/* The Operator Console. Its own file, sharing nothing with web/app (ADR 0016,
   ADR 0028); its look is web/prototype/console.html, adopted rather than
   adjusted (ADR 0044), which copies the application's tokens by value.

   Two parts: the prototype's (tokens, sign-in, shell, components), and below
   the line, the rules for what console_form.js, console_setup.js,
   console_boiler.js and the layout editor still draw, until each screen is
   rebuilt onto the prototype in its turn (docs/console-rework.md, step 3). */

:root {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-raised: #172033;
  --border-color: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #7c8ba1;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-yellow: #eab308;
  --accent-red: #ef4444;
  --on-accent: #042f37;
  --tint-cyan: #a5f3fc;
  --tint-red: #fca5a5;
  --tint-amber: #fde68a;
  --tint-green: #86efac;
  --dim: #475569;
  --hi-rgb: 255,255,255;
  --line-rgb: 51,65,85;
  --cyan-rgb: 6,182,212;
  --shadow-k: 1;
  --avatar-bg: linear-gradient(135deg,#0e7490,#334155);
  /* The sign-in is one look in either theme, as the application's is. */
  --gl-bg: #060a12;
  --gl-ink: #f8fafc;
  --gl-muted: #94a3b8;
  --gl-button: #ffffff;
  --gl-button-ink: #0b1220;
  --gl-button-hover: #e2e8f0;
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --gate-font: 'Red Hat Display', 'Outfit', -apple-system, "Segoe UI", sans-serif;
  --gate-mark-font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --appbar-h: 44px;
  --nav-w: 248px;
  --dock-w: 340px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg-primary: #ffffff; --bg-secondary: #f1f5f9; --bg-raised: #f8fafc; --border-color: #cbd5e1;
    --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #64748b;
    --accent-cyan: #0891b2; --accent-green: #059669; --accent-yellow: #ca8a04; --accent-red: #dc2626;
    --on-accent: #ffffff; --tint-cyan: #0e7490; --tint-red: #b91c1c; --tint-amber: #92400e; --tint-green: #15803d;
    --dim: #94a3b8; --hi-rgb: 15,23,42; --line-rgb: 203,213,225; --cyan-rgb: 8,145,178; --shadow-k: .35;
    --avatar-bg: linear-gradient(135deg,#67e8f9,#cbd5e1);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg-primary: #ffffff; --bg-secondary: #f1f5f9; --bg-raised: #f8fafc; --border-color: #cbd5e1;
  --text-primary: #0f172a; --text-secondary: #475569; --text-muted: #64748b;
  --accent-cyan: #0891b2; --accent-green: #059669; --accent-yellow: #ca8a04; --accent-red: #dc2626;
  --on-accent: #ffffff; --tint-cyan: #0e7490; --tint-red: #b91c1c; --tint-amber: #92400e; --tint-green: #15803d;
  --dim: #94a3b8; --hi-rgb: 15,23,42; --line-rgb: 203,213,225; --cyan-rgb: 8,145,178; --shadow-k: .35;
  --avatar-bg: linear-gradient(135deg,#67e8f9,#cbd5e1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg-primary); color: var(--text-primary); font: 13px/1.45 var(--font-main); }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
[hidden], .hidden { display: none !important; }
h1, h2, h3 { text-wrap: balance; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
/* The shell's own pieces start from no margin; what the renderers draw keeps
   the browser's until its screen is rebuilt. */
.appbar *, .nav *, .page-head *, .card-head *, .dock-head *, .pop * { margin: 0; }

/* ------------------------------------------------------------ sign-in -- */
.gate { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center;
  padding: 16px; overflow-y: auto; background: var(--gl-bg); color: var(--gl-ink); font-family: var(--gate-font); }
/* The field (console_backdrop.js): under everything, never in the way of a click. */
.gate-field { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hero { position: relative; z-index: 1; margin: auto 0; width: min(440px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-sub { margin: 0 0 18px; padding: 0 0 8px; border-bottom: 1px solid rgba(255,255,255,.12); color: var(--gl-muted);
  font-size: .72rem; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.hero-title { position: relative; width: min(480px, calc(100vw - 32px)); height: clamp(64px, 16vw, 96px);
  display: flex; align-items: center; justify-content: center; margin: 0 0 14px; color: #f8f5ff;
  font: 800 clamp(2.5rem, 11vw, 72px)/0.9 var(--gate-mark-font); letter-spacing: -.06em; }
.hero-title.is-warped > span { visibility: hidden; }
.hero-warp { position: absolute; inset: 0; }
.hero-badge { display: inline-flex; align-items: center; gap: 8px; margin: 10px 0 26px; padding: 4px 12px; border-radius: 999px;
  border: 1px solid rgba(6,182,212,.45); color: #a5f3fc; font-size: .8rem; letter-spacing: .4px; }
.hero-badge i { width: 6px; height: 6px; border-radius: 50%; background: #06b6d4; }
.ways { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.gbtn { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 0 22px; border-radius: 12px;
  border: 1px solid var(--gl-button); background: var(--gl-button); color: var(--gl-button-ink); font-weight: 600; font-size: .92rem; width: 100%; }
.gbtn:hover { background: var(--gl-button-hover); border-color: var(--gl-button-hover); }
.gbtn.secondary { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: var(--gl-ink); }
.gbtn.secondary:hover { background: rgba(255,255,255,.12); border-color: #06b6d4; }
.gbtn:focus-visible { outline: 2px solid #06b6d4; outline-offset: 3px; }
.gmark { width: 22px; height: 22px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; }
/* One line reserved, so a message appearing mid-click does not move the button. */
.gate-msg { color: var(--gl-muted); font-size: .86rem; margin: 14px 0 0; min-height: 1.35em; }
.gate-msg.err { color: #fca5a5; }
.gate-foot { color: var(--gl-muted); font-size: .82rem; margin: 18px 0 0; max-width: 34ch; }
.maker { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 24px 0 4px;
  color: var(--gl-muted); font-size: .72rem; letter-spacing: .4px; text-align: center; }

/* ------------------------------------------------------------- shell -- */
.app { height: 100%; display: grid; grid-template-rows: var(--appbar-h) minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.appbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 0 10px 0 12px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border-color); min-width: 0; }
.bar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .3px; white-space: nowrap; }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: var(--accent-cyan); display: grid; place-items: center; color: var(--on-accent); font-weight: 800; font-size: 13px; }
.brand small { color: var(--text-muted); font-weight: 500; }
.crumb { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bar-right { display: flex; align-items: center; gap: 6px; }
.jobs-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--border-color);
  color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.jobs-chip:hover { border-color: var(--accent-cyan); color: var(--text-primary); }
.jobs-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-cyan); box-shadow: 0 0 0 3px rgba(var(--cyan-rgb),.2); }
.jobs-chip.idle i { background: var(--dim); box-shadow: none; }
.app-link { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; color: var(--text-secondary);
  text-decoration: none; white-space: nowrap; font-size: 12px; }
.app-link:hover { background: rgba(148,163,184,.12); color: var(--text-primary); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--avatar-bg); display: grid; place-items: center; font-size: 11px; font-weight: 700;
  border: 1px solid rgba(var(--hi-rgb),.15); color: var(--text-primary); flex: none; }
.menu { position: relative; }
.pop { position: absolute; right: 0; top: 38px; z-index: 40; width: 300px; background: var(--bg-secondary); border: 1px solid var(--border-color);
  border-radius: 10px; box-shadow: 0 16px 40px rgba(0,0,0,calc(.5 * var(--shadow-k))); }
.pop-head { display: flex; gap: 12px; align-items: center; padding: 14px; border-bottom: 1px solid var(--border-color); }
.pop-head b { display: block; font-size: 14px; }
.pop-head small { color: var(--text-secondary); }
.pop-sec { padding: 12px 14px; border-bottom: 1px solid var(--border-color); display: grid; gap: 8px; }
.pop-sec:last-child { border-bottom: 0; }
.cap { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-secondary); }

.work { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 0; }
.work.with-dock { grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--dock-w); }

.nav { background: var(--bg-secondary); border-right: 1px solid var(--border-color); overflow: auto; padding: 8px 0 16px; }
.nav-group { padding: 10px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-secondary); }
.nav-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; width: calc(100% - 12px); margin: 1px 6px; padding: 7px 10px;
  border-radius: 7px; text-align: left; color: var(--text-secondary); }
.nav-item b { font-weight: 500; color: var(--text-primary); }
.nav-item span { grid-column: 1 / -1; font-size: 11.5px; color: var(--text-muted); line-height: 1.35; }
.nav-item:hover { background: rgba(148,163,184,.10); }
.nav-item.on { background: rgba(var(--cyan-rgb),.14); }
.nav-item.on b { color: var(--accent-cyan); font-weight: 600; }
.badge { font-style: normal; font-size: 11px; padding: 0 7px; border-radius: 999px; background: rgba(var(--cyan-rgb),.18); color: var(--tint-cyan); align-self: center; }

.main { overflow: auto; min-width: 0; }
.page { padding: 18px 24px 40px; max-width: 1180px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; font-weight: 600; }
.page-head p { color: var(--text-secondary); margin-top: 2px; max-width: 68ch; }
.page-head p:empty { display: none; }
.head-tools { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
#setup-board-wrap { display: grid; gap: 16px; }

.card { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 10px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px 10px; border-bottom: 1px solid var(--border-color); }
.card-head h2 { font-size: 14px; font-weight: 600; }
.card-head p { color: var(--text-secondary); font-size: 12.5px; margin-top: 1px; }
.card-head .r { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.card-body { padding: 14px 16px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.card-body > p { margin: 0; }
.card-foot { padding: 10px 16px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cards2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }

.grid { display: grid; gap: 10px 14px; }
.grid.bottom { align-items: end; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.f { display: grid; gap: 4px; align-content: start; min-width: 0; }
.f.start { justify-items: start; }
.f > label, .f > .lbl { color: var(--text-secondary); font-size: 12px; display: flex; gap: 6px; align-items: baseline; }
.f .opt { color: var(--text-muted); font-size: 11px; }
.f .help { color: var(--text-muted); font-size: 11.5px; line-height: 1.35; }
.in, select.in, textarea.in { width: 100%; min-width: 0; min-height: 32px; padding: 0 9px; border-radius: 6px; background: var(--bg-primary);
  border: 1px solid var(--border-color); outline: none; }
.in.auto { width: auto; }
textarea.in { padding: 8px 9px; min-height: 84px; resize: vertical; }
.in:focus { border-color: var(--accent-cyan); }
.in.bad, .in.invalid { border-color: var(--accent-red); box-shadow: 0 0 0 1px var(--accent-red); }
.in.mono, textarea.mono { font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text-secondary); }
.check input { accent-color: var(--accent-cyan); width: 15px; height: 15px; margin: 0; }

.btn { min-height: 30px; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--bg-primary);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; line-height: 1.2; white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--text-secondary); }
.btn.primary { background: var(--accent-cyan); border-color: var(--accent-cyan); color: var(--on-accent); font-weight: 600; }
.btn.danger { color: var(--tint-red); border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.08); }
.btn.small { min-height: 24px; padding: 2px 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { color: var(--accent-cyan); font-size: 12.5px; }
.link:hover { text-decoration: underline; }

.seg { display: flex; flex-wrap: wrap; background: var(--bg-primary); border: 1px solid var(--border-color); border-radius: 7px; padding: 2px; gap: 2px; }
.seg button { flex: 1 1 auto; min-height: 26px; padding: 2px 10px; border-radius: 5px; color: var(--text-secondary); font-size: 12px; }
.seg button.on { background: var(--accent-cyan); color: var(--on-accent); font-weight: 600; }
/* Six choices as two even rows of three, never five and a straggler. */
.seg.seg3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.seg button:not(.on):hover { color: var(--text-primary); }

.verdict { border-radius: 8px; padding: 9px 12px; border: 1px solid; font-size: 12.5px; margin: 6px 0; }
.verdict.ok { border-color: rgba(16,185,129,.5); background: rgba(16,185,129,.08); color: var(--tint-green); }
.verdict.bad { border-color: rgba(239,68,68,.5); background: rgba(239,68,68,.08); color: var(--tint-red); }
.verdict.next { border-color: rgba(var(--cyan-rgb),.5); background: rgba(var(--cyan-rgb),.08); color: var(--text-primary); }
.verdict.idle { border-color: var(--border-color); color: var(--text-secondary); }
#invite-msg:empty, #seat-msg:empty, #operator-msg:empty { display: none; }

.tbl { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.t th { text-align: left; font-weight: 500; color: var(--text-muted); padding: 6px 8px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
table.t td { padding: 6px 8px; border-bottom: 1px solid rgba(var(--line-rgb),.6); vertical-align: middle; overflow-wrap: anywhere; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n, table.t th.n { text-align: right; }
table.t tr[data-job], table.t tr[data-setup] { cursor: pointer; }
table.t tr[data-job]:hover td, table.t tr[data-setup]:hover td, table.t tr.sel td { background: rgba(var(--cyan-rgb),.08); }

dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; margin: 0; }
dl.kv dt { color: var(--text-muted); }
dl.kv dd { overflow-wrap: anywhere; margin: 0; }

.dock { background: var(--bg-secondary); border-left: 1px solid var(--border-color); min-height: 0; min-width: 0; }
.dock > div { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dock-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border-color); }
.dock-head h2 { font-size: 14px; font-weight: 600; flex: 1; }
.dock-body { flex: 1 1 0%; overflow: auto; padding: 14px; display: grid; gap: 12px; align-content: start; }
.dock-body h3 { font-size: 11px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--text-secondary); margin: 8px 0 4px; }
.dock-actions { padding: 10px 14px; border-top: 1px solid var(--border-color); display: grid; gap: 8px; }
.dock-actions .row { display: flex; gap: 8px; }
.dock-actions .row > * { flex: 1; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; color: var(--text-secondary); font-size: 18px; }
.icon-btn:hover { background: rgba(148,163,184,.12); color: var(--text-primary); }

@media (max-width: 1180px) {
  .work.with-dock { grid-template-columns: var(--nav-w) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .work.with-dock .dock { grid-column: 2; border-left: 0; border-top: 1px solid var(--border-color); max-height: 45vh; }
  .work.with-dock .nav { grid-row: 1 / span 2; }
}
@media (max-width: 900px) {
  .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .app { grid-template-rows: auto minmax(0, 1fr); }
  .appbar { grid-template-columns: minmax(0, 1fr); padding: 8px 12px; gap: 8px; }
  .bar-right { flex-wrap: wrap; }
  .crumb { display: none; }
  .work, .work.with-dock { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .nav { border-right: 0; border-bottom: 1px solid var(--border-color); max-height: 30vh; }
  .work.with-dock .nav { grid-row: auto; }
  .work.with-dock .dock { grid-column: auto; }
  .page { padding: 14px 16px 32px; }
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ==========================================================================
   What the renderers still draw, on the prototype's tokens, until each screen
   is rebuilt. The old names below are aliases, so these rules follow the theme.
   ========================================================================== */
:root {
  --bg: var(--bg-primary); --bg-2: var(--bg-secondary); --line: var(--border-color);
  --text: var(--text-primary); --text-2: var(--text-secondary); --muted: var(--text-muted);
  --accent: var(--accent-cyan); --ok: var(--accent-green); --warn: var(--accent-yellow); --bad: var(--accent-red);
  --radius: 8px;
}
h3 { font-size: 12px; margin: 14px 0 6px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
code { font-size: 12px; }
.note { color: var(--text-2); margin: 6px 0; }
.problems li { color: var(--tint-red); margin: 4px 0; }
.warnings li { color: var(--tint-amber); margin: 4px 0; }
.bad { color: var(--bad); }
.steps { margin: 6px 0; padding-left: 22px; color: var(--text-2); }
.steps .kind { color: var(--muted); font-size: 12px; }
.status { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.s-succeeded { color: var(--tint-green); border-color: rgba(16,185,129,.5); }
.s-failed { color: var(--tint-red); border-color: rgba(239,68,68,.5); }
.s-running { color: var(--tint-cyan); border-color: rgba(var(--cyan-rgb),.5); }
.s-queued { color: var(--tint-amber); border-color: rgba(234,179,8,.5); }
details { margin: 8px 0; }
summary { cursor: pointer; color: var(--text-2); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.tools { display: flex; gap: 4px; flex-wrap: wrap; }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; flex-wrap: wrap; }
.col-head h2 { font-size: 15px; margin: 0; }
.tab { color: var(--text-2); border-bottom: 2px solid transparent; padding: 8px 12px; margin-bottom: -1px; }
.tab[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------------------------- the form (Onboard, Expand, Renew): cards -- */
.form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; align-items: start; }
.facts:empty { display: none; }
.facts { grid-column: span 2; align-self: center; color: var(--text-secondary); }
table.edit td { padding: 4px 6px; vertical-align: top; }
table.edit .in { min-height: 28px; }
table.edit select.in { min-width: 9.5em; }
/* Remove, never broken a letter a line by a narrow table. */
table.edit td:last-child { width: 1%; white-space: nowrap; }
/* A header wraps rather than widening the table past its card. */
table.edit th { vertical-align: bottom; white-space: normal; }
table.edit td.sub-list { min-width: 260px; }
.mini { display: grid; gap: 4px; justify-items: start; }
.mini-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 4px; width: 100%; }
.notes-line { color: var(--text-muted); font-size: 11.5px; line-height: 1.45; margin: 0; }
/* A wide item (a seat): a block of its own, its fields in four labelled columns. */
.item-block { display: grid; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--border-color); }
.item-block:first-child { padding-top: 0; border-top: 0; }
.item-block .item-head { display: flex; justify-content: space-between; align-items: baseline; }
.item-block .item-head b { font-weight: 600; font-size: 12.5px; }
.form-grid.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span2 { grid-column: span 2; }
.item-block .check { min-height: 32px; }
.notes-line b { color: var(--text-secondary); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 28px; }
.chips.invalid { outline: 1px solid var(--accent-red); border-radius: 6px; }
.chip { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--bg-primary); border: 1px solid var(--border-color); white-space: nowrap; }
.chip.on { border-color: var(--accent-cyan); color: var(--tint-cyan); background: rgba(var(--cyan-rgb),.1); }
button.chip:hover { border-color: var(--text-secondary); }
@media (max-width: 900px) { .form-grid, .form-grid.g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .form-grid, .form-grid.g4 { grid-template-columns: minmax(0, 1fr); } .facts, .form-grid .span2 { grid-column: auto; } }
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field label { color: var(--text-2); font-size: 12px; }
.opt { color: var(--muted); font-size: 11px; }
.help { color: var(--muted); font-size: 11.5px; line-height: 1.35; display: block; }
.field input, .field select, .field textarea { color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; min-height: 32px; padding: 0 9px; width: 100%; min-width: 0; }
.field textarea { padding: 8px 9px; }
.field input[type="checkbox"], .field input[type="radio"] { width: 15px; height: 15px; min-height: 0; padding: 0; margin: 0; accent-color: var(--accent-cyan); justify-self: start; }
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field input.invalid, .field select.invalid { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }

/* ------------------------------------------------ the account and the jobs -- */
#account { display: grid; gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--bg-secondary); border: 1px solid var(--border-color); border-radius: 8px; padding: 10px 12px; min-width: 0; }
.stat .k { font-size: 11px; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); }
.stat .v { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v small { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.meter { height: 6px; border-radius: 3px; background: var(--bg-primary); overflow: hidden; margin-top: 6px; }
.meter > i { display: block; height: 100%; background: var(--accent-cyan); }
.meter.full > i { background: var(--accent-yellow); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border-color); white-space: nowrap; color: var(--text-secondary); }
.p-ok { color: var(--tint-green); border-color: rgba(16,185,129,.5); }
.p-run { color: var(--tint-cyan); border-color: rgba(var(--cyan-rgb),.5); }
.p-wait { color: var(--tint-amber); border-color: rgba(234,179,8,.5); }
.p-bad { color: var(--tint-red); border-color: rgba(239,68,68,.5); }
@media (max-width: 720px) { .stats { grid-template-columns: minmax(0, 1fr); } }
.job { display: grid; gap: 8px; }
.job > :first-child { margin-top: 0; }

/* ------------------------------------------------------ setup (ADR 0035) -- */
.state { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.st-done { color: var(--tint-green); border-color: rgba(16,185,129,.5); }
.st-ready { color: var(--tint-cyan); border-color: rgba(var(--cyan-rgb),.5); }
.st-waiting, .st-stale { color: var(--tint-amber); border-color: rgba(234,179,8,.5); }
.st-blocked { color: var(--muted); }
.dots { display: inline-flex; gap: 3px; vertical-align: middle; }
.dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid var(--line); display: inline-block; }
.dot.st-done { background: var(--ok); border-color: var(--ok); }
.dot.st-ready { border-color: var(--accent); }
.dot.st-waiting, .dot.st-stale { border-color: var(--warn); }
/* One plant (ADR 0044): a stepper on the left, one step at a time on the right. */
#setup-plant { display: grid; gap: 16px; }
#setup-plant > .verdict { margin: 0; }
.setup { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.stepper { list-style: none; margin: 0; padding: 6px; display: grid; gap: 2px; }
.step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: center; width: 100%; padding: 7px 8px; border-radius: 7px; text-align: left; }
.step:hover { background: rgba(148,163,184,.10); }
.step.on { background: rgba(var(--cyan-rgb),.14); }
.step .no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border-color); color: var(--text-secondary); }
.step.is-done .no { background: var(--accent-green); border-color: var(--accent-green); color: var(--on-accent); }
.step.is-ready .no { border-color: var(--accent-cyan); color: var(--accent-cyan); }
.step.is-waiting .no, .step.is-stale .no { border-color: var(--accent-yellow); color: var(--accent-yellow); }
.step b { display: block; font-weight: 500; }
.step small { color: var(--text-muted); font-size: 11.5px; }
.head-sub { font-size: 14px; font-weight: 400; }
.box > :first-child { margin-top: 0; }
@media (max-width: 900px) { .setup { grid-template-columns: minmax(0, 1fr); } }
.box { border: 1px dashed var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.editor, .notes { width: 100%; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; resize: vertical; }
.editor { min-height: 320px; }
.notes { min-height: 90px; font-family: inherit; font-size: 13px; }
.actions select { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; min-height: 28px; padding: 0 6px; max-width: 100%; }
.actions .btn, .row-tools .btn { min-height: 28px; }
label.btn { display: inline-flex; cursor: pointer; }

/* ------------------------------------------- the boiler builder (ADR 0036) -- */
.view-toggle { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 8px; }
.boiler h3 { margin-top: 18px; }
.boiler h4 { font-size: 12px; margin: 14px 0 2px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.bx { border: 1px solid var(--line); border-radius: var(--radius); margin: 8px 0; padding: 0 12px; background: var(--bg); }
.bx[open] { padding-bottom: 10px; }
.bx > summary { padding: 9px 0; list-style-position: inside; }
.bx .bx { background: var(--bg-2); }
.grid2, .grid3, .grid4 { display: grid; gap: 0 12px; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 700px) { .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); } }
.boiler .field { margin: 8px 0; }
.boiler .field input[type="color"] { padding: 2px; height: 32px; }
.boiler .field.narrow { margin: 0; }
.boiler td .row-tools { margin-top: 4px; flex-wrap: nowrap; white-space: nowrap; }
.boiler .field .invalid, .boiler input.invalid { border-color: var(--bad); box-shadow: 0 0 0 1px var(--bad); }
.field-err { color: var(--tint-red); font-size: 12px; display: block; }
.sub { border-left: 2px solid var(--line); padding-left: 10px; margin: 6px 0; }
.row-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.stops td, .lines td { padding: 4px 6px; vertical-align: top; }
.lines .cov { display: flex; align-items: center; gap: 4px; }
.lines .cov .field { flex: 1; }
.order { margin: 4px 0; padding-left: 18px; }
.add-zone { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 4px 12px 10px; margin: 14px 0; }
.add-run .run-count { width: 64px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.adv { margin: 6px 0; }

/* ------------------------------------------- the layout editor (ADR 0037) -- */
body.le-open { overflow: hidden; }
.le { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; }
.le-bar { display: grid; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.le-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 30px; }
.le-bar .tab { padding: 5px 9px; }
.le-bar select, .le-bar input[type="number"] { color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.le-sep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.le-spacer { flex: 1; }
.le-inline { color: var(--text-2); display: flex; align-items: center; gap: 4px; }
/* The bar wraps by whole groups, never one control alone; the actions stay right. */
.le-group { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.le-actions { margin-left: auto; }
#le-opacity { width: 90px; accent-color: var(--accent-cyan); }
#le-banner .verdict { margin: 6px 12px; }
.le-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) 360px; }
.le-left, .le-right { overflow: auto; padding: 8px 12px; border-right: 1px solid var(--line); }
.le-right { border-right: 0; border-left: 1px solid var(--line); }
.le-add { display: flex; flex-wrap: wrap; gap: 4px; }
.le-view { position: relative; min-width: 0; min-height: 0; }
.le-view canvas { width: 100%; height: 100%; display: block; }
.le-status { position: absolute; left: 10px; bottom: 8px; right: 10px; color: var(--text-2); font-size: 12px; pointer-events: none; text-shadow: 0 1px 2px #000; }
.le-calib { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: var(--bg-2); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 8px 12px; display: flex; gap: 6px; align-items: center; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree-row { font-size: 13px; color: var(--text); width: 100%; text-align: left; padding: 3px 6px; border-radius: 4px; }
.tree-row:hover { background: var(--bg-2); }
.tree-row.sel { background: rgba(var(--cyan-rgb), .18); }
.tree-type { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--muted); }
.t-wall { background: #2aa4b8; } .t-panel { background: #a78bfa; } .t-ring { background: #f472b6; } .t-box, .t-extrusion { background: #facc15; }
.le-right h3 { margin-top: 6px; }
.le-right h4 { font-size: 12px; margin: 12px 0 2px; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.le-right .field input, .le-right .field select { min-height: 28px; padding: 0 6px; }
.le-right .field { margin: 6px 0; }
.le-right .field.bare { margin: 0; }
.le-right .grid2, .le-right .grid3 { display: grid; gap: 0 8px; }
.le-right .grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.le-right .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.faces tr.sel td { background: rgba(var(--cyan-rgb), .12); }
.warn-text { color: var(--tint-amber); }
.danger-row { margin-top: 14px; }
@media (max-width: 1100px) { .le-body { grid-template-columns: 200px minmax(0, 1fr) 300px; } }
