:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #fbfcfc;
  --surface-2: #edf2f1;
  --panel: #ffffff;
  --line: #dfe7e5;
  --line-strong: #cbd7d4;
  --text: #16201d;
  --muted: #61706b;
  --muted-2: #879590;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #dff6f1;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --radius: 8px;
  --topnav-height: 0px;
  --sidebar-width: 210px;
}

* { box-sizing: border-box; }
html { min-width: 0; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topnav-height) minmax(calc(100vh - var(--topnav-height)), auto);
  overflow-x: hidden;
  background:
    linear-gradient(180deg, #fbfcfc 0%, var(--bg) 46%, #eef3f2 100%);
  color: var(--text);
  font: 14px/1.45 "Manrope", "Aptos", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.auth-page {
  display: block;
  min-height: 100vh;
  background: linear-gradient(180deg, #ffffff 0%, #f7f7f8 100%);
}

.app-topnav {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topnav-height);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.topnav-logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topnav-mark {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--text);
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.topnav-search {
  width: min(260px, 26vw);
  min-width: 150px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted-2);
  font-size: 13px;
}

.search-kbd {
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.topnav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.topnav-links a {
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.topnav-links a:hover { color: var(--text); }

.topnav-account {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.account-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #22c55e);
}

.sidebar {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  height: calc(100vh - var(--topnav-height));
  position: sticky;
  top: var(--topnav-height);
  overflow-y: auto;
  padding: 16px 12px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 2px 18px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.sidebar-brand strong,
.sidebar-brand small { display: block; }
.sidebar-brand strong { font-size: 14px; line-height: 1.2; }
.sidebar-brand small { margin-top: 2px; color: var(--muted); font-size: 11.5px; font-weight: 700; }

.workspace-card {
  display: grid;
  gap: 2px;
  margin: 0 2px 14px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.workspace-card span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.workspace-card strong {
  color: var(--text);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.brand { font-weight: 700; font-size: 16px; margin: 4px 8px 18px; overflow-wrap: anywhere; }
.nav-groups,
nav { display: grid; gap: 12px; }

.nav-section {
  display: grid;
  gap: 4px;
}

.nav-section > span {
  padding: 0 9px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

nav a {
  display: flex;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

nav a.active,
nav a:hover {
  color: var(--text);
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
}

.main {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  width: 100%;
  max-width: none;
  padding: 28px 34px 56px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin-left: auto;
}

.operator-mode-card {
  display: flex;
  align-items: flex-start;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.operator-mode-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.operator-mode-toggle input {
  margin: 4px 0 0;
  accent-color: var(--accent);
}

.operator-mode-copy {
  display: grid;
  gap: 4px;
}

.operator-mode-copy strong {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.3;
}

.operator-mode-copy small {
  max-width: 280px;
  color: var(--muted);
  line-height: 1.4;
}

h1,
h2 { margin: 0; letter-spacing: 0; color: var(--text); }
h1 { font-size: 26px; line-height: 1.2; font-weight: 750; }
h2 { font-size: 15px; line-height: 1.3; font-weight: 700; }
p { color: var(--muted); margin: 5px 0 0; }

.status-stack {
  display: grid;
  gap: 6px;
  justify-items: end;
  max-width: 100%;
}

.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.live-status { font-size: 12px; }
.session-card { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.view { display: none; }
.view.active { display: block; }

.ops-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 14px;
  margin-bottom: 14px;
}

.ops-hero-main,
.readout-card,
.connection-card,
.setup-strip {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 16px 36px rgba(19, 32, 29, 0.06);
}

.ops-hero-main {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.ops-hero-main::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--ok);
}

.ops-hero[data-state="warning"] .ops-hero-main::before { background: var(--warning); }
.ops-hero[data-state="critical"] .ops-hero-main::before { background: var(--danger); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ops-hero h2 {
  margin-top: 14px;
  max-width: 760px;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
}

.ops-hero p {
  max-width: 680px;
  margin-top: 12px;
  font-size: 15px;
}

.ops-action {
  display: grid;
  gap: 3px;
  margin-top: 22px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.ops-action span,
.readout-card span,
.connection-card span,
.setup-strip span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ops-action strong { font-size: 16px; }
.ops-action small { color: var(--muted); overflow-wrap: anywhere; }

.ops-readout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.readout-card {
  display: grid;
  gap: 8px;
  padding: 15px;
}

.readout-card strong {
  font-size: 22px;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.readout-card small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.connection-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.connection-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 13px 14px;
  position: relative;
  overflow: hidden;
}

.connection-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-strong);
}

.connection-card[data-state="normal"]::before { background: var(--ok); }
.connection-card[data-state="warning"]::before { background: var(--warning); }
.connection-card[data-state="critical"]::before { background: var(--danger); }

.connection-card strong { overflow-wrap: anywhere; }
.connection-card small {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.setup-strip {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 1fr;
  gap: 0;
  margin-bottom: 14px;
  overflow: hidden;
}

.setup-strip div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 13px 14px;
  border-right: 1px solid var(--line);
}

.setup-strip div:last-child { border-right: 0; }
.setup-strip strong { overflow-wrap: anywhere; }

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric,
.operator-card,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric { padding: 14px; }

.metric span,
.operator-card span {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
  line-height: 1.1;
  font-weight: 750;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.operator-card { padding: 14px; }
.operator-card strong {
  display: block;
  margin-top: 7px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.15;
  font-weight: 750;
}

.operator-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.ops-clarity-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 12px;
}

.action-list,
.alert-list,
.mcp-grid,
.provider-health-grid {
  display: grid;
  gap: 10px;
}

.action-item,
.alert-item,
.mcp-card,
.provider-card {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 11px 12px 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.action-item::before,
.alert-item::before,
.mcp-card::before,
.provider-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--line-strong);
}

.action-item[data-state="normal"]::before,
.alert-item[data-state="normal"]::before,
.mcp-card[data-state="normal"]::before,
.provider-card[data-state="normal"]::before { background: var(--ok); }
.action-item[data-state="warning"]::before,
.alert-item[data-state="warning"]::before,
.mcp-card[data-state="warning"]::before,
.provider-card[data-state="warning"]::before { background: var(--warning); }
.action-item[data-state="critical"]::before,
.alert-item[data-state="critical"]::before,
.mcp-card[data-state="critical"]::before,
.provider-card[data-state="critical"]::before { background: var(--danger); }

.action-item strong,
.alert-item strong,
.mcp-card strong,
.provider-card strong { font-size: 13.5px; overflow-wrap: anywhere; }
.action-item small,
.alert-item small,
.alert-item span,
.mcp-card small,
.mcp-card span,
.provider-card small,
.provider-card span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

.mcp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.provider-health-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.alert-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.alert-actions button {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.alert-actions button:hover {
  border-color: var(--line-strong);
  background: var(--surface-2);
}

.degraded-banner {
  margin-bottom: 12px;
  padding: 11px 13px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: #991b1b;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.hidden { display: none; }

.panel {
  padding: 14px;
  margin-bottom: 12px;
  overflow-x: auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.action-toast {
  position: sticky;
  top: 14px;
  z-index: 30;
  margin: 0 18px 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(22, 32, 29, 0.08);
  font-weight: 650;
}

.action-toast[data-state="normal"] {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--ok);
}

.action-toast[data-state="warning"] {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--warning);
}

.action-toast[data-state="critical"] {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 12px;
}

table {
  width: 100%;
  min-width: 720px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  border-spacing: 0;
  border-collapse: separate;
  overflow: hidden;
  background: #ffffff;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  overflow-wrap: anywhere;
  font-size: 13px;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
}

tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fcfcfd; }

button,
input,
select,
textarea {
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #a5b4fc;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  color: var(--text);
  padding: 7px 12px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

button:hover,
.link-button:hover {
  background: var(--surface-2);
  border-color: #cfcfd6;
}

button[type="submit"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

button[type="submit"]:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
label { min-width: 0; color: var(--text); font-size: 13px; font-weight: 600; }
textarea { width: 100%; resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}

.form-grid.wide { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.form-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .wide-field { grid-column: 1 / -1; }

.note-block {
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.note-block strong {
  font-size: 13px;
}

.note-block small {
  color: var(--muted);
  line-height: 1.5;
}

.compact-doc-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.compact-doc-card {
  min-width: 0;
}

.compact-doc-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.free-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.model-lane-grid,
.routing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.lane-card,
.routing-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.lane-card[data-state="warning"] {
  border-color: #fde68a;
  background: #fffdf3;
}

.lane-card[data-state="normal"] {
  border-color: #bbf7d0;
  background: #f8fffb;
}

.lane-card span,
.routing-card span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lane-card strong,
.routing-card strong {
  color: var(--text);
  font-size: 15px;
}

.lane-card small,
.routing-card small {
  color: var(--muted);
  line-height: 1.5;
}

.lane-model-list {
  display: grid;
  gap: 8px;
}

.lane-model {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.lane-model strong {
  font-size: 13px;
}

.lane-model small,
.lane-model span {
  color: var(--muted);
  font-size: 12px;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chips button {
  border-radius: 999px;
  padding: 6px 12px;
}

.filter-chips button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.system-details {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.modal-advanced-details {
  margin-top: 4px;
}

.system-details > summary {
  padding: 12px 14px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.system-details[open] > summary {
  border-bottom: 1px solid var(--line);
}

.free-model-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.free-model-card[data-state="normal"] {
  border-color: #bbf7d0;
  background: #f8fffb;
}

.free-model-card[data-state="warning"] {
  border-color: #fde68a;
  background: #fffdf3;
}

.free-model-card span {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.free-model-card strong {
  font-size: 15px;
  color: var(--text);
}

.free-model-card small,
.free-model-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.free-model-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted-2);
  font-size: 12px;
}

.journey-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0 0;
}

.journey-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, var(--surface) 100%);
}

.journey-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.journey-card strong {
  color: var(--text);
  font-size: 15px;
}

.journey-card small {
  color: var(--muted);
  line-height: 1.5;
}

.journey-card .link-button {
  width: fit-content;
  margin-top: 4px;
}

.connection-legend,
.visual-chip-wrap,
.version-meta-row,
.zed-key-route-map {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.connection-legend {
  margin: 12px 0 14px;
}

.legend-chip,
.visual-chip,
.stage-pill,
.provider-pill,
.basket-flow-badge,
.key-route-badge,
.version-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.stage-pill {
  margin-bottom: 4px;
}

.stage-pill[data-tone="start"] {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.stage-pill[data-tone="work"] {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.stage-pill[data-tone="reserve"] {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.stage-pill[data-tone="disabled"] {
  border-color: #d1d5db;
  background: #f3f4f6;
  color: #4b5563;
}

.legend-chip[data-tone="live"],
.version-card[data-tone="live"] .version-state,
.key-route-card[data-tone="live"] .key-route-badge,
.basket-flow-card[data-tone="live"] .basket-flow-badge,
.provider-pill.provider-live {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.legend-chip[data-tone="basket"],
.version-card[data-tone="basket"] .version-state,
.key-route-card[data-tone="basket"] .key-route-badge,
.basket-flow-card[data-tone="basket"] .basket-flow-badge,
.provider-pill.provider-basket {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.legend-chip[data-tone="orphan"],
.version-card[data-tone="orphan"] .version-state {
  border-color: #fde68a;
  background: #fffbeb;
  color: #a16207;
}

.legend-chip[data-tone="offline"],
.version-card[data-tone="offline"] .version-state,
.key-route-card[data-tone="offline"] .key-route-badge,
.provider-pill.provider-neutral {
  border-color: #d1d5db;
  background: #f3f4f6;
  color: #4b5563;
}

.provider-pill.provider-strong {
  border-color: #e9d5ff;
  background: #faf5ff;
  color: #7e22ce;
}

.provider-pill.provider-premium {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #c2410c;
}

.version-connection-map,
.basket-flow-map,
.zed-key-route-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.version-card,
.basket-flow-card,
.key-route-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.version-card[data-tone="live"],
.key-route-card[data-tone="live"],
.basket-flow-card[data-tone="live"] {
  border-color: #86efac;
  background: linear-gradient(180deg, #f9fffb 0%, #effcf3 100%);
}

.version-card[data-tone="basket"],
.key-route-card[data-tone="basket"],
.basket-flow-card[data-tone="basket"] {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #fbfdff 0%, #eef6ff 100%);
}

.version-card[data-tone="orphan"] {
  border-color: #fde68a;
  background: linear-gradient(180deg, #fffef8 0%, #fff8dd 100%);
}

.version-card[data-tone="offline"],
.key-route-card[data-tone="offline"] {
  border-color: #d1d5db;
  background: linear-gradient(180deg, #ffffff 0%, #f4f5f7 100%);
}

.basket-flow-card[data-tone="active-key"] {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
}

.basket-flow-card[data-tone="idle"] {
  border-color: #e5e7eb;
  background: #ffffff;
}

.version-card-head,
.basket-flow-head,
.key-route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.version-card strong,
.basket-flow-card strong,
.key-route-card strong {
  color: var(--text);
  font-size: 15px;
}

.version-card small,
.basket-flow-card small,
.key-route-card small {
  color: var(--muted);
  line-height: 1.5;
}

.version-block {
  display: grid;
  gap: 6px;
}

.version-block > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.visual-chip {
  background: #ffffff;
  color: var(--text);
}

.visual-chip.is-empty {
  color: var(--muted-2);
  background: var(--surface);
}

.role-chip {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.transport-chip {
  border-color: #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
}

.cost-chip {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.model-chip {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.key-chip {
  border-color: #d8b4fe;
  background: #faf5ff;
  color: #7e22ce;
}

.path-link,
.flow-lane {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.path-node,
.flow-node {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.path-node.key-node,
.flow-node.key-node {
  border-color: #d8b4fe;
  background: #faf5ff;
  color: #7e22ce;
}

.path-node.basket-node,
.flow-node.basket-node {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.path-node.model-node,
.flow-node.model-node {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.path-arrow,
.flow-arrow {
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 800;
}

.empty-visual-state {
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}

.zed-setup-grid {
  margin-top: 8px;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.scope-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.scope-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.scope-card strong {
  color: var(--text);
  font-size: 14px;
}

.scope-card small {
  color: var(--muted);
  line-height: 1.5;
}

.scope-card[data-tone="accent"] {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.scope-card[data-tone="neutral"] {
  border-color: #e5e7eb;
  background: #f8fafc;
}

.zed-hero-panel {
  display: grid;
  gap: 12px;
}

.modal {
  width: min(820px, calc(100vw - 32px));
  max-width: 820px;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
}

.modal-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.18);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
}

.modal-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.troubleshooting-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.troubleshooting-item small {
  color: var(--muted-2);
}

.troubleshooting-item span {
  color: var(--text);
}
.form-grid label,
.stack label { display: grid; gap: 6px; }
.stack { display: grid; gap: 10px; }

.bars { display: grid; gap: 10px; }
.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}

.bar-track {
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}

.bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #22c55e); }
.danger { color: var(--danger); font-weight: 700; }

pre {
  max-height: 480px;
  margin: 12px 0 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #18181b;
  color: #f8fafc;
  padding: 12px;
  white-space: pre-wrap;
}

.note { margin-top: 12px; color: var(--muted); font-size: 13px; }
.policy-note {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

code,
.mono {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 1px 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.doc-card ul,
.doc-card ol {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.doc-card strong { color: var(--text); }
.callout {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 440px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(24, 24, 27, 0.08);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--text);
  font-weight: 750;
}

.login-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-bottom: 12px;
  padding: 3px 9px;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.connection-list {
  display: grid;
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

@media (max-width: 900px) {
  .scope-grid,
  .doc-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .modal-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.connection-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.connection-list div:last-child { border-bottom: 0; }

.connection-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.connection-list strong { overflow-wrap: anywhere; }

.form-error {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: #991b1b;
  font-weight: 600;
}

.basket-plan-grid {
  margin-top: 12px;
}

.basket-model-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 6px 6px 0;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

#basket-model-select {
  min-height: 180px;
}

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .operator-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-hero { grid-template-columns: 1fr; }
  .ops-clarity-grid { grid-template-columns: 1fr; }
  .connection-board { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .provider-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-two,
  .doc-grid { grid-template-columns: 1fr; }
  .setup-strip { grid-template-columns: 1fr; }
  .setup-strip div { border-right: 0; border-bottom: 1px solid var(--line); }
  .setup-strip div:last-child { border-bottom: 0; }
  .form-grid,
  .form-grid.wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  body { display: block; }
  .app-topnav { position: sticky; }
  .topnav-search,
  .topnav-links { display: none; }
  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav-section { align-content: start; }
  .main { width: 100%; padding: 20px 14px 40px; }
  .topbar { flex-direction: column; }
  .topbar-actions { margin-left: 0; }
  .status-stack { justify-items: start; }
  .session-card { justify-content: flex-start; }
  .metrics,
  .operator-grid,
  .ops-readout,
  .connection-board,
  .ops-clarity-grid,
  .provider-health-grid,
  .grid-two,
  .form-grid,
  .form-grid.wide,
  .form-grid.compact,
  .doc-grid { grid-template-columns: 1fr; }
  table { min-width: 640px; }
}

@media (max-width: 560px) {
  .app-topnav { gap: 10px; padding: 0 12px; }
  .topnav-mark { font-size: 13px; }
  .topnav-account { max-width: 58vw; overflow: hidden; text-overflow: ellipsis; }
  h1 { font-size: 23px; }
}

@media (max-width: 480px) {
  .topnav-logo { font-size: 0; }
  nav { grid-template-columns: 1fr; }
}
