/* Tokens live in css/tokens.css (loaded first). This file keeps the base rules and the control-tower primitives
   (docs/UI_CONTROL_TOWER.md section 4) in the Autowhat brand (docs/UI_BRAND.md): type, the classic shell, page head, the
   brand motif (eyebrow, heading rule, highlight word), jump tiles, KPI strip, cards on a 12-column grid, dense tables,
   pills, badges, bars and key/value rows. components.css adds the desk components and the newer primitives (segmented
   control, side panel, mini tiles, chart kit); modern.css the interaction polish. Tokens only. */

/* ─── Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 400 var(--fs-body)/var(--lh-body) var(--font-ui);
  font-kerning: normal;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-ui); font-weight: 600; text-wrap: balance; letter-spacing: 0; }
.mono { font-family: var(--font-mono); font-size: var(--fs-note); font-weight: 500; }
code, kbd, pre, samp { font-family: var(--font-mono); }
.num, td.amount, .money { font-variant-numeric: tabular-nums lining-nums; }
.cond { font-family: var(--font-head); }
html:lang(hi) body { font-size: calc(var(--fs-body) + 1px); line-height: 1.58; } /* Devanagari: +1 px, +0.15 line-height */
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.small { font-size: var(--fs-note); }
.xs { font-size: var(--fs-meta); }
.cap { text-transform: uppercase; letter-spacing: var(--ls-cap); font-size: var(--fs-cap); font-weight: 600; color: var(--muted); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.flex { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 6px; }
.grow { flex: 1; min-width: 0; }
.hide { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ─── Shell (classic; the desk shell is shell.css) ───────── */
.app {
  display: grid;
  grid-template-columns: var(--nav-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  height: 100vh;
  overflow: hidden;
}
/* the sidebar carries the one brand stripe: 3 px on its left edge (never on the page, a card or a title) */
.sidebar {
  grid-row: 1 / span 2;
  background: var(--surface);
  border-right: 1px solid var(--line);
  box-shadow: inset 3px 0 0 var(--brand);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.brand {
  min-height: var(--topbar-h); display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 2px; padding: 8px 12px 7px;
  border-bottom: 1px solid var(--line);
}
.brand-logo { height: 40px; width: auto; display: block; }
.sidebar .brand-logo { height: 24px; }
.brand-icon { display: none; width: 22px; height: 22px; object-fit: contain; }
.brand-sub { font-size: var(--fs-xs); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo,
  :root:not([data-theme="light"]) .brand-icon { filter: invert(1); }
}
:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .brand-icon { filter: invert(1); }
.nav { overflow-y: auto; padding: 6px 6px 10px; flex: 1; }
.nav-group { padding: 10px 8px 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: var(--nav-item-h); padding: 6px 8px; border: 0; background: transparent;
  border-radius: var(--r-nav); cursor: pointer; text-align: left; color: var(--ink-2); font-size: var(--fs-body); position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item svg { width: 15px; height: 15px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item .badge { margin-left: auto; }
.sidebar-foot { border-top: 1px solid var(--line); padding: 8px 12px; font-size: var(--fs-meta); color: var(--muted); }
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { font: 600 var(--fs-topbar)/22px var(--font-head); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.topbar .crumbs { color: var(--muted); font-size: var(--fs-small); }
.topbar .spacer { flex: 1; }
/* a small rounded chip (filters, the "Live" pill); .dot is a green status dot */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); font-size: var(--fs-note); line-height: 16px; color: var(--ink-2); background: var(--surface);
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.search {
  display: flex; align-items: center; gap: 6px; padding: 0 9px; height: var(--control-h); width: 260px;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface-2); color: var(--muted); font-size: var(--fs-small);
}
.search kbd { margin-left: auto; font-family: var(--font-mono); font-size: var(--fs-xs); border: 1px solid var(--line-2); border-radius: var(--r-xs); padding: 0 4px; }
/* buttons: 28 px default, .sm 24 px (page-head and card actions), .xs 20 px; one .primary per region. Secondary: white
   with the teal-tinted border, an ice wash and a turquoise edge on hover. Primary: the action teal (white text 4.8:1)
   with the soft teal shadow, deeper on hover, pressed flat */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); cursor: pointer; font-size: var(--fs-small); font-weight: 500;
  white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent-line); }
.btn:active { background: var(--surface-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: var(--accent-shadow); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active { box-shadow: none; }
.btn.sm { height: var(--control-h-sm); padding: 0 8px; font-size: var(--fs-note); }
.btn.xs { height: var(--control-h-xs); padding: 0 6px; font-size: var(--fs-meta); }
.btn svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.main { overflow: auto; padding: 12px var(--gutter) 28px; position: relative; background: var(--bg-glow), var(--bg); }

/* ─── Page head: a 22 px Source Sans 3 title (an optional eyebrow above it and rule under it), one muted line, small buttons on the right ─── */
.page-h, .page-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 12px; }
.page-h > div:not(.actions), .page-head .ph-text { flex: 1 1 auto; min-width: 0; }
.page-h h2, .page-head .ph-title { font: 600 var(--fs-h2)/var(--lh-h2) var(--font-head); letter-spacing: var(--ls-title); color: var(--ink); font-variant-numeric: tabular-nums; }
.page-head .ph-eyebrow { margin-bottom: 3px; }
.page-h p, .page-head .ph-desc { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-small); line-height: var(--lh-small); max-width: 78ch; }
.page-h .actions, .page-head .ph-actions { margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.page-h .actions .btn, .page-head .ph-actions .btn { height: var(--control-h-sm); padding: 0 8px; font-size: var(--fs-note); }

/* ─── The brand motif (docs/UI_BRAND.md section 5): a mono eyebrow with a short leading rule ("02 — YOUR DESK"), a
   heading with one word in the action teal (.hl) and a short turquoise rule under it (.h-rule). For page heads, the
   sign-in page and empty states only, never on every card ─── */
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 4px; font: 500 var(--fs-xs)/var(--lh-xs) var(--font-mono); letter-spacing: var(--ls-eyebrow); text-transform: uppercase; color: var(--eyebrow); }
.eyebrow::before { content: ""; flex: none; width: 18px; height: 1px; background: currentColor; }
.eyebrow .n { font-weight: 600; }
.eyebrow .n::after { content: "—"; margin-left: 8px; font-weight: 400; }
/* Hindi: the caps spacing would pull a Devanagari word apart, and Plex Mono has no Devanagari */
html:lang(hi) .eyebrow { font-family: var(--font-ui); letter-spacing: 0; }
.hl { color: var(--accent-text); }
.h-rule::after { content: ""; display: block; width: 32px; height: 2px; margin-top: 7px; border-radius: 2px; background: var(--rule); }

/* ─── Jump tiles: small cards that open a screen, with a live count ─── */
.jump-tiles, .jump-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(150px, (100% - 56px) / 8), 1fr)); gap: 8px; margin-bottom: 10px; }
.jump {
  position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r-tile); padding: 8px 10px; cursor: pointer; box-shadow: var(--e1), var(--highlight); color: var(--ink); text-decoration: none; font: inherit;
}
.jump { transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background var(--t-fast) ease; }
.jump:hover { border-color: var(--accent-line); background: var(--ice-1); box-shadow: var(--e1-hover), var(--highlight); }
/* the icon sits on a small ice tile (16 px of stroke inside 26 px) */
.jump svg { width: 26px; height: 26px; padding: 5px; border-radius: var(--r-sm); background: var(--ice-2); stroke: var(--accent); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.jump .jump-t { min-width: 0; display: flex; flex-direction: column; }
.jump b { display: block; font-size: var(--fs-small); font-weight: 700; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump i { font-style: normal; font-size: var(--fs-note); line-height: 15px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jump .badge { position: absolute; top: 6px; right: 6px; }
.jump .jump-t:not(:last-child) b { padding-right: 24px; } /* a cut-off title stops short of the count badge */
.jump.crit { border-left: 3px solid var(--crit); }
.jump.warn { border-left: 3px solid var(--warn); }

/* ─── Grid & cards ───────────────────────────────────────── */
.grid, .grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.span-1 { grid-column: span 1; } .span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; }
.span-9 { grid-column: span 9; } .span-10 { grid-column: span 10; } .span-11 { grid-column: span 11; } .span-12 { grid-column: span 12; }
@media (max-width: 1100px) {
  .span-1, .span-2, .span-3 { grid-column: span 4; }
  .span-4, .span-5, .span-6, .span-7, .span-8, .span-9, .span-10, .span-11 { grid-column: span 12; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 56px 1fr; }
  .sidebar .brand { align-items: center; padding: 10px 0; }
  .sidebar .brand-logo, .sidebar .brand-sub, .nav-item span, .nav-group, .sidebar-foot, .nav-item .badge { display: none; }
  .sidebar .brand-icon { display: block; }
  .nav-item { justify-content: center; padding: 8px; }
  .search { display: none; }
  .span-1, .span-2, .span-3 { grid-column: span 6; }
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--e1), var(--highlight);
  display: flex; flex-direction: column; min-width: 0;
}
/* header: a 3 px accent tick, the 12.5 px title, a mono sub-label (the chart type), an "i" explainer, actions */
.card-h {
  display: flex; align-items: center; gap: 8px; min-height: 35px; padding: 8px 11px; border-bottom: 1px solid var(--line);
}
.card-h::before { content: ""; flex: none; width: 3px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent-bright), var(--accent)); }
.card-h h3 { font: 600 var(--fs-h3)/var(--lh-h3) var(--font-head); letter-spacing: 0; color: var(--ink); }
.card-h .sub { color: var(--muted); font: 400 var(--fs-xs)/14px var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-h .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 10px 11px; flex: 1; min-width: 0; }
.card-b.tight { padding: 0; }
.card-b.tight > .card-cap { padding: 0 11px 8px; }
.card-f { padding: 6px 11px; border-top: 1px solid var(--line); font-size: var(--fs-note); color: var(--muted); }
.card-cap { margin: 6px 0 0; font-size: var(--fs-meta); line-height: var(--lh-meta); color: var(--muted); }

/* ─── KPI strip: up to 8 equal cells a row; status cells carry a 3 px left edge ─── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(max(128px, (100% - 56px) / 8), 1fr)); gap: 8px; }
.kpis.fixed { grid-template-columns: repeat(auto-fill, minmax(max(128px, (100% - 56px) / 8), 1fr)); }
/* on a wide screen 9–14 cells split into two even rows (12 as 6 + 6, 13 as 7 + 6), never 8 + 4 or 8 + 5 with a hole at
   the end of the second row; a .fixed strip keeps its 1/8 cells */
@media (min-width: 1280px) {
  .kpis:not(.fixed):has(> .kpi:nth-child(9):last-child), .kpis:not(.fixed):has(> .kpi:nth-child(10):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpis:not(.fixed):has(> .kpi:nth-child(11):last-child), .kpis:not(.fixed):has(> .kpi:nth-child(12):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .kpis:not(.fixed):has(> .kpi:nth-child(13):last-child), .kpis:not(.fixed):has(> .kpi:nth-child(14):last-child) { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
.kpis + .grid, .kpis + .grid-12, .kpis + .card, .kpis + .kpis { margin-top: var(--gap); }
.kpi {
  position: relative; display: block; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 8px 10px 7px; box-shadow: var(--e1), var(--highlight); color: var(--ink); text-decoration: none;
  background: linear-gradient(180deg, var(--ice-1), var(--surface) 36px), var(--surface); /* the quiet top light */
}
/* a short turquoise hairline at the top-left: the brand's rule, once a strip, on its first cell (as the website draws it
   once under a heading; on every cell it turned into 20–30 dashes a screen). A cell wrapped in a link (.hub-kpi) counts
   as its wrapper; status cells keep their left edge */
.kpi::before { content: ""; position: absolute; left: 10px; top: 0; width: 28px; height: 2px; border-radius: 0 0 2px 2px; background: var(--rule); opacity: .75; pointer-events: none; display: none; }
.kpis > .kpi:first-child::before, .kpis > :first-child > .kpi::before { display: block; }
a.kpi:hover, button.kpi:hover { border-color: var(--accent-line); }
.kpi .l { font-size: var(--fs-cap); line-height: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: var(--ls-cap); font-weight: 600; }
.kpi .v { font: 600 var(--fs-kpi)/var(--lh-kpi) var(--font-head); letter-spacing: -.01em; margin-top: 3px; color: var(--ink); font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.kpi .v small, .kpi .v .u { font: 500 var(--fs-small)/1 var(--font-ui); color: var(--muted); margin-left: 3px; }
.kpi .d { font-size: var(--fs-meta); line-height: 15px; margin-top: 2px; display: flex; align-items: center; gap: 6px; color: var(--muted); position: relative; z-index: 1; text-shadow: 0 0 2px var(--surface), 0 0 2px var(--surface); } /* legible over the sparkline */
.kpi .spark { position: absolute; right: 8px; bottom: 6px; opacity: .9; line-height: 0; pointer-events: none; }
.kpi .spark svg { display: block; }
.up { color: var(--good-text); } .down { color: var(--crit-text); } .flat { color: var(--muted); }
.kpi .d.up { color: var(--good-text); } .kpi .d.down { color: var(--crit-text); }
.kpi.crit { border-left: 3px solid var(--crit); }
.kpi.serious { border-left: 3px solid var(--serious); }
.kpi.warn { border-left: 3px solid var(--warn); }
.kpi.good { border-left: 3px solid var(--good); }

/* ─── Pills / badges ─────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: var(--r-pill); font-size: var(--fs-cap); font-weight: 600; white-space: nowrap; line-height: 15px; letter-spacing: .01em; vertical-align: middle; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; flex: none; }
.pill.good { background: var(--good-soft); color: var(--good-text); }
.pill.warn { background: var(--warn-soft); color: var(--warn-text); }
.pill.serious { background: var(--serious-soft); color: var(--serious-text); }
.pill.crit { background: var(--crit-soft); color: var(--crit-text); }
.pill.neutral, .pill.muted { background: var(--surface-2); color: var(--ink-2); }
.pill.accent { background: var(--accent-soft); color: var(--accent-text); }
.pill.info { background: var(--info-soft); color: var(--info-text); }
.pill.ai { background: var(--ai-soft); color: var(--ai-text); }
.pill.plain::before { display: none; }
/* count badges: 16 px pills, white on crit for late / urgent work, neutral otherwise */
.badge { display: inline-flex; min-width: 16px; height: 16px; padding: 0 5px; align-items: center; justify-content: center; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; line-height: 16px; background: var(--crit); color: var(--crit-ink); font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.badge.soft, .badge.muted { background: var(--surface-3); color: var(--ink-2); }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.tag { display: inline-block; padding: 0 5px; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--fs-meta); line-height: 15px; color: var(--ink-2); }

/* ─── Tables: caps headers on an ice tint, 29 px rows, ice hover, a turquoise-soft selected row with the teal edge, mono
   ids, right-aligned tabular numbers ─── */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
.tbl th { text-align: left; font-weight: 600; font-size: var(--fs-cap); line-height: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: var(--ls-cap); padding: 6px 9px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--ice-1); position: sticky; top: 0; z-index: 1; }
.tbl td { height: var(--row-h-dense); padding: 5px 9px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; line-height: 18px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono, .tbl td.id, .tbl .id { font-family: var(--font-mono); font-size: var(--fs-note); font-weight: 600; }
.tbl td .sub { display: block; font: 400 var(--fs-meta)/14px var(--font-ui); color: var(--muted); } /* plain text under a mono id too */
.tbl .bar { min-width: 60px; }
.tbl-scroll { max-height: 420px; overflow: auto; }
.row-sel td, .tbl tr.sel td, .tbl tr[aria-selected="true"] td { background: var(--sel) !important; }
.tbl tr.sel td:first-child, .tbl tr[aria-selected="true"] td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.row-sel td .muted, .row-sel td .sub, .tbl tr.sel td .muted, .tbl tr.sel td .sub, .tbl tr[aria-selected="true"] td .muted, .tbl tr[aria-selected="true"] td .sub { color: var(--ink-2); } /* --sel is a tint: the second line steps up */
.tbl.plain tbody tr:nth-child(even) td { background: transparent; }

/* ─── Forms ──────────────────────────────────────────────── */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r-sm); overflow: hidden; background: var(--surface); vertical-align: middle; }
.seg button { border: 0; background: transparent; padding: 3px 9px; font-size: var(--fs-note); line-height: 16px; cursor: pointer; color: var(--ink-2); border-right: 1px solid var(--line); white-space: nowrap; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button.on, .seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); } /* the 2 px teal underline: 4.2:1 on the soft fill (5.2:1 dark), an indicator that reads without the colour of the fill */
select.sel, input.inp { height: var(--control-h); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: var(--r-sm); padding: 0 8px; font: inherit; font-size: var(--fs-small); }
/* every single-line select draws the flat token chevron (light and dark) instead of the OS bezel, like the forms and the
   list filters. :not(#\#) lifts the rule over the feature sheets' `background:` shorthands, which would otherwise wipe the
   chevron and leave a select with no arrow at all; the list filters' own #toolbar rule still has the last word. */
select:not([multiple]):not([size]):not(#\#) {
  appearance: none; padding-right: 24px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
input[type=range] { accent-color: var(--accent); }
.toolbar { display: flex; gap: 6px 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

/* ─── Progress / bars ────────────────────────────────────── */
.bar { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.bar.good > i { background: var(--good); } .bar.warn > i { background: var(--warn); } .bar.crit > i { background: var(--crit); } .bar.serious > i { background: var(--serious); }
.bar.s1 > i { background: var(--s1); } .bar.s2 > i { background: var(--s2); } .bar.s3 > i { background: var(--s3); } .bar.s4 > i { background: var(--s4); }
.meter { display: grid; grid-template-columns: 1fr auto; gap: 3px 8px; align-items: center; font-size: var(--fs-small); }
.meter .bar { grid-column: 1 / -1; margin-bottom: 5px; }
.stack { display: flex; height: 8px; border-radius: 3px; overflow: hidden; gap: 2px; background: var(--surface); }
.stack > i { display: block; height: 100%; }
.legend { display: flex; gap: 4px 12px; flex-wrap: wrap; font-size: var(--fs-note); color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ─── Lists & feeds ──────────────────────────────────────── */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 8px 1fr auto; gap: 9px; padding: 7px 11px; border-bottom: 1px solid var(--line); align-items: start; }
.feed-item:last-child { border-bottom: 0; }
.feed-item .sev { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.sev.crit { background: var(--crit); } .sev.serious { background: var(--serious); } .sev.warn { background: var(--warn); } .sev.good { background: var(--good); } .sev.info { background: var(--s1); }
.feed-item .t { font-weight: 500; }
.feed-item .m { color: var(--muted); font-size: var(--fs-note); }
.feed-item .when { color: var(--muted); font-size: var(--fs-meta); white-space: nowrap; }
/* key / value rows: muted key, ink value */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: var(--fs-small); }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; font-weight: 500; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.insight { border: 1px solid var(--ai-line); background: var(--ai-soft); border-radius: var(--r-md); padding: 8px 10px; font-size: var(--fs-small); }
.insight .h { font-weight: 600; color: var(--ai-text); display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.insight .h svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.insights { display: flex; flex-direction: column; gap: 8px; }
.insights-clip { max-height: 340px; overflow: auto; padding-right: 2px; }
.card.d3cmd-card, .card.insights-card { align-self: start; }
.card.d3cmd-card .card-b { padding: 8px 10px 6px; }
.d3cmd { height: 340px; }
.d3cmd svg { display: block; width: 100%; height: 100%; }
.d3cmd-meta { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-meta); color: var(--muted); margin-top: 4px; line-height: 1.3; }
.d3cmd-brush .selection { fill: var(--accent); fill-opacity: .12; stroke: var(--accent); }

/* ─── Charts (ui.js helpers; the chart kit core/charts.js styles its own .ck marks in components.css) ─── */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font-ui); font-size: 10px; fill: var(--muted); }
.chart .grid-l { stroke: var(--grid); stroke-width: 1; }
.chart .axis-l { stroke: var(--axis); stroke-width: 1; }
.chart .lbl { fill: var(--ink-2); font-size: var(--fs-meta); }
/* the centre of ui.js donut() and gauge(): a 600 tabular number over a small muted word */
.ring-v { font: 600 var(--fs-h2) var(--font-head); fill: var(--ink); font-variant-numeric: tabular-nums; }
.ring-v.lg { font-size: var(--fs-kpi); }
.ring-s { font: 400 var(--fs-xs) var(--font-ui); fill: var(--muted); }
.tooltip { position: fixed; pointer-events: none; z-index: 50; background: var(--ink); color: var(--bg); padding: 5px 8px; border-radius: 5px; font-size: var(--fs-note); box-shadow: var(--e2); opacity: 0; transition: opacity .08s; white-space: nowrap; }
.tooltip.on { opacity: 1; }

/* ─── Heatmap / calendar ─────────────────────────────────── */
.heat { display: grid; gap: 2px; }
.heat i { display: block; aspect-ratio: 1; border-radius: 2px; background: var(--surface-3); }

/* ─── Map (Kepler-style) ─────────────────────────────────── */
/* the map, video-wall and tooltip chrome is a dark canvas in both themes: the brand's near-black teal (tokens.css
   --map-bg / --map-land / --map-line, hue ~193° like the dark theme), its literal text greys AA on it (#7fa3aa 6.8:1,
   #9fbcc2 9.2:1, #e2f1f4 15.9:1 on --map-bg); status reds, greens and yellows keep their own */
.map-wrap { position: relative; background: var(--map-bg); border-radius: 6px; overflow: hidden; }
.map-wrap svg { display: block; width: 100%; height: min(78vh, 720px); }
.map-land { fill: var(--map-land); stroke: var(--map-line); stroke-width: 1; }
.map-label { fill: #8fb3ba; font-size: 9px; font-family: var(--font-ui); }
.map-panel { position: absolute; top: 10px; left: 10px; width: 210px; background: rgba(6, 22, 27, .92); color: #e2f1f4; border: 1px solid var(--map-line); border-radius: 6px; font-size: 11px; backdrop-filter: blur(4px); }
.map-panel h4 { font-family: var(--font-ui); font-size: 11px; font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--map-line); color: #fff; }
.map-panel > p { padding: 8px 10px 0; line-height: 1.45; }
.map-layer { display: flex; align-items: center; gap: 8px; padding: 5px 10px; cursor: pointer; }
.map-layer:hover { background: rgba(255, 255, 255, .05); }
.map-layer .sw { width: 10px; height: 10px; border-radius: 2px; }
.map-layer input { margin: 0; accent-color: #2cc6e6; }
.map-legend { position: absolute; right: 10px; bottom: 52px; background: rgba(6, 22, 27, .92); border: 1px solid var(--map-line); color: #e2f1f4; border-radius: 6px; padding: 7px 10px; font-size: 10.5px; }
.map-time { position: absolute; left: 10px; right: 10px; bottom: 10px; background: rgba(6, 22, 27, .92); border: 1px solid var(--map-line); color: #e2f1f4; border-radius: 6px; padding: 6px 10px; font-size: 11px; display: flex; align-items: center; gap: 10px; }
.map-time input[type=range] { flex: 1; accent-color: #2cc6e6; }
.map-stats { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; }
.map-stat { background: rgba(6, 22, 27, .92); border: 1px solid var(--map-line); color: #e2f1f4; border-radius: 6px; padding: 5px 9px; font-size: 10.5px; }
.map-stat b { display: block; font-family: var(--font-head); font-size: 16px; color: #fff; line-height: 1.1; }
.map-tip { position: absolute; pointer-events: none; background: var(--map-bg); color: #e2f1f4; border: 1px solid var(--map-line); padding: 5px 8px; border-radius: 5px; font-size: 11px; opacity: 0; white-space: nowrap; }
.map-tip.on { opacity: 1; }
.live-geo-wrap { height: min(78vh, 720px); min-height: 520px; background: var(--map-bg); }
.kepler-wrap { height: min(86vh, 860px); min-height: 620px; background: var(--map-bg); }
.kepler-wrap .live-geo-map { z-index: 5; }
.kepler-wrap .map-legend,
.kepler-wrap .map-time { display: none; }
.kepler-wrap .map-panel { display: block; z-index: 8; pointer-events: auto; }
.kepler-wrap .map-stats { display: flex; z-index: 8; }
.kepler-boot { display: flex; align-items: center; justify-content: center; height: 100%; color: #9fbcc2; font-size: 13px; letter-spacing: .02em; }
.kepler-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--map-bg); }
.map-fly { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 8px; }
.map-fly-btn { border: 1px solid var(--line); background: var(--surface); color: inherit; border-radius: 7px; padding: 5px 8px; cursor: pointer; font: inherit; text-align: left; line-height: 1.2; min-width: 108px; }
.map-fly-btn:hover, .map-fly-btn.cmd { border-color: var(--accent); }
.map-fly-btn.cmd { background: var(--accent-soft); }
.map-fly-btn.hq { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.map-fly-btn.plan { opacity: .7; border-style: dashed; }
.map-fly-btn b { display: block; font-size: 11.5px; }
.map-fly-btn i, .map-fly-btn em { display: block; font-style: normal; font-size: 9.5px; color: var(--muted); }
.map-fly-btn em { font-size: 9px; margin-top: 1px; }
.map-fly-btn.hq i, .map-fly-btn.hq b, .map-fly-btn.hq em { color: var(--accent-ink); }
.map-panel.kepler-note { width: 268px; max-height: calc(100% - 20px); overflow: auto; }
.map-panel .map-kv { margin: 8px 10px 4px; }
.map-panel .map-kv dt { color: #9fbcc2; }
.map-panel .map-kv dd { color: #e2f1f4; }
.map-insights { max-height: 420px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.map-base { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.map-base button { border: 0; background: var(--surface); color: inherit; padding: 5px 10px; font: inherit; cursor: pointer; }
.map-base button.on { background: var(--accent); color: var(--accent-ink); }
.live-geo-map { position: absolute; inset: 0; }
.live-geo-wrap .map-panel, .live-geo-wrap .map-stats, .live-geo-wrap .map-legend, .live-geo-wrap .map-time { z-index: 5; }
.live-geo-wrap .maplibregl-control-container { position: relative; z-index: 4; }
.live-geo-wrap .map-panel { box-shadow: 0 12px 34px rgba(0, 0, 0, .38); }
.map-source { margin-top: 4px; padding: 7px 10px; border-top: 1px solid var(--map-line); color: #7fa3aa; font-family: var(--font-mono); font-size: 9.5px; line-height: 1.45; }
.legend-cube { display: inline-block; width: 9px; height: 9px; margin-right: 6px; transform: skewY(-20deg); background: #0a9bba; border: 1px solid #9fe3f2; box-shadow: 2px -2px 0 #06606f; }
.legend-cube.plant { background: #ff5360; border-color: #ffc1c6; box-shadow: 2px -2px 0 #9b2732; }

/* ─── D3 network (globe / force / sankey / chord) ─────────── */
.d3viz-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.d3viz-bar .seg { flex-shrink: 0; }
.d3viz-bar #d3viz-cap { flex: 1 1 280px; line-height: 1.4; }
.d3viz { position: relative; min-height: 520px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.d3viz svg { display: block; width: 100%; height: auto; }
.d3viz .d3-sphere { fill: #0a1a2e; stroke: #3d6a94; stroke-width: 1.4; }
.d3viz .d3-grat { fill: none; stroke: rgba(180, 210, 240, .22); stroke-width: .6; }
.d3viz .d3-india { fill: #2f6a44; stroke: #b8ffd2; stroke-width: 1.2; }
.d3viz .d3-night { fill: rgba(4, 10, 22, .22); pointer-events: none; }
.d3viz-tip { position: absolute; pointer-events: none; z-index: 6; max-width: 240px; padding: 6px 8px; border-radius: 5px; background: rgba(6, 22, 27, .96); color: #e2f1f4; border: 1px solid #2e5d69; font-size: 11px; line-height: 1.45; opacity: 0; transform: translateY(4px); }
.d3viz-tip.on { opacity: 1; transform: none; }
[data-theme="light"] .d3viz .d3-sphere { fill: #9ec5e8; stroke: #6a93b8; }
[data-theme="light"] .d3viz .d3-grat { stroke: rgba(20, 40, 70, .16); }
[data-theme="light"] .d3viz .d3-india { fill: #cfe8c4; stroke: #2d6b3a; }
[data-theme="light"] .d3viz .d3-night { fill: rgba(20, 40, 80, .12); }
.live-geo-wrap .maplibregl-ctrl-attrib { background: rgba(6, 22, 27, .82); color: #9fbcc2; }
.live-geo-wrap .maplibregl-ctrl-attrib a { color: #a6e4f1; }
.live-geo-wrap .mapboxgl-map, .live-geo-wrap .maplibregl-map { font-family: var(--font-ui); }
.live-geo-wrap .deck-tooltip { background: rgba(6, 22, 27, .96) !important; color: #e2f1f4 !important; border: 1px solid #2e5d69; border-radius: 5px; font-family: var(--font-ui); font-size: 11px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }

/* ─── Copilot drawer ─────────────────────────────────────── */
.drawer {
  position: fixed; top: 44px; right: 0; bottom: 0; width: 360px; background: var(--surface); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: transform .18s ease; z-index: 40; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.drawer.open { transform: none; }
.drawer-h { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.drawer-h h3 { font-size: 13px; font-family: var(--font-ui); white-space: nowrap; }
.drawer-b { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.drawer-f { border-top: 1px solid var(--line); padding: 10px 12px; }
.msg { max-width: 95%; padding: 8px 10px; border-radius: 8px; font-size: 11.5px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }
.msg.ai b { color: var(--ink); }
.msg .ev { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.msg .ev span { font-size: 10px; padding: 1px 6px; border-radius: 3px; background: var(--surface); border: 1px solid var(--line-2); color: var(--ink-2); font-family: var(--font-mono); }
.sugg { display: flex; flex-wrap: wrap; gap: 5px; }
.sugg button { font-size: 10.5px; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); cursor: pointer; }
.ask { display: flex; gap: 6px; }
.ask input { flex: 1; height: 30px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--surface-2); color: var(--ink); padding: 0 9px; font: inherit; font-size: 11.5px; }

/* ─── Digital twin ───────────────────────────────────────── */
.twin svg { width: 100%; height: auto; display: block; }
.twin .zone { fill: var(--surface-2); stroke: var(--line-2); stroke-width: 1; }
.twin .zone-l { fill: var(--muted); font-size: 9px; font-family: var(--font-ui); text-transform: uppercase; letter-spacing: .05em; }
.twin .slot { stroke: var(--surface); stroke-width: .6; }
.twin .road { fill: var(--surface-3); }
.twin .truck { fill: var(--s1); stroke: none; }
.twin .truck.vendor { fill: var(--s2); }
.twin .truck.empty { fill: var(--muted); }
.twin .gate { fill: var(--accent); }
.twin text.t { fill: var(--ink-2); font-size: 9.5px; font-family: var(--font-ui); }
.twin text.tm { fill: var(--ink); font-size: 9.5px; font-family: var(--font-mono); }
.scen { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.scen button { border: 1px solid var(--line-2); background: var(--surface); border-radius: 6px; padding: 6px 8px; text-align: left; cursor: pointer; font-size: 11px; }
.scen button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ─── Blueprint ──────────────────────────────────────────── */
.arch { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.arch-col { border: 1px dashed var(--line-2); border-radius: 6px; padding: 8px; }
.arch-col h4 { font-family: var(--font-ui); font-size: 11px; color: var(--accent); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .05em; }
.arch-col div { font-size: 11px; padding: 4px 6px; margin-bottom: 4px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.steps { display: flex; gap: 0; align-items: stretch; overflow-x: auto; }
.step { flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid var(--line); background: var(--surface-2); position: relative; font-size: 11px; }
.step:first-child { border-radius: 6px 0 0 6px; } .step:last-child { border-radius: 0 6px 6px 0; }
.step b { display: block; font-size: 11.5px; }
.step .n { font-family: var(--font-head); font-size: 18px; font-weight: 600; color: var(--accent); }
.proof { width: 44px; height: 32px; border-radius: 3px; background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); border: 1px solid var(--line-2); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 9px; position: relative; }
.proof.ok::after { content: "✓"; position: absolute; right: 2px; bottom: 0; color: var(--good-text); font-weight: 700; font-size: 11px; }
.proof.bad::after { content: "!"; position: absolute; right: 3px; bottom: 0; color: var(--crit-text); font-weight: 700; font-size: 11px; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.check { border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; font-size: 11px; display: flex; gap: 8px; align-items: center; }
.check.fail { border-color: var(--crit); background: var(--crit-soft); }
.timeline { display: flex; flex-direction: column; gap: 0; }
.tl { display: grid; grid-template-columns: 64px 14px 1fr; gap: 8px; align-items: start; }
.tl .time { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); padding-top: 1px; }
.tl .node { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); margin: 3px 0 0 2px; position: relative; }
.tl .node.done { background: var(--accent); }
.tl .node::after { content: ""; position: absolute; left: 2px; top: 10px; width: 2px; height: 22px; background: var(--line-2); }
.tl:last-child .node::after { display: none; }
.tl .body { padding-bottom: 10px; font-size: 11.5px; }
.tl .body small { color: var(--muted); display: block; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--r-sm); font-size: 12px; opacity: 0; transition: .2s; z-index: 60; }
.toast.on { opacity: 1; transform: translateX(-50%); }
.radar text { font-size: 9.5px; fill: var(--muted); }
.radar .web { fill: none; stroke: var(--grid); }
.radar .shape { fill: var(--s1); fill-opacity: .22; stroke: var(--s1); stroke-width: 1.8; }
.radar .shape.v { fill: var(--s2); fill-opacity: .16; stroke: var(--s2); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ─── 3D scenes (CSS transforms) ─────────────────────────── */
.scene { position: relative; perspective: 1700px; overflow: hidden; border-radius: 6px; border: 1px solid var(--line); background: radial-gradient(ellipse at 50% 80%, var(--surface-3), var(--surface-2) 70%); cursor: grab; user-select: none; }
.scene:active { cursor: grabbing; }
.world { position: absolute; left: 50%; top: 58%; width: 0; height: 0; transform-style: preserve-3d; transform: translate3d(var(--px, 0px), var(--py, 0px), 0) rotateX(var(--rx, -24deg)) rotateY(var(--ry, -38deg)) scale3d(var(--sc, 1), var(--sc, 1), var(--sc, 1)); }
.obj { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; }
.face { position: absolute; backface-visibility: hidden; transform-origin: center; }
.lbl3 { backface-visibility: visible; background: transparent !important; color: var(--ink-2); font-size: 9px; text-transform: uppercase; letter-spacing: .05em; text-align: center; white-space: nowrap; }
.scene-hint { position: absolute; right: 8px; bottom: 6px; font-size: 10px; color: var(--muted); }
.inv-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1100px) { .inv-grid { grid-template-columns: repeat(2, 1fr); } }
.inv { border: 1px solid var(--line); border-radius: 6px; padding: 8px; font-size: 11.5px; }
.inv-scene { margin-bottom: 6px; }
.inv-scene .scene { cursor: default; }
.inv-scene .scene-hint { display: none; }
pre.sql { margin: 0 0 6px; padding: 7px 9px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 5px; font-family: var(--font-mono); font-size: 11px; white-space: pre-wrap; color: var(--accent); }
.map-wrap[style*="--mh"] svg { height: var(--mh); }

/* ═══ Polish: hover depth, the nav's active edge, scrollbars ═══ */
.card { transition: box-shadow var(--t-fast) ease, border-color var(--t-fast) ease; }
.card:hover { box-shadow: var(--e1-hover), var(--highlight); border-color: var(--line-2); }
.kpi { transition: box-shadow var(--t-fast) ease, border-color var(--t-fast) ease; }
.kpi:hover { box-shadow: var(--e1-hover), var(--highlight); }
.nav-item { transition: background var(--t-fast) ease, color var(--t-fast) ease; }
.btn { transition: background var(--t-fast) ease, box-shadow var(--t-fast) ease, transform .1s ease, border-color var(--t-fast) ease; }
.btn:active { transform: translateY(1px); }
.tbl-scroll::-webkit-scrollbar, .main::-webkit-scrollbar, .drawer-b::-webkit-scrollbar, .nav::-webkit-scrollbar, .tbl-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.tbl-scroll::-webkit-scrollbar-thumb, .main::-webkit-scrollbar-thumb, .drawer-b::-webkit-scrollbar-thumb, .nav::-webkit-scrollbar-thumb, .tbl-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
.tbl-scroll::-webkit-scrollbar-track, .main::-webkit-scrollbar-track { background: transparent; }
.topbar { backdrop-filter: blur(6px); }
.steps .step { transition: background var(--t-fast) ease; }
.steps .step:hover { background: var(--surface-3); }
.drawer { box-shadow: var(--e2); }
.msg.ai { box-shadow: var(--e1); }
.live-geo-map.svg-fallback { display: block; }
.live-geo-map.svg-fallback svg { display: block; width: 100%; height: 100%; }

/* ═══ Explainers: the "i" dot on a card header or a KPI (its text in data-explain and title) ═══ */
.card-h[data-explain] { cursor: help; }
.ex-i {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: 700; font-style: italic; font-family: var(--font-head);
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line-2);
  cursor: help; transition: background var(--t-fast) ease, color var(--t-fast) ease; /* full opacity: --muted on --surface-3 is 4.8:1 (5.3 dark); at .8 it fell to 3.2 */
}
.card-h[data-explain]:hover .ex-i, .ex-i:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }
.explainer {
  position: fixed; z-index: 70; max-width: 380px; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-tile);
  box-shadow: var(--e2);
  padding: 10px 12px; opacity: 0; transform: translateY(-3px);
  transition: opacity .13s ease, transform .13s ease;
}
.explainer.on { opacity: 1; transform: none; }
.explainer .xt {
  font-family: var(--font-head); font-weight: 600; font-size: var(--fs-small); color: var(--accent-text);
  display: flex; align-items: center; gap: 6px; margin-bottom: 5px;
}
.explainer .xt::before { content: ""; width: 3px; height: 12px; border-radius: 2px; background: var(--rule); flex: none; }
.explainer .xb { font-size: var(--fs-small); line-height: 1.55; color: var(--ink-2); }
@media (max-width: 760px) { .explainer { max-width: 260px; } }
.kpi[data-explain] { cursor: help; }
.kpi[data-explain]::after {
  content: "i"; position: absolute; top: 6px; right: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-weight: 700; font-style: italic; font-family: var(--font-head);
  background: var(--surface-3); color: var(--muted); border: 1px solid var(--line-2);
  opacity: 0; transition: opacity var(--t-fast) ease; pointer-events: none;
}
.kpi[data-explain]:hover::after { opacity: 1; background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-line); }

/* ═══ Module chrome (demo screens: pain tiles, facilities, SLA rules, plans) ═══ */

.pain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .pain-grid { grid-template-columns: 1fr; } }
.pain-tile { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 11px 12px; cursor: pointer; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-height: 168px; }
.pain-tile:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.pain-tile.crit { border-left: 3px solid var(--crit); }
.pain-tile.serious { border-left: 3px solid var(--serious); }
.pain-tile.warn { border-left: 3px solid var(--warn); }
.pain-tile.info { border-left: 3px solid var(--s1); }
.pain-tile .pt-top { display: flex; justify-content: space-between; align-items: center; }
.pain-tile b { font-size: 13px; letter-spacing: -.01em; }
.pain-tile .pt-m { font-family: var(--font-head); font-size: 15px; color: var(--accent); }
.pain-tile .pt-w { font-size: 10.5px; color: var(--muted); }
.pain-tile p { margin: 4px 0 0; font-size: 11.5px; color: var(--ink-2); line-height: 1.45; }
.pain-tile .pt-n { margin-top: auto; padding-top: 8px; font-size: 11px; color: var(--ink); border-top: 1px dashed var(--line); }

.pain-mini { display: flex; flex-direction: column; }
.pain-mini-row { display: grid; grid-template-columns: 8px 1fr; gap: 9px; align-items: start; padding: 8px 11px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; width: 100%; }
.pain-mini-row:hover { background: var(--surface-2); }
.pain-mini-row .m { color: var(--muted); font-size: 11px; }

.fac-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.fac-tile { border: 1px solid var(--line); border-radius: 6px; padding: 7px 8px; background: var(--surface-2); }
.fac-tile.cmd { border-color: var(--accent-line); background: var(--accent-soft); }
.fac-tile.plan { opacity: .7; border-style: dashed; }
.fac-tile b { display: block; font-size: 12px; }

.chan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 1100px) { .chan-grid { grid-template-columns: repeat(2, 1fr); } }
.chan-tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--surface-2); }
.chan-tile .v { font-family: var(--font-head); font-size: 26px; line-height: 1; margin: 4px 0; }
.chan-tile .v small { font-size: 13px; color: var(--muted); }
.chan-tile p { margin: 6px 0 8px; font-size: 11px; color: var(--ink-2); min-height: 44px; }
.chan-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chan-inline b { font-family: var(--font-head); font-size: 20px; display: block; }

.sla-rules { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px; }
@media (max-width: 1100px) { .sla-rules { grid-template-columns: repeat(3, 1fr); } }
.sla-rule { border: 1px solid var(--line); border-radius: 7px; padding: 8px 9px; background: var(--surface-2); }
.sla-rule b { display: block; font-size: 13px; margin: 2px 0; }
.sla-rule.ok { border-left: 3px solid var(--good); }
.sla-rule.bad { border-left: 3px solid var(--crit); }
.sla-clocks { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; }
.sla-clock { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface-2); }
.sla-clock b { display: block; font-size: 14px; }
.sla-clock.ok { border-left: 3px solid var(--good); }
.sla-clock.bad { border-left: 3px solid var(--crit); }
.veh-detail { font-size: 11.5px; }

.cost-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cost-col { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.cost-col b { display: block; font-family: var(--font-head); font-size: 22px; line-height: 1.1; margin: 4px 0 2px; }
.cost-col.good { border-left: 3px solid var(--good); }
.cost-col.bad { border-left: 3px solid var(--crit); }
.cost-col ul { margin: 8px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--ink-2); }
.loop-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.loop-steps li { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--surface-2); }
.loop-steps b { display: block; margin-bottom: 2px; }
.loop-steps span { font-size: 11.5px; color: var(--ink-2); }
.fact-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1100px) { .fact-grid { grid-template-columns: repeat(2, 1fr); } .cost-split { grid-template-columns: 1fr; } }
.fact { border: 1px solid var(--line); border-radius: 7px; padding: 8px 9px; background: var(--surface-2); }
.fact b { display: block; font-family: var(--font-head); font-size: 18px; margin: 2px 0; }
.fact i, .fact em { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); }
.int-cell { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.int-cell.good { background: color-mix(in srgb, var(--good) 18%, var(--surface)); color: var(--good); }
.int-cell.warn { background: color-mix(in srgb, var(--warn) 18%, var(--surface)); color: var(--warn); }
.int-cell.crit { background: color-mix(in srgb, var(--crit) 16%, var(--surface)); color: var(--crit); }
.int-pills { display: grid; gap: 6px; margin-top: 8px; }
.int-pills span { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; }
.int-tbl th { white-space: nowrap; }

.plan-shell { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .plan-shell { grid-template-columns: 1fr; } }
.plan-rail { position: sticky; top: 8px; display: flex; flex-direction: column; gap: 2px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.plan-nav { text-align: left; border: 0; background: transparent; color: var(--ink-2); font-size: 12px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.plan-nav:hover { background: var(--surface-2); color: var(--ink); }
.plan-nav.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.plan-body .card { margin-bottom: 10px; }
.plan-body .lead { font-size: 13px; line-height: 1.5; color: var(--ink-2); margin: 0; }
.dev-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .dev-grid { grid-template-columns: 1fr; } }
.dev-card { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.dev-card h4 { margin: 2px 0 8px; font-size: 15px; }
.dev-card.offline { border-top: 3px solid var(--warn); }
.dev-card.online { border-top: 3px solid var(--s1); }
.dev-card.fixed { border-top: 3px solid var(--good); }
.dev-card p { margin: 0 0 6px; }
.phase-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1100px) { .phase-grid { grid-template-columns: 1fr; } }
.phase { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.phase ul { margin: 8px 0 0; padding-left: 16px; font-size: 11.5px; color: var(--ink-2); }
.join-grid { display: grid; gap: 7px; }
.join-step { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--surface-2); }
.join-step b { display: block; margin-bottom: 2px; }
.join-step span { font-size: 11.5px; color: var(--ink-2); }
.best-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1100px) { .best-grid { grid-template-columns: 1fr; } }
.best-tile { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.best-tile .num { font-family: var(--font-head); font-size: 11px; color: var(--accent); }
.best-tile b { display: block; margin: 2px 0 4px; }
.best-tile p { margin: 0; font-size: 11.5px; color: var(--ink-2); }

.sim-page { display: grid; gap: 10px; }
.sim-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .sim-inputs { grid-template-columns: 1fr; } }
.sim-in { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--surface); box-shadow: var(--shadow); }
.sim-in.off { border-top: 3px solid var(--warn); }
.sim-in.on { border-top: 3px solid var(--s1); }
.sim-in.fix { border-top: 3px solid var(--good); }
.sim-in-h { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.sim-in-h i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sim-in-row { display: flex; align-items: baseline; gap: 6px; }
.sim-in-row input { width: 100%; font-family: var(--font-head); font-size: 36px; font-weight: 600; border: 0; background: transparent; color: var(--ink); padding: 0; }
.sim-in-row b { font-size: 20px; color: var(--muted); }
.sim-mix { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 4px; }
.sim-mix input { width: 52px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--ink); padding: 3px 6px; font-size: 12px; }
.sim-stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sim-pill { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 10px; cursor: pointer; min-width: 72px; text-align: left; }
.sim-pill span { display: block; font-size: 10px; color: var(--muted); }
.sim-pill b { display: block; font-family: var(--font-head); font-size: 16px; }
.sim-pill i { font-style: normal; font-size: 10px; color: var(--muted); }
.sim-pill.on { border-color: var(--accent-line); background: var(--accent-soft); }
.sim-pill.done { opacity: .7; }
.sim-nav { display: flex; gap: 6px; margin-left: auto; }
.sim-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 900px) { .sim-kpis { grid-template-columns: 1fr 1fr; } .sim-nav { margin-left: 0; width: 100%; } }
.sim-kpi { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.sim-kpi span { font-size: 11px; color: var(--muted); }
.sim-kpi b { display: block; font-family: var(--font-head); font-size: 26px; line-height: 1.1; }
.sim-kpi b small { font-size: 14px; color: var(--muted); }
.sim-kpi i { font-style: normal; font-size: 11px; color: var(--ink-2); }
.sim-kpi.net { border-left: 3px solid var(--accent); }
.sim-charts { display: grid; grid-template-columns: 1.4fr .8fr; gap: 10px; }
@media (max-width: 1100px) { .sim-charts { grid-template-columns: 1fr; } }
.sim-chart-card, .sim-flow-card, .sim-story { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); box-shadow: var(--shadow); }
#sim-lines, #sim-bars, #sim-flow { width: 100%; min-height: 118px; }
.sim-story p { margin: 8px 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.sim-story ul { margin: 0; padding-left: 18px; font-size: 12px; color: var(--ink-2); }
.sim-story-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ═══ 3D plants + container chrome ═══ */
.plant-pick { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
.plant-pick.tight { grid-template-columns: repeat(10, minmax(0, 1fr)); }
.plant-chip { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 7px; cursor: pointer; box-shadow: var(--shadow); min-width: 0; font: inherit; color: inherit; }
.plant-chip:hover, .plant-chip.on { border-color: var(--accent-line); background: var(--accent-soft); }
.plant-chip.plan { opacity: .72; border-style: dashed; }
.plant-chip b { display: block; font-size: 12px; }
.plant-chip i { display: block; font-style: normal; font-size: 10px; color: var(--muted); }
.plant-chip span { display: none; }
@media (max-width: 1100px) { .plant-pick, .plant-pick.tight { grid-template-columns: repeat(3, 1fr); } .plant-chip span { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 4px; } }

.sku-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; padding: 1px 6px 1px 5px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.sku-chip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c, #9aa3b2); }
.sku-chip.mini { font-size: 10px; padding: 0 5px 0 4px; }
.sku-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sku-card { border: 1px solid var(--line); border-radius: 8px; padding: 8px 9px; background: var(--surface-2); }
.sku-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sku-plants { display: flex; flex-wrap: wrap; gap: 4px; }
.sku-plants .tag.on { border-color: var(--accent-line); color: var(--accent-text); }
@media (max-width: 900px) { .sku-grid { grid-template-columns: 1fr; } }

.plant-lbl, .plant-sign, .plant-sub { pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.65); backface-visibility: visible; background: rgba(12,16,24,.72) !important; color: #fff !important; text-align: center; border-radius: 3px; }
.plant-sign { font-size: 10px; font-weight: 700; letter-spacing: .02em; text-transform: none; }
.plant-sub { font-size: 8px; color: #d7deea !important; text-transform: none; font-weight: 500; }
.rm-list { margin: 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); }
.rm-list li { margin: 3px 0; }
.linkish { border: 0; background: none; padding: 0; color: inherit; cursor: pointer; font: inherit; text-align: left; }
.linkish:hover { color: var(--accent); }
button.fac-tile { cursor: pointer; width: 100%; text-align: left; font: inherit; color: inherit; }

/* ═══ Live map · deck.gl engine chrome ═══ */
.deck-wrap { height: min(82vh, 820px); min-height: 600px; background: var(--map-bg); }
.map-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; font-size: 11.5px; }
.map-toolbar .seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.map-chips-card .card-b { padding: 8px 10px; }
.map-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 1100px) { .map-chips { grid-template-columns: repeat(2, 1fr); } }
.map-chip { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 9px; cursor: pointer; font: inherit; color: inherit; border-left-width: 3px; transition: transform .1s ease, border-color .12s ease; }
.map-chip:hover { transform: translateY(-1px); border-color: var(--accent-line); }
.map-chip.on { background: var(--accent-soft); border-color: var(--accent); }
.map-chip.crit { border-left-color: var(--crit); } .map-chip.warn { border-left-color: var(--warn); } .map-chip.good { border-left-color: var(--good); } .map-chip.info { border-left-color: var(--s1); }
.map-chip b { display: block; font-size: 12px; letter-spacing: -.01em; }
.map-chip i { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-fly-btn.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.map-layers { width: 236px; max-height: calc(100% - 20px); display: flex; flex-direction: column; z-index: 8; }
.map-layers h4 { display: flex; align-items: center; gap: 8px; }
.map-layers h4 span:first-child { flex: 1; }
.map-layers .btn { border-color: var(--map-line); background: transparent; color: #e2f1f4; }
.map-layer-list { overflow: auto; flex: 1; padding: 4px 0; }
.map-layer-g { padding: 7px 10px 2px; color: #7fa3aa; }
.map-layer { font-size: 10.5px; padding: 3px 10px; }
.map-layers.closed .map-layer-list, .map-layers.closed .map-source { display: none; }
.map-layers.closed { width: auto; }
.map-stats { z-index: 8; }
.map-stat b { font-size: 15px; }
.map-insp { position: absolute; top: 52px; right: 10px; width: 292px; max-height: calc(100% - 118px); overflow: auto; background: rgba(6, 22, 27, .94); border: 1px solid var(--map-line); border-radius: 8px; color: #e2f1f4; font-size: 11px; padding: 9px 11px 10px; display: none; z-index: 9; backdrop-filter: blur(5px); box-shadow: 0 14px 38px rgba(0, 0, 0, .45); }
.map-insp.on { display: block; }
.map-insp .mi-h { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 6px; }
.map-insp .mi-h > div { flex: 1; min-width: 0; }
.map-insp .mi-h b { font-size: 12.5px; color: #fff; }
.map-insp .mi-h .xs { color: #9fbcc2; }
.map-insp .btn { border-color: var(--map-line); background: transparent; color: #e2f1f4; }
.map-insp .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.map-insp .mi-pills { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.map-insp .mi-kv { grid-template-columns: 74px 1fr; gap: 3px 8px; font-size: 10.5px; }
.map-insp .mi-kv dt { color: #9fbcc2; } .map-insp .mi-kv dd { color: #e2f1f4; }
.map-insp .mi-kv .bar { background: var(--map-line); } .map-insp .mi-kv .bar > i { background: #4fd1c5; }
.map-insp .mi-sub { margin: 6px 0 2px; font-size: 10.5px; color: #e2f1f4; }
.map-insp .mi-spark, .map-insp .mi-bars, .map-insp .mi-gauge { margin: 4px 0 2px; }
.map-insp .mi-list { display: grid; gap: 2px; margin-top: 6px; }
.map-insp .mi-row { display: grid; grid-template-columns: 64px 1fr auto auto; gap: 6px; align-items: center; width: 100%; text-align: left; border: 1px solid var(--map-line); background: rgba(255, 255, 255, .03); color: inherit; font: inherit; font-size: 10.5px; padding: 3px 6px; border-radius: 5px; cursor: pointer; }
.map-insp .mi-row:hover { background: rgba(255, 255, 255, .08); }
.map-insp .mi-acts { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.map-insp .tag { background: var(--map-land); border-color: var(--map-line); color: #e2f1f4; }
.map-insp .sku-chip { background: var(--map-land); border-color: var(--map-line); color: #e2f1f4; }
.map-legend-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; bottom: 52px; left: 10px; right: auto; max-width: 420px; z-index: 7; }
.lg-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lg-col { display: inline-block; width: 7px; height: 12px; background: linear-gradient(180deg, #3ecf8e, #ff5b5b); margin-right: 7px; vertical-align: -2px; border-radius: 1px; }
.lg-line { display: inline-block; width: 14px; height: 3px; margin-right: 6px; vertical-align: 2px; border-radius: 2px; }
.lg-ring { display: inline-block; width: 9px; height: 9px; border: 2px solid; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.deck-wrap .map-time { left: 10px; right: 10px; z-index: 7; }
.deck-wrap .map-time .btn { border-color: var(--map-line); background: transparent; color: #e2f1f4; min-width: 28px; justify-content: center; }
.kepler-wrap .map-layers, .kepler-wrap .map-legend, .kepler-wrap .map-time, .kepler-wrap .map-insp { display: none !important; }
@media (max-width: 1100px) { .map-legend-2 { display: none; } .map-layers { width: 200px; } .map-insp { width: 250px; } }

/* ═══ 3D yard v2 ═══ */
#scene-yard { background: radial-gradient(ellipse at 50% 70%, #6b7482, #3b424c 72%); border-color: #2b3440; }
#scene-yard .face { transition: opacity .18s ease; }
#scene-yard [data-dim] { opacity: .22; }
.y3-flat, .y3-sign { backface-visibility: visible; font-family: var(--font-mono); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-align: center; white-space: nowrap; overflow: hidden; pointer-events: none; }
.y3-flat { font-size: 9px; color: #1b2230; background: transparent !important; }
.y3-flat.road { color: #f2e6b8; font-size: 8px; }
.y3-flat.dock { color: #fff8e0; font-size: 8px; }
.y3-flat.zone { font-size: 9.5px; color: #10161f; }
.y3-flat.zone.on { color: #0F62D0; }
.y3-flat.zone.sub { font-size: 7px; color: #3a4452; letter-spacing: .04em; }
.y3-sign { font-size: 8.5px; color: #fff; background: rgba(16, 22, 32, .86) !important; border: 1px solid rgba(255, 255, 255, .22); border-radius: 3px; line-height: 1.15; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.y3-sign.title { font-size: 9.5px; letter-spacing: .12em; background: rgba(218, 41, 28, .92) !important; border-color: rgba(255, 255, 255, .35); }
.y3-sign.band { font-size: 7.5px; letter-spacing: .08em; background: rgba(12, 42, 58, .92) !important; border-color: #4fd1c5; color: #cffcf6; }
.y3-sign.band.dry { background: rgba(40, 44, 52, .9) !important; border-color: #8a93a8; color: #e2e6ee; }
.y3-sign.temp { text-transform: none; letter-spacing: 0; }
.y3-sign.temp b { font-size: 11px; line-height: 1.1; }
.y3-sign.temp small { font-size: 6.5px; opacity: .85; text-transform: uppercase; letter-spacing: .05em; }
.y3-sign.temp.good { border-color: #3ecf8e; } .y3-sign.temp.warn { border-color: #ffc24a; background: rgba(90, 60, 10, .92) !important; } .y3-sign.temp.crit { border-color: #ff5b5b; background: rgba(110, 30, 30, .92) !important; }
.y3-sign.cold { font-size: 8px; background: rgba(20, 40, 90, .92) !important; border-color: #7ab4ff; color: #dbeaff; text-transform: none; }
.y3-sign.id { font-size: 7px; letter-spacing: .08em; background: rgba(16, 22, 32, .78) !important; }
.yard-cams { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.y3-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 8px; font-size: 10.5px; color: var(--ink-2); }
.y3-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

/* ═══ Per-module D3 rows ═══ */
.d3mod-row { margin: 0 0 10px; }
.d3mod-card { align-self: stretch; }
.d3mod-card .card-b { padding: 6px 8px 8px; position: relative; }
.d3mod { position: relative; min-height: 260px; }
.d3mod svg.d3m-svg { display: block; }
.d3mod-cap { font-size: 10.5px; color: var(--muted); line-height: 1.4; margin-top: 4px; padding: 0 2px; }
.d3mod-tip { position: absolute; pointer-events: none; z-index: 6; max-width: 240px; padding: 6px 8px; border-radius: 5px; background: rgba(6, 22, 27, .96); color: #e2f1f4; border: 1px solid #2e5d69; font-size: 11px; line-height: 1.45; opacity: 0; transform: translateY(4px); transition: opacity .1s ease, transform .1s ease; white-space: normal; }
.d3mod-tip.on { opacity: 1; transform: none; }
.card.d3mod-card .card-h .sub { font-family: var(--font-mono); font-size: 10px; }

/* ─── Fleet and route screens ────────────────────────────── */
.route-map { height: min(74vh, 700px); min-height: 480px; background: var(--map-bg); border-radius: 6px; overflow: hidden; position: relative; }
.route-map .maplibregl-popup-content { background: var(--map-land); color: #e2f1f4; border: 1px solid var(--map-line); font: 11px var(--font-ui); border-radius: 6px; padding: 8px 10px; }
.route-map .maplibregl-popup-tip { border-top-color: var(--map-land) !important; }
.route-map .maplibregl-ctrl-group { background: var(--map-land); border: 1px solid var(--map-line); }
.route-map .maplibregl-ctrl-group button { filter: invert(1); }
.map-panel.rm-panel { width: 190px; }
.map-legend.rm-legend { bottom: 12px; }
.decision { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.decision > div { border: 1px solid var(--line); border-radius: 7px; padding: 9px 10px; background: var(--surface-2); font-size: 11.5px; }
.decision > div.rec { border-color: var(--good); background: var(--good-soft); }
.decision b.h { display: block; font-size: 12px; margin-bottom: 3px; }
.decision .amt { font-family: var(--font-head); font-size: 20px; font-weight: 600; margin: 3px 0; }
.decision ul { margin: 4px 0 0; padding-left: 14px; color: var(--ink-2); }
.loss-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.loss-col { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.loss-col h4 { font-family: var(--font-ui); font-size: 11.5px; padding: 7px 10px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.loss-col.c h4 { background: var(--crit-soft); color: var(--crit-text); }
.loss-col.u h4 { background: var(--surface-2); color: var(--ink-2); }
.loss-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 11.5px; align-items: center; }
.loss-row:last-child { border-bottom: 0; }
.loss-row .m { color: var(--muted); font-size: 10.5px; grid-column: 1 / -1; }
.sim-grid { display: grid; grid-template-columns: 300px 1fr; gap: 10px; }
@media (max-width: 1100px) { .sim-grid { grid-template-columns: 1fr; } }
.sim-ctl { display: grid; grid-template-columns: 1fr; gap: 9px; }
.sim-ctl label { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; font-size: 11px; color: var(--ink-2); }
.sim-ctl label b { font-family: var(--font-mono); color: var(--ink); font-weight: 500; }
.sim-ctl input[type=range] { grid-column: 1 / -1; width: 100%; }
.var-tbl td.pos { color: var(--crit-text); font-weight: 600; } .var-tbl td.neg { color: var(--good-text); font-weight: 600; }
.bay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 8px; }
.bay { border: 1px solid var(--line); border-radius: 7px; padding: 8px 9px; background: var(--surface-2); font-size: 11px; cursor: pointer; text-align: left; }
.bay.sel { border-color: var(--accent); background: var(--accent-soft); }
.bay .bh { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.bay .bh b { font-family: var(--font-head); font-size: 13px; }
.bay .bar { margin-top: 5px; }
.vin { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .02em; }
.face { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--surface-3), var(--accent-soft)); border: 1px solid var(--line-2); align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--ink-2); flex: none; }
.profile-h { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.profile-h .face { width: 40px; height: 40px; font-size: 14px; }
.tyre-map { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.tyre-map i { display: block; aspect-ratio: 1 / 1.6; border-radius: 4px; background: var(--surface-3); position: relative; }
.tyre-map i.n { background: var(--s1); } .tyre-map i.r1 { background: var(--s3); } .tyre-map i.r2 { background: var(--s4); } .tyre-map i.low { background: var(--crit); }
.contract { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface-2); }
.contract h4 { font-family: var(--font-head); font-size: 15px; margin-bottom: 4px; }
.tile-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.tile { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--surface); }
.tile .cap { display: block; margin-bottom: 2px; }
.tile b { font-family: var(--font-head); font-size: 18px; }

/* ─── Clocks · wall · registers ─────────────────────────────── */
.clk { font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.clk.ok { color: var(--good-text); } .clk.soon { color: var(--warn-text); } .clk.over { color: var(--crit-text); font-weight: 600; }
@keyframes blink { 50% { opacity: .25; } }
tr.blink .clk.over, .pane-row.blink .clk.over { animation: blink 1s step-end infinite; }
tr.blink td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
.wall { background: #030b0e; color: #e2f1f4; border-radius: 8px; padding: 10px; }
.wall-h { display: flex; align-items: center; gap: 14px; padding: 4px 6px 10px; font-family: var(--font-head); font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: #9fbcc2; }
.wall-h b { color: #fff; font-size: 15px; } .wall-h .spacer { flex: 1; } .wall-h .red { color: #ff6b6b; }
.wall-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 1400px) { .wall-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pane { background: var(--map-bg); border: 1px solid var(--map-line); border-radius: 6px; overflow: hidden; display: flex; flex-direction: column; min-height: 300px; }
.pane-h { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-bottom: 1px solid var(--map-line); font-size: 12px; font-weight: 600; color: #fff; }
.pane-h .ic { font-size: 15px; } .pane-h .sub { color: #7fa3aa; font-weight: 400; font-size: 10.5px; } .pane-h .n { margin-left: auto; font-family: var(--font-head); font-size: 20px; color: #ffd166; }
.pane table { width: 100%; border-collapse: collapse; font-size: 11px; }
.pane th { text-align: left; color: #7fa3aa; font-weight: 600; font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em; padding: 4px 8px; border-bottom: 1px solid var(--map-line); }
.pane td { padding: 4px 8px; border-bottom: 1px solid var(--map-land); white-space: nowrap; color: #e2f1f4; vertical-align: middle; }
.pane td.rem { color: #9fbcc2; white-space: normal; min-width: 160px; max-width: 220px; font-size: 10.5px; }
.pane tr.blink td:first-child { box-shadow: inset 3px 0 0 #ff4d4d; }
.pane .clk.ok { color: #4ade80; } .pane .clk.soon { color: #ffd166; } .pane .clk.over { color: #ff6b6b; }
.pane-f { margin-top: auto; padding: 5px 10px; border-top: 1px solid var(--map-line); font-size: 10.5px; color: #7fa3aa; }
.wall-note { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.wall-note > div { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 11px; background: var(--surface-2); }
.wall-note b { display: block; margin-bottom: 3px; }
.stage-row { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; margin-bottom: 10px; }
.stage-cell { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface); text-align: center; font-size: 10.5px; color: var(--muted); }
.stage-cell b { display: block; font-family: var(--font-head); font-size: 18px; color: var(--ink); } .stage-cell .ov { color: var(--crit-text); font-weight: 600; }
.card-dark { background: var(--map-bg) !important; color: #e2f1f4; border-color: var(--map-line) !important; }
/* the owner's WhatsApp morning card: a green chat on tokens, so it follows the theme (the old literal dark rule sat
   outside the dark media query and turned the card dark on a light page) */
.daily { background: var(--good-soft); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 12px; max-width: 420px; line-height: 1.55; box-shadow: var(--shadow); }
.daily b.h { display: block; font-size: 13px; margin-bottom: 4px; } .daily ol { margin: 4px 0 0; padding-left: 18px; } .daily .q { background: color-mix(in srgb, var(--good) 24%, var(--surface)); border-radius: 8px; padding: 6px 9px; margin-top: 8px; display: inline-block; } .daily .a { background: var(--surface); border-radius: 8px; padding: 6px 9px; margin-top: 6px; }
.chat { display: flex; flex-direction: column; gap: 8px; }
.chat .u, .chat .a { max-width: 92%; padding: 8px 10px; border-radius: 9px; font-size: 11.5px; line-height: 1.5; }
.chat .u { align-self: flex-end; background: var(--accent); color: var(--accent-ink); } .chat .a { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }
.chat .meta { font-family: var(--font-mono); font-size: 10px; color: var(--muted); margin-top: 4px; }
.wave-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.wave { border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: var(--surface-2); font-size: 11px; }
.wave.live { border-color: var(--good); background: var(--good-soft); } .wave.build { border-color: var(--accent-line); background: var(--accent-soft); }
.wave b { display: block; font-size: 13px; } .wave ul { margin: 5px 0 0; padding-left: 14px; color: var(--ink-2); }
/* the contribution matrix: earn and loss are states, so the status soft fills and texts (AA in both themes), never a chart
   series; a 1 px inset edge in the solid status colour keys each cell to its legend swatch */
.mx { display: grid; gap: 3px; } .mx-row { display: grid; gap: 3px; align-items: center; } .mx-cell { height: 22px; border-radius: 3px; font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.mx-cell.earn { background: var(--good-soft); color: var(--good-text); box-shadow: inset 0 0 0 1px var(--good-line); } .mx-cell.loss { background: var(--crit-soft); color: var(--crit-text); box-shadow: inset 0 0 0 1px var(--crit-line); } .mx-cell.thin { background: var(--axis); color: var(--ink); }
.spread { display: flex; gap: 2px; align-items: flex-end; height: 40px; }
.spread i { flex: 1; background: var(--s1); border-radius: 2px 2px 0 0; min-width: 2px; }
.lf-tile { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; background: var(--surface); }
