/* ============================================================================
   DESC Certify — design system
   ----------------------------------------------------------------------------
   One stylesheet drives ~30 pages. The tokens on :root are the single source of
   truth for colour, spacing and type — nothing downstream should hard-code a hex.
   Aesthetic: a serious government security agency at night. Deep navy, elevated
   panels, a confident cyan, restrained amber/red for warnings and breaches.
   ========================================================================== */

/* IBM Plex Sans, self-hosted (latin subset) so the demo stays offline. Three
   weights cover everything: body 400, UI emphasis 500, headings/brand 600. */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
/* IBM Plex Sans Arabic for the Arabic preview (M9). The unicode-range means a
   page only downloads it when Arabic glyphs actually appear. */
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal; font-weight: 500; font-display: swap;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
  /* ==========================================================================
     THEME TOKENS — light is the default palette; the dark "cyber" theme lives
     in :root[data-theme="dark"] below. A tiny inline script in each page's
     <head> sets data-theme before first paint (see components.js for the
     toggle). Only these colour tokens flip; type/space/shape are shared.
     ======================================================================== */

  /* ---- Surfaces (light) ------------------------------------------------- */
  --bg:            #eef2f8;   /* cool off-white — the room the demo lives in  */
  --bg-2:          #f6f8fc;   /* lighter partner for insets / inputs          */
  --panel:         #ffffff;   /* default card / panel                         */
  --panel-2:       #f2f6fb;   /* elevated: thead, hovered rows, modals        */
  --panel-3:       #e4ecf5;   /* highest elevation, active chips              */

  /* ---- Brand primary (teal) — darkened for AA contrast on white --------- */
  --primary:       #0e7490;   /* DESC teal — confident accent, reads on white */
  --primary-dim:   #155e75;   /* pressed / secondary use of primary           */
  --primary-ink:   #ffffff;   /* text that sits ON a primary fill             */
  --primary-glow:  rgba(14, 116, 144, 0.22);

  /* ---- Text ------------------------------------------------------------- */
  --text:          #0f1c2e;   /* primary copy — near-black navy               */
  --text-dim:      #4b5c74;   /* secondary / captions                         */
  --text-faint:    #8291a6;   /* hints, disabled                             */

  /* ---- Lines ------------------------------------------------------------ */
  --border:        #dbe3ee;   /* default hairline                            */
  --border-strong: #c3cfde;   /* emphasised divider / focus ring base        */

  /* ---- Status (darkened so they pass on light surfaces) ----------------- */
  --ok:            #0f9d6b;   /* green  — passed / certified / on-track      */
  --ok-dim:        #dff5ec;
  --warn:          #b45309;   /* amber  — attention / due-soon               */
  --warn-dim:      #fbeeda;
  --danger:        #dc2626;   /* red    — breach / overdue / at-risk         */
  --danger-dim:    #fdeaea;
  --info:          #2563eb;   /* blue   — informational                      */
  --info-dim:      #e6effb;

  /* ---- Composite surfaces (tokenised so both themes flip cleanly) ------- */
  /* Sized in px, not %, so the glow sits at the top of a long page instead of
     stretching with it; past 420px the page is plain --bg all the way down. */
  --body-bg:
    radial-gradient(1100px 600px at 82% -48px, rgba(14,116,144,0.06), transparent 60%),
    radial-gradient(900px 520px at 8% 0, rgba(37,99,235,0.05), transparent 55%),
    linear-gradient(180deg, #ffffff 0, var(--bg) 420px);
  --surface-grad: linear-gradient(180deg, #ffffff, #fafcfe);
  --header-bg: rgba(255, 255, 255, 0.85);
  --nav-bg:    rgba(247, 250, 253, 0.9);
  --scrim:     rgba(15, 23, 42, 0.42);   /* modal backdrop                    */
  --proto-bg:  rgba(255, 248, 235, 0.9); /* "prototype" badge background      */

  /* ---- Ink bands (M9) — the dark navy kept for a few emphasis bands per
     page (story hero, licence card, "between audits" tile). Not for whole pages. */
  --ink:        #0b1a2e;
  --ink-2:      #13263f;
  --ink-text:   #eef3fa;
  --ink-dim:    #a9b8cd;
  --ink-line:   rgba(255, 255, 255, 0.14);
  --ink-accent: #5fd4ec;

  /* ---- Chart series (validated with the dataviz checks, light surface) -- */
  --series-1:   #0a86b0;   /* teal   — RedHorizon in the compare chart       */
  --series-2:   #4a3aa7;   /* violet — Kestrel; amber stays reserved for status */
  --chart-grid: #e6ecf3;

  color-scheme: light;

  /* ---- Type ------------------------------------------------------------- */
  --font-sans: "IBM Plex Sans", "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "SF Mono", "Consolas", "Roboto Mono", ui-monospace, monospace;

  --step--1: 0.82rem;
  --step-0:  0.94rem;   /* body */
  --step-1:  1.12rem;
  --step-2:  1.4rem;
  --step-3:  1.85rem;
  --step-4:  2.4rem;
  --step-5:  3.1rem;

  /* ---- Space & shape ---------------------------------------------------- */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.5rem;
  --sp-6: 2rem;
  --sp-7: 3rem;
  --sp-8: 4.5rem;

  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  --shadow-1: 0 1px 2px rgba(16,32,64,0.06);
  --shadow-2: 0 10px 26px rgba(16,32,64,0.10);
  --shadow-pop: 0 18px 50px rgba(16,32,64,0.16);

  --ring: 0 0 0 3px var(--primary-glow);

  --header-h: 62px;
  --maxw: 1180px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ============================================================================
   Dark theme — the original "serious agency at night" palette. Only the colour
   tokens change; every component reads them, so nothing below needs to know
   which theme is active.
   ========================================================================== */
:root[data-theme="dark"] {
  --bg:            #070b14;
  --bg-2:          #0a1120;
  --panel:         #0f1826;
  --panel-2:       #16233a;
  --panel-3:       #1d2f4d;

  --primary:       #22d3ee;
  --primary-dim:   #0e7490;
  --primary-ink:   #04242c;
  --primary-glow:  rgba(34, 211, 238, 0.28);

  --text:          #e8eef7;
  --text-dim:      #94a6c0;
  --text-faint:    #61748f;

  --border:        #1e2c44;
  --border-strong: #2c3f61;

  --ok:            #34d399;  --ok-dim:     #10362b;
  --warn:          #fbbf24;  --warn-dim:   #3a2e08;
  --danger:        #f87171;  --danger-dim: #3a1414;
  --info:          #60a5fa;  --info-dim:   #10233f;

  --body-bg:
    radial-gradient(1100px 600px at 82% -48px, rgba(34,211,238,0.08), transparent 60%),
    radial-gradient(900px 520px at 8% 0, rgba(96,165,250,0.06), transparent 55%),
    linear-gradient(180deg, var(--bg-2) 0, var(--bg) 380px);
  --surface-grad: linear-gradient(180deg, var(--panel), rgba(15,24,38,0.6));
  --header-bg: rgba(9, 14, 24, 0.82);
  --nav-bg:    rgba(10, 16, 28, 0.9);
  --scrim:     rgba(4, 8, 16, 0.66);
  --proto-bg:  rgba(20, 16, 4, 0.85);

  /* ink bands sit a step above the page in dark mode so they still read as emphasis */
  --ink:        #0d2140;
  --ink-2:      #142c50;
  --ink-text:   #eef3fa;
  --ink-dim:    #a9b8cd;
  --ink-line:   rgba(255, 255, 255, 0.16);
  --ink-accent: #5fd4ec;

  --series-1:   #0b93b3;
  --series-2:   #9085e9;
  --chart-grid: #1c2a42;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-pop: 0 18px 50px rgba(0,0,0,0.55);

  color-scheme: dark;
}

/* A brief cross-fade only while the user actively toggles — added/removed by
   components.js so the initial (pre-paint) theme never animates. */
html.theming, html.theming *, html.theming *::before, html.theming *::after {
  transition: background-color 0.3s var(--ease), color 0.25s var(--ease),
              border-color 0.3s var(--ease) !important;
}

/* ============================================================================
   Reset / base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* html paints the page colour too, so nothing below the first screen (or past an
   overscroll) is ever bare white. No fixed attachment: it only paints the viewport. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.55;
  color: var(--text);
  background: var(--body-bg);
  background-color: var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* leave room for the injected fixed header */
body[data-face] { padding-top: var(--header-h); }

h1, h2, h3, h4 { margin: 0 0 var(--sp-3); line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p  { margin: 0 0 var(--sp-4); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

small { font-size: var(--step--1); color: var(--text-dim); }
code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }

hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

::selection { background: var(--primary-glow); color: var(--text); }

/* Slim custom scrollbars keep the dark theme cohesive */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }

/* ============================================================================
   Layout helpers
   ========================================================================== */

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-5); }
.section   { padding-block: var(--sp-7); }

.stack   > * + * { margin-top: var(--sp-4); }
.stack-sm > * + * { margin-top: var(--sp-2); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.row { display: flex; gap: var(--sp-4); align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1 1 auto; }

.grid { display: grid; gap: var(--sp-5); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 860px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .row.stack-on-mobile { flex-direction: column; align-items: stretch; }
}

.text-dim   { color: var(--text-dim); }
.text-faint { color: var(--text-faint); }
.text-center { text-align: center; }
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: var(--step--1); font-weight: 600; color: var(--primary);
}

/* ============================================================================
   Panels & cards
   ========================================================================== */

.panel {
  background: var(--surface-grad);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}
.panel.elevated { background: var(--panel-2); box-shadow: var(--shadow-2); }
.panel.flush { padding: 0; overflow: hidden; }

.card {
  background: var(--surface-grad);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.card.interactive { cursor: pointer; }
.card.interactive:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.card.accent { border-top: 2px solid var(--primary); }

.card-title { font-size: var(--step-1); font-weight: 600; margin: 0 0 var(--sp-2); }

/* A metric / KPI tile */
.stat { display: flex; flex-direction: column; gap: var(--sp-1); }
.stat .stat-value { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat .stat-label { font-size: var(--step--1); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.stat.ok     .stat-value { color: var(--ok); }
.stat.warn   .stat-value { color: var(--warn); }
.stat.danger .stat-value { color: var(--danger); }
.stat.primary .stat-value { color: var(--primary); }

/* ============================================================================
   Buttons
   ========================================================================== */

.btn {
  --_bg: var(--panel-2);
  --_fg: var(--text);
  --_bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 0.55rem 1.05rem;
  font: inherit; font-weight: 600; font-size: var(--step-0);
  color: var(--_fg);
  background: var(--_bg);
  border: 1px solid var(--_bd);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s var(--ease), transform 0.05s var(--ease), box-shadow 0.15s var(--ease), background 0.15s;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
.btn .icon { font-size: 1.05em; line-height: 0; }

.btn-primary {
  --_bg: linear-gradient(180deg, var(--primary), var(--primary-dim));
  --_fg: var(--primary-ink);
  --_bd: transparent;
  box-shadow: 0 6px 18px -6px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 8px 22px -4px var(--primary-glow); }

.btn-ghost { --_bg: transparent; --_bd: var(--border-strong); }
.btn-ghost:hover { --_bg: var(--panel-2); }

.btn-danger {
  --_bg: transparent; --_fg: var(--danger); --_bd: color-mix(in srgb, var(--danger) 45%, transparent);
}
.btn-danger:hover { --_bg: var(--danger-dim); }

.btn-sm { padding: 0.35rem 0.7rem; font-size: var(--step--1); }
.btn-lg { padding: 0.75rem 1.5rem; font-size: var(--step-1); }
.btn-block { display: flex; width: 100%; }

.btn-link { background: none; border: none; color: var(--primary); padding: 0; cursor: pointer; font: inherit; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* ============================================================================
   Badges & pills
   ========================================================================== */

.badge {
  display: inline-flex; align-items: center; gap: 0.4em;
  padding: 0.2rem 0.6rem;
  font-size: var(--step--1); font-weight: 600; line-height: 1.4;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text-dim);
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }

.badge.ok      { color: var(--ok);      background: var(--ok-dim);     border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn    { color: var(--warn);    background: var(--warn-dim);   border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.danger  { color: var(--danger);  background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge.info    { color: var(--info);    background: var(--info-dim);   border-color: color-mix(in srgb, var(--info) 40%, transparent); }
.badge.primary { color: var(--primary); background: rgba(34,211,238,0.1); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.badge.neutral { color: var(--text-dim); }

/* SLA badges are just semantic aliases so pages read clearly.
   on-track → ok · due-soon → warn · overdue → danger */
.badge.sla-on-track { color: var(--ok);     background: var(--ok-dim);     border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.sla-due-soon { color: var(--warn);   background: var(--warn-dim);   border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.sla-overdue  { color: var(--danger); background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.badge.sla-overdue .dot { animation: pulse 1.6s var(--ease) infinite; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ============================================================================
   Tables
   ========================================================================== */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: var(--step-0); }
table.data thead th {
  text-align: left; font-size: var(--step--1); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim);
  padding: var(--sp-3) var(--sp-4);
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
table.data tbody td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.12s; }
table.data tbody tr:hover { background: rgba(34,211,238,0.04); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============================================================================
   Forms
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field > label { font-size: var(--step--1); font-weight: 600; color: var(--text-dim); }
.field .hint { font-size: var(--step--1); color: var(--text-faint); }

.input, .select, .textarea {
  width: 100%;
  font: inherit; font-size: var(--step-0);
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.textarea { min-height: 96px; resize: vertical; }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.2rem;
}

.check { display: inline-flex; align-items: center; gap: var(--sp-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }

/* ============================================================================
   Tabs
   ========================================================================== */

.tabs { display: flex; gap: var(--sp-1); border-bottom: 1px solid var(--border); }
.tab {
  padding: var(--sp-3) var(--sp-4);
  font: inherit; font-weight: 600; font-size: var(--step-0);
  color: var(--text-dim);
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }

/* ============================================================================
   Stepper — the six canonical stages
   Intake → Prerequisites → Assessment → Decision → Assurance → Renewal
   ========================================================================== */

.stepper { display: flex; align-items: flex-start; width: 100%; --line: var(--border-strong); }
.stepper .step { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; min-width: 0; }

/* connector line drawn to the left of each node, joining to the previous */
.stepper .step::before {
  content: ""; position: absolute; top: 15px; right: 50%; left: -50%;
  height: 2px; background: var(--line); z-index: 0;
}
.stepper .step:first-child::before { display: none; }

.stepper .node {
  position: relative; z-index: 1;
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: var(--step--1); font-weight: 700;
  background: var(--panel); border: 2px solid var(--line); color: var(--text-dim);
  transition: all 0.25s var(--ease);
}
.stepper .step-label { margin-top: var(--sp-2); font-size: var(--step--1); color: var(--text-dim); font-weight: 600; }

/* completed */
.stepper .step.done .node { background: var(--ok); border-color: var(--ok); color: var(--primary-ink); }
.stepper .step.done::before,
.stepper .step.done ~ .step.current::before { background: var(--ok); }
.stepper .step.done .step-label { color: var(--text); }

/* current */
.stepper .step.current .node {
  background: var(--primary); border-color: var(--primary); color: var(--primary-ink);
  box-shadow: 0 0 0 5px var(--primary-glow);
}
.stepper .step.current .step-label { color: var(--primary); }

/* the connector into the current node should read as "reached" */
.stepper .step.current::before { background: var(--ok); }

@media (max-width: 720px) {
  .stepper .step-label { font-size: 0.68rem; }
}

/* ============================================================================
   Progress meter (completeness, risk, readiness)
   ========================================================================== */

.meter { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.meter > .fill { height: 100%; width: 0; border-radius: 999px; background: var(--primary); transition: width 0.6s var(--ease); }
.meter.ok > .fill     { background: var(--ok); }
.meter.warn > .fill   { background: var(--warn); }
.meter.danger > .fill { background: var(--danger); }

/* ============================================================================
   Modal
   ========================================================================== */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: var(--scrim); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: var(--sp-5);
  opacity: 0; pointer-events: none; transition: opacity 0.2s var(--ease);
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(560px, 100%);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.2s var(--ease);
}
.modal-backdrop.open .modal { transform: none; }
.modal-head { padding: var(--sp-5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: var(--sp-5); }
.modal-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* ============================================================================
   Toasts
   ========================================================================== */

.toast-stack {
  position: fixed; z-index: 300; right: var(--sp-5); bottom: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-3); max-width: 360px;
}
.toast {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius); padding: var(--sp-3) var(--sp-4);
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.28s var(--ease);
}
.toast.leaving { animation: toast-out 0.22s var(--ease) forwards; }
.toast .toast-msg { font-size: var(--step-0); }
.toast .toast-title { font-weight: 650; margin-bottom: 2px; }
.toast.ok     { border-left-color: var(--ok); }
.toast.warn   { border-left-color: var(--warn); }
.toast.danger { border-left-color: var(--danger); }
.toast.info   { border-left-color: var(--info); }

@keyframes toast-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* ============================================================================
   Injected header + demo switcher (components.js)
   ========================================================================== */

.app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100; height: var(--header-h);
  display: flex; align-items: center; gap: var(--sp-5);
  padding-inline: var(--sp-5);
  background: var(--header-bg);
  backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); font-weight: 700; color: var(--text); letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand .brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--primary), var(--primary-dim));
  color: var(--primary-ink); font-size: 0.95rem; font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08) inset, 0 4px 14px -4px var(--primary-glow);
}
.brand .brand-name { font-size: var(--step-1); }
.brand .brand-name b { color: var(--primary); font-weight: 700; }
.brand .brand-sub { font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-faint); display: block; margin-top: -2px; }

/* Real DESC wordmark. The supplied logo is red on an opaque white background, so
   we present it as a small white plaque (padded + rounded) — clean on the light
   header and, crucially, on the dark one where a bare white PNG would read as a
   jarring box. Product name "Certify" sits after a divider. */
.brand .brand-logo {
  height: 32px; width: auto; display: block; flex: none;
  background: #fff; padding: 4px 7px; border-radius: 7px;
  box-shadow: var(--shadow-1);
}
.brand .brand-divider { width: 1px; height: 26px; background: var(--border-strong); flex: none; }
.brand .brand-certify { font-size: var(--step-1); font-weight: 650; color: var(--text); letter-spacing: -0.01em; }

/* Header theme toggle — icon-only, quiet chrome button */
.theme-toggle { padding: 0.4rem; width: 34px; }
.theme-toggle .icon-svg { display: block; }

/* Demo switcher — segmented control */
.demo-switch {
  display: flex; gap: 2px; padding: 3px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.demo-switch a {
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 0.32rem 0.85rem; border-radius: var(--radius-pill);
  font-size: var(--step--1); font-weight: 600; color: var(--text-dim);
  transition: color 0.15s, background 0.15s;
}
.demo-switch a:hover { color: var(--text); text-decoration: none; }
.demo-switch a[aria-current="true"] { background: var(--panel-3); color: var(--primary); box-shadow: var(--shadow-1); }
.demo-switch a .icon { font-size: 0.95em; }

.header-actions { display: flex; align-items: center; gap: var(--sp-3); }

@media (max-width: 760px) {
  .brand .brand-sub { display: none; }
  .brand .brand-divider, .brand .brand-certify { display: none; }
  .brand .brand-logo { height: 30px; }
  .demo-switch a span.lbl { display: none; }
  .app-header { gap: var(--sp-3); }
}

/* inline SVG icons inherit text colour and align with adjacent text */
.icon-svg { display: inline-block; vertical-align: -0.15em; flex: none; }
.btn .icon-svg { vertical-align: middle; }

/* ---- Secondary in-face navigation ---------------------------------------
   Injected on public + applicant (and DESC in M3) pages. Sticks just under the
   fixed app header so it's always reachable while the page scrolls. */
.portal-nav {
  position: sticky; top: var(--header-h); z-index: 80;
  background: var(--nav-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.portal-nav .inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 0 var(--sp-5);
  display: flex; align-items: center; gap: var(--sp-1);
  height: 50px;
}
.portal-nav a {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.45rem 0.8rem; border-radius: var(--radius-sm);
  font-size: var(--step-0); font-weight: 500; color: var(--text-dim);
  transition: color 0.15s, background 0.15s;
}
.portal-nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.portal-nav a[aria-current="page"] { color: var(--primary); background: rgba(34,211,238,0.08); }
.portal-nav a .icon-svg { opacity: 0.9; }
.portal-nav .nav-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.portal-nav .nav-right a.cta { color: var(--primary-ink); background: linear-gradient(180deg, var(--primary), var(--primary-dim)); font-weight: 600; }
.portal-nav .nav-right a.cta:hover { filter: brightness(1.1); background: linear-gradient(180deg, var(--primary), var(--primary-dim)); }

.portal-nav .nav-scroll { display: flex; align-items: center; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none; }
.portal-nav .nav-scroll::-webkit-scrollbar { display: none; }

@media (max-width: 820px) {
  .portal-nav a .lbl { font-size: var(--step--1); }
  .portal-nav .inner { gap: 0; }
}

/* ---- "View as" persona control (applicant chrome) ----------------------- */
.persona { position: relative; }
.persona [data-persona-toggle] { gap: 0.4em; }
.persona .persona-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 120;
  min-width: 240px; padding: var(--sp-2);
  background: var(--panel-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius); box-shadow: var(--shadow-pop);
}
.persona-menu-head { font-size: var(--step--1); color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.08em; padding: var(--sp-2) var(--sp-2) var(--sp-1); }
.persona-item {
  width: 100%; display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-2); border: none; border-radius: var(--radius-sm);
  background: none; color: var(--text); cursor: pointer; font: inherit; text-align: left;
}
.persona-item small { color: var(--text-faint); margin-left: auto; }
.persona-item .icon-svg { color: var(--primary); margin-left: var(--sp-2); }
.persona-item:hover { background: var(--panel-3); }
.persona-item.on { color: var(--primary); }
.persona-item.on small { color: var(--primary-dim); }

/* The persistent "this is only a demo" markers */
.proto-badge {
  position: fixed; z-index: 90; left: var(--sp-4); bottom: var(--sp-4);
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.3rem 0.7rem; border-radius: var(--radius-pill);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--warn); background: var(--proto-bg);
  border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent);
  backdrop-filter: blur(6px);
  user-select: none; pointer-events: none;
}
.proto-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ============================================================================
   Site footer (injected on public pages)
   ========================================================================== */

.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); margin-top: var(--sp-8); }
.site-footer .inner { max-width: var(--maxw); margin-inline: auto; padding: var(--sp-7) var(--sp-5) var(--sp-6); }
.site-footer .cols { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: var(--sp-6); }
.site-footer h5 { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin: 0 0 var(--sp-3); font-weight: 600; }
.site-footer a { color: var(--text-dim); display: block; padding: 3px 0; font-size: var(--step-0); }
.site-footer a:hover { color: var(--primary); text-decoration: none; }
.site-footer .foot-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.site-footer .foot-brand .brand-mark { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: linear-gradient(140deg, var(--primary), var(--primary-dim)); color: var(--primary-ink); font-weight: 800; }
.site-footer .foot-brand .foot-logo {
  height: 30px; width: auto; display: block;
  background: #fff; padding: 4px 7px; border-radius: 7px; box-shadow: var(--shadow-1);
}
.site-footer .foot-note { color: var(--text-faint); font-size: var(--step--1); max-width: 46ch; margin: 0; }
.site-footer .foot-bar { border-top: 1px solid var(--border); margin-top: var(--sp-6); padding-top: var(--sp-4); display: flex; justify-content: space-between; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.site-footer .foot-bar small { color: var(--text-faint); }
.site-footer .foot-bar .zafar { color: var(--text-dim); }
.site-footer .foot-bar .zafar b { color: var(--text); font-weight: 600; }
@media (max-width: 760px) { .site-footer .cols { grid-template-columns: 1fr; gap: var(--sp-5); } }

/* Generic hero used across public pages */
.hero { position: relative; padding-block: var(--sp-8) var(--sp-7); overflow: hidden; }
.hero .eyebrow { margin-bottom: var(--sp-3); }
.hero h1 { font-size: clamp(2.1rem, 4.5vw, var(--step-5)); max-width: 18ch; }
.hero p.lede { font-size: var(--step-1); color: var(--text-dim); max-width: 60ch; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--sp-7); align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }

/* Scheme tile accent variants (border-top colour by scheme) */
.tile-csp { border-top: 2px solid var(--primary); }
.tile-soc { border-top: 2px solid var(--info); }
.tile-dcf { border-top: 2px solid var(--warn); }

/* Feature icon chip */
.chip-icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--border); color: var(--primary); flex: none; }
.chip-icon.info { color: var(--info); }
.chip-icon.warn { color: var(--warn); }
.chip-icon.ok { color: var(--ok); }

/* ============================================================================
   AI engine surfaces (ai-engine.js)
   ========================================================================== */

.ai-block {
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(34,211,238,0.05), transparent 70%), var(--panel);
  padding: var(--sp-4) var(--sp-5);
}
.ai-label {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-size: var(--step--1); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary);
}
.ai-label .spark { font-size: 1em; }

/* the little "thinking" indicator */
.ai-thinking { display: inline-flex; align-items: center; gap: 0.55em; color: var(--text-dim); font-size: var(--step-0); }
.ai-dots { display: inline-flex; gap: 4px; }
.ai-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); opacity: 0.4; animation: ai-bounce 1.1s var(--ease) infinite; }
.ai-dots i:nth-child(2) { animation-delay: 0.15s; }
.ai-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-bounce { 0%,60%,100% { opacity: 0.35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* blinking caret used by the typing effect */
.ai-caret { display: inline-block; width: 2px; height: 1.05em; margin-left: 1px; background: var(--primary); vertical-align: text-bottom; animation: caret-blink 1s steps(1) infinite; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* rationale — "why", so the AI is never a black box */
.ai-rationale {
  margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  border-left: 2px solid var(--primary-dim);
  background: var(--bg-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: var(--step--1); color: var(--text-dim);
}
.ai-rationale b { color: var(--text); font-weight: 600; }

/* staged-reveal items start hidden, revealed by JS */
.reveal-item { opacity: 0; transform: translateY(6px); transition: opacity 0.4s var(--ease), transform 0.4s var(--ease); }
.reveal-item.shown { opacity: 1; transform: none; }

/* ============================================================================
   DESC portal components
   ========================================================================== */

/* Pipeline kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-3); }
.kanban .col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 120px; }
.kanban .col-head { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; }
.kanban .col-head b { font-size: var(--step-0); }
.kanban .col-body { padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); }
.kanban .pcard { background: var(--panel); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius-sm); padding: var(--sp-3); cursor: pointer; transition: border-color 0.15s, transform 0.1s; }
.kanban .pcard:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.kanban .pcard.pri-high { border-left-color: var(--warn); }
.kanban .pcard.flagged { border-left-color: var(--danger); }
.kanban .pcard .pcard-co { font-weight: 600; }
.kanban .pcard .pcard-meta { font-size: var(--step--1); color: var(--text-dim); margin-top: 2px; }

/* Risk board (continuous assurance) */
.risk-row { display: grid; grid-template-columns: 1.4fr auto 1fr auto; gap: var(--sp-4); align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.risk-row:last-child { border-bottom: none; }
.risk-score { font-size: var(--step-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.risk-score.ok { color: var(--ok); } .risk-score.warn { color: var(--warn); } .risk-score.danger { color: var(--danger); }
.trend { display: inline-flex; align-items: center; gap: 0.3em; font-size: var(--step--1); font-weight: 600; }
.trend.up { color: var(--danger); } .trend.down { color: var(--ok); } .trend.flat { color: var(--text-dim); }
.riskbar { height: 6px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.riskbar > span { display: block; height: 100%; border-radius: 999px; }

/* Decision bar — advisory (AI) vs authority (DESC) made visually distinct */
.decision { display: grid; grid-template-columns: 1fr; gap: var(--sp-4); }
.decision .advisory { border: 1px dashed color-mix(in srgb, var(--primary) 40%, var(--border)); border-radius: var(--radius); padding: var(--sp-4); background: linear-gradient(180deg, rgba(34,211,238,0.05), transparent 70%); }
.decision .authority { border: 1px solid var(--border-strong); border-radius: var(--radius); padding: var(--sp-4); background: var(--panel-2); }
.decision .authority .who { display: inline-flex; align-items: center; gap: 0.4em; font-size: var(--step--1); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text); }
.decision .btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-3); }

/* Audit trail — hash-chained entries */
.audit-entry { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-4); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.audit-entry:last-child { border-bottom: none; }
.audit-entry .a-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.audit-entry .a-icon.applicant { background: rgba(34,211,238,0.1); color: var(--primary); }
.audit-entry .a-icon.desc { background: var(--info-dim); color: var(--info); }
.audit-entry .a-icon.ai { background: rgba(52,211,153,0.1); color: var(--ok); }
.audit-entry .a-icon.system { background: var(--panel-3); color: var(--text-dim); }
.audit-entry .a-hash { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-faint); word-break: break-all; }
.audit-entry .a-hash b { color: var(--ok); }
.chain-badge { display: inline-flex; align-items: center; gap: 0.4em; color: var(--ok); font-size: var(--step--1); font-weight: 600; }

/* ============================================================================
   Chat dock (chat-widget.js) — reusable, scripted assistant
   ========================================================================== */

.chat-launch {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 150;
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.6rem 1.1rem; border-radius: var(--radius-pill);
  font: inherit; font-weight: 600; cursor: pointer;
  color: var(--primary-ink); border: none;
  background: linear-gradient(180deg, var(--primary), var(--primary-dim));
  box-shadow: var(--shadow-pop), 0 0 0 1px rgba(255,255,255,0.08) inset;
}
.chat-launch:hover { filter: brightness(1.08); }
.chat-launch.hidden { display: none; }

.chat-panel {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 160;
  width: min(400px, calc(100vw - 2 * var(--sp-5)));
  height: min(620px, calc(100vh - 2 * var(--sp-5)));
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  opacity: 0; transform: translateY(12px) scale(0.98); pointer-events: none;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.chat-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.chat-head { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.chat-head .avatar { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: linear-gradient(140deg, var(--primary), var(--primary-dim)); color: var(--primary-ink); }
.chat-head .chat-title { font-weight: 650; line-height: 1.1; }
.chat-head .chat-sub { font-size: var(--step--1); color: var(--text-dim); }
.chat-head .chat-close { margin-left: auto; }

.chat-body { flex: 1; overflow-y: auto; padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.chat-msg { max-width: 85%; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); font-size: var(--step-0); line-height: 1.5; }
.chat-msg.user { align-self: flex-end; background: var(--primary-dim); color: #eaffff; border-bottom-right-radius: 3px; }
.chat-msg.bot  { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.chat-msg .ai-line + .ai-line { margin-top: var(--sp-2); }
.chat-msg .chat-list { margin: var(--sp-2) 0 0; padding-left: 1.1rem; }
.chat-msg .chat-list li { margin: 2px 0; }
.chat-msg .ai-rationale { margin-top: var(--sp-3); }
.chat-msg .chat-action { margin-top: var(--sp-3); }

.chat-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); transition: background 0.3s var(--ease); }
.chat-chips.nudge { animation: chips-nudge 1.4s var(--ease); }
@keyframes chips-nudge { 0%, 100% { background: transparent; } 30% { background: rgba(34,211,238,0.08); } }
.chat-chip { padding: 0.35rem 0.7rem; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text-dim); font-size: var(--step--1); cursor: pointer; transition: color 0.15s, border-color 0.15s; }
.chat-chip:hover { color: var(--primary); border-color: var(--primary-dim); }
.chat-foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--border); }
.chat-input-row { display: flex; gap: var(--sp-2); }
.chat-input-row .input { flex: 1; }
.chat-disclaimer { font-size: var(--step--1); color: var(--text-faint); margin: var(--sp-2) 0 0; display: flex; align-items: center; gap: 0.4em; }

@media (max-width: 520px) {
  .chat-panel { right: 0; bottom: 0; width: 100vw; height: 100vh; border-radius: 0; }
}

/* ============================================================================
   Evidence analysis + vault
   ========================================================================== */

.ev-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: var(--sp-3) var(--sp-4);
  align-items: center; padding: var(--sp-4); border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--panel);
  transition: border-color 0.2s var(--ease), background 0.2s;
}
.ev-item .ev-file { font-weight: 500; }
.ev-item .ev-meta { font-size: var(--step--1); color: var(--text-dim); }
.ev-item .mono { color: var(--text-faint); }
.ev-item.status-inconsistent { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: linear-gradient(180deg, rgba(248,113,113,0.06), transparent 60%), var(--panel); }
.ev-item.status-matched .ev-dot { color: var(--ok); }
.ev-item.status-partial .ev-dot { color: var(--warn); }
.ev-item.status-inconsistent .ev-dot { color: var(--danger); }
.ev-item.status-pending .ev-dot { color: var(--text-faint); }

/* the inconsistency "aha" callout */
.inconsistency {
  border: 1px solid color-mix(in srgb, var(--danger) 55%, transparent);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(248,113,113,0.08), transparent 70%), var(--panel-2);
  padding: var(--sp-5);
}
.inconsistency .vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-4); align-items: stretch; margin: var(--sp-4) 0; }
.inconsistency .vs .claim { padding: var(--sp-4); border-radius: var(--radius-sm); background: var(--bg-2); border: 1px solid var(--border); }
.inconsistency .vs .claim h5 { margin: 0 0 var(--sp-2); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.inconsistency .vs .arrow { display: grid; place-items: center; color: var(--danger); }
@media (max-width: 720px) { .inconsistency .vs { grid-template-columns: 1fr; } .inconsistency .vs .arrow { transform: rotate(90deg); } }

/* ============================================================================
   Certificate (on-screen)
   ========================================================================== */

.certificate {
  position: relative; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: var(--radius-lg);
  background:
    radial-gradient(700px 340px at 85% -10%, rgba(34,211,238,0.1), transparent 60%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: var(--sp-7);
}
.certificate::before {
  content: ""; position: absolute; inset: 10px; border: 1px solid var(--border); border-radius: var(--radius); pointer-events: none;
}
.certificate .cert-seal { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; color: var(--primary-ink); background: linear-gradient(140deg, var(--primary), var(--primary-dim)); box-shadow: 0 0 0 6px var(--primary-glow); }
.certificate .cert-no { font-family: var(--font-mono); letter-spacing: 0.04em; color: var(--primary); }
.certificate .cert-holder { font-size: var(--step-3); font-weight: 700; letter-spacing: -0.01em; }
.certificate .cert-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4) var(--sp-6); }
.certificate .cert-grid .k { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); }
.certificate .cert-grid .v { font-weight: 500; }

/* ============================================================================
   Timeline (tracking / renewal)
   ========================================================================== */

.timeline { position: relative; padding-left: var(--sp-6); }
.timeline::before { content: ""; position: absolute; left: 10px; top: 4px; bottom: 4px; width: 2px; background: var(--border-strong); }
.timeline .tl-item { position: relative; padding-bottom: var(--sp-5); }
.timeline .tl-item:last-child { padding-bottom: 0; }
.timeline .tl-item::before { content: ""; position: absolute; left: calc(-1 * var(--sp-6) + 5px); top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 2px solid var(--border-strong); }
.timeline .tl-item.done::before { background: var(--ok); border-color: var(--ok); }
.timeline .tl-item.current::before { background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-glow); }
.timeline .tl-when { font-size: var(--step--1); color: var(--text-faint); }
.timeline .tl-title { font-weight: 600; }

/* Simulated drop zone for evidence "upload" */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: var(--sp-6); text-align: center; color: var(--text-dim);
  background: var(--bg-2); transition: border-color 0.2s, background 0.2s;
}
.dropzone.drag { border-color: var(--primary); background: rgba(34,211,238,0.05); color: var(--text); }

/* ============================================================================
   Utilities & motion preferences
   ========================================================================== */

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.divider { height: 1px; background: var(--border); margin-block: var(--sp-4); }
.glow-text { text-shadow: 0 0 24px var(--primary-glow); }
.nowrap { white-space: nowrap; }
.tabnum { font-variant-numeric: tabular-nums; }

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

/* ============================================================================
   Lifecycle (M5–M8) — status ladder, scope, stars, refresh tiers, due process,
   simulated Smart Supplier. Same tokens as everything above.
   ========================================================================== */

/* Status chips. Withdrawn gets its own darker treatment so it never reads as
   "just suspended"; Expired stays neutral — it's a lapse, not a sanction. */
.badge.status-chip.st-active    { color: var(--ok);     background: var(--ok-dim);     border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.status-chip.st-watch     { color: var(--warn);   background: var(--warn-dim);   border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.status-chip.st-suspended { color: var(--danger); background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.badge.status-chip.st-withdrawn { color: var(--panel); background: color-mix(in srgb, var(--danger) 78%, var(--text)); border-color: transparent; }
.badge.status-chip.st-expired   { color: var(--text-dim); background: var(--panel-2); }

.scope-chip {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: var(--step--1); font-weight: 500; color: var(--text); background: var(--panel-2);
  border: 1px solid var(--border); white-space: nowrap;
}
.scope-chip.missing { color: var(--danger); border-style: dashed; text-decoration: line-through; }

/* Stars — a clipped overlay, so 4.6 really shows 92% of the fifth star. */
.stars { display: inline-flex; align-items: center; gap: 0.4em; white-space: nowrap; }
.stars-track { position: relative; display: inline-block; color: var(--panel-3); letter-spacing: 1px; font-size: 1.05em; line-height: 1; }
.stars-fill { position: absolute; inset: 0 auto 0 0; overflow: hidden; color: #e0a526; white-space: nowrap; }
.stars b { font-weight: 600; }

.badge.tier { font-weight: 600; }
.badge.tier-green { color: var(--ok);     background: var(--ok-dim);     border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.tier-amber { color: var(--warn);   background: var(--warn-dim);   border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.tier-red   { color: var(--danger); background: var(--danger-dim); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.factor-list { display: grid; gap: var(--sp-2); }
.factor { display: grid; grid-template-columns: 14px 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-2); }
.factor .f-dot { width: 10px; height: 10px; border-radius: 50%; }
.factor .f-dot.green { background: var(--ok); } .factor .f-dot.amber { background: var(--warn); } .factor .f-dot.red { background: var(--danger); }
.factor .f-val { font-size: var(--step--1); color: var(--text-dim); text-align: right; }

/* The status ladder strip (rules page, case header). */
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.ladder .rung { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-3); background: var(--panel); position: relative; }
.ladder .rung.on { border-color: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
.ladder .rung.st-active { color: var(--ok); } .ladder .rung.st-watch { color: var(--warn); }
.ladder .rung.st-suspended, .ladder .rung.st-withdrawn { color: var(--danger); }
.ladder .rung b { display: block; color: currentColor; }
.ladder .rung small { color: var(--text-dim); display: block; margin-top: 2px; }
@media (max-width: 720px) { .ladder { grid-template-columns: repeat(2, 1fr); } }

/* Due-process steps: notice → fix window → reply → decision → appeal. */
.due-process { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; counter-reset: dp; }
.due-process .dp { position: relative; padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-3); border-top: 3px solid var(--border-strong); }
.due-process .dp + .dp { margin-left: 4px; }
.due-process .dp.done { border-top-color: var(--ok); }
.due-process .dp.current { border-top-color: var(--primary); }
.due-process .dp .dp-k { font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.due-process .dp.current .dp-k { color: var(--primary); font-weight: 600; }
.due-process .dp .dp-t { font-weight: 600; margin-top: 2px; }
.due-process .dp .dp-d { font-size: var(--step--1); color: var(--text-dim); }
@media (max-width: 860px) { .due-process { grid-template-columns: 1fr; } .due-process .dp + .dp { margin-left: 0; } }

/* Simulated Smart Supplier — deliberately neutral, unbranded, and labelled. */
.sim-banner {
  display: flex; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: repeating-linear-gradient(135deg, var(--panel-2), var(--panel-2) 10px, var(--bg-2) 10px, var(--bg-2) 20px);
  color: var(--text-dim); font-size: var(--step--1);
}
.sim-banner b { color: var(--text); letter-spacing: 0.04em; text-transform: uppercase; font-size: var(--step--1); }
.sim-frame { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--panel); overflow: hidden; }
.sim-frame > .sim-head { padding: var(--sp-3) var(--sp-5); background: var(--panel-2); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.sim-frame > .sim-body { padding: var(--sp-5); }

.elig-row { display: grid; grid-template-columns: 28px 1.3fr 1fr 1.6fr; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); }
.elig-row:last-child { border-bottom: none; }
.elig-row .ok-ico { color: var(--ok); } .elig-row .no-ico { color: var(--danger); }
.elig-row.blocked { background: color-mix(in srgb, var(--danger) 4%, transparent); }
@media (max-width: 860px) { .elig-row { grid-template-columns: 28px 1fr; } }

/* Star input on the buyer feedback form. Radios underneath for keyboard use. */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-input label { font-size: 1.6rem; line-height: 1; color: var(--panel-3); cursor: pointer; transition: color 0.12s, transform 0.12s; }
.star-input label:hover, .star-input label:hover ~ label,
.star-input input:checked ~ label { color: #e0a526; }
.star-input label:hover { transform: scale(1.12); }
.star-input input:focus-visible + label { outline: 2px solid var(--primary); border-radius: 4px; }
.dim-row { display: grid; grid-template-columns: 1.2fr auto 60px; gap: var(--sp-4); align-items: center; padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
.dim-row:last-child { border-bottom: none; }
.dim-row .w { font-size: var(--step--1); color: var(--text-faint); text-align: right; }
.dim-row .reason { grid-column: 1 / -1; }
.field-error { color: var(--danger); font-size: var(--step--1); }
@media (max-width: 720px) { .dim-row { grid-template-columns: 1fr; } .dim-row .w { text-align: left; } }

/* Leaderboard */
.lb-row { display: grid; grid-template-columns: 36px 1.5fr 1.6fr 90px 80px 150px 24px; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--border); cursor: pointer; }
.lb-row:hover { background: var(--panel-2); }
.lb-row.on { background: color-mix(in srgb, var(--primary) 7%, transparent); }
.lb-row:last-child { border-bottom: none; }
.lb-row .rank { font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.lb-head { cursor: default; font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); background: var(--panel-2); }
.lb-head:hover { background: var(--panel-2); }
@media (max-width: 900px) { .lb-row { grid-template-columns: 30px 1fr auto; } .lb-row > .hide-sm { display: none; } }

.delta { font-size: var(--step--1); font-weight: 600; }
.delta.up { color: var(--ok); } .delta.down { color: var(--danger); }

.quote { border-left: 3px solid var(--border-strong); padding: var(--sp-2) var(--sp-4); color: var(--text); background: var(--bg-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.quote.hidden-comment { color: var(--text-faint); font-style: italic; }
.reply-box { margin-left: var(--sp-5); border-left: 3px solid var(--primary); padding: var(--sp-2) var(--sp-4); background: color-mix(in srgb, var(--primary) 5%, transparent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.code-block { font-family: var(--font-mono); font-size: var(--step--1); background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--sp-4); white-space: pre; overflow-x: auto; color: var(--text); margin: 0; }
.rule-note { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius-sm); background: var(--info-dim); color: var(--text); font-size: var(--step--1); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.rule-note .icon-svg { color: var(--info); flex: none; margin-top: 1px; }
.buyer-id { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .buyer-id { display: none; } }

/* The DESC portal grew to twelve tools in M6–M8. A denser sub-bar keeps every
   one visible on a normal laptop instead of hiding Rules/Roles off-screen. */
.portal-nav.dense .inner { max-width: 1400px; }
.portal-nav.dense a { padding: 0.4rem 0.5rem; font-size: 0.86rem; gap: 0.35em; }
.portal-nav.dense .nav-scroll { gap: 2px; }

/* Standalone caption (outside a .stat block) — same voice as stat labels. */
.stat-label { font-size: var(--step--1); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.decision .authority .who + .text-faint { display: block; margin-top: 2px; }
/* Small stat cards stack caption / value / note vertically; badges keep their
   natural width instead of stretching. */
.card.stack-sm { display: flex; flex-direction: column; align-items: flex-start; }
.card.stack-sm > * + * { margin-top: var(--sp-2); }

/* Grid children may shrink below their content (tables, code) so wide content
   scrolls inside its card instead of pushing the page sideways. */
.grid > * { min-width: 0; }
.table-wrap { overflow-x: auto; }
/* Two-column page layouts (set inline per page) collapse to one on narrow screens. */
@media (max-width: 860px) {
  .grid[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}
#drill { scroll-margin-top: 130px; }

/* ============================================================================
   v3 (M9) — decisions first. Cockpit, case, compare, provider home, phone
   rating, story & close, grouped nav, Arabic preview. Same tokens; the dark
   navy "ink" is kept for a few emphasis bands. Hierarchy comes from size and
   weight, not from more colour.
   ========================================================================== */

/* ---- Small shared pieces --------------------------------------------------- */
.kicker { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }
.kicker.on-ink { color: var(--ink-accent); }
.dotx { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-faint); }
.dotx.ok { background: var(--ok); } .dotx.warn { background: var(--warn); } .dotx.danger { background: var(--danger); } .dotx.info { background: var(--info); }
.v3-h2 { font-size: var(--step-2); margin: 0; letter-spacing: -0.01em; }
.v3-sub { color: var(--text-dim); margin: var(--sp-1) 0 0; }
.count-pill { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--panel-3); font-weight: 650; font-size: var(--step--1); color: var(--text); }
.mono-ref { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-dim); }
.btn, .btn-link { min-height: 40px; }
.btn-sm { min-height: 34px; }
.ink-band { background: var(--ink); color: var(--ink-text); border-radius: var(--radius-lg); padding: var(--sp-6); border: 1px solid var(--ink-line); }
.ink-band .text-dim, .ink-band p { color: var(--ink-dim); }
.ink-band h1, .ink-band h2, .ink-band h3, .ink-band b, .ink-band strong { color: var(--ink-text); }
.ink-band a { color: var(--ink-accent); }

/* ---- Header additions ------------------------------------------------------ */
.demo-switch .switch-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: var(--border-strong); }
.demo-switch a.quiet { font-weight: 500; color: var(--text-faint); }
.demo-switch a.quiet[aria-current="true"] { color: var(--primary); }
.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-pill); overflow: hidden; flex: none; }
.lang-switch button { font: inherit; font-size: var(--step--1); font-weight: 600; padding: 0.3rem 0.65rem; min-height: 32px; border: 0; background: transparent; color: var(--text-dim); cursor: pointer; }
.lang-switch button[lang="ar"] { font-family: "IBM Plex Sans Arabic", var(--font-sans); }
.lang-switch button[aria-pressed="true"] { background: var(--panel-3); color: var(--primary); }
.lang-switch button:focus-visible { box-shadow: inset 0 0 0 2px var(--primary); border-radius: 0; }
@media (max-width: 1240px) { .header-actions [data-reset-demo] .lbl { display: none; } }
@media (max-width: 560px) {
  .lang-switch button { padding: 0.25rem 0.45rem; }
  .app-header { padding-inline: var(--sp-3); gap: var(--sp-2); }
  .header-actions { gap: var(--sp-1); }
  .demo-switch a { padding: 0.32rem 0.5rem; }
  .demo-switch .switch-sep { display: none; }
}

/* ---- Grouped portal nav (DESC) -------------------------------------------- */
.portal-nav .nav-group {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint); padding: 0 var(--sp-1) 0 var(--sp-3); white-space: nowrap;
  border-left: 1px solid var(--border); margin-left: var(--sp-2);
}
.portal-nav.grouped .inner { max-width: 1400px; }
.nav-more { position: relative; }
.nav-more-btn {
  display: inline-flex; align-items: center; gap: 0.45em; font: inherit; font-weight: 500; font-size: var(--step-0);
  padding: 0.45rem 0.75rem; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: transparent; color: var(--text-dim); cursor: pointer;
}
.nav-more-btn:hover { color: var(--text); background: var(--panel-2); }
.nav-more-btn[aria-expanded="true"] { background: var(--panel-2); color: var(--text); border-color: var(--border); }
.nav-more.on .nav-more-btn { color: var(--primary); }
.nav-more-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 120; min-width: 200px; padding: var(--sp-2);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: 2px;
}
.nav-more-menu[hidden] { display: none; }
.portal-nav .nav-more-menu a { padding: 0.55rem 0.75rem; min-height: 40px; }
@media (max-width: 900px) { .portal-nav .nav-group { display: none; } }
@media (max-width: 560px) { .nav-more-btn .lbl { display: none; } }

/* ---- DESC "Today" cockpit -------------------------------------------------- */
.greet-row { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--sp-4); flex-wrap: wrap; }
.greet-date { font-size: var(--step--1); color: var(--text-dim); font-weight: 500; }
.greet { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin: var(--sp-1) 0 var(--sp-2); letter-spacing: -0.02em; }
.greet-line { font-size: var(--step-1); color: var(--text-dim); margin: 0; }
.greet-line b { color: var(--text); font-weight: 650; }
.health-pill { display: inline-flex; align-items: center; gap: 0.55em; padding: 0.45rem 0.85rem; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--panel); font-size: var(--step--1); color: var(--text-dim); }

.loop-strip { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.loop-cell { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-4) var(--sp-5); color: var(--text); text-decoration: none; min-height: 140px; }
.loop-cell + .loop-cell { border-left: 1px solid var(--border); }
.loop-cell:hover { background: var(--panel-2); text-decoration: none; }
.loop-k { display: flex; align-items: center; gap: 0.5em; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; color: var(--text-dim); }
.loop-n { font-size: 2.4rem; font-weight: 650; line-height: 1.05; letter-spacing: -0.02em; margin-top: var(--sp-2); font-variant-numeric: tabular-nums; }
.loop-l { color: var(--text-dim); font-size: var(--step--1); }
.loop-note { margin-top: auto; padding-top: var(--sp-2); font-size: var(--step--1); font-weight: 600; color: var(--text-dim); }
.loop-note.ok { color: var(--ok); } .loop-note.warn { color: var(--warn); } .loop-note.danger { color: var(--danger); }
@media (max-width: 900px) { .loop-strip { grid-template-columns: repeat(2, 1fr); } .loop-cell:nth-child(3) { border-left: 0; } .loop-cell:nth-child(n+3) { border-top: 1px solid var(--border); } }
@media (max-width: 480px) { .loop-strip { grid-template-columns: 1fr; } .loop-cell + .loop-cell { border-left: 0; border-top: 1px solid var(--border); } .loop-cell { min-height: 0; } }

.section-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.decision-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: var(--sp-4); }
.dcard { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); min-width: 0; }
.dcard-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.cat-chip { font-size: 0.7rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.25rem 0.6rem; border-radius: var(--radius-pill); background: var(--panel-3); color: var(--text); }
.cat-chip.assurance { background: var(--danger-dim); color: var(--danger); }
.cat-chip.maintain { background: var(--warn-dim); color: var(--warn); }
.cat-chip.certify { background: var(--info-dim); color: var(--info); }
.cat-chip.perform { background: var(--panel-3); color: var(--text); }
.dcard h3 { font-size: var(--step-2); margin: 0; }
.dcard .proposal { margin: 0; font-weight: 500; }
.why-box { background: var(--panel-2); border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); font-size: var(--step--1); color: var(--text-dim); }
.why-box b { color: var(--text); }
.dcard .outcome { margin: 0; font-size: var(--step--1); color: var(--text); display: flex; gap: 0.5em; align-items: baseline; font-weight: 500; }
.dcard .outcome .icon-svg { color: var(--primary); flex: none; align-self: center; }
.dcard-actions { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); padding-top: var(--sp-2); }
.empty-decisions { padding: var(--sp-6); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-dim); }

.lower-row { display: grid; grid-template-columns: 1.35fr 1fr; gap: var(--sp-5); align-items: start; }
@media (max-width: 900px) { .lower-row { grid-template-columns: 1fr; } }
.feed { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.feed-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.feed-list li { display: grid; grid-template-columns: 92px 12px 1fr; gap: var(--sp-3); align-items: baseline; padding: var(--sp-3) 0; border-top: 1px solid var(--border); }
.feed-list li:first-child { border-top: 0; }
.feed-list time { font-size: var(--step--1); color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 480px) { .feed-list li { grid-template-columns: 70px 12px 1fr; } }
.side-tiles { display: grid; gap: var(--sp-4); }
.ink-tile { background: var(--ink); color: var(--ink-text); border-radius: var(--radius-lg); padding: var(--sp-5); border: 1px solid var(--ink-line); }
.ink-tile .big { font-size: 2.6rem; font-weight: 650; line-height: 1; letter-spacing: -0.02em; }
.ink-tile p { color: var(--ink-dim); margin: var(--sp-2) 0 0; }
.ink-tile .lead { color: var(--ink-text); font-weight: 500; font-size: var(--step-1); margin-top: var(--sp-3); }
.quiet-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.kv-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; }
.kv-list li { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-2) 0; border-top: 1px solid var(--border); font-size: var(--step--1); }
.kv-list li:first-child { border-top: 0; }
.kv-list b { font-variant-numeric: tabular-nums; }
.kv-list a { color: var(--text); }

/* ---- Case page ------------------------------------------------------------- */
.case-head { display: flex; justify-content: space-between; gap: var(--sp-4); align-items: flex-start; flex-wrap: wrap; }
.case-head h1 { margin: var(--sp-1) 0 var(--sp-1); font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
.case-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); color: var(--text-dim); font-size: var(--step--1); }
.case-meta .mono { color: var(--primary); }
.valid-pill { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.5rem 0.9rem; border-radius: var(--radius-pill); background: var(--ok-dim); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); font-weight: 600; font-size: var(--step--1); }
.valid-pill.warn { background: var(--warn-dim); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.valid-pill.danger { background: var(--danger-dim); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.band-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); display: grid; grid-template-columns: 1fr 1.35fr; }
.band-card > div { padding: var(--sp-5); min-width: 0; }
.band-card > div + div { border-left: 1px solid var(--border); }
@media (max-width: 1000px) { .band-card { grid-template-columns: 1fr; } .band-card > div + div { border-left: 0; border-top: 1px solid var(--border); } }
.band-card .ladder { margin-top: var(--sp-3); grid-template-columns: repeat(2, 1fr); }
.ladder .rung.proposed { border: 1.5px dashed currentColor; background: transparent; }
.ladder .rung.proposed small { color: currentColor; font-weight: 600; }
.case-steps { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: var(--sp-2); }
.case-steps .cs { display: flex; flex-direction: column; gap: 3px; padding-top: var(--sp-3); border-top: 3px solid var(--border-strong); min-width: 0; }
.case-steps .cs.done { border-top-color: var(--ok); }
.case-steps .cs.now { border-top-color: var(--primary); }
.case-steps .cs-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; font-weight: 700; background: var(--panel-3); color: var(--text-dim); }
.case-steps .done .cs-n { background: var(--ok); color: var(--panel); }
.case-steps .now .cs-n { background: var(--primary); color: var(--primary-ink); }
.case-steps .cs-t { font-weight: 600; font-size: var(--step--1); }
.case-steps .cs-t em { font-style: normal; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); margin-left: 0.3em; }
.case-steps .cs-d { font-size: 0.78rem; color: var(--text-dim); overflow-wrap: anywhere; }
.case-steps .later .cs-t { color: var(--text-dim); }
@media (max-width: 1180px) { .case-steps { grid-template-columns: repeat(3, 1fr); row-gap: var(--sp-4); } }
@media (max-width: 480px) { .case-steps { grid-template-columns: repeat(2, 1fr); } }

.case-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 1000px) { .case-grid { grid-template-columns: 1fr; } }
.ev-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
@media (max-width: 560px) { .ev-tiles { grid-template-columns: 1fr; } }
.ev-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.ev-tile .big { font-size: 2rem; font-weight: 650; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ev-tile .big small { font-size: var(--step--1); font-weight: 500; color: var(--text-dim); letter-spacing: 0; }
.ev-tile code { font-family: var(--font-mono); font-size: 0.85rem; background: var(--panel-2); padding: 2px 6px; border-radius: 4px; color: var(--text); }
.sparkline { display: block; max-width: 100%; height: auto; }
.sparkline .spark-line { stroke: var(--danger); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sparkline .spark-dot { fill: var(--danger); stroke: var(--panel); stroke-width: 2; }
.sparkline .spark-threshold { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 4 3; }
.spark-legend { font-size: 0.75rem; color: var(--text-dim); display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.spark-legend i { display: inline-block; width: 14px; height: 0; border-top: 1px dashed var(--text-dim); vertical-align: middle; margin-right: 4px; }
.reason-panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.notice-draft { white-space: pre-wrap; background: var(--panel-2); border-radius: var(--radius); padding: var(--sp-4); font-size: var(--step-0); line-height: 1.6; }
.notice-draft[contenteditable="true"] { outline: 2px solid var(--primary); background: var(--panel); }

.decide-panel { position: sticky; top: calc(var(--header-h) + 66px); background: var(--panel); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); box-shadow: var(--shadow-2); }
@media (max-width: 1000px) { .decide-panel { position: static; } }
.decide-panel h2 { font-size: var(--step-2); margin: 0; }
.decide-who { font-size: var(--step--1); color: var(--text-dim); }
.opt-list { display: grid; gap: var(--sp-2); border: 0; margin: 0; padding: 0; min-width: 0; }
.opt { display: grid; grid-template-columns: 22px 1fr; gap: var(--sp-3); align-items: start; padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; min-height: 48px; }
.opt:hover { background: var(--panel-2); }
.opt input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); }
.opt b { display: block; }
.opt small { color: var(--text-dim); }
.opt .tag { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--primary); margin-left: 0.4em; }
.opt:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 7%, var(--panel)); }
.opt:has(input:focus-visible) { box-shadow: var(--ring); }
.sign-btn { width: 100%; min-height: 48px; font-size: var(--step-1); white-space: normal; }
.footnotes { list-style: none; margin: 0; padding: var(--sp-3) 0 0; border-top: 1px solid var(--border); display: grid; gap: var(--sp-2); font-size: 0.8rem; color: var(--text-dim); }
.footnotes li { display: grid; grid-template-columns: 18px 1fr; gap: var(--sp-2); }
.footnotes .icon-svg { color: var(--text-faint); margin-top: 2px; }
.signed-box { border-radius: var(--radius); background: var(--ok-dim); padding: var(--sp-4); }
.signed-box ul { margin: var(--sp-2) 0 0; padding-left: 1.1rem; font-size: var(--step--1); }

/* ---- Performance: compare view -------------------------------------------- */
.view-tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-pill); }
.view-tabs button { font: inherit; font-weight: 600; font-size: var(--step--1); padding: 0.4rem 1rem; min-height: 38px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-dim); cursor: pointer; }
.view-tabs button[aria-selected="true"] { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
.chart-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); position: relative; }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--step--1); color: var(--text-dim); }
.chart-legend span { display: inline-flex; align-items: center; gap: 0.5em; }
.chart-legend i { width: 18px; height: 0; border-top: 2px solid; display: inline-block; }
.chart-legend i.s1 { border-color: var(--series-1); } .chart-legend i.s2 { border-color: var(--series-2); }
.chart-legend i.th { border-top: 1px dashed var(--text-dim); }
.chart-legend i.prov { border-top: 2px dashed var(--text-faint); }
.rating-chart { display: block; width: 100%; height: auto; direction: ltr; touch-action: pan-y; }
.rating-chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.rating-chart .axis text { fill: var(--text-dim); font-size: 11px; font-family: var(--font-sans); }
.rating-chart .threshold { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 5 4; }
.rating-chart .threshold-label { fill: var(--text-dim); font-size: 11px; font-weight: 600; }
.rating-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rating-chart .line.s1 { stroke: var(--series-1); } .rating-chart .line.s2 { stroke: var(--series-2); }
.rating-chart .line.provisional { stroke-dasharray: 3 5; }
.rating-chart .pt { stroke: var(--panel); stroke-width: 2; }
.rating-chart .pt.s1 { fill: var(--series-1); } .rating-chart .pt.s2 { fill: var(--series-2); }
.rating-chart .pt.hollow { fill: var(--panel); stroke-width: 2; }
.rating-chart .pt.hollow.s1 { stroke: var(--series-1); } .rating-chart .pt.hollow.s2 { stroke: var(--series-2); }
.rating-chart .end-label { font-size: 14px; font-weight: 650; fill: var(--text); }
.rating-chart .end-name { font-size: 11px; fill: var(--text-dim); }
.rating-chart .annot line { stroke: var(--text-faint); stroke-width: 1; }
.rating-chart .annot circle { fill: var(--panel); stroke: var(--series-2); stroke-width: 2; }
.rating-chart .annot text { fill: var(--text); font-size: 11px; font-weight: 600; }
.rating-chart .annot text.sub { fill: var(--text-dim); font-weight: 400; }
.rating-chart .crosshair { stroke: var(--text-faint); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-2); padding: var(--sp-2) var(--sp-3); font-size: var(--step--1); min-width: 180px; }
.chart-tip .tip-row { display: flex; align-items: center; gap: var(--sp-2); }
.chart-tip i { width: 14px; height: 0; border-top: 2px solid; display: inline-block; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart-table summary { cursor: pointer; font-size: var(--step--1); color: var(--primary); font-weight: 600; margin-top: var(--sp-3); min-height: 32px; }
.pcards { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
@media (max-width: 900px) { .pcards { grid-template-columns: 1fr; } }
.pcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.pcard-head { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; flex-wrap: wrap; }
.pcard-head h3 { margin: 0; font-size: var(--step-2); display: flex; align-items: center; gap: 0.5em; }
.pcard-head h3 i { width: 18px; height: 0; border-top: 3px solid; display: inline-block; border-radius: 2px; }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.stat-tile { background: var(--panel-2); border-radius: var(--radius); padding: var(--sp-3); }
.stat-tile .v { font-size: var(--step-3); font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-tile .k { font-size: 0.75rem; color: var(--text-dim); }
.milestones { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-2); }
.milestones li { display: grid; grid-template-columns: 92px 1fr; gap: var(--sp-3); font-size: var(--step--1); }
.milestones time { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.outcome-strip { border-radius: var(--radius); padding: var(--sp-3) var(--sp-4); font-weight: 600; display: flex; gap: var(--sp-2); align-items: flex-start; margin-top: auto; }
.outcome-strip.good { background: var(--ok-dim); color: var(--text); }
.outcome-strip.good .icon-svg { color: var(--ok); flex: none; margin-top: 2px; }
.outcome-strip.watch { background: var(--warn-dim); color: var(--text); }
.outcome-strip.watch .icon-svg { color: var(--warn); flex: none; margin-top: 2px; }
.closing-band { text-align: center; }
.closing-band .big-line { font-size: clamp(1.3rem, 2.6vw, 1.9rem); line-height: 1.35; font-weight: 500; color: var(--ink-text); margin: 0 auto; max-width: 44ch; text-wrap: balance; }
.closing-band .big-line b { font-weight: 700; color: var(--ink-accent); }
.closing-band p { margin: var(--sp-3) auto 0; }

/* ---- Provider home --------------------------------------------------------- */
.ph-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin: 0; }
.ph-head .sub { color: var(--text-dim); margin: var(--sp-1) 0 0; }
.ph-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: var(--sp-5); align-items: start; }
@media (max-width: 960px) { .ph-grid { grid-template-columns: 1fr; } }
.next-step { background: var(--panel); border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: var(--sp-5) var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-4); box-shadow: var(--shadow-2); min-width: 0; }
@media (max-width: 560px) { .next-step { padding: var(--sp-4); } }
.next-step-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.next-step .kicker { color: var(--primary); }
.due-chip { display: inline-flex; align-items: center; gap: 0.4em; padding: 0.3rem 0.75rem; border-radius: var(--radius-pill); background: var(--warn-dim); color: var(--warn); font-weight: 650; font-size: var(--step--1); }
.due-chip.calm { background: var(--panel-3); color: var(--text); }
.due-chip.danger { background: var(--danger-dim); color: var(--danger); }
.next-step-main { display: grid; grid-template-columns: auto 1fr; gap: var(--sp-5); align-items: center; }
@media (max-width: 560px) { .next-step-main { grid-template-columns: 1fr; } }
.next-step h2 { font-size: var(--step-3); margin: 0 0 var(--sp-2); letter-spacing: -0.015em; }
.next-step .lede { margin: 0; color: var(--text-dim); font-size: var(--step-1); }
.next-step .lede b { color: var(--text); }
.ring .ring-track { stroke: var(--panel-3); }
.ring .ring-fill { stroke: var(--primary); }
.ring .ring-text { font-size: 20px; font-weight: 650; fill: var(--text); font-family: var(--font-sans); }
.ring-cap { text-align: center; font-size: 0.75rem; color: var(--text-dim); margin-top: 4px; }
.action-rows { display: grid; gap: var(--sp-2); }
.action-row { display: grid; grid-template-columns: 24px 1fr auto; gap: var(--sp-3); align-items: center; padding: var(--sp-3) var(--sp-4); border-radius: var(--radius); }
.action-row.todo { background: var(--warn-dim); }
.action-row.todo > .icon-svg { color: var(--warn); }
.action-row.done { background: var(--ok-dim); }
.action-row.done > .icon-svg { color: var(--ok); }
.action-row b { display: block; }
.action-row small { color: var(--text-dim); }
@media (max-width: 480px) { .action-row { grid-template-columns: 24px 1fr; } .action-row .btn { grid-column: 2; justify-self: start; } }
.next-step-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.next-step-foot small { display: inline-flex; gap: 0.4em; align-items: center; }
.licence-card { background: var(--ink); color: var(--ink-text); border-radius: var(--radius-lg); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); border: 1px solid var(--ink-line); }
.licence-card .no { font-family: var(--font-mono); font-size: 1.05rem; letter-spacing: 0.03em; color: var(--ink-text); }
.licence-card .chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.licence-card .lchip { font-size: var(--step--1); padding: 2px 10px; border-radius: var(--radius-pill); border: 1px solid var(--ink-line); color: var(--ink-text); }
.licence-card a { color: var(--ink-accent); font-weight: 600; display: inline-flex; gap: 0.4em; align-items: center; min-height: 40px; }
.ahead { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); }
.dim-bars { display: grid; gap: var(--sp-3); }
.dim-bar { display: grid; grid-template-columns: 140px 1fr 40px; gap: var(--sp-3); align-items: center; font-size: var(--step--1); }
.dim-bar .k b { font-weight: 600; } .dim-bar .k small { color: var(--text-faint); margin-left: 0.3em; }
.dim-bar .bar { height: 8px; border-radius: 999px; background: var(--panel-3); overflow: hidden; }
.dim-bar .bar span { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.dim-bar.low .bar span { background: var(--warn); }
.dim-bar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 480px) { .dim-bar { grid-template-columns: 110px 1fr 34px; } }
.ph-lower { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-5); }
@media (max-width: 960px) { .ph-lower { grid-template-columns: 1fr; } }
.big-score { font-size: 2.6rem; font-weight: 650; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---- Buyer rating, phone first -------------------------------------------- */
.rate-shell { display: grid; grid-template-columns: minmax(0, 560px) minmax(260px, 1fr); gap: var(--sp-6); align-items: start; }
@media (max-width: 900px) { .rate-shell { grid-template-columns: 1fr; } }
.rate-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.rate-head h1 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.2rem); }
.rate-head .who { color: var(--text-dim); font-size: var(--step--1); margin-top: 2px; }
.time-chip { display: inline-flex; align-items: center; gap: 0.35em; padding: 0.25rem 0.65rem; border-radius: var(--radius-pill); background: var(--panel-3); font-weight: 600; font-size: var(--step--1); white-space: nowrap; }
.rate-contract { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-4); display: grid; gap: 2px; }
.rate-contract b { font-size: var(--step-1); }
.rate-contract .meta { color: var(--text-dim); font-size: var(--step--1); }
.rate-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.rate-row { padding: var(--sp-4); border-top: 1px solid var(--border); }
.rate-row:first-child { border-top: 0; }
.rate-row-top { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.rate-label b { display: block; font-size: var(--step-0); }
.rate-label small { color: var(--text-dim); }
.rate-label .w { color: var(--text-faint); font-size: 0.75rem; margin-left: 0.35em; font-weight: 500; }
.star-btns { display: inline-flex; gap: 2px; direction: ltr; }
.star-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; color: var(--border-strong); padding: 0; }
.star-btn svg { width: 30px; height: 30px; }
.star-btn.lit { color: #d99a12; }
.star-btn:hover { background: var(--panel-2); }
.star-btn:focus-visible { box-shadow: var(--ring); }
.rate-more { margin-top: var(--sp-2); font-size: var(--step--1); color: var(--text-dim); }
.rate-more summary { cursor: pointer; color: var(--primary); font-weight: 600; min-height: 32px; display: inline-flex; align-items: center; }
.rate-reason { margin-top: var(--sp-3); }
.rate-reason label { font-size: var(--step--1); font-weight: 600; color: var(--text-dim); display: block; margin-bottom: 4px; }
.hl-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.chip-toggle { font: inherit; font-size: var(--step--1); padding: 0.45rem 0.85rem; min-height: 44px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-dim); cursor: pointer; }
.chip-toggle[aria-pressed="true"] { border-color: var(--primary); color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--panel)); }
.rehire-group { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.privacy-line { display: flex; gap: var(--sp-2); align-items: flex-start; font-size: var(--step--1); color: var(--text-dim); margin: 0; }
.privacy-line .icon-svg { color: var(--text-faint); margin-top: 2px; flex: none; }
.send-btn { width: 100%; min-height: 52px; font-size: var(--step-1); }
.send-dock { position: sticky; bottom: 0; padding: var(--sp-3) 0 var(--sp-4); background: var(--bg); z-index: 4; border-top: 1px solid var(--border); }
@media (max-width: 480px) {
  .rate-page.container { padding-inline: var(--sp-4); padding-top: var(--sp-5); }
  .rate-page .rate-row { padding: var(--sp-3); }
  .rate-page .rate-row-top { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .rate-page .star-btns { justify-content: space-between; }
  .rate-page .rate-head h1 { font-size: 1.5rem; }
}
@media (min-width: 481px) and (max-width: 900px) { body:has(.rate-page) .chat-launch { bottom: 112px; } }

/* ---- Story & close (presenter pages) -------------------------------------- */
body[data-face="story"] main { padding-bottom: var(--sp-7); }
.story-hero { padding: clamp(2rem, 5vw, 4rem); }
.story-hero h1 { font-size: clamp(2rem, 4.4vw, 3.3rem); line-height: 1.12; letter-spacing: -0.025em; max-width: 20ch; margin: var(--sp-3) 0 var(--sp-4); }
.story-hero .lead { font-size: var(--step-1); max-width: 62ch; line-height: 1.6; margin: 0; }
.pills { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-5); }
.pill-principle { display: inline-flex; align-items: center; gap: 0.5em; padding: 0.4rem 0.9rem; border-radius: var(--radius-pill); border: 1px solid var(--ink-line); color: var(--ink-text); font-size: var(--step--1); font-weight: 500; }
.pill-principle .icon-svg { color: var(--ink-accent); }
.loop-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
@media (max-width: 1000px) { .loop-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .loop-cards { grid-template-columns: 1fr; } }
.loop-card { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5); border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.loop-card:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-2); }
.loop-card .num { font-family: var(--font-mono); font-size: var(--step--1); color: var(--text-faint); }
.loop-card h3 { margin: 0; font-size: var(--step-2); display: flex; align-items: center; gap: 0.5em; }
.loop-card h3 .icon-svg { color: var(--primary); }
.loop-card p { margin: 0; color: var(--text-dim); font-size: var(--step-0); }
.loop-card .gains { margin-top: auto; padding-top: var(--sp-3); border-top: 1px solid var(--border); font-size: var(--step--1); color: var(--text); }
.loop-card .gains b { color: var(--primary); font-weight: 650; }
.loop-card .go { font-size: var(--step--1); color: var(--primary); font-weight: 600; display: inline-flex; gap: 0.3em; align-items: center; }
.return-arc { display: block; width: 100%; height: 56px; color: var(--text-faint); }
.return-arc path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-dasharray: 6 6; }
.return-arc polygon { fill: currentColor; }
.arc-label { text-align: center; color: var(--text-dim); font-size: var(--step-0); margin: -4px 0 0; }
@media (max-width: 560px) { .return-arc { display: none; } .arc-label { margin-top: 0; } }
.two-panels { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
@media (max-width: 860px) { .two-panels { grid-template-columns: 1fr; } }
.two-panels > * { padding: var(--sp-6); border-radius: var(--radius-lg); }
@media (max-width: 560px) { .two-panels > * { padding: var(--sp-5); } .ink-band { padding: var(--sp-5); } }
.two-panels h2 { font-size: var(--step-2); line-height: 1.3; margin: var(--sp-2) 0 var(--sp-4); }
.num-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--sp-3); counter-reset: n; }
.num-list li { display: grid; grid-template-columns: 30px 1fr; gap: var(--sp-3); counter-increment: n; }
.num-list li::before { content: counter(n); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--step--1); background: var(--panel-3); color: var(--text); }
.ink-band .num-list li::before { background: var(--ink-2); color: var(--ink-accent); }
.num-list li b { display: block; }
.light-panel { background: var(--panel); border: 1px solid var(--border); }
.story-foot { display: flex; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; font-size: var(--step--1); color: var(--text-dim); border-top: 1px solid var(--border); padding-top: var(--sp-4); }
.close-h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.15; letter-spacing: -0.02em; max-width: 24ch; margin: var(--sp-2) 0 var(--sp-3); }
.close-lead { font-size: var(--step-1); color: var(--text-dim); max-width: 66ch; margin: 0; }
.change-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.change-table th { text-align: left; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); padding: var(--sp-3) var(--sp-4); background: var(--panel-2); }
.change-table td { padding: var(--sp-4); border-top: 1px solid var(--border); vertical-align: top; }
.change-table td:first-child { font-weight: 650; white-space: nowrap; }
.change-table td.today { color: var(--text-dim); }
.change-table td.with { display: grid; grid-template-columns: 20px 1fr; gap: var(--sp-2); }
.change-table td.with .icon-svg { color: var(--ok); margin-top: 2px; }
@media (max-width: 720px) {
  .change-table thead { display: none; }
  .change-table tr { display: grid; border-top: 1px solid var(--border); padding: var(--sp-3) 0; }
  .change-table tr:first-child { border-top: 0; }
  .change-table td { border-top: 0; padding: var(--sp-1) var(--sp-4); }
  .change-table td.today::before { content: "Today: "; font-weight: 600; }
}
.measures { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-3); }
@media (max-width: 1000px) { .measures { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .measures { grid-template-columns: 1fr; } }
.measure { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2); }
.measure b { font-size: var(--step-1); }
.measure p { margin: 0; color: var(--text-dim); font-size: var(--step--1); }
.measure .target { margin-top: auto; padding-top: var(--sp-3); font-size: var(--step--1); color: var(--text); font-weight: 600; border-top: 1px solid var(--border); }
.ask-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--sp-6); align-items: center; }
@media (max-width: 860px) { .ask-grid { grid-template-columns: 1fr; } }
.ask-grid .decides { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 650; letter-spacing: -0.02em; line-height: 1.15; margin: var(--sp-2) 0 0; color: var(--ink-text); }

/* ---- Arabic preview: right-to-left ---------------------------------------- */
[dir="rtl"] body { font-family: "IBM Plex Sans Arabic", var(--font-sans); }
[dir="rtl"] .mono, [dir="rtl"] code, [dir="rtl"] .mono-ref, [dir="rtl"] .tabnum { direction: ltr; unicode-bidi: isolate; }
[dir="rtl"] .eyebrow, [dir="rtl"] .kicker, [dir="rtl"] .stat-label, [dir="rtl"] .loop-k, [dir="rtl"] .portal-nav .nav-group { letter-spacing: 0; }
[dir="rtl"] .portal-nav .nav-right { margin-left: 0; margin-right: auto; }
[dir="rtl"] .portal-nav .nav-group { border-left: 0; border-right: 1px solid var(--border); margin-left: 0; margin-right: var(--sp-2); padding: 0 var(--sp-3) 0 var(--sp-1); }
[dir="rtl"] .nav-more-menu, [dir="rtl"] .persona-menu { right: auto; left: 0; }
[dir="rtl"] .persona-item { text-align: right; }
[dir="rtl"] .persona-item small { margin-left: 0; margin-right: auto; }
[dir="rtl"] .proto-badge { left: auto; right: var(--sp-4); }
[dir="rtl"] .toast-stack { right: auto; left: var(--sp-5); }
[dir="rtl"] .chat-launch, [dir="rtl"] .chat-panel { right: auto; left: var(--sp-5); }
[dir="rtl"] .timeline { padding-left: 0; padding-right: var(--sp-6); }
[dir="rtl"] .timeline::before { left: auto; right: 10px; }
[dir="rtl"] .timeline .tl-item::before { left: auto; right: calc(-1 * var(--sp-6) + 5px); }
[dir="rtl"] .stepper .step::before { right: -50%; left: 50%; }
[dir="rtl"] table.data thead th, [dir="rtl"] .change-table th { text-align: right; }
[dir="rtl"] .loop-cell + .loop-cell, [dir="rtl"] .band-card > div + div { border-left: 0; border-right: 1px solid var(--border); }
[dir="rtl"] .ai-rationale { border-left: 0; border-right: 2px solid var(--primary-dim); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
[dir="rtl"] .quote { border-left: 0; border-right: 3px solid var(--border-strong); border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
[dir="rtl"] .reply-box { border-left: 0; border-right: 3px solid var(--primary); border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; margin-right: var(--sp-5); }
[dir="rtl"] .dim-bar .v, [dir="rtl"] .num { text-align: left; }
[dir="rtl"] .rate-label .w, [dir="rtl"] .opt .tag, [dir="rtl"] .case-steps .cs-t em { margin-left: 0; margin-right: 0.35em; }
@media (max-width: 900px) { [dir="rtl"] .loop-cell:nth-child(3) { border-right: 0; } }
@media (max-width: 480px) { [dir="rtl"] .loop-cell + .loop-cell { border-right: 0; } }
.ring-wrap { display: inline-flex; flex-direction: column; align-items: center; justify-self: start; }

/* Phone header: keep every control reachable in 390px. The story link and the
   persona's name fold away; the language toggle shows only the language you'd
   switch to; the theme toggle steps aside on the narrowest screens. */
@media (max-width: 560px) {
  .brand .brand-logo { height: 26px; padding: 3px 5px; }
  .persona .persona-name { display: none; }
  .demo-switch a.quiet, .demo-switch .switch-sep { display: none; }
  .demo-switch { padding: 2px; }
  .demo-switch a { padding: 0.3rem 0.45rem; }
  .lang-switch button[aria-pressed="true"] { display: none; }
  .header-actions .btn-sm { padding: 0.3rem 0.45rem; }
}
@media (max-width: 420px) { .header-actions .theme-toggle { display: none; } }
body:has(.rate-page) .proto-badge { bottom: 96px; }
@media (min-width: 901px) { .send-dock { position: static; border-top: 0; background: none; padding-bottom: 0; } body:has(.rate-page) .proto-badge { bottom: var(--sp-4); } body:has(.rate-page) .chat-launch { bottom: var(--sp-5); } }
/* In the Arabic preview the layout mirrors but most content stays English, so
   each block takes its reading direction from its own first words — English
   sentences keep their full stops at the end, Arabic ones read right-to-left. */
[dir="rtl"] main :is(p, h1, h2, h3, h4, li, span, b, small, a, td, th, label, button, div, time, summary, figcaption) { unicode-bidi: plaintext; }
.ink-list { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: grid; gap: var(--sp-2); }
.ink-list li { display: grid; gap: 1px; padding: var(--sp-2) 0; border-top: 1px solid var(--ink-line); }
.ink-list li:first-child { border-top: 0; }
.ink-list a { font-weight: 600; color: var(--ink-accent); }
.ink-list span { font-size: var(--step--1); color: var(--ink-dim); }

/* ============================================================================
   M10 — phone polish, nav fade, DEMO marker
   ========================================================================== */
.portal-nav .lbl-short { display: none; }
.brand { position: relative; }
.brand .demo-mini {
  display: none; position: absolute; left: 2px; bottom: -9px;
  align-items: center; gap: 3px; padding: 0 5px; border-radius: var(--radius-pill);
  font-size: 0.56rem; font-weight: 700; letter-spacing: 0.1em; line-height: 1.5;
  color: var(--warn); background: var(--proto-bg); border: 1px dashed color-mix(in srgb, var(--warn) 55%, transparent);
}
.brand .demo-mini .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }

/* Overflowing nav strips fade at the edge they continue past (direction-aware). */
.portal-nav .nav-scroll.fade-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.portal-nav .nav-scroll.fade-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.portal-nav .nav-scroll.fade-start.fade-end { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }
[dir="rtl"] .portal-nav .nav-scroll.fade-end { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
[dir="rtl"] .portal-nav .nav-scroll.fade-start { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }

@media (max-width: 480px) {
  /* Short labels on the sub-nav: "Contracts · Rate · Tenders", not a three-line stack. */
  .portal-nav .lbl.has-short { display: none; }
  .portal-nav .lbl-short { display: inline; }
  .portal-nav a { white-space: nowrap; }

  /* The assistant folds to a 48px icon; the PROTOTYPE badge moves into the header. */
  .chat-launch { width: 48px; height: 48px; padding: 0; justify-content: center; border-radius: 50%; right: var(--sp-4); bottom: var(--sp-4); }
  .chat-launch .lbl { display: none; }
  .proto-badge { display: none; }
  .brand .demo-mini { display: inline-flex; }

  /* Toasts drop in under the header so they never cover a bottom button. */
  .toast-stack { top: calc(var(--header-h) + var(--sp-2)); bottom: auto; left: var(--sp-3); right: var(--sp-3); max-width: none; }

  /* Rating screen: the icon sits above the sticky Send bar, and the stars keep
     clear of the column it floats in. */
  body:has(.rate-page) .chat-launch { bottom: 100px; }
  .rate-page .star-btns { justify-content: flex-start; gap: 2px; padding-inline-end: 52px; }
  .rate-page .send-dock { padding-bottom: var(--sp-3); }
}
@media (max-width: 480px) { [dir="rtl"] .chat-launch { left: var(--sp-4); right: auto; } }
.opt.locked { opacity: 0.6; cursor: not-allowed; }
.more-opts { border-top: 1px dashed var(--border); padding-top: var(--sp-2); }
.more-opts summary { cursor: pointer; font-size: var(--step--1); font-weight: 600; color: var(--text-dim); min-height: 36px; display: flex; align-items: center; }
.more-opts .opt-list { margin-top: var(--sp-2); }
.action-row.info { background: var(--panel-2); }
.action-row.info > .icon-svg { color: var(--primary); }
.licence-card.preview { border-style: dashed; }
.licence-card.preview .no { font-family: var(--font-sans); font-size: var(--step-0); color: var(--ink-dim); }
.dim-bar { grid-template-columns: 168px 1fr 40px; }
@media (max-width: 480px) { .dim-bar { grid-template-columns: 132px 1fr 34px; } }
