/* ==========================================================================
   EthioLink Consent Engine — Consent & Data Sovereignty Layer
   Institutional UI system (v3) · single stylesheet · light + dark · responsive

   Served under CSP `style-src 'self'`: this is the only stylesheet, and every
   page avoids <style> blocks and style="" attributes (layout utilities live in
   layer 8). JavaScript may still set element.style.* via CSSOM.

   Layers
     1  Tokens (colour · type · space · elevation · motion)
     2  Base + accessibility
     3  Layout
     4  Application chrome (header, nav, notifications, user chip)
     5  Components (buttons, forms, cards, tabs, stats, tables, badges…)
     6  Feature surfaces (consent, lifecycle, compliance, regulator views)
     7  Public site (landing, pricing, guides, changelog)
     8  Utilities
     9  Responsive · print · motion preferences

   NOTE: class names are a contract with the dashboard scripts in public/js
   (admin.js, dashboard.js, institution.js). Renaming one silently breaks a
   dashboard, so every v2 selector is preserved here.
   ========================================================================== */

/* ==========================================================================
   1. TOKENS
   ========================================================================== */
:root {
  color-scheme: light;

  /* --- Brand: EthioLink green (primary action / verified / granted) --- */
  --brand: #0b7a3e;
  --brand-2: #12915a;
  --brand-dark: #075c30;
  --brand-soft: #e6f5ec;
  --brand-line: #bfe4d0;
  --on-brand: #ffffff;

  /* --- Institutional ink: console chrome + headings --- */
  --ink: #142433;
  --ink-2: #33485a;
  --muted: #5a6c7b;
  --chrome: #0b1f2c;
  --chrome-2: #102e40;
  --chrome-3: #0b3a26;
  --chrome-line: #1d3b4d;
  --chrome-ink: #eef5f9;
  --chrome-muted: #9fb6c5;

  /* --- Neutrals: page, surfaces, rules --- */
  --bg: #eef2f6;
  --bg-2: #e6ecf2;
  --surface: #ffffff;
  --surface-2: #f6f9fb;
  --surface-3: #edf2f7;
  --line: #dbe3ea;
  --line-2: #e9eff4;
  --line-strong: #c6d3dd;

  /* --- Semantic states --- */
  --danger: #b02a1c;
  --danger-soft: #fdecea;
  --danger-line: #f1c6bf;
  --warn: #96610f;
  --warn-soft: #fdf3e0;
  --warn-line: #f0d9a8;
  --ok: #15804f;
  --ok-soft: #e6f6ee;
  --info: #1d6a96;
  --info-soft: #e9f2f9;
  --info-line: #c4dcec;

  /* --- Elevation --- */
  --shadow-sm: 0 1px 2px rgba(10, 28, 41, .07);
  --shadow: 0 1px 2px rgba(10, 28, 41, .06), 0 4px 14px rgba(10, 28, 41, .06);
  --shadow-lg: 0 14px 40px rgba(8, 24, 36, .18);

  /* --- Radii --- */
  --radius-lg: 16px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;

  /* --- Spacing scale (4px base) --- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 28px; --sp-8: 32px; --sp-10: 40px;

  /* --- Type --- */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system,
    Tahoma, "Noto Sans Ethiopic", Nyala, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas,
    "Liberation Mono", Menlo, monospace;
  --fs-xs: 11.5px;
  --fs-sm: 12.5px;
  --fs-13: 13px;
  --fs-base: 14px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: clamp(21px, 2.6vw, 27px);
  --fs-3xl: clamp(28px, 4.4vw, 42px);
  --track-wide: .06em;

  /* --- Motion --- */
  --dur: .18s;
  --ease: cubic-bezier(.2, .7, .3, 1);

  /* --- Layering --- */
  --z-sticky: 20;
  --z-header: 40;
  --z-modal: 60;
  --z-toast: 80;

  --focus-ring: 0 0 0 3px rgba(18, 145, 90, .3);
  --focus-ring-danger: 0 0 0 3px rgba(176, 42, 28, .25);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --brand: #1fae6c;
  --brand-2: #2cc37c;
  --brand-dark: #0d6b3d;
  --brand-soft: #11301f;
  --brand-line: #1d4e33;
  --on-brand: #04170d;

  --ink: #e9f0f6;
  --ink-2: #c3d2de;
  --muted: #95a9b8;
  --chrome: #08131b;
  --chrome-2: #0e2531;
  --chrome-3: #0a2c1d;
  --chrome-line: #1b3442;
  --chrome-ink: #e9f2f7;
  --chrome-muted: #93aabb;

  --bg: #0a141c;
  --bg-2: #0d1a24;
  --surface: #111e28;
  --surface-2: #162634;
  --surface-3: #1b2c3a;
  --line: #23384a;
  --line-2: #1d2f3e;
  --line-strong: #33506a;

  --danger: #e2705f;
  --danger-soft: #351a16;
  --danger-line: #5a2a22;
  --warn: #d9a04a;
  --warn-soft: #33260f;
  --warn-line: #56411c;
  --ok: #35c07f;
  --ok-soft: #10321f;
  --info: #5aa9d6;
  --info-soft: #11293a;
  --info-line: #24486a;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .28), 0 4px 16px rgba(0, 0, 0, .26);
  --shadow-lg: 0 16px 44px rgba(0, 0, 0, .5);

  --focus-ring: 0 0 0 3px rgba(44, 195, 124, .32);
}

/* Dark-mode contrast corrections: on soft green/tint surfaces the light brand
   tint is the readable ink (--brand-dark is a mid green and fails AA there).
   Specificity (html[data-theme] …) keeps these winning over the base rules. */
html[data-theme="dark"] .badge.green,
html[data-theme="dark"] .deadline.ok,
html[data-theme="dark"] .banner.success,
html[data-theme="dark"] .banner.ok,
html[data-theme="dark"] .verified-line,
html[data-theme="dark"] code.token,
html[data-theme="dark"] .tab-btn.active,
html[data-theme="dark"] .separation-statement strong,
html[data-theme="dark"] .stat .num { color: var(--brand-2); }
html[data-theme="dark"] .landing-card .ic,
html[data-theme="dark"] .guide-card .ic,
html[data-theme="dark"] .eyebrow .ico,
html[data-theme="dark"] .stat .ic { color: var(--brand-2); }
html[data-theme="dark"] .landing-card .card-link { color: var(--brand-2); }
html[data-theme="dark"] .quiet-link:hover { color: var(--brand-2); }

/* ==========================================================================
   2. BASE + ACCESSIBILITY
   ========================================================================== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--dur) ease, color var(--dur) ease;
}

h1, h2, h3, h4, h5 {
  margin: 0 0 var(--sp-3);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.25;
  color: var(--ink);
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 {
  font-size: var(--fs-sm);
  text-transform: uppercase;
  letter-spacing: var(--track-wide);
  color: var(--muted);
  font-weight: 700;
}
h5 { font-size: var(--fs-base); }
p { margin: 0 0 var(--sp-3); }
ul, ol { margin: 0 0 var(--sp-3); }
small { font-size: var(--fs-sm); }
hr { border: none; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }

/* Link tint is an element-level *default* only. The :where() wrappers keep its
   specificity at zero, so component colours always win. Without this, a plain
   `html[data-theme="dark"] a {}` (0,1,1) outranks `.btn` (0,1,0) and painted
   green ink on the green hero button in dark mode (readable only on hover,
   where `button:hover, .btn:hover` at 0,2,0 took over). */
:where(a) { color: var(--brand-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
:where(a):hover { color: var(--brand); }
:where(html[data-theme="dark"]) :where(a) { color: var(--brand-2); }
:where(html[data-theme="dark"]) :where(a):hover { color: var(--brand-2); }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: .93em; }
code {
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 5px;
}

:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: rgba(18, 145, 90, .22); }

/* Slim, unobtrusive scrollbars on console surfaces. */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

/* ==========================================================================
   3. LAYOUT
   ========================================================================== */
main.wrap {
  width: 100%;
  max-width: 1180px;
  margin: var(--sp-6) auto;
  padding: 0 var(--sp-5);
  flex: 1;
}
main.wrap > *:last-child { margin-bottom: 0; }

.center-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 68vh;
}

/* Page header block: eyebrow + title + subtitle, used above the tab strips. */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.page-head h1, .page-head h2 { margin: 0; }
.page-head .page-sub {
  margin: var(--sp-1) 0 0;
  color: var(--muted);
  font-size: var(--fs-13);
  max-width: 72ch;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow .ico { color: var(--brand); }

.section-head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-7) 0 var(--sp-3);
}
.section-head > :first-child { margin: 0; }
.section-head .line { flex: 1; height: 1px; background: var(--line); }

/* ==========================================================================
   4. APPLICATION CHROME
   ========================================================================== */
header.top {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding: 10px var(--sp-5);
  color: var(--chrome-ink);
  background:
    radial-gradient(120% 180% at 8% -40%, rgba(28, 145, 96, .38), transparent 60%),
    linear-gradient(115deg, var(--chrome) 0%, var(--chrome-2) 58%, var(--chrome-3) 130%);
  border-bottom: 1px solid var(--chrome-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04), 0 6px 22px rgba(6, 20, 30, .18);
}
header.top a, header.top .logo { color: var(--chrome-ink); }

/* Lockup: the icon span becomes a moulded brand mark. */
header.top .logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: var(--fs-md);
  letter-spacing: -.01em;
  white-space: nowrap;
  text-decoration: none;
  color: var(--chrome-ink);
}
header.top .logo:hover { color: #fff; opacity: .94; }
header.top .logo > [data-icon] {
  padding: 7px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(150deg, var(--brand-2), var(--brand-dark));
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 2px 6px rgba(0, 0, 0, .25);
}
header.top .logo > [data-icon] .ico { display: block; }

header.top .page-tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--chrome-muted);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, .06);
  padding: 4px 11px;
}
header.top .spacer { flex: 1; }

/* Ethiopian identity rule: green → gold → red, fixed under the chrome. */
header.top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  pointer-events: none;
  background: linear-gradient(90deg,
    var(--brand-dark) 0 33.33%, #e8b73a 33.33% 66.66%, var(--danger) 66.66% 100%);
}

header.top .topnav { display: flex; gap: 2px; margin-right: var(--sp-2); flex-wrap: wrap; }
header.top .topnav a {
  color: rgba(255, 255, 255, .9);
  text-decoration: none;
  font-size: var(--fs-13);
  font-weight: 600;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  transition: background var(--dur) ease, color var(--dur) ease;
}
header.top .topnav a:hover { color: #fff; background: rgba(255, 255, 255, .14); }
header.top .topnav a.active {
  color: #fff;
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .34);
}

/* Header controls (theme, language, logout) */
header.top button {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .18);
  color: var(--chrome-ink);
  padding: 7px 12px;
  font-size: var(--fs-13);
  font-weight: 600;
}
header.top button:hover { background: rgba(255, 255, 255, .24); filter: none; }
header.top select {
  width: auto;
  padding: 7px 10px;
  font-size: var(--fs-13);
  color: var(--chrome-ink);
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .2);
}
header.top select:focus { box-shadow: var(--focus-ring); border-color: rgba(255, 255, 255, .4); }
header.top select option { color: var(--ink); background: var(--surface); }

/* Signed-in identity chip */
.chip-user {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--radius-pill);
  padding: 3px 13px 3px 4px;
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--chrome-ink);
}
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(150deg, #fff, #d9e6ee);
  color: var(--brand-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--fs-13);
}

/* Notification bell + panel */
.bell-wrap { position: relative; display: inline-flex; align-items: center; }
.bell-btn { position: relative; padding: 7px 10px; line-height: 1; }
.bell-dot {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffcf4d;
  box-shadow: 0 0 0 2px rgba(11, 31, 44, .9);
}
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 340px;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: var(--z-header);
}
.notif-item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--line-2);
  font-size: var(--fs-13);
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }

/* ==========================================================================
   5. COMPONENTS
   ========================================================================== */

/* ---------- Buttons ---------- */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: inherit;
  font-size: var(--fs-base);
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
  white-space: nowrap;
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
  transition: background var(--dur) ease, box-shadow var(--dur) ease,
    transform .06s ease, border-color var(--dur) ease;
}
button:hover, .btn:hover { background: var(--brand-2); color: var(--on-brand); }
button:active, .btn:active { transform: translateY(1px); box-shadow: none; }
button:focus-visible, .btn:focus-visible { box-shadow: var(--focus-ring); }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

button.secondary, .btn.secondary {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
button.secondary:hover, .btn.secondary:hover {
  background: var(--surface-2);
  color: var(--brand-dark);
  border-color: var(--brand-line);
}

button.danger, .btn.danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
button.danger:hover, .btn.danger:hover { background: #93220f; color: #fff; }
button.danger:focus-visible { box-shadow: var(--focus-ring-danger); }

button.ghost, .btn.ghost {
  background: transparent;
  color: inherit;
  border-color: currentColor;
  box-shadow: none;
}
button.ghost:hover, .btn.ghost:hover { background: rgba(128, 150, 165, .16); }

button.small { padding: 6px 12px; font-size: var(--fs-sm); border-radius: 7px; }
button.icon-only { padding: 7px; }

/* ---------- Form controls ---------- */
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 1px rgba(10, 28, 41, .03);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .85; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: var(--focus-ring);
}
input[type="checkbox"], input[type="radio"] {
  width: auto;
  box-shadow: none;
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
textarea { min-height: 96px; resize: vertical; }

label {
  display: block;
  margin: var(--sp-3) 0 var(--sp-1);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .01em;
}
label.check-row, label.admin-check-row { color: var(--ink); }

.row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

.hint, .field-hint { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-1); }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  border-radius: 6px;
}
.pw-toggle:hover { background: var(--surface-3); color: var(--ink); }

.check-row { display: flex; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.check-row input[type="checkbox"] { width: auto; }
.admin-check-row { display: flex; align-items: center; gap: 10px; margin: var(--sp-4) 0; }
.admin-check-row input[type="checkbox"] { width: auto; }

.search-input { max-width: 400px; margin-bottom: var(--sp-3); }
.url-row { display: flex; gap: var(--sp-2); max-width: 620px; }
.url-row input { flex: 1; }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
}
.card > h1, .card > h2, .card > h3 { margin-top: 0; }
.card > h4:first-child { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }

/* Optional card header/footer rows (additive markup; safe if absent). */
.card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--line-2);
}
.card-head .card-title { margin: 0; font-size: var(--fs-lg); font-weight: 700; }
.card-head .card-sub { margin: 0; color: var(--muted); font-size: var(--fs-sm); }
.card-foot {
  margin-top: var(--sp-4);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-2);
  color: var(--muted);
  font-size: var(--fs-sm);
}

.login-card {
  max-width: 430px;
  width: 100%;
  padding: var(--sp-6);
  border-top: 3px solid var(--brand);
}
.login-card .tabs { margin-bottom: var(--sp-5); }
.login-card .muted { margin-top: 0; }

.muted { color: var(--muted); font-size: var(--fs-13); }
.muted a { font-weight: 600; }
.grow { flex: 1; }

/* ---------- Tabs (segmented control) ---------- */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  padding: 4px;
  margin-bottom: var(--sp-5);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 2px rgba(10, 28, 41, .04);
}
.tab-btn {
  position: relative;
  background: transparent;
  color: var(--ink-2);
  border: 1px solid transparent;
  border-radius: 9px;
  box-shadow: none;
  padding: 8px 15px;
  font-size: var(--fs-13);
  font-weight: 600;
}
.tab-btn:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-btn.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--brand-dark);
  box-shadow: var(--shadow-sm);
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 3px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
}
.tab-btn .count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1;
}

/* ---------- Stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.stat {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  text-align: left;
  transition: transform .12s ease, box-shadow .15s ease;
}
.stat::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--brand-2), var(--brand-dark));
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat .num {
  display: block;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stat .lbl {
  display: block;
  margin-top: 2px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  text-transform: uppercase;
}
.stat .ic { color: var(--brand); margin-bottom: 2px; }
.stat.alert::before { background: linear-gradient(180deg, var(--danger), #8a2114); }
.stat.alert .num { color: var(--danger); }
.stat.ok::before { background: linear-gradient(180deg, var(--ok), #0d6b41); }
.stat.ok .num { color: var(--ok); }

/* ---------- Data tables ---------- */
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
table.data {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-13);
}
table.data th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: top;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td .badge + .badge { margin-left: var(--sp-1); }

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: var(--radius-pill);
  padding: 3px 10px 3px 8px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: capitalize;
  white-space: nowrap;
  /* Neutral default: a badge whose variant class is added later by JS still
     renders as an intentional chip instead of transparent text. */
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge.red { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }
.badge.green { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-line); }
.badge.amber { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.badge.gray {
  background: var(--surface-3);
  color: var(--muted);
  border-color: var(--line);
}
.badge.blue { background: var(--info-soft); color: var(--info); border-color: var(--info-line); }

/* Filter chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: var(--sp-3); align-items: center; }
.chip {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: none;
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.chip:hover { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
  box-shadow: var(--shadow-sm);
}

/* Masked/technical values, API keys, ledger payloads */
.detail-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-13);
  overflow-wrap: anywhere;
}
.detail-box code, .detail-box .token { font-size: var(--fs-sm); }
code.token {
  display: inline-block;
  word-break: break-all;
  font-size: var(--fs-xs);
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid var(--brand-line);
  padding: 2px 6px;
  border-radius: 5px;
}

/* Key/value blocks (receipt facts, ledger rows, details modals) */
.kv { margin: 6px 0; font-size: var(--fs-base); }
.kv .k {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .01em;
}
.rc-facts { margin-top: var(--sp-3); }
.rc-facts > div {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: var(--fs-13);
}
.rc-facts > div:last-child { border-bottom: none; }
.rc-facts .k {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px var(--sp-4);
  font-size: var(--fs-13);
  margin: var(--sp-3) 0;
}
.grid-2col label { margin: 2px 0; }

/* ---------- Empty & loading states ---------- */
.empty {
  text-align: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--muted);
  font-size: var(--fs-13);
}
.empty .empty-icon {
  display: inline-flex;
  padding: 14px;
  margin-bottom: var(--sp-3);
  border-radius: var(--radius);
  background: var(--surface-3);
  color: var(--muted);
}
.empty p { margin: 0; max-width: 46ch; margin-inline: auto; }

.skel {
  position: relative;
  overflow: hidden;
  height: 74px;
  border-radius: var(--radius);
  margin-bottom: var(--sp-3);
  background: var(--surface-3);
  border: 1px solid var(--line-2);
}
.skel::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  animation: skel 1.4s infinite;
}
html[data-theme="dark"] .skel::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}
@keyframes skel { 100% { transform: translateX(100%); } }

/* ==========================================================================
   6. FEATURE SURFACES — consent, retrieval receipts, lifecycle, compliance
   ========================================================================== */

/* ---------- Consent request cards (user dashboard) ---------- */
.request-item {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-3);
  transition: box-shadow .15s ease, transform .12s ease;
}
.request-item:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.request-item .head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.request-item .head strong { font-size: var(--fs-md); }
.request-item .actions {
  margin-top: var(--sp-3);
  padding-top: var(--sp-3);
  border-top: 1px solid var(--line-2);
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ---------- Retrieval receipt cards ---------- */
.receipt-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-3);
  transition: box-shadow .15s ease;
}
.receipt-card:hover { box-shadow: var(--shadow); }
.receipt-card.pending { border-left-color: var(--warn); }
.receipt-card.overdue { border-left-color: var(--danger); }
.receipt-card.flagged { border-left-color: var(--danger); background: var(--danger-soft); }
.receipt-card.attested { border-left-color: var(--ok); }

/* Shared receipt sub-parts. Deliberately NOT scoped to .receipt-card: the
   ledger / attestation modals reuse the same key-value block. */
.rc-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.rc-id {
  font-weight: 700;
  font-size: var(--fs-base);
  font-family: var(--font-mono);
  letter-spacing: -.01em;
}
.rc-actions { margin-top: var(--sp-3); display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* Revoked/expired consent rows inside the Access History table */
tr.lifecycle.revoked td { background: var(--danger-soft); }
tr.lifecycle.expired td { background: var(--surface-3); }

/* Append-only lifecycle ledger states (row tinting in tables) */
tr.lifecycle.pending td { background: var(--warn-soft); }
tr.lifecycle.attested td { background: var(--brand-soft); }
tr.lifecycle.overdue td { background: var(--warn-soft); }
tr.lifecycle.flagged td { background: var(--danger-soft); }

/* ---------- Compliance meter & deadline pills ---------- */
.meter {
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  border: 1px solid var(--line);
  overflow: hidden;
  margin: var(--sp-2) 0 var(--sp-1);
}
.meter > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-2));
  transition: width .4s var(--ease);
}
.meter.warn > i { background: linear-gradient(90deg, var(--warn), #e8b73a); }
.meter.bad > i { background: linear-gradient(90deg, var(--danger), #e0705f); }

.deadline {
  display: inline-block;
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid transparent;
  font-variant-numeric: tabular-nums;
}
.deadline.ok { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand-line); }
.deadline.soon { background: var(--warn-soft); color: var(--warn); border-color: var(--warn-line); }
.deadline.late { background: var(--danger-soft); color: var(--danger); border-color: var(--danger-line); }

/* ---------- Regulator / institution lifecycle detail ---------- */
.lc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.sig-box {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  font-size: var(--fs-sm);
  word-break: break-all;
  font-family: var(--font-mono);
  color: var(--ink-2);
}
.oblig-note {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
  margin-top: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: var(--fs-13);
}
.oblig-note .ico { color: var(--warn); margin-top: 2px; }

/* Manual consent check result (pure status, never audited). */
.verified-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-2);
  padding: 4px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-radius: var(--radius-pill);
}

/* ---------- PDPP unbundling + automation disclosure ---------- */
/* Purpose separation (Art. 6/7 unbundling): the consent modal must state
   plainly which purpose is being consented to and that it is not bundled. */
.separation-statement {
  margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--ink-2);
}
.separation-statement strong { color: var(--brand-dark); }

/* Automated decision-making disclosure (PDPP Art. 24(1)(m)) — the user must
   acknowledge explicitly before the request can be approved. */
.automation-warning {
  margin: var(--sp-3) 0;
  padding: var(--sp-3) var(--sp-4);
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius-sm);
  font-size: var(--fs-13);
  line-height: 1.55;
  color: var(--warn);
}
.automation-warning .check-row {
  margin-top: var(--sp-2);
  display: flex;
  gap: var(--sp-2);
  align-items: flex-start;
}
.automation-warning .check-row span { font-size: var(--fs-13); color: var(--ink-2); }
.automation-warning input[type="checkbox"] { width: auto; margin-top: 2px; }

/* Notification timestamp inside the bell panel */
.notif-item .when {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* ---------- Timeline ("My Data" feed) ---------- */
.tl { position: relative; padding-left: var(--sp-7); }
.tl::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-line), var(--line));
}
.tl-item { position: relative; padding: 6px 0 var(--sp-4); }
.tl-item .dot {
  position: absolute;
  left: -26px;
  top: 11px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--line-strong);
  background: var(--muted);
}
.tl-item.approved .dot { background: var(--ok); }
.tl-item.revoked .dot { background: var(--danger); }
.tl-item.requested .dot { background: var(--warn); }
.tl-item.rejected .dot { background: #8fa1b1; }
.tl-item.expired .dot { background: #8fa1b1; }
.tl-item .tl-title { font-weight: 600; font-size: var(--fs-base); }
.tl-item .tl-sub { color: var(--muted); font-size: var(--fs-sm); margin-top: 2px; }

/* ---------- Compliance / info banners ---------- */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-13);
  line-height: 1.5;
  background: var(--surface-2);
  color: var(--ink-2);
}
.banner .ico { flex: none; margin-top: 2px; }
.banner.info {
  background: var(--info-soft);
  color: var(--info);
  border-color: var(--info-line);
  border-left-color: var(--info);
}
.banner.warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-line);
  border-left-color: var(--warn);
}
.banner.danger, .banner.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
  border-left-color: var(--danger);
}
.banner.success, .banner.ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: var(--brand-line);
  border-left-color: var(--brand);
}
.banner b, .banner strong { color: inherit; }

/* Sovereign-mode enforcement marker */
.pill-sovereign {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--warn);
  border: 1px solid var(--warn);
  border-radius: var(--radius-pill);
  background: repeating-linear-gradient(45deg,
    var(--warn-soft), var(--warn-soft) 6px, var(--surface) 6px, var(--surface) 12px);
}

/* ---------- Toolbars ---------- */
.toolbar {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}
.toolbar h3 { margin: 0; }
.toolbar .chips { margin: 0; }

/* ---------- Modals ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(7, 20, 29, .55);
  backdrop-filter: blur(3px);
  animation: fade-in .16s ease;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-6);
  animation: modal-in .2s var(--ease);
}
.modal h3 { margin-top: 0; padding-right: var(--sp-6); }
.modal .muted { margin-bottom: var(--sp-4); }
.modal .detail-box { margin: var(--sp-3) 0; }
.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--line-2);
}
.modal .modal-actions button { min-width: 120px; }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}

/* ---------- Toasts ---------- */
.toast-zone {
  position: fixed;
  right: var(--sp-5);
  bottom: var(--sp-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-end;
  pointer-events: none;
}
.toast {
  max-width: 420px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-13);
  font-weight: 500;
  animation: toast-in .2s var(--ease);
}
.toast.success { border-left-color: var(--ok); }
.toast.error, .toast.danger { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.info { border-left-color: var(--info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Footer ---------- */
footer.site {
  margin-top: var(--sp-8);
  padding: var(--sp-6) var(--sp-5) var(--sp-8);
  color: var(--muted);
  font-size: var(--fs-sm);
  text-align: center;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
footer.site .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2) var(--sp-5);
  margin-bottom: var(--sp-3);
}
footer.site .footer-links a {
  color: var(--ink-2);
  font-weight: 600;
  text-decoration: none;
}
footer.site .footer-links a:hover { color: var(--brand-dark); text-decoration: underline; }
footer.site .footer-meta { margin: 0; }
footer.site .footer-meta + .footer-meta { margin-top: 4px; }

/* ==========================================================================
   7. PUBLIC SITE — landing, pricing, guides, changelog
   ========================================================================== */
.hero {
  padding: var(--sp-8) var(--sp-4) var(--sp-5);
  text-align: center;
}
.hero h1 {
  font-size: var(--fs-3xl);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: var(--sp-3);
  background: linear-gradient(120deg, var(--brand-dark), var(--brand-2) 60%, #0f7d8c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.sub {
  max-width: 66ch;
  margin: 0 auto;
  color: var(--muted);
  font-size: var(--fs-md);
  line-height: 1.6;
}
.hero .eyebrow { justify-content: center; }
.hero-actions {
  display: flex;
  justify-content: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-top: var(--sp-6);
}
.hero-actions .btn { padding: 11px 22px; }

/* Compliance / trust bar */
.compliance-row {
  display: flex;
  gap: var(--sp-2);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--sp-6);
}
.compliance-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}
.compliance-badge .ico { color: var(--brand); }

/* Landing cards */
.landing-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-5);
  text-align: left;
}
.landing-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease),
    border-color .15s ease;
}
.landing-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-line);
  color: var(--ink);
}
.landing-card .ic {
  display: inline-flex;
  padding: 11px;
  border-radius: var(--radius);
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  margin-bottom: var(--sp-3);
}
.landing-card h3 { margin: 0 0 6px; font-size: var(--fs-lg); }
.landing-card p { margin: 0; color: var(--muted); font-size: var(--fs-13); line-height: 1.55; }
.landing-card .card-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--sp-3);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-dark);
}

/* How-it-works steps (additive markup on the landing page) */
.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-4);
  margin-top: var(--sp-4);
  text-align: left;
}
.step-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5) var(--sp-4) var(--sp-4);
  box-shadow: var(--shadow-sm);
}
.step-card .step-num {
  position: absolute;
  top: -12px;
  left: var(--sp-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-sm);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.step-card h4 { margin: var(--sp-1) 0 6px; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: var(--fs-base); }
.step-card p { margin: 0; color: var(--muted); font-size: var(--fs-13); }

/* ---------- Pricing ---------- */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-7) 0;
}
.price-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-6) var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.price-card.highlight {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand), var(--shadow-lg);
}
.price-card h3 { margin: 0; font-size: var(--fs-lg); }
.price-card .price {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.price-card .price span { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.price-card ul { margin: 0; padding-left: var(--sp-5); color: var(--muted); font-size: var(--fs-13); line-height: 1.75; }
.price-card .btn { margin-top: auto; }
.ribbon {
  position: absolute;
  top: -12px;
  right: var(--sp-4);
  padding: 4px 12px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-sm);
}

/* ---------- Developer guides ---------- */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(224px, 1fr));
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
}
.guide-card {
  display: block;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .15s var(--ease),
    border-color .15s ease;
}
.guide-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand-line);
  color: var(--ink);
}
.guide-card .ic {
  display: inline-flex;
  padding: 10px;
  border-radius: var(--radius-sm);
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid var(--brand-line);
  margin-bottom: var(--sp-2);
}
.guide-card h3 { margin: 0 0 4px; font-size: var(--fs-md); }
.guide-card p { margin: 0; color: var(--muted); font-size: var(--fs-13); }
.guide-card code { font-size: var(--fs-sm); }

/* ---------- Code blocks & changelog ---------- */
.codeblock {
  margin: 0;
  padding: var(--sp-4) var(--sp-5);
  background: #0c1b26;
  color: #dbe7ef;
  border: 1px solid #16303f;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.65;
  tab-size: 2;
}
html[data-theme="dark"] .codeblock { background: #08131b; border-color: var(--line); }
.card .codeblock { margin-bottom: var(--sp-3); }

.changelog { display: flex; flex-direction: column; gap: var(--sp-4); margin: var(--sp-6) 0; }
.cl-entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow-sm);
}
.cl-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-2); flex-wrap: wrap; }
.cl-version {
  font-weight: 800;
  font-size: var(--fs-md);
  font-family: var(--font-mono);
  letter-spacing: -.01em;
}
.cl-date { color: var(--muted); font-size: var(--fs-sm); }
.cl-entry ul { margin: var(--sp-2) 0 0; padding-left: var(--sp-5); color: var(--muted); font-size: var(--fs-13); line-height: 1.7; }
.cl-entry ul li { margin-bottom: 3px; }
.cl-entry .badge { margin-left: auto; }

/* ==========================================================================
   8. UTILITIES
   ========================================================================== */
.hidden { display: none !important; }
.w-auto, .toolbar select { width: auto; }
.full-w { width: 100%; }
.maxw-220 { max-width: 220px; }
.maxw-560 { max-width: 620px; }
.nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.tnum { font-variant-numeric: tabular-nums; }
.stack { display: flex; flex-direction: column; gap: var(--sp-3); }
.inline-flex { display: inline-flex; align-items: center; gap: var(--sp-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 2px; }
.mt-8 { margin-top: var(--sp-2); }
.mt-12 { margin-top: var(--sp-3); }
.mt-14 { margin-top: 14px; }
.mt-16 { margin-top: var(--sp-4); }
.mt-18 { margin-top: 18px; }
.mt-30 { margin-top: var(--sp-8); }
.mb-8 { margin-bottom: var(--sp-2); }
.mb-12 { margin-bottom: var(--sp-3); }
.padded { padding: var(--sp-3); }
.padded-lg { padding: var(--sp-5); }
.btn-row { margin-top: var(--sp-4); display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center; }
.danger-zone {
  padding-top: var(--sp-4);
  border-top: 1px solid var(--danger-line);
}
.danger-zone button.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.danger-zone button.danger:hover { background: var(--danger); color: #fff; }
.ico { flex-shrink: 0; vertical-align: middle; }
/* Tertiary entry point (e.g. the administrator sign-in next to the hero CTAs):
   present and legible, but visually subordinate to the filled buttons. */
.quiet-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.quiet-link:hover { color: var(--brand-dark); }
.quiet-link:focus-visible { box-shadow: var(--focus-ring); }

/* ==========================================================================
   9. RESPONSIVE · MOTION · PRINT
   ========================================================================== */
@media (max-width: 900px) {
  main.wrap { padding: 0 var(--sp-4); margin: var(--sp-5) auto; }
  .page-head { align-items: flex-start; }
}

/* Mobile & touch optimisation */
@media (max-width: 640px) {
  main.wrap { margin: var(--sp-4) auto; padding: 0 var(--sp-3); }

  header.top { padding: 9px var(--sp-3); gap: var(--sp-2); }
  header.top .page-tag { display: none; }
  header.top .logo { font-size: var(--fs-base); }
  header.top .logo > [data-icon] { padding: 6px; }
  header.top select { max-width: 118px; }
  .chip-user { font-size: var(--fs-sm); padding: 3px 10px 3px 3px; }

  /* 16px inputs stop iOS Safari from zooming on focus */
  input, select, textarea { font-size: 16px; }
  label { font-size: var(--fs-sm); }
  select { padding-right: 36px; }

  button, .btn { min-height: 44px; padding: 10px 16px; }
  button.small { min-height: 38px; padding: 7px 12px; }

  .card { padding: var(--sp-4); border-radius: var(--radius); }
  .login-card { padding: var(--sp-5); }
  .card-head { gap: var(--sp-2); }

  /* Tab strips become swipeable rows instead of wrapping tall */
  .tabs {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 4px;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { white-space: nowrap; flex: 0 0 auto; }

  .table-wrap { margin: 0 calc(var(--sp-4) * -1); border-radius: 0; border-left: none; border-right: none; }
  table.data { font-size: var(--fs-sm); }
  table.data th, table.data td { padding: 9px 10px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); }
  .stat { padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4); }
  .stat .num { font-size: 21px; }
  .stat .lbl { font-size: var(--fs-xs); }

  .request-item, .receipt-card { padding: var(--sp-3) var(--sp-4); }
  .rc-facts > div { flex-direction: column; gap: 2px; }
  .rc-actions button { width: 100%; }
  .grid-2col { grid-template-columns: 1fr; }
  .lc-head { align-items: flex-start; }

  /* Lifecycle / compliance surfaces on small screens */
  .deadline { font-size: var(--fs-xs); padding: 2px 8px; }
  .meter { height: 12px; }
  .sig-box { font-size: var(--fs-xs); padding: 9px 10px; }
  .oblig-note { font-size: var(--fs-sm); padding: var(--sp-2) var(--sp-3); }
  .modal { padding: var(--sp-4); }
  .modal .detail-box { padding: var(--sp-2) var(--sp-3); }
  .modal .modal-actions { flex-direction: column-reverse; }
  .modal .modal-actions button { width: 100%; }
  .toolbar h3 { font-size: var(--fs-md); width: 100%; }

  .notif-panel { width: min(330px, calc(100vw - 28px)); }
  .toast-zone { left: var(--sp-3); right: var(--sp-3); bottom: var(--sp-3); align-items: stretch; }
  .toast { max-width: none; }

  .hero { padding: var(--sp-6) var(--sp-1) var(--sp-4); }
  .hero-actions .btn { width: 100%; }
  .landing-cards, .pricing-grid, .guide-grid { grid-template-columns: 1fr; }
  .price-card.highlight { box-shadow: 0 0 0 1px var(--brand), var(--shadow); }
  .step-grid { grid-template-columns: 1fr; }
  footer.site { padding: var(--sp-5) var(--sp-4) var(--sp-8); }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* Touch devices get larger hit areas everywhere */
@media (pointer: coarse) {
  button, .chip, .tab-btn { min-height: 44px; }
  .chip { padding: 9px 16px; }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .landing-card:hover, .guide-card:hover, .stat:hover { transform: none; }
}

/* Windows High Contrast / forced colours stay legible */
@media (forced-colors: active) {
  button, .btn, .chip, .badge, .card, .table-wrap { border: 1px solid ButtonText; }
  .stat::before, header.top::after { display: none; }
}

/* --------------------------------------------------------------------------
   Print: regulators and auditors print consent evidence. Chrome, toasts and
   action buttons are dropped so tables and receipts render on paper.
   -------------------------------------------------------------------------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #fff; --surface-3: #fff; }
  header.top {
    position: static;
    color: #000;
    background: none !important;
    border-bottom: 1px solid #999;
  }
  header.top::after { display: none; }
  header.top .logo, header.top .logo > [data-icon] {
    background: none !important;
    color: #000 !important;
    border-color: #999 !important;
    box-shadow: none !important;
  }
  header.top .page-tag { color: #333; border-color: #999; background: none; }
  header.top .topnav, header.top button, header.top select,
  .toast-zone, .modal-backdrop, .btn-row, .danger-zone,
  .chips, .toolbar button, .empty-icon, .skel { display: none !important; }
  main.wrap { max-width: none; margin: 0; padding: 0; }
  .card, .stat, .receipt-card, .request-item, .table-wrap, .cl-entry {
    box-shadow: none !important;
    border-color: #bbb !important;
    break-inside: avoid;
  }
  .stat-grid { break-inside: avoid; }
  table.data th { position: static; background: #f2f2f2; color: #000; }
  table.data td, table.data th { border-color: #ccc; }
  a { color: #000; text-decoration: none; }
  footer.site { border-top: 1px solid #999; background: none; }
}

