/* Software Factory control center: always-dark console. State colours carry meaning; glow marks live or blocked work. */
:root {
  color-scheme: dark;
  --ground: #0A0E14; --rail: #070A0F; --surface: #10161E; --raised: #151C26; --sunken: #0D121A;
  --line: #1E2732; --line-strong: #2B3644;
  --ink: #E8EDF3; --ink-2: #B6C0CD; --muted: #8592A3;
  --primary: #A898FF; --on-primary: #120D2E;
  --running: #3DD9EB; --queued: #8C96AA; --attention: #FFB547; --done: #4ADE80; --failed: #FF6B6B;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 10px; --r-sm: 7px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --tone: var(--muted);
  box-sizing: border-box;
}
[data-tone="running"] { --tone: var(--running); }
[data-tone="queued"] { --tone: var(--queued); }
[data-tone="attention"] { --tone: var(--attention); }
[data-tone="done"] { --tone: var(--done); }
[data-tone="failed"] { --tone: var(--failed); }
[data-tone="primary"] { --tone: var(--primary); }
[data-tone="muted"] { --tone: var(--muted); }

*, *::before, *::after { box-sizing: inherit; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--ground); color: var(--ink); font: 400 .9375rem/1.5 var(--font); -webkit-font-smoothing: antialiased; caret-color: var(--primary); }
::selection { background: color-mix(in srgb, var(--primary) 38%, transparent); color: #fff; }
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid var(--ground); }
::-webkit-scrollbar-track { background: transparent; }
a { color: var(--primary); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; text-wrap: balance; }
code, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
time { font-variant-numeric: tabular-nums; }
.tcard-foot time, .feed time, .trow time { font-family: var(--mono); }
code { font-size: .85em; padding: 1px 6px; border-radius: 5px; background: var(--raised); border: 1px solid var(--line); }
[data-icon] { display: inline-flex; }
svg.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.rail { position: sticky; top: 0; align-self: start; height: 100vh; display: flex; flex-direction: column; gap: 20px; padding: 20px 14px; background: var(--rail); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 1rem; letter-spacing: -0.01em; padding: 2px 6px; }
.mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--raised); color: var(--primary); box-shadow: inset 0 0 0 1px var(--line-strong), 0 4px 12px -6px #000; }
.mark svg.i { width: 19px; height: 19px; stroke-width: 2; }
.mark.big { width: 48px; height: 48px; border-radius: 12px; }
.mark.big svg.i { width: 28px; height: 28px; }

.server { display: flex; gap: 11px; align-items: center; padding: 11px 12px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; line-height: 1.3; transition: border-color .15s; }
.server:hover { border-color: var(--line-strong); }
.server-text { display: grid; min-width: 0; }
.server-text b { font-size: .75rem; font-weight: 500; color: var(--muted); }
.server-text span { font-size: .8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav { display: grid; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 500; transition: color .15s, background-color .15s; }
.nav a:hover { color: var(--ink); background: var(--surface); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--raised); }
.nav a[aria-current="page"] svg.i { color: var(--primary); }
.badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; font: 600 .6875rem/18px var(--mono); text-align: center; color: #1A1203; background: var(--attention); box-shadow: 0 2px 10px -2px color-mix(in srgb, var(--attention) 70%, transparent); }
.rail-foot { margin-top: auto; display: grid; gap: 4px; }
.main { padding: 26px clamp(16px, 2.6vw, 36px) 72px; max-width: 1480px; width: 100%; outline: none; }
.fab { display: none; }

/* status lamps */
.lamp { position: relative; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--queued); box-shadow: 0 0 0 3px color-mix(in srgb, var(--queued) 22%, transparent); }
.lamp[data-state="ok"] { background: var(--done); box-shadow: 0 0 0 3px color-mix(in srgb, var(--done) 25%, transparent), 0 2px 10px 0 color-mix(in srgb, var(--done) 55%, transparent); }
.lamp[data-state="stale"] { background: var(--failed); box-shadow: 0 0 0 3px color-mix(in srgb, var(--failed) 25%, transparent); }
.lamp[data-state="ok"]::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid var(--done); animation: ping 2.4s var(--ease) infinite; }
.lamp.big { width: 14px; height: 14px; }

/* ---------- page furniture ---------- */
.page-head { display: flex; flex-wrap: wrap; gap: 14px 20px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-head h1 { font-size: 1.625rem; line-height: 1.15; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; color: var(--ink-2); }
.status-head { display: flex; gap: 14px; align-items: center; min-width: 0; }
.back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: .875rem; }
.back:hover { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font: 500 .75rem/1.4 var(--font); color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); }
.live i { width: 7px; height: 7px; border-radius: 50%; background: var(--done); }
.live.tick i { animation: tick .9s var(--ease); }
.live[data-state="stale"] i { background: var(--attention); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.panel h2 { font-size: .9375rem; }
.panel-head a { font-size: .8125rem; font-weight: 500; text-decoration: none; }
.panel-head a:hover { text-decoration: underline; }
.panel + .panel, .stack > * + * { margin-top: 14px; }
.grid2 { margin: 14px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.grid2 > .panel + .panel, .lower > .panel + .panel { margin-top: 0; }

/* ---------- buttons & controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid var(--line-strong); background: var(--raised); color: var(--ink); padding: 7px 14px; border-radius: var(--r-sm); cursor: pointer; font: 500 .875rem/1.2 var(--font); text-decoration: none; transition: border-color .15s, background-color .15s, box-shadow .15s, transform .15s; }
.btn:hover { border-color: #3B4858; background: #1A2230; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; box-shadow: 0 4px 12px -6px #000; }
.btn.primary:hover { background: #B8ABFF; border-color: #B8ABFF; }
.btn.danger { color: var(--failed); border-color: color-mix(in srgb, var(--failed) 40%, var(--line)); background: transparent; }
.btn.danger:hover { background: color-mix(in srgb, var(--failed) 10%, transparent); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--surface); }
.btn.block { width: 100%; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; box-shadow: none; }

input, select, textarea { width: 100%; font: inherit; font-size: .875rem; color: var(--ink); background: var(--sunken); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 8px 11px; min-height: 36px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:hover, select:hover, textarea:hover { border-color: #3B4858; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent); }
select { appearance: none; padding-right: 32px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238592A3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 16px; }
select option, select optgroup { background: var(--raised); color: var(--ink); }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.7); cursor: pointer; }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
textarea.code { font-family: var(--mono); font-size: .8125rem; }
.form { display: grid; gap: 18px; max-width: 760px; }
.field { display: grid; gap: 7px; }
.field > span { font-weight: 500; font-size: .875rem; }
.field small, .hint { color: var(--muted); font-size: .8125rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { color: var(--failed); margin: 0; min-height: 1.2em; font-size: .875rem; }

.seg { display: inline-flex; gap: 4px; padding: 3px; border-radius: 9px; background: var(--sunken); border: 1px solid var(--line-strong); width: fit-content; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.seg label { display: inline-flex; align-items: center; gap: 7px; padding: 6px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; font-size: .875rem; transition: background-color .15s, color .15s; }
.seg input:checked + label { background: var(--raised); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.seg input:focus-visible + label { outline: 2px solid var(--primary); outline-offset: 1px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; font-size: .875rem; color: var(--ink-2); }
.switch input { appearance: none; width: 38px; height: 22px; min-height: 0; padding: 0; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; border: 0; flex: none; transition: background-color .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .2s var(--ease), background-color .2s; }
.switch input:checked { background: color-mix(in srgb, var(--done) 75%, #000); box-shadow: 0 0 14px -2px color-mix(in srgb, var(--done) 60%, transparent); }
.switch input:checked::after { transform: translateX(16px); background: #fff; }
.switch input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- pills, priority, ids ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 8px; border-radius: 999px; font-size: .75rem; font-weight: 500; line-height: 1.5; white-space: nowrap; color: var(--tone); background: color-mix(in srgb, var(--tone) 12%, transparent); border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill[data-tone="muted"] { color: var(--ink-2); }
.prio { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 5px; font: 600 .6875rem/1.5 var(--font); white-space: nowrap; color: var(--ink-2); background: var(--raised); border: 1px solid var(--line-strong); }
.prio[data-p="3"] { color: var(--failed); background: color-mix(in srgb, var(--failed) 12%, transparent); border-color: color-mix(in srgb, var(--failed) 35%, transparent); }
.prio[data-p="2"] { color: var(--attention); background: color-mix(in srgb, var(--attention) 10%, transparent); border-color: color-mix(in srgb, var(--attention) 30%, transparent); }
.prio[data-p="0"] { color: var(--muted); }
.id { font: 500 .75rem/1 var(--mono); color: var(--muted); letter-spacing: .01em; }
.type { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); }
.type svg.i { width: 14px; height: 14px; color: var(--muted); }
/* "Simulated" marks a test run, not a state: neutral, dashed, never a state colour */
.sim { display: inline-flex; align-items: center; gap: 4px; padding: 0 7px 0 5px; border-radius: 5px; font: 600 .6875rem/1.5 var(--font); white-space: nowrap; color: var(--ink-2); border: 1px dashed #3B4858; }
.sim svg.i { width: 12px; height: 12px; color: var(--muted); }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { position: relative; display: grid; grid-template-rows: auto auto 1fr; gap: 6px; padding: 14px 16px 14px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; min-width: 0; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.kpi:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.kpi-label { display: flex; align-items: center; gap: 7px; font-size: .8125rem; font-weight: 500; color: var(--ink-2); }
.kpi-label svg.i { color: var(--tone); width: 15px; height: 15px; }
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.kpi-value { font: 600 2rem/1 var(--font); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: .75rem; color: var(--muted); align-self: end; }
.kpi-sub b { font-weight: 600; color: var(--tone); }
.kpi[data-hot] { border-color: color-mix(in srgb, var(--tone) 45%, var(--line)); box-shadow: 0 10px 30px -14px color-mix(in srgb, var(--tone) 70%, transparent), inset 0 1px 0 color-mix(in srgb, var(--tone) 18%, transparent); }
.kpi[data-hot] .kpi-value { color: var(--tone); }

/* 14-day trend: one series, past days recessive, today in the tile's tone */
.spark { position: relative; display: flex; align-items: flex-end; gap: 2px; height: 34px; width: 112px; flex: none; border-bottom: 1px solid var(--line-strong); }
.spark span { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; }
.spark span::before { content: ""; width: 100%; max-width: 24px; height: calc(var(--v) * 100%); background: color-mix(in srgb, var(--ink-2) 32%, transparent); border-radius: 3px 3px 0 0; transition: background-color .15s; }
.spark span:last-child::before { background: var(--tone); }
.spark span:hover::before { background: var(--ink); }
.spark span:hover::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); right: 0; z-index: 3; padding: 4px 8px; border-radius: 6px; background: var(--raised); border: 1px solid var(--line-strong); color: var(--ink); font: 500 .6875rem/1.3 var(--mono); white-space: nowrap; pointer-events: none; box-shadow: 0 8px 20px -6px #000; }

/* ---------- factory line (signature) ---------- */
.line-panel { margin-bottom: 14px; padding-bottom: 14px; }
.line { list-style: none; margin: 0; padding: 4px 0 2px; display: grid; grid-template-columns: repeat(8, minmax(84px, 1fr)); overflow-x: auto; scroll-snap-type: x proximity; }
.station { position: relative; scroll-snap-align: start; }
.station > a, .station > div { position: relative; display: grid; justify-items: center; gap: 6px; padding: 2px 6px 4px; color: var(--muted); text-decoration: none; text-align: center; border-radius: var(--r-sm); }
.station > a:hover { background: var(--raised); color: var(--ink); }
/* the track: each station draws the segment arriving from its left neighbour */
.station + .station::before { content: ""; position: absolute; top: 11px; right: 50%; left: -50%; height: 2px; background: var(--line-strong); border-radius: 2px; }
.station[data-flow]::before { background: repeating-linear-gradient(90deg, var(--tone) 0 6px, transparent 6px 12px); background-size: 24px 2px; opacity: .8; animation: flow 1.2s linear infinite; }
.node { position: relative; z-index: 1; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--line-strong); }
.node::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.station[data-on] .node { border-color: var(--tone); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tone) 16%, transparent), 0 4px 16px 0 color-mix(in srgb, var(--tone) 55%, transparent); }
.station[data-on] .node::after { background: var(--tone); }
.station[data-passed] .node { border-color: color-mix(in srgb, var(--tone) 55%, var(--line-strong)); }
.station[data-passed] .node::after { background: color-mix(in srgb, var(--tone) 55%, var(--line-strong)); }
.station b { font: 600 1.25rem/1 var(--font); font-variant-numeric: tabular-nums; color: var(--ink-2); }
.station[data-on] b { color: var(--ink); }
.station .st-label { font-size: .75rem; font-weight: 500; line-height: 1.2; }
.station[data-on] .st-label { color: var(--tone); }
.line-off { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.line-off a { text-decoration: none; }
.line.compact { grid-template-columns: repeat(8, minmax(72px, 1fr)); }
.line.compact b { display: none; }
.line.compact .st-label { color: var(--muted); }
.line.compact [data-passed] .st-label { color: var(--ink-2); }
.line.compact .station[data-passed] + .station::before { background: color-mix(in srgb, var(--primary) 55%, var(--line-strong)); }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; align-items: start; }
.col { min-width: 0; border-radius: var(--r); background: var(--sunken); border: 1px solid var(--line); padding: 10px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 10px; }
.col-head h2 { font-size: .875rem; }
.col-head .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.col-head .count { font: 600 .75rem/1 var(--mono); color: var(--ink-2); padding: 3px 7px; border-radius: 999px; background: var(--raised); }
.col-head a { margin-left: auto; font-size: .75rem; font-weight: 500; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.col-head a:hover { color: var(--ink); }
.col-head a svg.i { width: 13px; height: 13px; }
.cards { display: grid; gap: 8px; }
.col-empty { padding: 18px 12px; border-radius: var(--r-sm); border: 1px dashed var(--line-strong); color: var(--muted); font-size: .8125rem; text-align: center; line-height: 1.45; }
.col-more { display: block; padding: 6px; text-align: center; font-size: .75rem; color: var(--muted); text-decoration: none; }
.col-more:hover { color: var(--ink); }

.tcard { display: grid; gap: 8px; padding: 11px 12px 10px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s var(--ease), box-shadow .2s; }
.tcard:hover { border-color: var(--line-strong); transform: translateY(-1px); box-shadow: 0 10px 24px -14px #000; }
.tcard[data-live] { border-color: color-mix(in srgb, var(--tone) 50%, var(--line)); box-shadow: 0 8px 24px -12px color-mix(in srgb, var(--tone) 60%, transparent), inset 0 1px 0 color-mix(in srgb, var(--tone) 15%, transparent); }
.tcard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard-title { margin: 0; font-weight: 500; font-size: .875rem; line-height: 1.35; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tcard-meta { display: flex; align-items: center; gap: 6px; font-size: .75rem; color: var(--muted); min-width: 0; }
.tcard-meta .repo { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tcard-foot time { font-size: .6875rem; color: var(--muted); }
.tcard-note { margin: 0; font-size: .75rem; line-height: 1.45; color: var(--ink-2); }
.tcard-action { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 500; color: var(--tone); }
.tcard-action svg.i { width: 13px; height: 13px; }
.tcard-head > svg.i { color: var(--tone); width: 15px; height: 15px; }
.tcard-tags { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.progress { display: grid; gap: 5px; }
.progress-track { height: 4px; border-radius: 4px; background: var(--raised); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: calc(var(--v) * 100%); border-radius: 4px; background: var(--tone); transition: width .6s var(--ease); }
.progress-label { display: flex; justify-content: space-between; font-size: .6875rem; color: var(--muted); }
.progress-label b { font-weight: 500; color: var(--tone); }

/* ---------- lower dashboard row ---------- */
.lower { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); gap: 14px; align-items: start; }

/* agent (execution server) cards */
.agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.agent { position: relative; display: grid; gap: 12px; padding: 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.agent[data-live] { border-color: color-mix(in srgb, var(--tone) 50%, var(--line)); box-shadow: 0 12px 34px -16px color-mix(in srgb, var(--tone) 70%, transparent), inset 0 1px 0 color-mix(in srgb, var(--tone) 18%, transparent); }
.agent-head { display: flex; align-items: center; gap: 12px; }
.agent-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 9px; background: color-mix(in srgb, var(--tone) 12%, var(--raised)); color: var(--tone); border: 1px solid color-mix(in srgb, var(--tone) 30%, var(--line)); }
.agent-icon svg.i { width: 18px; height: 18px; }
.agent-head h3 { font-size: .9375rem; }
.agent-head .sub { font-size: .75rem; color: var(--muted); }
.agent-head .pill { margin-left: auto; }
.agent p { margin: 0; font-size: .8125rem; color: var(--ink-2); line-height: 1.5; }
.agent > a.small { text-decoration: none; font-weight: 500; width: fit-content; }
.agent > a.small:hover { text-decoration: underline; }
.agent.placeholder { border-style: dashed; border-color: var(--line-strong); background: transparent; }
.meter { display: grid; gap: 6px; }
.meter-track { height: 6px; border-radius: 6px; background: color-mix(in srgb, var(--tone) 14%, var(--raised)); overflow: hidden; }
.meter-track span { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--tone); border-radius: 6px; transition: width .6s var(--ease); }
.meter-label { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); }
.meter-label b { color: var(--ink); font-weight: 600; font-family: var(--mono); }

/* ---------- facts, lists, feeds ---------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: .875rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; padding: 11px 0; }
.row .grow { flex: 1 1 220px; min-width: 0; }
.row .title { font-weight: 500; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.row a.title:hover { color: var(--primary); }
.meta { color: var(--muted); font-size: .8125rem; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 2px; }
.meta .sep::before { content: "·"; color: var(--line-strong); }

/* task rows: the whole row is the link */
.trows { list-style: none; margin: 0; padding: 0; }
.trow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto 76px; gap: 14px; align-items: center; padding: 11px 12px; margin: 0 -12px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; transition: background-color .15s; }
.trows > li + li .trow { border-top: 1px solid var(--line); border-radius: 0; }
.trows > li + li .trow:hover { border-radius: var(--r-sm); }
.trow:hover { background: var(--raised); }
.trow .t-title { min-width: 0; font-weight: 500; overflow-wrap: anywhere; }
.trow time { font-size: .75rem; color: var(--muted); text-align: right; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { position: relative; display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; padding: 9px 0; align-items: start; }
.feed li + li { border-top: 1px solid var(--line); }
.feed .fdot { margin-top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.feed .ftext { font-size: .875rem; color: var(--ink-2); overflow-wrap: anywhere; }
.feed .ftext a { text-decoration: none; font-family: var(--mono); font-size: .8125rem; white-space: nowrap; }
.feed .fmeta { display: block; font: .6875rem/1.6 var(--mono); color: var(--muted); }
.feed time { font-size: .6875rem; color: var(--muted); white-space: nowrap; margin-top: 3px; }

.timeline { list-style: none; margin: 0; padding: 0 0 0 20px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 6px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.timeline li { position: relative; padding: 0 0 14px; font-size: .875rem; color: var(--ink-2); }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--ground); border: 2px solid var(--tone); }
.timeline li:last-child::before { background: var(--tone); }
.timeline time { display: block; color: var(--muted); font-size: .6875rem; margin-top: 2px; }

/* ---------- pull request table ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 280px; max-width: 420px; }
.search svg.i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input { padding-left: 34px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select, .filters input:not([type="search"]) { width: auto; min-width: 150px; }
.filters .search { flex: 1 1 220px; }
.date-filter { display: inline-flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.date-filter input { width: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.fchip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px; font-size: .75rem; color: var(--ink-2); background: var(--raised); border: 1px solid var(--line-strong); text-decoration: none; }
.fchip b { color: var(--ink); font-weight: 500; }
.fchip svg.i { width: 13px; height: 13px; color: var(--muted); }
.fchip:hover svg.i { color: var(--ink); }
.clear-all { font-size: .75rem; color: var(--muted); text-decoration: none; }
.clear-all:hover { color: var(--ink); }
.count-line { font-size: .8125rem; color: var(--muted); margin: 0 0 10px; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.table th { text-align: left; font-size: .75rem; font-weight: 500; color: var(--muted); padding: 10px 14px; background: var(--sunken); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; color: var(--ink-2); }
.table tr:first-child td { border-top: 0; }
.table tbody tr { transition: background-color .15s; }
.table tbody tr:hover { background: var(--raised); }
.pr-cell { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.pr-cell > svg.i { margin-top: 3px; color: var(--tone); }
.pr-cell a { color: var(--ink); text-decoration: none; font-weight: 500; overflow-wrap: anywhere; }
.pr-cell a:hover { color: var(--primary); }
.pr-cell .meta { margin-top: 3px; }
.table td a.mono { text-decoration: none; font-size: .8125rem; }

/* execution runs and their summaries */
.exec-summary { margin: 6px 0 0; font-size: .8125rem; color: var(--ink-2); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row.exec { align-items: flex-start; }
.row.exec > .pill { margin-top: 2px; }

/* coding runs: approval, plan, validation, changes, log */
.panel.approval { border-color: color-mix(in srgb, var(--attention) 45%, var(--line)); box-shadow: 0 10px 30px -16px color-mix(in srgb, var(--attention) 60%, transparent); margin-bottom: 14px; }
.approval-form { display: grid; gap: 12px; margin-top: 14px; max-width: 640px; }
.doc.full { max-height: none; overflow: visible; } /* the plan you're approving reads in the page, not in a box */
.doc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); font-size: .875rem; line-height: 1.6; max-height: 520px; overflow: auto; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line); }
.panel details > summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.panel details > summary::-webkit-details-marker { display: none; }
.panel details > summary h2::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
.panel details[open] > summary h2::before { transform: rotate(90deg); }
.panel details[open] > summary { margin-bottom: 12px; }
.panel details:not(:first-child) > summary { font-size: .8125rem; color: var(--muted); margin-top: 12px; }
.code-block.log { max-height: 420px; overflow: auto; white-space: pre; overflow-wrap: normal; font-size: .75rem; user-select: text; }
.files, .checks { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .8125rem; }
.files li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; }
.files li > span:nth-child(2) { overflow-wrap: anywhere; color: var(--ink-2); }
.fstat { color: var(--muted); }
.checks li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.checks .fdot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.checks code { overflow-wrap: anywhere; justify-self: start; }

/* settings: execution servers */
.panel-lead { margin: -6px 0 12px; font-size: .8125rem; color: var(--muted); max-width: 75ch; }
.server-row { align-items: center; }
.server-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-select { display: inline-flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.inline-select select { width: auto; min-width: 64px; }
.confirm { flex: 1 1 100%; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid color-mix(in srgb, var(--failed) 40%, var(--line)); background: color-mix(in srgb, var(--failed) 7%, var(--sunken)); }
.confirm p { margin: 0 0 10px; font-size: .875rem; color: var(--ink-2); max-width: 75ch; }
.confirm b { color: var(--ink); }
.form.register { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); max-width: none; gap: 14px; }
.form.register .two { max-width: 560px; }
.head-side { display: inline-flex; align-items: baseline; gap: 12px; }
.form.register h3 { font-size: .875rem; }
.reveal { display: grid; gap: 12px; margin-bottom: 14px; padding: 14px 16px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--done) 35%, var(--line)); background: color-mix(in srgb, var(--done) 6%, var(--surface)); }
.reveal p { margin: 0; font-size: .875rem; color: var(--ink-2); max-width: 75ch; }
.reveal b { color: var(--ink); }
.code-block { margin: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line-strong); color: var(--ink); font: 500 .8125rem/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }

/* ---------- banners, empty states, toast, loading ---------- */
.banner { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 13px 16px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--attention) 35%, var(--line)); background: color-mix(in srgb, var(--attention) 8%, var(--surface)); margin-bottom: 14px; color: var(--ink-2); font-size: .875rem; }
.banner > svg.i { grid-row: span 2; margin-top: 2px; color: var(--attention); width: 18px; height: 18px; }
.banner b { color: var(--ink); font-weight: 600; }
.banner.error { border-color: color-mix(in srgb, var(--failed) 40%, var(--line)); background: color-mix(in srgb, var(--failed) 8%, var(--surface)); }
.banner.error > svg.i { color: var(--failed); }
.empty { display: grid; justify-items: start; gap: 4px; padding: 18px 2px 8px; color: var(--muted); font-size: .875rem; }
.empty strong { color: var(--ink); font-weight: 500; font-size: .9375rem; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; color: var(--ink-2); max-width: 75ch; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: var(--r); background: var(--raised); border: 1px solid var(--line-strong); color: var(--ink); font-weight: 500; font-size: .875rem; max-width: calc(100vw - 32px); box-shadow: 0 16px 40px -12px #000; animation: rise .25s var(--ease); }
.skeleton { display: grid; gap: 14px; padding-top: 4px; }
.skeleton span { display: block; height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--surface) 0%, var(--raised) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton span:nth-child(1) { width: 34%; height: 28px; }
.skeleton span:nth-child(2) { height: 96px; }
.skeleton span:nth-child(3) { height: 72px; }
.skeleton span:nth-child(4) { height: 220px; }

/* a newer version of the dashboard is live */
.update { position: fixed; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 16px; border-radius: var(--r); background: var(--raised); border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--line-strong)); color: var(--ink); font-weight: 500; font-size: .875rem; white-space: nowrap; max-width: calc(100vw - 32px); box-shadow: 0 16px 40px -12px #000; animation: rise .25s var(--ease); }

/* a value that changed on a live refresh */
.bump { animation: bump 1.6s var(--ease); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(60rem 30rem at 50% -10%, color-mix(in srgb, var(--primary) 9%, transparent), transparent 70%), var(--ground); }
.login-card { width: min(380px, 100%); display: grid; gap: 14px; padding: 28px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 60px -30px #000; }
.login-card h1 { font-size: 1.5rem; margin-top: 6px; }
.login-card p { margin: 0; color: var(--muted); font-size: .875rem; }

/* ---------- motion ---------- */
@keyframes ping { 0% { transform: scale(1); opacity: .7; } 80%, 100% { transform: scale(2.4); opacity: 0; } }
@keyframes tick { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--done) 70%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
@keyframes flow { to { background-position: 24px 0; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
@keyframes bump { 0% { color: var(--primary); text-shadow: 0 0 18px color-mix(in srgb, var(--primary) 80%, transparent); } 100% { text-shadow: none; } }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lower { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lower > :last-child { grid-column: 1 / -1; }
}
@media (max-width: 1080px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trow { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .trow .prio, .trow time { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; z-index: 10; height: auto; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 0; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; background: color-mix(in srgb, var(--rail) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .brand { padding: 0; }
  .brand > span:last-child { font-size: .9375rem; }
  .server { padding: 6px 10px; gap: 8px; }
  .server-text b { display: none; }
  .server-text span { font-size: .75rem; max-width: 42vw; }
  .nav { grid-column: 1 / -1; display: flex; overflow-x: auto; gap: 2px; margin: 0 -14px; padding: 0 14px 8px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 7px 10px; font-size: .875rem; }
  .nav a svg.i { display: none; }
  .badge { margin-left: 6px; }
  .rail-foot { display: none; }
  .main { padding: 18px 16px calc(96px + env(safe-area-inset-bottom, 0px)); }
  .fab { position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 15; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--primary); color: var(--on-primary); box-shadow: 0 10px 24px -8px #000, 0 4px 10px -4px #000; }
  .fab svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
  .fab[hidden] { display: none; }
  .grid2, .two, .lower { grid-template-columns: 1fr; }
  .lower > :last-child { grid-column: auto; }
  .page-head h1 { font-size: 1.375rem; }
  input, select, textarea { font-size: 1rem; }
  /* phone: what needs you first */
  .board { grid-template-columns: 1fr; }
  .col[data-col="attention"] { order: -2; }
  .col[data-col="running"] { order: -1; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { padding: 12px 14px; border-top: 1px solid var(--line); }
  .table tr:first-child { border-top: 0; }
  .table td { padding: 0; border: 0; }
  .table td + td { margin-top: 6px; }
  .table td[data-label]::before { content: attr(data-label) " "; color: var(--muted); font-size: .75rem; margin-right: 6px; }
  .table td.cell-inline { display: inline-block; margin-right: 10px; }
}
@media (max-width: 560px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpis > :last-child { grid-column: 1 / -1; }
  .kpi { padding: 12px 13px; }
  .kpi-value { font-size: 1.625rem; }
  .spark { width: 84px; height: 28px; }
  /* the whole factory line on a phone: two rows of four stations */
  .line, .line.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 14px; overflow: visible; }
  .station:nth-child(5)::before { display: none; }
  .filters select, .filters input:not([type="search"]) { flex: 1 1 140px; min-width: 0; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .server-actions { width: 100%; justify-content: space-between; }
  .facts dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
