@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ==========================================================================
   Design tokens
   Solid surfaces, hairline borders, layered soft shadows, one accent colour.
   Nothing translucent: glass blur made every screen read as busy.
   ========================================================================== */
:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-soft: #f6f9fc;
  --surface-sunken: #eef2f7;
  --ink: #0a2540;          /* headings */
  --text: #1a2b42;         /* body */
  --text-soft: #5a6b83;    /* secondary */
  --text-muted: #7a8ba3;   /* tertiary, labels */
  --border: #e3e8ee;
  --border-strong: #d3dbe5;

  --accent: #635bff;
  --accent-hover: #524bdb;
  --accent-soft: #f1f0ff;
  --accent-ring: rgba(99, 91, 255, 0.22);

  --green: #0e7c5a;
  --green-soft: #e6f5ef;
  --amber: #a95c00;
  --amber-soft: #fdf3e6;
  --red: #c1274f;
  --red-soft: #fdeef2;

  --ink-panel: #0a2540;    /* dark panels: code, chat, logs */
  --ink-panel-text: #d7e0ee;

  /* one spacing scale, so gaps stop being ad-hoc */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;

  --shadow-sm: 0 1px 1px rgba(10, 37, 64, 0.04), 0 2px 5px rgba(10, 37, 64, 0.04);
  --shadow: 0 1px 1px rgba(10, 37, 64, 0.04), 0 6px 14px -6px rgba(10, 37, 64, 0.12);
  --shadow-lg: 0 2px 4px rgba(10, 37, 64, 0.06), 0 24px 48px -16px rgba(10, 37, 64, 0.22);
  --ring: 0 0 0 3px var(--accent-ring);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { color: var(--ink); line-height: 1.2; }

/* One focus treatment for the whole app — keyboard navigation should never
   leave you guessing where you are. */
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-soft); }

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 60% at 50% -10%, #ffffff 0%, rgba(255,255,255,0) 60%),
    var(--bg);
}

.token-chip {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 0.8em;
  color: #fff;
}
.tc-blue { background: var(--accent); }
.tc-purple { background: #7a5af8; }
.tc-green { background: var(--green); }
.tc-pink { background: #be185d; }
.tc-amber { background: var(--amber); }

/* --- surfaces --------------------------------------------------------- */
.glass,
.feature, .step, .landing-col,
.deploy-card, .modal, .auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  font-family: inherit;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.2;
  padding: 0.62em 1.1em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.12s ease, border-color 0.12s ease,
              box-shadow 0.12s ease, color 0.12s ease;
}
.btn:hover { background: var(--surface-soft); border-color: #c3cddb; }
.btn:active { background: var(--surface-sunken); box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border-strong); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 1px 1px rgba(10, 37, 64, 0.06), 0 2px 5px rgba(99, 91, 255, 0.22);
}
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-primary:active { background: #463fc4; }
.btn-primary:disabled:hover { background: var(--accent); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--text-soft);
}
.btn-ghost:hover { background: var(--surface-sunken); border-color: transparent; color: var(--ink); }

.btn-danger {
  background: var(--surface);
  color: var(--red);
  border-color: #f0c9d4;
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover { background: var(--red-soft); border-color: #e5a9ba; }

.btn-sm { padding: 0.4em 0.75em; font-size: 0.78rem; }

/* ==========================================================================
   Form controls
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-soft);
}

.input, .select {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 0.6em 0.8em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input::placeholder { color: var(--text-muted); }
.input:hover, .select:hover { border-color: #c3cddb; }
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}
select.input, .select { cursor: pointer; }

/* ==========================================================================
   Landing
   ========================================================================== */
.hero { padding: var(--s8) var(--s5) var(--s6); text-align: center; }
.hero h1 {
  font-size: clamp(2.2rem, 5.5vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
  max-width: 860px;
  margin: 0 auto var(--s5);
}
.hero .sub {
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: var(--text-soft);
  max-width: 620px;
  margin: 0 auto var(--s6);
}
.hero .actions { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }
.hero .actions .btn { padding: 0.72em 1.4em; font-size: 0.95rem; }
.hero .typing {
  display: inline-block;
  border-right: 3px solid var(--accent);
  padding-right: 4px;
  animation: blink 0.9s step-end infinite;
}
@keyframes blink { 50% { border-color: transparent; } }

.hero-shot { max-width: 920px; margin: var(--s2) auto 0; padding: 0 var(--s5); }
.hero-shot img {
  width: 100%;
  display: block;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.landing-section { max-width: 960px; margin: 0 auto; padding: var(--s8) var(--s5) 0; text-align: center; }
.landing-section h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--s2);
}
.landing-sub { color: var(--text-soft); max-width: 600px; margin: 0 auto var(--s6); }

.feature-grid, .steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); text-align: left; }
.feature, .step, .landing-col { padding: var(--s5); }
.feature svg { width: 22px; height: 22px; color: var(--accent); margin-bottom: var(--s3); }
.feature h3, .step h3, .landing-col h3 { font-size: 0.98rem; font-weight: 600; margin-bottom: var(--s1); }
.feature p, .step p, .landing-col p { font-size: 0.875rem; color: var(--text-soft); }
.feature code, .install-note code, .hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--surface-sunken);
  padding: 1px 5px;
  border-radius: 4px;
}

.step-num {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem; font-weight: 600;
  margin-bottom: var(--s3);
}

.landing-cols { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); text-align: left; }

.landing-cta { max-width: 960px; margin: var(--s8) auto 0; padding: var(--s7) var(--s5); text-align: center; }
.landing-cta h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: var(--s2); }
.landing-cta p { color: var(--text-soft); margin-bottom: var(--s5); }

.landing-install { max-width: 960px; margin: var(--s8) auto 0; padding: 0 var(--s5); text-align: center; }
.landing-install h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: var(--s2); }
.install-box {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--ink-panel);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  max-width: 760px;
  margin: 0 auto var(--s3);
  box-shadow: var(--shadow);
}
.install-cmd {
  flex: 1; min-width: 0; text-align: left;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.84rem;
  color: var(--ink-panel-text);
  overflow-x: auto;
  white-space: nowrap;
}
.install-copy {
  flex: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.18);
  box-shadow: none;
  font-size: 0.8rem;
  padding: 0.45em 0.9em;
}
.install-copy:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.28); }
.install-note { font-size: 0.875rem; color: var(--text-soft); }

/* --- router benchmark ------------------------------------------------- */
.bench {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--s3);
  text-align: left; align-items: stretch;
}
/* grid and flex children default to min-width:auto, so a nowrap cell or a
   long command widens the whole page past the phone and gets clipped */
.bench > * { min-width: 0; }
.bench-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}
.bench-table { width: 100%; height: 100%; border-collapse: collapse; font-size: 0.9rem; }
.bench-table th {
  text-align: left; font-weight: 500; font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
}
.bench-table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.bench-table tr:last-child td { border-bottom: none; }
.bench-table th:not(:first-child), .bench-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.bench-hl td { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.bench-note { display: block; font-size: 0.75rem; font-weight: 400; color: var(--text-soft); }

.bench-facts { display: grid; gap: var(--s3); }
.bench-fact {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s4) var(--s5);
  display: flex; flex-direction: column; gap: var(--s1);
}
.bench-fact b {
  font-size: 1.9rem; font-weight: 700; letter-spacing: -0.03em;
  color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.1;
}
.bench-fact span { font-size: 0.85rem; color: var(--text-soft); line-height: 1.45; }
/* the negative result gets the same weight as the positive one, on purpose */
.bench-fact-neg b { color: var(--red); }

.bench-caveat {
  max-width: 720px; margin: var(--s4) auto 0;
  font-size: 0.85rem; color: var(--text-muted);
}
.bench-caveat a { color: var(--accent); text-decoration: none; font-weight: 500; }
.bench-caveat a:hover { text-decoration: underline; }

/* ==========================================================================
   Auth
   ========================================================================== */
.auth-wrap { min-height: 88vh; display: grid; place-items: center; padding: var(--s5); }
.auth-card { width: 100%; max-width: 400px; padding: var(--s6); box-shadow: var(--shadow); }
.auth-card h2 { font-size: 1.4rem; letter-spacing: -0.02em; margin-bottom: var(--s1); }
.auth-card > p { color: var(--text-soft); font-size: 0.9rem; margin-bottom: var(--s5); }
.auth-card .field { margin-bottom: var(--s4); text-align: left; }
.auth-card .btn { width: 100%; }
.auth-card .btn-primary { margin-top: var(--s2); padding: 0.7em 1.1em; }
.auth-card .btn-ghost { margin-top: var(--s2); }

/* ==========================================================================
   Shell: nav + dashboard
   ========================================================================== */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nav .logo {
  font-weight: 600; font-size: 1.02rem; letter-spacing: -0.02em;
  color: var(--ink);
  display: inline-flex; align-items: center; gap: var(--s2);
}
.logo-mark { width: 26px; height: 26px; border-radius: var(--r-sm); display: block; }
.nav-right { display: flex; align-items: center; gap: var(--s2); }
.nav > div { display: flex; align-items: center; gap: var(--s2); }
.nav-user { font-size: 0.85rem; color: var(--text-muted); }

.dash { max-width: 1080px; margin: 0 auto; padding: var(--s6) var(--s5) var(--s8); }

.update-banner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  background: var(--amber-soft);
  border: 1px solid #f0dcc0;
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s5);
  color: #7a4400;
  font-size: 0.875rem;
}
.update-btn { flex: none; }
.update-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.dash-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4); flex-wrap: wrap;
  margin-bottom: var(--s5);
  border-bottom: 1px solid var(--border);
}
.dash-head h2 { font-size: 1.5rem; letter-spacing: -0.025em; }
.dash-head > div:last-child { display: flex; gap: var(--s2); padding-bottom: var(--s3); }

/* Underlined tabs rather than filled pills: four solid blue blocks in a row
   was the loudest thing on the screen and none of it was the content. */
.dash-tabs { display: flex; gap: var(--s5); }
.dash-tab {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.9rem; font-weight: 500; color: var(--text-soft);
  padding: var(--s2) 0 var(--s3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.dash-tab:hover { color: var(--ink); }
.dash-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.sursum-grid { display: grid; gap: var(--s3); }

/* ==========================================================================
   Deploy cards
   ========================================================================== */
.deploy-card {
  padding: var(--s5);
  display: flex; flex-direction: column; gap: var(--s3);
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.deploy-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
/* pool cards have no click-through; only their buttons act */
.pool-card { cursor: default; }
.deploy-card .meta em { font-style: normal; color: var(--red); }
.deploy-card .row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.deploy-card .row .url { flex: 1; min-width: 0; }
.deploy-card .model { font-weight: 600; font-size: 1.05rem; color: var(--ink); letter-spacing: -0.015em; }
.deploy-card .meta { font-size: 0.82rem; color: var(--text-muted); }
.deploy-card .url,
.url {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  padding: 0.5em 0.7em;
  border-radius: var(--r-sm);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.status { display: inline-flex; align-items: center; gap: var(--s2); font-weight: 500; font-size: 0.82rem; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.status.healthy { color: var(--green); }
.status.healthy .dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status.pending, .status.checking, .status.provisioning, .status.redeploying { color: var(--amber); }
.status.pending .dot, .status.checking .dot,
.status.provisioning .dot, .status.redeploying .dot {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
  animation: pulse 1.4s ease-in-out infinite;
}
.status.failed { color: var(--red); }
.status.failed .dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
@keyframes pulse { 50% { opacity: 0.4; } }

.preflight { display: flex; flex-direction: column; gap: var(--s1); font-size: 0.82rem; }
.preflight-item { display: flex; align-items: center; gap: var(--s2); }
.preflight-item.ok { color: var(--green); }
.preflight-item.bad { color: var(--red); }

.card-actions { display: flex; gap: var(--s2); flex-wrap: wrap; }
.card-actions .btn { padding: 0.45em 0.9em; font-size: 0.82rem; }

.empty {
  text-align: center;
  padding: var(--s8) var(--s5);
  color: var(--text-soft);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}
.empty h3 { font-size: 1.15rem; margin-bottom: var(--s2); letter-spacing: -0.02em; }

/* ==========================================================================
   Modal
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 37, 64, 0.32);
  display: grid; place-items: center;
  padding: var(--s5);
  overflow-y: auto;
  animation: fade 0.14s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal {
  width: 100%; max-width: 620px;
  max-height: calc(100vh - 48px);
  padding: var(--s6);
  overflow-y: auto;
  overscroll-behavior: contain;
  box-shadow: var(--shadow-lg);
  animation: rise 0.16s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.modal h3 { font-size: 1.2rem; letter-spacing: -0.02em; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.modal-sub { font-size: 0.85rem; color: var(--text-soft); margin-top: var(--s1); }
.modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--text-muted);
  width: 28px; height: 28px; flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-sm); line-height: 1;
}
.modal-close:hover { background: var(--surface-sunken); color: var(--ink); }

.sec { margin-bottom: var(--s5); }
.sec-head { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.sec-num {
  width: 20px; height: 20px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem; font-weight: 600;
}
.sec-title { font-size: 0.9rem; font-weight: 600; color: var(--ink); }

.runtime-note {
  font-size: 0.85rem;
  color: var(--text-soft);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
}

.advanced {
  margin-bottom: var(--s5);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
}
.advanced summary {
  cursor: pointer;
  font-size: 0.875rem; font-weight: 500;
  color: var(--text-soft);
  user-select: none; list-style: none;
}
.advanced summary:hover { color: var(--ink); }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "▸ "; color: var(--text-muted); }
.advanced[open] summary::before { content: "▾ "; }
.advanced[open] .sec { margin-top: var(--s4); }
.advanced[open] .sec:last-child { margin-bottom: var(--s2); }

/* ==========================================================================
   Selectable cards (runtime / target / provider / model)
   One selected treatment everywhere: accent border + tinted ground.
   No hover lift — a page where everything jumps reads as restless.
   ========================================================================== */
.runtime-cards, .target-cards { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.runtime-card, .target-card, .provider {
  position: relative;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.runtime-card:hover, .target-card:hover:not(.disabled), .provider:hover {
  border-color: #c3cddb;
  background: var(--surface-soft);
}
.runtime-card.active, .target-card.active, .provider.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: var(--ring);
}
.target-card.disabled { opacity: 0.5; cursor: not-allowed; }

.runtime-card { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s1); padding: var(--s4); }
.rlogo { width: 30px; height: 30px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); margin-bottom: var(--s1); }
.rname { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.rdesc { font-size: 0.78rem; color: var(--text-soft); line-height: 1.4; }
.rtag {
  margin-top: var(--s1);
  font-size: 0.7rem; font-weight: 500;
  color: var(--text-soft);
  background: var(--surface-sunken);
  border-radius: 999px;
  padding: 2px 8px;
}
.runtime-card.active .rtag { background: rgba(99,91,255,0.12); color: var(--accent); }

.target-card { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); }
.tname { font-weight: 600; font-size: 0.92rem; color: var(--ink); }
.tdesc { font-size: 0.78rem; color: var(--text-soft); }
.soon-badge {
  position: absolute; top: 10px; right: 12px;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-soft);
  border-radius: var(--r-sm);
  padding: 2px 7px;
}

.providers { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.provider { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); }
.plogo {
  width: 30px; height: 30px; flex: none;
  border-radius: var(--r-sm);
  object-fit: cover;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 0.95rem;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
}
.pl-custom { background: linear-gradient(135deg, #8b8b96, #5b5b66); border-color: transparent; }
.pname { font-weight: 500; font-size: 0.88rem; color: var(--ink); }

.provider-models { margin-top: var(--s2); }
.model-list-static { display: flex; flex-direction: column; gap: var(--s1); }
.model-static {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: 0.6em 0.8em;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 0.85rem; font-weight: 500;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.model-static:hover { background: var(--surface-soft); border-color: var(--border-strong); }
.model-static.selected { border-color: var(--accent); background: var(--accent-soft); }
.pmd { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmd-side { display: flex; align-items: center; gap: var(--s2); flex: none; }
.pmd-tag {
  font-size: 0.7rem; font-weight: 500;
  color: var(--text-soft);
  background: var(--surface-sunken);
  border-radius: 999px; padding: 2px 8px;
  white-space: nowrap;
}
.model-static.selected .pmd-tag { background: rgba(99,91,255,0.12); color: var(--accent); }
/* the tick marks the chosen model — on every row it marked nothing */
.pmd-check { color: var(--accent); font-weight: 700; visibility: hidden; }
.model-static.selected .pmd-check { visibility: visible; }

.hint { font-size: 0.78rem; color: var(--text-muted); }
.opt { font-weight: 400; color: var(--text-muted); }

/* --- config grid ------------------------------------------------------ */
.cfg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.hf-field { margin-top: var(--s3); }
.modal .fields { display: flex; flex-direction: column; gap: var(--s4); margin-bottom: var(--s5); }
/* modals that list .field directly (the pool modal) get the same rhythm */
.modal > .field { margin-bottom: var(--s4); }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--r); }
.seg .seg-btn {
  flex: 1;
  padding: 0.42em 0.9em;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  font-family: inherit; font-size: 0.85rem; font-weight: 500;
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.seg .seg-btn:hover { color: var(--ink); }
.seg .seg-btn.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.progress { margin-top: var(--s2); display: flex; align-items: center; gap: var(--s2); font-size: 0.875rem; color: var(--text-soft); }
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--surface-sunken);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==========================================================================
   Pools + chat
   ========================================================================== */
.pool-models { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }
.pool-model-row { display: flex; gap: var(--s2); align-items: center; }
.pool-model-row select { flex: 1; }
.pool-model-remove { flex: none; }
.pool-add { align-self: flex-start; }

.chat-area { display: flex; flex-direction: column; gap: var(--s3); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.chat-pool-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.chat-pool-row label { font-size: 0.8rem; font-weight: 500; color: var(--text-soft); }
.chat-pool-row select { min-width: 220px; }
.chat-hint, .play-hint { color: var(--text-muted); font-size: 0.8rem; }

.chat-api-row {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: var(--s2) var(--s3);
}
.chat-api-url {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem; color: var(--text-soft);
  overflow-x: auto; white-space: nowrap;
}
.chat-api-copy, .chat-api-del { flex: none; font-size: 0.78rem; padding: 0.4em 0.8em; }

.chat-messages, .play-messages {
  display: flex; flex-direction: column; gap: var(--s3);
  background: var(--ink-panel);
  border-radius: var(--r-lg);
  padding: var(--s4);
  min-height: 260px;
  max-height: 440px;
  overflow-y: auto;
}
.play-messages { min-height: 220px; max-height: 380px; }
.play-empty { color: #7c8ca4; font-size: 0.875rem; text-align: center; margin: auto; }

.chat-input-row, .play-input-row { display: flex; gap: var(--s2); align-items: stretch; }
.chat-input-row .btn, .play-input-row .btn { flex: none; }
.play-input { flex: 1; resize: none; font-family: inherit; }
.play-input:disabled, #playSend:disabled, #chatSend:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- messages --------------------------------------------------------- */
.msg { display: flex; flex-direction: column; gap: var(--s1); max-width: 85%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .role, .msg .who {
  font-size: 0.66rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: #7c8ca4;
}
.msg .content, .msg .body {
  font-size: 0.875rem; line-height: 1.55;
  color: #e4eaf3;
  white-space: pre-wrap; word-break: break-word;
  background: rgba(255,255,255,0.07);
  border-radius: var(--r);
  padding: 0.6em 0.8em;
}
.msg.user .content, .msg.user .body { background: var(--accent); color: #fff; }
.msg .content strong { color: #fff; font-weight: 600; }
.msg .md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82em;
  background: rgba(255,255,255,0.1); padding: 1px 5px; border-radius: 4px;
}
.msg .md-pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem;
  background: rgba(0,0,0,0.25); border-radius: var(--r-sm);
  padding: var(--s2) var(--s3); margin: var(--s1) 0;
  white-space: pre; overflow-x: auto;
}
/* an answer that has not started yet: a quiet pulse, not an empty grey bar */
.msg:not(.user) .content:empty::before {
  content: "thinking…";
  color: #7c8ca4; font-style: italic;
  animation: pulse 1.4s ease-in-out infinite;
}
.msg.error .content, .msg.error .body { color: #ffb4c4; background: rgba(193,39,79,0.18); }
.msg .think, .msg .body.think {
  font-size: 0.8rem; color: #93a3b8;
  background: none; padding: 0;
}
.msg details.think summary {
  cursor: pointer; user-select: none;
  font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em;
  color: #7c8ca4; list-style: none;
}
.msg details.think summary::-webkit-details-marker { display: none; }
.msg details.think summary::before { content: "▸ "; }
.msg details.think[open] summary::before { content: "▾ "; }
.msg details.think summary:hover { color: #b3c0d3; }
.msg .think-body {
  margin-top: var(--s1); font-style: italic;
  white-space: pre-wrap; word-break: break-word;
}
.msg .meta { font-size: 0.7rem; color: #6b7c95; }
.msg .route-tag {
  align-self: flex-start;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.03em;
  color: #a5b4ff;
  background: rgba(99,91,255,0.16);
  border-radius: var(--r-sm);
  padding: 2px 8px;
}
.msg .route-tag.strong { color: #fbbf24; background: rgba(251,191,36,0.14); }
.msg .route-tag.latched { color: #f9a8d4; background: rgba(244,114,182,0.14); }

/* --- playground extras ------------------------------------------------ */
.play-area { display: flex; flex-direction: column; gap: var(--s3); }
.play-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.play-clear { flex-shrink: 0; }
.play-attach-col { display: flex; flex-direction: column; gap: var(--s1); align-items: stretch; }
.play-attach { white-space: nowrap; }
.play-attach:disabled { opacity: 0.4; cursor: not-allowed; }
.play-image-preview { position: relative; }
.play-image-preview img {
  max-width: 110px; max-height: 84px;
  border-radius: var(--r-sm); object-fit: cover;
  border: 1px solid var(--border); display: block;
}
.play-image-remove {
  position: absolute; top: -6px; right: -6px;
  width: 18px; height: 18px;
  border-radius: 50%; border: none; cursor: pointer; line-height: 1;
  background: var(--red); color: #fff; font-size: 0.65rem;
}
.play-image { margin-top: var(--s2); }
.play-image img { max-width: 220px; max-height: 220px; border-radius: var(--r); display: block; }

/* ==========================================================================
   Detail modal: tabs, snippets, logs
   ========================================================================== */
.detail-modal { max-width: 680px; }
.logs-modal { max-width: 760px; }
.detail-head, .logs-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s4); margin-bottom: var(--s4);
}
.detail-head h3 { font-size: 1.2rem; letter-spacing: -0.02em; }
.detail-sub { font-size: 0.85rem; color: var(--text-soft); margin-top: var(--s1); }
.logs-actions { display: flex; gap: var(--s2); }

.tabs {
  display: flex; gap: var(--s5);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s5);
}
.tab {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.875rem; font-weight: 500; color: var(--text-soft);
  padding: var(--s2) 0 var(--s3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.kv-row { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.kv-row .url { flex: 1; min-width: 0; }
.kv-label { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }

.code-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-sunken); border-radius: var(--r); margin-bottom: var(--s3); }
.code-tab {
  background: none; border: none; cursor: pointer; font-family: inherit;
  font-size: 0.8rem; font-weight: 500; color: var(--text-soft);
  padding: 0.38em 0.85em; border-radius: var(--r-sm);
  transition: background 0.12s ease, color 0.12s ease;
}
.code-tab:hover { color: var(--ink); }
.code-tab.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }

.code-block-wrap { position: relative; }
.code-block, .logs-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; line-height: 1.6;
  background: var(--ink-panel);
  color: var(--ink-panel-text);
  border-radius: var(--r);
  padding: var(--s4);
  overflow: auto;
}
.code-block { max-height: 340px; white-space: pre; word-break: normal; }
.logs-content { max-height: 55vh; white-space: pre-wrap; word-break: break-word; }
.code-copy {
  position: absolute; top: var(--s2); right: var(--s2);
  font-family: inherit; font-size: 0.72rem; font-weight: 500; cursor: pointer;
  background: rgba(255,255,255,0.1); color: var(--ink-panel-text);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--r-sm); padding: 3px 9px;
  transition: background 0.12s ease;
}
.code-copy:hover { background: rgba(255,255,255,0.2); }

/* ==========================================================================
   Account API keys
   ========================================================================== */
.keys-intro { margin-bottom: var(--s5); color: var(--text-soft); font-size: 0.875rem; }
.keys-intro p { margin: 0 0 var(--s3); max-width: 62ch; }
.keys-base { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.keys-new { display: flex; gap: var(--s2); margin-bottom: var(--s4); }
.keys-new .input { flex: 1; }
.keys-empty {
  color: var(--text-soft); font-size: 0.875rem;
  padding: var(--s7) var(--s5); text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-lg);
}
.keys-list { display: flex; flex-direction: column; gap: var(--s2); }
.key-row {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  padding: var(--s3) var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.key-main { flex: 1; min-width: 200px; }
.key-name { font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.key-display {
  color: var(--text-muted); font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.key-meta { display: flex; flex-direction: column; gap: 1px; color: var(--text-muted); font-size: 0.74rem; }

/* shown once, right after minting — it never comes back */
.key-reveal {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--r);
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
}
.key-reveal-head { font-size: 0.82rem; font-weight: 600; color: var(--ink); margin-bottom: var(--s2); }
.key-reveal-row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.key-reveal-row code {
  flex: 1; min-width: 0; overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 0.45em 0.7em;
}

/* ==========================================================================
   Metrics
   ========================================================================== */
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2);
  margin-top: var(--s3); padding-top: var(--s4);
  border-top: 1px solid var(--border);
}
.metric {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--s2) var(--s3);
  display: flex; flex-direction: column; gap: 1px;
}
.metric span { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.metric b { font-size: 0.9rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.spark-row { display: flex; align-items: flex-end; gap: var(--s3); margin-top: var(--s3); }
.spark-label { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); flex: none; padding-bottom: 4px; }
.spark { width: 100%; height: 44px; display: block; }
/* the detail modal wraps the sparkline in a span; let it stretch like the card's */
#detailSpark { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: var(--s3); }
.spark-empty { flex: 1; text-align: center; color: var(--text-muted); font-size: 0.8rem; padding: var(--s3) 0; }
.spark-last { flex: none; font-weight: 600; font-size: 0.85rem; color: var(--accent); font-variant-numeric: tabular-nums; padding-bottom: 2px; }

/* ==========================================================================
   Misc
   ========================================================================== */
.hidden { display: none !important; }

.toast {
  position: fixed; bottom: var(--s5); left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink-panel); color: #fff;
  padding: 0.7em 1.1em;
  border-radius: var(--r);
  font-size: 0.875rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  .nav { padding: var(--s3) var(--s4); flex-wrap: wrap; gap: var(--s2); }
  .hero { padding: var(--s7) var(--s4) var(--s6); }
  .hero h1 { font-size: clamp(1.9rem, 8vw, 2.6rem); }
  .dash { padding: var(--s5) var(--s4) var(--s7); }
  .dash-head { flex-direction: column; align-items: stretch; gap: var(--s3); }
  .dash-tabs { gap: var(--s4); overflow-x: auto; scrollbar-width: none; }
  .dash-tabs::-webkit-scrollbar { display: none; }
  .dash-head > div:last-child { padding-bottom: var(--s3); }
  .dash-head > div:last-child .btn { flex: 1; }
  .modal .row2 { grid-template-columns: 1fr; }
  .deploy-card .row { flex-direction: column; align-items: flex-start; }
  .card-actions { width: 100%; }
  .card-actions .btn { flex: 1; }
  .providers { grid-template-columns: repeat(2, 1fr); }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .runtime-cards, .target-cards, .cfg-grid { grid-template-columns: 1fr; }
  .overlay { padding: var(--s3); }
  .modal { padding: var(--s5) var(--s4); max-height: calc(100vh - 24px); }
  .toast { width: 88%; text-align: center; }
  .feature-grid, .steps, .landing-cols, .bench { grid-template-columns: 1fr; }
  .msg { max-width: 94%; }
}

@media (max-width: 420px) {
  .providers { grid-template-columns: 1fr; }
  .model-static { flex-direction: column; align-items: flex-start; gap: var(--s1); }
  .model-static .pmd-check { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   Public site only (site/): nav links, pricing, footer
   ========================================================================== */
.site-links { display: flex; align-items: center; gap: var(--s1); }
.site-links a { text-decoration: none; }
a.btn { text-decoration: none; }

.plans {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4);
  max-width: 820px; margin: 0 auto; text-align: left;
}
.plans > * { min-width: 0; }
.plan {
  display: flex; flex-direction: column; gap: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--s6);
}
.plan-pro { border-color: var(--accent); box-shadow: var(--ring), var(--shadow); }
.plan-head h3 {
  font-size: 1.1rem; font-weight: 600;
  display: flex; align-items: center; gap: var(--s2);
}
.plan-soon {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 2px 8px;
}
.plan-price { display: flex; align-items: baseline; gap: var(--s2); margin-top: var(--s2); }
.plan-price b { font-size: 2.2rem; font-weight: 700; letter-spacing: -0.03em; color: var(--ink); }
.plan-price span { font-size: 0.85rem; color: var(--text-muted); }
.plan-list {
  list-style: none; display: flex; flex-direction: column; gap: var(--s2);
  font-size: 0.9rem; color: var(--text-soft); flex: 1;
}
.plan-list li { padding-left: 1.4em; position: relative; }
.plan-list li::before {
  content: "✓"; position: absolute; left: 0;
  color: var(--accent); font-weight: 700;
}
.plan-list strong { color: var(--ink); font-weight: 600; }
.plan-cta { width: 100%; }

.site-foot {
  display: flex; gap: var(--s5); justify-content: center; flex-wrap: wrap;
  margin: var(--s8) auto 0; padding: var(--s6) var(--s5);
  border-top: 1px solid var(--border);
  font-size: 0.85rem; color: var(--text-muted);
}
.site-foot a { color: var(--text-soft); text-decoration: none; }
.site-foot a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .plans { grid-template-columns: 1fr; }
  .site-links .btn-ghost { display: none; }
}

/* --- hero rotator ------------------------------------------------------ */
.rotator {
  display: inline-flex; align-items: center; gap: 0.25em;
  vertical-align: baseline;
}
.rotator-logo {
  width: 0.78em; height: 0.78em;
  border-radius: 0.18em;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border);
  animation: pop 0.4s ease;
}
.rotator-name {
  background: linear-gradient(95deg, var(--accent), #9b7bff 60%, var(--accent));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  white-space: nowrap;
}
.caret {
  display: inline-block; width: 3px; height: 0.9em;
  background: var(--accent); border-radius: 2px;
  animation: blink 1s step-end infinite;
}
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

/* the hero holds two lines whatever the model's name length */
.hero h1 { min-height: 2.2em; }

/* --- cards lift a little on the public site (not in the app) ----------- */
.feature, .step, .landing-col, .plan {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature:hover, .step:hover, .landing-col:hover, .plan:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.plan-pro:hover { box-shadow: var(--ring), var(--shadow-lg); }

/* --- sections fade in as they come into view --------------------------- */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.seen { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s ease; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal.seen { opacity: 1; transform: none; }
  .rotator-logo { animation: none; }
}
