/* Self-hosted Geist / Geist Mono (latin subset, OFL). See assets/fonts/. */
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/assets/fonts/geist-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/geist-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/geist-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/geist-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/geist-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/geist-mono-500.woff2') format('woff2');
}

/* ====================================================================
   Sovereign Audit Attestation — shared UI styles
   Derived from the Sovereign Design System v0.2 (spec-sheet aesthetic:
   warm paper, ink text, hairline rules, Geist / Geist Mono, near-zero radii).
   This stylesheet intentionally styles BOTH the design-system class names
   and the legacy class names the page scripts rely on, so behaviour is
   preserved while the visual language is unified.
   ==================================================================== */

:root {
  /* color */
  --bg:           #fafaf8;   /* warm paper */
  --bg-2:         #f3f2ee;   /* lift */
  --bg-3:         #ebeae5;   /* sunken */
  --ink:          #15140f;   /* primary text */
  --ink-2:        #3b3a34;   /* secondary text */
  --ink-3:        #6b6a62;   /* muted / metadata value */
  --ink-4:        #a3a299;   /* placeholder / divider hint */
  --rule:         #d9d7cf;   /* hairline */
  --rule-2:       #c6c4ba;   /* stronger hairline */
  --accent:       oklch(0.46 0.06 245);
  --accent-soft:  oklch(0.46 0.06 245 / 0.10);
  --signal:       oklch(0.60 0.16 145);   /* ok / verified */
  --warn:         oklch(0.62 0.16 60);    /* warn */
  --danger:       oklch(0.55 0.20 25);    /* tamper / fail */

  /* categorical pastels — tags only, never state */
  --cat-sage:  oklch(0.90 0.04 145);
  --cat-mist:  oklch(0.88 0.04 240);
  --cat-peach: oklch(0.90 0.05 50);
  --cat-lilac: oklch(0.88 0.04 300);
  --cat-ochre: oklch(0.92 0.05 90);
  --cat-rose:  oklch(0.89 0.04 15);

  /* brand blue — prototype's deep slate used for the evidence banner/headband,
     the enabled sign button, and the selected-choice outline */
  --brand-blue:   #2e4d6b;
  --brand-blue-2: #284360;
  --on-brand:     #f6f8fa;
  --select-blue:  #3f6ea3;

  /* type */
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --t-7: 11px;  --t-6: 12px;  --t-5: 13px;  --t-4: 14px;
  --t-3: 16px;  --t-2: 19px;  --t-1: 24px;  --t-0: 34px;  --t-display: 52px;

  /* spacing (4px scale) */
  --s-1: 4px;  --s-2: 8px;  --s-3: 12px;  --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;  --s-8: 72px; --s-9: 112px;

  /* radii — almost zero */
  --r-0: 0px; --r-1: 2px; --r-2: 4px; --r-full: 999px;

  /* layout */
  --col: 1120px;
  --gutter: 32px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--t-4);
  line-height: 1.55;
  font-weight: 400;
  font-feature-settings: "ss01", "cv11", "calt";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--ink); color: var(--bg); }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--ink-4); }
a:hover { border-bottom-color: var(--ink); }

h1, h2, h3, h4 { font-weight: 400; letter-spacing: -0.01em; }

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

code, pre { font-family: var(--mono); }

/* ── topbar ─────────────────────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: saturate(140%) blur(6px);
}
.topbar-inner {
  max-width: var(--col); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between;
  height: 48px;
  font-family: var(--mono); font-size: var(--t-6);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); border: 0; }
.topbar-brand img { display: block; flex: none; }
.topbar-brand b { font-weight: 500; }
.topbar-brand span { color: var(--ink-3); }
.topbar-nav { display: flex; gap: var(--s-5); align-items: center; }
.topbar-nav a { color: var(--ink-3); border: 0; }
.topbar-nav a:hover { color: var(--ink); }

/* ── page meta strip (doc / view / status) ──────────────────────── */
.meta-strip {
  max-width: var(--col); margin: 0 auto; padding: var(--s-3) var(--gutter);
  display: flex; flex-wrap: wrap; gap: 0;
  font-family: var(--mono); font-size: var(--t-6); color: var(--ink-3);
  border-bottom: 1px solid var(--rule);
}
.meta-strip .kv { padding-right: var(--s-5); white-space: nowrap; }
.kv b { color: var(--ink); font-weight: 500; }

/* ── layout ─────────────────────────────────────────────────────── */
.wrap, .container {
  max-width: var(--col); margin: 0 auto; padding: var(--s-7) var(--gutter);
}
.container--narrow { max-width: 680px; }
.container--mid    { max-width: 920px; }

.page-title {
  font-size: var(--t-0); line-height: 1.1; letter-spacing: -0.015em;
  margin: 0 0 var(--s-2) 0; font-weight: 400;
}
.page-lede { color: var(--ink-3); font-size: var(--t-3); margin: 0 0 var(--s-6) 0; max-width: 64ch; }

.label, label {
  font-family: var(--mono); font-size: var(--t-7); color: var(--ink-3);
  letter-spacing: 0.04em; text-transform: lowercase;
}

/* ── panel / card ───────────────────────────────────────────────── */
.panel, .card {
  border: 1px solid var(--rule); background: var(--bg);
  padding: var(--s-5); border-radius: 0; box-shadow: none; margin-bottom: var(--s-5);
}
.card h2, .panel h2 { font-size: var(--t-1); margin: 0 0 var(--s-3) 0; }
.card h3, .panel h3 { font-size: var(--t-2); margin: 0 0 var(--s-3) 0; }
.card h4, .panel h4 { font-size: var(--t-3); margin: 0 0 var(--s-2) 0; font-weight: 500; }
.card p, .panel p { color: var(--ink-2); }

.empty-state {
  border: 1px dashed var(--rule-2); background: var(--bg);
  text-align: center; padding: var(--s-7); color: var(--ink-3);
  font-family: var(--mono); font-size: var(--t-6);
}

/* ── forms ──────────────────────────────────────────────────────── */
label { display: block; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="number"],
input[type="file"], textarea, select {
  font-family: var(--mono); font-size: var(--t-5);
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--rule-2); border-radius: var(--r-1);
  padding: 9px 10px; outline: 0; width: 100%;
}
textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { border-color: var(--ink); }
/* iOS Safari zooms in (and never zooms back) when a focused control is under
   16px, which overflows the viewport and reflows to the desktop layout. Keep
   touch form controls at 16px to suppress the focus-zoom. */
@media (pointer: coarse) {
  input[type="text"], input[type="password"], input[type="number"],
  input[type="file"], textarea, select { font-size: 16px; }
}
input[type="file"] { padding: 7px 10px; background: var(--bg-2); cursor: pointer; }

/* ── buttons ────────────────────────────────────────────────────── */
button, .btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--mono); font-size: var(--t-5); line-height: 1;
  padding: 10px 16px;
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  border-radius: var(--r-1); cursor: pointer;
  transition: background 80ms linear, color 80ms linear, border-color 80ms linear;
}
button:hover, .btn:hover { background: transparent; color: var(--ink); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { background: var(--ink); color: var(--bg); }

.btn--ghost {
  background: transparent; color: var(--ink); border-color: var(--rule-2);
}
.btn--ghost:hover { border-color: var(--ink); background: transparent; color: var(--ink); }

/* semantic decision buttons — ghost with a leading state dot */
.btn-approve, .btn-reject, .btn-defer {
  background: transparent; color: var(--ink); border: 1px solid var(--rule-2);
}
.btn-approve::before, .btn-reject::before, .btn-defer::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.btn-approve::before { background: var(--signal); }
.btn-reject::before  { background: var(--danger); }
.btn-defer::before   { background: var(--warn); }
/* the decision matching the AI recommendation is emphasized */
.actions .recommended { box-shadow: 0 0 0 2px var(--ink); font-weight: 600; }
.btn-approve:hover { border-color: color-mix(in oklab, var(--signal) 60%, var(--ink)); background: transparent; color: var(--ink); }
.btn-reject:hover  { border-color: color-mix(in oklab, var(--danger) 60%, var(--ink)); background: transparent; color: var(--ink); }
.btn-defer:hover   { border-color: color-mix(in oklab, var(--warn) 60%, var(--ink)); background: transparent; color: var(--ink); }

a.download-link, .download-link {
  font-family: var(--mono); font-size: var(--t-6);
  border: 1px solid var(--rule-2); border-radius: var(--r-1);
  padding: 6px 10px; color: var(--ink); background: var(--bg);
}
a.download-link:hover { border-color: var(--ink); }

/* ── badges + dots ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-family: var(--mono); font-size: var(--t-7); line-height: 1;
  padding: 5px 8px; border: 1px solid var(--rule-2); border-radius: var(--r-1);
  color: var(--ink-2); background: var(--bg); letter-spacing: 0.04em;
}
.badge.success, .badge--ok   { color: var(--ink); border-color: color-mix(in oklab, var(--signal) 50%, var(--rule)); }
.badge.warn,    .badge--warn { color: var(--ink); border-color: color-mix(in oklab, var(--warn) 60%, var(--rule)); }
.badge.error,   .badge--fail { color: var(--ink); border-color: color-mix(in oklab, var(--danger) 50%, var(--rule)); }
.badge.success::before, .badge.warn::before, .badge.error::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; display: inline-block;
}
.badge.success::before { background: var(--signal); }
.badge.warn::before    { background: var(--warn); }
.badge.error::before   { background: var(--danger); }

/* domain category tag (submission domain) */
.cat-tag {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: var(--t-7); letter-spacing: 0.04em;
  padding: 4px 8px; border-radius: var(--r-1);
  border: 1px solid color-mix(in oklab, var(--cat-mist) 60%, var(--rule-2));
  background: color-mix(in oklab, var(--cat-mist) 55%, var(--bg)); color: var(--ink-2);
}

/* ── callouts (legacy .result) ──────────────────────────────────── */
.result, .callout {
  font-size: var(--t-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-1);
  margin-top: var(--s-4); border: 1px solid var(--rule-2); background: var(--bg-2); color: var(--ink-2);
  border-left-width: 3px;
}
.result.success, .callout--ok   { background: color-mix(in oklab, var(--signal) 8%, var(--bg)); border-left-color: var(--signal); color: var(--ink); }
.result.error,   .callout--fail { background: color-mix(in oklab, var(--danger) 8%, var(--bg)); border-left-color: var(--danger); color: var(--ink); }
.callout--warn { background: color-mix(in oklab, var(--warn) 10%, var(--bg)); border-left-color: var(--warn); color: var(--ink); }

/* ── tabs (submit) ──────────────────────────────────────────────── */
.tab-group { display: flex; gap: var(--s-1); margin-bottom: var(--s-4); }
.tab {
  font-family: var(--mono); font-size: var(--t-6); letter-spacing: 0.02em;
  padding: 8px 14px; border: 1px solid var(--rule-2); background: var(--bg);
  color: var(--ink-3); cursor: pointer; border-radius: var(--r-1);
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── file drop ──────────────────────────────────────────────────── */
.file-drop {
  border: 1px dashed var(--rule-2); border-radius: var(--r-1);
  padding: var(--s-7) var(--s-5); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s; margin-bottom: var(--s-3);
  color: var(--ink-3);
}
.file-drop:hover, .file-drop.dragover { border-color: var(--ink); background: var(--bg-2); }
.file-drop input[type="file"] { display: none; }
.file-info { margin-top: var(--s-2); font-family: var(--mono); font-size: var(--t-6); color: var(--ink-3); }

/* ── tables ─────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: var(--t-6); }
table td, table th { text-align: left; padding: 9px var(--s-3) 9px 0; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink); }
table td:first-child { color: var(--ink-3); white-space: nowrap; }

/* ── code / pre ─────────────────────────────────────────────────── */
pre {
  background: var(--bg-2); border: 1px solid var(--rule); color: var(--ink);
  padding: var(--s-4); border-radius: var(--r-1);
  font-size: var(--t-6); line-height: 1.7; overflow-x: auto;
}
code { font-size: 0.92em; color: var(--ink); }
details summary { cursor: pointer; color: var(--ink-3); font-family: var(--mono); font-size: var(--t-6); margin-bottom: var(--s-2); }
details summary:hover { color: var(--ink); }

/* ── verify sections (audit) ────────────────────────────────────── */
.verify-section {
  border: 1px solid var(--rule); border-left: 3px solid var(--rule-2);
  background: var(--bg-2); border-radius: var(--r-1);
  padding: var(--s-5); margin-bottom: var(--s-5);
}
.verify-section h4 { margin: 0 0 var(--s-2) 0; }
.verify-section p { font-size: var(--t-5); color: var(--ink-3); margin: 0 0 var(--s-3) 0; }
.verify-result { margin-top: var(--s-3); font-family: var(--mono); font-size: var(--t-6); }

/* ── user badge (approver) ──────────────────────────────────────── */
/* account entry: a round avatar with the signed-in user's initials → /profile */
.topbar-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: color-mix(in oklab, var(--brand-blue) 14%, var(--bg));
  color: var(--brand-blue); border: 1px solid color-mix(in oklab, var(--brand-blue) 22%, transparent);
  font-family: var(--mono); font-size: var(--t-7); font-weight: 500; letter-spacing: .02em;
}
.topbar-avatar:hover { border-color: var(--brand-blue);
  background: color-mix(in oklab, var(--brand-blue) 20%, var(--bg)); color: var(--brand-blue); }

/* ── decision modal (approver) ──────────────────────────────────── */
.modal { display: none; position: fixed; inset: 0; background: color-mix(in oklab, var(--ink) 45%, transparent); z-index: 1000; align-items: center; justify-content: center; padding: var(--s-4); }
.modal.active { display: flex; }
.modal-content { background: var(--bg); border: 1px solid var(--rule-2); border-radius: var(--r-1); padding: var(--s-6); max-width: 520px; width: 100%; overflow-wrap: anywhere; }
.modal-content h3 { margin-top: 0; }
.modal-content #modalDesc { color: var(--ink-2); }
.submission-id {
  display: block; margin-top: var(--s-2); padding: var(--s-2) var(--s-3);
  background: var(--bg-2); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: var(--t-6); color: var(--ink);
  word-break: break-all; line-height: 1.5;
}
.modal-content textarea { margin: var(--s-3) 0; }
.modal-actions { display: flex; gap: var(--s-2); justify-content: flex-end; margin-top: var(--s-3); }
.modal-actions .btn--ghost { background: transparent; }

/* ── actions row + pdf preview (approver) ───────────────────────── */
.actions { display: flex; gap: var(--s-2); margin-top: var(--s-4); flex-wrap: wrap; }

/* comprehension gate note — shown in place of the decision buttons until the
   reviewer has spent the minimum dwell and scrolled a document to the end. */
.gate-note {
  display: flex; align-items: center; gap: var(--s-2);
  margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
  font-family: var(--mono); font-size: var(--t-6); line-height: 1.4; color: var(--ink-2);
  background: color-mix(in oklab, var(--warn) 8%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--warn) 30%, var(--rule));
  border-radius: var(--r-1);
}
.gate-note b { color: var(--ink); }
.gate-ic { flex-shrink: 0; opacity: .75; }
.artifact-preview { background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--r-1); padding: var(--s-4); margin: var(--s-4) 0; max-height: 400px; overflow: auto; }
.artifact-preview pre { margin: 0; border: 0; background: transparent; white-space: pre-wrap; word-break: break-word; }
.artifact-preview img, .artifact-preview audio { max-width: 100%; border-radius: var(--r-1); }
.pdf-container { max-height: 600px; overflow: auto; border: 1px solid var(--rule-2); border-radius: var(--r-1); margin: var(--s-4) 0; background: var(--bg-3); position: relative; }
.pdf-container iframe { width: 100%; height: 600px; display: block; border: none; }
.pdf-sentinel { height: 1px; width: 100%; }
.pdf-scroll-overlay { position: absolute; bottom: 0; left: 0; right: 0; background: color-mix(in oklab, var(--bg) 92%, transparent); padding: var(--s-4); text-align: center; border-top: 1px solid var(--rule-2); }
.pdf-scroll-overlay.reached { border-top-color: var(--signal); }
.pdf-scroll-overlay .status { font-family: var(--mono); font-size: var(--t-6); color: var(--ink-3); margin-bottom: var(--s-2); }
.scroll-progress { height: 3px; background: var(--rule); border-radius: var(--r-full); margin: var(--s-2) 0; overflow: hidden; }
.scroll-progress-bar { height: 100%; background: var(--ink-3); transition: width 0.3s; width: 0%; }
.scroll-progress-bar.complete { background: var(--signal); }

/* ── footer ─────────────────────────────────────────────────────── */
.footer {
  max-width: var(--col); margin: 0 auto; padding: var(--s-7) var(--gutter);
  border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: var(--t-6); color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
}
.footer-logout {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  color: var(--ink-3); text-decoration: none; border: 1px solid var(--rule-2);
  border-radius: var(--r-1); padding: 5px 10px; font-family: var(--mono); font-size: var(--t-6);
}
.footer-logout:hover { color: var(--ink); border-color: var(--ink); }
.footer-logout svg { display: block; }

/* copyval — long value middle-cropped to one line + subtle inline copy button */
.copyval { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; vertical-align: bottom; }
.copyval > code { font-family: var(--mono); font-size: 0.8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; word-break: normal; min-width: 0; }
.copy-btn {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--r-1);
  background: transparent; color: var(--ink-4); cursor: pointer; line-height: 0;
}
.copy-btn svg { display: block; }
/* faint by default; darken when the row/value is hovered, full on direct hover */
tr:hover .copy-btn, .copyval:hover .copy-btn, .qrow:hover .copy-btn { color: var(--ink-3); }
.copy-btn:hover { background: transparent; color: var(--ink); }
.copy-btn.copied, tr:hover .copy-btn.copied { color: var(--signal); }
/* responsive crop: full on desktop, middle-cropped only on mobile */
.copyval > code.cv-crop { display: none; }
@media (max-width: 640px) {
  .copyval > code.cv-full { display: none; }
  .copyval > code.cv-crop { display: inline; }
}

/* data list tables (browse log, requests): table on desktop, stacked cards on mobile */
.audit-table td .btn--ghost { white-space: nowrap; }
@media (max-width: 640px) {
  .audit-table thead { display: none; }
  .audit-table tbody tr { display: block; padding: var(--s-3) 0; border-bottom: 1px solid var(--rule); }
  .audit-table tbody tr:last-child { border-bottom: 0; }
  .audit-table td { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: start; padding: 3px 0; border: 0; }
  .audit-table td::before { content: attr(data-label); color: var(--ink-3); font-size: var(--t-6); }
  .audit-table td.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
  .audit-table td.actions::before { content: none; }
}
/* browse-log (7 cols): fixed layout so the dense table fits the card on desktop
   instead of overflowing past it; copyval cells truncate within their column. */
@media (min-width: 641px) {
  .audit-browse { table-layout: fixed; }
  .audit-browse td:first-child { white-space: normal; }
  .audit-browse td.actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .audit-browse th:nth-child(1), .audit-browse td:nth-child(1) { width: 16%; }
  .audit-browse th:nth-child(2), .audit-browse td:nth-child(2) { width: 6%; }
  .audit-browse th:nth-child(3), .audit-browse td:nth-child(3) { width: 14%; }
  .audit-browse th:nth-child(4), .audit-browse td:nth-child(4) { width: 16%; }
  .audit-browse th:nth-child(5), .audit-browse td:nth-child(5) { width: 16%; }
  .audit-browse th:nth-child(6), .audit-browse td:nth-child(6) { width: 14%; }
  .audit-browse th:nth-child(7), .audit-browse td:nth-child(7) { width: 18%; }
}

/* ── bottom-sheet ceremony (step-up auth) ───────────────────────── */
.sheet-scrim {
  position: fixed; inset: 0; z-index: 1100;
  background: color-mix(in oklab, var(--ink) 45%, transparent);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 180ms linear;
}
.sheet-scrim.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-width: 520px;
  background: var(--bg); border: 1px solid var(--rule-2); border-bottom: 0;
  border-radius: var(--r-1) var(--r-1) 0 0;
  padding: var(--s-5) var(--s-5) var(--s-6);
  display: flex; flex-direction: column; gap: var(--s-4);
  /* the sheet itself scrolls; contain stops the scroll chaining to the page
     behind it (which otherwise drags the queue on iOS). */
  max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  transform: translateY(100%); transition: transform 240ms cubic-bezier(0.2,0.8,0.2,1);
}
/* lock the page behind an open sheet so touch scrolls stay in the sheet */
body.sheet-open { overflow: hidden; }
.sheet-scrim.open .sheet { transform: translateY(0); }
.sheet h3 { margin: 0; font-size: var(--t-2); }
.sheet .sheet-sub { margin: 0; color: var(--ink-3); font-size: var(--t-4); }
.sheet .sheet-cap { font-family: var(--mono); font-size: var(--t-7); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-4); }
.sheet .method-btn { width: 100%; justify-content: space-between; background: transparent; color: var(--ink); border-color: var(--rule-2); }
.sheet .method-btn:hover { border-color: var(--ink); background: transparent; color: var(--ink); }
.sheet .sheet-actions { display: flex; flex-direction: column; gap: var(--s-2); }

/* ── sealing steps (shown while the decision is anchored) ────────── */
.seal-steps { display: flex; flex-direction: column; gap: var(--s-2); }
.seal-step {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--bg-2); border: 1px solid var(--rule); border-radius: var(--r-1);
  padding: var(--s-3) var(--s-4); font-size: var(--t-5); color: var(--ink-4);
}
.seal-step.active, .seal-step.done { color: var(--ink); }
.seal-step .ic { width: 16px; height: 16px; flex: none; display: flex; align-items: center; justify-content: center; color: var(--ink-4); }
.seal-step.done .ic { color: var(--signal); }
.seal-step .spinner {
  width: 12px; height: 12px; border: 1.5px solid var(--rule-2);
  border-top-color: var(--ink); border-radius: 50%;
  animation: sov-spin 800ms linear infinite;
}
@keyframes sov-spin { to { transform: rotate(360deg); } }

/* ── sealed record (full-screen confirmation, solid ink) ────────── */
.sealed {
  position: fixed; inset: 0; z-index: 1200;
  background: var(--ink); color: var(--bg);
  display: none; flex-direction: column;
  padding: var(--s-7) var(--s-5) var(--s-6); overflow-y: auto;
}
.sealed.open { display: flex; }
.sealed-inner { width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-5); flex: 1; }
.sealed .kicker { font-family: var(--mono); font-size: var(--t-7); letter-spacing: 0.06em; text-transform: uppercase; color: var(--signal); }
.sealed h2 { margin: 0; font-size: var(--t-0); line-height: 1.1; letter-spacing: -0.015em; }
.sealed .sealed-sub { margin: 0; color: #b9b7ad; font-size: var(--t-4); max-width: 48ch; }
.sealed .sealed-sub b { color: var(--bg); font-weight: 500; }
.sealed-cap { font-family: var(--mono); font-size: var(--t-7); letter-spacing: 0.04em; text-transform: uppercase; color: #7d7b72; }
.sealed-block { display: flex; flex-direction: column; gap: var(--s-3); padding-top: var(--s-4); border-top: 1px solid #36342c; }
.sealed-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); font-size: var(--t-5); color: #b9b7ad; }
.sealed-row .v { font-family: var(--mono); font-size: var(--t-6); color: var(--bg); }
.sealed-id { font-family: var(--mono); font-size: var(--t-6); color: var(--bg); word-break: break-all; line-height: 1.5; margin-top: var(--s-1); }
.sealed-anchor { display: flex; align-items: center; gap: var(--s-2); font-size: var(--t-5); color: var(--bg); }
.sealed-anchor .adot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal); flex: none; }
.sealed-actions { margin-top: auto; padding-top: var(--s-6); display: flex; flex-direction: column; gap: var(--s-2); }
.sealed .btn-paper { width: 100%; justify-content: center; background: var(--bg); color: var(--ink); border-color: var(--bg); }
.sealed .btn-paper:hover { background: transparent; color: var(--bg); border-color: var(--bg); }
.sealed .btn-quiet { width: 100%; justify-content: center; background: transparent; color: #b9b7ad; border-color: transparent; }
.sealed .btn-quiet:hover { background: transparent; color: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  .seal-step .spinner { animation: none; }
  .sheet, .sheet-scrim { transition: none; }
}

/* ── home grid (landing destinations) ───────────────────────────── */
.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-1); margin-top: var(--s-5); }
.home-grid .card { margin: 0; text-decoration: none; display: flex; flex-direction: column; gap: var(--s-2); }

/* ── uuid lookup row (audit) ────────────────────────────────────── */
.uuid-row { display: flex; gap: var(--s-2); margin-top: 6px; }
.uuid-row button { white-space: nowrap; }

/* ────────────────────────────────────────────────────────────────
   mobile-first: the base styles above are the small-screen baseline;
   this block adapts layout for narrow viewports (phones).
   ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --gutter: 16px; }

  .wrap, .container { padding-top: var(--s-5); padding-bottom: var(--s-5); }
  .page-title { font-size: var(--t-1); }
  .page-lede { font-size: var(--t-4); margin-bottom: var(--s-5); }
  .meta-strip { font-size: var(--t-7); }

  /* topbar: keep one row, shrink and prevent overflow */
  .topbar-inner { height: 44px; }
  .topbar-brand span { display: none; }     /* keep mark + wordmark only */
  .topbar-nav { gap: var(--s-3); }

  /* landing destinations stack */
  .home-grid { grid-template-columns: 1fr; }

  /* decision actions stack full-width for thumb reach */
  .actions { flex-direction: column; }
  .actions button { width: 100%; justify-content: center; }

  /* primary single-action buttons span the width */
  #submitBtn { width: 100%; justify-content: center; }

  /* uuid lookup stacks: input over a full-width button */
  .uuid-row { flex-direction: column; }
  .uuid-row button { width: 100%; justify-content: center; }

  /* modal sits flush near the bottom like a sheet, easier to reach */
  .modal { align-items: flex-end; padding: 0; }
  .modal-content { max-width: 100%; border-radius: 0; padding: var(--s-5) var(--s-4) var(--s-6); }

  /* downloadable attestation link shouldn't float on narrow screens */
  .download-link { display: inline-block; }

  /* approver cards: less crowded on a phone */
  .card { padding: var(--s-4); }
  .card .meta { display: flex; flex-direction: column; gap: 2px; }
  .card .meta span { margin-right: 0; }
  /* evidence / context tables wrap instead of forcing horizontal scroll */
  .card table { width: 100%; table-layout: fixed; }
  .card table td { word-break: break-word; overflow-wrap: anywhere; }
  .artifact-preview { max-height: 280px; }
  .pdf-container, .pdf-container iframe { max-height: 360px; height: 360px; }
}

/* ── mobile: approval-only ──────────────────────────────────────────
   The phone is for one job — reviewing and signing decisions. Submitting
   artifacts and auditing the ledger are desktop tasks, so their entry points
   (top-nav links and home-screen cards) are hidden on small screens. The
   approver console and profile (where the signing key is enrolled) remain. */
@media (max-width: 640px) {
  .topbar-nav a[href="/audit.html"],
  .home-grid .card[href="/audit.html"],
  #sealedAuditLink { display: none; }
}

/* ── prototype-style approval flow (queue → review → evidence → sign) ──────
   Faithful to docs/references/prototype-*.jsx: a focused, single-column review
   experience. Mobile-first; on wider screens the column is centred and capped. */
.sovc-flow { max-width: 560px; margin: 0 auto; }
/* desktop: the queue, review/sign flow, and evidence sheet all use a roomy
   column like profile/home instead of a phone-width strip */
@media (min-width: 641px) {
  .sovc-flow { max-width: 920px; }
  .sheet { max-width: 760px; }
}
.sovc-screen { display: none; }
.sovc-screen.active { display: block; }

/* queue rows */
.sovc-qhead { margin-bottom: var(--s-4); }
.sovc-qhead h1 { font-size: var(--t-1); margin: var(--s-1) 0 0; }
.sovc-qrow { display: block; width: 100%; text-align: left; background: var(--bg);
  border: 1px solid var(--rule-2); border-radius: var(--r-1); padding: var(--s-4);
  margin-bottom: var(--s-3); cursor: pointer; font: inherit; color: inherit; }
.sovc-qrow:hover { border-color: var(--ink-4); }
.sovc-qrow .q1 { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.sovc-qrow .q-title { font-weight: 600; }
.sovc-qrow .q2 { display: flex; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-2);
  color: var(--ink-3); font-size: var(--t-6); }
.sovc-qtag { font-family: var(--mono); font-size: var(--t-7); padding: 2px 8px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.qref { font-family: var(--mono); }
/* queue row: record id + subcategory, then the party (person/company) beneath */
.sovc-qrow .qref { font-size: var(--t-7); color: var(--ink-4); letter-spacing: .02em; }
.sovc-qrow .qsub { font-size: var(--t-6); color: var(--ink-3); white-space: nowrap; }
.sovc-qrow > .qparty { display: block; font-size: var(--t-5); color: var(--ink-2); margin-top: 2px; }
.q-sla { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.q-sla .qdot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
/* due today → orange, overdue → red */
.q-sla.urgent { color: var(--warn); }
.q-sla.urgent .qdot { background: var(--warn); }
.q-sla.overdue { color: var(--danger); font-weight: 500; }
.q-sla.overdue .qdot { background: var(--danger); }

/* review screen */
.sovc-back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
  color: var(--ink-3); font-size: var(--t-6); cursor: pointer; padding: 0; margin-bottom: var(--s-3); }
.sovc-back:hover { color: var(--ink); }
.sovc-headband { margin-bottom: var(--s-4); }
.sovc-headband .k-row { display: flex; align-items: center; gap: var(--s-3); }
.sovc-headband h1 { font-size: var(--t-1); margin: var(--s-2) 0 2px; }
.sovc-headband .sub { display: block; color: var(--ink-3); font-size: var(--t-5); }
.sovc-recline { font-size: var(--t-4); margin: var(--s-3) 0; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-1); border-left: 3px solid var(--ink-4); background: var(--bg-2); }

.sovc-view { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  width: 100%; text-align: left; background: var(--bg-2); border: 1px solid var(--rule-2);
  border-radius: var(--r-1); padding: var(--s-4); font: inherit; font-size: var(--t-4);
  color: inherit; cursor: pointer; margin-bottom: var(--s-4); }
.sovc-view:hover { border-color: var(--ink-4); }
.sovc-view.reviewed { border-color: color-mix(in oklab, var(--signal) 55%, var(--rule)); }
.sovc-view .vchev { color: var(--ink-4); }

/* uphold / override choice */
.sovc-choice { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.sovc-choice button { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3);
  text-align: left; padding: var(--s-4); border: 1px solid var(--rule-2); border-radius: var(--r-1);
  background: var(--bg); cursor: pointer; font: inherit; color: inherit; }
.sovc-choice button .sub { display: block; color: var(--ink-3); font-size: var(--t-6); margin-top: 2px; }
.sovc-choice button .tick { opacity: 0; color: var(--signal); flex-shrink: 0; }
.sovc-choice button.selected { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.sovc-choice button.selected .tick { opacity: 1; }

/* override sub-choice (which alternative outcome) */
.sovc-alts { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.sovc-alts button { flex: 1; min-width: 96px; justify-content: center; }

/* fields */
.sovc-field { margin-bottom: var(--s-4); }
.sovc-field > label { display: block; font-size: var(--t-5); color: var(--ink-2); margin-bottom: var(--s-2); text-transform: none; }
.sovc-field .req { color: var(--danger); }
.sovc-field input, .sovc-field textarea { width: 100%; }
.sovc-field .hint { font-size: var(--t-6); color: var(--ink-3); margin-top: var(--s-2); display: flex; align-items: center; gap: 6px; }
.sovc-field .hint.ok { color: var(--signal); }
.sovc-field .count { text-align: right; font-family: var(--mono); font-size: var(--t-7); color: var(--ink-4); margin-top: 2px; }
.sovc-attest { font-size: var(--t-5); color: var(--ink-3); border-top: 1px solid var(--rule); padding-top: var(--s-3); margin-top: var(--s-4); }

/* fixed sign bar */
.sovc-signbar { position: sticky; bottom: 0; z-index: 5; background: color-mix(in oklab, var(--bg) 96%, transparent);
  backdrop-filter: blur(6px); border-top: 1px solid var(--rule-2); padding: var(--s-3) 0 var(--s-4);
  margin-top: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.btn-sign { width: 100%; justify-content: center; }
.btn-sign:disabled { opacity: .45; cursor: not-allowed; }
.keynote { text-align: center; font-family: var(--mono); font-size: var(--t-7); color: var(--ink-3); }

/* evidence sheet (bottom sheet) — factor bands */
.sovc-seccap { display: flex; justify-content: space-between; align-items: baseline; margin: var(--s-4) 0 var(--s-2);
  font-family: var(--mono); font-size: var(--t-6); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.sovc-seccap .n { color: var(--ink); }
.sovc-frow { padding: var(--s-3) 0; border-top: 1px solid var(--rule); }
.sovc-frow .fr-top { display: flex; justify-content: space-between; gap: var(--s-3); }
.sovc-frow .fr-name { color: var(--ink-2); font-size: var(--t-5); }
.sovc-frow .fr-val { font-weight: 600; }
.sovc-frow .fr-track { position: relative; height: 4px; border-radius: 999px; background: var(--bg-3); margin: var(--s-2) 0; }
.sovc-frow .fr-ok { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 999px; background: color-mix(in oklab, var(--signal) 35%, var(--bg-3)); }
.sovc-frow .fr-marker { position: absolute; top: -2px; width: 2px; height: 8px; background: var(--ink); }
.sovc-frow.is-out .fr-marker { background: var(--danger); }
.sovc-frow .fr-meta { display: flex; justify-content: space-between; font-size: var(--t-7); color: var(--ink-4); }
.sovc-frow.is-out .fr-status { color: var(--danger); }
.sovc-tech2 .ti { display: flex; justify-content: space-between; gap: var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--rule); font-size: var(--t-6); }
.sovc-tech2 .ti.wide { flex-direction: column; gap: 2px; }
.sovc-tech2 .tl { color: var(--ink-3); }
.sovc-tech2 .tv { font-family: var(--mono); word-break: break-all; }
.btn-reviewed { width: 100%; justify-content: center; margin-top: var(--s-4); }

/* ── cosmetic pass: match the prototype's visual language ──────────────────
   Category-tinted cards (--tint set per row/headband in JS), a deep-blue
   evidence banner + headband, radio-style choice selection, and a blue
   enabled sign button. Warm-paper base is unchanged; blue is the action/info
   accent as in the prototype. */

/* queue cards: soft category tint, white tag pill */
.sovc-qrow { background: color-mix(in oklab, var(--tint, var(--bg-2)) 45%, var(--bg));
  border-color: color-mix(in oklab, var(--tint, var(--rule-2)) 60%, var(--rule-2)); }
.sovc-qrow:hover { border-color: var(--ink-4); }
.sovc-qrow .sovc-qtag { background: var(--bg); border-color: color-mix(in oklab, var(--ink) 12%, transparent); }

/* review headband: tinted band with the sign-off cue in the alert colour */
.sovc-headband { background: color-mix(in oklab, var(--tint, var(--bg-2)) 45%, var(--bg));
  border: 1px solid color-mix(in oklab, var(--tint, var(--rule)) 60%, var(--rule));
  border-radius: var(--r-1); padding: var(--s-4); }
.sovc-headband .label { color: var(--danger); }

/* view-evidence banner: bold blue, stays blue after review */
.sovc-view { background: var(--brand-blue); border: 0; color: var(--on-brand); font-weight: 500; }
.sovc-view:hover { background: var(--brand-blue-2); border: 0; color: var(--on-brand); }
.sovc-view .vchev { color: var(--on-brand); }
.sovc-view.reviewed { background: var(--brand-blue); color: var(--on-brand); }

/* choice cards: resting radio, filled check + blue outline when selected */
.sovc-choice button .tick { opacity: 1; width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--rule-2); color: transparent; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; line-height: 1; }
.sovc-choice button.selected { border-color: var(--select-blue);
  box-shadow: inset 0 0 0 1px var(--select-blue); background: color-mix(in oklab, var(--select-blue) 7%, var(--bg)); }
.sovc-choice button.selected .tick { background: var(--ink); border-color: var(--ink); color: #fff; }

/* enabled sign button: solid blue (disabled stays muted, not just faded) */
.btn-sign { background: var(--brand-blue); border-color: var(--brand-blue); color: var(--on-brand); }
.btn-sign:hover { background: var(--brand-blue-2); border-color: var(--brand-blue-2); color: var(--on-brand); }
.btn-sign:disabled, .btn-sign:disabled:hover { opacity: 1; background: var(--bg-3);
  border-color: var(--rule-2); color: var(--ink-4); }

/* evidence sheet: blue headband bleeding to the sheet edges */
.ev-head { background: var(--brand-blue); color: var(--on-brand);
  margin: calc(-1 * var(--s-5)) calc(-1 * var(--s-5)) 0; padding: var(--s-5);
  border-radius: var(--r-1) var(--r-1) 0 0; display: flex; flex-direction: column; gap: 2px; }
.ev-head .ev-name { font-size: var(--t-5); color: color-mix(in oklab, var(--on-brand) 80%, transparent); }
.ev-head .ev-ref { font-family: var(--mono); font-size: var(--t-6); color: color-mix(in oklab, var(--on-brand) 65%, transparent); }
.ev-head h3 { margin: var(--s-2) 0 0; color: var(--on-brand); }

/* within-policy factors: collapsed behind a disclosure row */
.sovc-within { border-top: 1px solid var(--rule); }
.sovc-within > summary { list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; padding: var(--s-3) 0; color: var(--ink-2); font-size: var(--t-5); }
.sovc-within > summary::-webkit-details-marker { display: none; }
.sovc-within > summary::after { content: '›'; color: var(--ink-4); transition: transform 120ms; }
.sovc-within[open] > summary::after { transform: rotate(90deg); }

/* signing-key list: stacked rows — a 4-column table collides on mobile */
.cred-row { border-top: 1px solid var(--rule); padding: var(--s-3) 0; }
.cred-row:first-child { border-top: 0; }
.cred-main { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.cred-label { font-family: var(--mono); font-size: var(--t-5); color: var(--ink); word-break: break-word; }
.cred-remove { flex: none; padding: 4px 10px; }
.cred-meta { font-family: var(--mono); font-size: var(--t-7); color: var(--ink-3); margin-top: 4px; }
