/* ==========================================================================
   Onyx Next design system, as used by the public sample workspace (/sample/*).
   Direction: dark-first "onyx" surfaces, one accent (Pulse Blue, taken from the
   Onyx Insights logo), Geist + Geist Mono, hairline depth instead of shadows.
   Structural reference: Linear (awesome-design-md). Borrowed ideas: the surface
   ladder, hairlines, product-first framing, 8/12/16 radii. Not borrowed: Linear's
   accent, type, or any asset. This is an approximation, not an official system.

   Radius rule (single scale): controls 8, panels 12, frames 16, status pills full.
   Status never relies on colour alone: every status carries an icon and a word.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/geist/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/geist/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- Tokens: dark (default) ---------- */
:root, [data-theme="dark"] {
  color-scheme: dark;

  /* surface ladder */
  --canvas: #080a0f;
  --s1: #0d1118;
  --s2: #131822;
  --s3: #1a202c;
  --s4: #212837;
  --hairline: #1d2431;
  --hairline-strong: #2b3547;
  --hairline-hi: #3a4660;
  --edge-hi: rgba(255, 255, 255, 0.05); /* faint top-edge light on lifted panels */

  /* ink */
  --ink: #eef1f6;
  --ink-2: #b9c2d2;
  --ink-3: #8c97ab;
  --ink-4: #5d697e; /* disabled and decorative only */

  /* the one accent: Pulse Blue (from the logo) */
  --accent: #3d9bff;
  --accent-hover: #67b1ff;
  --accent-press: #2b86ea;
  --accent-ink: #04101f; /* text on accent: 7:1 */
  --accent-soft: rgba(61, 155, 255, 0.14);
  --accent-line: rgba(61, 155, 255, 0.42);
  --focus: #7cc0ff;

  /* status (always paired with icon + word) */
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.13);
  --warn: #f5b53d;
  --warn-soft: rgba(245, 181, 61, 0.14);
  --crit: #ff6b78;
  --crit-soft: rgba(255, 107, 120, 0.14);
  --low: #8c97ab; /* "not enough traffic": neutral, dashed, never green */
  --low-soft: rgba(140, 151, 171, 0.12);

  /* chart ramp: accent first, then neutrals, so charts stay calm */
  --c1: #3d9bff;
  --c2: #8fd0ff;
  --c3: #b9c2d2;
  --c4: #6f7c93;
  --grid: rgba(185, 194, 210, 0.09);

  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
  --scrim: rgba(3, 5, 9, 0.66);

  /* type */
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* radius scale */
  --r-ctl: 8px;
  --r-panel: 12px;
  --r-frame: 16px;

  /* spacing (4px base) */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 72px;

  --sidebar-w: 248px;
  --topbar-h: 56px;

  /* z-index scale (systemic layers only) */
  --z-sticky: 20;
  --z-drawer: 40;
  --z-modal: 60;
  --z-toast: 80;
}

/* ---------- Tokens: light ---------- */
[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f6f9;
  --s1: #ffffff;
  --s2: #f0f2f6;
  --s3: #e7eaf0;
  --s4: #dde1e9;
  --hairline: #e2e6ed;
  --hairline-strong: #cdd3de;
  --hairline-hi: #b4bccb;
  --edge-hi: rgba(255, 255, 255, 0);

  --ink: #0b0f17;
  --ink-2: #3a4456;
  --ink-3: #596477; /* 5.9:1 on white */
  --ink-4: #8b95a6;

  --accent: #1766d4;
  --accent-hover: #145fc8;
  --accent-press: #104fa6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(23, 102, 212, 0.1);
  --accent-line: rgba(23, 102, 212, 0.4);
  --focus: #1766d4;

  --ok: #0b7a4a;
  --ok-soft: rgba(11, 122, 74, 0.1);
  --warn: #945a06;
  --warn-soft: rgba(148, 90, 6, 0.1);
  --crit: #c8283a;
  --crit-soft: rgba(200, 40, 58, 0.09);
  --low: #596477;
  --low-soft: rgba(89, 100, 119, 0.1);

  --c1: #1766d4;
  --c2: #5aa6ff;
  --c3: #6c7a91;
  --c4: #a3adbf;
  --grid: rgba(11, 15, 23, 0.08);

  --shadow-pop: 0 18px 44px rgba(20, 32, 60, 0.18);
  --scrim: rgba(12, 18, 32, 0.38);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
.num, .mono, code, kbd, pre { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.muted { color: var(--ink-3); }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--sp-3); top: -64px; z-index: var(--z-toast);
  background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: var(--r-ctl);
}
.skip-link:focus { top: var(--sp-3); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.ph, .ph-fill { font-size: 1.15em; vertical-align: -0.18em; flex: none; }

/* ---------- Type scale ---------- */
.t-h1 { font-size: 28px; line-height: 1.15; letter-spacing: -0.03em; font-weight: 600; }
.t-h2 { font-size: 20px; line-height: 1.25; letter-spacing: -0.02em; font-weight: 600; }
.t-h3 { font-size: 15px; line-height: 1.35; letter-spacing: -0.01em; font-weight: 600; }
.t-lead { font-size: 17px; line-height: 1.5; color: var(--ink-2); }
.t-small { font-size: 12.5px; line-height: 1.45; }
.t-label { font-size: 12px; line-height: 1.3; color: var(--ink-3); font-weight: 500; }
.eyebrow { font-size: 12px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Layout: app shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  background: var(--s1); border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; padding: var(--sp-3) var(--sp-3) var(--sp-4);
  gap: var(--sp-4);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px; min-height: 40px; }
/* Emblem crop of the existing logo (/assets/logo-onyx-insights.jpg, 1448x1086).
   PROPOSAL ONLY: the logo is a poster image, so this crop stands in until design supplies a vector mark. */
.brand-mark {
  width: 28px; height: 28px; border-radius: var(--r-ctl); flex: none;
  background: #05070b url("/assets/logo-onyx-insights.jpg") no-repeat;
  background-size: 101px auto; background-position: -37px -13px;
  border: 1px solid var(--hairline-strong);
}
.brand-name { font-weight: 600; letter-spacing: -0.02em; font-size: 15px; }
.brand-name small { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-3); letter-spacing: 0; margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: var(--sp-4); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-title { padding: 6px 10px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); letter-spacing: 0.02em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; min-height: 34px;
  border-radius: var(--r-ctl); color: var(--ink-2); font-weight: 450; position: relative;
  transition: background .12s, color .12s;
}
.nav-item .ph { font-size: 17px; color: var(--ink-3); }
.nav-item:hover { background: var(--s2); color: var(--ink); }
.nav-item.is-active { background: var(--s3); color: var(--ink); }
.nav-item.is-active .ph { color: var(--accent); }
.nav-item.is-active::before {
  content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-item .count { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: var(--z-sticky); height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5);
  background: color-mix(in srgb, var(--canvas) 86%, transparent);
  backdrop-filter: blur(10px) saturate(1.2); -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid var(--hairline);
}
.topbar .spacer { flex: 1; }
.search-btn { flex: 0 1 300px; min-width: 0; justify-content: space-between; }
.btn.menu-btn { display: none; }
.page { padding: var(--sp-5); max-width: 1480px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.page-head p { color: var(--ink-3); margin-top: 4px; max-width: 62ch; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }

.grid { display: grid; gap: var(--sp-4); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1fr) 340px; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.row { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { margin-left: auto; }

/* ---------- Panels (depth by ladder + hairline, no shadow) ---------- */
.panel {
  background: var(--s1); border: 1px solid var(--hairline); border-radius: var(--r-panel);
  box-shadow: inset 0 1px 0 var(--edge-hi); min-width: 0;
}
.panel-head { display: flex; align-items: center; gap: var(--sp-3); padding: 14px var(--sp-4) 12px; border-bottom: 1px solid var(--hairline); flex-wrap: wrap; }
.panel-head .t-h3 { margin-right: auto; }
.panel-body { padding: var(--sp-4); }
.panel--flush .panel-body { padding: 0; }
.panel--lift { background: var(--s2); border-color: var(--hairline-strong); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-ctl); border: 1px solid transparent;
  font-weight: 500; font-size: 13.5px; line-height: 1; white-space: nowrap; cursor: pointer;
  background: transparent; color: var(--ink); transition: background .12s, border-color .12s, transform .08s;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--primary:active { background: var(--accent-press); }
.btn--secondary { background: var(--s2); border-color: var(--hairline-strong); }
.btn--secondary:hover { background: var(--s3); border-color: var(--hairline-hi); }
.btn--ghost:hover { background: var(--s2); }
.btn--sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn--icon { width: 36px; padding: 0; flex: none; }
.btn--icon.btn--sm { width: 30px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: 12px; color: var(--ink-3); }
.field .error { font-size: 12px; color: var(--crit); display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 7px 12px; background: var(--s1); color: var(--ink);
  border: 1px solid var(--hairline-strong); border-radius: var(--r-ctl);
}
.input::placeholder { color: var(--ink-3); }
.input:hover, .select:hover { border-color: var(--hairline-hi); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input-wrap { position: relative; }
.input-wrap > .ph { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.input-wrap > .input { padding-left: 34px; }
.select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.check { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; padding: 2px 4px; border-radius: var(--r-ctl); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
kbd {
  display: inline-block; min-width: 20px; padding: 1px 6px; text-align: center; font-size: 11px;
  background: var(--s2); border: 1px solid var(--hairline-strong); border-bottom-width: 2px; border-radius: 6px; color: var(--ink-2);
}

/* segmented control + tabs */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--s2); border: 1px solid var(--hairline); border-radius: 10px; }
.seg button { min-height: 28px; padding: 0 12px; border: 0; background: transparent; color: var(--ink-3); border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 13px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--s4); color: var(--ink); box-shadow: inset 0 0 0 1px var(--hairline-strong); }
.tabs { display: flex; gap: var(--sp-4); border-bottom: 1px solid var(--hairline); overflow-x: auto; scrollbar-width: none; }
.tabs button { position: relative; padding: 10px 2px 11px; border: 0; background: none; color: var(--ink-3); cursor: pointer; font-weight: 500; font-size: 13.5px; white-space: nowrap; display: inline-flex; gap: 8px; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); }
.tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); border-radius: 2px; }
.tabs .badge { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 99px; background: var(--s3); color: var(--ink-2); }

/* ---------- Status model ---------- */
.status {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px 2px 7px; border-radius: 99px;
  font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap; border: 1px solid transparent;
}
.status .ph, .status .ph-fill { font-size: 14px; vertical-align: 0; }
.status.is-ok { color: var(--ok); background: var(--ok-soft); }
.status.is-warn { color: var(--warn); background: var(--warn-soft); }
.status.is-crit { color: var(--crit); background: var(--crit-soft); }
.status.is-low { color: var(--ink-2); background: var(--low-soft); border: 1px dashed var(--hairline-hi); } /* dashed: unknown, not healthy */
.status.is-none { color: var(--ink-3); background: transparent; border: 1px dashed var(--hairline-strong); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px;
  background: var(--s2); border: 1px solid var(--hairline); color: var(--ink-2); font-size: 12px; line-height: 1.5;
}
.chip.mono, .chip .mono { font-size: 11.5px; }
.chip--accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

/* provenance chip: states how a number was counted (OI-19: one counting rule) */
.prov {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px; border-radius: 6px;
  border: 1px dashed var(--hairline-hi); color: var(--ink-3); font-size: 11.5px; cursor: help; background: transparent;
}
.prov .ph { font-size: 13px; }
.prov:hover { color: var(--ink); border-color: var(--accent-line); }

/* ---------- Data display ---------- */
.kpi { display: flex; flex-direction: column; gap: 6px; padding: var(--sp-4); min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; font-weight: 500; }
/* Big figures use Geist's own tabular numerals; Geist Mono's wide commas look loose at this size. Mono stays for tables, IDs, queries. */
.kpi-value { font-family: var(--font); font-size: 32px; line-height: 1.1; letter-spacing: -0.035em; font-weight: 550; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.kpi-value small { font-size: 14px; color: var(--ink-3); letter-spacing: 0; margin-left: 2px; }
.kpi-sub { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.delta { font-family: var(--mono); font-size: 12px; display: inline-flex; align-items: center; gap: 3px; }
.delta.up-bad, .delta.down-bad { color: var(--crit); }
.delta.up-good, .delta.down-good { color: var(--ok); }
.delta.flat { color: var(--ink-3); }
.spark { width: 100%; height: 30px; overflow: visible; }
.spark polyline { fill: none; stroke: var(--c1); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark .area { fill: var(--accent-soft); stroke: none; }
.spark.is-crit polyline { stroke: var(--crit); } .spark.is-crit .area { fill: var(--crit-soft); }
.spark.is-warn polyline { stroke: var(--warn); } .spark.is-warn .area { fill: var(--warn-soft); }
.spark.is-low polyline { stroke: var(--low); stroke-dasharray: 3 3; } .spark.is-low .area { fill: transparent; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); padding: 9px var(--sp-4);
  border-bottom: 1px solid var(--hairline); white-space: nowrap; background: var(--s1); position: sticky; top: 0;
}
.table td { padding: 10px var(--sp-4); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--s2); }
.table tbody tr.is-selected { background: var(--accent-soft); }
.table .num, .table .cell-num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.cell-num { text-align: right; }
.cell-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; }
.cell-name .sub { font-weight: 400; color: var(--ink-3); font-size: 12px; font-family: var(--mono); }
.row-link { cursor: pointer; }

.list { display: flex; flex-direction: column; }
.list > * { padding: 12px var(--sp-4); border-bottom: 1px solid var(--hairline); }
.list > *:last-child { border-bottom: 0; }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-panel); border: 1px solid var(--hairline-strong); background: var(--s2); align-items: flex-start; }
.callout .ph, .callout .ph-fill { font-size: 18px; margin-top: 1px; }
.callout.is-info { border-color: var(--accent-line); background: var(--accent-soft); } .callout.is-info > .ph, .callout.is-info > .ph-fill { color: var(--accent); }
.callout.is-warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); } .callout.is-warn > .ph, .callout.is-warn > .ph-fill { color: var(--warn); }
.callout.is-crit { border-color: color-mix(in srgb, var(--crit) 40%, transparent); background: var(--crit-soft); } .callout.is-crit > .ph, .callout.is-crit > .ph-fill { color: var(--crit); }
.callout.is-low { border-style: dashed; border-color: var(--hairline-hi); }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: var(--sp-6) var(--sp-5); }
.empty .ph { font-size: 28px; color: var(--ink-3); }
.empty p { color: var(--ink-3); max-width: 52ch; }

.skeleton { background: linear-gradient(90deg, var(--s2) 0%, var(--s3) 50%, var(--s2) 100%); background-size: 200% 100%; border-radius: 6px; animation: shimmer 1.4s linear infinite; min-height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.code { background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--r-panel); font-size: 13px; line-height: 1.7; overflow: auto; }
.code pre { margin: 0; padding: 12px 14px; }
.tok-k { color: var(--accent); } .tok-s { color: var(--ok); } .tok-n { color: var(--warn); } .tok-c { color: var(--ink-3); }

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-family: var(--mono); font-size: 10.5px; }
.chart .line-1 { fill: none; stroke: var(--c1); stroke-width: 1.8; stroke-linejoin: round; }
.chart .line-2 { fill: none; stroke: var(--crit); stroke-width: 1.8; stroke-linejoin: round; }
.chart .area-1 { fill: url(#fill-accent); stroke: none; }
.chart .cursor { stroke: var(--hairline-hi); stroke-dasharray: 3 3; }
.chart-tip { position: absolute; pointer-events: none; transform: translate(-50%, -110%); padding: 8px 10px; border-radius: var(--r-ctl); background: var(--s4); border: 1px solid var(--hairline-hi); font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-pop); opacity: 0; transition: opacity .1s; z-index: 3; }
.chart-tip.is-on { opacity: 1; }
.legend { display: flex; gap: var(--sp-4); font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 2px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--c1); }
.legend i.crit { background: var(--crit); }

/* ---------- Overlays ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: var(--z-drawer); opacity: 0; pointer-events: none; transition: opacity .18s; }
.scrim.is-on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: calc(var(--z-drawer) + 1);
  background: var(--s1); border-left: 1px solid var(--hairline-strong); transform: translateX(104%);
  transition: transform .26s cubic-bezier(.16, 1, .3, 1); display: flex; flex-direction: column; box-shadow: var(--shadow-pop);
}
.drawer.is-on { transform: none; }
.drawer-head { display: flex; align-items: center; gap: var(--sp-3); padding: 14px var(--sp-4); border-bottom: 1px solid var(--hairline); }
.drawer-body { padding: var(--sp-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-4); flex: 1; }

.cmdk { position: fixed; inset: 0; z-index: var(--z-modal); display: none; align-items: flex-start; justify-content: center; padding: 14vh var(--sp-4) 0; background: var(--scrim); }
.cmdk.is-on { display: flex; }
.cmdk-box { width: min(620px, 100%); background: var(--s2); border: 1px solid var(--hairline-hi); border-radius: var(--r-frame); box-shadow: var(--shadow-pop); overflow: hidden; }
.cmdk-box .input { border: 0; border-bottom: 1px solid var(--hairline); border-radius: 0; min-height: 52px; background: transparent; font-size: 15px; }
.cmdk-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-ctl); cursor: pointer; color: var(--ink-2); min-height: 44px; }
.cmdk-item:hover, .cmdk-item[aria-selected="true"] { background: var(--s4); color: var(--ink); }
.cmdk-item .hint { margin-left: auto; color: var(--ink-3); font-size: 12px; }

.pop { position: relative; display: inline-flex; }
.pop-card {
  position: absolute; z-index: 25; top: calc(100% + 8px); left: 0; width: 300px; padding: 12px 14px; font-size: 12.5px; line-height: 1.5;
  background: var(--s4); border: 1px solid var(--hairline-hi); border-radius: var(--r-panel); box-shadow: var(--shadow-pop); color: var(--ink-2);
  opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .12s, transform .12s, visibility .12s;
}
.pop:hover .pop-card, .pop:focus-within .pop-card { opacity: 1; visibility: visible; transform: none; }

.toast { position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: var(--z-toast); padding: 12px 14px; background: var(--s4); border: 1px solid var(--hairline-hi); border-radius: var(--r-panel); box-shadow: var(--shadow-pop); display: none; gap: 10px; align-items: center; }
.toast.is-on { display: flex; }

/* time range picker (OI-19: show when the range is fixed, never look active) */
.range { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 10px 0 12px; border: 1px solid var(--hairline-strong); border-radius: var(--r-ctl); background: var(--s1); color: var(--ink-2); font-size: 13px; cursor: pointer; }
.range:hover { border-color: var(--hairline-hi); color: var(--ink); }
.range.is-fixed { cursor: not-allowed; background: transparent; border-style: dashed; color: var(--ink-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: calc(var(--z-drawer) + 1); left: 0; top: 0; width: min(300px, 86vw);
    transform: translateX(-104%); transition: transform .26s cubic-bezier(.16, 1, .3, 1), box-shadow .26s; box-shadow: none; /* closed: no shadow, or it bleeds in at the left edge */
  }
  .sidebar.is-on { transform: none; box-shadow: var(--shadow-pop); }
  .nav-item.is-active::before { left: -12px; }
  .btn.menu-btn { display: inline-flex; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar { padding: 0 var(--sp-3); gap: 8px; }
  .page { padding: var(--sp-4) var(--sp-3) var(--sp-7); gap: var(--sp-4); }
  .cols-4 { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none !important; }
  /* touch targets: 44px minimum for every control (OI-19 item 22) */
  .btn, .input, .select, .range, .seg button, .check, .nav-item, .cmdk-item, summary, [role="button"], .tabs button { min-height: 44px; }
  .btn--icon, .btn--icon.btn--sm { width: 44px; min-width: 44px; }
  .btn--sm { min-height: 44px; }
  .prov, button.chip, .table a, .cell-name a, .list a { min-height: 44px; }
  .table a, .cell-name a, .list a { display: inline-flex; align-items: center; }
  button.chip { padding: 0 12px; font-size: 13px; }
  .prov { padding-left: 10px; padding-right: 10px; }
  .seg button { padding: 0 14px; }
  .nav-item { padding: 10px 12px; }
  .page-head { align-items: flex-start; }
  .kpi-value { font-size: 26px; }
  /* tables stack into labelled cards on phones */
  .table--stack thead { display: none; }
  .table--stack, .table--stack tbody, .table--stack tr, .table--stack td { display: block; width: 100%; }
  .table--stack tr { padding: 12px var(--sp-4); border-bottom: 1px solid var(--hairline); }
  .table--stack td { padding: 3px 0; border: 0; text-align: left !important; display: flex; justify-content: space-between; gap: 12px; }
  .table--stack td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: 12px; font-family: var(--font); }
  .table--stack td:first-child { display: block; padding-bottom: 6px; }
  .table--stack td:first-child::before { content: none; }
  .drawer { width: 100vw; }
  .search-btn { flex: 1 1 auto; }
  /* explanatory popovers open inline on phones so they can never overflow the viewport */
  .pop { display: block; }
  .pop-card { position: static; width: auto; margin-top: 8px; display: none; opacity: 1; visibility: visible; transform: none; }
  .pop:focus-within .pop-card { display: block; }
}

/* ---------- Motion safety ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- Sample workspace ---------- */
.sample-banner {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 16px; min-height: 40px; padding: 8px var(--sp-4);
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-line); color: var(--ink); font-size: 13px; line-height: 1.45; text-align: center;
}
.sample-banner .ph { color: var(--accent); font-size: 16px; }
.sample-banner a { color: var(--accent); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; display: inline-flex; align-items: center; min-height: 24px; }
.sample-banner a:hover { color: var(--accent-hover); }
.sample-banner-signin { color: var(--ink-2); }
/* the way back to the public site: first in the banner, kept to the left on wide screens, an arrow and the words, no underline.
   Qualified with .sample-banner: `.sample-banner a` above is more specific than the bare class and would keep the underline,
   the lighter weight and the shorter tap target. */
.sample-banner .sample-banner-back { margin-right: auto; gap: 6px; text-decoration: none; font-weight: 600; }
.sample-banner .sample-banner-back:hover { text-decoration: underline; }
.sample-banner-back .ph { font-size: 15px; }
/* sidebar rows for screens that are not part of the sample */
.nav-item.is-off { color: var(--ink-4); cursor: default; }
.nav-item.is-off .ph { color: var(--ink-4); }
.nav-item.is-off:hover { background: transparent; color: var(--ink-4); }
@media (max-width: 640px) { .sample-banner { font-size: 12.5px; padding: 8px var(--sp-3); } .sample-banner .sample-banner-back { margin-right: 0; flex-basis: 100%; justify-content: center; min-height: 32px; } }

/* ---------- Clickable sample workspace extensions ---------- */
.payment-journey { display:flex; align-items:stretch; gap:10px; }
.payment-step { flex:1; min-width:0; display:flex; flex-direction:column; gap:6px; padding:14px; border:1px solid var(--hairline); border-radius:var(--r-panel); background:var(--s1); color:var(--ink); transition:border-color .15s,background .15s; }
.payment-step:hover,.payment-step:focus-visible { border-color:var(--accent-line); background:var(--s2); }
.payment-step > .ph { color:var(--accent); font-size:20px; }
.payment-step b { font-size:13px; font-weight:600; }
.payment-step span { color:var(--ink-3); font-size:12px; }
.journey-arrow { align-self:center; color:var(--ink-4); }
.payment-offers { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.payment-offers a { position:relative; min-height:108px; display:flex; flex-direction:column; gap:8px; padding:14px; border:1px solid var(--hairline); border-radius:var(--r-panel); color:var(--ink); background:var(--s1); }
.payment-offers a:hover,.payment-offers a:focus-visible { border-color:var(--accent-line); background:var(--s2); }
.payment-offers a b { display:flex; align-items:center; gap:6px; font-size:13px; font-weight:600; }
.payment-offers a b .ph { color:var(--accent); }
.payment-offers a span { color:var(--ink-3); font-size:12px; line-height:1.45; padding-right:10px; }
.payment-offers a > .ph:last-child { position:absolute; right:12px; top:12px; color:var(--ink-4); }
.workspace-links { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.workspace-link { min-height:42px; display:flex; align-items:center; gap:9px; padding:8px 10px; border:1px solid var(--hairline); border-radius:var(--r-ctl); color:var(--ink-2); font-size:13px; }
.workspace-link > .ph:first-child { color:var(--accent); }
.workspace-link > .ph:last-child { margin-left:auto; color:var(--ink-4); }
.workspace-link:hover,.workspace-link:focus-visible,.workspace-link.is-current { color:var(--ink); border-color:var(--accent-line); background:var(--accent-soft); }
.eyebrow { display:flex; align-items:center; gap:7px; color:var(--accent); font-size:12px; font-weight:600; letter-spacing:.04em; text-transform:uppercase; margin-bottom:7px; }
.sample-disclaimer { display:flex; align-items:center; gap:8px; padding:10px 12px; border:1px solid var(--accent-line); border-radius:var(--r-ctl); background:var(--accent-soft); color:var(--ink-2); font-size:12.5px; }
.sample-disclaimer .ph { color:var(--accent); }
.workspace-filter { display:flex; align-items:center; gap:7px; margin-left:auto; color:var(--ink-3); }
.workspace-filter input { width:min(220px,36vw); min-height:34px; border:1px solid var(--hairline-strong); border-radius:var(--r-ctl); background:var(--s1); color:var(--ink); padding:0 9px; font:inherit; font-size:12px; }
@media(max-width:900px) { .payment-offers,.workspace-links { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:640px) { .payment-journey { display:grid; grid-template-columns:1fr 1fr; } .journey-arrow { display:none; } .payment-offers,.workspace-links { grid-template-columns:1fr; } .workspace-filter { width:100%; margin-left:0; } .workspace-filter input { flex:1; width:auto; } }
