/* Umbrarium dashboard. Dark theme and tokens follow the Showroom Dashboard (same palette, panels, bars, chips, tables); the rules are global
   because this app has one stylesheet. Nothing here sets opacity on content; motion is off when the visitor prefers reduced motion. */
:root {
  --bg: #050608; --bg-2: #090a0e; --surface: #0d0f16; --surface-2: #12151d;
  --border: #1e2430; --border-2: #2c3444;
  --ink: #e9ecf3; --ink-soft: #98a2b3; --ink-faint: #7c869c;
  --ok: #7bd86a; --warn: #e6b450; --bad: #f0796a;
  --accent: #8b7dff; --accent-ink: #b3a9ff;
  --spectrum: linear-gradient(90deg, #f0796a 0%, #f0a15a 16.6%, #e6c450 33.3%, #7bd86a 50%, #4aa3ff 66.6%, #7d7dff 83.3%, #c07dff 100%);
  --bar: #8b7dff; --bar-soft: color-mix(in srgb, #8b7dff 38%, transparent); --grid: color-mix(in srgb, #98a2b3 22%, transparent);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}
/* Light palette: the same tokens, so every rule below works in both. It follows the visitor's system setting; ?theme=dark or ?theme=light (set on <html> by the page) wins. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f4f5fa; --bg-2: #eceef6; --surface: #ffffff; --surface-2: #f0f2f9;
    --border: #dde1ec; --border-2: #c4cbdb;
    --ink: #151a26; --ink-soft: #475066; --ink-faint: #626c85;
    --ok: #26782b; --warn: #8f6200; --bad: #bb3326;
    --accent: #5a49d8; --accent-ink: #4333c0;
    --bar: #5a49d8; --bar-soft: color-mix(in srgb, #5a49d8 34%, transparent); --grid: color-mix(in srgb, #475066 18%, transparent);
    --shadow: 0 1px 2px rgba(20, 26, 38, 0.08);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5fa; --bg-2: #eceef6; --surface: #ffffff; --surface-2: #f0f2f9;
  --border: #dde1ec; --border-2: #c4cbdb;
  --ink: #151a26; --ink-soft: #475066; --ink-faint: #626c85;
  --ok: #26782b; --warn: #8f6200; --bad: #bb3326;
  --accent: #5a49d8; --accent-ink: #4333c0;
  --bar: #5a49d8; --bar-soft: color-mix(in srgb, #5a49d8 34%, transparent); --grid: color-mix(in srgb, #475066 18%, transparent);
  --shadow: 0 1px 2px rgba(20, 26, 38, 0.08);
  color-scheme: light;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.5; }
#app, .app { min-height: 100vh; min-height: 100dvh; }
.app { display: flex; flex-direction: column; }
.app > main { flex: 1 1 auto; min-width: 0; }
a { color: var(--accent-ink); }
h1, h2, h3 { line-height: 1.2; }
.boot, .boot-msg { max-width: 60ch; margin: 3rem auto; padding: 0 1rem; color: var(--ink-soft); }
.boot-msg.err { color: var(--bad); }

/* frame */
.app-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1.2rem; padding: 0.3rem clamp(12px, 1.6vw, 28px); border-bottom: 1px solid var(--border); background: var(--bg-2); }
.app-top .demo-banner { margin-left: auto; }
.app-top .brand { font-weight: 700; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; display: inline-flex; align-items: center; gap: 0.5rem; }
.app-top .brand::before { content: ""; width: 0.9rem; height: 0.9rem; background: var(--spectrum); clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.app-top nav { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.app-top nav a { color: var(--ink-soft); text-decoration: none; padding: 0.25rem 0.7rem; border-radius: 8px; min-height: 2rem; display: inline-flex; align-items: center; font-size: 0.9rem; }
.app-top nav a:hover { color: var(--ink); background: var(--surface-2); }
.app-top nav a.active { color: var(--ink); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
/* single sign-on in the nav (auth.mode oidc): the signed-in name and Sign out share the link metrics (2rem tall, 0.9rem), so they line up at 390, 1280 and 2560 px */
.app-top nav .who { color: var(--ink-soft); font-size: 0.9rem; min-height: 2rem; padding: 0.25rem 0.5rem 0.25rem 0.9rem; display: inline-flex; align-items: center; max-width: min(18rem, 46vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app-top nav form.signout { display: inline-flex; margin: 0; }
.app-top nav .signout button { font: inherit; font-size: 0.9rem; color: var(--ink-soft); background: transparent; border: 0; border-radius: 8px; padding: 0.25rem 0.7rem; min-height: 2rem; cursor: pointer; }
.app-top nav .signout button:hover { color: var(--ink); background: var(--surface-2); }
/* the printed-page header and the print-only notes are drawn for paper only (css/print.css shows them) */
.print-only { display: none; }
.skip { position: absolute; left: -999px; top: 0; background: var(--accent); color: #fff; padding: 0.5rem 1rem; z-index: 10; }
.skip:focus { left: 0; }
.room { max-width: 1180px; margin: 0 auto; padding: 1.6rem 24px 3rem; }
/* the running dashboard uses the whole window: no centred column */
.room.full { max-width: none; margin: 0; padding: 0.8rem clamp(12px, 1.6vw, 28px) 1.6rem; }
.room-head h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 700; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
.lede { font-size: 1.04rem; line-height: 1.55; color: var(--ink-soft); margin: 0 0 1rem; max-width: 70ch; }
.badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1.2rem; }
.badges span { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.3rem 0.75rem; background: var(--surface); }
.app-foot { border-top: 1px solid var(--border); padding: 0.4rem clamp(12px, 1.6vw, 28px); color: var(--ink-faint); font-size: 0.74rem; display: flex; flex-wrap: wrap; gap: 0.2rem 1.2rem; }
.sec { font-size: 1.15rem; font-weight: 650; margin: 1.8rem 0 0.7rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* static shell start panel (same pattern as the Showroom) */
.tool-start { margin: 0 0 1.6rem; padding: 1.1rem 1.2rem 1.2rem; border: 1px solid var(--border-2); border-radius: 12px; background: var(--bg-2); }
.tool-start-note { margin: 0 0 0.9rem; font-size: 0.95rem; line-height: 1.55; color: var(--ink-soft); }
.tool-start-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.tool-start-actions[hidden] { display: none; }
.tool-start-actions .btn { min-height: 2.9rem; padding: 0.7rem 1.4rem; }
.tool-start-boot:not(:empty) { margin-top: 1rem; }

/* shared pieces */
.hint { color: var(--ink-faint); font-size: 0.88rem; line-height: 1.5; margin: 0.4rem 0; }
.err { color: var(--bad); margin: 0.6rem 0 0; }
.ok-text { color: var(--ok); }
code { font-family: var(--mono); font-size: 0.85em; color: var(--accent-ink); background: var(--bg-2); padding: 0.1rem 0.35rem; border-radius: 5px; }
button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, pre:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 0.9rem 1rem 1rem; min-width: 0; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.1rem; font-weight: 650; margin: 0 0 0.6rem; }
.panel h3 { font-size: 0.95rem; font-weight: 650; margin: 0 0 0.6rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem; }
.panel + .panel { margin-top: 1rem; }
.panel h3.sub { display: block; margin: 1.2rem 0 0.5rem; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.6rem 0 0; }
.route { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.1rem 0.5rem; white-space: nowrap; }
.route.plane { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.route.replica-scan { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.route.source { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; font: inherit; font-size: 0.92rem; font-weight: 600; min-height: 2.6rem; padding: 0.5rem 1.1rem; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { color: var(--ink-faint); cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, #fff); }
.btn-primary:disabled { background: var(--surface-2); border-color: var(--border-2); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 2.1rem; padding: 0.25rem 0.8rem; font-size: 0.84rem; }
select, input[type=text], input[type=number], input[type=password], textarea { background: var(--bg-2); color: var(--ink); border: 1px solid var(--border-2); border-radius: 9px; padding: 0.5rem 0.7rem; font: inherit; font-size: 0.93rem; min-height: 2.6rem; max-width: 100%; }
textarea { width: 100%; font-family: var(--mono); font-size: 0.85rem; }
label.field { display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--ink-soft); }
label.field input, label.field select { width: 100%; }
label.check { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.2rem; cursor: pointer; }
input[type=checkbox] { width: 1.15rem; height: 1.15rem; accent-color: var(--accent); }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.8rem; margin: 0.6rem 0; }

/* status */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 1rem; padding: 0.4rem 0.8rem; border: 1px solid var(--border); border-left: 4px solid var(--ink-faint); border-radius: 10px; background: var(--surface); margin: 0; box-shadow: var(--shadow); }
.status .state { display: inline-flex; align-items: center; gap: 0.45rem; }
.status .state::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--ink-faint); }
.status.ok .state::before { background: var(--ok); } .status.info .state::before { background: var(--accent); } .status.warn .state::before { background: var(--warn); } .status.bad .state::before { background: var(--bad); }
.status .feed-readout { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.05rem 0.65rem; font-variant-numeric: tabular-nums; }
.status .feed-readout.moving { color: var(--ink); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.dash-bar { position: sticky; top: 0; z-index: 5; padding: 0.3rem 0 0.4rem; background: var(--bg); }
.dash-bar .progress-box { margin: 0.4rem 0 0; }
.model-line { margin: 0.2rem 0 0.6rem; }
.status.ok { border-left-color: var(--ok); } .status.info { border-left-color: var(--accent); } .status.warn { border-left-color: var(--warn); } .status.bad { border-left-color: var(--bad); }
.status b { font-weight: 700; }
.status .asof { font-family: var(--mono); font-size: 0.84rem; color: var(--ink); }
.status .detail { color: var(--ink-soft); font-size: 0.84rem; flex: 1 1 18rem; }
.notice { padding: 0.7rem 0.9rem; border: 1px solid var(--border-2); border-left: 4px solid var(--warn); border-radius: 10px; background: var(--surface); margin: 0.8rem 0; }
.notice.bad { border-left-color: var(--bad); } .notice.ok { border-left-color: var(--ok); } .notice.info { border-left-color: var(--accent); }
.notice p { margin: 0.2rem 0; }
.progress { height: 0.7rem; margin: 0.5rem 0 0.3rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--spectrum); }
.progress-box { margin: 0 0 0.9rem; }

/* filter bar, tiles, controls */
.filterbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.7rem; margin: 0 0 0.9rem; }
.chips, .toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
.chip { background: transparent; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.35rem 0.8rem; font: inherit; font-size: 0.84rem; cursor: pointer; min-height: 2.2rem; }
.chip.on { color: var(--ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.chip b { margin-left: 0.4rem; color: var(--ink-faint); }
/* saved views menu */
.views { position: relative; }
.views-panel { position: absolute; z-index: 20; top: calc(100% + 0.35rem); right: 0; width: min(30rem, 92vw); max-height: 70vh; overflow: auto; padding: 0.8rem 1rem; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow); text-align: left; }
.views-panel h3 { margin: 0.6rem 0 0.35rem; font-size: 0.92rem; }
.views-panel h3:first-child { margin-top: 0; }
.views-panel .row { margin: 0.5rem 0 0; }
.view-list { list-style: none; margin: 0.3rem 0 0.6rem; padding: 0; display: grid; gap: 0.4rem; }
.view-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; padding: 0.35rem 0; border-top: 1px solid var(--border); }
.view-row:first-child { border-top: 0; }
.view-name { font-weight: 600; overflow-wrap: anywhere; }
.view-actions { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin-left: auto; }
.view-default { cursor: default; min-height: 0; padding: 0.05rem 0.55rem; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border-2); border-radius: 9px; overflow: hidden; }
.seg button { background: transparent; color: var(--ink-soft); border: none; padding: 0.45rem 0.9rem; font: inherit; font-size: 0.86rem; font-weight: 600; cursor: pointer; min-height: 2.4rem; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { color: var(--ink-faint); cursor: not-allowed; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 24rem)); gap: 0.8rem; margin: 0 0 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 12px; padding: 0.8rem 1rem; min-width: 0; }
.tile .n { display: block; font-size: clamp(1.4rem, 1.6vw + 0.6rem, 2rem); font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile .l { display: block; color: var(--ink-soft); font-size: 0.86rem; margin-top: 0.2rem; }
.tile .note { display: block; color: var(--ink-faint); font-size: 0.78rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(28rem, 100%), 1fr)); gap: 1rem; margin: 0 0 1.4rem; align-items: start; }
.grid .wide { grid-column: span 2; }
@media (max-width: 1250px) { .grid .wide { grid-column: 1 / -1; } }
.grid .panel + .panel { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; margin: 0.6rem 0; }
.facts div { background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 0.55rem 0.75rem; min-width: 0; }
.facts dt { font-family: var(--mono); font-size: 0.7rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.facts dd { margin: 0.15rem 0 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* bars */
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.bar { display: grid; grid-template-columns: minmax(5rem, 9.5rem) minmax(0, 1fr) minmax(4.2rem, 6.5rem); align-items: center; gap: 0.55rem; width: 100%; background: transparent; border: none; border-radius: 7px; padding: 0.3rem 0.4rem; cursor: pointer; text-align: left; font: inherit; color: inherit; min-height: 2.1rem; }
.bar.static { cursor: default; }
.bar:hover:not(.static) { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.bar .lbl { font-size: 0.86rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; height: 0.85rem; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--bar); border-radius: 6px; }
.bar.muted .fill { background: var(--bar-soft); }
.bar.on { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: 1px solid var(--accent); }
.bar.on .fill { background: var(--bar); box-shadow: 0 0 0 1px var(--ink); }
.bar:hover:not(.static) .fill { filter: brightness(1.15); }
.bar .val { font-size: 0.84rem; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }

/* columns and the line over them */
.cols-wrap { position: relative; padding-top: 1.1rem; }
.cols { display: flex; gap: 3px; height: 13rem; position: relative; background: linear-gradient(to bottom, var(--grid) 0 1px, transparent 1px) 0 0 / 100% 25% repeat-y; background-origin: content-box; padding-bottom: 0; }
.cols-wrap .peak { position: absolute; top: 0; right: 0; z-index: 1; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-soft); background: var(--surface); padding: 0 0.3rem; border-radius: 4px; font-variant-numeric: tabular-nums; }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding: 0; background: transparent; border: none; border-radius: 3px; cursor: pointer; color: inherit; font: inherit; }
.col.static { cursor: default; }
.col:hover:not(.static) { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.col .well { flex: 1; display: flex; align-items: flex-end; width: 100%; }
.col .stick { display: block; width: 100%; background: var(--bar); border-radius: 2px 2px 0 0; }
.col:hover:not(.static) .stick { filter: brightness(1.2); }
.col.muted .stick { background: var(--bar-soft); }
.col.on .stick { box-shadow: 0 0 0 1px var(--ink); }
.col.on { background: color-mix(in srgb, var(--accent) 14%, transparent); outline: 1px solid var(--accent); }
.col .tick { height: 1.2rem; font-family: var(--mono); font-size: 0.68rem; color: var(--ink-faint); white-space: nowrap; overflow: visible; text-align: center; }
.line-over { position: absolute; left: 0; right: 0; top: 1.1rem; height: calc(100% - 2.3rem); pointer-events: none; }
.line-over polyline { fill: none; stroke: var(--accent-ink); stroke-width: 2; vector-effect: non-scaling-stroke; }
.cols-wrap.line .col .stick { background: var(--bar-soft); }

/* tables */
.table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; margin-top: 0.4rem; }
.table-scroll.tall { max-height: 24rem; overflow-y: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
table.data th, table.data td { padding: 0.4rem 0.7rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data thead th { background: var(--surface-2); color: var(--ink); font-family: var(--mono); position: sticky; top: 0; }
table.data tbody th { font-weight: 600; color: var(--ink); }
table.data td { color: var(--ink-soft); }
table.data .num { text-align: right; }
table.data tr.on { background: color-mix(in srgb, var(--accent) 12%, transparent); }
table.data td.nul { color: var(--ink-faint); font-style: italic; }
table.data tr.dim td, table.data tr.dim th { color: var(--ink-faint); }
button.link { background: none; border: none; padding: 0.25rem 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline dotted; cursor: pointer; min-height: 1.8rem; text-align: inherit; }
th button.link { font-family: var(--mono); }

/* code, scripts, sql */
pre.code { margin: 0.5rem 0; padding: 0.8rem 1rem; max-height: 26rem; overflow: auto; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; font-family: var(--mono); font-size: 0.8rem; line-height: 1.5; color: var(--ink-soft); tab-size: 4; white-space: pre; }
pre.code.small { max-height: 12rem; }
details.fold { border: 1px solid var(--border); border-radius: 10px; padding: 0.4rem 0.8rem; margin: 0.6rem 0; background: var(--bg-2); }
details.fold > summary { cursor: pointer; font-weight: 600; min-height: 2rem; display: flex; align-items: center; }
.sqlbox { margin-top: 0.5rem; }
.sqlbox summary { cursor: pointer; font-size: 0.8rem; color: var(--ink-faint); font-family: var(--mono); }

/* setup */
.steps { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.steps li { font-size: 0.84rem; color: var(--ink-faint); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.3rem 0.8rem; }
.steps li.on { color: var(--ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }
.steps li.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pill { display: inline-block; font-family: var(--mono); font-size: 0.74rem; border: 1px solid var(--border-2); border-radius: 999px; padding: 0.05rem 0.55rem; margin: 0.1rem 0.2rem 0.1rem 0; color: var(--ink-soft); }
.pill.dim { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.pill.mea { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pill.bad { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 50%, transparent); }
.trend { width: 100%; height: 3.2rem; background: var(--bg-2); border: 1px solid var(--border); border-radius: 8px; }
.trend polyline { fill: none; stroke: var(--accent-ink); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.way { border: 1px solid var(--border-2); border-radius: 12px; padding: 0.8rem 1rem; margin: 0.8rem 0; background: var(--bg-2); }
.way h4 { margin: 0 0 0.4rem; font-size: 0.98rem; }
.hint-card { border: 1px solid var(--border-2); border-left: 4px solid var(--warn); border-radius: 12px; padding: 0.9rem 1rem; margin: 0.8rem 0; background: var(--surface); }
.hint-card.dismissed { border-left-color: var(--ink-faint); }
.hint-card .headline { font-weight: 700; margin: 0 0 0.3rem; }
.costline { font-family: var(--mono); font-size: 0.86rem; color: var(--ink); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.8rem; margin: 0.6rem 0; }
.effects { list-style: none; margin: 0.4rem 0; padding: 0; display: grid; gap: 0.4rem; }
.effects li { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px; padding: 0.45rem 0.8rem; background: var(--bg-2); }
.effects li.ok { border-left-color: var(--ok); } .effects li.warn { border-left-color: var(--warn); }
.effects code { margin-right: 0.4rem; }

@media (prefers-reduced-motion: no-preference) {
  .bar .fill, .col .stick, .progress span { transition: width 0.18s ease, height 0.18s ease; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 700px) {
  .room { padding-left: 12px; padding-right: 12px; }
  .app-top { padding-left: 12px; padding-right: 12px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .bar { grid-template-columns: 5.6rem minmax(0, 1fr) 4.4rem; gap: 0.4rem; }
  .cols { gap: 1px; height: 9rem; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 0.55rem; }
  .tile .n { font-size: 1.25rem; }
  .facts { grid-template-columns: 1fr 1fr; }
  .app-foot { padding-left: 12px; padding-right: 12px; }
  .dash-bar { position: static; }
  .status .detail { display: none; }
  .app-top .demo-banner { margin-left: 0; width: 100%; border-radius: 8px; }
  .app-top nav .who { max-width: 11rem; padding-left: 0.5rem; }
  .demo-picker { margin: 0.8rem 0; padding: 0.9rem; }
  .tile { padding: 0.6rem 0.75rem; }
}
/* summary shape */
.summary-banner .banner-detail { color: var(--ink); }
.summary-banner .banner-why { margin: .3rem 0 0; }
.summary-banner .banner-service { margin: .2rem 0 0; }
.ways { margin: .4rem 0 .6rem 1.2rem; padding: 0; display: grid; gap: .3rem; }
.summary-effect { display: block; margin-top: .3rem; font-size: .88rem; color: var(--ink-soft); }
.summary-settings, .summary-offer { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .9rem; margin: .8rem 0; background: var(--bg-2); }
.hint-card.summary-hint .cannot-dismiss { font-style: italic; }

/* browser demo: the permanent banner and the size picker */
.demo-banner { margin: 0; padding: 0.1rem 0.7rem; font-size: 0.74rem; line-height: 1.4; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; background: transparent; }
.demo-picker { max-width: none; margin: 0.8rem 0; padding: 1.2rem clamp(1rem, 2vw, 2rem) 1.4rem; }
.picker-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0.4rem clamp(1.5rem, 3vw, 3rem); }
fieldset.field { border: 0; padding: 0; margin: 0.6rem 0; min-width: 0; }
fieldset.field legend, .field .lbl { color: var(--ink-soft); font-size: 0.85rem; padding: 0; margin-bottom: 0.3rem; }
.optset { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.optset.stack-opts { flex-direction: column; align-items: stretch; }
.opt { display: inline-flex; align-items: center; gap: 0.5rem; border: 1px solid var(--border-2); border-radius: 9px; padding: 0.4rem 0.8rem; min-height: 2.4rem; cursor: pointer; background: var(--surface-2); font-size: 0.9rem; }
.opt:hover { border-color: var(--accent); }
.opt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); font-weight: 600; }
.opt.off { color: var(--ink-faint); cursor: not-allowed; }
.opt input { accent-color: var(--accent); }
.sizes .opt { min-width: 3.6rem; justify-content: center; }
.sizes .opt input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.sizes .opt:focus-within { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.estimate { margin: 0.5rem 0 0; font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); }
label.field.seed input { max-width: 10rem; }
label.field.range { display: grid; gap: 0.15rem; }
label.field.range b { color: var(--ink); font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 1.6rem; padding: 0; }
.row.tight { margin: 0.3rem 0 0.5rem; }

/* the dashboard: a settings strip on the left (demo), the panels filling the rest */
.dash { display: block; }
.dash.has-side { display: grid; grid-template-columns: 17.5rem minmax(0, 1fr); gap: 0 1.1rem; align-items: start; }
.dash-main { min-width: 0; }
/* the strip scrolls on its own; Rebuild / Reset stay in a footer that never scrolls away */
.dash-side { position: sticky; top: 0.6rem; max-height: calc(100vh - 4.2rem); align-self: start; display: flex; flex-direction: column; }
.dash-side .demo-panel { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 4.2rem); padding: 0; overflow: hidden; }
.dash-side .demo-panel h2 { font-size: 1rem; margin: 0; padding: 0.6rem 0.9rem 0.3rem; }
.side-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 0.9rem 0.5rem; }
.side-foot { flex: none; display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.55rem 0.9rem; border-top: 1px solid var(--border); background: var(--surface); }
.side-foot .btn { flex: 1 1 auto; }
.dash-side .panel h3.sub { margin: 0.55rem 0 0.25rem; font-size: 0.9rem; }
.dash-side .row { margin: 0.25rem 0 0; gap: 0.4rem; }
.dash-side .row.tight { margin: 0.1rem 0 0.2rem; }
.dash-side fieldset.field { margin: 0.3rem 0; }
.dash-side .field { margin-top: 0.3rem; margin-bottom: 0.2rem; }
.dash-side fieldset.field legend, .dash-side .field .lbl { font-size: 0.8rem; margin-bottom: 0.15rem; }
.dash-side .hint { margin: 0.2rem 0; font-size: 0.8rem; line-height: 1.4; }
.dash-side .estimate { margin: 0.2rem 0; font-size: 0.78rem; }
.dash-side label.check { min-height: 1.8rem; }
.dash-side .seg button { min-height: 1.9rem; padding: 0.25rem 0.6rem; }
.dash-side input[type=range] { min-height: 1.2rem; }
.dash-side .opt { min-height: 2rem; padding: 0.25rem 0.55rem; }
.dash-side .stack-opts { gap: 0.25rem; }
.dash-side .optset { gap: 0.3rem; }
.dash-side .sizes .opt { padding: 0.25rem 0.5rem; min-width: 2.7rem; min-height: 1.9rem; }
.dash-side .scale { margin: 0.2rem 0 0.4rem; padding: 0.4rem 0.5rem; border: 1px dashed var(--border-2); border-radius: 9px; }
.dash-side .scale .btn { width: 100%; }
.dash-side label.field.range { grid-template-columns: auto 1fr; align-items: center; column-gap: 0.6rem; }
.dash-side label.field.range input { min-width: 0; }
.dash-side label.field.seed.inline { grid-template-columns: auto 1fr; align-items: center; column-gap: 0.6rem; }
.dash-side label.field.seed.inline input { max-width: none; }
.side-toggle { display: none; margin: 0 0 0.6rem; }
@media (max-width: 1000px) {
  .dash.has-side { display: block; }
  .side-toggle { display: inline-flex; }
  .dash-side { display: none; position: static; max-height: none; margin: 0 0 0.8rem; }
  .dash-side .demo-panel { max-height: none; overflow: visible; }
  .side-body { overflow: visible; }
  .side-foot { position: sticky; bottom: 0; }
  .dash-side.open { display: block; }
}

/* the SQL console (demo): the same tokens as the dashboard, so it reads as one app in dark and light */
.sqlview { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1rem; align-items: start; }
.sqlview > .notice { grid-column: 1 / -1; }
.sql-main { min-width: 0; display: grid; gap: 1rem; }
.sql-main .panel + .panel, .sql-side .panel + .panel { margin-top: 0; }
.sql-side { display: grid; gap: 1rem; min-width: 0; align-content: start; }
.sql-editor-panel .row { margin-top: 0.5rem; }
.sql-editor { display: block; width: 100%; min-height: 9rem; resize: vertical; font-family: var(--mono); font-size: 0.88rem; line-height: 1.5; tab-size: 2; white-space: pre; overflow: auto; padding: 0.7rem 0.9rem; background: var(--bg-2); color: var(--ink); border: 1px solid var(--border-2); border-radius: 10px; }
.sql-editor::placeholder { color: var(--ink-faint); }
.sql-editor-panel .feed-readout { margin-left: auto; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); border: 1px solid var(--border-2); border-radius: 999px; padding: 0.05rem 0.65rem; font-variant-numeric: tabular-nums; }
.sql-editor-panel .feed-readout.moving { color: var(--ink); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.sql-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 1.1rem; font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sql-meta .sql-time { color: var(--ink); font-weight: 600; }
.sql-copy { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-left: auto; font-family: var(--font); }
.sql-copy .hint { margin: 0; }
.sql-scroll { max-height: 30rem; overflow: auto; }
table.sql-grid td, table.sql-grid th { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; }
table.sql-grid thead th { z-index: 1; }
table.sql-grid td { color: var(--ink); }
table.sql-grid .null { color: var(--ink-faint); font-style: italic; font-size: 0.8em; letter-spacing: 0.04em; border: 1px solid var(--border); border-radius: 4px; padding: 0 0.3rem; }
table.sql-grid tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--ink) 3%, transparent); }
.sql-error-text { margin: 0.4rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 0.84rem; color: var(--bad); }
pre.sql-plan { max-height: 20rem; color: var(--ink); }
.sql-table { margin: 0.4rem 0; padding: 0.2rem 0.6rem; }
.sql-table summary { flex-wrap: wrap; gap: 0.2rem 0.6rem; font-size: 0.9rem; }
.sql-table summary b { font-family: var(--mono); }
.sql-rowcount { margin-left: auto; font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sql-cols { list-style: none; margin: 0.2rem 0 0.4rem; padding: 0; display: grid; gap: 0.15rem; }
.sql-cols li { display: flex; justify-content: space-between; gap: 0.8rem; font-size: 0.82rem; }
.sql-type { font-family: var(--mono); font-size: 0.76rem; color: var(--ink-faint); }
.sql-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.1rem; }
.sqlview > *, .sql-main > *, .sql-side > *, .sql-list li, .sql-table { min-width: 0; }
.sql-list button.link { display: block; width: 100%; text-decoration: none; font-weight: 500; color: var(--accent-ink); text-align: left; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sql-list button.link:hover { text-decoration: underline; }
.sql-list button.link.mono { font-family: var(--mono); font-size: 0.78rem; }
.sqlbox .run-in-console { margin-top: 0.1rem; }
/* the cheat sheet: one fold per group, a title that loads its example, the general form in code under it */
.cheat-jump { display: none; }
.sql-cheat details.fold { margin: 0.4rem 0; padding: 0.2rem 0.6rem; }
.sql-cheat details.fold > summary { font-size: 0.92rem; }
.cheat-list, .cheat-limits { list-style: none; margin: 0.2rem 0 0.3rem; padding: 0; display: grid; gap: 0.6rem; }
.cheat-limits { gap: 0.4rem; font-size: 0.84rem; color: var(--ink-soft); }
.cheat-entry { min-width: 0; display: grid; gap: 0.1rem; }
.cheat-title { font-weight: 600; font-size: 0.88rem; }
button.link.cheat-title { text-align: left; color: var(--accent-ink); text-decoration: none; }
button.link.cheat-title:hover { text-decoration: underline; }
.cheat-syntax { display: block; font-family: var(--mono); font-size: 0.76rem; color: var(--ink-soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.cheat-note { margin: 0.1rem 0 0; font-size: 0.8rem; }
@media (max-width: 1000px) {
  .cheat-jump { display: inline-flex; }
  .sqlview { grid-template-columns: minmax(0, 1fr); }
  .sql-editor-panel .feed-readout { margin-left: 0; }
}

/* the first-run tour (demo): a dimmed spotlight on the real element and a small popover; the same tokens as the rest */
.tour-help { width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--border-2); background: transparent; color: var(--ink-soft); font: inherit; font-weight: 700; cursor: pointer; line-height: 1; }
.tour-help:hover { color: var(--ink); border-color: var(--accent); }
.tour-backdrop { position: fixed; inset: 0; z-index: 90; background: transparent; }
.tour-spot { position: fixed; z-index: 91; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 100vmax rgba(5, 6, 8, 0.62); outline: 2px solid var(--accent-ink); outline-offset: 0; }
.tour-pop { position: fixed; z-index: 92; width: min(340px, calc(100vw - 24px)); padding: 0.8rem 1rem 0.9rem; background: var(--surface); color: var(--ink); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); }
.tour-pop h2 { font-size: 1.02rem; margin: 0 0 0.3rem; }
.tour-pop p { margin: 0.2rem 0; font-size: 0.9rem; color: var(--ink-soft); }
.tour-pop .tour-count { font-family: var(--mono); font-size: 0.74rem; color: var(--ink-faint); margin: 0 0 0.2rem; }
.tour-actions { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.7rem; }
.tour-spacer { flex: 1; }
.tour-pop.dock { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; }
@media (prefers-reduced-motion: no-preference) {
  .tour-spot { transition: top 0.18s ease, left 0.18s ease, width 0.18s ease, height 0.18s ease; }
  .tour-pop { animation: tour-in 0.16s ease-out; }
  @keyframes tour-in { from { transform: translateY(6px); } to { transform: none; } }
}
@media (max-width: 700px) { .app-top .tour-help { margin-left: auto; } }

/* Alerts: the nav badge, the rule list and the notification inbox */
.count-badge { display: inline-block; min-width: 1.35rem; margin-left: 0.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--accent); color: var(--bg); font-size: 0.74rem; font-weight: 700; line-height: 1.35rem; text-align: center; font-variant-numeric: tabular-nums; }
.alert-form { margin: 0.8rem 0; padding: 0.7rem 0.9rem; border: 1px solid var(--border-2); border-radius: 10px; background: var(--bg-2); }
.alert-form h3 { margin: 0 0 0.4rem; justify-content: flex-start; }
.alert-list, .note-list { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.alert-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 0.4rem 0.8rem; padding: 0.6rem 0; border-top: 1px solid var(--border); }
.alert-row:first-child { border-top: 0; }
.alert-main { min-width: 0; flex: 1 1 22rem; }
.alert-main p { margin: 0.2rem 0 0; }
.alert-actions { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.note { padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 10px; margin: 0.5rem 0; background: var(--surface); }
.note.unread { border-left: 4px solid var(--accent); }
.note-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.6rem; }
.note-text { margin: 0.3rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rls-marker { margin: 0 0 .8rem; }
.rls-issue { color: var(--bad); }
#rls-policies input[type=text] { width: 100%; min-width: 9rem; } #rls-policies input.wide { min-width: 22rem; }
