/* GEO platform: shell and components. Logical properties throughout, so Arabic (RTL) mirrors
   without a second stylesheet. Tokens: tokens.css. Decisions: DESIGN.md. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: var(--t-14); line-height: 1.55; color: var(--ink);
  background: var(--canvas); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-1); }
:is(.sidebar, .card.night, .auth-art, .score-hero, .toast) :focus-visible { outline-color: var(--ice); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; letter-spacing: -0.01em; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3 { letter-spacing: 0; line-height: 1.35; }
h1 { font-size: var(--t-31); } h2 { font-size: var(--t-20); } h3 { font-size: var(--t-16); }
h1, h2, h3 { text-wrap: balance; }
/* Data typed by people (names, URLs, English facts) keeps its own direction inside an Arabic page */
.dl dd, .table td, .bidi, .page-head h1, .checklist .text, .card > p, .rv-title, .rv-quote, .al-quote, .pt-answer-text,
[dir="auto"] { unicode-bidi: plaintext; }
/* Typed addresses read left to right in Arabic forms too (C11) */
input[type=email], input[type=url], input[type=password] { direction: ltr; }
[dir=rtl] input[type=email], [dir=rtl] input[type=url], [dir=rtl] input[type=password] { text-align: right; }
.note { display: flex; gap: var(--s-2); align-items: center; color: var(--ink-3); font-size: var(--t-13); }
.note svg { width: 16px; height: 16px; flex: none; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* The skip link appears where the keyboard is: the first Tab stop is on screen (C14) */
a.sr-only:focus { position: fixed; inset-block-start: 8px; inset-inline-start: 8px; z-index: 100; width: auto; height: auto; margin: 0;
  clip: auto; overflow: visible; padding: 8px 14px; border-radius: var(--r-2); background: var(--navy); color: var(--ice); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--ink-3); }
.ltr { direction: ltr; unicode-bidi: isolate; }
/* Domains, URLs and e-mails break rather than push the page sideways at large text (C5). Never
   "anywhere": it shrinks a word's min-content to one letter, so tables and flex rows squeeze it and
   break ordinary words mid-letter; break-word breaks only a word that cannot fit a line alone. */
.ltr, .mono, .row-sub.ltr { overflow-wrap: break-word; }
/* "Back" points the way the page reads: right-to-left pages turn the arrow (N4) */
.back-arrow { display: inline-block; }
[dir="rtl"] .back-arrow { transform: scaleX(-1); }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--night); color: var(--on-night-2); padding: var(--s-5) var(--s-3) var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-5);
  background-image: radial-gradient(120% 60% at 0% 0%, color-mix(in oklab, var(--royal) 55%, transparent), transparent 70%);
}
.brand { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-1) var(--s-3); color: var(--on-night); }
.brand:hover { color: var(--on-night); }
.brand-mark { width: 30px; height: 30px; flex: none; fill: none; }
.brand-logo { height: 30px; width: auto; max-width: 96px; flex: none; object-fit: contain; border-radius: 8px; background: var(--ice); padding: 3px; }
.brand-name { font-weight: 600; font-size: var(--t-14); line-height: 1.2; }
.brand-name small { display: block; font-weight: 400; font-size: var(--t-12); color: var(--on-night-3); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: var(--t-12); color: var(--on-night-3); padding: 0 var(--s-3) var(--s-1); }
.nav-link {
  display: flex; align-items: center; gap: var(--s-3); padding: 8px var(--s-3); border-radius: var(--r-2);
  color: var(--on-night-2); font-weight: 500; transition: background-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out);
}
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: 0.85; }
.nav-link[aria-current="page"] { background: color-mix(in oklab, var(--ice) 14%, transparent); color: var(--on-night); }
.nav-link[aria-current="page"] svg { color: var(--ice); opacity: 1; }
@media (hover: hover) { .nav-link:hover { background: color-mix(in oklab, var(--ice) 9%, transparent); color: var(--on-night); } }
.client-switch {
  margin: 0 var(--s-1); padding: var(--s-3); border-radius: var(--r-3);
  background: var(--navy); border: 1px solid color-mix(in oklab, var(--ice) 14%, transparent);
}
.client-switch .eyebrow { font-size: var(--t-12); color: var(--on-night-3); }
.client-switch strong { display: block; color: var(--on-night); font-weight: 600; font-size: var(--t-14); }
.client-switch a { font-size: var(--t-12); color: var(--ice); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s-2); padding: 0 var(--s-3); font-size: var(--t-12); }
.sidebar-foot .who { color: var(--on-night); font-weight: 500; font-size: var(--t-13); }
.lang-form { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-pill); background: color-mix(in oklab, var(--ice) 10%, transparent); }
.lang-form button { border: 0; background: transparent; color: var(--on-night-2); font: inherit; font-size: var(--t-12); padding: 3px 10px; border-radius: var(--r-pill); cursor: pointer; }
.lang-form button[aria-pressed="true"] { background: var(--ice); color: var(--abyss); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-8); background: color-mix(in oklab, var(--canvas) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-block-end: 1px solid var(--line);
}
/* The trail keeps its longest word: squeezed to nothing by the top bar, it broke "Clients" mid-word (C5) */
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s-2); font-size: var(--t-13); color: var(--ink-3); min-width: auto; }
.crumbs > :not(.sep) { min-width: 0; overflow-wrap: break-word; }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { color: var(--ink-3); }
.topbar .spacer { flex: 1; }
.mode-pill { font-size: var(--t-12); padding: 3px 10px; border-radius: var(--r-pill); border: 1px dashed var(--line-strong); color: var(--ink-2); }
.btn.menu-toggle { display: none; }
.content { padding: var(--s-8); max-width: 1320px; width: 100%; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); margin-block-end: var(--s-8); flex-wrap: wrap; }
.page-head .kicker { font-size: var(--t-13); color: var(--ink-3); margin-block-end: var(--s-2); display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; min-width: 0; overflow-wrap: break-word; }
.page-head > div { min-width: 0; }
.page-head h1 { overflow-wrap: break-word; hyphens: auto; }
.page-head p.lead { color: var(--ink-2); margin-block-start: var(--s-2); max-width: 62ch; font-size: var(--t-16); }
.actions { display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center; }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--action); --fg: var(--on-action); --bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: 38px; padding: 0 var(--s-4);
  border-radius: var(--r-2); border: 1px solid var(--bd); background: var(--bg); color: var(--fg); font: inherit; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out), color var(--d-fast) var(--ease-out), transform var(--d-fast) var(--ease-out);
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { color: var(--fg); }
@media (hover: hover) { .btn:hover { --bg: var(--royal); box-shadow: 0 0 0 2px var(--ice); } .btn.ghost:hover { --bg: var(--surface-2); } .btn.quiet:hover { --bg: var(--surface-2); }
  .btn.ghost:hover, .btn.quiet:hover { box-shadow: none; } }
/* navy -> royal alone is 1.17:1; the ice ring makes the hover visible (N4) */
.btn:active:not(:disabled) { transform: scale(var(--press)); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.ghost { --bg: var(--surface); --fg: var(--ink); --bd: var(--line-strong); }
.btn.quiet { --bg: transparent; --fg: var(--ink-2); }
.btn.dark { --bg: var(--navy); --fg: var(--ice); }
.btn.ice { --bg: var(--ice); --fg: var(--abyss); }
@media (hover: hover) { .btn.ice:hover { --bg: color-mix(in srgb, var(--ice) 86%, transparent); --fg: var(--abyss); } .btn.dark:hover { --bg: var(--abyss); } }
.btn.small { min-height: 30px; padding: 0 var(--s-3); font-size: var(--t-13); }
.btn.danger { --bg: var(--surface); --fg: var(--royal); --bd: var(--royal); }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-3); padding: var(--s-6); box-shadow: var(--shadow-1); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-block-end: var(--s-4); flex-wrap: wrap; }
.card-head > * { min-width: 0; }
.card-head h2 { font-size: var(--t-16); }
.card-head .count { color: var(--ink-3); font-weight: 400; margin-inline-start: var(--s-1); }
.card.night { background: var(--night); color: var(--on-night-2); border-color: transparent; box-shadow: var(--shadow-2);
  background-image: radial-gradient(90% 120% at 100% 0%, color-mix(in oklab, var(--azure) 40%, transparent), transparent 60%); }
.card.night h2, .card.night strong { color: var(--on-night); }
.grid { display: grid; gap: var(--s-5); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: var(--s-5); }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: var(--s-1); }
.kpi .label { font-size: var(--t-13); color: var(--ink-3); }
.kpi .value { font-size: var(--t-31); font-weight: 600; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: var(--t-12); color: var(--ink-3); }
.card.night .kpi .label, .card.night .kpi .sub { color: var(--on-night-3); }
.card.night .kpi .value { color: var(--on-night); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; max-width: 100%; position: relative; } /* holds its .sr-only cells, which would widen the page */
/* Grid and flex children may shrink below their content, so a wide table scrolls inside its
   wrapper instead of widening the page (C5) */
.content, .content > *, .grid > *, .stack > *, .page-head > *, .card { min-width: 0; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--t-14); }
.table th { text-align: start; font-weight: 500; font-size: var(--t-12); color: var(--ink-3); padding: 10px var(--s-4); border-block-end: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px var(--s-4); border-block-end: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-block-end: 0; }
.table td.num, .table th.num { text-align: end; }
@media (hover: hover) { .table tbody tr { transition: background-color var(--d-fast) var(--ease-out); } .table tbody tr:hover { background: var(--canvas); } }
.table .row-title { font-weight: 500; color: var(--ink); }
.table .row-sub { font-size: var(--t-12); color: var(--ink-3); }

/* ---------- Badges, chips ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--r-pill); font-size: var(--t-12); font-weight: 500; line-height: 20px; white-space: normal;
  max-width: 100%; overflow-wrap: break-word;
  background: var(--surface-3); color: var(--navy); }
/* In a table a status reads as one piece: the table grows and scrolls inside its wrapper (C5) */
.table-wrap .badge { white-space: nowrap; }
.badge svg { width: 12px; height: 12px; }
.badge.solid { background: var(--navy); color: var(--ice); }
.badge.deep { background: var(--abyss); color: var(--ice); }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); color: var(--ink-2); }
.badge.azure { background: var(--royal); color: var(--ice); }
/* Severity: carried by label and glyph, never by colour alone (DESIGN.md) */
.sev { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-12); font-weight: 600; }
.sev i { display: inline-flex; gap: 2px; }
.sev i b { width: 4px; height: 12px; border-radius: 2px; background: var(--line-strong); }
.sev.high i b { background: var(--abyss); } .sev.medium i b:nth-child(-n+2) { background: var(--royal); } .sev.low i b:first-child { background: var(--azure); }
.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 5px; border: 1px solid var(--ink-2); border-radius: 5px;
  font-size: 0.6875rem; font-weight: 600; color: var(--ink-2); font-family: var(--mono); }
.chip.us { background: var(--navy); border-color: var(--navy); color: var(--ice); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-5); max-width: 760px; }
.form .row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field legend { font-weight: 500; font-size: var(--t-13); color: var(--ink); }
.field .help { font-size: var(--t-12); color: var(--ink-3); }
.field .error { font-size: var(--t-12); color: var(--royal); font-weight: 600; display: flex; gap: 6px; align-items: center; }
.field .error::before { content: "!"; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--royal); color: var(--ice); font-size: 11px; }
input[type=text], input[type=email], input[type=url], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-2);
  padding: 9px 12px; min-height: 40px; transition: border-color var(--d-fast) var(--ease-out), box-shadow var(--d-fast) var(--ease-out);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azure); box-shadow: 0 0 0 3px color-mix(in oklab, var(--ice) 70%, transparent); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--royal); border-width: 2px; }
.checks { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; margin: 0; }
.checks label { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); cursor: pointer; font-weight: 400;
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out); }
.checks label:has(input:checked) { background: var(--accent-soft); border-color: var(--azure); }
.checks input { accent-color: var(--azure); }
input[type=checkbox] { accent-color: var(--azure); width: 16px; height: 16px; }
.check-line { display: flex; align-items: center; gap: var(--s-2); }
.form-actions { display: flex; gap: var(--s-2); padding-block-start: var(--s-2); border-block-start: 1px solid var(--line); padding-top: var(--s-5); }
fieldset { border: 0; padding: 0; margin: 0; }
.search { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.search input, .search select { flex: 1 1 200px; min-width: 0; }
.search select { max-width: 240px; }

/* ---------- Lists, checklist, empty ---------- */
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.checklist li { display: flex; align-items: center; gap: var(--s-3); padding: 10px 0; border-block-end: 1px solid var(--line); }
.checklist li:last-child { border-block-end: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: transparent; }
.checklist .done .tick { background: var(--navy); border-color: var(--navy); color: var(--ice); }
.checklist .tick svg { width: 12px; height: 12px; }
.checklist .done .text { color: var(--ink-2); }
.checklist a { margin-inline-start: auto; font-size: var(--t-13); }
.progress { height: 6px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--azure); border-radius: inherit; transform-origin: left; }
[dir=rtl] .progress > span { transform-origin: right; }
.empty { text-align: center; padding: var(--s-12) var(--s-6); color: var(--ink-3); display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.empty svg { width: 40px; height: 40px; color: var(--azure); opacity: 0.8; }
.empty strong { color: var(--ink); font-size: var(--t-16); font-weight: 600; }
.dl { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: var(--s-3) var(--s-5); margin: 0; }
.dl dt { color: var(--ink-3); font-size: var(--t-13); }
.dl dd { margin: 0; white-space: pre-line; }
.tag-list { display: flex; flex-wrap: wrap; gap: var(--s-2); }

/* ---------- Flash messages ---------- */
.toasts { position: fixed; inset-block-end: var(--s-6); inset-inline-end: var(--s-6); z-index: 50; display: flex; flex-direction: column; gap: var(--s-2); max-width: 420px; }
.toast { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-3); background: var(--night); color: var(--on-night); box-shadow: var(--shadow-3); font-size: var(--t-14); }
.toast svg { width: 18px; height: 18px; color: var(--ice); flex: none; margin-top: 2px; }
.toast.error { background: var(--royal); }
.toast button { margin-inline-start: auto; background: none; border: 0; color: var(--on-night-2); cursor: pointer; font-size: 18px; line-height: 1; padding: 0 0 0 var(--s-2); }

/* ---------- Placeholder (wave-1 stub screens) ---------- */
.stub { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s-6); }
.stub .card.night p { color: var(--on-night-2); }

/* ---------- Auth and error pages ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--canvas); }
.auth-art { position: relative; overflow: hidden; background: var(--abyss); color: var(--on-night-2); padding: var(--s-12); display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { padding: 0; }
.auth-art h2 { color: var(--on-night); font-size: var(--t-31); font-weight: 600; max-width: 20ch; }
.auth-art p { max-width: 42ch; margin-top: var(--s-3); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: var(--s-12) var(--s-8); }
.auth-panel .inner { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: var(--s-6); }
.auth-panel h1 { font-size: var(--t-25); }
.answer-card { position: relative; z-index: 1; margin-block: var(--s-10); max-width: 440px; padding: var(--s-5); border-radius: var(--r-3);
  background: color-mix(in oklab, var(--navy) 70%, transparent); border: 1px solid color-mix(in oklab, var(--ice) 16%, transparent); backdrop-filter: blur(6px); }
.answer-card .q { font-size: var(--t-13); color: var(--on-night-3); margin-bottom: var(--s-3); }
.answer-card .a { color: var(--on-night); font-size: var(--t-16); line-height: 1.6; }
.answer-card .a mark { background: color-mix(in oklab, var(--azure) 55%, transparent); color: var(--ice); border-radius: 4px; padding: 0 4px; }
.orbit { position: absolute; inset: auto -20% -35% auto; width: 620px; height: 620px; border-radius: 50%; border: 1px solid color-mix(in oklab, var(--ice) 14%, transparent); }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 70px; border-radius: 50%; border: 1px solid color-mix(in oklab, var(--ice) 10%, transparent); }
.orbit::after { inset: 150px; border-color: color-mix(in oklab, var(--ice) 8%, transparent); }
[dir=rtl] .orbit { inset: auto auto -35% -20%; }

/* ---------- Motion: state changes only, under reduced motion a cross-fade ---------- */
@media (prefers-reduced-motion: no-preference) {
  .enter { animation: enter var(--d-enter) var(--ease-out) both; }
  .enter-stagger > * { animation: enter var(--d-enter) var(--ease-out) both; }
  .enter-stagger > *:nth-child(2) { animation-delay: 60ms; } .enter-stagger > *:nth-child(3) { animation-delay: 120ms; }
  .enter-stagger > *:nth-child(4) { animation-delay: 180ms; }
  .toast { animation: toast-in var(--d-enter) var(--ease-out) both; }
  .toast.leaving { animation: toast-out var(--d-exit) var(--ease-out) both; }
  .progress > span { animation: grow 600ms var(--ease-out) both; }
}
@media (prefers-reduced-motion: reduce) {
  .enter, .enter-stagger > *, .toast { animation: fade var(--d-base) linear both; }
}
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) { .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side, .stub { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  /* Closed, the drawer is off screen and out of the tab order: visibility turns hidden once the
     closing slide has ended, and visible at once when it opens (C14). */
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: min(86vw, 300px); z-index: 40; transform: translateX(-102%);
    visibility: hidden; transition: transform var(--d-enter) var(--ease-out), visibility 0s linear var(--d-enter); }
  [dir=rtl] .sidebar { transform: translateX(102%); }
  body.nav-open .sidebar { transform: none; visibility: visible; transition: transform var(--d-enter) var(--ease-out), visibility 0s; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: color-mix(in oklab, var(--abyss) 45%, transparent); z-index: 30; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar, .content { padding-inline: var(--s-4); }
  .content { padding-block: var(--s-6); }
  .grid.two, .grid.three, .grid.four, .form .row { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px var(--s-3); }
  .dl dd { margin-block-end: var(--s-2); }
  h1 { font-size: var(--t-25); }
}

/* ---------- Components on a night ground (C4) ----------
   Chips, outline badges, chart text and checklist ticks are drawn for the light ground; on the
   night cards they take the ice set, and the client's chip is filled ice (DESIGN.md, Signature). */
:is(.card.night, .answer-card, .score-hero, .auth-art) .chip { border-color: var(--on-night-3); color: var(--on-night-2); }
:is(.card.night, .answer-card, .score-hero, .auth-art) .chip.us { background: var(--ice); border-color: var(--ice); color: var(--abyss); }
:is(.card.night, .answer-card, .score-hero) .badge.outline { border-color: var(--on-night-3); color: var(--on-night-2); }
:is(.card.night, .answer-card, .score-hero) .badge:not(.outline) { background: color-mix(in oklab, var(--ice) 18%, transparent); color: var(--on-night); }
:is(.card.night, .score-hero) .trend text { fill: var(--on-night-2); }
:is(.card.night, .score-hero) .trend text.x { fill: var(--on-night-3); }
:is(.card.night, .score-hero) .trend .grid { stroke: color-mix(in oklab, var(--ice) 16%, transparent); }
.card.night .checklist .tick { border-color: var(--on-night-3); }
.card.night .checklist .done .tick { background: var(--ice); border-color: var(--ice); color: var(--abyss); }
.card.night .checklist .done .text { color: var(--on-night-3); }
.card.night .checklist .text, .card.night .checklist li { color: var(--on-night-2); }
.card.night .checklist a { color: var(--ice); }
.card.night .muted, .card.night .row-sub { color: var(--on-night-3); }

/* ---------- Browser-drawn parts in the five colours (C10) ---------- */
::selection { background: var(--ice); color: var(--abyss); }
:is(.card.night, .sidebar, .auth-art, .lp-body) ::selection { background: var(--azure); color: var(--ice); }
::placeholder { color: var(--ink-3); opacity: 1; }
html { color-scheme: light; accent-color: var(--navy); }
input[type=checkbox], input[type=radio] {
  appearance: none; -webkit-appearance: none; width: 18px; height: 18px; margin: 0; flex: none; display: inline-grid; place-content: center;
  border: 1.5px solid var(--navy); border-radius: 4px; background: transparent; cursor: pointer; vertical-align: -3px;
  transition: background-color var(--d-fast) var(--ease-out), border-color var(--d-fast) var(--ease-out);
}
input[type=radio] { border-radius: 50%; }
input[type=checkbox]::before { content: ""; width: 9px; height: 5px; border-left: 2px solid var(--ice); border-bottom: 2px solid var(--ice);
  transform: translateY(-1px) rotate(-45deg); opacity: 0; }
input[type=checkbox]:checked { background: var(--navy); }
input[type=checkbox]:checked::before { opacity: 1; }
input[type=radio]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--navy); transform: scale(0);
  transition: transform var(--d-fast) var(--ease-out); }
input[type=radio]:checked::before { transform: scale(1); }
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: 0.45; cursor: not-allowed; }
:is(.card.night, .sidebar) input[type=checkbox] { border-color: var(--on-night-2); }
:is(.card.night, .sidebar) input[type=checkbox]:checked { background: var(--ice); }
:is(.card.night, .sidebar) input[type=checkbox]::before { border-color: var(--abyss); }
select { appearance: none; -webkit-appearance: none; padding-inline-end: 36px; background-repeat: no-repeat; background-size: 12px 8px;
  background-position: right 12px center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23041D56' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
[dir=rtl] select { background-position: left 12px center; }
select[multiple] { background-image: none; padding-inline-end: 12px; }

/* Phones and large text: a long button label wraps instead of pushing the page sideways (C5) */
@media (max-width: 560px) { .btn { white-space: normal; max-width: 100%; text-align: center; min-height: 38px; height: auto; padding-block: 6px; } }

/* Browser date and number controls in the five colours (N2): the calendar icon is drawn in navy,
   the grey spin buttons are dropped (arrow keys and typing still step the value). */
input[type="date"]::-webkit-calendar-picker-indicator {
  color: transparent; opacity: 1; cursor: pointer; width: 16px; height: 16px;
  background: no-repeat center / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23041D56' stroke-width='1.5'%3E%3Crect x='2' y='3' width='12' height='11' rx='2'/%3E%3Cpath d='M2 6.5h12M5.5 1.5v3M10.5 1.5v3'/%3E%3C/svg%3E"); }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
