/* KESTREL portal styles. Design language: Startwave (tokens from @startwave/tokens, values copied, not imported,
   because the portal has no build step). Light is the default; dark is opt-in (data-theme="dark" on <html>).
   Layout: a collections sidebar, then the prompt and the runs list in one centred column. */

@font-face {
  font-family: "Inter Variable";
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/InterVariable.woff2") format("woff2"); /* SIL OFL 1.1, see fonts/OFL.txt */
}

/* ---------------------------------------------------------------- tokens */
:root,
[data-theme="light"] {
  color-scheme: light;
  --font: "Inter Variable", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --canvas: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --l1: #1c1d20;
  --l2: #626467;
  --l3: #686a6e;
  --l4: #85878a;
  --fill-1: #eef1f5;
  --fill-2: #e6e9ed;
  --fill-3: #dadde1;
  --sep: #e1e4e8;
  --sep-strong: #c5c8cc;
  --edge: #e1e4e8;
  --green: #0a7a58;
  --green-mark: #0b9e74;
  --green-fill: #e6f7f1;
  --amber: #876000;
  --amber-fill: #fff3c2;
  --amber-dot: #f0ad00;
  --red: #a03e28;
  --red-fill: #f8e6db;
  --red-mark: #d0553a;
  --teal: #206860;
  --teal-fill: #dfede8;
  --accent: #0a5cff;
  --accent-hover: #0050e6;
  --accent-text: #0050e6;
  --accent-fill: #e8efff;
  --accent-fill-strong: #d1e0ff;
  --on-accent-fill: #0047d1;
  --danger: #c2452c;
  --danger-hover: #a63a24;
  --highlight: linear-gradient(100deg, #74ccff, #78eecb);
  --on-highlight: #0d1b22;
  --gradient: linear-gradient(120deg, #0a5cff, #38b6ff 50%, #3ee6b5);
  --glow: 0 6px 18px -6px rgb(10 92 255 / 0.55);
  --elev-1: 0 1px 2px rgb(0 0 0 / 0.04);
  --elev-2: 0 1px 2px rgb(0 0 0 / 0.08), 0 3px 10px -6px rgb(0 0 0 / 0.12);
  --elev-3: 0 16px 42px -16px rgb(0 0 0 / 0.22), 0 3px 10px -4px rgb(0 0 0 / 0.1);
  --elev-4: 0 30px 78px -22px rgb(0 0 0 / 0.32), 0 5px 18px -6px rgb(0 0 0 / 0.14);
  --scrim: rgb(15 23 42 / 0.28);
  --mist-1: rgb(10 92 255 / 0.1);
  --mist-2: rgb(56 182 255 / 0.1);
  --mist-3: rgb(62 230 181 / 0.07);
  --wash-top: #e2ecff;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 22px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #0b0d12;
  --surface: #15181e;
  --surface-2: #1b1f26;
  --l1: #f2f5fb;
  --l2: #b6b9be;
  --l3: #a9acb1;
  --l4: #7c7f84;
  --fill-1: #24262b;
  --fill-2: #2a2c31;
  --fill-3: #373a40;
  --sep: #2a2c31;
  --sep-strong: #45484e;
  --edge: #2a2c31;
  --green: #4fbf78;
  --green-mark: #4fbf78;
  --green-fill: #0f2e19;
  --amber: #ffd166;
  --amber-fill: #3a2f08;
  --amber-dot: #ffc93d;
  --red: #f2ae94;
  --red-fill: #4c332b;
  --red-mark: #f08a6c;
  --teal: #93cebc;
  --teal-fill: #263d35;
  --accent: #1f6bff;
  --accent-hover: #1a64f5;
  --accent-text: #7aaaff;
  --accent-fill: #172238;
  --accent-fill-strong: #1f2e4a;
  --on-accent-fill: #a8c6ff;
  --highlight: linear-gradient(100deg, #5ec2fb, #5fe3bd);
  --glow: 0 6px 18px -6px rgb(31 107 255 / 0.6);
  --elev-1: none;
  --elev-2: none;
  --elev-3: 0 14px 38px -10px rgb(0 0 0 / 0.4);
  --elev-4: 0 28px 72px -16px rgb(0 0 0 / 0.52);
  --scrim: rgb(0 0 0 / 0.55);
  --mist-1: rgb(10 92 255 / 0.22);
  --mist-2: rgb(56 182 255 / 0.12);
  --mist-3: rgb(62 230 181 / 0.08);
  --wash-top: #0f1626;
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; } /* components set display on classes; the attribute must still win */
html { background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 14px/1.5 var(--font);
  letter-spacing: -0.01em;
  color: var(--l1);
  background:
    radial-gradient(60% 55% at 12% -10%, var(--mist-1), transparent 70%),
    radial-gradient(45% 50% at 88% -6%, var(--mist-2), transparent 70%),
    radial-gradient(40% 40% at 55% 0%, var(--mist-3), transparent 75%),
    linear-gradient(180deg, var(--wash-top) 0, var(--canvas) 420px);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
  overflow-wrap: break-word;
}
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent-text); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon.s12 { width: 12px; height: 12px; }
.icon.s20 { width: 20px; height: 20px; }
.muted { color: var(--l2); }
.caption { font-size: 12px; line-height: 16px; font-weight: 450; color: var(--l2); }
.mono { font-family: var(--mono); font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px; padding: 20px 14px 14px 20px; min-width: 0; }
.logo { display: inline-flex; align-items: center; gap: 9px; padding: 2px 4px; color: var(--l1); text-decoration: none; border-radius: var(--r-md); }
.logo svg { width: 28px; height: 28px; flex: none; }
.logo rect { fill: var(--accent); }
.logo path { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.logo b { font-size: 20px; font-weight: 500; letter-spacing: -0.035em; }
.logo small { margin-left: 2px; font-size: 12px; font-weight: 450; letter-spacing: 0; color: var(--l3); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 0; }
.sidebar-head h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.015em; text-transform: uppercase; color: var(--l2); }
.sidebar-scrim { z-index: 44; }
.main { min-width: 0; padding: 18px 32px 64px; }
.column { max-width: 860px; margin: 0 auto; }
.foot-note { margin: 40px 0 0; text-align: center; font-size: 12px; color: var(--l3); }

/* ---------------------------------------------------------------- collections */
.collections { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 6px; align-content: start; overflow-y: auto; min-height: 0; flex: 1 1 auto; scrollbar-width: thin; }
.collection { border: 1px solid transparent; border-radius: var(--r-lg); transition: background 0.14s, border-color 0.14s; }
.collection:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.collection[data-selected="true"] { background: var(--surface); border-color: var(--edge); box-shadow: var(--elev-2); }

/* ---------------------------------------------------------------- prompt */
.hero { padding: 44px 0 8px; text-align: center; }
.hero h1 { margin: 0 0 26px; font-size: 44px; font-weight: 500; line-height: 1.05; letter-spacing: -0.055em; text-wrap: balance; }
.highlight { padding: 0 0.12em; margin-inline: -0.04em; border-radius: 0.08em; background: var(--highlight); color: var(--on-highlight); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.composer { position: relative; padding: 14px 14px 12px 18px; text-align: left; background: var(--surface); border: 1px solid var(--sep-strong); border-radius: var(--r-2xl); box-shadow: var(--elev-3); transition: border-color 0.14s, box-shadow 0.14s; }
.composer:focus-within { border-color: var(--accent); box-shadow: var(--elev-3), 0 0 0 4px var(--accent-fill); }
.composer[data-over="true"] { border-color: var(--red-mark); }
.composer textarea { display: block; width: 100%; min-height: 56px; max-height: 220px; padding: 4px 0; border: 0; outline: none; resize: none; background: transparent; font-size: 17px; line-height: 1.45; }
.composer textarea::placeholder { color: var(--l3); }
.composer-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.targets { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.send { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; box-shadow: var(--glow); cursor: pointer; }
.send:hover { background: var(--accent-hover); }
.send:disabled { background: var(--fill-3); color: var(--l3); box-shadow: none; cursor: not-allowed; }
.send svg { width: 18px; height: 18px; stroke: currentColor; }
.plan-line { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; min-height: 30px; margin: 12px 4px 0; font-size: 13px; color: var(--l2); text-align: center; }
.plan-line b { font-weight: 500; color: var(--l1); }
.plan-line .dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--l4); }
.plan-line[data-tone="limit"] { color: var(--amber); }
.plan-line[data-tone="over"] { color: var(--red); }
.examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.examples .chip { background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge), var(--elev-1); }
.examples .chip:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- chips, badges, buttons */
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; max-width: 100%; padding: 0 12px; border: 0; border-radius: 999px; background: var(--fill-1); color: var(--l1); font-size: 13px; font-weight: 450; white-space: nowrap; cursor: pointer; }
.chip:hover { background: var(--fill-2); }
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip.accent { background: var(--accent-fill); color: var(--on-accent-fill); cursor: default; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px; background: var(--fill-1); color: var(--l2); font-size: 12px; font-weight: 500; line-height: 16px; white-space: nowrap; }
.badge > i { width: 6px; height: 6px; flex: none; border-radius: 50%; background: currentColor; }
.badge[data-tone="green"] { background: var(--green-fill); color: var(--green); }
.badge[data-tone="green"] > i { background: var(--green-mark); }
.badge[data-tone="amber"] { background: var(--amber-fill); color: var(--amber); }
.badge[data-tone="amber"] > i { background: var(--amber-dot); }
.badge[data-tone="red"] { background: var(--red-fill); color: var(--red); }
.badge[data-tone="red"] > i { background: var(--red-mark); }
.badge[data-tone="blue"] { background: var(--accent-fill); color: var(--on-accent-fill); }
.badge[data-tone="blue"] > i { background: var(--accent); }
.badge[data-tone="teal"] { background: var(--teal-fill); color: var(--teal); }
.badge[data-pulse] > i { animation: breathe 1.8s ease-in-out infinite; }
button.badge { border: 0; cursor: pointer; font-family: inherit; }
.badge.add { background: transparent; color: var(--l3); box-shadow: inset 0 0 0 1px var(--sep); }
.badge.add:hover { color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
@keyframes breathe { 50% { opacity: 0.35; } }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--surface); color: var(--l1); box-shadow: inset 0 0 0 1px var(--sep-strong); font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--fill-1); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: var(--glow); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.tinted { background: var(--accent-fill); color: var(--on-accent-fill); box-shadow: none; }
.btn.tinted:hover { background: var(--accent-fill-strong); }
.btn.plain { background: transparent; color: var(--l2); box-shadow: none; }
.btn.plain:hover { background: var(--fill-2); color: var(--l1); }
.btn.danger { color: var(--red); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 40%, transparent); }
.btn.danger:hover { background: var(--red-fill); }
.btn.danger-solid { background: var(--danger); color: #fff; box-shadow: none; }
.btn.danger-solid:hover { background: var(--danger-hover); }
.btn.small { height: 30px; padding: 0 12px; font-size: 13px; }
.btn.icon-only { width: 36px; padding: 0; }
.btn.small.icon-only { width: 30px; }
.segmented { display: inline-flex; max-width: 100%; padding: 2px; overflow-x: auto; border-radius: 999px; background: var(--fill-2); scrollbar-width: none; }
.segmented button { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--l2); font-size: 13px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--l1); box-shadow: 0 1px 3px rgb(0 0 0 / 0.1); }
.segmented .count { margin-left: 4px; color: var(--l3); font-variant-numeric: tabular-nums; }
.select { height: 30px; padding: 0 30px 0 12px; border: 0; border-radius: 999px; background: var(--fill-1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23626467' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center; font-size: 13px; font-weight: 450; appearance: none; cursor: pointer; }
.health { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); box-shadow: 0 8px 24px -10px rgb(0 0 0 / 0.14), inset 0 0 0 1px var(--edge); backdrop-filter: blur(22px) saturate(180%); font-size: 13px; font-weight: 500; cursor: pointer; }
.dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--l4); }
.dot[data-tone="green"] { background: var(--green-mark); }
.dot[data-tone="amber"] { background: var(--amber-dot); }
.dot[data-tone="red"] { background: var(--red-mark); }

/* ---------------------------------------------------------------- runs */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 44px 2px 12px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 500; letter-spacing: -0.025em; }
.card { background: var(--surface); border: 1px solid var(--edge); border-radius: var(--r-xl); box-shadow: var(--elev-1); }
.runs { overflow: hidden; }
.run + .run { border-top: 1px solid var(--sep); }
.run-row { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto 20px; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 14px 18px; cursor: pointer; }
.run-row:hover, .run[data-open="true"] .run-row { background: var(--surface-2); }
.run-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.run-title, .run-sub { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-title { font-size: 14.5px; font-weight: 500; }
.run-sub { margin-top: 2px; font-size: 12.5px; color: var(--l2); }
.run-count { text-align: right; font-size: 14px; font-weight: 500; white-space: nowrap; }
.run-count small { display: block; font-size: 12px; font-weight: 450; color: var(--l3); }
.chevron { color: var(--l3); transition: transform 0.2s; }
.run[data-open="true"] .run-row .chevron { transform: rotate(90deg); }
.ring { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--fill-1); color: var(--l3); }
.ring[data-kind="progress"] { background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--fill-2) 0); }
.ring[data-kind="progress"]::after { content: ""; grid-area: 1 / 1; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); }
.run-row:hover .ring[data-kind="progress"]::after, .run[data-open="true"] .ring[data-kind="progress"]::after { background: var(--surface-2); }
.ring[data-kind="busy"] { background: none; border: 2.5px solid var(--fill-2); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ring[data-tone="green"] { background: var(--green-fill); color: var(--green); }
.ring[data-tone="amber"] { background: var(--amber-fill); color: var(--amber); }
.ring[data-tone="red"] { background: var(--red-fill); color: var(--red); }
.empty { padding: 36px 18px; text-align: center; color: var(--l2); }

/* the expanded run */
.summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 16px 0 12px; }
.big { font-size: 28px; font-weight: 500; line-height: 1.1; letter-spacing: -0.04em; }
.big small { margin-left: 6px; font-size: 14px; font-weight: 450; letter-spacing: -0.01em; color: var(--l2); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bar { height: 6px; overflow: hidden; border-radius: 999px; background: var(--fill-2); }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--gradient); transition: width 0.6s ease; }
.question { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-2); }
.question q { font-weight: 500; quotes: "\201C" "\201D"; }
.notice { display: flex; gap: 12px; align-items: flex-start; margin: 12px 0; padding: 12px 14px; border-radius: var(--r-lg); background: var(--amber-fill); }
.notice[data-tone="red"] { background: var(--red-fill); }
.notice[data-tone="blue"] { background: var(--accent-fill); }
.notice[data-tone="quiet"] { background: var(--surface-2); color: var(--l2); }
.notice .icon { margin-top: 2px; }
.notice p { margin: 0; }
.notice details.more { margin-top: 2px; padding-top: 0; border-top: 0; }
.filters { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 8px 10px; border-bottom: 1px solid var(--sep); text-align: left; font-size: 12px; font-weight: 500; color: var(--l3); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--sep); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table .end { text-align: right; }
.doc-id { margin: -2px -4px; padding: 2px 4px; border: 0; border-radius: 6px; background: none; color: var(--l1); font: 500 13px/1.4 var(--mono); cursor: copy; }
.doc-id:hover { background: var(--fill-1); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
details.more { margin-top: 16px; padding-top: 10px; border-top: 1px solid var(--sep); }
details.more summary { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; list-style: none; font-size: 13px; font-weight: 500; color: var(--l2); cursor: pointer; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary .chevron { transition: transform 0.2s; }
details.more[open] summary .chevron { transform: rotate(90deg); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; margin: 10px 0 4px; font-size: 13px; }
.facts dt { color: var(--l2); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.command { display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 10px 10px 10px 14px; border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--sep); }
.command code { flex: 1; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--l1); }
.skeleton { height: 14px; margin: 10px 0; border-radius: 6px; background: linear-gradient(90deg, var(--fill-1), var(--fill-2), var(--fill-1)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------------------------------------------------------------- drawers, dialogs, toast */
.scrim { position: fixed; inset: 0; z-index: 50; background: var(--scrim); animation: fade 0.18s ease; }
.scrim.over-drawer { z-index: 60; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 10px; right: 10px; bottom: 10px; z-index: 51; display: flex; flex-direction: column; width: min(460px, calc(100vw - 20px)); background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--elev-4), 0 0 0 1px var(--edge); animation: slide 0.28s cubic-bezier(0.32, 0.72, 0, 1); }
.drawer:focus { outline: none; }
/* Panels move but never fade: a drawer or dialog is opaque from its first frame (only the scrim fades). */
@keyframes slide { from { transform: translateX(24px); } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; }
.drawer-head h2 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.03em; }
.drawer-body { flex: 1; padding: 8px 20px 20px; overflow-y: auto; }
.dialog { position: fixed; left: 50%; top: 50%; z-index: 61; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: var(--surface); border-radius: var(--r-2xl); box-shadow: var(--elev-4), 0 0 0 1px var(--edge); transform: translate(-50%, -50%); animation: pop 0.2s cubic-bezier(0.2, 0.8, 0.2, 1); }
.dialog[data-wide] { width: min(640px, calc(100vw - 24px)); }
.dialog:focus { outline: none; }
@keyframes pop { from { transform: translate(-50%, -48%) scale(0.98); } }
.dialog-head { display: flex; justify-content: space-between; gap: 12px; padding: 22px 22px 4px; }
.dialog-head h2 { margin: 0; font-size: 19px; font-weight: 500; letter-spacing: -0.03em; }
.dialog-body { display: grid; gap: 12px; padding: 8px 22px 4px; }
.dialog-body p { margin: 0; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 16px 22px 20px; }
.field label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--l2); }
.field input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--sep-strong); border-radius: var(--r-md); background: var(--surface); font-size: 14.5px; }
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-fill); }
.rows { overflow: hidden; border: 1px solid var(--edge); border-radius: var(--r-lg); }
.rows > div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.rows > div + div { border-top: 1px solid var(--sep); }
.rows .grow { flex: 1; min-width: 0; }
.rows .title { font-weight: 500; }
.rows .detail { display: block; font-size: 12.5px; color: var(--l2); }
.gpu { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--edge); border-radius: var(--r-lg); }
.gpu-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.log-tail { max-height: 260px; margin: 8px 0 0; overflow: auto; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--sep); font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--l2); }
.section-label { display: flex; align-items: center; gap: 8px; margin: 18px 0 6px; font-size: 13px; font-weight: 500; color: var(--l1); }
.toast { position: fixed; bottom: 22px; left: 50%; z-index: 80; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 999px; background: var(--l1); color: var(--canvas); box-shadow: var(--elev-3); font-size: 13.5px; font-weight: 450; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: all 0.22s; }
.toast[data-on] { opacity: 1; transform: translate(-50%, 0); }
.connection { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--l3); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 45; width: min(320px, 88vw); padding-top: 16px; background: var(--canvas); box-shadow: var(--elev-4); transform: translateX(-105%); transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1); }
  .sidebar[data-open] { transform: none; }
  .main { padding: 0 16px 48px; }
}
@media (max-width: 639px) {
  .hero { padding: 22px 0 4px; }
  .hero h1 { margin-bottom: 18px; font-size: 30px; }
  .composer { padding: 12px 12px 10px 14px; }
  .composer textarea { min-height: 48px; font-size: 16px; }
  .run-row { grid-template-columns: 32px minmax(0, 1fr) 16px; gap: 4px 10px; padding: 12px 14px; }
  .run-row .run-count { display: none; }
  .run-row > .ring { grid-row: 1 / span 2; }
  .run-row .run-status { grid-column: 2; grid-row: 2; justify-self: start; }
  .run-row > .chevron { grid-column: 3; grid-row: 1 / span 2; }
  .filters .actions { width: 100%; }
  .section-head { margin-top: 32px; }
}


/* ---------------------------------------------------------------- GPU strip */
.gpu-strip { overflow: hidden; }
.gpu-row { display: grid; grid-template-columns: 10px 52px minmax(0, 1fr) auto 120px; align-items: center; gap: 12px; padding: 11px 16px; color: var(--l1); text-decoration: none; }
.gpu-row + .gpu-row { border-top: 1px solid var(--sep); }
.gpu-row:hover { background: var(--surface-2); }
.gpu-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.gpu-name { font-weight: 500; white-space: nowrap; }
.gpu-doing, .gpu-numbers { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpu-numbers { font-size: 12.5px; color: var(--l2); }
.spark, .spark-empty { display: block; width: 120px; height: 22px; }
.dot[data-tone="blue"] { background: var(--accent); }

/* ---------------------------------------------------------------- runs in sections */
.run-section { margin-bottom: 18px; }
.run-section-head { display: flex; align-items: baseline; gap: 8px; margin: 0 2px 8px; font-size: 13px; font-weight: 500; color: var(--l2); }
.run-section-head .count { color: var(--l3); }
.run-section > .btn { margin-top: 6px; }
a.run-row { color: var(--l1); text-decoration: none; }
.gpu-tag { display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 5px; background: var(--accent-fill); color: var(--on-accent-fill); font-size: 11.5px; font-weight: 500; vertical-align: 1px; }
.badge.mini { margin-right: 6px; padding: 0 6px; font-size: 11px; vertical-align: 1px; }

/* ---------------------------------------------------------------- pages */
.page-column { max-width: 1100px; margin: 0 auto; padding-top: 8px; }
.crumbs { margin: 4px 0 8px; font-size: 12.5px; color: var(--l3); }
.crumbs a { color: var(--l2); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; overflow: hidden; font-size: 28px; font-weight: 500; letter-spacing: -0.035em; text-overflow: ellipsis; white-space: nowrap; }
.page-head h1:focus { outline: none; }
.page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.page-sub { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 13px; color: var(--l2); }
.tabs { display: flex; gap: 2px; margin: 18px 0 14px; overflow-x: auto; border-bottom: 1px solid var(--sep); scrollbar-width: none; }
.tabs [role="tab"] { flex: none; padding: 9px 12px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; color: var(--l2); font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: pointer; }
.tabs [role="tab"][aria-selected="true"] { border-bottom-color: var(--accent); color: var(--l1); }
.tabs [role="tab"]:hover { color: var(--l1); }
.page-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px 32px; align-items: start; }
.facts-grid { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 18px; margin: 0; font-size: 13.5px; }
.facts-grid dt { color: var(--l2); white-space: nowrap; }
.facts-grid dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts-grid q { quotes: "\201C" "\201D"; }
.table-wrap { overflow-x: auto; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.table-wrap .table th, .table-wrap .table td { white-space: nowrap; }
.table-wrap .table td[title] { max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
.table-wrap .table td a { color: var(--l1); }
.mini-gpu { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); color: var(--l1); text-decoration: none; }
.mini-gpu:hover { background: var(--surface-2); }
.mini-gpu .spark { margin-left: auto; }
.log-full { height: min(70vh, 720px); margin: 0; overflow: auto; padding: 12px 14px; border-radius: var(--r-lg); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--sep); font: 11.5px/1.55 var(--mono); white-space: pre; color: var(--l2); }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart { margin: 0; padding: 12px 14px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.chart-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.chart-head b { font-weight: 500; }
.chart svg { display: block; width: 100%; height: 120px; }
.chart-foot { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }

@media (max-width: 760px) {
  .page-grid, .chart-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 22px; white-space: normal; }
  .facts-grid { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts-grid dd { margin-bottom: 8px; }
  .gpu-row { grid-template-columns: 10px auto minmax(0, 1fr); gap: 4px 10px; }
  .gpu-row .gpu-numbers { grid-column: 2 / -1; grid-row: 2; }
  .gpu-row .spark, .gpu-row .spark-empty { grid-column: 2 / -1; grid-row: 3; width: 100%; }
}

.one-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.gpu-head > div:first-child { min-width: 0; }

/* ---------------------------------------------------------------- app shell (top bar, sidebar, rail) */
.appbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 18px; height: 56px; padding: 0 20px;
  background: color-mix(in srgb, var(--canvas) 82%, transparent); backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%); border-bottom: 1px solid var(--sep); }
.appbar .logo b { font-size: 18px; }
.appbar .logo svg { width: 26px; height: 26px; }
.appnav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.appnav a { padding: 7px 12px; border-radius: 999px; color: var(--l2); font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.appnav a:hover { background: var(--fill-1); color: var(--l1); }
.appnav a[aria-current="page"] { background: var(--surface); color: var(--l1); box-shadow: 0 1px 3px rgb(0 0 0 / 0.1), inset 0 0 0 1px var(--edge); }
.appbar-end { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.phone-only { display: none; }
.app { grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { top: 56px; height: calc(100vh - 56px); gap: 8px; padding: 14px 10px 14px 14px; }
.sidebar-head h2 a { color: inherit; text-decoration: none; }
.main { padding-top: 14px; }
.search { width: 100%; height: 32px; padding: 0 12px; border: 1px solid var(--sep-strong); border-radius: 999px; background: var(--surface); font-size: 13px; }
.search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-fill); }
.collections { gap: 1px; }
.collection-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border-radius: 8px; color: var(--l1); font-size: 13.5px; text-decoration: none; }
.collection-line:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.collection-line[aria-current="page"] { background: var(--surface); box-shadow: var(--elev-2), inset 0 0 0 1px var(--edge); font-weight: 500; }
.collection-line .initial { display: none; }
.collection-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.collection-docs { font-size: 12px; color: var(--l3); }
.tiers { display: inline-flex; align-items: center; gap: 4px; }
.tier { display: inline-flex; align-items: center; gap: 4px; color: var(--l3); }
.tier > i { width: 7px; height: 7px; border-radius: 50%; }
.tier[data-tier="features"] > i { background: var(--teal); }
.tier[data-tier="stored"] > i { background: var(--accent); }
.tier[data-tier="building"] > i { width: 10px; height: 10px; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--fill-3) 0); }
.tier[data-tier="protected"] .icon { width: 11px; height: 11px; }
.tier-label { font-size: 12px; color: var(--l2); margin-right: 6px; }
.group-toggle { margin-top: 8px; }
.group-toggle .btn[aria-expanded="true"] .chevron { transform: rotate(90deg); }
body[data-rail] .app { grid-template-columns: 64px minmax(0, 1fr); }
body[data-rail] .sidebar { padding: 14px 8px; }
body[data-rail] .sidebar-head h2, body[data-rail] .collection-label, body[data-rail] .collection-docs, body[data-rail] .tiers,
body[data-rail] .group-toggle, body[data-rail] #collection-filter { display: none !important; }
body[data-rail] .collection-line { grid-template-columns: 1fr; justify-items: center; padding: 0; }
body[data-rail] .collection-line .initial { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--fill-1); font-weight: 500; }
body[data-rail] #collapse-sidebar svg { transform: rotate(180deg); }

/* ---------------------------------------------------------------- page top, live numbers, limiter */
.page-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.page-top .crumbs { margin: 0; }
.crumbs a { text-decoration: none; }
.crumbs [aria-current] { color: var(--l2); }
.btn.back { padding: 0 10px 0 6px; }
.section-head h2 a { color: inherit; text-decoration: none; }
.section-head h2 a:hover { text-decoration: underline; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.stat { min-width: 140px; padding: 12px 16px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.stat-value { font-size: 26px; font-weight: 500; letter-spacing: -0.03em; line-height: 1.15; }
.stat-value small { font-size: 14px; font-weight: 450; color: var(--l2); }
.evidence { display: grid; gap: 6px; margin-top: 12px; }
.ev-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.ev-bar { height: 6px; border-radius: 999px; background: var(--fill-2); overflow: hidden; }
.ev-bar > i { display: block; height: 100%; background: var(--accent); }
.stack-bar { display: flex; height: 10px; overflow: hidden; border-radius: 999px; background: var(--fill-2); margin: 4px 0; }
.stack-bar > i { display: block; height: 100%; background: var(--l4); }
.stack-bar > i[data-tone="green"] { background: var(--green-mark); }
.stack-bar > i[data-tone="amber"] { background: var(--amber-dot); }
.stack-bar > i[data-tone="red"] { background: var(--red-mark); }
.stack-bar > i[data-tone="blue"] { background: var(--accent); }
.mini-gpu .caption { white-space: nowrap; }
a.gpu { color: var(--l1); text-decoration: none; }
a.gpu:hover { background: var(--surface-2); }
.gpu-busy svg { width: 100%; height: 40px; }
.hot { color: var(--amber); font-weight: 500; }
.gpu-doing b { font-weight: 500; }

/* ---------------------------------------------------------------- run filters, picker */
.run-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.run-filters .search { flex: 1 1 220px; width: auto; }
.chip.picker { cursor: pointer; }
.chip.picker .chevron { transform: rotate(90deg); width: 12px; height: 12px; }
.picker-list { max-height: 50vh; overflow-y: auto; margin-top: 10px; }
.picker-option { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; cursor: pointer; }
.picker-option + .picker-option { border-top: 1px solid var(--sep); }
.picker-option:hover, .picker-option:focus-visible { background: var(--surface-2); }
.picker-option[aria-selected="true"] .title { color: var(--accent-text); }

@media (max-width: 980px) {
  .phone-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .appbar { gap: 8px; padding: 0 10px; }
  .appbar .logo b { display: none; }
  .sidebar { top: 0; height: 100vh; z-index: 50; }
  body[data-rail] .app { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 12px 16px 48px; }
}
@media (max-width: 520px) {
  .appnav a { padding: 6px 9px; font-size: 13px; }
  .health { padding: 0 10px; }
  .health { font-size: 0; gap: 0; } /* the dot alone on a phone; the label stays for screen readers */
  .stat { min-width: 0; flex: 1 1 40%; }
}

.tabs [role="tab"] { text-decoration: none; }
.ev-bar > i[data-high="true"] { background: var(--amber-dot); }
@media (max-width: 980px) { .app, body[data-rail] .app { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .appbar .logo { display: none; } .appnav { flex: 1; } }
.rows > [data-plan] { display: contents; }
.rows > [data-plan] > div { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--sep); }

.gpu { grid-template-columns: minmax(0, 1fr); }
.rows > .disk-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto 70px 44px; }
@media (max-width: 520px) { .rows > .disk-row { grid-template-columns: minmax(0, 1fr) 60px 40px; } .disk-io { display: none; } }
.disk-io { white-space: nowrap; }

/* ---------------------------------------------------------------- the question builder, the prompt's help */
.builder { padding: 4px 2px 6px; }
.parts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.part { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 12px; border-radius: 12px;
  background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--edge); }
.part:focus-within { box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-fill); }
.part[data-tone="over"] { box-shadow: inset 0 0 0 1px var(--red-mark); }
.part input { min-width: 0; max-width: 100%; border: 0; background: transparent; color: var(--l1); font: inherit; font-size: 15px; outline: none; }
.part-meta { font-size: 11.5px; color: var(--l3); white-space: nowrap; }
.part-remove { all: unset; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: var(--l3); cursor: pointer; }
.part-remove:hover, .part-remove:focus-visible { background: var(--fill-2); color: var(--l1); }
.join { all: unset; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; cursor: pointer;
  color: var(--accent-text); background: var(--accent-fill); }
.join[data-op="or"] { color: var(--amber); background: color-mix(in srgb, var(--amber-dot) 18%, transparent); }
button.join:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-part { height: 30px; }
.parts-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.split-offer { height: 26px; padding: 0 10px; color: var(--accent-text); }
.part-list { display: grid; gap: 6px; margin: 0 0 12px; padding: 0; list-style: none; }
.part-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.part.static { padding: 6px 12px; }
.part.static q { font-size: 14px; }
.prompt-more { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin-top: 2px; }
.prompt-more .more { border: 0; margin: 0; padding: 0; }
.prompt-more .more[open] { flex-basis: 100%; }
.more-body { display: grid; gap: 8px; justify-items: center; margin-top: 8px; }
.tips { justify-items: start; max-width: 620px; margin-inline: auto; text-align: left; }
.tips ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; color: var(--l2); }
.tips b { color: var(--l1); font-weight: 500; }
.funnel { display: grid; gap: 6px; margin: 6px 0 14px; padding: 0; list-style: none; }
.funnel li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) 80px; align-items: center; gap: 10px; font-size: 13px; }
.funnel-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.funnel-bar { height: 8px; border-radius: 999px; background: var(--fill-2); overflow: hidden; }
.funnel-bar > i { display: block; height: 100%; background: var(--accent); }
.funnel .num { text-align: right; }
@media (max-width: 520px) { .funnel li { grid-template-columns: minmax(0, 1fr) 70px; } .funnel-bar { grid-column: 1 / -1; grid-row: 2; } }
.part-decision { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-weight: 600; font-size: 12.5px; color: var(--l3); }
.part-decision[data-decision="yes"] { background: color-mix(in srgb, var(--green-mark) 16%, transparent); color: var(--green); }
.part-decision[data-decision="uncertain"] { background: color-mix(in srgb, var(--amber-dot) 18%, transparent); color: var(--amber); }
.rows .grow { min-width: min-content; }
@media (max-width: 520px) {
  .part { flex-wrap: wrap; width: 100%; row-gap: 0; padding: 6px 6px 6px 12px; }
  .part input { flex: 1 1 calc(100% - 30px); }
  .part-meta { order: 3; flex-basis: 100%; }
  #source-marker .badge { font-size: 0; gap: 0; padding: 0 6px; }
}

/* polish: phone widths */
.crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 520px) {
  .run-status { display: none; }  /* the ring and the section say the state; the badge cost a third line */
  .caps-table th:nth-child(3), .caps-table td:nth-child(3), .caps-table th:nth-child(4), .caps-table td:nth-child(4) { display: none; }  /* size and parts: in the header and the line below the table */
}
.tier[data-tier="partial"] > i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.building-line { color: var(--accent-text); }
.funnel-yes { display: block; overflow: hidden; text-overflow: ellipsis; }
.funnel-label { line-height: 1.35; }
.part-decision[data-decision="none"] { color: var(--l4); }

/* ---------------------------------------------------------------- new collection */
.new-line { color: var(--accent-text); }
.new-line .collection-label { display: inline-flex; align-items: center; gap: 6px; }
.steps { display: grid; gap: 14px; margin: 8px 0 0; padding: 0; list-style: none; }
.step { padding: 18px 20px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.step h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 16px; font-weight: 500; }
.step-n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-fill); color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.step[aria-disabled="true"] { background: transparent; }
.step[aria-disabled="true"] h2 { color: var(--l3); }
.step[aria-disabled="true"] .step-n { background: var(--fill-2); color: var(--l3); }
.step .field { display: grid; gap: 6px; margin-bottom: 12px; }
.step .field label { font-size: 13px; font-weight: 500; }
.dropzone { display: grid; justify-items: center; gap: 6px; padding: 26px 16px; border: 1.5px dashed var(--sep-strong); border-radius: var(--r-lg);
  text-align: center; cursor: pointer; color: var(--l2); }
.dropzone .icon { width: 22px; height: 22px; color: var(--accent); }
.dropzone:hover, .dropzone[data-over="true"], .dropzone:focus-within { border-color: var(--accent); background: var(--accent-fill); }
.dropzone .link { color: var(--accent-text); text-decoration: underline; }
.upload-summary { display: flex; align-items: center; gap: 12px; margin: 14px 0 8px; font-size: 13px; }
.report { margin-top: 14px; }
.report .stats { margin-bottom: 8px; }
.choice { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; border: 0; }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--edge); border-radius: 12px; cursor: pointer; }
.choice label:has(input:checked) { border-color: var(--accent); background: var(--accent-fill); }
.choice label:has(input[value="now"]:checked) { border-color: var(--red-mark); background: color-mix(in srgb, var(--red-mark) 10%, transparent); }
.choice .caption { display: block; }
.danger-text { color: var(--red); }

/* ---------------------------------------------------------------- the server out of reach */
.offline-banner { position: sticky; top: 56px; z-index: 39; display: flex; align-items: center; gap: 10px; padding: 9px 20px;
  background: color-mix(in srgb, var(--amber-dot) 18%, var(--canvas)); border-bottom: 1px solid color-mix(in srgb, var(--amber-dot) 40%, transparent);
  font-size: 13.5px; color: var(--l1); }
body[data-stale] .gpu-strip, body[data-stale] .runs, body[data-stale] .stats, body[data-stale] .mini-gpu,
body[data-stale] .evidence, body[data-stale] .gpu { opacity: 0.55; filter: saturate(0.4); transition: opacity 0.3s; }
body[data-stale] .badge i, body[data-stale] .ring[data-kind="busy"] { animation: none !important; }
/* a long live badge in a page header (a build's progress) wraps instead of running off a phone screen */
.page-sub .badge { white-space: normal; max-width: 100%; height: auto; min-height: 22px; padding-block: 2px; }

/* ---------------------------------------------------------------- admin: hosts and cards */
.host { margin-bottom: 26px; padding: 18px 20px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.host-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.host-head h2 { margin: 0; font-size: 18px; font-weight: 500; }
.meter-line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.meter-line .ev-bar { flex: 0 0 110px; }
.ev-bar.disk-free { position: relative; overflow: visible; }
.ev-bar.disk-free > b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--red-mark); border-radius: 1px; }
.cards-table td { vertical-align: top; }
.table-wrap .cards-table td.state-cell { white-space: normal; min-width: 200px; max-width: 380px; }
.cards-table .reason { margin-top: 4px; line-height: 1.35; }
.cards-table tr[data-state="detached"] td, .cards-table tr[data-state="unknown"] td { color: var(--l3); }
@media (max-width: 520px) { .host { padding: 14px; } .host-head { flex-wrap: wrap; } }

/* ---------------------------------------------------------------- several hosts */
.hosts-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.host-tile { color: var(--l1); text-decoration: none; min-width: 200px; }
.host-tile:hover { background: var(--surface-2); }
.host-tile-head { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 2px; }
.gpu-foot { padding: 8px 16px; border-top: 1px solid var(--sep); }
.gpu-row .gpu-name { white-space: nowrap; }
[data-many="true"] > .gpu-row { grid-template-columns: 10px 118px minmax(0, 1fr) auto 120px; }
@media (max-width: 980px) { [data-many="true"] > .gpu-row { grid-template-columns: 10px auto minmax(0, 1fr); } }

/* ---------------------------------------------------------------- the owner's one-liner, lanes on a run row */
.machine-line { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; padding: 10px 14px; border-radius: 12px; min-width: 0; overflow-wrap: anywhere;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--edge); font-size: 15px; font-weight: 500; color: var(--l1); }
.run-lanes { display: block; margin-top: 3px; font-size: 12.5px; color: var(--l2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.run-lanes .lane { font-variant-numeric: tabular-nums; }
.run-lanes .lane.trial { color: var(--amber); }
.run-lanes .lane-sep { margin: 0 8px; color: var(--l4); }

/* ---------------------------------------------------------------- unified: server tags, internal runs, the status line */
.server-tag { margin-left: 8px; padding: 1px 7px; border-radius: 999px; background: var(--fill-1); color: var(--l2); font-size: 11.5px; font-weight: 450; vertical-align: 1px; white-space: nowrap; }
.run.internal .run-title, .gpu-row.internal .gpu-doing { color: var(--l3); font-weight: 450; }
.run.internal .run-sub { color: var(--l4); }
.run.internal .ring { opacity: 0.5; }
.machine-line { font-size: 16px; }
.all-normal { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--green-mark) 10%, transparent); font-weight: 500; }
.server-blocks { display: grid; gap: 10px; margin-top: 12px; }
.server-block { padding: 14px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface); }
.server-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.server-gpu { display: flex; align-items: center; gap: 10px; }
.server-gpu .grow { flex: 1; min-width: 0; }
.server-facts { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; }

.run-alert { color: var(--red); font-weight: 500; }
.lanes-table tr[data-state="ended"] td { color: var(--l3); }
.lanes-table tr[data-state="failed"] td:first-child, .lanes-table tr[data-state="failed"] td:nth-child(2) { color: var(--red); }
.alert-notice { margin: 0 0 10px; }

/* ---------------------------------------------------------------- the fleet: one GPU card for every GPU */
.gpu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 12px; margin-bottom: 18px; }
.gpu-card { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--edge); border-radius: var(--r-lg); background: var(--surface);
  color: var(--l1); text-decoration: none; }
.gpu-card:hover { background: var(--surface-2); }
.gpu-card-head { display: flex; align-items: center; gap: 8px; }
.gpu-card-name { font-weight: 600; font-size: 16px; }
.gpu-card-head .chip-status { margin-left: auto; }
.chip-status { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--fill-1); color: var(--l2); white-space: nowrap; }
.chip-status[data-tone="blue"] { background: var(--accent-fill); color: var(--accent-text); }
.chip-status[data-tone="green"] { background: color-mix(in srgb, var(--green-mark) 14%, transparent); color: var(--green); }
.chip-status[data-tone="amber"] { background: color-mix(in srgb, var(--amber-dot) 18%, transparent); color: var(--amber); }
.chip-status[data-tone="red"] { background: color-mix(in srgb, var(--red-mark) 14%, transparent); color: var(--red); }
.gpu-card-doing { font-size: 13.5px; color: var(--l2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpu-card-bar { display: block; height: 4px; }
.gpu-card-spark .spark, .gpu-card-spark .spark-empty { display: block; width: 100%; height: 36px; }
.gpu-card-num { font-size: 12.5px; color: var(--l2); line-height: 1.5; }
.gpu-card-foot { font-size: 11.5px; color: var(--l3); }
.gpu-seen.late { color: var(--amber); }
.gpu-card[data-status="offline"], .gpu-card[data-status="maintenance"] { opacity: 0.62; filter: saturate(0.3); }
.gpu-card.compact { grid-template-columns: 90px auto minmax(0, 1fr) auto 120px; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 0; border: 0; background: transparent; }
.gpu-card.compact + .gpu-card.compact { border-top: 1px solid var(--sep); }
.gpu-card.compact .gpu-card-name { font-size: 14px; }
.gpu-card.compact .chip-status { margin: 0; }
tr.muted td, tr.muted a { color: var(--l3); }
@media (max-width: 760px) { .gpu-card.compact { grid-template-columns: auto auto minmax(0, 1fr); } .gpu-card.compact .gpu-card-num, .gpu-card.compact .spark, .gpu-card.compact .spark-empty { grid-column: 1 / -1; } }

/* ---------------------------------------------------------------- one primary navigation (no collections sidebar) */
.app, body[data-rail] .app { grid-template-columns: minmax(0, 1fr); }
.main { max-width: 1180px; width: 100%; margin: 0 auto; }
.appnav a[data-nav="admin"] { color: var(--l3); }
.server-gpus { margin: 0 -14px; }
.server-gpus .gpu-card.compact { grid-template-columns: 70px auto minmax(0, 1fr) auto; }
.server-gpus .gpu-card.compact .spark, .server-gpus .gpu-card.compact .spark-empty { grid-column: 1 / -1; width: 100%; height: 30px; }
.server-head .caption { margin-left: 6px; }

.server-gpus .gpu-card.compact.nameless { grid-template-columns: auto minmax(0, 1fr) auto; }
.server-gpus .gpu-card.compact .spark-empty { display: none; }
.phases { display: grid; gap: 6px; margin: 6px 0 14px; padding: 0; list-style: none; }
.phases li { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(80px, 2fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.phases li[data-state="waiting"] { color: var(--l3); }
.phases li[data-state="failed"] .phase-name { color: var(--red); }

/* ---------------------------------------------------------------- choosing files on a server; the build plan */
.src-tabs { margin: 0 0 12px; }
.fs-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.fs-roots { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.fs-path { display: flex; gap: 8px; margin-bottom: 8px; }
.fs-path .search { flex: 1; }
.fs-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 4px 0 8px; font-size: 13px; color: var(--l3); }
.crumb, .link-like { all: unset; cursor: pointer; color: var(--accent-text); }
.crumb:hover, .link-like:hover { text-decoration: underline; }
.fs-table { max-height: 420px; overflow-y: auto; }
.fs-pick { width: 32px; }
.fs-sel { margin-top: 8px; }
.locations { display: grid; gap: 10px; margin-top: 8px; }
.locations { gap: 14px; margin-bottom: 14px; }
.loc-host { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: baseline; gap: 6px 12px; }
.loc-host > .loc-where { grid-column: 2; }
.loc-pins { grid-column: 2; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.loc { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.build-progress { display: grid; gap: 10px; }
.build-progress-head { display: flex; align-items: center; gap: 12px; }
.build-progress-head .ev-bar { flex: 1; }

/* Storage card on the GPUs page: one per server, its drives. */
.storage-card { gap: 10px; align-content: start; }
.storage-card:hover { background: var(--surface); }
.vol { display: grid; gap: 4px; }
.vol-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.vol-free { margin-left: auto; }
.vol-free.warn { color: var(--amber); font-weight: 600; }
.vol-bar { display: flex; height: 6px; border-radius: 999px; background: var(--fill-2); overflow: hidden; }
.vol-bar > i { display: block; height: 100%; background: var(--l3); opacity: 0.5; }
.vol-bar > i.ours { background: var(--accent); opacity: 1; }

/* ---------------------------------------------------------------- run page: every server's GPU, lane sessions */
.run-gpus { display: grid; gap: 10px; }
.run-gpu { display: grid; gap: 6px; }
.run-gpu .gpu-card.compact { grid-template-columns: 64px auto minmax(0, 1fr) auto; padding: 10px 12px; border: 1px solid var(--edge); border-radius: 12px; background: var(--surface); }
.run-gpu .gpu-card.compact > .spark, .run-gpu .gpu-card.compact > .spark-empty { display: none; }
.run-gpu-verdict { padding-left: 2px; }
.lane-sessions { margin-top: 8px; }
.lane-sessions > div { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

/* ---------------------------------------------------------------- home: Ask first, one live line, Up next */
.home-status { display: grid; gap: 10px; }
.home-status .machine-line { margin: 0; text-decoration: none; }
.home-status .machine-line:hover { background: var(--surface-2); }
.home-status .machine-line .go { margin-left: auto; color: var(--l3); font-size: 13px; font-weight: 450; white-space: nowrap; }
.home-links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--l3); }

/* ---------------------------------------------------------------- option controls (components/controls.js) */
.seg-field { display: grid; gap: 4px; margin: 0; padding: 0; border: 0; min-width: 0; }
.seg-field.inline { display: inline-flex; align-items: center; gap: 8px; }
.seg-label { padding: 0; font-size: 12.5px; color: var(--l3); font-weight: 450; }
.seg { display: inline-flex; padding: 2px; border-radius: 999px; background: var(--fill-1); box-shadow: inset 0 0 0 1px var(--edge); }
.seg-option { position: relative; }
.seg-option input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg-option span { display: block; padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--l2); white-space: nowrap; }
.seg-option input:checked + span { background: var(--surface); color: var(--l1); font-weight: 550; box-shadow: 0 1px 2px rgb(0 0 0 / 0.08), inset 0 0 0 1px var(--edge); }
.seg-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg-option.disabled span { color: var(--l4); }
.seg-option.disabled input { cursor: not-allowed; }
.seg-help { max-width: 52ch; }
.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; position: relative; }
.toggle input { position: absolute; opacity: 0; width: 34px; height: 20px; margin: 0; cursor: pointer; }
.toggle-track { width: 34px; height: 20px; border-radius: 999px; background: var(--fill-2); position: relative; transition: background .15s; flex: none; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); transition: transform .15s; }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track::after { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle.disabled { color: var(--l4); cursor: not-allowed; }

/* Ask: when to run and on which GPUs, under the question box */
.ask-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 20px; margin: 10px 0 0; }
.ask-controls .where { font-size: 13px; color: var(--l3); }
.schedule-line { margin-top: 6px; text-align: center; font-size: 13px; color: var(--l2); }
.schedule-line[data-tone="amber"] { color: var(--amber); }

/* Ask: one GPU or both, the advisory under the controls */
.advisory { display: grid; justify-items: center; gap: 4px; font-size: 13px; color: var(--l2); text-align: center; }
.advisory[data-tone="amber"] > span { color: var(--amber); }
.advisory[data-tone="green"] > span { color: var(--green, var(--l2)); }
.advisory-why { text-align: left; }
.compact-table td, .compact-table th { padding: 4px 10px; font-size: 12.5px; }

/* ---------------------------------------------------------------- results: full documents, export menu */
.row-toggle { width: 34px; padding-right: 0 !important; }
.row-toggle .icon-btn { border: 0; background: none; padding: 4px; border-radius: 6px; color: var(--l3); cursor: pointer; }
.row-toggle .icon-btn:hover { background: var(--fill-1); color: var(--l1); }
.row-toggle [aria-expanded="true"] .chevron { transform: rotate(90deg); }
tr.row-more > td { background: var(--surface-2); padding-top: 4px; padding-bottom: 14px; }
.doc-head { display: inline-block; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.doc-preview { display: inline-block; max-width: min(72ch, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.doc-fields { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 4px 16px; margin: 6px 0; font-size: 13.5px; }
.doc-fields dt { color: var(--l3); text-transform: capitalize; }
.doc-fields dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.doc-text { white-space: pre-wrap; }
.doc-json { font-size: 12.5px; color: var(--l2); }
.doc-more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin-top: 2px; }
.doc-more[open] summary { margin-bottom: 4px; }
.export-body { display: grid; gap: 12px; padding: 8px 0 4px; }
.field-pick { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; border: 0; }
.field-pick legend { width: 100%; margin-bottom: 2px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.export-go { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.seg-field > .seg { justify-self: start; }
.vol-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vol.reserved { opacity: 0.55; filter: saturate(0.3); }
.queue-title { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ask: Options (collapsed) */
.ask-options { text-align: left; max-width: 720px; margin: 0 auto; }
.options-body { display: grid; gap: 14px; padding: 8px 0 4px; }
.options-body textarea { width: 100%; min-height: 70px; }
.options-body [data-opt-reset] { justify-self: start; }

/* ---------------------------------------------------------------- space: the drives' use, the toast's Undo */
.vol-bar > i[data-kind="stores"], .vol-legend i[data-kind="stores"] { background: var(--accent); opacity: 1; }
.vol-bar > i[data-kind="runs"], .vol-legend i[data-kind="runs"] { background: var(--teal); opacity: 1; }
.vol-bar > i[data-kind="staging"], .vol-legend i[data-kind="staging"] { background: var(--amber-dot); opacity: 1; }
.vol-bar > i[data-kind="trash"], .vol-legend i[data-kind="trash"] { background: var(--l4); opacity: 1; }
.vol-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.vol-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.storage-card[data-status="offline"] { opacity: 0.62; filter: saturate(0.3); }
.section-head .actions { display: inline-flex; gap: 6px; margin-left: auto; }
.toast-action { margin-left: 8px; }
.space-form { display: grid; gap: 12px; }
.section-head:has(> .section-label) { margin: 18px 2px 8px; }
.section-head > .section-label { margin: 0; }

/* UI pass (D, 28 Nov): idle stretches on a GPU's busy line and its cause; a missing reading */
.spark-gap { fill: var(--amber-dot); fill-opacity: .22; }
.gpu-gap { color: var(--amber); margin-top: 2px; }
.no-reading { cursor: help; }
/* tables fit their card (lead: fewer, wider columns; no column clipped off the edge): long names wrap */
.page-grid > *, .gpu-grid > * { min-width: 0; }
.table td { overflow-wrap: anywhere; }
.table td.one-line { max-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eta-rates { margin-top: 4px; border-collapse: collapse; }
.eta-rates td { padding: 0 8px 0 0; white-space: nowrap; }
.eta-rates td.num { text-align: right; }
/* the collection's build, stage by stage (owner, 28 Nov) */
.pipe-table th[scope="row"] { font-weight: 500; white-space: nowrap; }
.pipe-table td { vertical-align: top; }
.pipe-bar { display: inline-block; width: 140px; margin-top: 6px; }
.pipe-bar[data-tone="done"] > i { background: var(--l4); }
.pipe-bar[data-tone="green"] > i { background: var(--green-dot, #1a9e5a); }
.pipe-overall { margin: 10px 0 18px; }
.contribs { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 10px 24px; margin-bottom: 18px; }
.contrib .ev-bar { margin: 4px 0; }
.contrib .ev-bar { display: block; }
.contrib-lines { margin: 10px 2px 4px; display: grid; gap: 3px; }
/* runs list (owner, 28 Nov): a build's part runs as one row, expandable; background services collapsed */
.run-group > details > summary { list-style: none; cursor: pointer; }
.run-group > details > summary::-webkit-details-marker { display: none; }
.run-group > details[open] > summary > svg:last-child { transform: rotate(90deg); }
.group-members { padding: 0 0 8px 44px; display: grid; }
.group-members .run-row.small { padding-top: 6px; padding-bottom: 6px; opacity: .9; }
.run-services { margin-top: 18px; }
.stat-wide { flex: 2 1 420px; }
.eta-readings { margin-top: 6px; display: grid; gap: 2px; }
.eta-range .more { margin-top: 6px; }
/* phone pass (UI engineer's findings, 28 Nov) */
/* a visually hidden label (.sr-only, absolute) inside a scrolled table took the page as its containing block and
   widened the whole page to the table's width (collections: 891 px at 390): the wrap is the containing block */
.table-wrap { position: relative; }
@media (max-width: 600px) {
  .stats > .stat, .stats > .stat-wide { flex: 1 1 100%; min-width: 0; }
  .eta-rates td { white-space: normal; }
  .seg, .segmented { flex-wrap: wrap; border-radius: 16px; }
  .segmented { max-width: 100%; }
}

/* live pass (28 Nov): the stages table fits at 1440 (long cells wrap, cells align to the top) and stacks at 390 */
.table-wrap .pipe-table th, .table-wrap .pipe-table td { white-space: normal; vertical-align: top; }
.pipe-table td:nth-child(4) { min-width: 200px; }
.pipe-table td:last-child { max-width: 420px; }
@media (max-width: 600px) {
  .pipe-table thead { display: none; }
  .pipe-table, .pipe-table tbody, .pipe-table tr, .pipe-table th, .pipe-table td { display: block; width: auto; max-width: none; min-width: 0; }
  .pipe-table tr { padding: 10px 12px; border-bottom: 1px solid var(--sep); }
  .table-wrap .pipe-table th, .table-wrap .pipe-table td { padding: 2px 0; border: 0; }
  .pipe-bar { width: 100%; }
}

/* Phase 4: parts done per server (run page) and the plan's Where row: wrap on a phone, never overflow */
.hosts-progress .stat-value { display: flex; flex-wrap: wrap; gap: 0 0.8em; }
.host-prog { white-space: nowrap; }
.shady-only li { overflow-wrap: anywhere; }
