/* ============================================================================
   console.css — every component class the console has.

   Screens MUST NOT write inline styles and MUST NOT invent class names. If a
   screen needs a new component it composes the classes below. That is what
   keeps ten screens written by different hands looking like one console.

   Every `style-hover` in the design is a real :hover rule here.
   ========================================================================== */

/* ---------------------------------------------------------------- reset ---- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-13);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; color: inherit; font-size: inherit; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
::selection { background: var(--select); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-6); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Numeric columns. Put .tnum on ANY cell holding a figure. */
.tnum { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ keyframes ---- */
@keyframes pulse  { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes fadein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: translateX(0); } }
.is-pulsing { animation: pulse 1.6s ease-in-out infinite; }

/* ----------------------------------------------------------- scrollbars ---- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: var(--r-8); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--hairline); }
.panel::-webkit-scrollbar-thumb, .content::-webkit-scrollbar-thumb { border-color: var(--surface); }
* { scrollbar-color: var(--scroll) transparent; scrollbar-width: thin; }

/* ================================================================ shell ==== */
.app { display: flex; flex-direction: column; height: 100vh; min-width: var(--app-min-w); overflow: hidden; }
.topbar { flex: none; background: var(--surface); border-bottom: 1px solid var(--rule); }
.topbar-main { display: flex; align-items: center; gap: var(--s-14); padding: var(--s-11) var(--s-20); }
.topbar-tabs { display: flex; align-items: center; gap: var(--s-2); padding: 0 var(--s-20); }
.workspace { flex: 1; display: flex; min-height: 0; }
.content { flex: 1; overflow-y: auto; min-width: 0; padding: var(--s-20); }
.spacer { flex: 1; }
.divider { width: 1px; height: 22px; background: var(--rule); flex: none; }

.brand { display: flex; align-items: center; gap: var(--s-9); }
.brand-mark {
  width: 24px; height: 24px; border-radius: var(--r-7); background: var(--c1p);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: var(--fw-bold); font-size: var(--fs-11);
}
.brand-name { font-weight: var(--fw-bold); font-size: var(--fs-145); letter-spacing: var(--tracking-tight); }

/* Small inline metadata, e.g. "United States", the freshness line. */
.meta { display: flex; align-items: center; gap: var(--s-6); font-size: var(--fs-12); color: var(--muted); }
.meta--boxed {
  padding: var(--s-4) 10px; border: 1px solid var(--rule); border-radius: var(--r-8);
  color: var(--mid); cursor: pointer;
}
.meta--boxed:hover { border-color: var(--rule-hover); }

/* Freshness dot. Set the tone class; --none is the hairline grey. */
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--hairline); }
.dot--good { background: var(--good); }
.dot--warn { background: var(--warn); }
.dot--bad  { background: var(--bad); }
.dot--info { background: var(--info); }
.dot--none { background: var(--hairline); }
.dot--square { border-radius: var(--r-2); }

.icon { width: var(--fs-15); height: var(--fs-15); flex: none; display: block; }
.icon--sm { width: 13px; height: 13px; }
.icon--lg { width: 18px; height: 18px; }

/* ------------------------------------------------------ team-member banner - */
.team-banner {
  flex: none; display: flex; align-items: center; gap: var(--s-9);
  padding: var(--s-8) var(--s-20);
  background: var(--tag-info-bg); color: var(--tag-info-fg);
  font-size: var(--fs-125);
}
.team-banner[hidden] { display: none; }

/* ------------------------------------------------------------ sample badge - */
/* Visible whenever ANY panel on screen is fixture-backed. Not decoration —
   it is the difference between a demo and a report. */
.sample-badge {
  display: flex; align-items: center; gap: var(--s-6);
  padding: var(--s-4) 10px; border-radius: var(--r-20);
  background: var(--tag-warn-bg); color: var(--tag-warn-fg);
  font-size: var(--fs-11); font-weight: var(--fw-semi);
  border: 1px solid transparent; white-space: nowrap;
}
.sample-badge[hidden] { display: none; }

/* =========================================================== segmented ==== */
/* .seg is the track; .seg-btn the buttons; .is-on the selected one. */
.seg { display: flex; background: var(--sunken); border-radius: var(--r-8); padding: var(--s-2); gap: var(--s-2); }
.seg-btn {
  border: 0; cursor: pointer; padding: 5px var(--s-11); border-radius: var(--r-6);
  font-size: var(--fs-12); font-weight: var(--fw-medium);
  display: flex; align-items: center; gap: var(--s-6);
  background: transparent; color: var(--muted); box-shadow: none;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.is-on { background: var(--surface); color: var(--ink); box-shadow: var(--lift); }
.seg-btn--strong { font-weight: var(--fw-semi); }
.seg-dot { width: 7px; height: 7px; border-radius: var(--r-2); flex: none; background: transparent; }
.seg-dot--1p { background: var(--c1p); }
.seg-dot--3p { background: var(--c3p); }
.seg-dot--both { background: var(--c1p-3p); }
.seg-dot--market { background: var(--c-walmart); }

/* =============================================================== tabs ===== */
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: var(--s-9) var(--s-13) var(--s-11);
  font-size: var(--fs-13); font-weight: var(--fw-medium);
  display: flex; align-items: center; gap: var(--s-7);
  border-bottom: 2px solid transparent; color: var(--muted);
}
.tab:hover { color: var(--ink); }
.tab.is-on { color: var(--ink); border-bottom-color: var(--c1p); }
/* `.tab-badge` was here. Deleted 2026-08-04 with the two counts it styled — an
   unbadged "4" on Exports and "3" on Access, shell-owned and therefore visible from
   every screen including live ones. There is no live-total plumbing into the tab
   strip, so nothing needs this rule; re-add it alongside real counts, not before. */

/* ============================================================ buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: var(--s-7);
  padding: 5px var(--s-11); border: 1px solid var(--rule); border-radius: var(--r-8);
  background: var(--surface); cursor: pointer;
  font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--mid);
}
.btn:hover { border-color: var(--rule-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn--block { width: 100%; padding: var(--s-9) var(--s-13); font-size: var(--fs-125); text-align: left; justify-content: flex-start; }
.btn--primary { background: var(--c1p); border-color: var(--c1p); color: #fff; }
.btn--primary:hover { background: var(--link-hover); border-color: var(--link-hover); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { border-color: var(--rule); }
.btn-count {
  padding: 1px var(--s-6); border-radius: var(--r-20);
  background: var(--tag-bad-bg); color: var(--tag-bad-fg);
  font-size: var(--fs-105); font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
}
.btn-count:empty { display: none; }

/* ============================================================== cards ===== */
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-10);
  padding: var(--s-14) var(--s-16);
}
.card--flush { padding: 0; overflow: hidden; }
.card--click { cursor: pointer; }
.card--click:hover { border-color: var(--rule-hover); }
.card-head { display: flex; align-items: flex-start; gap: var(--s-12); margin-bottom: var(--s-12); }
.card-head--flush { padding: var(--s-14) var(--s-16); margin: 0; border-bottom: 1px solid var(--rule-soft); }
.card-title { font-weight: var(--fw-semi); font-size: var(--fs-14); letter-spacing: var(--tracking-tight); }
.card-sub { margin-top: var(--s-4); font-size: var(--fs-12); color: var(--muted); line-height: var(--lh-body); }
.card-body { min-width: 0; }
.card-foot { margin-top: var(--s-12); padding-top: var(--s-12); border-top: 1px solid var(--rule-soft); font-size: var(--fs-12); color: var(--muted); }

/* Layout helpers. Screens compose these instead of writing grid inline. */
.stack   { display: flex; flex-direction: column; gap: var(--s-16); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-8); }
.row     { display: flex; align-items: center; gap: var(--s-12); }
.row--top { align-items: flex-start; }
.row--wrap { flex-wrap: wrap; }
.grid    { display: grid; gap: var(--s-14); }
.grid-2  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6  { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split   { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: var(--s-14); }
.split--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* Screen headings */
.h1 { font-size: var(--fs-17); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tight); margin: 0; }
.h2 { font-size: var(--fs-14); font-weight: var(--fw-semi); letter-spacing: var(--tracking-tight); margin: 0; }
.lead { font-size: var(--fs-125); color: var(--body); line-height: var(--lh-note); max-width: 78ch; text-wrap: pretty; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }            /* a TEXT colour, 4.5:1 on white  */
.caps  { font-size: var(--fs-105); font-weight: var(--fw-semi); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }

/* --------------------------------------------------------------- KPI ------ */
.kpi { display: flex; flex-direction: column; gap: var(--s-6); min-width: 0; }
.kpi-label { font-size: var(--fs-11); font-weight: var(--fw-semi); color: var(--muted); letter-spacing: var(--tracking-caps); text-transform: uppercase; }
.kpi-value { font-size: var(--fs-24); font-weight: var(--fw-bold); letter-spacing: var(--tracking-tighter); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value--sm { font-size: var(--fs-20); }
.kpi-sub { font-size: var(--fs-12); color: var(--muted); }
.kpi-row { display: flex; align-items: center; gap: var(--s-8); flex-wrap: wrap; }

/* ============================================================== tags ====== */
/* Status vocabulary: good healthy, warn paced, bad failed, info live/derived,
   teal 3P, neut everything with no status meaning. */
.tag {
  display: inline-flex; align-items: center; gap: var(--s-4);
  padding: 2px var(--s-7); border-radius: var(--r-20);
  font-size: var(--fs-105); font-weight: var(--fw-semi); white-space: nowrap;
  background: var(--tag-neut-bg); color: var(--tag-neut-fg);
}
.tag--good { background: var(--tag-good-bg); color: var(--tag-good-fg); }
.tag--warn { background: var(--tag-warn-bg); color: var(--tag-warn-fg); }
.tag--bad  { background: var(--tag-bad-bg);  color: var(--tag-bad-fg); }
.tag--info { background: var(--tag-info-bg); color: var(--tag-info-fg); }
.tag--teal { background: var(--tag-teal-bg); color: var(--tag-teal-fg); }
.tag--neut { background: var(--tag-neut-bg); color: var(--tag-neut-fg); }

/* Which system stated the figure. Never let an ERP number read as Amazon's. */
.src {
  display: inline-flex; align-items: center; padding: 1px var(--s-6);
  border-radius: var(--r-20); font-size: var(--fs-10); font-weight: var(--fw-semi);
  letter-spacing: .02em; text-transform: uppercase;
  background: var(--src-erp-bg); color: var(--src-erp-fg);
}
.src--api { background: var(--src-api-bg); color: var(--src-api-fg); }
.src--erp { background: var(--src-erp-bg); color: var(--src-erp-fg); }

/* ============================================================= deltas ===== */
.delta {
  display: inline-flex; align-items: center; gap: var(--s-4);
  padding: 2px var(--s-6); border-radius: var(--r-20);
  font-size: var(--fs-105); font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--delta-flat-bg); color: var(--delta-flat-fg);
}
.delta--up   { background: var(--delta-up-bg);   color: var(--delta-up-fg); }
.delta--down { background: var(--delta-down-bg); color: var(--delta-down-fg); }
.delta--flat { background: var(--delta-flat-bg); color: var(--delta-flat-fg); }
/* No delta known — a fraction of null. Renders as an em dash with no fill,
   because a grey pill saying 0.0% would be a measurement we do not have. */
.delta--none { background: transparent; color: var(--muted); padding-left: 0; padding-right: 0; }

/* ============================================================== pills ===== */
.pill {
  display: inline-flex; align-items: center; gap: var(--s-4);
  padding: 1px var(--s-6); border-radius: var(--r-20);
  font-size: var(--fs-105); font-weight: var(--fw-semi);
  font-variant-numeric: tabular-nums;
  background: var(--sunken); color: var(--muted);
}
.pill:empty { display: none; padding: 0; }

/* Filter chips. .is-on for the active one. */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-6);
  padding: var(--s-4) 10px; border: 1px solid var(--rule); border-radius: var(--r-20);
  background: var(--surface); cursor: pointer;
  font-size: var(--fs-12); font-weight: var(--fw-medium); color: var(--mid);
}
.chip:hover { border-color: var(--rule-hover); }
.chip.is-on { background: var(--tag-info-bg); border-color: transparent; color: var(--tag-info-fg); }

/* ============================================================== tables ==== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.th {
  text-align: left; padding: var(--s-8) var(--s-12);
  font-size: var(--fs-105); font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-caps); text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--rule);
  white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1;
}
.td {
  padding: var(--s-9) var(--s-12); font-size: var(--fs-125);
  border-bottom: 1px solid var(--rule-soft); vertical-align: top; color: var(--ink);
}
.th--num, .td--num { text-align: right; font-variant-numeric: tabular-nums; }
.td--tight { white-space: nowrap; }
.td--wrap { min-width: 220px; }
.td--faint { color: var(--faint); }
.tr--click { cursor: pointer; }
.tr--click:hover .td { background: var(--bg); }
.tr--click:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.tr--on .td { background: var(--tag-info-bg); }

/* The em dash that means "cannot be known". NEVER render 0 here. */
.nil { color: var(--faint); }

/* ============================================================== charts ==== */
/* .bars is a column chart track; each .bar is a column, .bar-fill its height.
   Screens set the fill height with an inline custom property via
   el("div", {class:"bar-fill bar-fill--1p", style:"height:42%"}) — the ONLY
   inline style a screen may write, because a bar height is data, not styling. */
.bars { display: flex; align-items: flex-end; gap: var(--s-6); height: 160px; }
.bar { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; }
.bar-stack { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.bar-fill { border-radius: 3px 3px 0 0; background: var(--hairline); min-height: 2px; width: 100%; }
.bar-fill--1p { background: var(--c1p); }
.bar-fill--3p { background: var(--c3p); }
.bar-fill--good { background: var(--good); }
.bar-fill--warn { background: var(--warn); }
.bar-fill--bad  { background: var(--bad); }
.bar-label { font-size: var(--fs-10); color: var(--faint); text-align: center; font-variant-numeric: tabular-nums; }
.bar:hover .bar-fill { filter: brightness(1.08); }

/* Horizontal proportion bar, for mix and coverage. */
.bar-track { height: 8px; border-radius: var(--r-full); background: var(--sunken); overflow: hidden; display: flex; }
.bar-track--tall { height: 12px; }
.bar-seg { height: 100%; background: var(--hairline); }
.bar-seg--1p { background: var(--c1p); }
.bar-seg--3p { background: var(--c3p); }
.bar-seg--good { background: var(--good); }
.bar-seg--warn { background: var(--warn); }
.bar-seg--bad  { background: var(--bad); }
.bar-seg--none { background: var(--hairline); }

/* Sparkline: a row of thin bars, for a per-row trend. */
.spark { display: flex; align-items: flex-end; gap: 1px; height: 22px; width: 72px; }
.spark-bar { flex: 1; background: var(--hairline); border-radius: 1px; min-height: 1px; }
.spark-bar--1p { background: var(--c1p); }
.spark-bar--3p { background: var(--c3p); }

/* Funnel steps. */
.funnel { display: flex; flex-direction: column; gap: var(--s-9); }
.funnel-step { display: grid; grid-template-columns: 120px 1fr 84px; gap: var(--s-12); align-items: center; }
.funnel-label { font-size: var(--fs-12); color: var(--mid); }
.funnel-value { font-size: var(--fs-125); font-weight: var(--fw-semi); text-align: right; font-variant-numeric: tabular-nums; }

/* Key/value board, for the metric board layout and detail blocks. */
.kv { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: var(--s-6) var(--s-12); align-items: baseline; }
.kv-k { font-size: var(--fs-105); font-weight: var(--fw-semi); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.kv-v { font-size: var(--fs-125); line-height: var(--lh-body); }

/* Progress, for chunk counts. */
.progress { height: 6px; border-radius: var(--r-full); background: var(--sunken); overflow: hidden; }
.progress-fill { height: 100%; background: var(--info); }
.progress-fill--good { background: var(--good); }
.progress-fill--bad { background: var(--bad); }

/* ============================================================= notices ==== */
.notice {
  display: flex; align-items: flex-start; gap: var(--s-9);
  padding: var(--s-11) var(--s-13); border-radius: var(--r-10);
  font-size: var(--fs-125); line-height: var(--lh-note);
  background: var(--sunken); color: var(--body); text-wrap: pretty;
}
.notice--good { background: var(--tag-good-bg); color: var(--tag-good-fg); }
.notice--warn { background: var(--tag-warn-bg); color: var(--tag-warn-fg); }
.notice--bad  { background: var(--tag-bad-bg);  color: var(--tag-bad-fg); }
.notice--info { background: var(--tag-info-bg); color: var(--tag-info-fg); }

/* "This cannot be known" — the honest empty state. Use this rather than a
   chart of zeros whenever the data does not exist. */
.absent {
  padding: var(--s-20); border: 1px dashed var(--hairline); border-radius: var(--r-10);
  background: var(--surface); color: var(--body);
  font-size: var(--fs-125); line-height: var(--lh-note); text-wrap: pretty;
}
.absent-title { font-weight: var(--fw-semi); color: var(--ink); margin-bottom: var(--s-6); }
.empty { padding: var(--s-20); text-align: center; color: var(--faint); font-size: var(--fs-125); }

/* ======================================================== prov panel ====== */
.panel {
  width: var(--panel-w); flex: none; background: var(--surface);
  border-left: 1px solid var(--rule); overflow-y: auto;
  animation: fadein .16s ease-out;
}
.panel[hidden] { display: none; }
.panel-head { display: flex; align-items: flex-start; gap: var(--s-12); padding: var(--s-16); border-bottom: 1px solid var(--rule-soft); }
.panel-headtext { flex: 1; min-width: 0; }
.panel-kicker { display: flex; align-items: center; gap: var(--s-6); font-size: var(--fs-11); font-weight: var(--fw-semi); color: var(--link); }
.panel-kicker .icon { width: 14px; height: 14px; }
.panel-title { margin-top: var(--s-7); font-weight: var(--fw-semi); font-size: var(--fs-15); line-height: var(--lh-tight); }
.panel-value { margin-top: var(--s-4); font-weight: var(--fw-bold); font-size: var(--fs-20); letter-spacing: var(--tracking-tighter); }
.panel-close {
  width: 28px; height: 28px; flex: none; border: 1px solid var(--rule); border-radius: var(--r-8);
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.panel-close:hover { border-color: var(--rule-hover); }
.panel-close .icon { width: 14px; height: 14px; }
.panel-rows { padding: var(--s-4) 0; }
.panel-row { display: grid; grid-template-columns: 96px 1fr; gap: var(--s-12); align-items: baseline; padding: var(--s-9) var(--s-16); border-bottom: 1px solid var(--rule-soft); }
.panel-k { font-size: var(--fs-105); font-weight: var(--fw-semi); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); }
.panel-v { font-size: var(--fs-125); line-height: var(--lh-body); word-break: break-word; }
.panel-v--good { color: var(--fg-good); }
.panel-v--warn { color: var(--fg-warn); }
.panel-v--bad  { color: var(--fg-bad); }
.panel-v--info { color: var(--fg-info); }
.panel-note {
  margin: var(--s-14) var(--s-16); padding: var(--s-13) var(--s-14);
  background: var(--bg); border-radius: var(--r-10);
  font-size: var(--fs-125); line-height: var(--lh-note); color: var(--body); text-wrap: pretty;
}
.panel-actions { padding: 0 var(--s-16) var(--s-20); display: flex; flex-direction: column; gap: var(--s-7); }

/* ============================================================ utilities === */
.sep { height: 1px; background: var(--rule-soft); border: 0; margin: var(--s-14) 0; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
