/* ══════════════════════════════════════════════════════════════════════════
   SkyperBI design system
   Tokens, spacing, type scale and component styles are carried over verbatim
   from SkyperBI-Estate128-Final-Demo.html so this application reads as the
   same product. Every colour in the UI — charts included — resolves from the
   tokens below; nothing downstream hardcodes a colour.
   ══════════════════════════════════════════════════════════════════════════ */

:root{
  /* Sidebar / inverted surfaces — near-black rather than navy, so the one
     blue in the product belongs to the accent and not to the furniture. */
  --ink:#16181B; --ink-2:#22262B; --ink-3:#2B3037; --ink-line:#33383F;
  /* Three steps of grey on the dark rail. The dimmest still clears 4.5:1,
     because it carries section labels and counts, which are body-size here. */
  --on-ink:#E6E8EB; --on-ink-2:#AEB4BC; --on-ink-3:#7C838C;
  --on-ink-accent:#6BA1FF;          /* the accent, lifted for a dark ground */
  /* The two halves of the hero bar. They are set a full step of lightness
     apart, not just a step of hue, so the split survives a greyscale print
     and a colour-blind reader. */
  --ink-bar:#2563EB;                /* GST */
  --ink-bar-2:#C7D8F8;              /* net sales */

  /* Page. A neutral near-white, with borders carrying the structure so
     surfaces stay flat and quiet. */
  --canvas:#F7F8F9; --surface:#FFFFFF; --surface-2:#FAFBFC;
  --line:#E3E5E8; --line-2:#D0D4D9;
  --text:#101214; --text-2:#4B5259; --text-3:#6B7280;

  /* One accent for the chrome. --brand fills, icons and the active navigation
     row; --brand-2 anything that must clear AA as text or carry white on top.
     Both do: 5.17:1 and 6.70:1 on white. */
  --brand:#2563EB; --brand-2:#1D4ED8; --brand-soft:#EFF4FF;
  --sky:#6BA1FF; --grad-a:#2563EB; --grad-b:#1D4ED8;

  /* Semantic only — never decorative. */
  --amber:#B45309; --amber-soft:#FFFBEB;
  --coral:#B91C1C; --coral-soft:#FEF2F2;
  --green:#047857; --green-soft:#ECFDF5;
  --violet:#6D28D9; --violet-soft:#F5F3FF;

  /* Categorical chart series — the one place colour is used freely, because
     here it encodes data rather than decorating chrome. Each is deep enough to
     clear 3:1 against a white card (WCAG 1.4.11 for graphical objects), and
     the order alternates hue so neighbouring series stay tellable apart. */
  /* The order alternates hue, so neighbouring series stay tellable apart, and
     every one of the ten clears 3:1 on a white card as supplied — measured,
     from 3.09:1 (lime) to 6.29:1 (indigo). Semantic green and red are
     deliberately absent from this list so they keep meaning up and down. */
  --c1:#4F46E5; --c2:#0284C7; --c3:#0D9488; --c4:#D97706; --c5:#7C3AED;
  --c6:#DB2777; --c7:#059669; --c8:#E11D48; --c9:#0891B2; --c10:#65A30D;

  --r:10px; --r-sm:6px;
  /* Shadows are almost absent by design; a 1px border reads cleaner and keeps
     dozens of cards from looking like they float at different heights. */
  --sh:0 1px 2px rgba(16,18,20,.04);
  --sh-lg:0 12px 32px -12px rgba(16,18,20,.28);
  --sans:'IBM Plex Sans',system-ui,sans-serif;
  --disp:'Space Grotesk','IBM Plex Sans',sans-serif;
  --mono:'IBM Plex Mono',ui-monospace,monospace;
  --pad:1;
}

*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--canvas);color:var(--text);font-family:var(--sans);
  font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;background:none;border:none}
a{color:var(--brand-2);text-decoration:none}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:3px}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--line-2);border-radius:20px;border:3px solid transparent;background-clip:content-box}
::-webkit-scrollbar-thumb:hover{background:var(--text-3);background-clip:content-box;border:3px solid transparent}
.mono{font-family:var(--mono);font-variant-numeric:tabular-nums}
.eyebrow{font-family:var(--mono);font-size:10.5px;letter-spacing:.14em;text-transform:uppercase;
  color:var(--text-3);font-weight:500}
.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}

/* ─────────── SHELL ─────────── */
#app{display:grid;grid-template-columns:236px 1fr;grid-template-rows:1fr 30px;height:100vh;overflow:hidden}
.side{grid-row:1/3;background:var(--ink);color:var(--on-ink);display:flex;flex-direction:column;
  overflow:hidden;border-right:1px solid var(--ink-line)}
.side-top{padding:17px 18px;border-bottom:1px solid rgba(255,255,255,.08);
  display:flex;align-items:center;gap:8px}
.wordmark{font-size:16px}
.collapse-btn{margin-left:auto;width:24px;height:24px;border-radius:var(--r-sm);display:grid;
  place-items:center;color:var(--on-ink-3);flex:none;transition:.15s}
.collapse-btn:hover{background:rgba(255,255,255,.08);color:#fff}
.collapse-btn svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:2;
  stroke-linecap:round;stroke-linejoin:round;transition:transform .18s}

/* Collapsed rail: icons only. Labels are hidden rather than removed so the
   accessible name of each control survives, and `title` gives a hover label. */
#app.nav-collapsed{grid-template-columns:64px 1fr}
/* The toggle stays visible when collapsed — hiding it would leave no way back
   to the expanded rail. Only its chevron flips. */
#app.nav-collapsed .side-top{padding:17px 8px;justify-content:center;gap:5px}
#app.nav-collapsed .collapse-btn{margin-left:0}
#app.nav-collapsed .collapse-btn svg{transform:rotate(180deg)}
#app.nav-collapsed .wm-text,
#app.nav-collapsed .navi span,
#app.nav-collapsed .navi .cnt,
/* `.av` is itself a div, so the text block is targeted specifically —
   otherwise the avatar disappears along with the label. */
#app.nav-collapsed .side-user>div:not(.av){display:none}
#app.nav-collapsed .navsec{font-size:0;padding:12px 10px 6px}
#app.nav-collapsed .navsec:after{content:"";display:block;height:1px;
  background:rgba(255,255,255,.12)}
#app.nav-collapsed .navi{justify-content:center;padding:9px 0}
#app.nav-collapsed .side nav{padding:12px 8px}
#app.nav-collapsed .side-user{justify-content:center}
.side nav{flex:1;overflow-y:auto;padding:12px 10px}
.side nav::-webkit-scrollbar-thumb{background:var(--ink-line);background-clip:content-box}
.wordmark{display:flex;align-items:center;gap:11px;font-family:var(--disp);font-weight:700;
  font-size:19px;letter-spacing:-.015em;color:#fff}
.mark{width:30px;height:30px;border-radius:8px;background:linear-gradient(145deg,var(--grad-a),var(--grad-b));
  display:grid;place-items:center;flex:none;box-shadow:inset 0 1px 0 rgba(255,255,255,.35)}
.mark i{display:block;width:11px;height:11px;border:2px solid #fff;border-radius:2px;
  border-top-color:transparent;border-right-color:transparent;transform:rotate(-45deg) translate(1px,-1px)}
.navsec{font-family:var(--mono);font-size:9.6px;letter-spacing:.16em;text-transform:uppercase;
  color:var(--on-ink-3);padding:15px 10px 7px}
.navi{display:flex;align-items:center;gap:10px;width:100%;padding:8px 10px;border-radius:var(--r-sm);
  color:var(--on-ink);font-size:13.2px;text-align:left;transition:.13s;position:relative}
.navi:hover{background:rgba(255,255,255,.06);color:#fff}
.navi.on{background:var(--brand);color:#fff;font-weight:600}
.navi.on .ico{opacity:1}
.ico{width:16px;height:16px;flex:none;opacity:.72;stroke:currentColor;fill:none;stroke-width:1.6;
  stroke-linecap:round;stroke-linejoin:round}
.navi .cnt{margin-left:auto;font-family:var(--mono);font-size:10.5px;background:rgba(255,255,255,.1);
  padding:1px 6px;border-radius:20px}
.side-user{padding:12px;border-top:1px solid rgba(255,255,255,.08);display:flex;gap:10px;align-items:center}
.av{width:32px;height:32px;border-radius:8px;background:linear-gradient(145deg,var(--grad-a),var(--grad-b));
  display:grid;place-items:center;color:#fff;font-family:var(--disp);font-weight:700;font-size:12.5px;flex:none}
.side-user b{display:block;font-size:12.6px;color:#fff;font-weight:600;line-height:1.25}
.side-user span{font-size:11px;color:var(--on-ink-3);font-family:var(--mono)}

.main{display:flex;flex-direction:column;overflow:hidden;background:var(--canvas)}
.top{height:57px;background:var(--surface);border-bottom:1px solid var(--line);display:flex;
  align-items:center;gap:14px;padding:0 20px;flex:none}
.crumb{display:flex;align-items:baseline;gap:9px;min-width:0}
.crumb h1{font-family:var(--disp);font-size:17.5px;letter-spacing:-.02em;margin:0;white-space:nowrap}
.crumb span{font-size:12.4px;color:var(--text-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.top-r{margin-left:auto;display:flex;align-items:center;gap:9px}
.sess{font-family:var(--mono);font-size:11.4px;color:var(--text-2);background:var(--surface-2);
  border:1px solid var(--line);padding:4px 9px;border-radius:20px;display:flex;align-items:center;gap:6px}
.dot{width:6px;height:6px;border-radius:50%;background:var(--green);flex:none}
.dot.live{animation:pulse 2.4s infinite}
.dot.err{background:var(--coral);animation:none}
@keyframes pulse{0%,100%{opacity:1;box-shadow:0 0 0 0 currentColor}50%{opacity:.85;box-shadow:0 0 0 4px transparent}}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:10px 16px;
  border-radius:var(--r-sm);font-weight:600;font-size:13.5px;border:1px solid transparent;transition:.15s}
.btn-p{background:var(--brand);color:#fff}
.btn-p:hover{background:var(--brand-2)}
.btn-g{border-color:var(--line-2);background:var(--surface);color:var(--text)}
.btn-g:hover{background:var(--surface-2);border-color:var(--text-3)}
.btn-sm{padding:6px 11px;font-size:12.5px}
.btn svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round}
.btn[disabled]{opacity:.55;cursor:default}

/* ─────────── FILTER BAR ─────────── */
.fbar{min-height:50px;background:var(--surface);border-bottom:1px solid var(--line);display:flex;
  align-items:center;gap:8px;padding:7px 20px;flex:none;flex-wrap:wrap}
.f{display:flex;align-items:center;gap:6px;flex:none}
.f label{font-family:var(--mono);font-size:9.8px;letter-spacing:.1em;text-transform:uppercase;color:var(--text-3)}
.f select{padding:5px 26px 5px 9px;border:1px solid var(--line-2);border-radius:var(--r-sm);
  background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%236B7280' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>") no-repeat right 8px center;
  appearance:none;font-size:12.6px;font-weight:500;cursor:pointer;max-width:210px}
.f select:hover{border-color:var(--text-3)}
.fsep{width:1px;height:20px;background:var(--line);flex:none;margin:0 4px}
.rls{margin-left:auto;display:flex;align-items:center;gap:7px;font-family:var(--mono);font-size:10.8px;
  color:var(--amber);background:var(--amber-soft);border:1px solid var(--line);padding:4px 10px;
  border-radius:20px;flex:none}
.rls svg{width:11px;height:11px;stroke:currentColor;fill:none;stroke-width:2}

.scroll{flex:1;overflow-y:auto;padding:20px 20px 26px}
.page{display:none;animation:fade .32s ease}
.page.on{display:block}
@keyframes fade{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

.lineage{grid-column:2;background:var(--ink-2);color:var(--on-ink-2);display:flex;align-items:center;
  padding:0 16px;font-family:var(--mono);font-size:10.6px;overflow-x:auto;white-space:nowrap}
.lineage::-webkit-scrollbar{height:0}
.ln{display:flex;align-items:center;gap:7px;padding:0 13px;border-right:1px solid rgba(255,255,255,.08);height:100%}
.ln:last-child{border:none}
.ln b{color:var(--sky);font-weight:500}
.ln.push{margin-left:auto;border-left:1px solid rgba(255,255,255,.08)}

/* ─────────── LAYOUT ─────────── */
.grid{display:grid;gap:14px}
.k6{grid-template-columns:repeat(auto-fit,minmax(212px,1fr))}
.c2{grid-template-columns:repeat(auto-fit,minmax(380px,1fr))}
.c3{grid-template-columns:repeat(auto-fit,minmax(290px,1fr))}
.sec{margin-bottom:22px}
.sec-h{display:flex;align-items:center;gap:12px;margin-bottom:11px}
.sec-h h2{font-family:var(--disp);font-size:13.6px;letter-spacing:-.005em;margin:0;font-weight:600}
.sec-h .rule{flex:1;height:1px;background:var(--line)}

.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--r)}
.card-h{display:flex;align-items:center;gap:10px;padding:13px 16px;border-bottom:1px solid var(--line)}
.card-h h3{font-family:var(--disp);font-size:13.4px;margin:0;font-weight:600;letter-spacing:-.01em}
.card-h .sub{font-size:11.6px;color:var(--text-3);font-family:var(--mono)}
.card-h .tools{margin-left:auto;display:flex;gap:5px;align-items:center}
.tbtn{width:26px;height:26px;border-radius:var(--r-sm);display:grid;place-items:center;color:var(--text-3)}
.tbtn:hover{background:var(--surface-2);color:var(--brand-2)}
.tbtn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.7;
  stroke-linecap:round;stroke-linejoin:round}
.card-b{padding:16px}
.card-b.flush{padding:0}

/* ─────────── KPI TILE ─────────── */
/* Flex column + height:100% makes every tile in a grid row the same height,
   and `margin-top:auto` on the comparison row pins it to the bottom. Without
   this a tile whose comparison label wraps to two lines grows taller than its
   neighbours and the values stop sharing a baseline. */
.kpi{position:relative;background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:14px 15px 12px 18px;overflow:hidden;box-shadow:var(--sh);transition:.16s;cursor:pointer;
  text-align:left;width:100%;height:100%;display:flex;flex-direction:column}
.kpi:hover{border-color:var(--line-2);background:var(--surface-2)}
.kpi .rail{position:absolute;left:0;top:0;bottom:0;width:3px;background:var(--brand)}
.kpi.up .rail{background:var(--green)}
.kpi.dn .rail{background:var(--coral)}
.kpi.wa .rail{background:var(--amber)}
.kpi-t{display:flex;align-items:flex-start;gap:8px;margin-bottom:9px}
.kpi-t h4{font-size:12.2px;font-weight:600;color:var(--text-2);margin:0;letter-spacing:.005em}
.kpi-t .tag{margin-left:auto;font-family:var(--mono);font-size:9.4px;letter-spacing:.08em;
  color:var(--text-3);border:1px solid var(--line);padding:1px 5px;border-radius:3px;white-space:nowrap}
.kpi-v{font-family:var(--disp);font-size:27px;font-weight:700;letter-spacing:-.03em;line-height:1;
  font-variant-numeric:tabular-nums}
.kpi-v small{font-size:14px;font-weight:600;color:var(--text-2);margin-left:2px;letter-spacing:0}
.kpi-c{font-size:11.4px;color:var(--text-3);margin-top:7px;line-height:1.35}
.kpi-m{display:flex;align-items:flex-end;justify-content:space-between;gap:10px;
  margin-top:auto;padding-top:9px}
.kpi-m>div:first-child{min-width:0}
.chip{display:inline-flex;align-items:center;gap:3px;font-family:var(--mono);font-size:11.2px;
  font-weight:500;padding:2px 6px;border-radius:4px}
.chip.up{background:var(--green-soft);color:var(--green)}
.chip.dn{background:var(--coral-soft);color:var(--coral)}
.chip.wa{background:var(--amber-soft);color:var(--amber)}
.chip.nu{background:var(--surface-2);color:var(--text-2);border:1px solid var(--line)}
.kpi-m .vs{font-size:10.6px;color:var(--text-3);font-family:var(--mono)}
.spark{height:26px;width:82px;flex:none}
.plan{margin-top:10px;height:3px;background:var(--surface-2);border-radius:2px;overflow:hidden;position:relative}
.plan i{position:absolute;left:0;top:0;bottom:0;border-radius:2px;background:var(--brand);display:block}
.plan-l{display:flex;justify-content:space-between;font-family:var(--mono);font-size:9.8px;
  color:var(--text-3);margin-top:4px}

/* ─────────── TABLES ─────────── */
.tbl{width:100%;border-collapse:collapse;font-size:13px}
.tbl th{text-align:left;font-family:var(--mono);font-size:9.8px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--text-3);font-weight:500;padding:9px 12px;border-bottom:1px solid var(--line);
  background:var(--surface-2);position:sticky;top:0;z-index:2;white-space:nowrap}
.tbl th.sortable{cursor:pointer;user-select:none}
.tbl th.sortable:hover{color:var(--brand-2)}
.tbl th .dir{margin-left:4px;opacity:.55}
.tbl td{padding:9px 12px;border-bottom:1px solid var(--line)}
.tbl tbody tr:hover td{background:var(--surface-2)}
.tbl tr:last-child td{border-bottom:none}
.tbl .n{text-align:right;font-family:var(--mono);font-variant-numeric:tabular-nums;white-space:nowrap}
.tbl .n.neg{color:var(--coral)}
.tbl .code{font-family:var(--mono);font-size:11.8px;color:var(--text-2)}
.bar{height:4px;border-radius:2px;background:var(--brand);display:block;min-width:2px}
.wrap-t{max-height:420px;overflow:auto}

/* Table-first pages fill the available height instead of leaving a short card
   floating above dead canvas. The header and pager stay fixed while the rows
   scroll, which is how an enterprise data grid behaves. */
#pg-register.on{display:flex;flex-direction:column;min-height:calc(100vh - 187px)}
#pg-register>.sec{flex:1;display:flex;margin-bottom:0;min-height:0}
#pg-register .card{flex:1;display:flex;flex-direction:column;min-height:0}
#pg-register .card-b{flex:1;min-height:0;display:flex}
#pg-register .wrap-t{max-height:none;flex:1;min-height:0;width:100%}

/* The ranking closes this page rather than sharing a row with the Pareto, so
   it scrolls at a height of its own instead of stretching to match a chart.
   Taller than the 420px default because the ranking is the point of the page
   and ten rows of it says very little. */
#pg-customers .wrap-t{max-height:560px}
/* Each card ends where its content does. The percentiles table is eight rows
   beside a fifty-row ranking, and stretching it to match leaves a half-screen
   of empty card under the last figure. */
#pg-customers .grid.c2>.card,
#pg-profit .grid.c2>.card,
#pg-team .grid.c2>.card{align-self:start}

.pill{display:inline-flex;align-items:center;gap:5px;font-size:11.4px;font-weight:600;
  padding:2px 8px;border-radius:20px}
.p-ok{background:var(--green-soft);color:var(--green)}
.p-wa{background:var(--amber-soft);color:var(--amber)}
.p-er{background:var(--coral-soft);color:var(--coral)}
.p-nu{background:var(--surface-2);color:var(--text-2);border:1px solid var(--line)}
.p-tl{background:var(--brand-soft);color:var(--brand-2)}
.p-vi{background:var(--violet-soft);color:var(--violet)}

/* table toolbar */
.tbar{display:flex;gap:8px;align-items:center;padding:11px 16px;border-bottom:1px solid var(--line);
  flex-wrap:wrap}
.tbar input[type=search]{flex:1;min-width:180px;padding:7px 10px;border:1px solid var(--line-2);
  border-radius:var(--r-sm);background:var(--surface);font-size:12.6px}
.tbar input[type=search]:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.pager{display:flex;align-items:center;gap:8px;padding:10px 16px;border-top:1px solid var(--line);
  font-family:var(--mono);font-size:11.4px;color:var(--text-2)}
.pager .spacer{flex:1}

/* ─────────── STATES ─────────── */
.empty{text-align:center;padding:40px 20px;color:var(--text-3)}
.empty b{display:block;font-family:var(--disp);color:var(--text-2);font-size:14px;margin-bottom:5px}
.empty p{margin:0;font-size:12.8px;max-width:44ch;margin-inline:auto}
.empty.err b{color:var(--coral)}

.skel{background:linear-gradient(90deg,var(--surface-2) 25%,var(--line) 37%,var(--surface-2) 63%);
  background-size:400% 100%;animation:shimmer 1.3s ease infinite;border-radius:var(--r-sm)}
@keyframes shimmer{0%{background-position:100% 50%}100%{background-position:0 50%}}
.skel-kpi{height:104px;border-radius:var(--r)}
.skel-chart{height:280px}
.skel-row{height:32px;margin-bottom:6px}

.hint{font-size:12.2px;color:var(--text-2);background:var(--surface-2);border-left:3px solid var(--brand);
  padding:10px 13px;border-radius:0 var(--r-sm) var(--r-sm) 0;margin-bottom:14px}
.hint b{font-weight:600;color:var(--text)}
.hint.wa{border-left-color:var(--amber);background:var(--amber-soft)}

/* ─────────── CHART TOOLTIP ─────────── */
/* ApexCharts' own tooltip chrome is suppressed so the panel inherits the
   product's surface, border and type rather than the library's defaults. */
.apexcharts-tooltip{background:transparent!important;border:none!important;
  box-shadow:var(--sh-lg)!important}
.ctip{background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r-sm);
  padding:9px 11px;min-width:168px;font-family:var(--sans)}
.ctip-h{font-size:11.6px;font-weight:600;color:var(--text);margin-bottom:3px;
  max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ctip-v{font-family:var(--disp);font-size:17px;font-weight:700;color:var(--text);
  letter-spacing:-.02em;margin-bottom:6px;font-variant-numeric:tabular-nums}
.ctip-r{display:flex;justify-content:space-between;gap:14px;font-size:11.4px;
  color:var(--text-2);padding:1.5px 0}
.ctip-r b{font-family:var(--mono);font-weight:500;color:var(--text);
  font-variant-numeric:tabular-nums}

/* A chart whose points filter the dashboard says so on hover. */
.clickable-chart .apexcharts-bar-area,
.clickable-chart .apexcharts-pie-area{cursor:pointer}

/* ─────────── TOAST ─────────── */
.toast{position:fixed;bottom:44px;left:50%;transform:translateX(-50%) translateY(14px);
  background:var(--ink);color:var(--on-ink);padding:10px 17px;border-radius:22px;font-size:13px;
  z-index:90;opacity:0;transition:.28s;pointer-events:none;box-shadow:var(--sh-lg);
  display:flex;align-items:center;gap:9px;max-width:min(90vw,520px)}
.toast.on{opacity:1;transform:translateX(-50%)}

/* ─────────── AI ANALYST ─────────── */
.ai{display:grid;grid-template-columns:1fr 296px;gap:14px;height:calc(100vh - 187px);min-height:520px}
.chat{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);display:flex;
  flex-direction:column;overflow:hidden;box-shadow:var(--sh)}
.chat-b{flex:1;overflow-y:auto;padding:18px 20px;display:flex;flex-direction:column;gap:16px}
.msg{max-width:min(760px,94%);animation:fade .3s}
.msg.u{align-self:flex-end}
.msg.u .bub{background:var(--ink);color:var(--on-ink);border-radius:12px 12px 3px 12px;
  padding:9px 13px;font-size:13.2px}
.msg.a .bub{background:var(--surface-2);border:1px solid var(--line);border-radius:12px 12px 12px 3px;
  padding:13px 15px;font-size:13.4px}
.msg-w{display:flex;align-items:center;gap:7px;margin-bottom:6px;font-family:var(--mono);font-size:9.8px;
  letter-spacing:.1em;text-transform:uppercase;color:var(--text-3)}
.msg.u .msg-w{justify-content:flex-end}
.aidot{width:16px;height:16px;border-radius:5px;background:linear-gradient(145deg,var(--grad-a),#5D51A0);
  display:grid;place-items:center;flex:none}
.aidot:after{content:"";width:5px;height:5px;background:#fff;border-radius:50%}
.bub h5{font-family:var(--disp);font-size:13px;margin:14px 0 6px;font-weight:600}
.bub h5:first-child{margin-top:0}
.bub p{margin:0 0 9px}
.bub p:last-child{margin:0}
.bub ul{margin:0 0 9px;padding-left:17px}
.bub li{margin-bottom:4px}
.bub b{font-weight:600}
.bub .num{font-family:var(--mono);font-weight:500;background:var(--surface);border:1px solid var(--line);
  padding:0 4px;border-radius:3px;font-size:12.2px}
.aichart{margin:11px 0;border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);padding:6px}
.srcnote{margin-top:10px;padding-top:9px;border-top:1px dashed var(--line-2);font-family:var(--mono);
  font-size:10.4px;color:var(--text-3);line-height:1.5}
.chat-f{border-top:1px solid var(--line);padding:12px 14px;flex:none;background:var(--surface-2)}
.ask{display:flex;gap:8px;align-items:flex-end;background:var(--surface);border:1px solid var(--line-2);
  border-radius:var(--r);padding:7px 7px 7px 13px;transition:.15s}
.ask:focus-within{border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.ask textarea{flex:1;border:none;resize:none;outline:none;max-height:110px;font-size:13.2px;
  padding:4px 0;background:transparent;font-family:var(--sans)}
.send{width:32px;height:32px;border-radius:var(--r-sm);background:var(--brand);color:#fff;
  display:grid;place-items:center;flex:none}
.send:hover{background:var(--brand-2)}
.send:disabled{background:var(--line-2);cursor:default}
.send svg{width:15px;height:15px;stroke:currentColor;fill:none;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round}
.sugs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:9px}
.sug{border:1px solid var(--line-2);background:var(--surface);border-radius:20px;padding:5px 11px;
  font-size:12.2px;color:var(--text-2);transition:.13s;font-family:var(--sans)}
.sug:hover{border-color:var(--brand);color:var(--brand-2);background:var(--brand-soft)}
.think{display:flex;align-items:center;gap:7px;color:var(--text-3);font-size:12.6px;font-family:var(--mono)}
.think i{width:5px;height:5px;border-radius:50%;background:var(--brand);animation:bounce 1.3s infinite}
.think i:nth-child(2){animation-delay:.16s}
.think i:nth-child(3){animation-delay:.32s}
@keyframes bounce{0%,60%,100%{opacity:.25;transform:translateY(0)}30%{opacity:1;transform:translateY(-4px)}}

.pane{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);display:flex;
  flex-direction:column;overflow:hidden;box-shadow:var(--sh)}
.pane-h{padding:11px 13px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:8px;flex:none}
.pane-h b{font-family:var(--disp);font-size:12.4px;font-weight:600}
.pane-h .n{margin-left:auto;font-family:var(--mono);font-size:10px;color:var(--text-3)}
.pane-b{flex:1;overflow-y:auto;padding:9px}
/* The exceptions card is set apart by a top rule in the warning colour rather
   than a coloured fill, which would fight the rest of the surface. */
.card-risk{border-top:2px solid var(--amber)}
/* A signal card is a button: the reset undoes the browser's own styling so it
   still reads as a row, and the focus ring puts it on the keyboard path. */
.alert-i{display:flex;gap:10px;width:100%;padding:10px 12px;border:none;
  border-bottom:1px solid var(--line);background:none;font:inherit;color:inherit;
  text-align:left;cursor:pointer;transition:.13s}
.alert-i:hover{background:var(--surface-2)}
.alert-i:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
.alert-i .sig{width:3px;border-radius:2px;flex:none;background:var(--brand)}
.alert-i .sig.up{background:var(--green)}
.alert-i .sig.dn{background:var(--coral)}
.alert-i .sig.wa{background:var(--amber)}
.alert-i b{display:block;font-size:12.6px;font-weight:600;margin-bottom:2px}
.alert-i span{font-size:11.8px;color:var(--text-2);line-height:1.4;display:block}

/* ─────────── SOURCE / PROVENANCE ─────────── */
.src-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.src-field{border:1px solid var(--line);border-radius:var(--r-sm);padding:9px 10px;background:var(--surface-2)}
.src-field span{display:block;font-family:var(--mono);font-size:9.5px;text-transform:uppercase;
  letter-spacing:.08em;color:var(--text-3);margin-bottom:3px}
.src-field b{display:block;font-size:12.5px;word-break:break-word;font-weight:600}

/* ─────────── MODAL ─────────── */
.modal{position:fixed;inset:0;z-index:70;display:none;align-items:center;justify-content:center;
  padding:22px;background:rgba(16,18,20,.55);backdrop-filter:blur(3px)}
.modal.on{display:flex;animation:fade .2s}
.modal-c{background:var(--surface);border-radius:12px;width:100%;max-width:620px;max-height:86vh;
  overflow:auto;box-shadow:var(--sh-lg)}
.modal-h{padding:16px 20px;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:10px}
.modal-h h3{font-family:var(--disp);font-size:15.5px;margin:0}
.modal-h .x{margin-left:auto;color:var(--text-3);font-size:20px;line-height:1}
.modal-h .x:hover{color:var(--coral)}
.modal-b{padding:20px}

/* ─────────── THEMES ─────────── */
html[data-theme="midnight"]{
  /* The dark counterpart of graphite: same structure, inverted ground. The
     canvas is darker than the surfaces so cards read as raised by value, not
     by shadow. */
  --ink:#080B11; --ink-2:#161A21; --ink-3:#1E242D; --ink-line:#26303F;
  --on-ink:#E6EBF2; --on-ink-2:#AEB6C1; --on-ink-3:#828C99;
  --on-ink-accent:#6BA1FF;
  --ink-bar:#4C8DFF; --ink-bar-2:#C7D8F8;

  --canvas:#061020; --surface:#0E1A2C; --surface-2:#132238;
  --line:#1E3149; --line-2:#2A405C;
  --text:#E8EDF5; --text-2:#9BADC4; --text-3:#7C8FA6;

  --brand:#4C8DFF; --brand-2:#6BA1FF; --brand-soft:#152238;
  --sky:#6BA1FF; --grad-a:#4C8DFF; --grad-b:#1D4ED8;

  --amber:#FBBF24; --amber-soft:#2B2110;
  --coral:#F87171; --coral-soft:#2E1414;
  --green:#34D399; --green-soft:#0C2A22;
  --violet:#A78BFA; --violet-soft:#1F1B33;

  /* Same hues lifted for the dark ground. */
  --c1:#818CF8; --c2:#38BDF8; --c3:#2DD4BF; --c4:#FBBF24; --c5:#A78BFA;
  --c6:#F472B6; --c7:#10B981; --c8:#FB7185; --c9:#22D3EE; --c10:#A3E635;

  --sh:0 1px 2px rgba(0,0,0,.5);
  --sh-lg:0 12px 32px -12px rgba(0,0,0,.75);
}
html[data-theme="midnight"] .f select{
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%238A93A1' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>")}

html[data-density="compact"]{--pad:.72}
html[data-density="compact"] .card-b{padding:calc(16px * var(--pad))}
html[data-density="compact"] .kpi{padding:10px 11px 9px 14px}
html[data-density="compact"] .kpi-v{font-size:23px}
html[data-density="compact"] .tbl td{padding:6px 10px}
html[data-density="compact"] .scroll{padding:14px 14px 18px}
html[data-density="compact"] .grid{gap:10px}

/* ─────────── RESPONSIVE ─────────── */
@media (max-width:1180px){
  .ai{grid-template-columns:1fr;height:auto}
  .ai .chat{min-height:520px}
}
@media (max-width:900px){
  #app{grid-template-columns:1fr}
  .side{position:fixed;inset:0 auto 0 0;width:236px;z-index:60;transform:translateX(-100%);
    transition:transform .2s;grid-row:auto}
  .side.open{transform:none}
  .lineage{grid-column:1}
  .top{padding:0 12px;gap:8px}
  .top-r .lbl{display:none}
  .top-r{flex:none;gap:6px}
  /* The title must be allowed to shrink, otherwise its nowrap runs underneath
     the toolbar buttons instead of ellipsing. */
  .crumb{flex:1 1 auto;min-width:0}
  .crumb h1{font-size:15.5px;overflow:hidden;text-overflow:ellipsis;min-width:0}
  .crumb span{display:none}
  .sess{display:none}
  .scroll{padding:14px 12px 20px}
  .src-grid{grid-template-columns:1fr}
  .menu-btn{display:grid!important}
}
.menu-btn{display:none;width:30px;height:30px;border-radius:var(--r-sm);place-items:center;color:var(--text-2)}
.menu-btn svg{width:17px;height:17px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round}
.scrim{display:none;position:fixed;inset:0;background:rgba(16,18,20,.5);z-index:55}
.scrim.on{display:block}

@media (prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}

@media print{
  .side,.fbar,.top-r,.lineage,.toast{display:none!important}
  #app{display:block;height:auto}
  .card{break-inside:avoid;box-shadow:none}
}

/* ══════════════════════════════════════════════════════════════════════════
   Filter bar: five controls inline, the rest in a panel, active filters as
   removable chips. Twelve selects in one row ran off the side of the screen
   and hid the filters that were actually in force.
   ══════════════════════════════════════════════════════════════════════════ */
.fwrap{background:var(--surface);border-bottom:1px solid var(--line)}
.fwrap .fbar{border-bottom:none}
/* The chevron is drawn inside a data URI, which cannot read a custom property,
   so its grey is the one colour in this file that has to be written out. It is
   --text-3 in each theme; change it here whenever that token changes. */
.f-sel{padding:6px 26px 6px 10px;border:1px solid var(--line-2);border-radius:var(--r-sm);
  background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%236B7280' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>") no-repeat right 8px center;background-size:11px;
  font:inherit;font-size:12.6px;color:var(--text);appearance:none;cursor:pointer;
  max-width:170px;flex:none}
.f-sel:hover{border-color:var(--text-3)}
.f-sel.on{border-color:var(--brand);background-color:var(--brand-soft);color:var(--brand-2)}

.fmore{position:relative;flex:none}
.fmore .cnt{display:inline-grid;place-items:center;min-width:17px;height:17px;padding:0 4px;
  margin-left:2px;border-radius:9px;background:var(--brand);color:#fff;
  font-family:var(--mono);font-size:10.2px;font-weight:600}
.fmore .cnt[hidden]{display:none}
.fpanel{position:absolute;z-index:60;top:calc(100% + 7px);left:0;width:min(560px,92vw);
  background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r);
  box-shadow:var(--sh-lg);padding:16px}
.fpanel[hidden]{display:none}
.fpanel-h{display:flex;align-items:baseline;justify-content:space-between;gap:10px;margin-bottom:11px}
.fpanel-h b{font-family:var(--disp);font-size:13.5px}
.fpanel-h span{font-family:var(--mono);font-size:10.4px;color:var(--text-3)}
.fpanel-g{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));gap:11px 16px}
.fp{display:grid;gap:4px;min-width:0}
.fp>span{font-family:var(--mono);font-size:10px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--text-3)}
.fp>span i{font-style:normal;letter-spacing:0;text-transform:none;opacity:.75}
.fp select.on{border-color:var(--brand);background-color:var(--brand-soft);color:var(--brand-2)}
.fp select{width:100%;padding:6px 26px 6px 10px;border:1px solid var(--line-2);
  border-radius:var(--r-sm);background:var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path d='M2 4l3 3 3-3' stroke='%236B7280' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>") no-repeat right 8px center;
  background-size:11px;font:inherit;font-size:12.6px;color:var(--text);appearance:none;cursor:pointer}

.fchips{display:flex;flex-wrap:wrap;align-items:center;gap:6px;padding:8px 22px;
  border-top:1px solid var(--line);background:var(--surface-2)}
.fchips[hidden]{display:none}
.fchips-l{font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;
  color:var(--text-3)}
.fchip{display:inline-flex;align-items:center;gap:5px;padding:3px 7px 3px 10px;
  border:1px solid color-mix(in srgb,var(--brand) 35%,transparent);border-radius:20px;
  background:var(--brand-soft);color:var(--brand-2);font-size:11.8px;cursor:pointer;
  max-width:280px}
.fchip:hover{border-color:var(--brand)}
.fchip svg{width:11px;height:11px;fill:none;stroke:currentColor;stroke-width:2.4;
  stroke-linecap:round;opacity:.65;flex:none}
.fchip:hover svg{opacity:1}
.fclear{margin-left:4px;background:none;border:none;color:var(--text-3);font:inherit;
  font-size:11.8px;font-weight:500;cursor:pointer;text-underline-offset:2px}
.fclear:hover{color:var(--text);text-decoration:underline}

/* ---- pills, drill-down rows and negative figures ------------------------ */
.pill{display:inline-flex;align-items:center;padding:1px 7px;border-radius:20px;
  border:1px solid var(--line);background:var(--surface-2);color:var(--text-2);
  font-family:var(--mono);font-size:10.4px;white-space:nowrap}
.pill.accent{background:var(--brand-soft);border-color:color-mix(in srgb,var(--brand) 28%,transparent);
  color:var(--brand-2)}
.pill.wa{background:var(--amber-soft);border-color:color-mix(in srgb,var(--amber) 28%,transparent);
  color:var(--amber)}
.tbl td.dn,.tbl td .dn{color:var(--coral)}
.rows-click tbody tr{cursor:pointer}
.tbl-drill tbody tr.drill{cursor:pointer}
.tbl-drill td.x{width:22px;color:var(--text-3);font-size:11px}
.ct{display:grid;gap:1px;min-width:0}
.ct b{font-weight:600;font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.ct .code{font-family:var(--mono);font-size:10.6px;color:var(--text-3)}
.drill-body td{padding:0 !important;background:var(--surface-2)}
.drill-in{max-height:360px;overflow:auto;border-top:1px solid var(--line)}
.drill-in .tbl td,.drill-in .tbl th{padding-top:7px;padding-bottom:7px}

/* ---- phones ------------------------------------------------------------- */
@media (max-width:720px){
  .fchips{padding:8px 14px}
  .fpanel{width:min(560px,94vw);left:auto;right:0}
  .k6{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kpi-v{font-size:19px}
  .spark{display:none}
}

/* ---- dataset upload ----------------------------------------------------- */
.upl{display:grid;gap:12px}
.upl-drop{display:grid;justify-items:center;gap:4px;padding:22px;border:1.5px dashed var(--line-2);
  border-radius:var(--r);background:var(--surface-2);cursor:pointer;text-align:center}
.upl-drop:hover,.upl-drop.over{border-color:var(--brand);background:var(--brand-soft)}
.upl-drop svg{width:22px;height:22px;fill:none;stroke:var(--brand);stroke-width:1.8;
  stroke-linecap:round;stroke-linejoin:round}
.upl-drop b{font-size:13.4px}
.upl-drop span{font-family:var(--mono);font-size:11px;color:var(--text-3);max-width:60ch}
.upl-list{display:grid;gap:6px}
.upl-list:empty{display:none}
.upl-f{display:flex;align-items:center;gap:8px;padding:6px 10px;border:1px solid var(--line);
  border-radius:var(--r-sm);background:var(--surface);font-size:12.6px}
.upl-f .nm{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.upl-f .sz{margin-left:auto;font-family:var(--mono);font-size:11px;color:var(--text-3)}
.upl-f .bad{color:var(--coral);font-family:var(--mono);font-size:11px}
.upl-act{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.upl-state{font-family:var(--mono);font-size:11.5px;color:var(--text-2)}
.upl-state.err{color:var(--coral)}
.upl-state.ok{color:var(--green)}
.upl-log{margin:0;max-height:260px;overflow:auto;padding:10px 12px;border:1px solid var(--line);
  border-radius:var(--r-sm);background:var(--surface-2);font-family:var(--mono);font-size:11.4px;
  line-height:1.55;color:var(--text-2);white-space:pre-wrap}
.upl-log[hidden]{display:none}

/* ---- click menu on a tile or a chart point ------------------------------ */
.amenu{position:fixed;z-index:80;min-width:232px;padding:5px;border:1px solid var(--line-2);
  border-radius:var(--r);background:var(--surface);box-shadow:var(--sh-lg);
  animation:fade .12s}
.amenu-h{padding:7px 9px 6px;font-family:var(--mono);font-size:10px;letter-spacing:.1em;
  text-transform:uppercase;color:var(--text-3);border-bottom:1px solid var(--line);
  margin-bottom:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.amenu button{display:flex;align-items:flex-start;gap:9px;width:100%;padding:8px 9px;border:none;
  border-radius:var(--r-sm);background:none;text-align:left;cursor:pointer;color:var(--text)}
.amenu button:hover,.amenu button:focus-visible{background:var(--brand-soft)}
.amenu button svg{width:15px;height:15px;margin-top:1px;flex:none;fill:none;stroke:var(--brand);
  stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.amenu button b{display:block;font-size:12.8px;font-weight:600}
.amenu button i{display:block;font-style:normal;font-size:11px;color:var(--text-3);line-height:1.35}

/* ---- streaming narration -------------------------------------------------
   A caret while the sentence is being written, so a pause reads as the model
   thinking rather than as the answer having stopped. It is removed on the last
   frame, not on a timer. */
.bub p.prose.streaming:after{content:"";display:inline-block;width:2px;height:1em;
  margin-left:2px;vertical-align:-2px;background:var(--brand);
  animation:caret 1s steps(2,start) infinite}
@keyframes caret{to{opacity:0}}
@media(prefers-reduced-motion:reduce){.bub p.prose.streaming:after{animation:none}}
.bub p.prose.partial{color:var(--text-3)}

/* ---- source-level detail modal ------------------------------------------ */
.modal-c{max-width:min(1060px,94vw)}
.drill-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:10px}
.drill-path{font-family:var(--mono);font-size:10.6px;color:var(--text-3);word-break:break-word}
.drill-count{font-family:var(--mono);text-align:right;flex:none}
.drill-count b{display:block;font-size:19px;color:var(--brand-2)}
.drill-count span{font-size:10px;letter-spacing:.08em;text-transform:uppercase;color:var(--text-3)}
.drill-note{padding:9px 11px;background:var(--brand-soft);border-left:3px solid var(--brand);
  border-radius:0 var(--r-sm) var(--r-sm) 0;font-size:11.8px;color:var(--text-2);margin:10px 0}
.drill-tools{display:flex;gap:8px;margin:10px 0}
.drill-tools input{flex:1;padding:8px 10px;border:1px solid var(--line-2);border-radius:var(--r-sm);
  background:var(--surface);font:inherit;font-size:12.5px;color:var(--text)}
.drill-table-wrap{max-height:52vh;overflow:auto;border:1px solid var(--line);border-radius:var(--r-sm)}
.drill-table-wrap .tbl{font-size:11.8px}
.drill-table-wrap .tbl td,.drill-table-wrap .tbl th{padding:7px 9px}
.drill-foot{display:flex;align-items:center;gap:8px;margin-top:10px;font-family:var(--mono);
  font-size:11.2px;color:var(--text-3);flex-wrap:wrap}

/* A sortable header is a button, so it is reachable by keyboard and reads as
   an action. The arrow is part of the label rather than a separate glyph, so
   the column that is ordering the query is unmistakable. */
.drill-table-wrap .tbl th.srt{padding:0}
.drill-table-wrap .tbl th.srt button{width:100%;padding:7px 9px;border:0;background:none;
  font:inherit;color:inherit;letter-spacing:inherit;text-transform:inherit;text-align:left;
  cursor:pointer;white-space:nowrap}
.drill-table-wrap .tbl th.srt.n button{text-align:right}
.drill-table-wrap .tbl th.srt button:hover{background:var(--surface-2);color:var(--text)}
.drill-table-wrap .tbl th.srt.on button{color:var(--brand-2)}
.drill-table-wrap .tbl th.pick,.drill-table-wrap .tbl td.pick{width:30px;padding-right:0;
  text-align:center}
.drill-table-wrap .tbl input[type=checkbox]{accent-color:var(--brand);cursor:pointer;margin:0}
.drill-table-wrap .tbl tr.picked td{background:var(--brand-soft)}


/* ══════════════════════════════════════════════════════════════════════════
   Sales Overview — the approved layout (docs/HANDOFF.md).
   A 3-column grid: a navy hero beside a 2x2 metric block, three health cards,
   the trend beside the analyst, and the action list beneath.
   ══════════════════════════════════════════════════════════════════════════ */
.ov{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;
  padding:24px 28px 28px}
.ov-hero{grid-column:span 2}
.ov-trend{grid-column:span 2}
.ov-ai{grid-row:span 2}
.ov-actions{grid-column:span 2}
@media(max-width:1180px){
  .ov{grid-template-columns:repeat(2,minmax(0,1fr))}
  .ov-hero,.ov-trend,.ov-actions{grid-column:span 2}
  .ov-ai{grid-row:auto;grid-column:span 2}
}
@media(max-width:760px){
  .ov{grid-template-columns:minmax(0,1fr);padding:16px 14px 22px;gap:14px}
  .ov-hero,.ov-trend,.ov-actions,.ov-ai{grid-column:span 1}
}

/* ---- hero: net sales, split into net and GST ---------------------------- */
.hero{background:var(--ink);border-radius:var(--r);padding:24px 26px;
  display:flex;flex-direction:column;gap:18px;color:var(--on-ink);min-height:196px}
.hero-h{display:flex;align-items:center;gap:10px}
.hero-h b{font-family:var(--mono);font-size:10.5px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--on-ink-2)}
.hero-tag{padding:2px 7px;border:1px solid var(--ink-line);border-radius:20px;
  font-family:var(--mono);font-size:9.6px;letter-spacing:.08em;color:var(--on-ink-2)}
.hero-cmp{margin-left:auto;font-family:var(--mono);font-size:10.4px;color:var(--on-ink-3)}
.hero-v{font-family:var(--disp);font-weight:600;font-size:42px;letter-spacing:-.02em;
  line-height:1;color:#fff}
.hero-v .cur{font-size:24px;color:var(--on-ink-2);margin-right:4px}
.hero-v .un{font-size:22px;color:var(--on-ink-2);margin-left:6px}
.hero-sub{font-size:12.6px;color:var(--on-ink-2)}
.hero-bar{display:flex;height:9px;border-radius:20px;overflow:hidden;background:var(--ink-3)}
.hero-bar i{display:block;height:100%}
.hero-bar .net{background:var(--ink-bar-2)}
.hero-bar .gst{background:var(--ink-bar)}
.hero-legend{display:flex;flex-wrap:wrap;gap:18px}
.hero-legend div{display:grid;gap:2px}
.hero-legend span{font-family:var(--mono);font-size:10px;letter-spacing:.08em;
  text-transform:uppercase;color:var(--on-ink-3);display:flex;align-items:center;gap:6px}
.hero-legend span i{width:8px;height:8px;border-radius:2px;flex:none}
/* The legend swatches read from the same tokens as the bar segments, so the
   two can never drift apart. */
.hero-legend span i.net{background:var(--ink-bar-2)}
.hero-legend span i.gst{background:var(--ink-bar)}
.hero-legend b{font-size:13px;color:#fff;font-weight:500}

/* ---- 2x2 volume metrics -------------------------------------------------- */
.ov-metrics{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
.ov-metrics .m{padding:18px 20px;border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);display:grid;gap:5px;align-content:start;cursor:pointer}
.ov-metrics .m:nth-child(2n){border-right:none}
.ov-metrics .m:nth-child(n+3){border-bottom:none}
.ov-metrics .m:hover{background:var(--surface-2)}
.ov-metrics .m span{font-family:var(--mono);font-size:9.8px;letter-spacing:.1em;
  text-transform:uppercase;color:var(--text-3)}
.ov-metrics .m b{font-family:var(--disp);font-size:25px;font-weight:600;letter-spacing:-.02em;
  line-height:1.05}
.ov-metrics .m i{font-style:normal;font-size:11.6px;color:var(--text-3)}
/* A different accent per metric, so the four read as four things rather than
   one block of type. The card itself stays white — only the rule is coloured,
   and it carries no meaning beyond telling the cells apart. */
.ov-metrics .m{position:relative}
.ov-metrics .m:before{content:"";position:absolute;left:0;top:18px;bottom:18px;width:3px;
  border-radius:0 2px 2px 0}
.ov-metrics .m:nth-child(1):before{background:var(--c1)}
.ov-metrics .m:nth-child(2):before{background:var(--c3)}
.ov-metrics .m:nth-child(3):before{background:var(--c4)}
.ov-metrics .m:nth-child(4):before{background:var(--c5)}

/* ---- health cards -------------------------------------------------------- */
.hc{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  padding:20px;display:flex;flex-direction:column;gap:14px}
.hc-h{display:flex;align-items:flex-start;gap:10px}
.hc-h h3{margin:0;font-family:var(--disp);font-size:15px;font-weight:600}
.hc-h p{margin:2px 0 0;font-size:11.4px;color:var(--text-3)}
.hc-badge{margin-left:auto;display:inline-flex;align-items:center;gap:5px;padding:3px 8px;
  border-radius:20px;font-family:var(--mono);font-size:9.8px;letter-spacing:.06em;white-space:nowrap}
.hc-badge.risk{background:var(--coral-soft);color:var(--coral)}
.hc-badge.warn{background:var(--amber-soft);color:var(--amber)}
.hc-badge.ok{background:var(--green-soft);color:var(--green)}
.hc-badge.flat{background:var(--surface-2);color:var(--text-2);border:1px solid var(--line)}
.hc-v{font-family:var(--disp);font-size:27px;font-weight:600;letter-spacing:-.02em;line-height:1}
.hc-v .cur{font-size:17px;color:var(--text-3);margin-right:3px}
.hc-v small{display:block;font-family:var(--sans);font-size:11.4px;font-weight:400;
  color:var(--text-3);margin-top:4px;letter-spacing:0}
.hc-rows{display:grid;gap:9px}
.hc-row{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:10px;font-size:12.4px}
.hc-row .k{display:flex;align-items:center;gap:7px;color:var(--text-2)}
.hc-row .k i{width:8px;height:8px;border-radius:2px;flex:none}
.hc-row .v{font-family:var(--mono);font-size:12.2px}
.hc-row .p{font-family:var(--mono);font-size:11px;color:var(--text-3);min-width:44px;text-align:right}
.hc-split{display:flex;height:8px;border-radius:20px;overflow:hidden;background:var(--surface-2);
  border:1px solid var(--line)}
.hc-split i{display:block;height:100%}
.hc-foot{margin-top:auto;display:flex;align-items:center;gap:8px;padding-top:4px;
  font-family:var(--mono);font-size:10.6px;color:var(--text-3);flex-wrap:wrap}
.hc-link{margin-left:auto;background:none;border:none;padding:0;cursor:pointer;
  font-family:var(--sans);font-size:12px;font-weight:500;color:var(--brand-2)}
.hc-link:hover{text-decoration:underline}
.hc-note{padding:8px 10px;border-left:3px solid var(--amber);background:var(--amber-soft);
  border-radius:0 var(--r-sm) var(--r-sm) 0;font-size:11.4px;color:var(--text-2)}
.hc-stats{display:grid;gap:10px}
.hc-stat{display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  padding-bottom:9px;border-bottom:1px solid var(--line)}
.hc-stat:last-child{border-bottom:none;padding-bottom:0}
.hc-stat span{font-size:12.2px;color:var(--text-2)}
.hc-stat b{font-family:var(--mono);font-size:15px;color:var(--text)}

/* ---- analyst panel on the overview -------------------------------------- */
.ovai{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  display:flex;flex-direction:column;min-height:320px}
.ovai-h{display:flex;align-items:center;gap:9px;padding:16px 18px;border-bottom:1px solid var(--line)}
.ovai-h h3{margin:0;font-family:var(--disp);font-size:15px;font-weight:600;flex:1}
.ovai-b{padding:16px 18px;display:grid;gap:14px;overflow:auto;flex:1;align-content:start}
.ovai-s{font-family:var(--mono);font-size:9.8px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--text-3)}
.ovai-sum{font-size:12.8px;line-height:1.55;color:var(--text-2)}
.ovai-i{display:grid;gap:3px;padding:10px 12px;border-radius:var(--r-sm);background:var(--surface-2);
  border-left:3px solid var(--line-2)}
.ovai-i.wa{border-left-color:var(--amber);background:var(--amber-soft)}
.ovai-i.dn{border-left-color:var(--coral);background:var(--coral-soft)}
.ovai-i.up{border-left-color:var(--green);background:var(--green-soft)}
.ovai-i b{font-size:12.4px}
.ovai-i span{font-size:11.6px;color:var(--text-2);line-height:1.5}
.ovai-q{display:flex;flex-wrap:wrap;gap:6px}
.ovai-q button{padding:5px 10px;border:1px solid var(--line-2);border-radius:20px;
  background:var(--surface);font:inherit;font-size:11.8px;color:var(--text-2);cursor:pointer}
.ovai-q button:hover{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-2)}
.ovai-f{padding:14px 18px;border-top:1px solid var(--line);display:grid;gap:8px}
.ovai-f .note{font-family:var(--mono);font-size:10px;color:var(--text-3);line-height:1.5}

/* ---- action list --------------------------------------------------------- */
.ov-actions .tbl td{padding:11px 14px}
.act-item{display:grid;gap:2px}
.act-item b{font-size:13px}
.act-item span{font-size:11.2px;color:var(--text-3)}


/* ---- filter toolbar: the grouped control from the approved design -------- */
.fgroup{display:flex;align-items:stretch;border:1px solid var(--line-2);border-radius:var(--r-sm);
  background:var(--surface);overflow:hidden;flex:none}
/* Every cell is the same width. Left to size themselves, a <select> takes the
   width of its WIDEST option, not its current value — so State and Material
   group ballooned and left their chevrons stranded a centimetre from the text,
   while Entity and Month sat snug. Equal cells put the five chevrons on a
   rhythm and let long values truncate instead of stretching the toolbar. */
.fg{display:grid;gap:2px;padding:6px 11px 7px;border-right:1px solid var(--line);
  width:140px;min-width:0;transition:background .13s}
.fg:last-child{border-right:none}
.fg:hover{background:var(--surface-2)}
.fg:focus-within{background:var(--brand-soft)}
.fg>span{font-family:var(--mono);font-size:9.4px;letter-spacing:.1em;text-transform:uppercase;
  color:var(--text-3);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fg .f-sel{border:none;background-color:transparent;padding:0 17px 0 0;font-size:12.6px;
  font-weight:500;background-position:right 0 center;width:100%;max-width:none;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fg .f-sel.on{background-color:transparent;color:var(--brand-2)}
/* The cell says a filter is in force, so the value does not need a chip's
   fill as well — it would double the signal inside one small control. */
.fg:has(.f-sel.on){background:var(--brand-soft);box-shadow:inset 2px 0 0 var(--brand)}
.fstatus{font-family:var(--mono);font-size:10.8px;color:var(--text-3);white-space:nowrap}
.fstatus.on{color:var(--brand-2)}
#fReset{flex:none}

/* Nothing in the header may wrap onto a second line. */
.btn,.sess{white-space:nowrap}
.top-r .sess{flex:none}

@media(max-width:760px){
  .fgroup{flex-wrap:wrap}
  .fg{border-right:none;border-bottom:1px solid var(--line);flex:1 1 45%;width:auto}
}

/* The scope chip is a reminder, not a control: it yields first when the
   toolbar runs out of room. */
@media(max-width:1560px){.fwrap .rls{display:none}}

/* ---- phone: the filter group wraps into a readable two-column block ------ */
@media(max-width:760px){
  .fgroup{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .fg{border-right:1px solid var(--line);border-bottom:1px solid var(--line);
    min-width:0;width:auto}
  .fg:nth-child(2n){border-right:none}
  .fg .f-sel{max-width:100%;width:100%}
  .fbar{flex-wrap:wrap;gap:8px}
  .fstatus{order:3}
}

/* ---- phone: sticky action bar ------------------------------------------- */
.mbar{display:none}
@media(max-width:760px){
  .mbar{position:fixed;left:0;right:0;bottom:0;z-index:65;display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;background:var(--line);
    border-top:1px solid var(--line-2)}
  .mbar button{display:flex;flex-direction:column;align-items:center;gap:3px;padding:9px 4px 10px;
    border:none;background:var(--surface);font:inherit;font-size:10.6px;font-weight:500;
    color:var(--text-2);cursor:pointer}
  .mbar button:active{background:var(--brand-soft);color:var(--brand-2)}
  .mbar button svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;
    stroke-linecap:round;stroke-linejoin:round}
  .scroll{padding-bottom:64px}
  .lineage{display:none}
}

.empty [data-retry]{margin-top:10px}

/* ── Report studio ──────────────────────────────────────────────────────
   A field list beside the report it builds. The list is the catalogue the
   server will accept; everything else on the page is drawn from what the
   server sent back. */
.rb{display:grid;grid-template-columns:238px 1fr;gap:14px;align-items:start}
.rb-fields{background:var(--surface);border:1px solid var(--line);border-radius:var(--r);
  overflow:hidden;position:sticky;top:0}
.rb-fh{display:flex;justify-content:space-between;align-items:baseline;gap:8px;
  padding:10px 12px;border-bottom:1px solid var(--line);font-weight:600;font-size:12.6px}
.rb-fh span{font-family:var(--mono);font-size:10.5px;color:var(--text-3)}
.rb-fl{max-height:620px;overflow:auto;padding-bottom:6px}
.rb-g{padding:9px 12px 4px;font-family:var(--mono);font-size:9.8px;letter-spacing:.1em;
  text-transform:uppercase;color:var(--text-3)}
.rb-f{display:flex;align-items:center;gap:8px;width:100%;padding:5px 12px;border:none;
  background:none;font:inherit;font-size:12.3px;color:inherit;text-align:left;cursor:pointer}
.rb-f:hover{background:var(--surface-2)}
.rb-f:focus-visible{outline:2px solid var(--brand);outline-offset:-2px}
.rb-f i{display:grid;place-items:center;width:16px;height:16px;flex:none;border-radius:4px;
  font-style:normal;font-family:var(--mono);font-size:9px;font-weight:600}
.rb-f i.d{background:var(--brand-soft);color:var(--brand-2)}
.rb-f i.m{background:var(--surface-2);color:var(--text-2);border:1px solid var(--line)}

.rb-bar{display:flex;flex-wrap:wrap;align-items:flex-end;gap:10px;margin-bottom:12px}
.rb-bar .fg{min-width:150px}
.rb-viz{display:flex;gap:2px;padding:2px;border:1px solid var(--line);border-radius:var(--r-sm);
  background:var(--surface)}
.rb-v{display:grid;place-items:center;width:30px;height:28px;border:none;border-radius:4px;
  background:none;color:var(--text-3);cursor:pointer}
.rb-v svg{width:15px;height:15px;fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round}
.rb-v:hover{color:var(--text)}
.rb-v.on{background:var(--brand-soft);color:var(--brand-2)}
.rb-v:focus-visible{outline:2px solid var(--brand);outline-offset:1px}

.rb-meas{display:flex;flex-wrap:wrap;align-items:center;gap:7px;margin-bottom:12px}
.rb-meas>div{display:flex;flex-wrap:wrap;gap:6px}
.rb-ml{font-family:var(--mono);font-size:10px;letter-spacing:.09em;text-transform:uppercase;
  color:var(--text-3)}
.rb-chip{padding:4px 10px;border:1px solid var(--line);border-radius:20px;background:var(--surface);
  font:inherit;font-size:11.8px;color:var(--text-2);cursor:pointer;transition:.13s}
.rb-chip:hover{border-color:var(--brand);color:var(--brand-2)}
.rb-chip.on{background:var(--brand);border-color:var(--brand);color:#fff}
/* Selected, but a split means only the first one is drawn. */
.rb-chip.on.muted{opacity:.45}
.rb-chip:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
.rb-note{font-size:11.2px;color:var(--text-3)}

@media (max-width:980px){
  .rb{grid-template-columns:1fr}
  .rb-fields{position:static}
  .rb-fl{max-height:230px}
}

/* ── Sign in ────────────────────────────────────────────────────────────
   The one page served before anyone is known, so it shares the dashboard's
   tokens and nothing else. */
body.signin{display:grid;place-items:center;min-height:100vh;padding:24px;
  background:var(--canvas);color:var(--text)}
.signin-c{width:100%;max-width:372px}
.signin-brand{display:flex;align-items:center;gap:11px;margin-bottom:18px}
.signin-brand b{display:block;font-family:var(--disp);font-size:17px;letter-spacing:-.01em}
.signin-brand span{display:block;font-family:var(--mono);font-size:10.5px;
  letter-spacing:.08em;text-transform:uppercase;color:var(--text-3)}
.signin-card{padding:24px;background:var(--surface);border:1px solid var(--line);
  border-radius:var(--r)}
.signin-card h1{font-family:var(--disp);font-size:20px;margin:0 0 6px}
.signin-sub{margin:0 0 18px;font-size:12.6px;line-height:1.5;color:var(--text-2)}
.signin-f{display:block;margin-bottom:13px}
.signin-f span{display:block;margin-bottom:5px;font-family:var(--mono);font-size:10px;
  letter-spacing:.09em;text-transform:uppercase;color:var(--text-3)}
.signin-f input{width:100%;padding:9px 11px;border:1px solid var(--line-2);
  border-radius:var(--r-sm);background:var(--canvas);font:inherit;font-size:13.4px;color:var(--text)}
.signin-f input:focus{outline:none;border-color:var(--brand);
  box-shadow:0 0 0 3px var(--brand-soft)}
.signin-err{margin-bottom:14px;padding:9px 11px;border-radius:var(--r-sm);
  background:var(--coral-soft);color:var(--coral);font-size:12.4px;line-height:1.45}
.signin-note{margin-bottom:14px;padding:9px 11px;border-radius:var(--r-sm);
  background:var(--brand-soft);color:var(--brand-2);font-size:12.4px}
.signin-go{width:100%;justify-content:center;margin-top:5px;padding:10px}
.signin-foot{margin:14px 2px 0;font-size:11.6px;line-height:1.5;color:var(--text-3)}

/* The sidebar row naming who is signed in, under the company row. */
.side-me{display:flex;align-items:center;gap:8px;padding:8px 14px 12px;
  border-top:1px solid var(--line)}
.side-me>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-family:var(--mono);font-size:10.5px;letter-spacing:.06em;color:var(--text-3)}
.side-me form{margin:0 0 0 auto}
#app.nav-collapsed .side-me>span{display:none}
#app.nav-collapsed .side-me{justify-content:center;padding:8px 0 12px}
.signout{display:grid;place-items:center;width:26px;height:26px;flex:none;margin-left:auto;
  border:1px solid var(--line);border-radius:var(--r-sm);background:var(--surface);
  color:var(--text-3);cursor:pointer;transition:.13s}
.signout svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;
  stroke-linecap:round;stroke-linejoin:round}
.signout:hover{border-color:var(--coral);color:var(--coral)}
.signout:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
