/* ═══════════════════════════════════════════════════════════════════════════
   Velar Audit — design system

   GovTech enterprise: high information density, institutional restraint, and a
   navy-and-blue palette. The reference points are Stripe Dashboard, Vercel and
   Linear rather than anything decorative — this is a supervisory instrument for
   an electoral tribunal, and it should read like one.

   Poppins is self-hosted in /fonts. Nothing in the interface fetches from a CDN
   at runtime: during a hackathon the venue wifi is the adversary, and a
   dashboard that depends on fonts.googleapis.com can arrive blank.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: Poppins; font-weight: 400; font-display: swap; font-style: normal;
  src: url('/fonts/poppins-400.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 500; font-display: swap; font-style: normal;
  src: url('/fonts/poppins-500.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 600; font-display: swap; font-style: normal;
  src: url('/fonts/poppins-600.woff2') format('woff2'); }
@font-face { font-family: Poppins; font-weight: 700; font-display: swap; font-style: normal;
  src: url('/fonts/poppins-700.woff2') format('woff2'); }

:root {
  --navy:        #0B1F3A;
  --navy-soft:   #14304f;
  --brand:       #155EEF;
  --brand-dark:  #0E4BC7;
  --brand-050:   #EFF8FF;
  --brand-100:   #D1E4FD;

  --canvas:      #F8FAFC;
  --surface:     #FFFFFF;
  --subtle:      #F8FAFC;
  --border:      #E2E8F0;
  --border-2:    #CBD5E1;

  --text:        #0F172A;
  --text-2:      #475569;
  --text-3:      #64748B;

  --ok-bg:   #ECFDF3; --ok-fg:   #027A48;
  --warn-bg: #FFFAEB; --warn-fg: #B54708;
  --err-bg:  #FEF3F2; --err-fg:  #B42318; --err-solid: #D92D20;
  --info-bg: #EFF8FF; --info-fg: #175CD3;
  --success: var(--ok-fg);
  --warn:    var(--warn-fg);
  --error:   var(--err-fg);

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px;

  --radius:     12px;
  --radius-md:  10px;
  --radius-sm:  6px;
  --shadow:     0 1px 2px 0 rgba(0, 0, 0, .03);
  --shadow-lift:0 16px 48px rgba(11, 31, 58, .18);

  --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: Poppins, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 22px;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input, select { font-family: inherit; color: inherit; }

/* Escala tipográfica: comprimida respecto de GOV.UK, pero con su misma lógica */
.heading-xl { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -.02em; }
.heading-l  { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.heading-m  { font-size: 16px; line-height: 24px; font-weight: 600; }
.heading-s  { font-size: 14px; line-height: 22px; font-weight: 600; }
.body-s     { font-size: 13px; line-height: 19px; }
.secondary  { color: var(--text-2); }

@media (max-width: 640px) {
  .heading-xl { font-size: 26px; line-height: 32px; }
  .heading-l  { font-size: 21px; line-height: 28px; }
}

/*
 * Focus ring.
 *
 * The GOV.UK yellow was swapped for an institutional blue ring to match this
 * palette, but the guarantee behind it is kept: it stays !important — the only
 * one in this file — because component states with higher specificity were
 * hiding it. `.nav-item[aria-current="page"]` (0-2-1) beat
 * `button:focus-visible` (0-1-1), so the indicator vanished on exactly the
 * element most likely to receive focus when someone tabs in. Enumerating every
 * state that could win is a race you lose; a focus indicator that cannot be
 * overridden is the point.
 */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--brand) !important;
  outline-offset: 2px !important;
  border-radius: var(--radius-sm);
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); text-decoration: underline; }

.sr, .skip-link:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link:focus {
  display: block; padding: var(--sp-2) var(--sp-4); background: var(--brand);
  color: #fff; text-decoration: none; font-weight: 600;
}
.hidden { display: none !important; }

/* ── Top identity bar ───────────────────────────────────────────────────── */

/*
 * The top bar carries identity, environment and session. Section navigation
 * sits on its own bar below. Splitting them avoids the classic problem of
 * showing the same navigation twice and making the reader work out which of
 * the two is the real one.
 */
.navbar {
  background: var(--navy);
  color: #fff;
  position: sticky; top: 0; z-index: 30;
  border-bottom: 3px solid var(--brand);
}
.navbar-inner {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-6); height: 56px;
}
@media (max-width: 640px) { .navbar-inner { padding: 0 var(--sp-4); height: auto; min-height: 56px; flex-wrap: wrap; gap: var(--sp-2); } }

.navbar .brand-link {
  display: flex; align-items: center; gap: var(--sp-3);
  background: none; border: none; padding: 0; cursor: pointer; color: #fff;
}
.navbar .brand-sub { font-size: 12px; color: var(--border-2); }

.navbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-4); }
.navbar-env {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 4px 10px; border-radius: 9999px;
  border: 1px solid rgba(255,255,255,.28); font-size: 12.5px; color: #fff;
}
.navbar-user { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; }
.navbar-user .who { text-align: right; line-height: 1.3; }
.navbar-user .org { color: var(--border-2); font-size: 12px; }
.navbar .avatar { background: var(--navy-soft); color: #fff; }
.navbar .btn.secondary {
  background: transparent; border-color: rgba(255,255,255,.35); color: #fff;
}
.navbar .btn.secondary:hover { background: rgba(255,255,255,.12); border-color: #fff; }
@media (max-width: 520px) { .navbar-user .who, .navbar-env { display: none; } }

/* ── Layout ─────────────────────────────────────────────────────────────── */

.shell { display: flex; flex-direction: column; min-height: calc(100vh - 56px); }

.brand {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
}
/*
 * The logo is a lockup, not a letter in a box: it carries the wordmark itself,
 * so there is no text node beside it to keep in sync — and no 30px badge
 * squeezing the magnifier down to a smudge.
 */
.brand-logo { display: block; height: 40px; width: auto; }

/*
 * Section navigation, sitting directly under the identity bar.
 *
 * It used to be a left sidebar. Four sections did not justify surrendering
 * 240px of every screen to them, and the table — which is the thing people
 * actually came to read — was the one paying for it.
 */
/* ── Sidebar ────────────────────────────────────────────────────────────── */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 900px) { .shell { grid-template-columns: 1fr; } }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
@media (max-width: 900px) { .sidebar { position: static; height: auto; } }

.sidebar .brand {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-5) var(--sp-5) var(--sp-4);
}

.nav { padding: var(--sp-2) var(--sp-3); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3); border-radius: var(--radius-sm);
  border: none; background: none; width: 100%; text-align: left; cursor: pointer;
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
}
.nav-item:hover { background: var(--subtle); color: var(--text); }
.nav-item[aria-current="page"] {
  background: var(--brand-050); color: var(--brand-dark); font-weight: 600;
}
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); }
.nav-item[aria-current="page"] .nav-count { color: var(--brand-dark); }

/* Palette legend, straight from the reference: it tells whoever is looking at
   a screenshot which two blues the system is built on. */
.sidebar-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); }
.swatches { display: flex; flex-direction: column; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.swatches li { display: flex; align-items: center; gap: var(--sp-2); font-size: 11.5px; color: var(--text-3); }
.swatches .chip { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.env-pill {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 5px 10px; border-radius: 9999px;
  border: 1px solid var(--border); background: var(--subtle);
  font-size: 12.5px; font-weight: 500; color: var(--text-2);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.dot.live { animation: pulse 2.4s infinite; }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(15,122,82,.5); }
  70%  { box-shadow: 0 0 0 6px rgba(15,122,82,0); }
  100% { box-shadow: 0 0 0 0 rgba(15,122,82,0); }
}
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none; } }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  min-height: 56px; flex-shrink: 0;
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-2) var(--sp-6);
  position: sticky; top: 0; z-index: 20;
}
@media (max-width: 640px) { .topbar { padding: 0 var(--sp-4); } }

.breadcrumbs { font-size: 14px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.breadcrumbs li { display: flex; align-items: center; gap: var(--sp-2); }
.breadcrumbs li + li::before {
  content: ""; width: 6px; height: 6px; border: solid var(--border-2);
  border-width: 1.5px 1.5px 0 0; transform: rotate(45deg);
}
.breadcrumbs button {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--brand); text-decoration: underline; font-size: inherit;
}
.breadcrumbs [aria-current] { color: var(--text); font-weight: 500; }

.profile { margin-left: auto; position: relative; }

.account-trigger {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 5px var(--sp-2) 5px var(--sp-3); border-radius: var(--radius-sm);
  border: 1px solid transparent; background: none; cursor: pointer;
}
.account-trigger:hover { background: var(--subtle); border-color: var(--border); }
.account-trigger[aria-expanded="true"] { background: var(--subtle); border-color: var(--border); }
.account-trigger .who { text-align: right; line-height: 1.3; font-size: 13px; }
.account-trigger .who .org { color: var(--text-3); font-size: 12px; }
.account-trigger .chev {
  width: 8px; height: 8px; border: solid var(--text-3); border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) translate(-2px, -2px); flex-shrink: 0;
}
.account-trigger[aria-expanded="true"] .chev { transform: rotate(-135deg) translate(-1px, -1px); }
@media (max-width: 620px) { .account-trigger .who { display: none; } }

.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  min-width: 248px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift); overflow: hidden;
}
.account-menu .identity { padding: var(--sp-4); border-bottom: 1px solid var(--border); }
.account-menu .identity .mail { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.account-menu .identity .org { font-size: 12.5px; color: var(--text-2); margin: 2px 0 8px; }
.account-menu .items { padding: var(--sp-1); }
.account-menu .item {
  display: block; width: 100%; text-align: left;
  padding: 9px var(--sp-3); border: none; background: none; cursor: pointer;
  font-size: 13.5px; color: var(--text); border-radius: var(--radius-sm);
}
.account-menu .item:hover { background: var(--subtle); }
.account-menu .item.danger { color: var(--err-fg); }
.account-menu .item.danger:hover { background: var(--err-bg); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-100); color: var(--navy);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; flex-shrink: 0;
}

.phase-banner {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: var(--sp-2) var(--sp-7);
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-size: 13.5px; color: var(--text-2);
}
@media (max-width: 640px) { .phase-banner { padding: var(--sp-2) var(--sp-4); } }

.content { padding: var(--sp-7) var(--sp-6); max-width: 1500px; width: 100%; margin: 0 auto; }
@media (max-width: 640px) { .content { padding: var(--sp-4); } }

/* ── View header ────────────────────────────────────────────────────────── */

.view-head { margin-bottom: var(--sp-7); }
.view-head .caption { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
.view-head h1 { margin: var(--sp-1) 0 var(--sp-2); }
.view-head .lede { font-size: 16px; color: var(--text-2); max-width: 62ch; }
.actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-5); }

.rule { border: none; border-top: 1px solid var(--border); margin: var(--sp-7) 0; }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-4); border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  font-size: 14.5px; font-weight: 500; white-space: nowrap;
  background: var(--brand); color: #fff; box-shadow: var(--shadow);
  transition: background .12s ease;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn.secondary { background: var(--surface); border-color: var(--border-2); color: var(--text); }
.btn.secondary:hover { background: var(--subtle); border-color: var(--text-3); }
.btn.warning { background: var(--error); color: #fff; }
.btn.warning:hover { background: #a92a2a; }
.btn.sm { height: 32px; padding: 0 var(--sp-3); font-size: 13.5px; }
/*
 * Named btn-full rather than .block: that class already means "content card"
 * in this stylesheet, and a full-width button was picking up the card's white
 * background, rendering white text on white.
 */
.btn-full { width: 100%; }

.btn-link {
  border: none; background: none; padding: 0; cursor: pointer;
  color: var(--brand); text-decoration: underline; text-underline-offset: 2px;
  font-size: inherit; font-family: inherit; font-weight: 500;
}
.btn-link:hover { color: var(--brand-dark); text-decoration-thickness: 2px; }

/* ── Forms ──────────────────────────────────────────────────────────────── */

.field { margin-bottom: var(--sp-5); }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: var(--sp-1); }
.field .hint { color: var(--text-2); font-size: 13.5px; margin-bottom: var(--sp-2); }
.input, .select {
  width: 100%; height: 40px; padding: 0 var(--sp-3);
  border: 1px solid var(--border-2); border-radius: var(--radius-sm);
  font-size: 14.5px; background: var(--surface); color: var(--text);
  appearance: none;
}
.input:hover, .select:hover { border-color: var(--text-3); }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 6l5 5 5-5' stroke='%2348545f' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 15px;
  padding-right: 32px;
}
.input.narrow { max-width: 26em; }

.error-summary {
  border: 1px solid var(--error); border-left: 4px solid var(--error);
  border-radius: var(--radius-sm); background: #fdf4f3;
  padding: var(--sp-4); margin-bottom: var(--sp-5);
}
.error-summary h2 { font-size: 16px; font-weight: 600; color: var(--error); margin-bottom: var(--sp-1); }
.field.has-error .input { border-color: var(--error); }

/* ── Status tags ────────────────────────────────────────────────────────── */

/*
 * Status pill. The meaning is carried by the label, with the coloured dot as
 * reinforcement rather than as the signal — a reader who cannot separate two
 * reds from two greens still gets the status from the words.
 */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 9999px;
  font-size: 12px; line-height: 18px; font-weight: 500; white-space: nowrap;
  background: #F1F5F9; color: var(--text-2);
}
.tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}
.tag.verified      { background: var(--ok-bg);  color: var(--ok-fg); }
.tag.pending       { background: var(--warn-bg); color: var(--warn-fg); }
.tag.non_compliant { background: var(--err-bg);    color: var(--err-fg); }
.tag.returned      { background: var(--info-bg);   color: var(--info-fg); }
.tag.unscored      { background: #F1F5F9;   color: var(--text-2); }
.tag.high          { background: var(--err-bg);    color: var(--err-fg); }
.tag.medium        { background: var(--warn-bg); color: var(--warn-fg); }

/* ── Callouts ───────────────────────────────────────────────────────────── */

.inset {
  border-left: 4px solid var(--border-2); background: var(--brand-050);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: var(--sp-3) var(--sp-4); margin: var(--sp-4) 0;
  font-size: 14.5px; color: var(--text-2);
}
.inset.warn { border-left-color: var(--error); background: #fdf4f3; }

.warning-text { display: flex; gap: var(--sp-3); align-items: flex-start; margin: var(--sp-5) 0; }
.warning-text .mark {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--text); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 17px; line-height: 1;
}
.warning-text p { font-size: 14.5px; color: var(--text-2); }
.warning-text strong { color: var(--text); }

/* ── Cards and blocks ───────────────────────────────────────────────────── */

.block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow); padding: var(--sp-6);
}
.block > h2 { margin-bottom: 2px; }
.block > .caption { color: var(--text-2); font-size: 13.5px; margin-bottom: var(--sp-5); }

.cols { display: grid; gap: var(--sp-5); }
.cols.two-thirds { grid-template-columns: 2fr 1fr; }
.cols.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols.thirds { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .cols.two-thirds, .cols.halves, .cols.thirds { grid-template-columns: 1fr; } }
.stack { display: flex; flex-direction: column; gap: var(--sp-7); }

/* ── Headline figures ───────────────────────────────────────────────────── */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr; } }

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--sp-5); border-top: 3px solid var(--brand);
}
.stat .k { font-size: 13px; font-weight: 500; color: var(--text-2); }
.stat .v { font-size: 30px; line-height: 38px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: var(--sp-1) 0; }
.stat .n { font-size: 13px; color: var(--text-3); }
.stat.ok   { border-top-color: var(--success); }
.stat.warn { border-top-color: var(--warn); }
.stat.err  { border-top-color: var(--error); }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
caption { text-align: left; font-weight: 600; padding: var(--sp-4) var(--sp-5); }
thead th {
  background: var(--subtle); text-align: left; padding: var(--sp-3) var(--sp-5);
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td, tbody th {
  text-align: left; padding: var(--sp-3) var(--sp-5);
  border-bottom: 1px solid var(--border); vertical-align: middle; font-weight: 400;
}
tbody tr:last-child td, tbody tr:last-child th { border-bottom: none; }
tbody tr:hover { background: var(--subtle); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }

.pager {
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border);
  font-size: 14px; color: var(--text-2); flex-wrap: wrap;
}
.empty { padding: var(--sp-9) var(--sp-5); text-align: center; color: var(--text-2); }

/* ── Filters and tabs ───────────────────────────────────────────────────── */

.filter-bar {
  display: flex; gap: var(--sp-4); flex-wrap: wrap; align-items: flex-end;
  padding: var(--sp-5); border-bottom: 1px solid var(--border);
}
.filter-bar .field { margin-bottom: 0; }

.tabs { display: flex; gap: var(--sp-2); flex-wrap: wrap; padding: var(--sp-4) var(--sp-5) 0; }
.tab {
  padding: var(--sp-2) var(--sp-4); border-radius: 9999px; border: 1px solid transparent;
  background: none; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-2);
}
.tab:hover { background: var(--subtle); color: var(--text); }
.tab[aria-selected="true"] { background: var(--brand-050); color: var(--brand-dark); font-weight: 600; border-color: var(--brand-100); }

/* ── Verification flow ──────────────────────────────────────────────────── */

.flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-5); }
@media (max-width: 1000px) { .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .flow { grid-template-columns: 1fr; } }
.flow-step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-5); border-top: 3px solid var(--brand);
}
.flow-step .n {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand-050); color: var(--brand-dark);
  font-size: 12.5px; font-weight: 700; margin-bottom: var(--sp-2);
}
.flow-step .t { font-weight: 600; font-size: 15px; }
.flow-step .d { font-size: 13.5px; color: var(--text-2); margin-top: var(--sp-1); }

/* ── Lists ──────────────────────────────────────────────────────────────── */

.task-list li {
  display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border);
}
.task-list li:last-child { border-bottom: none; }
.task-list li:hover { background: var(--subtle); }
.task-list .title { font-weight: 600; min-width: 10em; }
.task-list .detail { flex: 1; min-width: 18em; font-size: 14px; color: var(--text-2); }

.summary-list { font-size: 14px; }
.summary-list > div { display: flex; gap: var(--sp-5); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.summary-list > div:last-child { border-bottom: none; }
.summary-list dt { font-weight: 600; width: 15em; flex-shrink: 0; color: var(--text-2); }
.summary-list dd { margin: 0; flex: 1; min-width: 12em; word-break: break-all; }

.checks li { display: flex; gap: var(--sp-2); align-items: flex-start; padding: var(--sp-2) 0; font-size: 14px; }
.checks .mark { font-weight: 700; flex-shrink: 0; width: 1.3em; }
.checks .bad .mark  { color: var(--error); }
.checks .warn .mark { color: var(--warn); }
.checks .ok .mark   { color: var(--success); }

/* ── Timeline ───────────────────────────────────────────────────────────── */

.timeline { position: relative; padding-left: var(--sp-7); }
.timeline::before { content: ""; position: absolute; left: 5px; top: 10px; bottom: 10px; width: 2px; background: var(--border); }
.tl-step { position: relative; padding-bottom: var(--sp-7); }
.tl-step:last-child { padding-bottom: 0; }
.tl-step::before {
  content: ""; position: absolute; left: calc(-1 * var(--sp-7) + 1px); top: 7px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px var(--brand-050);
}
.tl-step.done::before { background: var(--success); box-shadow: 0 0 0 3px var(--ok-bg); }
.tl-step.todo::before { background: var(--border-2); box-shadow: 0 0 0 3px var(--canvas); }
.tl-step h3 { font-size: 17px; font-weight: 600; }
.tl-step .when { font-size: 13.5px; color: var(--text-3); margin-bottom: var(--sp-3); }

/* ── Slide-over drawer ──────────────────────────────────────────────────── */

.scrim { position: fixed; inset: 0; background: rgba(12, 45, 74, .45); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw);
  background: var(--surface); box-shadow: var(--shadow-lift); z-index: 41;
  display: flex; flex-direction: column; border-left: 3px solid var(--brand);
  animation: slide-in .2s cubic-bezier(.32,.72,0,1);
}
@keyframes slide-in { from { transform: translateX(100%) } to { transform: translateX(0) } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none } }
.drawer-head { padding: var(--sp-5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: var(--sp-3); align-items: flex-start; }
.drawer-body { padding: var(--sp-5); overflow-y: auto; flex: 1; }
.drawer-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-3); flex-wrap: wrap; background: var(--subtle); }

/* ── Wallets ────────────────────────────────────────────────────────────── */

.wallet {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: var(--sp-6); border-top: 3px solid var(--brand);
}
.wallet .sub { font-size: 13.5px; color: var(--text-2); }
.wallet .amount { font-size: 28px; line-height: 36px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.addr { display: flex; gap: var(--sp-2); align-items: center; margin: var(--sp-4) 0; }
.addr code {
  flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis;
  background: var(--subtle); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px;
}

/* ── Privacy diagram ────────────────────────────────────────────────────── */

.privacy { display: grid; grid-template-columns: 1fr auto 1fr; gap: var(--sp-6); align-items: stretch; }
@media (max-width: 1080px) { .privacy { grid-template-columns: 1fr; } }
.privacy-col { border-radius: var(--radius); border: 1px solid var(--border); padding: var(--sp-5); background: var(--subtle); }
.privacy-col.on { background: var(--brand-050); border-color: var(--brand-100); }
.privacy-col h3 { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.privacy-col.on h3 { color: var(--brand-dark); }
.privacy-col .cap { font-size: 13.5px; color: var(--text-2); margin: var(--sp-1) 0 var(--sp-4); }
.privacy-list li { padding: var(--sp-3) 0; border-bottom: 1px solid rgba(11,12,12,.07); font-size: 14px; }
.privacy-list li:last-child { border-bottom: none; }

.transform { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: var(--sp-2); text-align: center; }
.transform .step {
  border: 1px solid var(--border-2); background: var(--surface);
  border-radius: 9999px; padding: var(--sp-2) var(--sp-4);
  font-size: 13px; font-weight: 500; white-space: nowrap;
}
.transform .step.mid { border-color: var(--brand); color: var(--brand); font-family: ui-monospace, Menlo, monospace; }
.transform .arrow { color: var(--text-3); font-size: 18px; line-height: 1; }

/* ── Charts ─────────────────────────────────────────────────────────────── */

.chart { width: 100%; display: block; }
.chart .axis { font-size: 12px; fill: var(--text-3); }
.chart .gridline { stroke: var(--border); stroke-width: 1; stroke-dasharray: 3 3; }

.legend { margin-top: var(--sp-5); }
.legend li { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-2) 0; font-size: 14px; }
.legend .swatch { width: 10px; height: 10px; border-radius: 2px; flex-shrink: 0; }
.legend .pct { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.progress { height: 6px; border-radius: 9999px; background: var(--border); overflow: hidden; margin-bottom: var(--sp-4); }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 9999px; transition: width .3s ease; }

/* ── Sign in ────────────────────────────────────────────────────────────── */

.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6); }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6); }

/* ── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: var(--sp-6); left: 50%; transform: translateX(-50%);
  background: var(--navy); color: #fff; z-index: 60;
  padding: var(--sp-3) var(--sp-5); border-radius: var(--radius-sm);
  font-size: 14.5px; box-shadow: var(--shadow-lift); max-width: min(560px, 92vw);
  animation: rise .18s ease;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px) } to { opacity: 1; transform: translate(-50%, 0) } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none } }


/* ── QVAC engine panel ──────────────────────────────────────────────────── */

/*
 * Navy, and deliberately the only dark surface in the product. The engine is
 * the claim the whole system rests on — that donor data is assessed without
 * leaving the building — so it gets the one piece of visual weight available.
 */
.engine-panel {
  background: var(--navy); color: #fff;
  border-radius: var(--radius); padding: var(--sp-6);
}
.engine-head { display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; align-items: flex-start; }
.engine-head h2 { color: #fff; }
.engine-sub { font-size: 13px; line-height: 19px; color: #A9BCD4; margin-top: 2px; max-width: 54ch; }
.engine-badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  padding: 5px 12px; border-radius: 9999px; font-size: 12.5px;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.20); color: #fff;
}
.engine-metrics {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-5); margin: var(--sp-6) 0;
}
@media (max-width: 860px) { .engine-metrics { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.engine-metrics .k { font-size: 12px; color: #A9BCD4; }
.engine-metrics .v { font-size: 20px; font-weight: 600; margin-top: 2px; }
.engine-panel .progress { background: rgba(255,255,255,.16); border: none; }
.engine-panel .progress > i { background: #6FA8FF; }
.engine-panel .btn { background: var(--brand); }
.engine-panel .btn:hover { background: #2C71F2; }

/* ── Risk cards ─────────────────────────────────────────────────────────── */

.risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.risk-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow);
  padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-2);
}
.risk-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.risk-head .ref { font-weight: 600; font-size: 13px; }
.risk-amount { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.risk-party { font-size: 12.5px; color: var(--text-3); }
.risk-why { font-size: 13px; line-height: 19px; color: var(--text-2); flex: 1; }
.risk-card .btn { align-self: flex-start; margin-top: var(--sp-2); }

/* ── Audit view filter bar ──────────────────────────────────────────────── */

.filter-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow); padding: var(--sp-5);
}

/* Alternating rows, ultra-subtle, for high-density tables */
tbody tr:nth-child(even) { background: var(--subtle); }
tbody tr:hover { background: var(--brand-050); }


/* ── Split sign-in ──────────────────────────────────────────────────────── */

.auth-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } }

.auth-art {
  background: var(--navy); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--sp-8); position: relative; overflow: hidden;
}
@media (max-width: 900px) { .auth-art { display: none; } }
.auth-art .brand-sub { color: #93AECD; font-size: 12.5px; }
.auth-art .pitch { max-width: 34ch; }
.auth-art .pitch h2 { font-size: 26px; line-height: 34px; font-weight: 600; letter-spacing: -.02em; }
.auth-art .pitch p { color: #A9BCD4; margin-top: var(--sp-3); font-size: 14px; line-height: 21px; }
.auth-art svg.mesh { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; pointer-events: none; }

.auth-form-side { display: grid; place-items: center; padding: var(--sp-8) var(--sp-6); }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h1 { margin-bottom: var(--sp-1); }
.auth-form .lede { color: var(--text-2); font-size: 14px; margin-bottom: var(--sp-7); }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.checkbox { display: flex; gap: var(--sp-3); align-items: flex-start; font-size: 13.5px; color: var(--text-2); }
.checkbox input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--brand); flex-shrink: 0; }
textarea.input { height: auto; min-height: 96px; padding: var(--sp-3); resize: vertical; line-height: 21px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */

.modal-scrim {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px);
  display: grid; place-items: center; padding: var(--sp-5);
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow-lift); width: 100%; max-width: 460px;
  max-height: 90vh; display: flex; flex-direction: column;
}
.modal-head { padding: var(--sp-5); border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); }
.modal-body { padding: var(--sp-5); overflow-y: auto; }
.modal-foot { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--border); display: flex; gap: var(--sp-3); justify-content: flex-end; }

/* Progress steps inside the return modal */
.steps { display: flex; align-items: flex-start; margin: var(--sp-5) 0 var(--sp-2); }
.steps li { flex: 1; text-align: center; position: relative; font-size: 11.5px; color: var(--text-3); }
.steps li::before {
  content: ""; display: block; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-2);
  margin: 0 auto var(--sp-2); position: relative; z-index: 1;
}
.steps li::after {
  content: ""; position: absolute; top: 9px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.steps li:first-child::after { display: none; }
.steps li.done { color: var(--ok-fg); font-weight: 500; }
.steps li.done::before { background: var(--ok-fg); border-color: var(--ok-fg); }
.steps li.done::after { background: var(--ok-fg); }
.steps li.active { color: var(--brand); font-weight: 500; }
.steps li.active::before { border-color: var(--brand); }

/* ── Audit trail ────────────────────────────────────────────────────────── */

.trail-actor { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--text-3); }
.event-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; background: var(--brand); }
.event-dot.received { background: var(--brand); }
.event-dot.attestation { background: var(--info-fg); }
.event-dot.verified { background: var(--ok-fg); }
.event-dot.flagged { background: var(--err-fg); }
.event-dot.returned { background: var(--text-3); }
