/* Alderfly portal. Minimal app UI: neutral surfaces, one indigo accent, semantic colour for state and category.
   Loads nothing from outside (system fonts; the CSP allows only 'self'). No inline styles anywhere. */

:root {
  --bg: #f7f7f8; --surface: #ffffff; --surface-2: #f2f2f4; --line: #e7e7ea; --line-2: #d6d6db;
  --text: #111114; --text-2: #55555f; --text-3: #8b8b96;
  --accent: #002fa7; --accent-2: #00237d; --accent-soft: #e8edf9; --on-accent: #ffffff;   /* International Klein Blue */
  --green: #16a34a; --green-soft: #e8f7ee; --amber: #d97706; --amber-soft: #fdf3e2;
  --red: #dc2626; --red-soft: #fdecec; --blue: #2563eb; --blue-soft: #e9f0fe;
  --sky: #0891b2; --sky-soft: #e3f4f8; --teal: #0d9488; --teal-soft: #e4f6f4;
  --pink: #db2777; --pink-soft: #fcebf3; --slate: #64748b; --slate-soft: #eef1f5;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 16, 24, .04), 0 1px 3px rgba(16, 16, 24, .06);
  --shadow-lg: 0 12px 32px rgba(16, 16, 24, .12);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  /* legacy names still used by a few templates */
  --ok: var(--green); --warn: var(--amber); --bad: var(--red); --navy: var(--accent); --muted: var(--text-2);
  --faint: var(--text-3); --rule: var(--line); --card: var(--surface); --paper: var(--bg);
  --ok-soft: var(--green-soft); --warn-soft: var(--amber-soft); --bad-soft: var(--red-soft); --navy-soft: var(--accent-soft);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0e; --surface: #141418; --surface-2: #1b1b21; --line: #26262e; --line-2: #34343e;
    --text: #ededf0; --text-2: #a4a4b0; --text-3: #6f6f7b;
    --accent: #4f7cff; --accent-2: #7499ff; --accent-soft: #101c3d; --on-accent: #ffffff;
    --green: #4ade80; --green-soft: #12251a; --amber: #fbbf24; --amber-soft: #2a2110; --red: #f87171; --red-soft: #2c1414;
    --blue: #60a5fa; --blue-soft: #122036; --sky: #22d3ee; --sky-soft: #0c2429; --teal: #2dd4bf; --teal-soft: #0f2623;
    --pink: #f472b6; --pink-soft: #2b1422; --slate: #94a3b8; --slate-soft: #1a1e25;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* explicit choice from the theme switch (static/theme.js) wins over the system setting */
:root[data-theme="dark"] {
    --bg: #0b0b0e; --surface: #141418; --surface-2: #1b1b21; --line: #26262e; --line-2: #34343e;
    --text: #ededf0; --text-2: #a4a4b0; --text-3: #6f6f7b;
    --accent: #4f7cff; --accent-2: #7499ff; --accent-soft: #101c3d; --on-accent: #ffffff;
    --green: #4ade80; --green-soft: #12251a; --amber: #fbbf24; --amber-soft: #2a2110; --red: #f87171; --red-soft: #2c1414;
    --blue: #60a5fa; --blue-soft: #122036; --sky: #22d3ee; --sky-soft: #0c2429; --teal: #2dd4bf; --teal-soft: #0f2623;
    --pink: #f472b6; --pink-soft: #2b1422; --slate: #94a3b8; --slate-soft: #1a1e25;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; min-height: 100vh; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.02em; color: var(--text); }
h1 { font-size: 26px; line-height: 1.2; }
h2 { font-size: 16px; line-height: 1.3; letter-spacing: -.01em; }
h3 { font-size: 14px; margin: 20px 0 8px; }
p { margin: 0 0 10px; }
code, .mono { font-family: var(--mono); font-size: .9em; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 5px; }
.ico { width: 16px; height: 16px; flex: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- shell */
body.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr);
  background: linear-gradient(90deg, var(--surface) 235px, var(--line) 235px, var(--line) 236px, var(--bg) 236px); }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); padding: 2px 8px; text-decoration: none !important; }
.brand .mark { width: 22px; height: 22px; fill: var(--accent); }
.brand .word { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand .sub { color: var(--text-3); font-size: 13px; padding-left: 9px; border-left: 1px solid var(--line-2); }
.side-new { width: 100%; justify-content: flex-start; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.side-label { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.side-nav a, .side-out button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font: 500 13.5px/1.3 var(--sans); text-decoration: none; background: none; border: 0; width: 100%; cursor: pointer; text-align: left; }
.side-nav a:hover, .side-out button:hover { background: var(--surface-2); color: var(--text); }
.side-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.side-out { margin: 0; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 36px 40px; }
.top { display: flex; justify-content: center; padding: 22px 16px 0; }
@media (max-width: 900px) {
  body.shell { display: block; background: var(--bg); }
  .side { position: sticky; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-new span, .side-label, .side-nav a span, .side-out span, .brand .word { display: none; }
  .side-new { width: auto; padding: 8px; min-height: 34px; }
  .side-nav { flex-direction: row; gap: 2px; }
  .wrap { padding: 0 16px 32px; }
}

/* ---------------------------------------------------------------- page head */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; padding: 34px 0 22px; flex-wrap: wrap; }
.head > div:first-child { max-width: 760px; min-width: 0; }
.eyebrow { margin: 0 0 6px; font-size: 12.5px; color: var(--text-3); font-weight: 500; }
.eyebrow a { color: var(--text-2); }
.lede { color: var(--text-2); font-size: 14px; margin: 6px 0 0; max-width: 640px; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mono-h { font-family: var(--mono); font-size: 22px; letter-spacing: 0; font-weight: 600; }
.mono-h.small, h2.small { font-size: 15px; }
.head:has(~ .stepper) { padding-bottom: 16px; }
.section-h { margin: 28px 0 12px; }
.jump { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; white-space: nowrap;
  font: 550 13.5px/1 var(--sans); padding: 9px 14px; min-height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text); text-decoration: none !important; box-shadow: var(--shadow);
  transition: background .12s, border-color .12s, transform .06s; }
.btn:hover { background: var(--surface-2); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--on-accent); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line-2)); background: var(--surface); }
.btn.danger:hover { background: var(--red-soft); }
.btn.big { padding: 12px 18px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.small-btn { min-height: 30px; padding: 6px 10px; font-size: 12.5px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link.danger { color: var(--red); }
form.inline { display: inline; margin: 0; }

/* ---------------------------------------------------------------- surfaces */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin: 0 0 16px; box-shadow: var(--shadow); }
@media (max-width: 640px) { .panel { padding: 16px; } }
.panel.narrow { max-width: 560px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel > h2 { margin-bottom: 12px; }
.panel-warn { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); background: linear-gradient(var(--amber-soft), var(--amber-soft)) left / 4px 100% no-repeat, var(--surface); }
.panel-bad { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); background: linear-gradient(var(--red), var(--red)) left / 4px 100% no-repeat, var(--surface); }
.panel-ok { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); background: linear-gradient(var(--green), var(--green)) left / 4px 100% no-repeat, var(--surface); }
.panel-new { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: linear-gradient(var(--accent), var(--accent)) left / 4px 100% no-repeat, var(--surface); }
.panel-warn { background: linear-gradient(var(--amber), var(--amber)) left / 4px 100% no-repeat, var(--surface); }
.muted { color: var(--text-2); } .small { font-size: 12.5px; }
.empty { color: var(--text-2); padding: 6px 0; margin: 0; }
.hint { color: var(--text-2); font-size: 13px; margin: 12px 0 0; }
.warn-line { color: var(--amber); } .ok-line { color: var(--green); margin: 0; font-weight: 500; } .bad-text { color: var(--red); font-weight: 600; }
.flash { background: var(--accent-soft); color: var(--accent); border-radius: var(--radius-sm); padding: 10px 14px; margin: 20px 0 0; font-weight: 500; }
.error { background: var(--red-soft); color: var(--red); border-radius: var(--radius-sm); padding: 10px 14px; }
.note { background: var(--amber-soft); border-radius: var(--radius-sm); padding: 10px 14px; }
.notice-warn { background: var(--amber-soft); color: var(--text); border-radius: var(--radius-sm); padding: 8px 12px; margin: 0 0 10px; }
.foot { color: var(--text-3); font-size: 12.5px; padding: 28px 0 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col .panel { margin: 0; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- stats */
.stats, .grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 16px; }
.stat, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.stat .n, .card .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .l, .card .k { order: -1; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.card .s { color: var(--text-3); font-size: 12px; }
.stat::before, .card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, transparent); }
.stat-queued { --c: var(--blue); } .stat-running { --c: var(--sky); } .stat-passed { --c: var(--green); }
.stat-held, .stat-error { --c: var(--red); } .stat-blocked { --c: var(--pink); }
.stat-passed .n { color: var(--green); } .stat-held .n, .stat-error .n { color: var(--red); }
.card.good { --c: var(--green); } .card.good .v { color: var(--green); }
.card.badc { --c: var(--red); } .card.badc .v { color: var(--red); }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--text-3); font-weight: 550; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td .sub, td .code { display: block; color: var(--text-3); font-size: 12px; }
td .code { font-family: var(--mono); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; } .nowrap { white-space: nowrap; }
table.compact td { padding: 7px 10px; } table.compact td:first-child { padding-left: 0; }
.scroll-x { overflow-x: auto; } table.grid td { font-size: 12.5px; white-space: nowrap; }

/* ---------------------------------------------------------------- pills and badges */
.badge, .tag, .stage-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  font: 600 11.5px/1.4 var(--sans); background: var(--slate-soft); color: var(--slate); border: 0; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.big { font-size: 12.5px; padding: 5px 12px; }
.s-passed { background: var(--green-soft); color: var(--green); }
.s-held, .s-error { background: var(--red-soft); color: var(--red); }
.s-blocked { background: var(--pink-soft); color: var(--pink); }
.s-running, .s-queued, .s-open { background: var(--blue-soft); color: var(--blue); }
.s-cancelled { background: var(--slate-soft); color: var(--text-3); }
.tag-warn { background: var(--amber-soft); color: var(--amber); }
.tag-safe { background: var(--green-soft); color: var(--green); }
.tag-redact, .tag-rule { background: var(--red-soft); color: var(--red); }

/* ---------------------------------------------------------------- forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text); }
.help { color: var(--text-3); font-weight: 400; font-size: 12px; }
input, select, textarea { font: 14px/1.4 var(--sans); color: var(--text); background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; transition: border-color .12s, box-shadow .12s; }
textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.stack { display: flex; flex-direction: column; gap: 14px; } .stack .btn { align-self: flex-start; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; }
.grid3 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 20px; margin-top: 16px; }
@media (max-width: 760px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 400; }
.check input, input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.checks-grid { gap: 10px 22px; }
.settings h3 { border-top: 1px solid var(--line); padding-top: 18px; }
.form-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.row-form, .filters, .decide-bar { display: flex; gap: 10px 12px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0 0; }
.row-form label { flex: 1 1 220px; } .row-form label.short { flex: 0 1 150px; } .row-form .grow { flex: 1 1 320px; }
.copy-row { display: flex; gap: 8px; margin: 10px 0 6px; } .copy-row input { flex: 1; font-family: var(--mono); font-size: 12.5px; }
input.wide { width: min(100%, 640px); } .inline-label { margin: 14px 0 0; }

/* ---------------------------------------------------------------- readiness checks */
.checks { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0 24px; }
.checks li { display: grid; grid-template-columns: 10px 120px 1fr; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); }
.checks .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.checks .ok .dot { background: var(--green); } .checks .bad .dot { background: var(--red); } .checks .warn .dot { background: var(--amber); }
.checks .k { font-weight: 550; } .checks .v { color: var(--text-2); font-size: 13px; } .checks .bad .v { color: var(--red); }
@media (max-width: 640px) { .checks li { grid-template-columns: 10px 1fr; } .checks .v { grid-column: 2; } }
details { margin-top: 10px; } summary { cursor: pointer; color: var(--accent); font-weight: 500; }

/* ---------------------------------------------------------------- progress */
.progress { height: 6px; background: var(--surface-2); border-radius: 999px; margin: 14px 0 6px; overflow: hidden; }
.progress .bar { height: 100%; width: var(--p, 0%); background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress .bar.indeterminate { width: 30%; animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
@media (prefers-reduced-motion: reduce) { .progress .bar.indeterminate { animation: none; width: 100%; opacity: .4; } * { transition: none !important; } }
.progress-text { color: var(--text-2); font-size: 12.5px; margin: 0 0 12px; min-height: 1.4em; }

/* ---------------------------------------------------------------- stepper and next step */
.stepper { margin: 0 0 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); }
.stepper ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.step { position: relative; display: flex; flex-direction: column; gap: 7px; padding-right: 8px; font-size: 12.5px; color: var(--text-3); }
.step::before { content: ""; position: absolute; left: 24px; right: 4px; top: 11px; height: 2px; border-radius: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font: 650 11px/1 var(--sans); background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line-2); }
.step-text { display: flex; flex-direction: column; gap: 1px; line-height: 1.3; }
.step-text a { color: inherit; }
.step-note { font-size: 11.5px; font-weight: 500; }
.step-done { color: var(--text-2); } .step-done::before { background: var(--green); }
.step-done .step-dot { background: var(--green); border-color: var(--green); color: #fff; }
.step-current { color: var(--text); font-weight: 600; }
.step-current .step-dot { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.step-current .step-note { color: var(--accent); }
.step-blocked { color: var(--red); font-weight: 600; }
.step-blocked .step-dot { background: var(--red); border-color: var(--red); color: #fff; box-shadow: 0 0 0 4px var(--red-soft); }
@media (max-width: 860px) {
  .stepper ol { grid-template-columns: 1fr; gap: 6px; }
  .step { flex-direction: row; align-items: center; gap: 10px; }
  .step::before { left: 11px; right: auto; top: 26px; bottom: -8px; width: 2px; height: auto; }
}
.next-step { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; padding: 16px 20px;
  border-radius: var(--radius); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: var(--accent-soft); }
.next-step .eyebrow { color: var(--accent); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; margin: 0 0 3px; }
.next-title { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.next-why { color: var(--text-2); margin: 2px 0 0; font-size: 13px; }
.next-blocked { border-color: color-mix(in srgb, var(--red) 30%, var(--line)); background: linear-gradient(120deg, var(--red-soft), var(--pink-soft)); }
.next-blocked .eyebrow { color: var(--red); }

/* ---------------------------------------------------------------- tabs, chips, segmented control */
.tabs { display: flex; gap: 2px; align-items: center; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; }
.tabs a { padding: 9px 12px; color: var(--text-2); font-weight: 550; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.chips a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; text-decoration: none; }
.chips a:hover { border-color: var(--line-2); color: var(--text); }
.chips a[aria-current="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chips a .muted { color: inherit; opacity: .6; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 10px; margin: 0 0 12px; flex-wrap: wrap; }
.seg a { padding: 6px 12px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 550; text-decoration: none; }
.seg a[aria-current="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.pager { display: flex; gap: 14px; justify-content: center; align-items: center; margin: 16px 0; color: var(--text-2); }

/* ---------------------------------------------------------------- category colours (Discovery, removed values) */
.cat-rare_token, .fam-people { --c: var(--sky); --cs: var(--sky-soft); }
.cat-id_shape, .fam-ids { --c: var(--blue); --cs: var(--blue-soft); }
.cat-next_to_replacement, .fam-companies { --c: var(--accent); --cs: var(--accent-soft); }
.cat-raw_survivor, .fam-contact { --c: var(--pink); --cs: var(--pink-soft); }
.cat-unclassified_field, .fam-places { --c: var(--teal); --cs: var(--teal-soft); }
.cat-quasi_identifier, .fam-money { --c: var(--amber); --cs: var(--amber-soft); }
.cat-image_text, .fam-dates { --c: var(--green); --cs: var(--green-soft); }
.cat-near_miss_detection, .fam-secrets { --c: var(--red); --cs: var(--red-soft); }
.cat-logo_like, .fam-hidden { --c: var(--slate); --cs: var(--slate-soft); }
.cat-reviewer_model, .fam-text, .fam-other { --c: var(--text-3); --cs: var(--surface-2); }
.tag.cat { background: var(--cs); color: var(--c); }
.chips a.cat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

/* ---------------------------------------------------------------- removed values */
ul.fams { list-style: none; margin: 0; padding: 0; }
ul.fams > li { border-top: 1px solid var(--line); }
ul.fams > li:first-child { border-top: 0; }
ul.fams details { margin: 0; }
ul.fams summary { display: grid; grid-template-columns: 12px minmax(130px, 1.1fr) 2fr 48px; gap: 12px; align-items: center; padding: 9px 0; color: var(--text); list-style: none; font-weight: 500; }
ul.fams summary::-webkit-details-marker { display: none; }
ul.fams summary::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.fam-bar { height: 8px; background: var(--surface-2); border-radius: 999px; position: relative; overflow: hidden; }
.fam-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--c); border-radius: 999px; }
ul.fams table { margin: 0 0 10px 24px; width: calc(100% - 24px); }

/* ---------------------------------------------------------------- Discovery */
.triage-head { padding: 18px 22px; }
.triage-sum { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.triage-sum > div:first-child { flex: 1 1 380px; }
.triage-n { margin: 0; font-size: 15px; } .triage-n strong { font-size: 22px; letter-spacing: -.02em; }
.triage-sum .progress .bar { background: linear-gradient(90deg, var(--green), var(--teal)); }
.triage-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 4px 10px; }
.cand-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.cand { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.cand::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c, var(--line)); }
.cand:hover { border-color: var(--line-2); }
.cand-decided { opacity: .6; }
.cand:has(input[name=cand]:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cand-pick input { margin-top: 3px; }
.cand-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-bottom: 10px; }
.cand-value { font-family: var(--mono); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; margin-right: 4px; }
.cand-rank { margin-left: auto; white-space: nowrap; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.cand-preview { display: flex; gap: 14px; align-items: flex-start; }
.cand-media { flex: none; display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.cand-media img, .cand-media video { display: block; width: 220px; max-height: 160px; object-fit: contain; }
.cand-body { min-width: 0; flex: 1; }
.ctx { font: 12.5px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 9px 11px; margin: 0 0 6px; max-height: 8.5em; overflow: auto; color: var(--text-2); }
mark { background: color-mix(in srgb, var(--amber) 28%, transparent); color: var(--text); padding: 1px 2px; border-radius: 3px; }
table.sample { margin: 0 0 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.sample th, table.sample td { font-size: 12px; padding: 5px 9px; }
table.sample .focus { background: var(--amber-soft); color: var(--text); font-weight: 600; }
.cand-where { margin: 0; overflow-wrap: anywhere; font-size: 12px; color: var(--text-3); }
.cand-act { display: flex; flex-direction: column; gap: 6px; min-width: 124px; }
.cand-act .btn { box-shadow: none; }
.cand-act .btn[value^="safe"]:hover { background: var(--green-soft); border-color: var(--green); color: var(--green); }
@media (max-width: 760px) {
  .cand { grid-template-columns: 20px minmax(0, 1fr); }
  .cand-act { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .cand-preview { flex-direction: column; } .cand-media img, .cand-media video { width: 100%; }
}
.bulk-bar { position: sticky; bottom: 16px; z-index: 5; display: flex; gap: 12px 14px; align-items: flex-end; flex-wrap: wrap;
  background: var(--text); color: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 12px 14px; margin: 14px 0; }
.bulk-bar label { flex: 0 1 200px; color: var(--bg); font-size: 12px; }
.bulk-bar select { background: color-mix(in srgb, var(--bg) 12%, var(--text)); color: var(--bg); border-color: transparent; }
.bulk-bar [data-selected-count] { align-self: center; font-weight: 650; min-width: 86px; }
.bulk-bar.is-empty { display: none; }
.empty-state { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 30px 20px; text-align: center; color: var(--text-2); }
.empty-state strong { color: var(--text); }

/* ---------------------------------------------------------------- Review */
.review-bar { position: sticky; top: 12px; z-index: 5; display: grid; grid-template-columns: auto 1fr auto; gap: 10px 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin: 0 0 12px; box-shadow: var(--shadow); }
.review-bar.is-done { border-color: color-mix(in srgb, var(--green) 40%, var(--line)); }
.review-count strong { font-size: 18px; }
.seg-bar { display: flex; height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.seg-bar span { width: var(--p, 0%); transition: width .3s; } .seg-ok { background: var(--green); } .seg-miss { background: var(--red); }
.review-actions { display: flex; gap: 12px; align-items: center; }
@media (max-width: 760px) { .review-bar { grid-template-columns: 1fr; position: static; } }
.review-row:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.review-row h2 { font-family: var(--mono); font-size: 13px; text-transform: capitalize; }
.review-row h2 .muted { font-weight: 400; text-transform: none; }
.review-row .file-text { max-height: 18em; }
.side-by-side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } @media (max-width: 800px) { .side-by-side { grid-template-columns: 1fr; } }
.side-by-side h3 { margin: 0 0 6px; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.verdict { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: flex-end; margin-top: 12px; }
.verdict label { flex: 1 1 300px; font-weight: 400; color: var(--text-2); font-size: 12.5px; }
.verdict [data-verdict-ok] { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, var(--line-2)); }
.verdict [data-verdict-ok]:hover { background: var(--green-soft); }
kbd { font: 600 11px/1 var(--mono); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; background: var(--surface); color: var(--text-2); }
.kbd-hint { margin: 0 0 12px; } @media (hover: none) { .kbd-hint { display: none; } }

/* replacement marks: a symbol plus a colour, never colour alone */
del.chg { text-decoration: line-through; text-decoration-color: var(--red); background: var(--red-soft); border-radius: 3px; }
ins.chg { text-decoration: none; background: var(--accent-soft); border-radius: 3px; }
mark.t { background: transparent; color: inherit; padding: 0 1px; border-bottom: 2px solid var(--text-3); }
mark.t .t-sym, ins.chg .t-sym { display: inline-block; font: 700 9.5px/1 var(--mono); padding: 1px 3px; margin-right: 2px; vertical-align: 1px; border-radius: 3px; background: var(--text); color: var(--bg); }
.chg-pseudonym, .t-pseudonym { --k: var(--sky); } .chg-code, .t-code { --k: var(--blue); } .chg-removed, .t-removed { --k: var(--red); }
.chg-shifted, .t-shifted { --k: var(--teal); } .chg-scaled, .t-scaled { --k: var(--amber); } .chg-generalized, .t-generalized { --k: var(--pink); }
.chg-kept, .t-kept { --k: var(--text-3); }
ins.chg .t-sym, mark.t .t-sym { background: var(--k, var(--text)); color: #fff; }
mark.t { border-bottom-color: var(--k, var(--text-3)); }
.kept-span { border-bottom: 1px dashed var(--text-3); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 12px; font-size: 12.5px; color: var(--text-2); }

/* ---------------------------------------------------------------- files and text views */
.file-text { white-space: pre-wrap; word-break: break-word; font: 12.5px/1.6 var(--mono); max-height: 70vh; overflow: auto; background: var(--surface-2);
  padding: 12px; border-radius: var(--radius-sm); border: 0; margin: 0; }
.file-text.small { max-height: 16em; }
.rec-text { max-height: 9.5em; overflow: auto; white-space: pre-wrap; font-size: 13px; }
table.records td.mono { white-space: nowrap; }
.pdf-page, .media { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
pre.log { font: 12px/1.5 var(--mono); background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; overflow: auto; white-space: pre-wrap; max-height: 320px; }
ul.plain { list-style: none; padding: 0; margin: 8px 0 0; } ul.plain li { padding: 4px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.tree { font: 12px/1.5 var(--mono); max-height: 28em; overflow: auto; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.checklist { list-style: none; padding: 0; margin: 0; } .checklist li { padding: 5px 0; }
.checklist li.ok .mark-ok { color: var(--green); } .checklist li.bad .mark-ok { color: var(--red); font-weight: 700; }
.delivery { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
details.rec summary { font-family: var(--mono); font-size: 12.5px; padding: 4px 0; }
.prewrap { white-space: pre-wrap; } h3.flush { margin: 0; }
.row-notes { margin: 12px 0 0; padding-left: 12px; border-left: 2px solid var(--line-2); color: var(--text-2); }

/* ---------------------------------------------------------------- batch page */
.release { display: flex; gap: 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.release > div:first-child { max-width: 680px; }
.release .eyebrow { color: var(--green); font-weight: 650; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; }
.release-cta { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 20px; margin: 0; }
.meta dt { color: var(--text-3); font-size: 12px; margin-bottom: 2px; } .meta dd { margin: 0; font-weight: 500; }
.danger-zone { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------------------------------------------------------------- overview: needs you */
.attention .panel-head { margin-bottom: 14px; }
.attn-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.attn-col { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; border-top: 3px solid var(--c, var(--accent)); }
.attn-fix { --c: var(--red); } .attn-discovery { --c: var(--amber); } .attn-review { --c: var(--blue); } .attn-signoff { --c: var(--sky); } .attn-release { --c: var(--green); }
.attn-title { margin: 0 0 8px; font-weight: 650; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.attn-n { font: 700 11.5px/1.7 var(--sans); padding: 0 8px; border-radius: 999px; background: var(--c); color: #fff; }
.attn-col ul { list-style: none; margin: 0; padding: 0; }
.attn-col li { padding: 5px 0; font-size: 13px; border-top: 1px solid var(--line); }
.attn-col li:first-child { border-top: 0; }
.attn-col li a { display: flex; flex-direction: column; color: var(--text); text-decoration: none; }
.attn-col li a .mono { font-weight: 600; } .attn-col li a:hover .mono { color: var(--accent); }
.health-details { margin-top: 6px; }

/* ---------------------------------------------------------------- sign-in, supplier, public pages */
body.bare { display: flex; flex-direction: column; align-items: center; background:
  radial-gradient(1200px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); }
body.bare main.wrap { max-width: 960px; }
body.bare .foot { text-align: center; }
.auth { max-width: 400px; width: 100%; margin: 56px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 30px; box-shadow: var(--shadow-lg); }
.auth h1 { margin-bottom: 16px; font-size: 24px; }
.supplier { max-width: 760px; width: 100%; margin: 40px auto 24px; }
.supplier .lede { margin-bottom: 20px; }
.wide-auth { max-width: 900px; margin: 36px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-lg); }
.facts { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.facts li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.facts .k { color: var(--text-3); font-size: 12px; }
.supplier .uploader { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.faq { border-top: 1px solid var(--line); padding-top: 12px; } .faq p { color: var(--text-2); margin: 8px 0 0; }
.qr { display: block; width: 200px; max-width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.secret { display: inline-block; margin-top: 6px; letter-spacing: .08em; word-break: break-all; }

/* ---------------------------------------------------------------- uploader */
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--radius); background: var(--surface-2); padding: 34px 20px; text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-title { font-size: 17px; font-weight: 650; margin: 0 0 4px; }
.drop-sub { color: var(--text-2); font-size: 13px; max-width: 560px; margin: 0 auto 16px; }
.drop-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.queue { margin-top: 16px; } .queue-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; } .queue-head p { margin: 0; }
.files { list-style: none; margin: 10px 0 0; padding: 0; max-height: 260px; overflow: auto; border-top: 1px solid var(--line); }
.files li { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.files .p { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; } .files .s { color: var(--text-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.files li.done .s { color: var(--green); } .files li.more { color: var(--text-2); grid-template-columns: 1fr; }
.queue-actions { margin-top: 14px; display: flex; gap: 8px; }
.done { border: 1px solid color-mix(in srgb, var(--green) 40%, var(--line)); background: var(--green-soft); border-radius: var(--radius); padding: 18px 20px; margin-top: 4px; }
.done .eyebrow { color: var(--green); font-weight: 650; } .done-title { font-size: 18px; font-weight: 650; margin: 0 0 4px; }

/* ---------------------------------------------------------------- quotes */
.shots { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.shots a { display: block; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); color: var(--text-2); }
.shots a:hover { border-color: var(--accent); }
.shots img { display: block; width: 100%; height: 150px; object-fit: cover; object-position: top; }
.shots span { display: block; padding: 6px 8px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* theme switch */
.theme-toggle { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); width: 100%;
  background: none; border: 0; color: var(--text-2); font: 500 13.5px/1.3 var(--sans); cursor: pointer; text-align: left; }
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle .when-dark { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .when-dark { display: inline; }
  :root:not([data-theme="light"]) .theme-toggle .when-light { display: none; }
}
.top .theme-toggle { width: auto; margin-left: 12px; }
@media (max-width: 900px) { .side .theme-toggle span.label { display: none; } .side .theme-toggle { width: auto; } }
