:root {
  --night: #0c1220;
  --panel: #141c2e;
  --panel-2: #1a2438;
  --line: #24304a;
  --line-soft: #1c263b;
  --text: #e6ebf5;
  --muted: #8893aa;
  --faint: #5d6780;
  --ok: #4fd1a5;
  --fail: #ff6b6b;
  --warn: #ffc56b;
  --money: #ffb547;
  --focus: #9cc3ff;

  --s-analyze: #6ea8ff;
  --research: #3ec9b4;
  --s-spec-revise: #a9c9ff;
  --s-mockups: #b892ff;
  --s-mockups-revise: #d8c2ff;
  --s-implement: #ffb547;
  --s-revise: #ff8a7a;
  --s-ai-review: #4fd1c5;
  --s-security: #f472b6;
  --s-review-fix: #ffd27a;
  --s-merge: #22c55e;
  --s-design-brief: #7dd3fc;
  --s-design-brief-revise: #bae6fd;
  --s-prototype: #a3e635;
  --s-prototype-revise: #d9f99d;
  --s-design: #f0abfc;
  --s-design-revise: #f5d0fe;
  --s-handoff: #34d399;
  --s-fin-intake: #fbbf24;
  --s-fin-mapping-revise: #fde68a;
  --s-reconcile: #38bdf8;
  --s-reconcile-revise: #7dd3fc;
  --s-fin-check: #a78bfa;
  --s-fin-accept: #4ade80;

  --link: var(--s-spec-revise);
  --primary: var(--s-analyze);
  --on-primary: #0c1220;
  --on-fill: #0c1220;
  --pop: #0a0f1b;
  --pop-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  --scrim: rgba(4, 7, 14, .72);
  --bar-bg: color-mix(in srgb, var(--night) 90%, transparent);
  --sunken: rgba(0, 0, 0, .12);
  --card-shadow: none;
  --me-bg: #21345a;
  --me-line: #2c4676;
  --code: #cdd5e4;
  --term-bg: #0a0f1b;
  --term-text: #c9d2e3;
  --term-warn: #ffe0ad;
  --term-error: #ffc2c2;
  --glow-1: color-mix(in srgb, var(--s-analyze) 10%, transparent);
  --glow-2: color-mix(in srgb, var(--s-mockups) 6%, transparent);
  /* how much of a stage hue survives when it colors text; the rest is --text */
  --ink-mix: 100%;
  color-scheme: dark;

  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --ui: "Onest", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

/* Light theme: cool paper with the same navy ink as the brand. Stage hues are deepened so bars hold
   their shape on white; text roles (links, statuses) get their own darker values to keep 4.5:1. */
:root[data-theme="light"] {
  --night: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #eef1f7;
  --line: #d5dce8;
  --line-soft: #e4e9f1;
  --text: #131b2e;
  --muted: #4a566e;
  --faint: #5f6b82;
  --ok: #087653;
  --fail: #c8312f;
  --warn: #94600a;
  --money: #a35d00;
  --focus: #2458c6;

  --s-analyze: #3b82f6;
  --research: #0d9488;
  --s-spec-revise: #6b9cf0;
  --s-mockups: #8b5cf6;
  --s-mockups-revise: #a78bfa;
  --s-implement: #f59e0b;
  --s-revise: #f26b5b;
  --s-ai-review: #14b8a6;
  --s-security: #ec4899;
  --s-review-fix: #eab308;
  --s-merge: #16a34a;
  --s-design-brief: #0ea5e9;
  --s-design-brief-revise: #56c1ee;
  --s-prototype: #65a30d;
  --s-prototype-revise: #93c43a;
  --s-design: #d946ef;
  --s-design-revise: #e588f3;
  --s-handoff: #10b981;
  --s-fin-intake: #f59e0b;
  --s-fin-mapping-revise: #f2c14e;
  --s-reconcile: #0284c7;
  --s-reconcile-revise: #38a0d6;
  --s-fin-check: #7c3aed;
  --s-fin-accept: #22c55e;

  --link: #2458c6;
  --primary: #2458c6;
  --on-primary: #ffffff;
  --pop: #ffffff;
  --pop-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 16px 40px rgba(16, 24, 40, .14);
  --scrim: rgba(19, 27, 46, .38);
  --bar-bg: color-mix(in srgb, #ffffff 86%, transparent);
  --sunken: rgba(19, 27, 46, .03);
  --card-shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --me-bg: #e4edfd;
  --me-line: #c6d7f6;
  --code: #34405a;
  --term-bg: #f7f9fc;
  --term-text: #26324a;
  --term-warn: #7a4d00;
  --term-error: #a61f1f;
  --glow-1: color-mix(in srgb, var(--s-analyze) 7%, transparent);
  --glow-2: color-mix(in srgb, var(--s-mockups) 5%, transparent);
  --ink-mix: 58%;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0;
  color: var(--text);
  font: 15px/1.5 var(--ui);
  font-variant-numeric: tabular-nums;
  background:
    radial-gradient(1200px 500px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(900px 400px at -10% 30%, var(--glow-2), transparent 60%),
    var(--night);
  min-height: 100vh;
}
.panel, .run-card, .table-wrap, .form, .pcard, .log { box-shadow: var(--card-shadow); }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
button { font: inherit; color: inherit; cursor: pointer; }

main { padding: 0 32px 48px; max-width: 1560px; margin: 0 auto; }

/* ---------- header: sections + orchestrator state (all pages), filter bar (dashboard) ---------- */
:root { --bar-h: 56px; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 32px;
  height: var(--bar-h); padding: 0 32px;
  background: var(--bar-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { margin: 0; font: 700 18px/1 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.brand-link { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 26px; height: 26px; flex: none; }
.brand-word { display: inline-block; white-space: pre; }
.ai-grad { background: linear-gradient(100deg, #6ea8ff, #b892ff 60%, #4fd1c5); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="light"] .ai-grad { background-image: linear-gradient(100deg, #3b82f6, #8b5cf6 60%, #14b8a6); }
.tabs-nav { display: flex; align-self: stretch; gap: 24px; }
.tabs-nav > a {
  display: flex; align-items: center; color: var(--muted); font-size: 14.5px; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; padding-top: 2px; white-space: nowrap;
}
.tabs-nav > a:hover { color: var(--text); text-decoration: none; }
.tabs-nav > a[hidden] { display: none; }
.tabs-nav > a[aria-current="page"] { color: var(--text); border-bottom-color: var(--s-analyze); }
/* Groups of the menu (header.js): a button that opens a panel of its sections. */
.nav-g { display: flex; align-self: stretch; }
.nav-gbtn {
  display: flex; align-items: center; gap: 5px; padding: 2px 0 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font: 500 14.5px var(--ui); white-space: nowrap; cursor: pointer;
}
.nav-gbtn:hover, .nav-gbtn[aria-expanded="true"] { color: var(--text); }
.nav-gbtn.cur { color: var(--text); border-bottom-color: var(--s-analyze); }
.nav-gbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.nav-chev { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nav-gbtn[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }
.nav-pop {
  position: absolute; z-index: 30; min-width: 260px; max-width: min(420px, calc(100vw - 16px)); max-height: calc(100dvh - var(--bar-h) - 16px); overflow: auto;
  padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--pop); box-shadow: var(--pop-shadow);
}
.nav-pop.wide { min-width: 320px; }
.nav-pop[hidden] { display: none; }
.nav-pop a { color: var(--text); text-decoration: none; }
.nav-item { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; font-size: 14px; }
.nav-item small { color: var(--faint); font-size: 12.5px; }
.nav-item:hover, .nav-pop a:focus-visible { background: var(--panel-2); outline: none; }
.nav-item[aria-current="page"] { box-shadow: inset 2px 0 0 var(--s-analyze); }
.nav-teams { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line-soft); }
.nav-teams-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--faint); font-size: 12.5px; }
.nav-teams-all { color: var(--link) !important; font-size: 12.5px; }
.nav-team { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 12px; padding: 6px 0; }
.nav-team + .nav-team { border-top: 1px solid var(--line-soft); }
.nav-team-name { font-size: 14px; font-weight: 500; }
.nav-team-views { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; }
.nav-team-views a { color: var(--muted) !important; }
.nav-team a:hover { color: var(--text) !important; text-decoration: underline; }
.nav-team a[aria-current="page"] { color: var(--link) !important; }
.nav-none { margin: 4px 0; color: var(--faint); font-size: 13px; }
/* «Что нового» has entries the reader has not opened yet (header.js): on the section and on its group. */
.nav-gbtn.has-new::after { content: ""; flex: none; width: 7px; height: 7px; margin: 0 0 9px 1px; border-radius: 50%; background: var(--s-implement); }
.nav-item.has-new b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 0 2px 6px; border-radius: 50%; background: var(--s-implement); }
/* Someone who sees no team's work: the orchestrator's slots are not theirs; the box stays, it keeps the person's menu on the right. */
.status.quiet > * { display: none; }
@media (min-width: 721px) and (max-width: 1320px) { .tabs-nav { gap: 16px; } }

/* Groups of the menu (header.js): a button like a section, its panel fixed to the bar under it. */
.nav-g { display: flex; align-self: stretch; }
.nav-gbtn {
  display: flex; align-items: center; gap: 5px; padding: 2px 0 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; color: var(--muted); font: 500 14.5px var(--ui); white-space: nowrap; cursor: pointer;
}
.nav-gbtn:hover, .nav-gbtn[aria-expanded="true"] { color: var(--text); }
.nav-gbtn.cur { color: var(--text); border-bottom-color: var(--s-analyze); }
.nav-gbtn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.nav-gbtn.has-new::after { content: ""; width: 7px; height: 7px; margin: 0 0 9px 1px; border-radius: 50%; background: var(--s-implement); }
.nav-chev { width: 10px; height: 10px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.nav-gbtn[aria-expanded="true"] .nav-chev { transform: rotate(180deg); }
.nav-pop {
  position: fixed; z-index: 30; min-width: 260px; max-width: min(420px, calc(100vw - 16px)); max-height: calc(100dvh - var(--bar-h) - 16px); overflow: auto;
  padding: 6px; background: var(--pop); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop-shadow);
}
.nav-pop[hidden] { display: none; }
.nav-pop.wide { min-width: 340px; }
.nav-pop a { color: var(--text); text-decoration: none; }
.nav-item { display: grid; gap: 1px; padding: 8px 10px; border-radius: 8px; }
.nav-item b { font-weight: 500; font-size: 14px; }
.nav-item small { color: var(--faint); font-size: 12.5px; }
.nav-item:hover, .nav-item:focus-visible { background: var(--panel); outline: none; }
.nav-item[aria-current="page"] { background: var(--panel-2); }
.nav-item.has-new b::after { content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 0 1px 6px; border-radius: 50%; background: var(--s-implement); }
.nav-teams { margin-top: 4px; padding: 8px 4px 4px; border-top: 1px solid var(--line-soft); }
.nav-teams-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 6px 6px; color: var(--faint); font-size: 12.5px; }
.nav-pop .nav-teams-all { color: var(--link); font-size: 12.5px; }
.nav-team { display: grid; gap: 4px; padding: 7px 6px; border-radius: 8px; }
.nav-team:hover { background: var(--panel); }
.nav-team-name { font-weight: 500; font-size: 14px; }
.nav-team-views { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.nav-pop .nav-team-views a { color: var(--muted); font-size: 13px; }
.nav-pop .nav-team a:hover { color: var(--text); text-decoration: underline; }
.nav-pop .nav-team a[aria-current="page"] { color: var(--text); text-decoration: underline; text-decoration-color: var(--s-analyze); text-underline-offset: 3px; }
.nav-none { margin: 0; padding: 4px 6px; color: var(--faint); font-size: 13px; }
/* Someone who sees no team's work: the orchestrator's slots are not for them, the box still keeps the bar's right side. */
.status.quiet > * { display: none; }

.status { position: relative; margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13.5px; }
.st-btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text); white-space: nowrap;
}
.st-btn:hover, .st-btn[aria-expanded="true"] { border-color: var(--muted); }
.st-btn .st-main { font-weight: 600; }
.st-btn .short { display: none; }
.st-btn .st-extra { color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line); }
.st-btn.down { border-color: color-mix(in srgb, var(--fail) 50%, transparent); color: var(--fail); }
.st-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--fail); }
.slots { display: inline-flex; gap: 3px; }
.slots i { width: 7px; height: 16px; border-radius: 2px; background: var(--line); }
.slots i.on { background: var(--s-implement); animation: pulse 2.4s ease-in-out infinite; }
.slots.idle i { background: color-mix(in srgb, var(--ok) 55%, transparent); }
.st-update {
  padding: 5px 10px; border-radius: 10px; color: var(--warn); white-space: nowrap;
  background: color-mix(in srgb, var(--warn) 8%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.st-update[hidden] { display: none; }
.st-age { display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12.5px; min-width: 44px; white-space: nowrap; }
.st-age.bad { color: var(--fail); }
.st-pop {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 30; width: 340px; max-height: 70vh; overflow: auto;
  background: var(--pop); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: var(--pop-shadow); font-size: 13.5px;
}
.st-pop[hidden] { display: none; }
.st-pop p { margin: 0 0 4px; }
.st-pop h4 { margin: 12px 0 4px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.st-pop ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }

.toolbar {
  position: sticky; top: var(--bar-h); z-index: 19;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 32px; background: var(--bar-bg); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.scope { margin-left: auto; color: var(--faint); font-size: 13px; text-align: right; }
.scope b { color: var(--warn); font-weight: 500; }
.page-meta { margin: 10px 0 0; color: var(--muted); font-size: 13.5px; }

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-size: 13.5px; color: var(--muted);
  transition: background .15s, color .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.seg.small button { padding: 4px 10px; font-size: 13px; }
.seg a { padding: 6px 14px; border-radius: 7px; font-size: 13.5px; color: var(--muted); text-decoration: none; transition: background .15s, color .15s; }
.seg a:hover { color: var(--text); }
.seg a[aria-current="page"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.viewsw { margin-bottom: 14px; }
:root[data-theme="light"] .seg { background: var(--panel-2); border-color: var(--line-soft); }
:root[data-theme="light"] .seg button[aria-pressed="true"],
:root[data-theme="light"] .seg a[aria-current="page"] { background: var(--panel); box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 0 0 1px var(--line-soft); }
.project-select {
  appearance: none; background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%23999' stroke-width='1.6'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 32px 8px 12px; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer;
}
.project-select:hover { border-color: var(--muted); }
.project-select[hidden] { display: none; }

.issue-filter {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px;
  border-radius: 10px; background: color-mix(in srgb, var(--s-analyze) 12%, transparent); border: 1px solid color-mix(in srgb, var(--s-analyze) 35%, transparent); font-size: 13.5px;
}
.issue-filter[hidden] { display: none; }
.issue-filter button { border: 0; background: transparent; color: var(--muted); padding: 2px 8px; border-radius: 6px; }
.issue-filter button:hover { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }

/* ---------- hero timeline ---------- */
.hero { padding: 36px 0 12px; }
.hero-head { margin-bottom: 18px; }
.hero-head h2 { margin: 0; font: 700 clamp(28px, 3.4vw, 44px)/1 var(--display); letter-spacing: -.02em; }
.hint { margin: 0; color: var(--faint); font-size: 13.5px; max-width: 520px; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.legend button {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; font-size: 13px; color: var(--text);
}
.legend button i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.legend button[aria-pressed="false"] { color: var(--faint); border-style: dashed; }
.legend button[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }

.timeline { display: grid; grid-template-columns: 250px 1fr; border-top: 1px solid var(--line); }
.tl-labels { border-right: 1px solid var(--line); }
/* The row keeps the height the chart draws with (ROW in app.js), so labels line up with the bars. */
.tl-row { display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--line-soft); overflow: hidden; }
.tl-label {
  display: flex; flex-direction: column; justify-content: center; padding: 0 14px 0 0;
  text-align: left; background: transparent; border: 0; width: 100%;
}
.tl-label:hover { background: color-mix(in srgb, var(--text) 2.5%, transparent); }
.tl-stand { font-size: 12.5px; line-height: 1.3; padding-right: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn { border: 0; background: transparent; padding: 0; color: var(--link); }
.link-btn:hover { text-decoration: underline; }
.stand-cell { font-size: 12.5px; white-space: nowrap; }
.sd-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.sd-dot.sd-ok { background: var(--ok); }
.sd-dot.sd-bad { background: var(--fail); }
.sd-dot.sd-busy { background: var(--s-implement); animation: pulse 1.6s ease-in-out infinite; }
.stand-dialog {
  width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 18px 20px; overflow: auto;
  background: var(--pop); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--pop-shadow);
}
.stand-dialog::backdrop { background: var(--scrim); }
.sd-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sd-head h2 { margin: 0; font-size: 17px; }
.sd-x { border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.sd-x:hover { color: var(--text); background: var(--panel-2); }
.sd-problem { margin: 10px 0 0; font-size: 13.5px; }
.sd-pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 14px; }
.sd-page { margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.sd-page img, .sd-noshot { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; background: var(--panel-2); }
.sd-noshot { display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.sd-page figcaption { padding: 9px 11px; font-size: 13px; line-height: 1.45; }
.sd-page figcaption a { color: var(--muted); }
.sd-err { display: block; margin-top: 4px; font-size: 12.5px; overflow-wrap: anywhere; }
.sd-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; font-size: 13px; }
.sd-rebuild {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 7px 14px; border-radius: 9px; font: inherit; cursor: pointer;
}
.sd-rebuild:hover:not(:disabled) { border-color: var(--muted); }
.sd-rebuild:disabled { opacity: .6; cursor: default; }
.tl-label .k { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.tl-label .runs-meta { font-weight: 400; font-size: 12.5px; }
.tl-label .t { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label.active .k::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--s-implement); animation: pulse 1.6s ease-in-out infinite; }
.tl-axis-spacer { height: 28px; }
.tl-chart { position: relative; overflow: hidden; }
.tl-chart svg { display: block; }
.tl-empty { grid-column: 1 / -1; padding: 42px 0; color: var(--muted); }

.bar { cursor: pointer; transition: opacity .15s; }
.bar:hover, .bar:focus-visible { opacity: .85; }
.bar:focus-visible { outline: none; stroke: var(--focus); stroke-width: 2; }
.bar.live { animation: glow 1.8s ease-in-out infinite; }
.axis text { fill: var(--faint); font-size: 11.5px; font-family: var(--ui); }
.axis line { stroke: var(--line-soft); }
.now-line { stroke: var(--text); stroke-opacity: .5; stroke-dasharray: 3 4; }
.now-label { fill: var(--text); font-size: 11px; font-weight: 600; }

@keyframes pulse { 50% { opacity: .35; } }
@keyframes glow { 50% { filter: brightness(1.35); } }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 30px 0 34px; border-block: 1px solid var(--line); }
.kpi { padding: 20px 22px; border-right: 1px solid var(--line-soft); }
.kpi:last-child { border-right: 0; }
.kpi .v { font: 700 clamp(24px, 2.6vw, 34px)/1.1 var(--display); letter-spacing: -.02em; }
.kpi .v.money { color: var(--money); }
.kpi .l { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.kpi .s { color: var(--faint); font-size: 12.5px; margin-top: 2px; }
.kpi .spark { margin-top: 10px; height: 26px; display: block; width: 100%; }

/* ---------- chart panels ---------- */
.grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 16px; padding: 18px 20px 16px; min-width: 0; }
.panel.wide { grid-column: 1; }
.grid > .panel:nth-child(2) { grid-column: 2; grid-row: 1; }
.grid > .panel:nth-child(3) { grid-column: 2; grid-row: 2; }
.grid > .panel:nth-child(4) { grid-column: 1; grid-row: 2; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.panel-sub { color: var(--faint); font-size: 13px; }
.chart { position: relative; min-height: 120px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .empty { color: var(--muted); padding: 36px 0; text-align: center; }
.chart .grid-line { stroke: var(--line-soft); }
.chart text { fill: var(--faint); font-size: 11.5px; font-family: var(--ui); }
.chart .val { fill: var(--text); font-weight: 600; }
.seg-rect { cursor: pointer; }
.seg-rect:hover, .seg-rect:focus-visible { filter: brightness(1.2); outline: none; }

.donut-wrap { display: grid; grid-template-columns: 170px 1fr; gap: 20px; align-items: center; }
.donut-center .a { font: 700 22px/1 var(--display); fill: var(--money); }
.donut-center .b { fill: var(--muted); font-size: 12px; }
.comp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.comp-list li { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: baseline; font-size: 13.5px; }
.comp-list i { width: 12px; height: 12px; border-radius: 3px; background: var(--c); transform: translateY(1px); }
.comp-list .n { color: var(--faint); font-size: 12.5px; display: block; }
.comp-list b { font-weight: 600; }

.stage-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stage-table th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12.5px; padding: 0 10px 8px 0; }
.stage-table td { padding: 8px 10px 8px 0; border-top: 1px solid var(--line-soft); }
.stage-table .num { text-align: right; white-space: nowrap; }
.chip { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.chip i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); flex: none; }
.meter { position: relative; height: 8px; background: var(--line-soft); border-radius: 4px; min-width: 120px; overflow: hidden; }
.meter span { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 4px; }
.rate-ok { color: var(--ok); } .rate-bad { color: var(--fail); }

/* ---------- sections ---------- */
section + section { margin-top: 44px; }
.section-title { margin: 0 0 14px; font: 700 22px/1.1 var(--display); letter-spacing: -.01em; }
.section-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-row .section-title { margin: 0; }

.running { display: grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap: 18px; }
.run-card { background: var(--panel); border: 1px solid var(--line-soft); border-left: 3px solid var(--c); border-radius: 14px; padding: 16px 18px; min-width: 0; }
.run-card h4 { margin: 0; font-size: 17px; font-weight: 600; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.run-card h4 small { color: var(--muted); font-weight: 400; font-size: 13.5px; }
.run-card .sub { color: var(--muted); font-size: 13px; margin: 4px 0 12px; }
.progress { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin-bottom: 6px; }
.progress span { display: block; height: 100%; background: var(--c); border-radius: 3px; transition: width .5s; }
.progress.over span { background: repeating-linear-gradient(45deg, var(--c) 0 6px, color-mix(in srgb, var(--c) 55%, transparent) 6px 12px); }
.progress-note { color: var(--faint); font-size: 12.5px; margin-bottom: 12px; }
.steps { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; font-size: 13px; }
.steps li { display: grid; grid-template-columns: 58px 18px 1fr; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.steps .at { color: var(--faint); font-size: 12px; padding-top: 1px; }
.steps svg { width: 15px; height: 15px; margin-top: 2px; }
.steps .think { color: color-mix(in srgb, var(--s-mockups) var(--ink-mix), var(--text)); } .steps .say { color: color-mix(in srgb, var(--s-analyze) var(--ink-mix), var(--text)); } .steps .tool { color: color-mix(in srgb, var(--s-implement) var(--ink-mix), var(--text)); } .steps .other { color: var(--faint); }
.steps .txt { word-break: break-word; }
.steps .tool-txt { font-family: var(--mono); font-size: 12px; color: var(--code); }
.preparing { border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 13.5px; }
.preparing-head { display: flex; align-items: center; gap: 9px; }
.preparing-head b { font-weight: 600; }
.preparing-sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 0 23px; }
.preparing-line { display: block; margin: 10px 0 0 23px; font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--c); animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.idle { background: var(--panel); border: 1px dashed var(--line); border-radius: 14px; padding: 22px; color: var(--muted); }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12.5px; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--text) 2%, transparent); }
td.num, th.num { text-align: right; white-space: nowrap; }
.key-btn { border: 0; background: transparent; padding: 0; font-weight: 600; color: var(--text); }
.key-btn:hover { color: var(--link); }
.title-cell { max-width: 360px; color: var(--muted); }
.status-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.status-pill.review { border-color: color-mix(in srgb, var(--ok) 45%, transparent); color: var(--ok); }
.status-pill.work { border-color: color-mix(in srgb, var(--money) 45%, transparent); color: var(--money); }
.status-pill.wait { border-color: color-mix(in srgb, var(--s-analyze) 45%, transparent); color: var(--link); }
.status-pill.info { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); }
.st-ok { color: var(--ok); } .st-fail { color: var(--fail); } .st-run { color: var(--money); }
.err { color: var(--fail); font-size: 12.5px; max-width: 380px; }
.muted { color: var(--faint); }
.cache { color: var(--faint); font-size: 12.5px; }

.log { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; padding: 8px 0; max-height: 460px; overflow: auto; font-size: 13px; }
.log-row { display: grid; grid-template-columns: 70px 90px 1fr; gap: 10px; padding: 4px 16px; }
.log-row:hover { background: color-mix(in srgb, var(--text) 2%, transparent); }
.log-row .at { color: var(--faint); }
.log-row .who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-row .extra { color: var(--faint); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }
.log-row.warn .m { color: var(--warn); }
.log-row.error .m { color: var(--fail); }

.footnote { color: var(--faint); font-size: 12.5px; max-width: 900px; margin-top: 36px; }

/* ---------- tooltip ---------- */
.tip {
  position: fixed; z-index: 50; pointer-events: none; max-width: 340px;
  background: var(--pop); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; box-shadow: var(--pop-shadow);
}
.tip h5 { margin: 0 0 6px; font-size: 14px; font-weight: 600; }
.tip .row { display: flex; justify-content: space-between; gap: 18px; color: var(--muted); }
.tip .row b { color: var(--text); font-weight: 500; }
.tip .e { color: var(--fail); margin-top: 6px; font-size: 12px; }

/* ---------- navigation / project switcher ---------- */
.brand-link { color: inherit; }
.brand-link:hover { text-decoration: none; }
.seg[hidden] { display: none; }
.proj { font-size: 13px; color: var(--muted); white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- settings ---------- */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 20px; padding: 36px 0 22px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font: 700 clamp(28px, 3.4vw, 44px)/1 var(--display); letter-spacing: -.02em; }
.settings { display: grid; grid-template-columns: 330px 1fr; gap: 18px; align-items: start; }
.plist { display: grid; gap: 10px; margin-bottom: 10px; }
.pcard { text-align: left; background: var(--panel); border: 1px solid var(--line-soft); border-radius: 14px; padding: 14px 16px; display: grid; gap: 4px; width: 100%; }
.pcard:hover { border-color: var(--line); }
.pcard.sel { border-color: color-mix(in srgb, var(--s-analyze) 55%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-analyze) 10%, transparent); }
.pcard.new { border-style: dashed; }
.theme-card { margin-top: 10px; gap: 8px; }
.theme-card:hover { border-color: var(--line-soft); }
.theme-card .seg { justify-self: start; }
.theme-card .foot { margin-top: 0; }
.pcard .row1 { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pcard b { font-size: 15.5px; font-weight: 600; }
.pcard .meta { color: var(--muted); font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .foot { display: flex; gap: 12px; color: var(--faint); font-size: 12.5px; margin-top: 4px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.off { color: var(--faint); }
.badge.bad { color: var(--fail); border-color: color-mix(in srgb, var(--fail) 40%, transparent); }
.add { width: 100%; border: 1px dashed var(--line); background: transparent; border-radius: 14px; padding: 14px; color: var(--muted); font-size: 14px; }
.add:hover { color: var(--text); border-color: var(--muted); }

/* clip, not hidden: keeps the sticky tabs and save bar working */
.form { background: var(--panel); border: 1px solid var(--line-soft); border-radius: 16px; overflow: clip; min-width: 0; }
.form-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.form-head h3 { margin: 0; font: 700 20px/1.1 var(--display); }
.form-head .sub { color: var(--faint); font-size: 13px; margin-top: 4px; }
.form code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.switch { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); border: 0; background: transparent; padding: 4px; border-radius: 8px; }
.switch .sw { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; }
.switch .sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text); transition: transform .15s, background .15s; }
.switch[aria-checked="true"] { color: var(--text); }
.switch[aria-checked="true"] .sw { background: var(--ok); }
.switch[aria-checked="true"] .sw::after { transform: translateX(16px); background: var(--night); }
.form fieldset { border: 0; margin: 0; padding: 20px 22px 6px; display: grid; grid-template-columns: 190px 1fr; gap: 14px 22px; border-bottom: 1px solid var(--line-soft); min-width: 0; }
.form legend { float: left; padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); grid-column: 1 / -1; margin-bottom: 2px; }
.form legend[hidden] { display: none; }

/* project form: tabs, panes, save bar */
.ptabs {
  position: sticky; top: var(--bar-h); z-index: 5; display: flex; gap: 2px; padding: 0 14px; overflow-x: auto;
  background: var(--panel); border-bottom: 1px solid var(--line-soft);
}
.ptabs button {
  border: 0; background: transparent; color: var(--muted); padding: 13px 12px 11px; font-size: 14px; font-weight: 500;
  border-bottom: 2px solid transparent; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap;
}
.ptabs button:hover { color: var(--text); }
.ptabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--s-analyze); }
.ptabs button[hidden] { display: none; }
.pane[hidden] { display: none; }
.pane-lead { margin: 0; padding: 20px 22px 0; color: var(--muted); font-size: 13.5px; max-width: 76ch; }
.pane-issues { display: grid; gap: 8px; padding: 0 22px; }
.pane-issues:not(:empty) { padding-top: 14px; }
.pane fieldset { border-bottom: 0; padding-top: 18px; }
.pane fieldset:not([hidden]) ~ fieldset { margin: 4px 22px 0; padding-inline: 0; border-top: 1px dashed var(--line-soft); }
.pane fieldset:last-child { padding-bottom: 14px; }
.issue-inline {
  display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 10px 12px; border-radius: 10px; font-size: 13.5px;
  border: 1px solid color-mix(in srgb, var(--fail) 35%, transparent); background: color-mix(in srgb, var(--fail) 6%, transparent);
}
.issue-inline .fix { display: block; color: var(--faint); font-size: 12.5px; }
.form .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--faint); }
.form .dot.ok { background: var(--ok); } .form .dot.fail { background: var(--fail); } .form .dot.warn { background: var(--warn); }
.more { font-size: 12.5px; color: var(--faint); }
.more summary { cursor: pointer; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: ""; width: 6px; height: 6px; margin-left: 4px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-2px); }
.more[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.more summary:hover { color: var(--text); }
.more p { margin: 6px 0 0; max-width: 72ch; line-height: 1.5; }
.blast-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.blast-legend span { display: inline-flex; gap: 6px; align-items: center; }
.switch-col { display: grid; gap: 4px; justify-items: start; }
.group-title { color: var(--faint); font-size: 12.5px; margin: 8px 4px -2px; }
.group-title:first-child { margin-top: 0; }
.savebar {
  position: sticky; bottom: 0; z-index: 5; border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(10px);
}
.savebar .actions { padding: 12px 22px; }
.savebar .checks { margin: 12px 22px 0; max-height: 40vh; overflow: auto; }
.dirty { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.dirty[hidden], .check-sum[hidden] { display: none; }
.check-sum { font-size: 13px; }
.check-sum.bad-t { color: var(--fail); } .check-sum.ok-t { color: var(--ok); }
.f-label { font-size: 14px; padding-top: 9px; }
.form fieldset > .group { display: contents; }
.form fieldset > .group[hidden], .form fieldset[hidden] { display: none; }
.f-label small { display: block; color: var(--faint); font-size: 12.5px; margin-top: 2px; line-height: 1.35; }
.f-field { display: grid; gap: 6px; padding-bottom: 8px; align-content: start; min-width: 0; }
.f-field[hidden] { display: none; }
.f-err { color: var(--fail); font-size: 12.5px; }
.f-err:empty { display: none; }
.input { background: var(--night); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; color: var(--text); font: 14px/1.4 var(--ui); width: 100%; min-width: 0; }
.input.mono { font-family: var(--mono); font-size: 13px; }
.input.narrow { max-width: 240px; }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 16%, transparent); }
.input[readonly] { color: var(--muted); background: transparent; }
.input[aria-invalid="true"] { border-color: var(--fail); }
textarea.input { min-height: 84px; resize: vertical; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.help { color: var(--faint); font-size: 12.5px; }
.ok-t { color: var(--ok); } .bad-t { color: var(--fail); }
.kv-list { display: grid; gap: 8px; }
.kv-list:empty { display: none; }
.kv { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 32px; gap: 8px; }
.kv .x, .repo-row .x { border: 0; background: transparent; color: var(--faint); border-radius: 6px; }
.kv .x:hover, .repo-row .x:hover { color: var(--fail); background: color-mix(in srgb, var(--fail) 8%, transparent); }
/* rows of the team form: projects, directions */
.team-rows { display: grid; gap: 8px; }
.team-rows:empty { display: none; }
.team-row { display: grid; gap: 8px 14px; align-items: center; }
.team-row.dir { grid-template-columns: minmax(0, 240px) auto auto minmax(0, 1fr) 32px; }
.team-row.dir .link-btn { justify-self: start; }
.team-row .dir-rules { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 14px; padding: 4px 0 12px; }
.team-row .dir-rules[hidden] { display: none; }
.team-row .dir-rules label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.team-row .dir-rules textarea { resize: vertical; line-height: 1.45; font-size: 13.5px; }
.team-row .dir-rules .help { grid-column: 1 / -1; }
@media (max-width: 900px) { .team-row .dir-rules { grid-template-columns: 1fr; } }
.team-row.proj { grid-template-columns: minmax(0, 1fr) minmax(0, 240px); padding: 8px 0; border-top: 1px solid var(--line-soft); }
.team-row.proj:first-child { border-top: 0; padding-top: 0; }
.team-row.proj.head { padding-bottom: 2px; font-size: 12px; color: var(--faint); }
.team-row .x { border: 0; background: transparent; color: var(--faint); border-radius: 6px; height: 32px; }
.team-row .x:hover { color: var(--fail); background: color-mix(in srgb, var(--fail) 8%, transparent); }
.team-row .pick { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; color: var(--muted); white-space: nowrap; cursor: pointer; }
.team-row .pick input { accent-color: var(--ok); width: 15px; height: 15px; margin: 0; }
.team-row .pick:has(input:checked) { color: var(--text); }
.team-row .pick:has(input:disabled) { cursor: default; opacity: .55; }
.team-row .who { display: grid; gap: 2px; min-width: 0; }
.team-row .who small { color: var(--faint); font-size: 12.5px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-row .who .pick { white-space: normal; }
.form a.ext { color: var(--faint); font-size: 12.5px; }
@media (max-width: 720px) {
  .team-row.dir { grid-template-columns: minmax(0, 1fr) 32px; }
  .team-row.proj { grid-template-columns: minmax(0, 1fr); }
  .team-row.proj.head { display: none; }
}
.repo-list { display: grid; gap: 10px; }
.repo-row { display: grid; grid-template-columns: minmax(0, 150px) minmax(0, 1fr) minmax(0, 130px) 32px; gap: 8px; }
.repo-row [data-repo-role], .repo-row [data-repo-devUrl] { grid-column: 1 / 4; }
.repo-row.single [data-repo-devUrl] { grid-column: 1 / -1; }
.repo-row.single { grid-template-columns: minmax(0, 1fr) minmax(0, 160px); }
.repo-deploy { grid-column: 1 / 4; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.repo-row.single .repo-deploy { grid-column: 1 / -1; }
.repo-deploy label { display: grid; gap: 4px; min-width: 0; }
.repo-deploy label span { color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 720px) { .repo-deploy { grid-template-columns: minmax(0, 1fr); } }
.repo-row:not(.single) + .repo-row { padding-top: 10px; border-top: 1px solid var(--line, color-mix(in srgb, var(--text) 6%, transparent)); }
.model-grid { display: grid; grid-template-columns: max-content minmax(0, 320px); gap: 8px 14px; align-items: center; }
.model-grid label { color: var(--muted); font-size: 13px; }
.model-pick { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; cursor: pointer; }
.model-pick:hover { border-color: var(--focus); }
.model-pick-caret { color: var(--faint); font-size: 11px; }
.model-dialog {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; overflow: auto;
  background: var(--pop); color: var(--text); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--pop-shadow);
}
.model-dialog::backdrop { background: var(--scrim); }
.mp-body { padding: 18px 20px; }
.mp-body > .help { margin: 6px 0 12px; }
.mp-list { display: grid; gap: 6px; }
.mp-group { margin: 12px 0 2px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.mp-opt {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; font: 14px/1.4 var(--ui);
}
.mp-opt:hover { border-color: var(--focus); }
.mp-opt.on { border-color: var(--ok); background: var(--panel-2); }
.mp-name { font-weight: 600; }
.mp-pool { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); font-size: 11px; padding: 0 7px; }
.mp-meta { margin-left: auto; color: var(--muted); font-size: 12.5px; }
.mp-about { flex-basis: 100%; color: var(--muted); font-size: 13px; }
.link-btn { border: 0; background: transparent; color: var(--link); padding: 0; font-size: 13.5px; justify-self: start; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; padding-top: 4px; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: 12.5px; padding: 3px 4px 3px 9px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); }
.tag button { border: 0; background: transparent; color: var(--faint); padding: 0 4px; border-radius: 4px; font-size: 11px; }
.tag button:hover { color: var(--fail); }
.tag-input { width: 110px; background: transparent; border: 1px dashed var(--line); border-radius: 7px; padding: 4px 9px; color: var(--text); font: 12.5px var(--mono); }
.tag-input:focus { outline: none; border-color: var(--focus); border-style: solid; }

.checks { margin: 18px 22px 4px; border: 1px solid var(--line-soft); border-radius: 12px; background: color-mix(in srgb, var(--text) 1.5%, transparent); }
.checks[hidden] { display: none; }
.checks-head { display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.checks ul { list-style: none; margin: 0; padding: 8px 14px 10px; display: grid; gap: 7px; font-size: 13.5px; }
.checks li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; }
.checks .fix { color: var(--faint); font-size: 12.5px; display: block; }

.actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; flex-wrap: wrap; }
.btn { border-radius: 10px; padding: 9px 16px; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--panel-2); }
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.btn.danger { background: transparent; color: var(--fail); border-color: transparent; padding-inline: 0; }
.btn[hidden] { display: none; }
a.btn { color: inherit; text-decoration: none; display: inline-block; }
.toast { color: var(--ok); font-size: 13.5px; }
.toast.error { color: var(--fail); }

/* ---------- responsive / motion ---------- */
@media (max-width: 1000px) {
  .settings { grid-template-columns: 1fr; }
  .form fieldset { grid-template-columns: 1fr; gap: 6px 0; }
  .f-label { padding-top: 6px; }
}
@media (max-width: 1180px) {
  .grid { grid-template-columns: 1fr; }
  .grid > .panel { grid-column: 1 !important; grid-row: auto !important; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(3) { border-right: 0; }
  .kpi:nth-child(n+4) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 720px) {
  main { padding-inline: 16px; }
  .top { height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0 12px; padding: 4px 16px 0; }
  .top > .me { grid-row: 1; grid-column: 3; height: 44px; }
  .top > .me .me-name { display: none; }
  .tabs-nav { grid-row: 2; grid-column: 1 / -1; height: 40px; gap: 20px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs-nav::-webkit-scrollbar { display: none; }
  .top > .status { grid-row: 1; grid-column: 2; }
  .brand { font-size: 16px; }
  .top > .brand, .top > .status { height: 44px; display: flex; align-items: center; }
  .st-age { display: none; }
  .st-btn { padding: 5px 10px; }
  .st-btn .st-extra, .st-btn .long, .st-update { display: none; }
  .st-btn .short { display: inline; }
  .st-pop { width: min(340px, calc(100vw - 32px)); }
  .toolbar { position: static; padding: 10px 16px; }
  .scope { margin-left: 0; text-align: left; width: 100%; }
  .timeline { grid-template-columns: 112px 1fr; }
  .ptabs { position: static; }
  .tl-label { padding-right: 8px; }
  .tl-label .k { white-space: nowrap; }
  .tl-label .runs-meta { display: none; }
  .tl-stand { padding-right: 8px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-right: 0 !important; border-top: 1px solid var(--line-soft); }
  .running { grid-template-columns: 1fr; }
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .log-row { grid-template-columns: 60px 1fr; }
  .log-row .who { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}

[data-compose][hidden] { display: none; }
select.input { appearance: auto; }

/* rules and checks */
.defaults-card { border-style: dashed; margin-top: 10px; }
.switch-row { display: flex; gap: 22px; flex-wrap: wrap; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line-soft); }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 14px; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--s-analyze); font-weight: 600; }
.tabs button .cnt { color: var(--faint); font-size: 12px; margin-left: 5px; font-weight: 400; }
textarea.rules { min-height: 170px; font-size: 12.8px; line-height: 1.55; }
.common-rules { border: 1px dashed var(--line); border-radius: 10px; padding: 9px 14px; color: var(--muted); font-size: 13px; }
.common-rules summary { cursor: pointer; color: var(--text); }
.common-rules pre { white-space: pre-wrap; font-family: var(--mono); font-size: 12px; color: var(--faint); margin: 8px 0 0; max-height: 260px; overflow: auto; }
.form[hidden] { display: none; }
[data-proposals-label][hidden], [data-proposals-field][hidden] { display: none; }
.proposals { display: flex; flex-direction: column; gap: 10px; margin-bottom: 6px; }
.proposal { border: 1px solid var(--line); border-left: 3px solid var(--s-analyze); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.proposal textarea { width: 100%; min-height: 54px; font-size: 13.5px; line-height: 1.45; resize: vertical; }
.proposal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.proposal-meta { color: var(--muted); font-size: 12.5px; min-width: 0; }
.proposal-meta b { color: var(--text); font-weight: 600; }
.btn.small { padding: 5px 12px; font-size: 13px; border-radius: 8px; }

/* server page */
.srv-charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.srv-charts .chart { min-height: 150px; }
tr.grp th { padding-top: 18px; color: var(--text); font-size: 13.5px; font-weight: 600; background: color-mix(in srgb, var(--text) 1.5%, transparent); }
.mono-sm { font-family: var(--mono); font-size: 12px; font-weight: 500; word-break: break-all; }
.warn-t { color: var(--warn); }
[id="docker-error"][hidden] { display: none; }
@media (max-width: 1000px) { .srv-charts { grid-template-columns: 1fr; } }

/* task setup quiz */
.qz { display: grid; grid-template-columns: 300px 1fr; gap: 18px; align-items: start; }
.qz-new { width: 100%; margin-bottom: 12px; }
.qz-view { display: grid; gap: 14px; min-width: 0; }
.qz-screen { display: grid; gap: 14px; }
.qz-idea { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.qz-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; }
.qz-idea-full { margin: 0; color: var(--muted); white-space: pre-wrap; }
.qz-h { margin: 18px 0 10px; font-size: 14px; font-weight: 600; }
.qz-h:first-child { margin-top: 0; }
.qz-start .actions, .qz-screen > .actions, .qz-failed .actions, .qz-redo .actions { padding: 14px 0 0; justify-content: flex-start; }
.qz-products, .qz-options { display: flex; flex-wrap: wrap; gap: 8px; }
.qz-opt { text-align: left; display: grid; gap: 2px; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 14px; max-width: 100%; }
.qz-opt:hover { border-color: var(--muted); }
.qz-opt.on { border-color: var(--s-analyze); box-shadow: 0 0 0 3px color-mix(in srgb, var(--s-analyze) 14%, transparent); }
.qz-opt small { color: var(--faint); font-size: 12px; }
.qz-opt .qz-rec { color: var(--ok); }
.qz-sugg { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.qz-sugg .chip { border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 7px; padding: 3px 9px; font-size: 12.5px; }
.qz-sugg .chip:hover { color: var(--text); border-color: var(--muted); }
.qz-start .tag-input { width: 260px; }
.qz-q h3, .qz-done h3, .qz-failed h3 { margin: 0 0 6px; font-size: 16px; }
.qz-q p { margin: 0 0 8px; }
.qz-q .qz-options { margin: 10px 0; }
.qz-q .input { margin-top: 4px; }
.qz-recon p { margin: 0; line-height: 1.5; }
.qz-recon ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.qz-sub { margin: 12px 0 0; font-size: 13px; color: var(--faint); font-weight: 600; }
.qz-steplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; --c: var(--s-analyze); }
.qz-steplist li { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.qz-steplist li.done { color: var(--muted); }
.qz-mark { color: var(--ok); display: flex; justify-content: center; }
.qz-history summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.qz-qa { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.qz-qa:first-of-type { margin-top: 10px; }
.qz-qa span { color: var(--muted); }
.qz-lbl { display: grid; gap: 6px; font-size: 13.5px; margin-top: 12px; }
.qz-lbl small { color: var(--faint); font-size: 12px; }
.qz-draft textarea { resize: vertical; line-height: 1.45; }
.qz-design-switch { display: grid; gap: 6px; }
.qz-draft > .qz-design-switch { margin-top: 14px; }
.qz-draft .panel-head .qz-mini, .qz-mini { margin-left: auto; padding: 4px 10px; font-size: 12.5px; }
.qz-nested { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 12px; }
.qz-est { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 12px; }
.qz-exec { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.qz-exec-l { font-size: 13.5px; margin-right: 4px; }
.qz-story ul { margin: 6px 0 0; padding-left: 18px; }
.qz-story details { margin-top: 10px; }
.qz-story summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.qz-pre { margin: 10px 0 0; white-space: pre-wrap; font: inherit; font-size: 13.5px; color: var(--muted); max-height: 320px; overflow: auto; }
.qz-story-start { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.qz-story-start .input { width: 280px; }
/* An epic's text before and after the agent's work, side by side. */
.qz-compare { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.qz-was-title { margin: 0; font-size: 15px; font-weight: 600; }
.qz-was .qz-pre { max-height: none; color: var(--text); opacity: .8; }
@media (max-width: 1000px) { .qz-compare { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .qz-est { grid-template-columns: 1fr; } }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
@media (max-width: 1000px) { .qz { grid-template-columns: 1fr; } }

/* apps: list | chat | the app's panel */
.ap-main { max-width: none; padding: 0; }
.ap { --ap-left: 260px; --ap-right: 520px; position: relative; display: grid; grid-template-columns: var(--ap-left) minmax(0, 1fr) var(--ap-right); height: calc(100vh - var(--bar-h)); }
.ap-resize { position: absolute; top: 0; bottom: 0; z-index: 5; width: 9px; margin-left: -4px; cursor: col-resize; touch-action: none; }
.ap-resize[data-side="left"] { left: var(--ap-left); }
.ap-resize[data-side="right"] { right: var(--ap-right); margin: 0 -4px 0 0; }
.ap-resize::after { content: ""; position: absolute; inset: 0 4px; background: transparent; transition: background .15s; }
.ap-resize:hover::after, .ap-resize:focus-visible::after, .ap.resizing .ap-resize.on::after { background: var(--s-analyze); }
.ap-resize:focus-visible { outline: none; }
.ap.resizing { cursor: col-resize; user-select: none; }
.ap.resizing iframe { pointer-events: none; }
.ap-off { margin: 32px; }
.ap-side { border-right: 1px solid var(--line-soft); padding: 18px 14px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ap-cap-h, .ap-box-h h3 { margin: 0; font: 600 11px var(--ui); text-transform: uppercase; letter-spacing: .08em; color: var(--faint); }
.ap-cap-h { margin: 0 8px 4px; }
.ap-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; min-height: 0; }
.ap-item { text-align: left; padding: 10px 12px; border-radius: 10px; display: grid; gap: 2px; color: var(--muted); background: transparent; border: 1px solid transparent; }
.ap-item b { color: var(--text); font-weight: 600; font-size: 14.5px; }
.ap-item small { font-size: 12px; }
.ap-item:hover { border-color: var(--line-soft); }
.ap-item.sel { background: var(--panel-2); border-color: var(--line); }
.ap-you { color: var(--warn); }
.ap-empty { padding: 4px 8px; }
.ap-new { margin-top: auto; border-style: dashed; color: var(--link); font-weight: 600; background: transparent; }
.ap-new.sel { border-color: var(--s-analyze); }
.ap-conns { margin-top: 6px; }
.ap-conn h4 { display: flex; gap: 8px; align-items: center; }
.ap-conn .ap-kv { margin: 8px 0; }
.ap-conn-form { display: grid; gap: 8px; margin-top: 8px; }
.ap-field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.ap-pick { margin-top: 8px; }
.ap-pick select { flex: 1; min-width: 0; }
.ap-capacity { font-size: 12px; color: var(--faint); padding: 8px; line-height: 1.6; }
.ap-bar { height: 5px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin: 2px 0 6px; }
.ap-bar i { display: block; height: 100%; background: var(--s-analyze); }
.ap-bar i.ok { background: var(--ok); }
.ap-link { background: none; border: 0; padding: 0; color: var(--link); font-size: inherit; }
.ap-link:hover { text-decoration: underline; }
.ap-chat { display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); min-width: 0; min-height: 0; }
.ap-head { padding: 14px 22px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; min-height: 58px; flex-wrap: wrap; }
.ap-title { font: 700 17px var(--display); margin: 0; }
.ap-cost { margin-left: auto; font-size: 12px; color: var(--money); font-family: var(--mono); }
.ap-msgs { flex: 1; padding: 18px 22px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.ap-msgs > .idle { margin: auto 0; }
.ap-me { align-self: flex-end; max-width: 72%; background: var(--me-bg); border: 1px solid var(--me-line); padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.ap-bot { max-width: 88%; background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; border-radius: 14px 14px 14px 4px; }
.ap-bot.err { border-color: color-mix(in srgb, var(--fail) 40%, transparent); }
.ap-me time, .ap-who time, .ap-sys time { font-size: 11px; color: var(--faint); margin-left: 8px; }
.ap-me time { display: block; text-align: right; margin: 2px 0 0; }
.ap-who { font-size: 11px; color: var(--faint); margin-bottom: 4px; }
.ap-text { white-space: pre-wrap; }
.ap-bot ul, .ap-bot ol { margin: 4px 0 8px; padding-left: 20px; }
.ap-sys { align-self: center; font-size: 12.5px; color: var(--muted); text-align: center; white-space: pre-wrap; display: flex; gap: 8px; align-items: center; --c: var(--s-analyze); }
.ap-card { margin-top: 10px; border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px 14px; }
.ap-card:first-child { margin-top: 0; }
.ap-card h4 { margin: 0 0 4px; font-size: 14.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ap-card h5 { margin: 10px 0 2px; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ap-card p { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; }
.ap-card .qz-options { margin: 8px 0; }
.ap-ai { border-left: 2px solid var(--s-mockups); padding-left: 10px; }
.ap-money { color: var(--money) !important; font-family: var(--mono); font-size: 12.5px !important; }
.ap-diff { font-family: var(--mono); font-size: 12px; }
.ap-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.ap-row .input { flex: 1; }
.ap-wrap { flex-wrap: wrap; }
.ap-secret .ap-how { white-space: pre-wrap; margin-top: 6px; }
.ap-lock { font-size: 12px; color: var(--faint) !important; margin: 6px 0 0 !important; }
.ap-steps { margin-top: 8px; --c: var(--warn); }
.ap-steps li { font-size: 13px; }
.ap-start { display: grid; gap: 22px; width: 100%; max-width: 760px; margin: 12px auto; }
.ap-start p { margin: 0; color: var(--muted); }
.ap-st-h { font: 700 21px/1.25 var(--display); margin: 0; }
.ap-st-lead { margin-top: 6px !important; font-size: 14.5px; }
.ap-st-cap { margin: 0 0 8px; font-size: 12px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.ap-idea { border: 1px solid var(--line); border-radius: 14px; background: var(--night); transition: border-color .15s, box-shadow .15s; }
.ap-idea:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 14%, transparent); }
.ap-idea textarea { display: block; width: 100%; min-height: 128px; resize: vertical; border: 0; background: transparent; color: var(--text); font: 15px/1.55 var(--ui); padding: 14px 16px 6px; outline: none; }
.ap-idea textarea::placeholder { color: var(--faint); }
.ap-idea-bar { display: flex; align-items: center; gap: 12px; padding: 8px 10px 10px 16px; flex-wrap: wrap; }
.ap-idea-bar .help:first-child { flex: 1; min-width: 180px; }
.ap-idea-bar b { color: var(--muted); font-weight: 500; }
.ap-idea-bar .btn.primary:disabled { opacity: .45; cursor: not-allowed; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); }
.ap-st-examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ap-st-ex { text-align: left; display: grid; gap: 4px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel-2); }
.ap-st-ex:hover { border-color: var(--s-analyze); }
.ap-st-ex b { font-size: 13.5px; font-weight: 600; display: flex; gap: 7px; align-items: center; }
.ap-st-ex b small { margin-left: auto; font-size: 10.5px; color: var(--faint); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; font-weight: 500; }
.ap-st-ex span { color: var(--faint); font-size: 12px; line-height: 1.4; }
.ap-st-flow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; counter-reset: f; }
.ap-st-flow li { counter-increment: f; padding: 12px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); display: grid; gap: 4px; align-content: start; }
.ap-st-flow b { color: var(--text); font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.ap-st-flow b::before { content: counter(f); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--line); flex: none; }
.ap-st-flow .key b::before { background: var(--warn); color: var(--night); }
.ap-st-conns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.ap-st-chip { padding: 2px 10px; border-radius: 999px; border: 1px dashed var(--line); font-size: 12.5px; color: var(--faint); }
.ap-st-chip.on { color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.ap-st-safe { padding: 10px 12px; border-radius: 11px; border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); background: color-mix(in srgb, var(--ok) 5%, transparent); font-size: 13px; }
@media (max-width: 1100px) { .ap-st-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .ap-st-examples, .ap-st-flow { grid-template-columns: 1fr; } }

/* Way to the first release and whose move it is */
.ap-stepper { flex: 1 0 100%; display: flex; list-style: none; margin: 0; padding: 0; }
.ap-stepper li { flex: 1; min-width: 0; display: grid; gap: 6px; padding-right: 6px; }
.ap-stepper li::before { content: ""; height: 4px; border-radius: 4px; background: var(--line); }
.ap-stepper li.done::before { background: var(--ok); opacity: .75; }
.ap-stepper li.now::before { background: linear-gradient(90deg, var(--s-analyze) 0 50%, var(--line) 50%); }
.ap-stepper li.now.you::before { background: linear-gradient(90deg, var(--warn) 0 50%, var(--line) 50%); }
.ap-stepper li.now.bad::before { background: linear-gradient(90deg, var(--fail) 0 50%, var(--line) 50%); }
.ap-stepper li.now.run::before { background: linear-gradient(90deg, var(--s-analyze), var(--s-spec-revise), var(--s-analyze)); background-size: 200% 100%; animation: ap-run 1.6s linear infinite; }
@keyframes ap-run { to { background-position: -200% 0; } }
.ap-stepper span { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-stepper .done span { color: var(--muted); }
.ap-stepper .done span::before { content: "✓ "; color: var(--ok); font-weight: 700; }
.ap-stepper .now span { color: var(--text); font-weight: 600; }
.ap-next { flex: 1 0 100%; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); flex-wrap: wrap; }
.ap-next p { margin: 0; flex: 1 1 260px; min-width: 0; font-size: 13.5px; color: var(--muted); }
.ap-next p b { display: block; color: var(--text); font-size: 14px; }
.ap-next-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-weight: 700; }
.ap-next.agent .ap-next-ic { background: color-mix(in srgb, var(--s-analyze) 16%, transparent); --c: var(--s-analyze); }
.ap-next.you { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 7%, transparent); }
.ap-next.you .ap-next-ic { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.ap-next.bad { border-color: color-mix(in srgb, var(--fail) 45%, transparent); background: color-mix(in srgb, var(--fail) 7%, transparent); }
.ap-next.bad .ap-next-ic { background: color-mix(in srgb, var(--fail) 16%, transparent); color: var(--fail); }
[data-target].ap-flash { animation: ap-flash 1.4s ease-out; }
@keyframes ap-flash { 0%, 30% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 55%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
@media (prefers-reduced-motion: reduce) { .ap-stepper li.now.run::before, [data-target].ap-flash { animation: none; } }
.ap-compose { margin: 0 22px 18px; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; transition: border-color .15s; }
.ap-compose textarea { flex: 1 1 200px; }
.ap-compose.research { border-color: var(--research); box-shadow: 0 0 0 3px color-mix(in srgb, var(--research) 14%, transparent); }
.ap-compose-bar { flex: 1 0 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-compose-bar .seg button[data-mode="research"][aria-pressed="true"] { color: color-mix(in srgb, var(--research) var(--ink-mix), var(--text)); }
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.ap-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; padding: 3px 4px 3px 10px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; background: var(--panel-2); }
.ap-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-chip.loading { opacity: .6; }
.ap-chip button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 2px 6px; border-radius: 999px; font-size: 14px; line-height: 1; }
.ap-chip button:hover { color: var(--text); background: var(--line); }
.ap-attach { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 8px; color: var(--muted); font-size: 13px; cursor: pointer; }
.ap-attach:hover, .ap-attach:focus-within { color: var(--text); background: var(--panel-2); }
.ap-me .ap-tag { display: inline-block; margin-right: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; color: color-mix(in srgb, var(--research) var(--ink-mix), var(--text)); border: 1px solid color-mix(in srgb, var(--research) 45%, transparent); vertical-align: 1px; }
.ap-me .ap-files { display: block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
/* Research card */
.ap-research { border-left: 3px solid var(--research); }
.ap-research h4 .rs-n { font: 600 11px var(--ui); text-transform: uppercase; letter-spacing: .08em; color: color-mix(in srgb, var(--research) var(--ink-mix), var(--text)); }
.ap-research ul.rs-sum { margin: 6px 0 4px; padding-left: 18px; }
.ap-research ul.rs-sum li { margin: 3px 0; }
.ap-research details { margin-top: 8px; }
.ap-research details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.rs-table { margin-top: 10px; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.rs-table table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.rs-table th, .rs-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.rs-table th { position: sticky; top: 0; background: var(--panel-2); font-weight: 600; z-index: 1; }
.rs-table tr:hover td { background: color-mix(in srgb, var(--panel-2) 60%, transparent); }
.rs-cap { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.rs-charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 10px; }
.rs-charts figure { margin: 0; }
.rs-charts a { display: block; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.rs-charts img { display: block; width: 100%; height: auto; }
.rs-charts figcaption { font-size: 12px; color: var(--muted); padding: 4px 2px 0; }
.rs-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rs-files a { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; color: var(--text); text-decoration: none; }
.rs-files a:hover { border-color: var(--research); }
.rs-files small { color: var(--faint); }
.ap-compose[hidden] { display: none; }
.ap-compose .input { border: 0; background: transparent; resize: none; padding: 8px 4px; box-shadow: none; }
.ap-panel { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; min-height: 0; }
.ap-box { padding: 14px 16px; border-radius: 14px; }
.ap-box-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.ap-box-empty { padding: 8px; }
.ap-url { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.ap-kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.ap-kv > span { color: var(--muted); }
.ap-kv > b { font-weight: 500; min-width: 0; }
.ap-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ap-big { font: 700 20px var(--display); margin-bottom: 4px; }
.ap-big.off-t { font-size: 15px; }
.warn-t { color: var(--warn); } .money-t { color: var(--money); } .off-t { color: var(--faint); }
.ap-budget { flex-wrap: wrap; }
.ap-budget .input { flex: 0 0 84px; }
.ap-rel { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.ap-rel:last-child { border: 0; }
.ap-rel b { font-family: var(--mono); width: 30px; flex: none; }
.ap-rel .t { color: var(--muted); flex: 1; min-width: 0; }
.ap-cur { font-size: 12px; white-space: nowrap; }
.ap-acc { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.ap-acc small { display: block; font-size: 11.5px; }
.ap-acc .switch { font-size: 12px; padding: 0; gap: 6px; }
.ap-acc .switch .sw { width: 30px; height: 18px; }
.ap-acc .switch .sw::after { width: 12px; height: 12px; }
.ap-acc .switch[aria-checked="true"] .sw::after { transform: translateX(12px); }
.ap-log { margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ap-log time { font-family: var(--mono); color: var(--faint); }
.ap-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line-soft); margin-bottom: -4px; overflow-x: auto; }
.ap-tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 10px; color: var(--muted); font-size: 13.5px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.ap-tab:hover { color: var(--text); }
.ap-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--s-analyze); }
.ap-tab small { font: 600 11px var(--mono); color: var(--faint); background: var(--panel-2); border-radius: 8px; padding: 1px 6px; }
.ap-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.ap-dot.bad { background: var(--fail); }
.ap-tab-body { display: flex; flex-direction: column; gap: 14px; }
.ap-tab-body:empty { display: none; }
.ap-prev-bar { margin-top: 0; flex-wrap: wrap; }
.ap-prev-bar .ap-link { font-size: 13px; }
.ap-prev-bar + .help { margin: 0; }
.ap-frame { flex: 1; min-height: 420px; display: flex; }
.ap-frame[hidden] { display: none; }
.ap-frame iframe { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.ap-months { margin: 10px 0 4px; font-family: var(--mono); font-size: 12.5px; }

/* apps: dev / prod */
.ap-stage { font-size: 12px; padding: 2px 9px; border-radius: 6px; border: 1px dashed currentColor; white-space: nowrap; }
.ap-stage.dev { color: color-mix(in srgb, var(--s-mockups) var(--ink-mix), var(--text)); }
.ap-stage.prod { color: var(--ok); border-style: solid; background: color-mix(in srgb, var(--ok) 8%, transparent); }
.ap-stage-ctl { display: grid; gap: 4px; justify-items: start; }
.ap-stage-ctl small { font-size: 12px; font-weight: 400; }
.ap-stage-ctl .seg button[data-stage="prod"][aria-pressed="true"] { color: var(--ok); }
.ap-stage-ctl .seg button[data-stage="dev"][aria-pressed="true"] { color: color-mix(in srgb, var(--s-mockups) var(--ink-mix), var(--text)); }
.ap-deploy-note { margin: 6px 0 0 !important; font-size: 12.5px !important; }
.ap-unchecked { color: color-mix(in srgb, var(--s-mockups) var(--ink-mix), var(--text)); }

/* apps: logs — a terminal, with a map of where the errors are */
.ap-logs { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ap-logs[hidden] { display: none; }
.lg-bar { display: grid; gap: 8px; }
.lg-bar .seg { flex-wrap: wrap; justify-self: start; }
.lg-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lg-tools .ap-link { margin-left: auto; font-size: 13px; }
.ap-box-h .ap-link { font-size: 13px; }
.lg-count { font: 600 11px var(--mono); color: var(--fail); margin-left: 2px; }
.lg-follow { font-size: 12.5px; padding: 0; gap: 6px; }
.lg-follow .sw { width: 30px; height: 18px; }
.lg-follow .sw::after { width: 12px; height: 12px; }
.lg-follow[aria-checked="true"] .sw::after { transform: translateX(12px); }
.lg-meta { margin: 0; }
.lg-map { position: relative; height: 10px; border-radius: 3px; background: var(--line-soft); cursor: pointer; overflow: hidden; }
.lg-map[hidden] { display: none; }
.lg-map i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--warn); opacity: .8; }
.lg-map i.error { background: var(--fail); opacity: 1; }
.lg-map:hover i { opacity: 1; }
.lg-view {
  height: 52vh; min-height: 280px; overflow: auto; padding: 6px 0;
  background: var(--term-bg); border: 1px solid var(--line); border-radius: 12px;
  font: 12px/1.55 var(--mono); color: var(--term-text);
}
.lg-l { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 1px 12px 1px 10px; border-left: 2px solid transparent; cursor: pointer; }
.lg-l:hover { background: color-mix(in srgb, var(--text) 3%, transparent); }
.lg-l time { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.lg-l span { white-space: pre-wrap; word-break: break-word; }
.lg-l.warn { border-left-color: var(--warn); }
.lg-l.warn span { color: var(--term-warn); }
.lg-l.error { border-left-color: var(--fail); background: color-mix(in srgb, var(--fail) 5%, transparent); }
.lg-l.error span { color: var(--term-error); }
.lg-l.sel { background: color-mix(in srgb, var(--s-analyze) 16%, transparent); border-left-color: var(--s-analyze); }
.lg-l.flash { animation: lg-flash 1.2s ease-out; }
@keyframes lg-flash { from { background: color-mix(in srgb, var(--warn) 35%, transparent); } }
.lg-empty { margin: 0; padding: 18px 14px; color: var(--muted); font: 13px/1.5 var(--ui); display: flex; gap: 8px; align-items: center; --c: var(--s-analyze); }
.lg-act .ap-row { margin-top: 0; }
.lg-act .help { margin: 6px 0 0; font-size: 12.5px; }
@media (prefers-reduced-motion: reduce) { .lg-l.flash { animation: none; outline: 1px solid var(--warn); } }
@media (max-width: 1440px) { .ap { --ap-left: 240px; --ap-right: 460px; } }
@media (max-width: 1280px) { .ap { --ap-left: 230px; --ap-right: 380px; } .ap-two { grid-template-columns: 1fr; } }
@media (max-width: 1000px) {
  .ap { grid-template-columns: 1fr; height: auto; }
  .ap-resize { display: none; }
  .ap-side, .ap-chat { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .ap-msgs { max-height: 70vh; }
  .ap-me, .ap-bot { max-width: 100%; }
}
