/* Commercial OS PWA — the one shared stylesheet (identity, shell, components). No external resources: the fonts are
   self-hosted under /fonts/ (SIL OFL 1.1, licence files beside them) and the approved organization marks live in /brand/.

   IDENTITY (owner directive 2026-12-05 §3, docs/FINAL_BUILD_PLAN.md §4)
   - Commercial OS itself (sign-in, picker, system, owner view): neutral charcoal / grey / white, text wordmark only.
   - body[data-org="amaq"] or any container with class .org-amaq: GF Libya blue #1B539A · #7AAEEE · #C6DFFF · #15191D · #F5F5F5.
   - body[data-org="hm"]   or any container with class .org-hm:   Cash Station ink #0B0F0C, palette C′ greys, electric green
     #40FC05 ONLY as a small signal on the dark frame (stripe, active nav/tab mark, bell count, primary-button icon, focus halo).
     Green is never text on white and never a large fill.
   - A dark frame (top bar, desktop side rail, phone tab bar) around a light work area, for every context.

   TOKENS (use these names in view CSS; never a hex colour that belongs to an organization)
     text      --ink --ink-2 --muted              surfaces  --paper (page) --surface (cards) --sunken (wells, tracks)
     lines     --line (dividers) --line-2 (stronger dividers) --control (input/button borders, 3:1)
     brand     --accent (fills under white text) --accent-strong (text/links on white) --accent-soft (selected/tinted bg)
               --accent-line (border on --accent-soft) --primary-icon (icon inside .btn-primary)
     frame     --frame --frame-2 (hover) --frame-3 (selected) --on-frame --on-frame-2 --frame-accent --stripe
     state     --ok/--ok-bg --warn/--warn-bg --danger/--danger-bg   focus --focus --focus-halo
     shape     --radius --radius-sm   sizes --topbar-h --tabbar-h   fonts --font --mono

   COMPONENT VOCABULARY (shared by every view; views add only their own layout in views-*.css)
     page      .page(.page-narrow) > .page-head(.eyebrow, h1, .page-desc, .page-actions) + .page-body
     layout    .grid-2 .grid-3 (1 column on phone)   .split > .split-list + .split-detail (+ .has-selection on phone)
     panels    .panel > .panel-head(h2) + .panel-body   .notice(-info/-ok/-warn/-error)   .empty (centered icon + text)
     figures   .kpi-grid > .kpi(.kpi-na) > .kpi-label .kpi-value .kpi-sub   .stat-row > .stat   progress.meter
     boards    .board > .board-col > .board-col-head(.board-count) + .board-card(a|button) > .board-card-title .board-card-meta
     lists     .list > .list-item > .list-main(.list-title, .list-meta) + .list-side   .timeline > .tl-item > .tl-time + .tl-body
     tables    .table-wrap > .table(.table-stack on phone)   .kv > .kv-row(dt, dd)
     controls  .btn(-primary/-quiet/-danger/-small)  .toolbar  .seg > button[aria-pressed]  .form-grid > .field(label, .input|.select, .field-hint)
     chips     .chip(-ok/-warn/-danger/-accent/-locked/-muted/-synthetic)   text .muted .small .mono .num
   Breakpoints: phone ≤ 760px (bottom tab bar, single column), tablet ≤ 1023px. Touch targets 44px on coarse pointers. */

/* ------------------------------------------------------------------ fonts (self-hosted, SIL OFL 1.1: /fonts/*-OFL.txt) */
@font-face { font-family: "COS Cairo"; src: url('/fonts/Cairo-w400.ttf') format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "COS Cairo"; src: url('/fonts/Cairo-w500.ttf') format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "COS Cairo"; src: url('/fonts/Cairo-w600.ttf') format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "COS Cairo"; src: url('/fonts/Cairo-w700.ttf') format("truetype"); font-weight: 700 800; font-style: normal; font-display: swap; }
/* IBM Plex Sans draws Latin letters, digits and Latin punctuation only (it is listed first, so it wins for them).
   Spaces are left out of the range on purpose, so the spaces between Arabic words come from Cairo. */
@font-face { font-family: "COS Plex"; src: url('/fonts/IBMPlexSans-Variable.ttf') format("truetype"); font-weight: 100 700; font-style: normal; font-display: swap;
  unicode-range: U+0021-007E, U+00A1-00FF, U+0131, U+0152-0153, U+2010-2027, U+2030-205E, U+20AC, U+2122, U+2212; }

/* ------------------------------------------------------------------ tokens (DARK LUXURY, DECISIONS 70): three identities
   Values and contrast audit: docs/evidence/ux/dark-tokens.md. Light values of the previous look: tag ux-transform-start. */
/* ------------------------------------------------------------------ Commercial OS neutral (default) */
:root {
  /* text */
  --ink: #eef0f2;
  --ink-2: #c3c8cd;
  --muted: #a2a8ae;
  /* lines */
  --line: #2c2f33;               /* dividers (decorative) */
  --line-2: #3d4146;             /* stronger dividers, meter track */
  --control: #858b92;            /* input / outline-button borders: >= 3:1 on every surface below */
  /* surfaces */
  --paper: #0b0c0e;              /* page base under the glows */
  --surface: #17181a;            /* opaque card = --glass over --paper */
  --surface-raised: #1d1f22;     /* opaque dialog / sheet / toast (fallback for --glass-strong) */
  --sunken: #0f1012;             /* wells: inputs, tracks, code boxes */
  --tint: #222428;               /* hover breath */
  /* states (shared by all identities; ok is a mint-teal so it never reads as Cash Station green) */
  --ok: #6fdcae;      --ok-bg: #0f2a20;      --ok-line: #3c9a71;      --ok-ink: #d2f5e4;
  --warn: #f4bd5c;    --warn-bg: #2c2110;    --warn-line: #a7792a;    --warn-ink: #fbe6bf;
  --danger: #ff9890;  --danger-bg: #33171a;  --danger-line: #b8514a;  --danger-ink: #ffdad6;
  --danger-fill: #b8322a; --danger-strong: #8e211b; --on-danger: #ffffff;
  --ok-on-frame: #8fe3bd;
  /* brand */
  --accent: #eceef0;             /* primary fill (light pill) */
  --accent-hover: #ffffff;
  --accent-press: #d3d6da;
  --accent-edge: #eceef0;
  --on-accent: #0b0c0e;
  --accent-strong: #ffffff;      /* links, eyebrow, chip-accent text */
  --accent-soft: #26292d;        /* selected / tinted background */
  --accent-line: #5d636a;
  --accent-mark: #d8dbdf;        /* graphical marks: meter, bar, spinner, selected edges, switch on */
  --primary-icon: #0b0c0e;
  --primary-icon-bg: transparent;
  /* frame */
  --frame: #0e0f11;
  --frame-2: #1d1f22;
  --frame-3: #2b2e32;
  --frame-glass: rgb(14 15 17 / .84);
  --on-frame: #f4f5f6;
  --on-frame-2: #b0b6bc;
  --frame-accent: #ffffff;
  --stripe: #4a4f55;
  --focus: #ffffff;
  --focus-halo: #6d747b;
  /* internal notes + free-text flag (warm, deliberately unlike any customer message) */
  --note-bg: #241d10;  --note-line: #b8913f;  --note-ink: #f6e5bd;  --note-tag: #6b4e12;
  --note-flag-bg: #33250b;  --note-strong: #d9a441;  --note-icon: #f0c060;  --note-input: #1a150c;
  --mark: #6e5710;               /* search highlight; text inside keeps the light ink */
  --mark-tile: #ffffff;          /* the approved organization mark keeps its white tile */
  /* switches + quota levels */
  --switch-off: #0f1012;  --switch-knob: #c3c8cd;  --switch-on: #eceef0;  --switch-knob-on: #0b0c0e;
  --lvl-warn: #e0a53a;  --lvl-degrade: #ee8a3c;
  /* messages */
  --bubble-in: #1b1d20;  --bubble-in-line: #34383d;  --bubble-out: #25292e;  --bubble-out-line: #4a5057;
  /* luxury layer */
  --glass: rgb(255 255 255 / .045);
  --glass-strong: rgb(24 26 29 / .9);
  --glass-line: rgb(255 255 255 / .09);
  --glass-blur: blur(18px) saturate(140%);
  --glow-1: rgb(75 0 130 / .34);       /* indigo #4B0082 — ambient only */
  --glow-2: rgb(0 229 255 / .08);      /* cyan #00E5FF — ambient only */
  --pattern-line: rgb(255 255 255 / .018);
  --na-hatch: rgb(255 255 255 / .045);
  --scrim: rgb(3 4 5 / .66);
  --shadow-c1: rgb(0 0 0 / .45);
  --shadow-c2: rgb(0 0 0 / .62);
  --shadow-1: 0 1px 2px var(--shadow-c1), 0 10px 28px rgb(0 0 0 / .28);
  --shadow-2: 0 2px 6px var(--shadow-c1), 0 28px 72px var(--shadow-c2);
  --edge-light: linear-gradient(90deg, transparent, rgb(75 0 130 / .9) 30%, rgb(0 229 255 / .75) 70%, transparent);
  --page-bg:
    radial-gradient(1100px 680px at 100% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 620px at 0% 112%, var(--glow-2), transparent 60%),
    repeating-linear-gradient(135deg, var(--pattern-line) 0 1px, transparent 1px 22px),
    var(--paper);
  /* hero KPI tiles: greys/white only for the neutral identity */
  --hero-1: #eceef0;  --on-hero-1: #0b0c0e;  --hatch-1: rgb(11 12 14 / .10);
  --hero-2: #a9afb5;  --on-hero-2: #0b0c0e;  --hatch-2: rgb(11 12 14 / .12);
  --hero-3: #3d4146;  --on-hero-3: #ffffff;  --hatch-3: rgb(255 255 255 / .10);
  --hero-4: #1d1f22;  --on-hero-4: #ffffff;  --hatch-4: rgb(255 255 255 / .08);
  /* shape */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --topbar-h: 59px;
  --tabbar-h: 60px;
  --font: "COS Plex", "COS Cairo", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ GF Libya (amaq) — #1B539A #7AAEEE #C6DFFF #15191D #F5F5F5 */
body[data-org="amaq"], .org-amaq {
  --ink: #f5f5f5;  --ink-2: #c9d3df;  --muted: #acbacb;
  --line: #222b36;  --line-2: #324051;  --control: #7893b5;
  --paper: #0c1015;  --surface: #15191d;  --surface-raised: #1a2028;  --sunken: #0f1318;  --tint: #1d242d;
  --accent: #1b539a;  --accent-hover: #2361b0;  --accent-press: #174883;  --accent-edge: #7aaeee;  --on-accent: #f5f5f5;
  --accent-strong: #7aaeee;  --accent-soft: #15283f;  --accent-line: #3a6497;  --accent-mark: #7aaeee;
  --primary-icon: #c6dfff;  --primary-icon-bg: transparent;
  --frame: #0d1116;  --frame-2: #19212a;  --frame-3: #22303f;  --frame-glass: rgb(13 17 22 / .84);
  --on-frame: #f5f5f5;  --on-frame-2: #adbccd;  --frame-accent: #7aaeee;  --stripe: #7aaeee;
  --focus: #f5f5f5;  --focus-halo: #3f77bd;
  --switch-on: #7aaeee;  --switch-knob-on: #15191d;  --switch-off: #0f1318;  --switch-knob: #c9d3df;
  --bubble-in: #171d24;  --bubble-in-line: #2c3846;  --bubble-out: #15283f;  --bubble-out-line: #2f5687;
  --glass: rgb(198 223 255 / .038);
  --glass-strong: rgb(21 25 29 / .9);
  --glass-line: rgb(198 223 255 / .11);
  --glow-1: rgb(27 83 154 / .26);       /* #1B539A (capped by the two-layer glass audit) */
  --glow-2: rgb(122 174 238 / .1);      /* #7AAEEE */
  --pattern-line: rgb(198 223 255 / .022);
  --na-hatch: rgb(198 223 255 / .05);
  --edge-light: linear-gradient(90deg, transparent, rgb(122 174 238 / .85) 50%, transparent);
  --page-bg:
    radial-gradient(1100px 680px at 100% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 620px at 0% 112%, var(--glow-2), transparent 60%),
    repeating-linear-gradient(135deg, var(--pattern-line) 0 1px, transparent 1px 22px),
    var(--paper);
  /* hero tiles: the five palette values only (image 3's multi-hue cards yield to the binding palette) */
  --hero-1: #1b539a;  --on-hero-1: #f5f5f5;  --hatch-1: rgb(198 223 255 / .14);
  --hero-2: #7aaeee;  --on-hero-2: #15191d;  --hatch-2: rgb(21 25 29 / .12);
  --hero-3: #c6dfff;  --on-hero-3: #15191d;  --hatch-3: rgb(27 83 154 / .14);
  --hero-4: #f5f5f5;  --on-hero-4: #15191d;  --hatch-4: rgb(27 83 154 / .12);
}

/* ------------------------------------------------------------------ Cash Station (hm) — ink #0B0F0C, C′ greys, white; green = signal only */
body[data-org="hm"], .org-hm {
  --ink: #f4f5f5;  --ink-2: #c5c9ca;  --muted: #a3a6a7;
  --line: #262626;  --line-2: #393939;  --control: #808586;
  --paper: #070908;  --surface: #121413;  --surface-raised: #191c1a;  --sunken: #0b0f0c;  --tint: #1d211f;
  --accent: #f2f3f3;  --accent-hover: #ffffff;  --accent-press: #d6d9d9;  --accent-edge: #f2f3f3;  --on-accent: #0b0f0c;
  --accent-strong: #ffffff;  --accent-soft: #222624;  --accent-line: #52585a;  --accent-mark: #e4e6e6;
  --primary-icon: #40fc05;  --primary-icon-bg: #0b0f0c;   /* green glyph on an ink disc inside the white pill */
  --frame: #0b0f0c;  --frame-2: #1d211f;  --frame-3: #2d312f;  --frame-glass: rgb(11 15 12 / .84);
  --on-frame: #ffffff;  --on-frame-2: #a9adae;  --frame-accent: #40fc05;  --stripe: #40fc05;
  --focus: #ffffff;  --focus-halo: #40fc05;
  --switch-on: #f2f3f3;  --switch-knob-on: #0b0f0c;  --switch-off: #0b0f0c;  --switch-knob: #c5c9ca;
  --bubble-in: #181b19;  --bubble-in-line: #313533;  --bubble-out: #242826;  --bubble-out-line: #4a4f4d;
  --glass: rgb(255 255 255 / .042);
  --glass-strong: rgb(18 20 19 / .9);
  --glass-line: rgb(255 255 255 / .08);
  --glow-1: rgb(255 255 255 / .07);     /* white/grey only: no green glow, no purple */
  --glow-2: rgb(157 157 157 / .06);
  --pattern-line: rgb(255 255 255 / .018);
  --na-hatch: rgb(255 255 255 / .045);
  --edge-light: linear-gradient(90deg, transparent, rgb(255 255 255 / .55) 50%, transparent);
  --page-bg:
    radial-gradient(1100px 680px at 100% -12%, var(--glow-1), transparent 62%),
    radial-gradient(900px 620px at 0% 112%, var(--glow-2), transparent 60%),
    repeating-linear-gradient(135deg, var(--pattern-line) 0 1px, transparent 1px 22px),
    var(--paper);
  --hero-1: #f2f3f3;  --on-hero-1: #0b0f0c;  --hatch-1: rgb(11 15 12 / .10);
  --hero-2: #9d9d9d;  --on-hero-2: #0b0f0c;  --hatch-2: rgb(11 15 12 / .12);
  --hero-3: #393939;  --on-hero-3: #ffffff;  --hatch-3: rgb(255 255 255 / .10);
  --hero-4: #0b0f0c;  --on-hero-4: #ffffff;  --hatch-4: rgb(255 255 255 / .08);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-strong); }
h1, h2, h3 { margin: 0; line-height: 1.35; letter-spacing: 0; }
p { margin: 0; }
.mono, code { font-family: var(--mono); font-size: 0.86em; }
.num { font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.flip { transform: scaleX(-1); }

/* focus: an ink outline with the organization's halo inside it (green on HM, light blue on GF Libya, grey when neutral) */
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 4px var(--focus-halo); border-radius: 4px; }
[tabindex="-1"]:focus { outline: none; box-shadow: none; }        /* headings/main receive focus programmatically on navigation */
.code-id { overflow-wrap: normal; word-break: normal; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { min-height: 100vh; min-height: 100dvh; }
.splash, .loading { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.splash { justify-content: center; min-height: 60vh; }
.loading { padding: 14px 4px; font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.noscript { padding: 24px; }

.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--radius-sm); background: var(--ink); color: var(--paper); font-weight: 600; cursor: pointer; }
.skip:focus { top: 8px; }

/* ------------------------------------------------------------------ buttons, inputs, chips */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--control); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: var(--ink-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary .ico { color: var(--primary-icon); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); border-color: var(--danger-strong); }
.btn-danger-quiet { color: var(--danger); border-color: var(--danger-line); }
.btn-danger-quiet:hover:not(:disabled) { border-color: var(--danger); }
.btn-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover:not(:disabled) { border-color: transparent; background: var(--sunken); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); }
.link { background: none; border: 0; padding: 6px 0; color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13.5px; }

.input {
  width: 100%; min-height: 40px; padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--control); background: var(--surface);
}
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); box-shadow: 0 0 0 4px var(--focus-halo); }
.input:disabled { background: var(--sunken); color: var(--muted); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
.input-mono { font-family: var(--mono); }
.input-code { font-family: var(--mono); font-size: 22px; letter-spacing: .35em; text-align: center; }
.select { padding-inline-end: 28px; }
.select-sm { min-height: 34px; width: auto; min-width: 110px; padding-block: 4px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label { font-weight: 600; font-size: 13.5px; }
.field-hint { font-size: 12.5px; color: var(--muted); }
.form { display: grid; gap: 14px; }
.check-row { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.checkbox { width: 18px; height: 18px; accent-color: var(--accent); }

.chip, .chip-synthetic, .chip-muted {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.chip .ico { width: 13px; height: 13px; }
.chip-accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.chip-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-sim { background: var(--sunken); border-style: dashed; }
.chip-muted { background: var(--sunken); border-color: var(--line); color: var(--muted); }
/* test data marker: small, neutral, the same in every organization */
.chip-synthetic { background: var(--sunken); border: 1px dashed var(--control); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.status-draft { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.status-approved { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.status-retired { background: var(--sunken); color: var(--muted); }
.badge { display: inline-block; padding: 0 7px; border-radius: 5px; font-size: 12.5px; font-weight: 700; line-height: 1.7; }
.badge-handover { background: var(--warn-bg); color: var(--warn); }
.count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--sunken); font-size: 13.5px; margin-block: 10px; }
.notice .ico { margin-top: 2px; }
.notice-body { min-width: 0; overflow-wrap: anywhere; }
.notice-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.notice-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }

/* ------------------------------------------------------------------ top bar: the dark frame + organization context */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--frame); color: var(--on-frame); padding-top: env(safe-area-inset-top); --focus: var(--on-frame); --focus-halo: var(--frame-accent); }
.stripe { height: 3px; background: var(--stripe); }
.topbar-inner {
  display: flex; align-items: center; gap: 12px; height: 56px;
  padding-right: max(16px, env(safe-area-inset-right)); padding-left: max(16px, env(safe-area-inset-left));
}
.spacer { flex: 1; }
.org-badge { display: inline-flex; align-items: center; gap: 10px; min-width: 0; padding: 4px; margin-inline-start: -4px; border-radius: var(--radius-sm); color: inherit; }
.org-badge-btn { border: 1px solid transparent; background: transparent; cursor: pointer; text-align: start; padding: 4px 8px 4px 6px; min-height: 44px; }
.org-badge-btn:hover { background: var(--frame-2); }
/* the approved organization mark sits on a white tile, so it keeps its own colours on any background */
.org-mark { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 4px; border-radius: 9px; background: var(--mark-tile); border: 1px solid var(--line); }
.org-mark img { display: block; width: 100%; height: 100%; object-fit: contain; }
.org-mono {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font: 700 13px/1 var(--font); letter-spacing: .04em; direction: ltr;
}
.topbar .org-mono { background: var(--mark-tile); color: var(--frame); }
.topbar .org-mark { border-color: transparent; }
.org-text { display: grid; min-width: 0; line-height: 1.3; }
.org-brand { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .org-sub { color: var(--on-frame-2); }
.org-chev { color: var(--on-frame-2); }
/* Commercial OS's own name: a text wordmark, never a drawn logo */
.wordmark { font-weight: 700; font-size: 16px; letter-spacing: .01em; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.wordmark-os { font-weight: 500; color: var(--on-frame-2); }
.env-tag { display: inline-flex; align-items: center; font-size: 12.5px; color: var(--on-frame-2); border: 1px solid var(--frame-3); padding: 1px 10px; border-radius: 999px; white-space: nowrap; line-height: 1.6; }
.env-short { display: none; }
.bell { position: relative; display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: var(--radius-sm); color: var(--on-frame); text-decoration: none; flex: none; }
.bell .ico { width: 20px; height: 20px; }
.bell:hover, .bell.is-active { background: var(--frame-2); }
.bell-count {
  position: absolute; top: 3px; inset-inline-end: 1px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--frame-accent); color: var(--frame); border: 2px solid var(--frame);
  font: 700 12px/15px var(--font); text-align: center; font-variant-numeric: tabular-nums; direction: ltr;
}
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: var(--radius-sm); color: var(--on-frame); text-decoration: none; min-height: 44px; }
.user-chip:hover { background: var(--frame-2); }
.avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--frame-3); color: var(--on-frame); font-weight: 700; font-size: 13px; }
.user-text { display: grid; line-height: 1.25; }
.user-handle { font-weight: 600; font-size: 13.5px; }
.user-role { font-size: 12.5px; color: var(--on-frame-2); }
.topbar .btn-quiet { color: var(--on-frame); }
.topbar .btn-quiet:hover:not(:disabled) { background: var(--frame-2); }
.topbar-neutral .stripe { background: var(--stripe); }

/* ------------------------------------------------------------------ layout + side rail (right side in RTL) */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100dvh - var(--topbar-h)); }
.sidenav {
  position: sticky; top: var(--topbar-h); height: calc(100dvh - var(--topbar-h)); overflow-y: auto;
  background: var(--frame); color: var(--on-frame-2); padding: 14px 10px 20px;
  display: flex; flex-direction: column; gap: 16px;
  --focus: var(--on-frame); --focus-halo: var(--frame-accent);
}
.nav-group-label { font-size: 12.5px; font-weight: 600; color: var(--on-frame-2); padding: 0 10px 6px; }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border-radius: var(--radius-sm); color: var(--on-frame-2); text-decoration: none; font-weight: 500; font-size: 14.5px;
}
.nav-link:hover { background: var(--frame-2); color: var(--on-frame); }
.nav-link[aria-current="page"] { background: var(--frame-3); color: var(--on-frame); font-weight: 700; }
.nav-link[aria-current="page"] .ico { color: var(--frame-accent); }
.nav-link[aria-current="page"]::before { content: ""; position: absolute; inset-inline-start: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--frame-accent); }
.nav-system { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--frame-3); }
.main { min-width: 0; padding: 24px 28px 40px; }
.main:focus { outline: none; }
.main-neutral { max-width: 1040px; margin-inline: auto; width: 100%; }
.tabbar { display: none; }

/* ------------------------------------------------------------------ pages */
.page { max-width: 1120px; }
.page-narrow { max-width: 760px; }
.page-head { margin-bottom: 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; row-gap: 6px; }
.page-head > * { grid-column: 1; }
.page-head > .page-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.eyebrow { font-size: 12.5px; font-weight: 600; color: var(--accent-strong); }
.page-head h1, .pane-title h1 { font-size: 22px; font-weight: 700; }
.page-desc { color: var(--muted); max-width: 70ch; }
.page-body { display: grid; gap: 14px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; font-weight: 600; text-decoration: none; min-height: 36px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.panel-body { padding: 14px 16px; }
.panel-danger { border-color: var(--danger-line); }
.panel-danger .panel-head { background: var(--danger-bg); color: var(--danger-ink); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.subnav-link { border: 1px solid var(--control); background: var(--surface); border-radius: 999px; padding: 4px 12px; min-height: 34px; cursor: pointer; font-size: 13px; font-weight: 600; }
.subnav-link:hover { border-color: var(--accent); color: var(--accent-strong); }

/* responsive grids (children are usually .panel or .kpi) */
.grid-2, .grid-3 { display: grid; gap: 14px; align-items: start; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 > .panel, .grid-3 > .panel { margin-bottom: 0; }

/* figures: one KPI = a label, a value and an optional sub-line. Unavailable is shown as text, never as 0. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; align-content: start; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.kpi-value { font-size: 24px; font-weight: 700; line-height: 1.3; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.kpi-na { background: var(--sunken); border-style: dashed; border-color: var(--line-2); }
.kpi-na .kpi-value { font-size: 15px; font-weight: 600; color: var(--muted); padding-block: 5px; }

/* simple bar charts / progress: a thin horizontal meter in the organization colour */
progress.meter {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; margin: 0;
  border: 0; border-radius: 999px; background: var(--line); color: var(--accent); overflow: hidden;
}
progress.meter::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress.meter::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress.meter::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* boards: columns side by side (horizontal scroll when they do not fit, always on phones) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: start; scroll-snap-type: x proximity; overscroll-behavior-x: contain; }
.board-col { background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 0; scroll-snap-align: start; }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-weight: 700; font-size: 13.5px; min-width: 0; }
.board-count { margin-inline-start: auto; min-width: 26px; padding: 0 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 12.5px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.board-card {
  display: grid; gap: 4px; width: 100%; min-height: 44px; margin: 0; padding: 10px 12px; text-align: start;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: inherit; text-decoration: none; cursor: pointer; -webkit-appearance: none; appearance: none;
}
.board-card:hover { border-color: var(--control); background: var(--tint); }
.board-card[aria-current="true"], .board-card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.board-card-title { font-weight: 600; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.board-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12.5px; color: var(--muted); }

/* lists: rows with a main part (title over meta) and a side part (status, time, actions) */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel > .list, .panel-body > .list { border: 0; border-radius: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.list > li:last-child > .list-item, .list > .list-item:last-child { border-bottom: 0; }
a.list-item, button.list-item { width: 100%; margin: 0; border-inline: 0; border-top: 0; background: transparent; font: inherit; text-align: start; cursor: pointer; }
a.list-item:hover, button.list-item:hover { background: var(--tint); }
.list-item[aria-current="true"], .list-item[aria-current="page"] { background: var(--accent-soft); }
.list-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.list-title { font-weight: 600; overflow-wrap: anywhere; }
.list-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--muted); }
.list-side { flex: none; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); text-align: end; font-variant-numeric: tabular-nums; }

/* filters / search row above a list or board */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.toolbar > .input, .toolbar > .search { flex: 1 1 220px; width: auto; min-width: 0; }
.toolbar > .select, .toolbar .select { width: auto; min-width: 140px; }
.toolbar > .field { flex: 0 1 auto; }
.toolbar > .seg { align-self: center; }

/* segmented control: one choice of a few (period, view). Selected = aria-pressed="true". */
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: calc(var(--radius-sm) + 3px); background: var(--sunken); border: 1px solid var(--line); }
.seg > button { min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.seg > button:hover { background: var(--surface); color: var(--ink); }
.seg > button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* timeline: time column + event text */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; }
.tl-item { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.tl-body { min-width: 0; overflow-wrap: anywhere; font-size: 14px; display: grid; gap: 2px; }

/* list/detail: two panes on desktop; on phones one pane (the view toggles .has-selection on .split) */
.split { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 14px; align-items: start; }
.split > * { min-width: 0; }

.kv { display: grid; gap: 0; margin: 0; }
.kv-row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; }

.empty-state { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-state .ico { width: 34px; height: 34px; stroke-width: 1.4; color: var(--control); }
.empty-state h2 { color: var(--ink); font-size: 16px; }
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 20px; color: var(--muted); }
.empty:not(.list-msg) > .ico { width: 32px; height: 32px; stroke-width: 1.5; color: var(--control); }
.empty:not(.list-msg) :is(h2, h3, strong) { color: var(--ink); font-size: 15px; }

/* ------------------------------------------------------------------ inbox */
.main-inbox { padding: 0; }
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: calc(100dvh - var(--topbar-h)); }
.pane { min-width: 0; min-height: 0; }
.list-pane { display: flex; flex-direction: column; border-inline-end: 1px solid var(--line); background: var(--surface); }
.pane-head { display: flex; align-items: flex-end; gap: 10px; padding: 18px 16px 8px; }
.pane-title { flex: 1; display: grid; gap: 2px; }
.pane-note { display: flex; align-items: center; gap: 6px; padding: 0 16px 10px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.pane-note .ico { width: 14px; height: 14px; }
.conv-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.list-msg { padding: 12px 16px; }
.list-msg.empty { display: grid; justify-items: center; gap: 6px; color: var(--muted); padding: 40px 16px; text-align: center; }
.conv {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; align-items: start;
  padding: 12px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; min-height: 64px;
}
.conv:hover { background: var(--tint); }
.conv[aria-current="true"] { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent); }
.conv:focus-visible { outline-offset: -2px; }
.ch-ico { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--sunken); color: var(--ink-2); }
.ch-ico .ico { width: 17px; height: 17px; }
.conv-main { display: grid; min-width: 0; gap: 2px; }
.conv-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.conv-ch { font-weight: 700; font-size: 14px; }
.conv-id { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { color: var(--ink-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-meta { display: grid; justify-items: end; gap: 4px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.thread-pane { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.thread-pane > .loading { padding: 20px; }
.thread { display: flex; flex-direction: column; min-height: 0; height: 100%; }
/* conversation header = a compact title row (.thread-bar, the only part pinned on phones) + a details row (.thread-head) */
.thread-bar { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 20px 0; background: var(--surface); }
.thread-bar h2 { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 16px; font-weight: 700; }
.thread-bar h2:focus { outline: none; }
.thread-bar .ch-ico { width: 28px; height: 28px; flex: none; }
.thread-head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 4px 20px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.thread-id { font-weight: 500; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.thread-sub { flex: 1; min-width: 0; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.thread-actions { display: flex; gap: 8px; }
.thread-missing { padding: 20px; }
.back-btn { display: none; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; margin-inline-start: -8px; font-weight: 600; text-decoration: none; }
.thread-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 372px; }
.thread-msgs { display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.day-sep { align-self: center; font-size: 12.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; margin: 4px 0; }
.msg { display: grid; gap: 3px; max-width: min(560px, 86%); }
.msg-in { align-self: flex-start; }
.msg-out { align-self: flex-end; }
.msg-bubble {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; border-start-start-radius: 4px;
  padding: 9px 13px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.7;
}
.msg-out .msg-bubble { border-start-start-radius: 14px; border-start-end-radius: 4px; background: var(--accent-soft); }
.msg-meta { font-size: 12.5px; color: var(--muted); padding-inline: 4px; }
.empty-inline { padding: 20px 0; }

/* the sealed composer: where a reply box would normally be, a quiet locked band */
.sealed {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-top: 1px solid var(--line-2); background: var(--sunken); color: var(--ink-2);
}
.sealed .ico { width: 20px; height: 20px; color: var(--ink); }
.sealed div { display: grid; gap: 1px; }
.sealed strong { font-size: 13.5px; color: var(--ink); }
.sealed span { font-size: 12.5px; }

.assist { border-inline-start: 1px solid var(--line); background: var(--surface); overflow-y: auto; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 10px; }
.assist-head { display: flex; align-items: center; gap: 8px; }
.assist-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; flex: 1; }
.assist-head h2 .ico { color: var(--accent); }
.assist-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); background: var(--sunken); border-radius: var(--radius-sm); padding: 8px 10px; }
.assist-note .ico { width: 15px; height: 15px; margin-top: 3px; }
.assist-note strong { color: var(--ink); }
.assist-mode { font-size: 12.5px; color: var(--muted); }
.assist-mode:empty { display: none; }
.assist-controls .btn-row { margin-top: 0; }
.sugg-slot:empty { display: none; }
.hist-head { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.hist-head h3 { font-size: 13.5px; font-weight: 700; }

.verdict { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 5px; font-size: 12.5px; font-weight: 700; line-height: 1.7; white-space: nowrap; }
.verdict-proposed { background: var(--ok-bg); color: var(--ok); }
.verdict-handover { background: var(--warn-bg); color: var(--warn); }
.verdict-blocked { background: var(--danger-bg); color: var(--danger); }
.verdict-unknown { background: var(--sunken); color: var(--ink-2); }
.verdict-review { background: var(--warn-bg); color: var(--warn); }
.sugg-review { border-color: var(--warn-line); }
.chip-state-new { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-state-dup { background: var(--sunken); color: var(--ink-2); }
.chip-state-transient { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
/* problems come BEFORE the suggested text; model free text gets its own unmissable flag */
.free-text-flag { display: flex; gap: 10px; align-items: flex-start; margin: 10px 12px 0; padding: 10px 12px; border: 1px solid var(--note-strong); border-radius: var(--radius-sm); background: var(--note-flag-bg); color: var(--note-ink); }
.free-text-flag .ico { width: 20px; height: 20px; color: var(--note-icon); margin-top: 1px; }
.free-text-flag div { display: grid; gap: 2px; }
.free-text-flag strong { font-size: 14.5px; }
.free-text-flag span { font-size: 13px; }
.sugg-problems { margin: 10px 12px 0; padding: 8px 12px 10px; background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); color: var(--note-ink); }
.sugg-problems-title { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.sugg-problems-title .ico { width: 15px; height: 15px; }
.sugg-problems .problems li { font-size: 13px; }
.sugg-problems .code-id { color: var(--warn-ink); font-size: 12.5px; }
.problem-free { font-weight: 700; }
.sugg-text-free { border: 1px dashed var(--note-strong); }
.sugg { border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
/* verdict is carried by the badge; the card only takes a quiet full-border tint (no one-sided accent stripe) */
.sugg-proposed { border-color: var(--ok-line); }
.sugg-handover { border-color: var(--warn-line); }
.sugg-blocked { border-color: var(--danger-line); }
.sugg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 12px 0; }
.sugg-kind { font-size: 12.5px; color: var(--muted); }
.sugg-text { margin: 10px 12px; padding: 10px 12px; background: var(--paper); border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.75; }
.sugg-meta { margin: 0 12px 10px; display: grid; gap: 8px; }
.sugg-meta > div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; }
.sugg-meta dt { font-size: 12.5px; color: var(--muted); padding-top: 1px; }
.sugg-meta dd { margin: 0; font-size: 13px; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; overflow-wrap: anywhere; }
.sugg-meta dd .mono { color: var(--muted); font-size: 12.5px; }
.problems, .refs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; width: 100%; }
.problems li, .refs li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.sugg-foot { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); background: var(--paper); }
.sugg-foot .ico { width: 14px; height: 14px; }
.history { display: grid; gap: 6px; }
.hist { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); min-width: 0; overflow: hidden; }
.assist { overflow-x: hidden; }
.sugg-meta dd > .code-id { flex-basis: 100%; }
.hist summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; min-height: 44px; list-style-position: inside; }
.hist-intent { flex: 1; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-time { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-body { border-top: 1px solid var(--line); }
.hist-prov { margin: 0 12px 10px; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ agent */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 4px; }
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.stat-accent { border-color: var(--accent-line); background: var(--accent-soft); }
.stat-accent .stat-value { color: var(--accent-strong); }
.stat-danger { border-color: var(--danger-line); background: var(--danger-bg); }
.stat-danger .stat-value { color: var(--danger); }
.stat-locked { background: var(--sunken); border-style: dashed; }
.mode-set { border: 0; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.mode-opt { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--control); border-radius: var(--radius); cursor: pointer; }
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt:has(input:disabled) { cursor: not-allowed; opacity: .72; }
.mode-opt input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.mode-text { display: grid; gap: 2px; }
.mode-title { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.mode-desc { font-size: 13px; color: var(--muted); }
.section-msg:empty { display: none; }

/* ------------------------------------------------------------------ knowledge */
.src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.src { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.src-main { min-width: 0; display: grid; gap: 4px; }
.src-title { font-size: 15px; font-weight: 700; }
.src-sub { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: var(--muted); }
.ver-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; justify-items: stretch; }
.ver { display: flex; align-items: center; gap: 8px; padding: 4px 10px; min-height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--line); color: inherit; text-decoration: none; }
.ver:hover { border-color: var(--accent); background: var(--accent-soft); }
.ver-n { font-family: var(--mono); font-weight: 700; font-size: 13px; direction: ltr; }
.ver-date { font-size: 12.5px; color: var(--muted); }
.detail-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field-wide { grid-column: 1 / -1; }
.form-panel { border-color: var(--accent-line); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: start; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--sunken); }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td .chip { margin-inline-start: 6px; }
.table td.num, .table th.num { text-align: end; font-variant-numeric: tabular-nums; }
.cell-text { display: block; max-width: 52ch; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ org settings */
.toggle-row { display: flex; gap: 16px; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); }
.toggle-text { display: grid; gap: 2px; min-width: 0; }
.toggle-title { font-weight: 700; }
.toggle-desc { font-size: 13px; color: var(--muted); max-width: 64ch; }
.toggle-row .select { width: auto; min-width: 170px; }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0;
  border-radius: 999px; background: var(--switch-off); border: 0; cursor: pointer; transition: background .15s;
}
.switch::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--switch-knob); box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: inset-inline-start .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { inset-inline-start: 21px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.quota-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 16px; }
.quota { display: grid; gap: 6px; }
.quota-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quota-name { font-weight: 600; }
.chip-unknown { background: var(--sunken); border-style: dashed; border-color: var(--control); color: var(--ink-2); }
.quota-note { font-size: 13px; color: var(--muted); }
.bar { position: relative; height: 10px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); overflow: visible; }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--accent); min-inline-size: 0; }
.bar-fill.lvl-warn { background: var(--lvl-warn); }
.bar-fill.lvl-degrade { background: var(--lvl-degrade); }
.bar-fill.lvl-stop { background: var(--danger); }
.bar-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-inline-start: -1px; background: var(--ink-2); opacity: .55; border-radius: 1px; }
.quota-nums { display: flex; gap: 12px; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.lvl-chip-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.lvl-chip-warn, .lvl-chip-degrade { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.lvl-chip-stop { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }

/* ------------------------------------------------------------------ picker + switcher + sheets */
.picker { max-width: 640px; margin: 40px auto; display: grid; gap: 14px; }
.picker h1 { font-size: 22px; }
.org-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.org-choice {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px;
  border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none;
}
.org-choice .org-text { flex: 1; }
.org-choice .org-mark { width: 44px; height: 44px; padding: 5px; }
.org-choice .org-mono { width: 44px; height: 44px; }
.org-choice:hover, .org-choice[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.org-choices-lg .org-choice { min-height: 76px; }
.picker-links { display: flex; flex-wrap: wrap; gap: 8px; }

dialog { color: var(--ink); }
dialog::backdrop { background: var(--scrim); }
.dialog, .sheet { border: 1px solid var(--line); border-radius: 14px; padding: 0; width: min(460px, calc(100vw - 32px)); background: var(--surface); box-shadow: 0 18px 50px var(--shadow-c2); }
.dialog { overflow: hidden; }
.sheet { overflow-y: auto; }
/* every dialog inside an organization starts with the company band (dark frame + its signal colour) */
.dialog-brand { display: flex; align-items: center; gap: 8px; padding: 8px 20px; background: var(--frame); color: var(--on-frame); font-weight: 700; font-size: 13.5px; }
.dialog-brand-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--frame-accent); flex: none; }
.dialog-title { font-size: 17px; font-weight: 700; padding: 18px 20px 6px; }
.dialog-body { padding: 0 20px; color: var(--ink-2); display: grid; gap: 8px; }
.dialog-actions { display: flex; gap: 8px; padding: 18px 20px; justify-content: flex-start; }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px 10px; }
.sheet-title { flex: 1; font-size: 16px; font-weight: 700; }
.sheet-body { padding: 0 16px 18px; display: grid; gap: 10px; }
.more-list { list-style: none; margin: 0; padding: 0; display: grid; }
.more-link {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 6px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-decoration: none; font-weight: 600; text-align: start; cursor: pointer;
}
.more-link:hover { background: var(--tint); }
.more-link .ico { color: var(--ink-2); }
.more-danger, .more-danger .ico { color: var(--danger); }
.more-sep { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: 8px; }

/* ------------------------------------------------------------------ auth (neutral: Commercial OS text wordmark only) */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.auth:focus { outline: none; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 22px; display: grid; gap: 14px; box-shadow: 0 1px 2px var(--shadow-c1), 0 12px 32px var(--shadow-c1); }
.auth-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.auth-mark { display: none; }                           /* no invented logo: the product name is the wordmark */
.auth-mark-a, .auth-mark-b { display: none; }
.auth-product { display: block; font-weight: 700; font-size: 18px; direction: ltr; text-align: right; letter-spacing: .01em; }
.auth-env { display: block; font-size: 12.5px; color: var(--muted); }
.auth-title { font-size: 20px; font-weight: 700; }
.auth-sub { color: var(--muted); font-size: 13.5px; }
.auth-foot { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); padding-top: 4px; }
.auth-foot .ico { width: 14px; height: 14px; margin-top: 3px; }
.auth-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.form-error:empty { display: none; }
.secret-box { display: grid; gap: 8px; padding: 12px; background: var(--paper); border-radius: var(--radius-sm); border: 1px solid var(--line); }
.secret-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; }
.secret-label { grid-column: 1 / -1; font-size: 12.5px; color: var(--muted); }
.secret { font-size: 14px; overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.secret-uri { font-size: 12.5px; }
.recovery-list { margin: 0; padding: 12px 34px 12px 12px; background: var(--paper); border-radius: var(--radius-sm); columns: 2; column-gap: 24px; }
.recovery-list code { font-size: 13.5px; }

/* ------------------------------------------------------------------ live region, offline */
/* toasts float ABOVE the "sending disabled" band (desktop) / above the tab bar (phone, where that band is not pinned),
   and never over the pinned conversation title row */
.live { position: fixed; inset-inline: 0; bottom: calc(92px + env(safe-area-inset-bottom)); display: grid; justify-items: center; pointer-events: none; z-index: 60; padding-inline: 16px; }
.toast { pointer-events: auto; display: flex; gap: 8px; align-items: center; max-width: 560px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--frame); color: var(--on-frame); font-size: 13.5px; box-shadow: 0 8px 24px var(--shadow-c2); }
.toast-error { background: var(--danger-strong); color: var(--on-danger); }
.toast-ok .ico { color: var(--ok-on-frame); }
.update-bar {
  position: fixed; inset-inline: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 70; margin-inline: auto; max-width: 540px;
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); background: var(--frame); color: var(--on-frame); font-size: 13.5px; box-shadow: 0 8px 24px var(--shadow-c2);
}
.update-bar span { flex: 1; }
.update-bar .btn { border-color: var(--on-frame); }
.offline-bar { position: sticky; top: 0; z-index: 40; padding: 8px 16px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--warn-bg); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line); font-size: 13px; font-weight: 600; text-align: center; }

/* ------------------------------------------------------------------ Stage 0: shared bits */
.btn-tall { min-height: 48px; font-size: 15px; }
.sub-h { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
.chip-danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip-locked { background: var(--sunken); border-style: dashed; border-color: var(--control); color: var(--ink-2); }
.kv-compact .kv-row { grid-template-columns: 150px minmax(0, 1fr); padding: 6px 0; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.confirm-list { display: grid; gap: 4px; padding: 8px 12px; background: var(--paper); border-radius: var(--radius-sm); font-weight: 600; color: var(--ink); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }

/* one-time secret dialog (enrollment token) */
.dialog-once { width: min(520px, calc(100vw - 32px)); }
.secret-once { font-size: 16px; letter-spacing: .02em; padding: 6px 0; }
.dialog-once .notice { margin-block: 4px; }

/* passkeys */
.add-passkey { border-top: 1px solid var(--line); margin-top: 14px; display: grid; gap: 8px; }
.add-passkey .sub-h { margin-bottom: 0; }

/* agent: a locked mode is shown, never selectable */
.mode-locked { cursor: default; border-style: dashed; background: var(--sunken); }
.mode-lock { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-top: 3px; color: var(--ink-2); flex: none; }
.mode-locked .mode-desc .mono { font-size: 12px; }

/* labels (org settings + inbox) */
.label-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.label-item { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.label-item .mono { color: var(--muted); font-size: 12px; }
.label-chip { display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-strong); font-size: 12.5px; font-weight: 600; line-height: 1.8; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.label-chip .ico { width: 12px; height: 12px; }
.label-form, .invite-form { border-top: 1px solid var(--line); margin-top: 14px; }
.label-form .sub-h, .invite-form .sub-h { margin-bottom: 0; }

/* send cost guard */
.guard-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.guard { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 10px; min-width: 0; }
.guard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.guard-ch { font-weight: 700; }
.guard-id { color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.guard-head .chip { margin-inline-start: auto; white-space: normal; }
.cost-ready_for_review { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.cost-cap_reached { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.cost-free_tier_unverified, .cost-payment_absence_unattested { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.guard-real { padding: 10px 12px; border-radius: var(--radius-sm); border: 1px dashed var(--control); background: var(--sunken); display: grid; gap: 6px; }
.guard-real-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guard-real .problems li { font-size: 13px; }
.guard-edit { border-top: 1px solid var(--line); padding-top: 8px; }
.guard-edit summary { display: flex; align-items: center; gap: 6px; min-height: 40px; cursor: pointer; font-weight: 600; color: var(--accent-strong); }
.guard-edit-body { display: grid; gap: 8px; padding-top: 6px; }
.input-num { max-width: 160px; font-variant-numeric: tabular-nums; }
.guard-trip { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; display: grid; gap: 6px; }
.guard-trip-on { border-color: var(--danger-line); background: var(--danger-bg); }
.guard-trip-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.guard-trip-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }

/* inbox: search + filters */
.list-tools { display: grid; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 4px; }
.search-input { min-height: 38px; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-items: end; }
.filter { display: grid; gap: 2px; min-width: 0; }
.filter label { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter .select-sm { width: 100%; min-width: 0; font-size: 13px; padding-inline: 8px 22px; text-overflow: ellipsis; }
.filters-clear { grid-column: 1 / -1; justify-self: start; padding: 2px 0; }
.search-results { overflow-y: auto; flex: 1; padding: 10px 16px 16px; display: grid; gap: 12px; align-content: start; }
.results-head { display: flex; align-items: center; gap: 8px; }
.results-head h2 { flex: 1; font-size: 14.5px; font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.results-head h2:focus { outline: none; }
.results-group h3 { font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hit { display: grid; gap: 3px; padding: 8px 10px; min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: inherit; text-decoration: none; background: var(--surface); }
.hit:hover { border-color: var(--accent); background: var(--accent-soft); }
.hit-note { border-style: dashed; border-color: var(--note-line); background: var(--note-bg); }
.hit-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.hit-kind { font-weight: 600; }
.hit-conv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hit-time { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.hit-body { font-size: 13.5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.conv-tags { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.conv-tags:empty { display: none; }
.conv-assignee { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--ink-2); }
.conv-assignee .ico { width: 12px; height: 12px; }
.st-open { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.st-pending { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.st-resolved { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }

/* inbox: side column = management + internal notes + AI assistant */
.thread-side { border-inline-start: 1px solid var(--line); background: var(--surface); overflow-y: auto; overflow-x: hidden; min-height: 0; }
.thread-side .assist { border-inline-start: 0; border-top: 1px solid var(--line); overflow: visible; }
.wb, .notes-panel { padding: 16px 18px; display: grid; gap: 10px; }
.wb h2, .notes-head h2 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.wb h2 .ico { color: var(--accent); }
.wb-body { display: grid; gap: 10px; }
.wb-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; border: 0; margin: 0; padding: 0; min-width: 0; }
.wb-label { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0; }
.wb-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.wb-ctl .select { flex: 1 1 140px; min-width: 0; min-height: 36px; padding-block: 4px; }
.wb-ctl .notice { flex-basis: 100%; margin: 0; }
.wb-pipeline-off { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); background: var(--sunken); border: 1px dashed var(--control); border-radius: var(--radius-sm); padding: 6px 8px; }
.wb-pipeline-off .ico { width: 14px; height: 14px; margin-top: 3px; }
.wb-labels { display: block; }
.wb-labels legend { padding: 0; margin-bottom: 6px; }
.label-toggles { gap: 6px; }
.label-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; min-height: 34px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 13px; cursor: pointer; }
.label-toggle:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); font-weight: 600; }
.label-toggle .checkbox { width: 16px; height: 16px; }
.label-row { display: flex; flex-wrap: wrap; gap: 4px; }
.notes-panel { border-top: 1px solid var(--line); }
.notes-head { display: flex; align-items: center; gap: 8px; }
.notes-head h2 { flex: 1; }
.notes-head h2 .ico { color: var(--note-icon); }
/* internal notes look deliberately different from customer messages: warm paper, dashed edge, "internal" tag */
.internal-flag { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--note-ink); background: var(--note-flag-bg); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); padding: 8px 10px; }
.internal-flag .ico { width: 15px; height: 15px; margin-top: 3px; }
.notes { display: grid; gap: 8px; }
.note { border: 1px dashed var(--note-line); background: var(--note-bg); border-radius: var(--radius-sm); padding: 8px 10px; display: grid; gap: 4px; min-width: 0; }
.note-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.note-tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--note-tag); color: var(--note-ink); font-size: 12px; font-weight: 700; line-height: 1.7; }
.note-author { color: var(--ink-2); font-weight: 600; }
.note-time { margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.7; }
.note-form { display: grid; gap: 6px; }
.note-label { font-weight: 600; font-size: 13.5px; }
.note-input { background: var(--note-input); border-style: dashed; }
.note-form-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.note-form .btn-row { margin-top: 0; }
.btn-note { background: var(--note-flag-bg); border-color: var(--note-strong); color: var(--note-ink); }
.btn-note:hover:not(:disabled) { border-color: var(--note-icon); }

/* ------------------------------------------------------------------ tablet */
@media (max-width: 1279px) {
  .thread-body { display: block; overflow-y: auto; }
  .thread-msgs { min-height: auto; }
  .messages { overflow: visible; }
  .assist { border-inline-start: 0; border-top: 1px solid var(--line); overflow: visible; }
  .thread-side { border-inline-start: 0; border-top: 1px solid var(--line); overflow: visible; }
}
@media (max-width: 1023px) {
  .layout { grid-template-columns: 212px minmax(0, 1fr); }
  .inbox { grid-template-columns: 290px minmax(0, 1fr); }
  .main { padding: 18px 20px 36px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); }
  .user-text { display: none; }
}

/* ------------------------------------------------------------------ phone (≤ 760px): bottom tab bar, single column */
@media (max-width: 760px) {
  :root { --topbar-h: 57px; }
  body { font-size: 16px; }
  .topbar-inner { height: 54px; gap: 6px; padding-right: max(10px, env(safe-area-inset-right)); padding-left: max(6px, env(safe-area-inset-left)); }
  .org-brand { font-size: 15.5px; }
  .org-sub { display: none; }
  .org-mark, .org-mono { width: 34px; height: 34px; }
  .env-tag { padding: 0 8px; font-size: 12px; }
  .env-long { display: none; }
  .env-short { display: inline; }
  .user-text { display: none; }
  .user-chip { min-width: 44px; min-height: 44px; justify-content: center; padding: 4px; }
  .layout { display: block; min-height: 0; }
  .sidenav { display: none; }
  .main { padding: 16px max(16px, env(safe-area-inset-right)) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
  .main-neutral { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
    position: fixed; inset-inline: 0; bottom: 0; z-index: 25;
    background: var(--frame); border-top: 1px solid var(--frame-3);
    padding-bottom: env(safe-area-inset-bottom); padding-right: env(safe-area-inset-right); padding-left: env(safe-area-inset-left);
    --focus: var(--on-frame); --focus-halo: var(--frame-accent);
  }
  .tab {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--tabbar-h); min-width: 44px; padding: 6px 2px 4px;
    border: 0; background: transparent; color: var(--on-frame-2); text-decoration: none; font-size: 12px; font-weight: 600; cursor: pointer;
    white-space: nowrap; overflow: hidden;
  }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .tab .ico { width: 22px; height: 22px; }
  .tab.is-active { color: var(--on-frame); }
  .tab.is-active .ico { color: var(--frame-accent); stroke-width: 2.2; }
  .tab.is-active::before { content: ""; position: absolute; top: 0; inset-inline: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--frame-accent); }
  .tab:focus-visible { outline-offset: -3px; }
  .update-bar { bottom: calc(var(--tabbar-h) + 12px + env(safe-area-inset-bottom)); }
  .live { bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); }

  .main-inbox { padding: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .inbox { display: block; height: auto; }
  .list-pane { border-inline-end: 0; min-height: calc(100dvh - var(--topbar-h) - var(--tabbar-h)); }
  .conv-list { overflow: visible; }
  .conv { min-height: 72px; padding-inline: max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-left)); }
  .inbox .thread-pane { display: none; }
  .inbox.has-selection .list-pane { display: none; }
  .inbox.has-selection .thread-pane { display: block; }
  .thread { height: auto; }
  /* only the 48px title row is pinned; dates, state and the takeover button scroll away with the content */
  .thread-bar {
    position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 5; height: 48px; min-height: 0; gap: 4px;
    padding: 0 max(16px, env(safe-area-inset-left)) 0 max(4px, env(safe-area-inset-right)); border-bottom: 1px solid var(--line);
  }
  .thread-bar h2 { font-size: 15.5px; }
  .back-btn { display: inline-flex; justify-content: center; width: 44px; height: 44px; padding: 0; margin: 0; flex: none; }
  .back-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .thread-head { padding: 8px 16px 12px; gap: 8px 10px; }
  .thread-actions { flex-basis: 100%; }
  .thread-actions .btn { width: 100%; min-height: 44px; }
  .thread-body { display: block; overflow: visible; }
  .messages { padding: 16px; }
  .msg { max-width: 92%; }
  .sealed { padding: 10px 16px; }
  .assist { padding: 16px; }
  .assist-controls .btn { flex: 1 1 100%; min-height: 44px; }

  .page-head { grid-template-columns: minmax(0, 1fr); }
  .page-head > .page-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 6px; }
  .page-head h1, .pane-title h1 { font-size: 20px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi-value { font-size: 21px; }
  .board { grid-auto-columns: minmax(78%, 1fr); margin-inline: calc(-1 * max(16px, env(safe-area-inset-right))) calc(-1 * max(16px, env(safe-area-inset-left))); padding-inline: max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-left)); scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
  .list-item { padding: 12px 14px; gap: 10px; }
  .list-item:has(.list-side .btn) { flex-wrap: wrap; }
  .toolbar > .input, .toolbar > .search, .toolbar > .select, .toolbar .select, .toolbar > .field { flex: 1 1 100%; width: 100%; }
  .toolbar > .seg { align-self: stretch; }
  .seg { display: flex; }
  .seg > button { flex: 1 1 auto; min-height: 40px; }
  .tl-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split.has-selection > .split-list { display: none; }
  .split:not(.has-selection) > .split-detail { display: none; }
  .stat-row { grid-template-columns: 1fr; }
  .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .src { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .toggle-row { align-items: flex-start; }
  .toggle-row:has(select) { flex-direction: column; align-items: stretch; }
  .toggle-row .select { width: 100%; }
  .sugg-meta > div { grid-template-columns: 1fr; gap: 2px; }
  .table-wrap { overflow: visible; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
  .table-stack tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  .table-stack td { padding: 3px 0; border: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: center; }
  .table-stack td::before { content: attr(data-label); font-size: 12.5px; color: var(--muted); }
  .picker { margin: 16px auto; }

  .sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); max-height: 85dvh; }
  .recovery-list { columns: 1; }

  /* Stage 0 on phones: every control is a 44px target, stacked where it would otherwise squeeze */
  .list-tools { padding-inline: max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-left)); }
  .search-input, .select-sm, .wb-ctl .select { min-height: 44px; }
  .search .icon-btn { width: 44px; height: 44px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .filter:first-child { grid-column: 1 / -1; }
  .filters-clear { min-height: 44px; }
  .search-results { overflow: visible; padding-inline: max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-left)); }
  .results-head .btn { min-height: 44px; }
  .hit { min-height: 56px; }
  .wb, .notes-panel { padding: 16px; }
  .wb-row { grid-template-columns: 1fr; gap: 4px; }
  .wb-ctl .btn { min-height: 44px; }
  .label-toggle { min-height: 44px; padding-inline: 12px; }
  .note-form .btn, .btn-note { width: 100%; min-height: 44px; }
  .kv-compact .kv-row { grid-template-columns: 1fr; gap: 2px; }
  .guard-head .chip { margin-inline-start: 0; }
  .guard-edit summary { min-height: 44px; }
  .input-num { max-width: none; }
  .cell-actions .btn { min-height: 44px; flex: 1 1 auto; }
  .dialog-once { width: calc(100vw - 24px); }
  .dialog-once .btn { min-height: 44px; }
  .page-actions .btn { min-height: 44px; }
}
@media (pointer: coarse) {
  .btn, .input, .icon-btn, .subnav-link, .ver, .back-link { min-height: 44px; }
  .label-toggle, .guard-edit summary, .hit, .board-card, .nav-link { min-height: 44px; }
  .seg > button { min-height: 44px; }
  .icon-btn { width: 44px; }
  .select-sm { min-height: 44px; }
  .switch { width: 50px; height: 30px; }
  .switch::after { width: 24px; height: 24px; }
  .switch:checked::after { inset-inline-start: 23px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ================================================================== DARK LUXURY layer (DECISIONS 70): base + components
   Same class vocabulary; these rules restyle the components above for the dark identities. */
html { background: var(--paper); }                       /* canvas colour (overscroll, before CSS vars of body apply) */
body { background: transparent; color: var(--ink); }      /* replaces body { background: var(--paper) } */
/* the luxury page: one fixed, non-interactive layer under everything; org-aware because it inherits from body */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: var(--page-bg);
}
::selection { background: var(--accent-line); color: var(--ink); }
html { scrollbar-color: var(--line-2) transparent; }
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--ink); caret-color: var(--ink);
  box-shadow: 0 0 0 1000px var(--sunken) inset; transition: background-color 9999s;
}
option, optgroup { background: var(--surface-raised); color: var(--ink); }
.spinner { border-color: var(--line-2); border-top-color: var(--accent-mark); }
.checkbox, .mode-opt input { accent-color: var(--accent-mark); }

/* ---------------------------------------------------------------- buttons: pills (image 2) */
.btn {
  border-radius: var(--radius-pill); padding: 0 18px;
  border: 1px solid var(--control); background: transparent; color: var(--ink);
}
.btn:hover:not(:disabled) { border-color: var(--ink-2); background: var(--tint); }
.btn:active:not(:disabled) { background: var(--accent-soft); border-color: var(--accent-line); }
.btn:disabled { opacity: 1; color: var(--muted); border-color: var(--line-2); border-style: dashed; background: transparent; }
.btn-primary {
  background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent);
  box-shadow: inset 0 1px 0 var(--glass-line), var(--shadow-1);
}
/* the icon keeps its box (no layout shift); hm paints an ink disc behind the green glyph with a 3px ring */
.btn-primary .ico { color: var(--primary-icon); background: var(--primary-icon-bg); border-radius: 50%; box-shadow: 0 0 0 3px var(--primary-icon-bg); overflow: visible; }  /* overflow: the radius must not clip glyph corners */
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-edge); }   /* was --accent-strong */
.btn-primary:active:not(:disabled) { background: var(--accent-press); }
.btn-primary:disabled { background: var(--accent-soft); border-color: var(--line-2); color: var(--muted); box-shadow: none; }
.btn-primary:disabled .ico { color: var(--muted); background: transparent; box-shadow: none; }
.btn-danger { background: var(--danger-fill); border-color: var(--danger); color: var(--on-danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-strong); border-color: var(--danger); }
.btn-danger-quiet { color: var(--danger); border-color: var(--danger-line); background: transparent; }
.btn-danger-quiet:hover:not(:disabled) { border-color: var(--danger); background: var(--danger-bg); }
.btn-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.btn-quiet { border-color: transparent; background: transparent; }
.btn-quiet:hover:not(:disabled) { border-color: transparent; background: var(--tint); }
.btn-quiet:disabled { border-color: transparent; }
.btn-small { padding: 0 12px; }
.icon-btn { border-radius: var(--radius-pill); color: var(--ink-2); }
.icon-btn:hover { background: var(--tint); color: var(--ink); }
.link { color: var(--accent-strong); }
.subnav-link { border-radius: var(--radius-pill); border-color: var(--control); background: transparent; color: var(--ink-2); }
.subnav-link:hover { border-color: var(--accent-mark); color: var(--ink); }     /* was --accent / --accent-strong */

/* ---------------------------------------------------------------- segmented control: pill track, pill thumb (1y/6m/1m) */
.seg { border-radius: var(--radius-pill); padding: 4px; gap: 4px; background: var(--sunken); border: 1px solid var(--line-2); }
.seg > button { border-radius: var(--radius-pill); padding: 0 14px; color: var(--ink-2); }
.seg > button:hover { background: var(--tint); color: var(--ink); }
.seg > button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 var(--glass-line), 0 1px 3px var(--shadow-c1); }
.seg > button:disabled { color: var(--muted); cursor: not-allowed; }

/* ---------------------------------------------------------------- inputs: dark wells */
.input { background: var(--sunken); border: 1px solid var(--control); color: var(--ink); }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:hover:not(:disabled) { border-color: var(--ink-2); }
.input:disabled { background: transparent; border-style: dashed; border-color: var(--line-2); color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-hint { color: var(--muted); }

/* ---------------------------------------------------------------- chips: status pills */
.chip, .chip-synthetic, .chip-muted { border-radius: var(--radius-pill); border: 1px solid var(--line-2); background: var(--sunken); color: var(--ink-2); }
.chip-accent, .st-open { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.chip-ok, .status-approved, .chip-state-new, .st-resolved, .lvl-chip-ok, .cost-ready_for_review { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok); }
.chip-warn, .status-draft, .chip-state-transient, .st-pending, .lvl-chip-warn, .lvl-chip-degrade,
.cost-free_tier_unverified, .cost-payment_absence_unattested { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.chip-danger, .lvl-chip-stop, .cost-cap_reached { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.chip-muted, .status-retired { background: transparent; border-color: var(--line-2); color: var(--muted); }
.chip-locked, .chip-unknown, .chip-sim { background: transparent; border: 1px dashed var(--control); color: var(--ink-2); }
/* test-data marker: same in every identity, dashed, never coloured like a state */
.chip-synthetic { background: transparent; border: 1px dashed var(--control); color: var(--ink-2); }
.verdict-proposed { background: var(--ok-bg); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok-line); }
.verdict-handover, .verdict-review, .badge-handover { background: var(--warn-bg); color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn-line); }
.verdict-blocked { background: var(--danger-bg); color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger-line); }
.verdict-unknown { background: var(--sunken); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.label-chip { background: var(--accent-soft); color: var(--accent-strong); }
.label-toggle { border-color: var(--line-2); }
.label-toggle:has(input:checked) { background: var(--accent-soft); border-color: var(--accent-mark); color: var(--accent-strong); }
.board-count { background: var(--sunken); border-color: var(--line-2); color: var(--ink-2); }

/* ---------------------------------------------------------------- notices */
.notice { background: var(--sunken); border-color: var(--line-2); color: var(--ink); }
.notice-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.notice-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.notice-info { background: var(--accent-soft); border-color: var(--accent-line); color: var(--ink); }
.notice-error .ico { color: var(--danger); }
.notice-warn .ico { color: var(--warn); }
.notice-ok .ico { color: var(--ok); }

/* ---------------------------------------------------------------- frame: glass top bar, side rail, phone tab bar */
.topbar {
  background: var(--frame-glass); color: var(--on-frame);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 -1px 0 var(--glass-line);
}
.topbar-neutral .stripe { background: var(--edge-light) center bottom / 100% 1px no-repeat; }  /* neutral: indigo→cyan 1px hairline drawn inside the existing 3px stripe box, so --topbar-h is unchanged */
.topbar .org-mono { background: var(--mark-tile); color: var(--frame); }
.org-mono { background: var(--accent); color: var(--on-accent); }
.org-mark { background: var(--mark-tile); border-color: transparent; }
.org-sub { color: var(--muted); }
.env-tag { border-color: var(--frame-3); color: var(--on-frame-2); }
.bell-count { background: var(--frame-accent); color: var(--frame); border-color: var(--frame); }   /* the hm count badge = green */
.avatar { background: var(--frame-3); color: var(--on-frame); box-shadow: inset 0 0 0 1px var(--glass-line); }
.sidenav {
  background: var(--frame-glass); color: var(--on-frame-2);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 1px 0 0 var(--glass-line);       /* RTL: the rail sits on the right, its content-side edge is lit */
}
.nav-link { border-radius: var(--radius-pill); color: var(--on-frame-2); }
.nav-link:hover { background: var(--frame-2); color: var(--on-frame); }
.nav-link[aria-current="page"] { background: var(--frame-3); color: var(--on-frame); font-weight: 700; box-shadow: inset 0 1px 0 var(--glass-line); }
.nav-link[aria-current="page"] .ico { color: var(--frame-accent); }
.nav-link[aria-current="page"]::before { inset-inline-start: 5px; top: 11px; bottom: 11px; width: 3px; border-radius: 3px; background: var(--frame-accent); }
.nav-system { border-top-color: var(--frame-3); }

/* ---------------------------------------------------------------- glass panels and cards (translucent fill + top light; no blur:
   the page behind them is smooth gradients, so blurring dozens of tiles would cost GPU time for no visible gain) */
.panel, .kpi, .stat, .src, .list, .guard, .sugg, .org-choice, .board-col {
  background: var(--glass); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--glass-line), var(--shadow-1);
}
.panel > .list, .panel-body > .list { background: transparent; box-shadow: none; }
.panel-head { border-bottom-color: var(--line); }
.panel-danger { border-color: var(--danger-line); }
.panel-danger .panel-head { background: var(--danger-bg); color: var(--danger-ink); }
.board-col { background: rgb(0 0 0 / .18); box-shadow: inset 0 1px 0 var(--glass-line); }
.board-card { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.board-card:hover { border-color: var(--control); background: var(--tint); }
.board-card[aria-current="true"], .board-card[aria-pressed="true"] { border-color: var(--accent-mark); box-shadow: inset 0 0 0 1px var(--accent-mark); }
.list-item { border-bottom-color: var(--line); }
a.list-item:hover, button.list-item:hover, .conv:hover, .more-link:hover { background: var(--tint); }
.list-item[aria-current="true"], .list-item[aria-current="page"] { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent-mark); }
.stat-accent { border-color: var(--accent-line); background: var(--accent-soft); }
.stat-accent .stat-value { color: var(--accent-strong); }
.stat-danger { border-color: var(--danger-line); background: var(--danger-bg); }
.stat-danger .stat-value { color: var(--danger); }
.stat-locked, .mode-locked { background: transparent; border: 1px dashed var(--control); }
.mode-opt { border-color: var(--control); }
.mode-opt:has(input:checked) { border-color: var(--accent-mark); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-mark); }
.ver, .hit, .label-item, .hist { background: var(--surface); border-color: var(--line-2); }
.ver:hover, .hit:hover { border-color: var(--accent-mark); background: var(--accent-soft); }
.org-choice:hover, .org-choice[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-mark); }
.table th { background: var(--sunken); color: var(--muted); }
.table th, .table td { border-bottom-color: var(--line); }
.ch-ico, .nt-icon { background: var(--sunken); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.nt-unread { border-inline-start-color: var(--accent-mark); }
.assist-head h2 .ico, .wb h2 .ico { color: var(--accent-mark); }     /* were --accent (2:1 on amaq dark) */
.empty-state .ico, .empty:not(.list-msg) > .ico { color: var(--control); }
.secret-box, .recovery-list, .confirm-list, .sugg-text, .sugg-foot, .assist-note, .qual-result, .mk-prefill, .ap-text { background: var(--sunken); }
.day-sep { background: var(--sunken); border-color: var(--line-2); color: var(--muted); }

/* ---------------------------------------------------------------- figures: KPI, unavailable KPI, hero KPI */
.kpi-label { color: var(--muted); }
.kpi-value { color: var(--ink); }
/* unavailable: dashed 3:1 edge + faint hatch + a word in --ink-2; it can never be read as a big "0" */
.kpi-na {
  background: repeating-linear-gradient(135deg, var(--na-hatch) 0 1px, transparent 1px 7px), transparent;
  border: 1px dashed var(--control); box-shadow: none;
}
.kpi-na .kpi-value { color: var(--ink-2); font-size: 15px; font-weight: 600; }

/* hero tile (image 3): a vivid flat fill from the identity palette with a hatched geometric shape behind the text.
   Text tokens are re-scoped on the tile so every descendant rule (a.kpi .kpi-label { color: var(--muted) }, hover tint)
   inherits the hero contrast pair instead of the page one. */
.kpi-hero {
  --hero: var(--hero-1); --on-hero: var(--on-hero-1); --hatch: var(--hatch-1);
  --ink: var(--on-hero); --ink-2: var(--on-hero); --muted: var(--on-hero);
  --tint: var(--hero); --line: var(--hero); --line-2: var(--on-hero);
  position: relative; isolation: isolate; overflow: hidden; min-height: 116px;
  background: var(--hero); color: var(--on-hero); border: 1px solid var(--hero);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .22), var(--shadow-1);
}
.kpi-hero-2 { --hero: var(--hero-2); --on-hero: var(--on-hero-2); --hatch: var(--hatch-2); }
.kpi-hero-3 { --hero: var(--hero-3); --on-hero: var(--on-hero-3); --hatch: var(--hatch-3); }
.kpi-hero-4 { --hero: var(--hero-4); --on-hero: var(--on-hero-4); --hatch: var(--hatch-4); border-color: var(--glass-line); }  /* the ink/graphite tile needs an edge on a dark page */
.kpi-hero .kpi-label { font-weight: 700; }
.kpi-hero .kpi-value { font-size: 30px; letter-spacing: -.01em; }
.kpi-hero::before, .kpi-hero::after { content: ""; position: absolute; z-index: -1; pointer-events: none; }
/* shape 1: hatched disc spilling off the end-bottom corner */
.kpi-hero::after {
  inset-block-end: -42%; inset-inline-end: -16%; width: 72%; aspect-ratio: 1; border-radius: 50%;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 2px, transparent 2px 9px);
}
/* shape 2: an outlined ring for depth */
.kpi-hero::before {
  inset-block-start: -34%; inset-inline-end: 30%; width: 40%; aspect-ratio: 1; border-radius: 50%;
  border: 2px solid var(--hatch);
}
/* variants change the geometry so a row of heroes reads as a set (image 3) */
.kpi-hero-2::after { border-radius: 0; clip-path: polygon(100% 0, 100% 100%, 0 100%); inset-block-end: -10%; inset-inline-end: -8%; width: 64%; }
.kpi-hero-3::after { border-radius: 18px; transform: rotate(45deg); inset-block-end: -48%; inset-inline-end: -10%; width: 60%; }
.kpi-hero-4::after { border-radius: 999px 999px 0 0; inset-block-end: -6%; inset-inline-end: 6%; width: 58%; aspect-ratio: 2 / 1; }
a.kpi.kpi-hero:hover, button.kpi.kpi-hero:hover { background: var(--hero); border-color: var(--on-hero); box-shadow: inset 0 0 0 1px var(--on-hero), var(--shadow-2); }
/* Cash Station: the ink hero carries the thin green signal stripe (the only green on a tile) */
body[data-org="hm"] .kpi-hero-4, .org-hm .kpi-hero-4 { box-shadow: inset 0 3px 0 var(--stripe), var(--shadow-1); }

/* ---------------------------------------------------------------- meters, bars, switches */
progress.meter { background: var(--line-2); color: var(--accent-mark); }
progress.meter::-webkit-progress-bar { background: var(--line-2); }
progress.meter::-webkit-progress-value { background: var(--accent-mark); }
progress.meter::-moz-progress-bar { background: var(--accent-mark); }
.bar { background: var(--sunken); border-color: var(--line-2); }
.bar-fill { background: var(--accent-mark); }
.bar-fill.lvl-warn { background: var(--lvl-warn); }
.bar-fill.lvl-degrade { background: var(--lvl-degrade); }
.bar-fill.lvl-stop { background: var(--danger); }
.bar-mark { background: var(--ink-2); opacity: 1; }
.switch { background: var(--switch-off); box-shadow: inset 0 0 0 1px var(--control); }   /* off = dark well with a 3:1 edge */
.switch::after { background: var(--switch-knob); box-shadow: 0 1px 3px var(--shadow-c1); }
.switch:checked { background: var(--switch-on); box-shadow: none; }
.switch:checked::after { background: var(--switch-knob-on); }
.switch:disabled { opacity: 1; background: transparent; box-shadow: inset 0 0 0 1px var(--line-2); }

/* ---------------------------------------------------------------- inbox: panes, bubbles, sealed band, notes */
.list-pane { background: var(--glass); border-inline-end-color: var(--line); }
.thread-pane { background: transparent; }
.thread-bar, .thread-head { background: var(--glass); }
.thread-head { border-bottom-color: var(--line); }
.assist, .thread-side, .reply-panel { background: var(--glass); border-color: var(--line); }
.thread-side .assist, .thread-side .reply-panel, .thread-side .crm-panel { background: transparent; }   /* no third glass layer */
.conv { border-bottom-color: var(--line); }
.conv[aria-current="true"] { background: var(--accent-soft); box-shadow: inset -3px 0 0 var(--accent-mark); }
/* customer (in) = neutral glass-grey bubble at the start; ours (out) = identity-tinted bubble at the end */
.msg-bubble { background: var(--bubble-in); border: 1px solid var(--bubble-in-line); color: var(--ink); box-shadow: inset 0 1px 0 var(--glass-line); }
.msg-out .msg-bubble { background: var(--bubble-out); border-color: var(--bubble-out-line); }
.msg-meta { color: var(--muted); }
/* simulated reply: grey, DASHED, lock tag — never a real sent bubble (views-work.css .msg-sim .msg-bubble) */
.msg-sim .msg-bubble {
  background: repeating-linear-gradient(135deg, var(--na-hatch) 0 1px, transparent 1px 8px), var(--sunken);
  border: 1.5px dashed var(--control); color: var(--ink); box-shadow: none;
}
.msg-sim-tag { color: var(--muted); }
.reply-item { background: var(--sunken); border-color: var(--control); }
/* sealed composer band: hatched, locked, quieter than any message */
.sealed {
  background: repeating-linear-gradient(135deg, var(--na-hatch) 0 1px, transparent 1px 8px), var(--sunken);
  border-top: 1px solid var(--line-2); color: var(--ink-2);
}
.sealed .ico, .sealed strong { color: var(--ink); }
/* internal notes: warm dark paper + dashed gold edge + "internal" tag — unlike in/out bubbles (grey/identity) and
   unlike .msg-sim (grey dashed) by hue, edge colour and tag */
.note { background: var(--note-bg); border: 1px dashed var(--note-line); color: var(--note-ink); }
.note-head { color: var(--note-ink); }
.note-author { color: var(--note-ink); }
.note-tag { background: var(--note-tag); color: var(--note-ink); box-shadow: inset 0 0 0 1px var(--note-line); }
.note-input { background: var(--note-input); border-style: dashed; border-color: var(--note-line); }
.internal-flag { background: var(--note-flag-bg); border-color: var(--note-line); color: var(--note-ink); }
.notes-head h2 .ico { color: var(--note-icon); }
.hit-note { background: var(--note-bg); border-color: var(--note-line); border-style: dashed; }
.btn-note { background: var(--note-flag-bg); border-color: var(--note-strong); color: var(--note-ink); }
.btn-note:hover:not(:disabled) { border-color: var(--note-icon); }
/* model free text flag: solid amber edge (notes are dashed), unmissable */
.free-text-flag { background: var(--note-flag-bg); border: 1px solid var(--note-strong); color: var(--note-ink); }
.free-text-flag .ico { color: var(--note-icon); }
.sugg-text-free { border: 1px dashed var(--note-strong); }
.sugg-problems { background: var(--warn-bg); border-color: var(--warn-line); color: var(--note-ink); }
.sugg-problems .code-id { color: var(--warn-ink); }
.sugg { border-color: var(--line-2); }
.sugg-proposed { border-color: var(--ok-line); }
.sugg-handover, .sugg-review { border-color: var(--warn-line); }
.sugg-blocked { border-color: var(--danger-line); }
.crm-hint { border-inline-start-color: var(--warn); background: var(--warn-bg); color: var(--warn-ink); }
.guard-real { background: var(--sunken); border-color: var(--control); }
.guard-trip-on { border-color: var(--danger-line); background: var(--danger-bg); }
.wb-pipeline-off { background: var(--sunken); border-color: var(--control); }
mark { background: var(--mark); color: inherit; box-shadow: 0 0 0 1px var(--note-line); }

/* ---------------------------------------------------------------- overlays: dialog, sheet, toast, update bar */
dialog { color: var(--ink); }
dialog::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog, .sheet {
  background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 20px;
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: inset 0 1px 0 var(--glass-line), var(--shadow-2);
}
.dialog-brand { background: var(--frame); color: var(--on-frame); box-shadow: inset 0 -1px 0 var(--glass-line); }
.dialog-brand-dot { background: var(--frame-accent); }
.dialog-body { color: var(--ink-2); }
.more-link { border-bottom-color: var(--line); color: var(--ink); }
.more-link .ico { color: var(--ink-2); }
.toast, .update-bar {
  background: var(--glass-strong); color: var(--ink); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-2); border-radius: 16px; padding-inline: 16px;   /* not a pill: toasts can wrap to two lines */
}
.toast-error { background: var(--danger-strong); color: var(--on-danger); border-color: var(--danger-line); }
.toast-ok .ico { color: var(--ok); }
.update-bar .btn { border-color: var(--ink); }
.offline-bar { background: var(--warn-bg); color: var(--warn-ink); border-bottom-color: var(--warn-line); }

/* ---------------------------------------------------------------- auth: glass card on the neutral glowing page */
.auth {
  background: radial-gradient(520px 380px at 50% 38%, var(--glow-1), transparent 70%);
}
.auth-card {
  position: relative; isolation: isolate;
  background: var(--glass-strong); border: 1px solid var(--glass-line); border-radius: 20px;
  -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%);
  box-shadow: inset 0 1px 0 var(--glass-line), var(--shadow-2);
}
/* edge light along the top of the card (indigo→cyan on neutral; never behind text) */
.auth-card::before {
  content: ""; position: absolute; inset-inline: 24px; top: -1px; height: 1px; pointer-events: none;
  background: var(--edge-light);
}
.auth-brand { border-bottom-color: var(--line); }
.auth-env, .auth-sub, .auth-foot { color: var(--muted); }

/* ---------------------------------------------------------------- phone (<= 760px): keep this block AFTER the rules above (it overrides them) */
@media (max-width: 760px) {
  .tabbar {
    background: var(--frame-glass);
    -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
    border-top: 1px solid var(--glass-line);
  }
  .tab { color: var(--on-frame-2); }
  .tab.is-active { color: var(--on-frame); }
  .tab.is-active .ico { color: var(--frame-accent); }
  .tab.is-active::before { background: var(--frame-accent); }
  /* the pinned conversation title row is glass too (content scrolls under it) */
  .thread-bar { background: var(--glass-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-bottom-color: var(--line); }
  .sheet { border-radius: 20px 20px 0 0; }          /* bottom sheet: flat bottom edge (app.css phone rule) */
}

/* ---------------------------------------------------------------- focus halo: several rules above set box-shadow on focusable elements,
   which would erase app.css's :focus-visible halo (same specificity, earlier). Restore it, combined with the element's own edge. */
:is(.btn, .kpi, .org-choice, .seg > button, .nav-link, .board-card, .list-item, .conv, .subnav-link, .ver, .hit, .icon-btn):focus-visible {
  box-shadow: 0 0 0 4px var(--focus-halo);
}
input.switch:focus-visible { box-shadow: inset 0 0 0 1px var(--control), 0 0 0 4px var(--focus-halo); }
input.switch:checked:focus-visible { box-shadow: 0 0 0 4px var(--focus-halo); }

/* ---------------------------------------------------------------- motion (only when the user has not asked for less) */
@media (prefers-reduced-motion: no-preference) {
  .btn, .seg > button, .nav-link, .tab, .subnav-link, .board-card, .list-item, .conv, .ver, .hit, .org-choice, .kpi, .switch, .switch::after {
    transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease, color .16s ease, inset-inline-start .16s ease;
  }
}

/* ================================================================== UX pass (DECISIONS 70): layout and flow fixes
   From the owner and employee walkthroughs of the real app. Layout only; every safety marker keeps its look and words. */

/* home: three tiers — what needs attention (large), how the system runs (status), the rest (small) */
.home-band { display: grid; gap: 10px; }
.band-title { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: .01em; }
.kpi-grid-hero { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.kpi-grid-hero .kpi { min-height: 124px; padding: 16px 18px; align-content: space-between; }
.kpi-grid-hero .kpi-value { font-size: 38px; line-height: 1.1; letter-spacing: -.01em; }
.kpi-grid-status { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpi-grid-sm .kpi { padding: 10px 14px; }
.kpi-grid-sm .kpi-value { font-size: 20px; }
.kpi-calm .kpi-value { color: var(--ink-2); }

/* the conversation (≥ 1280px): messages and the review panel scroll as one column, so the customer's words are always readable */
@media (min-width: 1280px) {
  .thread-msgs { overflow-y: auto; overscroll-behavior: contain; }
  .messages { flex: none; overflow: visible; min-height: 40%; }
}
/* inbox rows: the customer's words lead; channel and reference are the quiet second line */
.conv { min-height: 60px; padding-block: 11px; }
.conv-main .conv-preview { color: var(--ink); font-weight: 600; font-size: 14px; }
.conv-main .conv-top { font-size: 12.5px; color: var(--muted); }
.conv-main .conv-ch { font-weight: 600; font-size: 12.5px; color: var(--ink-2); }

/* a protected «غير متاح — …» label inside a figure wraps instead of being cut */
.kpi-value .chip { white-space: normal; height: auto; line-height: 1.5; }

/* owner view: one card per company, attention first; nothing is added up or compared */
.ex-head { flex-wrap: wrap; }
.ex-title { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ex-title h2 { font-size: 17px; }
.ex-sub { font-size: 12.5px; color: var(--muted); }
.ex-card > .notice { margin: 12px 16px 0; }
.ex-attn { margin: 12px 16px 0; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--accent-line); background: var(--accent-soft); display: grid; gap: 10px; }
.ex-attn-calm { border-color: var(--ok-line); background: var(--ok-bg); }
.ex-attn-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.ex-attn-title .ico { width: 16px; height: 16px; }
.ex-attn-list { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-attn-item { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 14px 4px 6px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13.5px; font-weight: 600; }
a.ex-attn-item:hover { border-color: var(--accent); }
.ex-attn-n { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 700; }
.ex-attn-na { font-weight: 500; color: var(--muted); padding-inline: 12px; }
.switch-exec { margin-top: 12px; }

/* critic round (DECISIONS 70): toasts stay at the bottom (they covered page and conversation titles when placed at the top) and never
   catch the pointer; the bell count sits on the bell's corner instead of over the bell */
.live .toast { pointer-events: none; }
.bell-count { top: -1px; inset-inline-end: -5px; min-width: 18px; height: 18px; font-size: 11px; line-height: 14px; }
/* off switch: a filled track, so off and on differ by fill as well as knob position (the AI price and stock rules use these) */
.switch:not(:checked):not(:disabled) { background: color-mix(in srgb, var(--switch-knob) 24%, var(--surface)); }
/* the "sending disabled" band in a conversation: a lit band with a clear edge instead of grey hatching on grey */
.sealed { background: var(--surface-raised); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); box-shadow: inset 3px 0 0 var(--warn); }
.sealed .ico { color: var(--warn); }
/* analytics bars: an empty track must not read as a full bar on the dark page */
.bar { background: rgb(255 255 255 / .05); border-color: transparent; }
/* hero tile ornaments: quieter, so they read as texture and not as a rendering error */
.kpi-hero::before, .kpi-hero::after { opacity: .5; }

/* sales board on wide screens: empty stages stay narrow so the full pipeline fits */
@media (min-width: 761px) {
  .board { grid-auto-columns: minmax(210px, 1fr); }
  .board-col:not(:has(.board-list)) { min-width: 0; }
}

@media (max-width: 760px) {
  /* a wide table that is not a stacking table scrolls inside its frame (the roles matrix widened the whole page) */
  .table-wrap:not(:has(.table-stack)) { overflow-x: auto; position: relative; }   /* relative: screen-reader-only text inside stays clipped */
  /* customer and deal rows: side details move under the name instead of squeezing it to one word per line */
  .list-item-wrap { flex-wrap: wrap; }
  .list-item-wrap .list-side { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; text-align: start; gap: 4px 12px; }
  /* sales board: stages stacked vertically (no sideways swiping past empty stages); an empty stage is one line */
  .board { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; margin-inline: 0; padding-inline: 0; scroll-snap-type: none; }
  .board-col:not(:has(.board-list)) > :not(.board-col-head) { display: none; }
  .board-col:not(:has(.board-list)) { padding-block: 6px; }
  /* home on the phone: figures reach the first screen */
  .page-home .page-desc { display: none; }
  .page-home .page-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; width: 100%; }
  .page-home .page-actions .btn { padding-inline: 6px; font-size: 13px; white-space: normal; line-height: 1.3; text-align: center; }
  .kpi-grid-hero { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-grid-hero .kpi { min-height: 108px; padding: 12px 14px; }
  .kpi-grid-hero .kpi-value { font-size: 32px; }
  .kpi-grid-status { grid-template-columns: minmax(0, 1fr); }
  /* narrow hero tiles: the hatched shape stays in the corner, away from the label and sub-line */
  .kpi-grid-hero .kpi-hero::after { width: 40%; inset-block-end: -22%; inset-inline-end: -12%; opacity: .4; }
  .kpi-grid-hero .kpi-hero::before { width: 30%; }
  /* the tab bar is nearly opaque on the phone: page text must not show through the labels */
  .tabbar { background: rgb(from var(--frame) r g b / .97); }
  .topbar { background: rgb(from var(--frame) r g b / .97); }
  .thread-bar { background: var(--surface-raised); }
  /* inside an open conversation the tab bar steps aside (the back button is in the pinned title row) */
  body:has(.inbox.has-selection) .tabbar { display: none; }
  body:has(.inbox.has-selection) .main-inbox { padding-bottom: env(safe-area-inset-bottom); }
  /* agent status: 2 × 2 instead of four full-width rows */
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* owner view: label and figure on one row */
  .ex-card .kv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ex-attn, .ex-card > .notice { margin-inline: 12px; }
}

/* ================================================================== FINAL POLISH (DECISIONS 71): simple, professional, quiet
   Owner: «واجهة احترافية وبسيطة… لا Hairline، ولا إفراط في التوهج أو الأخضر أو الزخارف». */
/* no hairlines: the gradient edge light under the neutral top bar and on the sign-in card is removed */
.topbar-neutral .stripe { background: none; }
.auth-card::before { display: none; }
/* quieter ambient light: the page glow is a hint, not a feature */
:root { --glow-1: rgb(75 0 130 / .14); --glow-2: rgb(0 229 255 / .03); }
body[data-org="amaq"], .org-amaq { --glow-1: rgb(27 83 154 / .14); --glow-2: rgb(122 174 238 / .05); }
body[data-org="hm"], .org-hm { --glow-1: rgb(255 255 255 / .04); --glow-2: rgb(157 157 157 / .03); }
/* hero tiles: one flat colour; the hatch ornaments become a faint texture */
.kpi-hero::before { display: none; }
.kpi-hero::after { opacity: .22; }
/* Cash Station green as a signal only: the active place (stripe, side rail, tab) and the focus ring keep it; buttons and badges do not */
body[data-org="hm"], .org-hm { --primary-icon: #0b0f0c; --primary-icon-bg: transparent; }
body[data-org="hm"] .bell-count { background: var(--on-frame); color: var(--frame); }

/* names and references are words, not code: only real codes (code()) keep the monospace face */
bdi.mono:not(.code-id) { font-family: inherit; font-size: inherit; }

/* inbox: quick views + a folded filter panel */
.filter-box { display: grid; gap: 8px; }
.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.seg-quick > button { min-height: 32px; }
.filters-toggle { gap: 6px; }
.filters-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; }
.conv-top { color: var(--muted); }

/* sales board: stage titles are column labels, smaller than the page title, on one line */
.board-col-head h2 { font-size: 14.5px; line-height: 1.35; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 auto; }
.board-card-title { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.board-card-value { white-space: nowrap; }
@media (min-width: 761px) {
  .board { grid-auto-columns: minmax(230px, 1fr); }
}

/* ================================================================== DARK LUXURY fallbacks (keep LAST) */
/* no backdrop-filter → opaque surfaces (translucent frames over scrolling content would hurt legibility) */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root, body[data-org="amaq"], .org-amaq, body[data-org="hm"], .org-hm {
    --frame-glass: var(--frame);
    --glass-strong: var(--surface-raised);
    --glass: var(--surface);
  }
  dialog::backdrop { background: rgb(0 0 0 / .72); }
}
/* the user asked for less transparency → the same opaque surfaces, and no blur at all */
@media (prefers-reduced-transparency: reduce) {
  :root, body[data-org="amaq"], .org-amaq, body[data-org="hm"], .org-hm {
    --frame-glass: var(--frame);
    --glass-strong: var(--surface-raised);
    --glass: var(--surface);
    --glow-1: transparent;
    --glow-2: transparent;
  }
  .topbar, .sidenav, .tabbar, .thread-bar, .dialog, .sheet, .toast, .update-bar, .auth-card, dialog::backdrop {
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
/* Windows high contrast: system colours, decorative layers off, every edge kept */
@media (forced-colors: active) {
  body::before, .kpi-hero::before, .kpi-hero::after, .auth-card::before { display: none; }
  .panel, .kpi, .kpi-hero, .stat, .list, .dialog, .sheet, .auth-card, .msg-bubble, .note { border: 1px solid CanvasText; }
  .kpi-na, .msg-sim .msg-bubble, .note, .chip-synthetic { border-style: dashed; }
  .btn-primary .ico { box-shadow: none; background: transparent; }
}
/* reduced motion: app.css's existing @media (prefers-reduced-motion: reduce) rule (zeroes animation/transition durations)
   stays as it is; the transitions added in PART C are only declared under prefers-reduced-motion: no-preference. */

/* Decision 73 (2026-12-06): email + password sign-in. Sign-in card only; existing tokens, no new colours. */
.pw-label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pw-label-row .link { font-size: 13px; }
.remember { margin-top: 2px; }
.remember .field-hint { margin: 0; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; margin-block: 4px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
