/* ==========================================================================
   Attest — review desk for clinical dossiers
   Design notes
   - Subject: regulatory review of clinical documents. The vocabulary is
     ledgers, marginalia, stamped dispositions, section references, hairlines.
   - Palette: cool mineral paper and petrol ink, with four evidence colours.
     Deliberately not warm cream, not near-black with an acid accent.
   - Type: Newsreader carries the document and display voice (a serif that
     reads like a typeset report); Archivo carries the interface; Plex Mono is
     reserved for identifiers, thresholds and anchors, which are data.
   - Layout: registers with a margin column, not a grid of cards. One bold
     gesture: the completeness fingerprint, which draws once per analysis.
   ========================================================================== */

@import url('/fonts/fonts.css');

:root {
  --paper: #edf0ef;
  --surface: #f7f8f7;
  --surface-2: #e4e9e8;
  --ink: #0f1a1c;
  --ink-2: #46575a;
  --ink-3: #6d7d80;
  --rule: #c8d2d2;
  --rule-strong: #a7b5b6;
  --petrol: #0c4f54;
  --petrol-soft: #d9e7e6;
  --petrol-ink: #073b3f;
  --high: #8a2b32;
  --high-soft: #f0dfe0;
  --medium: #8a6413;
  --medium-soft: #f1e8d6;
  --ok: #22624b;
  --ok-soft: #dfeae4;
  --neutral: #5c6b6e;
  --focus: #0c4f54;

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  --step--1: 12px;
  --step-0: 14px;
  --step-1: 16px;
  --step-2: 19px;
  --step-3: 24px;
  --step-4: 32px;
  --step-5: 44px;
  --step-6: clamp(34px, 4.2vw, 54px);

  --gutter: clamp(16px, 3vw, 40px);
  --radius: 2px;
  --shadow: 0 1px 0 rgba(15, 26, 28, 0.06), 0 12px 24px -22px rgba(15, 26, 28, 0.5);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: var(--step-6); letter-spacing: -0.02em; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 0.8em; }
a { color: var(--petrol); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--petrol-ink); }
button { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.88em; }

::selection { background: var(--petrol-soft); }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- shell -- */

.shell { min-height: 100%; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 28px;
  padding: 0 var(--gutter);
  height: 62px;
  background: color-mix(in srgb, var(--paper) 92%, white);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(6px);
}

.brand {
  display: flex; align-items: baseline; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand .wordmark {
  font-family: var(--serif); font-size: 25px; font-weight: 600; letter-spacing: -0.015em;
}
.brand .descriptor {
  font-size: 11px; color: var(--ink-3); letter-spacing: 0.02em;
  border-left: 1px solid var(--rule-strong); padding-left: 10px;
  max-width: 190px; line-height: 1.25;
}

/* -------------------------------------------------------- global search -- */

.topbar-search {
  position: relative;
  flex: 1;
  max-width: 440px;
  margin: 0 16px;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  color: var(--ink-3);
  pointer-events: none;
}

.topbar-search input {
  padding: 6px 36px 6px 32px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  transition: all 120ms ease;
  height: 34px;
  width: 100%;
}

.topbar-search input:focus {
  background: white;
  border-color: var(--petrol);
  outline: 2px solid var(--petrol-soft);
}

.search-shortcut {
  position: absolute;
  right: 8px;
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-3);
  padding: 1px 5px;
  border-radius: var(--radius);
  pointer-events: none;
  line-height: 1.3;
}

.search-clear-btn {
  position: absolute;
  right: 8px;
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear-btn:hover {
  color: var(--ink);
}

.search-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 440px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(15, 26, 28, 0.12), 0 1px 3px rgba(15, 26, 28, 0.08);
  z-index: 100;
  font-size: 13px;
}

.search-group-title {
  padding: 6px 12px 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
}

.search-group-title:first-child {
  border-top: none;
}

.search-item {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 50%, transparent);
  transition: background 80ms ease;
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover,
.search-item[aria-selected='true'] {
  background: var(--petrol-soft);
  color: var(--petrol-ink);
}

.search-item .item-id {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--petrol);
  flex-shrink: 0;
}

.search-item[aria-selected='true'] .item-id {
  color: var(--petrol-ink);
}

.search-item .item-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-item .item-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item .item-sub {
  font-size: 11.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item mark {
  background: color-mix(in srgb, var(--medium-soft) 85%, white);
  color: var(--ink);
  font-weight: 600;
  padding: 0 1px;
  border-radius: 1px;
}

.search-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 12.5px;
}

@media (max-width: 860px) {
  .topbar-search {
    max-width: 200px;
    margin: 0 8px;
  }
  .search-shortcut {
    display: none;
  }
}

.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a, .nav button.linkish {
  padding: 7px 11px; border-radius: var(--radius); text-decoration: none;
  color: var(--ink-2); font-size: 13.5px; font-weight: 500;
  border: 0; background: none; cursor: pointer;
}
.nav a:hover, .nav button.linkish:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current='page'] { color: var(--petrol-ink); background: var(--petrol-soft); }

.page { flex: 1; width: 100%; max-width: 1460px; margin: 0 auto; padding: 0 var(--gutter) 72px; }
.page--wide { max-width: none; padding-left: clamp(12px, 2vw, 28px); padding-right: clamp(12px, 2vw, 28px); }

.footer {
  border-top: 1px solid var(--rule);
  padding: 18px var(--gutter);
  color: var(--ink-3); font-size: 12px;
  display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline;
}
.footer .mono { color: var(--ink-3); }

/* ------------------------------------------------------------- typography -- */

.lede {
  font-family: var(--serif); font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.45; color: var(--ink-2); max-width: 62ch;
}
.muted { color: var(--ink-2); }
.dim { color: var(--ink-3); }
.small { font-size: 12.5px; }
.serif { font-family: var(--serif); }
.measure { max-width: 68ch; }
.nums { font-variant-numeric: tabular-nums; }

.kicker {
  font-size: 12px; color: var(--ink-3); font-weight: 500;
}

.page-head {
  display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  padding: 40px 0 22px; border-bottom: 1px solid var(--rule);
}
.page-head h1 { font-size: clamp(28px, 3.4vw, 40px); }
.page-head .lede { margin-top: 10px; font-size: 16px; max-width: 54ch; }
.page-head__actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* -------------------------------------------------------------- controls -- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 13px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.btn--primary { background: var(--petrol); border-color: var(--petrol); color: #f5fafa; }
.btn--primary:hover { background: var(--petrol-ink); border-color: var(--petrol-ink); color: white; }
.btn--quiet { background: transparent; border-color: transparent; color: var(--ink-2); padding: 6px 8px; }
.btn--quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn--danger { color: var(--high); border-color: color-mix(in srgb, var(--high) 30%, var(--rule)); }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn .shortcut { font-family: var(--mono); font-size: 11px; color: inherit; opacity: 0.65; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--ink-3); }
input[type='text'], input[type='email'], input[type='password'], input[type='url'], select, textarea {
  font: inherit; font-size: 14px;
  color: var(--ink); background: var(--surface);
  border: 1px solid var(--rule-strong); border-radius: var(--radius);
  padding: 9px 11px; width: 100%;
}
textarea { min-height: 160px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--petrol-soft); border-color: var(--petrol); }

.seg {
  display: inline-flex; border: 1px solid var(--rule-strong);
  border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.seg button {
  border: 0; background: none; padding: 7px 12px; cursor: pointer;
  font-size: 12.5px; color: var(--ink-2); border-right: 1px solid var(--rule);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed='true'] { background: var(--petrol); color: #f2f8f7; }
.seg .count { font-family: var(--mono); font-size: 11px; opacity: 0.7; margin-left: 5px; }

/* ----------------------------------------------------------------- chips -- */

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  padding: 2px 9px; font-size: 11.5px; color: var(--ink-2);
  background: var(--surface); white-space: nowrap;
}
.chip--petrol { border-color: color-mix(in srgb, var(--petrol) 35%, white); background: var(--petrol-soft); color: var(--petrol-ink); }
.chip--high { border-color: color-mix(in srgb, var(--high) 35%, white); background: var(--high-soft); color: var(--high); }
.chip--medium { border-color: color-mix(in srgb, var(--medium) 35%, white); background: var(--medium-soft); color: var(--medium); }
.chip--ok { border-color: color-mix(in srgb, var(--ok) 32%, white); background: var(--ok-soft); color: var(--ok); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.stamp {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; border: 1px solid currentColor; border-radius: var(--radius);
  padding: 2px 6px; display: inline-block; line-height: 1.5; white-space: nowrap;
}
.stamp--high { color: var(--high); background: color-mix(in srgb, var(--high-soft) 55%, white); }
.stamp--medium { color: var(--medium); background: color-mix(in srgb, var(--medium-soft) 55%, white); }
.stamp--low, .stamp--neutral { color: var(--ink-2); background: var(--surface); }
.stamp--ok { color: var(--ok); background: var(--ok-soft); }
.stamp--petrol { color: var(--petrol-ink); background: var(--petrol-soft); }

/* ------------------------------------------------------------- dashboard -- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 56px);
  align-items: end;
  padding: clamp(28px, 4vw, 52px) 0 28px;
}
.hero h1 { max-width: 22ch; }
.hero .lede { margin-top: 14px; }
.hero__aside {
  border-left: 1px solid var(--rule);
  padding-left: clamp(16px, 2vw, 28px);
  display: grid; gap: 14px;
}
.hero__aside .fact { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline; }
.hero__aside .fact span { color: var(--ink-2); font-size: 12.5px; }
.hero__aside .fact strong { font-family: var(--serif); font-size: 22px; font-weight: 500; }

.section-head {
  display: flex; align-items: baseline; gap: 14px;
  padding: 26px 0 12px; border-bottom: 1px solid var(--rule-strong);
}
.section-head h2 { font-size: 20px; }
.section-head .aside { margin-left: auto; color: var(--ink-3); font-size: 12.5px; }

.ledger { width: 100%; border-collapse: collapse; }
.ledger thead th {
  text-align: left; font-size: 11.5px; font-weight: 500; color: var(--ink-3);
  padding: 10px 12px 8px 0; border-bottom: 1px solid var(--rule);
}
.ledger tbody tr { border-bottom: 1px solid var(--rule); }
.ledger tbody tr:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.ledger td { padding: 14px 12px 14px 0; vertical-align: top; }
.ledger td:first-child { padding-left: 2px; }
.ledger .title { font-family: var(--serif); font-size: 17px; line-height: 1.3; }
.ledger .title a { color: var(--ink); text-decoration: none; }
.ledger .title a:hover { color: var(--petrol-ink); text-decoration: underline; }
.ledger .meta { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.ledger .num { font-family: var(--serif); font-size: 20px; font-variant-numeric: tabular-nums; }
.ledger .num small { font-family: var(--sans); font-size: 11px; color: var(--ink-3); }
.ledger .actions { text-align: right; white-space: nowrap; }
.ledger tr.is-empty td { color: var(--ink-3); font-style: italic; font-family: var(--serif); }

.dossier-strip {
  display: grid; grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px; align-items: center;
  padding: 22px 0; border-bottom: 1px solid var(--rule);
}
.dossier-strip h3 { font-size: 21px; }
.dossier-strip h3 a { color: var(--ink); text-decoration: none; }
.dossier-strip h3 a:hover { color: var(--petrol-ink); }
.dossier-strip .headline { color: var(--ink-2); margin-top: 6px; max-width: 60ch; font-size: 13.5px; }
.dossier-strip .docs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.dossier-strip .chart { justify-self: end; }

.empty {
  border: 1px dashed var(--rule-strong); padding: 30px; text-align: center;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty h2 { font-size: 21px; margin-bottom: 6px; }
.empty p { color: var(--ink-2); max-width: 52ch; margin: 0 auto 16px; }

/* ---------------------------------------------------------- radar / dial -- */

.fingerprint { display: block; max-width: 100%; overflow: visible; }
.fingerprint .grid { fill: none; stroke: var(--rule); stroke-width: 1; }
.fingerprint .axis { stroke: var(--rule); stroke-width: 1; }
.fingerprint .shape {
  fill: color-mix(in srgb, var(--petrol) 14%, transparent);
  stroke: var(--petrol); stroke-width: 1.6; stroke-linejoin: round;
  animation: draw 900ms ease-out 120ms both;
}
.fingerprint .point { fill: var(--petrol); }
.fingerprint .label { font-family: var(--sans); font-size: 9.5px; fill: var(--ink-3); letter-spacing: 0.01em; }
.fingerprint .label.is-strong { fill: var(--ink-2); font-weight: 500; }
.fingerprint .value { font-family: var(--mono); font-size: 9px; fill: var(--ink-3); }

@keyframes draw {
  from { opacity: 0; stroke-dasharray: 0 600; }
  to { opacity: 1; stroke-dasharray: 600 0; }
}

.dial { position: relative; width: 74px; height: 74px; }
.dial svg { transform: rotate(-90deg); }
.dial .track { fill: none; stroke: var(--rule); stroke-width: 5; }
.dial .value { fill: none; stroke: var(--petrol); stroke-width: 5; stroke-linecap: butt; }
.dial .value.is-low { stroke: var(--high); }
.dial .value.is-mid { stroke: var(--medium); }
.dial .reading {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
}
.dial .reading b { font-family: var(--serif); font-size: 24px; font-weight: 500; line-height: 1; }
.dial .reading span { font-size: 10px; color: var(--ink-3); }

/* ------------------------------------------------------------- workspace -- */

.doc-head { padding: 26px 0 0; }
.doc-head__top { display: flex; gap: 20px; align-items: flex-start; }
.doc-head__top .titles { min-width: 0; }
.doc-head h1 { font-size: clamp(24px, 2.6vw, 34px); margin-bottom: 8px; }
.doc-head .sub { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.doc-head .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.doc-head .summary { margin-top: 14px; color: var(--ink-2); font-size: 13.5px; max-width: 95ch; }

.tabs {
  position: sticky; top: 61px; z-index: 30;
  display: flex; align-items: center; gap: 0;
  margin: 18px 0 0; border-bottom: 1px solid var(--rule-strong);
  background: color-mix(in srgb, var(--paper) 95%, white);
  overflow-x: auto;
}
.tabs a {
  padding: 11px 14px 9px; color: var(--ink-2); text-decoration: none;
  font-size: 13px; border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap;
}
.tabs a:hover { color: var(--ink); background: var(--surface-2); }
.tabs a[aria-current='page'] { color: var(--ink); border-bottom-color: var(--petrol); font-weight: 500; }
.tabs .count { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-left: 5px; }

.workspace {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(16px, 2.4vw, 34px); align-items: start;
  padding-top: 18px;
}

.register { min-width: 0; }
.register__controls {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 0 0 12px; border-bottom: 1px solid var(--rule);
}
.register__count { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.register__group { border-bottom: 1px solid var(--rule); }
.register__group > h3 {
  display: flex; align-items: baseline; gap: 10px;
  font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  color: var(--ink-2); padding: 13px 0 8px; letter-spacing: 0.01em;
}
.register__group > h3 .n { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); font-weight: 400; }

.finding {
  display: grid; grid-template-columns: 3px minmax(0, 1fr);
  gap: 11px; padding: 10px 0 11px 0;
  cursor: pointer; border: 0; background: none; text-align: left; width: 100%;
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 55%, transparent);
}
.finding:last-child { border-bottom: 0; }
.finding:hover { background: color-mix(in srgb, var(--surface) 75%, transparent); }
.finding[aria-pressed='true'] { background: var(--petrol-soft); }
.finding .mark { background: var(--neutral); }
.finding[data-severity='high'] .mark { background: var(--high); }
.finding[data-severity='medium'] .mark { background: var(--medium); }
.finding[data-severity='low'] .mark { background: var(--rule-strong); }
.finding .body { min-width: 0; }
.finding .q { font-size: 13.5px; line-height: 1.45; color: var(--ink); font-weight: 500; }
.finding .ref { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.finding .quote {
  font-family: var(--serif); font-size: 13.5px; color: var(--ink-2);
  margin-top: 6px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.finding .row { display: flex; gap: 8px; align-items: center; margin-top: 7px; flex-wrap: wrap; }
.finding .meter { height: 2px; background: var(--rule); width: 64px; position: relative; }
.finding .meter i { position: absolute; inset: 0 auto 0 0; background: var(--ink-3); }

/* Document reader with the evidence lens */

.reader {
  position: sticky; top: 112px;
  max-height: calc(100vh - 140px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.reader__head {
  position: sticky; top: 0; z-index: 2;
  display: flex; gap: 12px; align-items: baseline;
  padding: 10px 16px; border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--surface) 94%, white);
}
.reader__head .label { font-size: 11.5px; color: var(--ink-3); }
.reader__head .where { font-family: var(--mono); font-size: 11px; color: var(--ink-2); margin-left: auto; }
.reader__body { padding: 8px 20px 40px; font-family: var(--serif); font-size: 15.5px; line-height: 1.66; }
.reader__body .sec { margin-top: 22px; }
.reader__body h4 {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  padding-bottom: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 8px;
}
.reader__body p { margin: 0 0 10px; }
.reader__body p.table { font-family: var(--mono); font-size: 11.5px; line-height: 1.7; white-space: pre-wrap; color: var(--ink-2); background: var(--paper); padding: 8px 10px; border-left: 2px solid var(--rule-strong); }
.reader__body .sent { transition: background 140ms ease; }
.reader__body .sent.hl {
  background: color-mix(in srgb, var(--petrol) 16%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--petrol) 12%, transparent);
}
.reader__body p.is-anchor { position: relative; }
.reader__body p.is-anchor::before {
  content: ''; position: absolute; left: -12px; top: 0.25em; bottom: 0.25em;
  width: 2px; background: var(--petrol);
}
.reader__empty { padding: 24px; color: var(--ink-3); font-family: var(--sans); font-size: 13px; }

/* ---------------------------------------------------------------- tables -- */

.table-wrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--surface); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-3);
  padding: 9px 12px; border-bottom: 1px solid var(--rule-strong); white-space: nowrap;
  background: color-mix(in srgb, var(--paper) 60%, white);
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data td.mono, table.data th.mono { font-family: var(--mono); font-size: 11.5px; }
table.data .quote { font-family: var(--serif); font-size: 13px; }
table.data tr[data-severity='high'] td:first-child { box-shadow: inset 3px 0 0 var(--high); }
table.data tr[data-severity='medium'] td:first-child { box-shadow: inset 3px 0 0 var(--medium); }

/* ---------------------------------------------------------------- claims -- */

.claim-card {
  border: 1px solid var(--rule); background: var(--surface);
  padding: 16px 18px; margin-bottom: 12px;
}
.claim-card .claim {
  font-family: var(--serif); font-size: 17px; line-height: 1.45; margin: 8px 0 12px;
}
.claim-card .meta-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.claim-card .evidence {
  border-left: 2px solid var(--petrol); padding: 8px 0 8px 12px; margin-top: 10px;
  font-family: var(--serif); font-size: 13.5px; color: var(--ink-2);
}
.claim-card .evidence .src { font-family: var(--sans); font-size: 11.5px; color: var(--ink-3); margin-bottom: 3px; }
.claim-card .rationale { font-size: 13px; color: var(--ink-2); margin-top: 10px; }

.strength { display: inline-flex; align-items: center; gap: 7px; }
.strength .track { display: flex; gap: 2px; }
.strength .track span { width: 10px; height: 5px; background: var(--rule); }
.strength .track span.on { background: var(--petrol); }
.strength .band { font-size: 11px; color: var(--ink-3); }

/* ------------------------------------------------------------------- SAE -- */

.timeline { border: 1px solid var(--rule); background: var(--surface); padding: 16px 18px 8px; overflow-x: auto; }
.timeline svg { display: block; min-width: 620px; }
.timeline .axis { stroke: var(--rule-strong); stroke-width: 1; }
.timeline .tick { font-family: var(--mono); font-size: 9px; fill: var(--ink-3); }
.timeline .case-line { stroke: var(--rule); stroke-width: 1; }
.timeline .case-dot { fill: var(--petrol); }
.timeline .case-dot.late { fill: var(--high); }
.timeline .case-label { font-family: var(--sans); font-size: 10px; fill: var(--ink-2); }
.timeline .limit { stroke: var(--medium); stroke-width: 1; stroke-dasharray: 2 3; }

/* ------------------------------------------------------------------ drift -- */

.chain { border: 1px solid var(--rule); background: var(--surface); margin-bottom: 12px; }
.chain__head { padding: 12px 16px; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: flex-start; }
.chain__head .claim { font-family: var(--serif); font-size: 15.5px; line-height: 1.45; }
.chain__head .meta { margin-left: auto; text-align: right; }
.chain__body { padding: 14px 16px; display: grid; gap: 10px; }
.hop {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px;
  padding: 10px 0; border-top: 1px solid var(--rule);
}
.hop:first-child { border-top: 0; }
.hop .side { display: grid; gap: 4px; align-content: start; }
.hop .passage { font-family: var(--serif); font-size: 14px; line-height: 1.5; }
.hop .where { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.hop .added { font-size: 11.5px; color: var(--medium); margin-top: 6px; }
.chain__none { padding: 16px; color: var(--ink-2); font-size: 13px; }

/* ------------------------------------------------------------- provenance -- */

.panel { border: 1px solid var(--rule); background: var(--surface); padding: 18px 20px; margin-bottom: 16px; }
.panel h2 { font-size: 19px; margin-bottom: 6px; }
.panel h3 { font-size: 16px; margin: 18px 0 8px; }
.panel .grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 4px 14px; font-size: 12.5px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; }

.brief {
  font-family: var(--mono); font-size: 12px; line-height: 1.7; white-space: pre-wrap;
  background: var(--paper); border: 1px solid var(--rule); padding: 16px; overflow-x: auto;
}

/* ------------------------------------------------------------------ login -- */

.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr;
}
.auth__aside {
  padding: clamp(28px, 5vw, 64px); display: flex; flex-direction: column; justify-content: space-between;
  background: var(--petrol-ink); color: #e8efee;
}
.auth__aside h1 { color: #f2f7f6; max-width: 18ch; }
.auth__aside .brand { color: #f2f7f6; }
.auth__aside .brand .descriptor { color: #a9bdbb; border-color: #3c5f60; }
.auth__aside p { color: #c3d3d1; max-width: 44ch; }
.auth__aside .foot { font-size: 11.5px; color: #93abaa; }
.auth__form { display: grid; place-content: center; padding: clamp(24px, 5vw, 64px); }
.auth__form .inner { width: min(380px, 100%); }
.auth__form h2 { font-size: 26px; margin-bottom: 4px; }
.auth__form .sub { color: var(--ink-2); margin-bottom: 22px; font-size: 13.5px; }
.auth__switch { margin-top: 16px; font-size: 13px; color: var(--ink-2); }
.form-error { color: var(--high); font-size: 12.5px; min-height: 18px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ misc -- */

.notice {
  border-left: 2px solid var(--medium); background: var(--medium-soft);
  padding: 10px 14px; font-size: 13px; color: var(--ink); margin: 14px 0;
}
.notice--petrol { border-left-color: var(--petrol); background: var(--petrol-soft); }
.notice--high { border-left-color: var(--high); background: var(--high-soft); }

.spinner {
  width: 14px; height: 14px; border: 2px solid var(--rule-strong);
  border-top-color: var(--petrol); border-radius: 50%;
  animation: spin 700ms linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress { height: 2px; background: var(--rule); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--petrol); transition: width 240ms ease; }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  background: var(--ink); color: #f2f7f6; padding: 11px 15px;
  font-size: 13px; border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 360px;
}
.toast[data-tone='error'] { background: var(--high); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row--end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; }
.divider { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.skill { border: 1px solid var(--rule); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.skill h3 { font-size: 17px; }
.skill p { font-size: 13px; color: var(--ink-2); margin: 0; }
.skill .meta { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; padding-top: 6px; }

.check-list { display: grid; gap: 0; }
.check-list details { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.check-list summary { cursor: pointer; font-size: 13px; display: flex; gap: 10px; align-items: baseline; }
.check-list summary .mono { color: var(--ink-3); font-size: 10.5px; }
.check-list .q { font-size: 13px; color: var(--ink-2); margin-top: 6px; }

/* --------------------------------------------------- summary dashboard -- */

.summary-dashboard {
  margin: 36px 0 28px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(18px, 2.5vw, 28px);
  box-shadow: 0 1px 3px rgba(15, 26, 28, 0.04);
}

.summary-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.metric-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.metric-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  font-weight: 600;
}

.metric-value {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.metric-value small {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink-3);
  font-weight: normal;
}

.metric-value.is-alert {
  color: var(--high);
}

.metric-sub {
  font-size: 11.5px;
  color: var(--ink-2);
  margin-top: 2px;
}

.metric-sub .high-count {
  color: var(--high);
  font-weight: 600;
}

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.chart-panel {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.progress-radial-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 8px;
}

.radial-container {
  position: relative;
  width: 110px;
  height: 110px;
  flex-shrink: 0;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring .ring-bg {
  fill: none;
  stroke: var(--surface-2);
}

.progress-ring .ring-fill {
  fill: none;
  stroke: var(--petrol);
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms ease;
}

.radial-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.radial-text strong {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--petrol-ink);
  line-height: 1;
}

.radial-text small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  margin-top: 2px;
}

.pipeline-steps {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.pipeline-steps::before {
  content: '';
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 6px;
  width: 1px;
  background: var(--rule-strong);
}

.pipeline-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.pipeline-step .step-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--rule-strong);
  background: var(--surface);
  margin-top: 2px;
  flex-shrink: 0;
  transition: all 160ms ease;
}

.pipeline-step.is-complete .step-dot {
  border-color: var(--ok);
  background: var(--ok);
}

.pipeline-step.is-active .step-dot {
  border-color: var(--petrol);
  background: var(--petrol-soft);
}

.pipeline-step .step-info {
  display: flex;
  flex-direction: column;
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-step .step-info strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.pipeline-step .step-info span {
  color: var(--ink-3);
  font-size: 11px;
}

.severity-stacked-bar {
  height: 8px;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-2);
  display: flex;
}

.severity-stacked-bar .bar-seg {
  height: 100%;
  transition: width 300ms ease;
}

.bar-seg--high { background: var(--high); }
.bar-seg--medium { background: var(--medium); }
.bar-seg--ok { background: var(--ok); }

.bar-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 11px;
  color: var(--ink-2);
}

.bar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.dot--high { background: var(--high); }
.dot--medium { background: var(--medium); }
.dot--ok { background: var(--ok); }

.domain-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 6px;
}

.domain-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 38px;
  align-items: center;
  gap: 10px;
}

.domain-bar-label {
  font-size: 12px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.domain-bar-track {
  height: 7px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}

.domain-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 400ms ease;
}

.fill--ok { background: var(--ok); }
.fill--medium { background: var(--medium); }
.fill--high { background: var(--high); }

.domain-bar-num {
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
}

.summary-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.task-list, .activity-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--rule);
}

.task-bullet {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bullet--high { background: var(--high); }
.bullet--medium { background: var(--medium); }
.bullet--low, .bullet--action { background: var(--petrol); }

.task-content {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-title a {
  text-decoration: none;
  color: var(--ink);
}

.task-title a:hover {
  color: var(--petrol-ink);
  text-decoration: underline;
}

.task-detail {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-actions {
  flex-shrink: 0;
}

.btn--sm {
  padding: 3px 8px;
  font-size: 11.5px;
}

.empty-tasks {
  padding: 18px 12px;
  text-align: center;
}

.activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--paper);
  border: 1px solid var(--rule);
  text-decoration: none;
  color: inherit;
  transition: background 100ms ease;
}

.activity-row:hover {
  background: var(--surface-2);
}

.activity-left {
  flex: 1;
  min-width: 0;
}

.activity-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-desc {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.activity-time {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
}

@media (max-width: 960px) {
  .charts-grid, .summary-columns {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------- responsive -- */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; align-items: start; }
  .hero__aside { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 16px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .workspace { grid-template-columns: 1fr; }
  .reader { position: relative; top: 0; max-height: none; order: -1; }
  .dossier-strip { grid-template-columns: 1fr; }
  .dossier-strip .chart { justify-self: start; }
  .two-col { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { gap: 12px; height: auto; padding: 10px var(--gutter); flex-wrap: wrap; }
  .brand .descriptor { display: none; }
  .nav { width: 100%; justify-content: space-between; overflow-x: auto; }
  .nav a, .nav button.linkish { padding: 6px 8px; font-size: 13px; }
  .tabs { top: 0; }
  .doc-head__top { flex-wrap: wrap; }
  .doc-head .actions { margin-left: 0; justify-content: flex-start; }
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
  .reader__body { padding: 8px 14px 28px; }
  .hop { grid-template-columns: 1fr; gap: 6px; }
  .ledger thead { display: none; }
  .ledger tbody td { display: block; padding: 4px 0; }
  .ledger tbody tr { display: block; padding: 12px 0; }
  .ledger td.actions { text-align: left; }
}

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

@media print {
  .topbar, .tabs, .actions, .footer { display: none; }
  body { background: white; }
  .reader { position: static; max-height: none; border: 0; box-shadow: none; }
}

/* The hidden attribute must beat component display rules. */
[hidden] { display: none !important; }

/* Tab bars scroll on narrow screens without platform scrollbar chrome. */
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }

/* --------------------------------------------------- screenshot review styles -- */

.screenshot-preview-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.screenshot-preview-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--rule-strong);
  background: white;
}

.screenshot-preview-info {
  flex: 1;
  min-width: 0;
}

.screenshot-deck {
  display: flex;
  flex-direction: column;
}

.screenshot-workspace--split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.screenshot-workspace--full {
  display: block;
}

.screenshot-pane {
  min-width: 0;
}

.screenshot-canvas-frame {
  position: relative;
  overflow: auto;
  max-height: 780px;
  min-height: 380px;
  background: #182224;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
}

.screenshot-canvas-img {
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
  border-radius: 1px;
}

.screenshot-evidence-pane {
  min-width: 0;
}

.screenshot-lens-container {
  display: flex;
  flex-direction: column;
}

.screenshot-lens-toolbar {
  padding: 8px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  align-items: center;
}

.screenshot-lens-viewport {
  overflow: auto;
  max-height: 550px;
  background: #182224;
  padding: 12px;
  display: flex;
  justify-content: center;
}

.screenshot-lens-img {
  max-width: 100%;
  height: auto;
  box-shadow: 0 2px 16px rgba(0,0,0,0.35);
}

.lens-btn.is-active {
  background: var(--petrol-soft) !important;
  color: var(--petrol-ink) !important;
  font-weight: 600;
}

@media (max-width: 960px) {
  .screenshot-workspace--split {
    grid-template-columns: 1fr;
  }
}

