/* UNMASK — interface styles.
   Emerald on slate. Principles: calm tinted surfaces, hairline dividers, colour
   where it carries meaning (status, confidence, focus, the primary action), Sora
   for headings and the wordmark, Inter for UI, JetBrains Mono for identifiers. */

/* Fonts are self-hosted (SIL Open Font License, see static/fonts/LICENSE-*). */
@font-face { font-family: "Inter"; src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Sora"; src: url("../fonts/sora-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Sora"; src: url("../fonts/sora-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Sora"; src: url("../fonts/sora-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }

/* Themes: light by default for an unset preference, dark on request or when the
   system asks for it (data-theme="system"). Every colour below is a token; no
   component hard-codes one. All text tokens meet WCAG AA on bg and surface. */
:root, :root[data-theme="light"] {
  --bg: #f6f9f8;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --bg-sunk: #eaf1ef;
  --hover: #e3ece9;
  --border: #dde7e4;
  --border-strong: #c6d4d0;
  --text: #16241f;
  --text-strong: #0b1417;
  --muted: #4b6360;
  --faint: #56706b;
  --accent: #047857;
  --accent-soft: #d1fae5;
  --info: #0369a1;
  --ok: #15803d;
  --warn: #a16207;
  --bad: #b91c1c;
  --off: #8a9b98;
  --primary-bg: #047857;
  --primary-hover: #065f46;
  --primary-text: #ffffff;
  --on-ok: #ffffff;
  --brand-gradient: linear-gradient(135deg, #10b981 0%, #0ea5e9 100%);
  --shadow-sm: 0 1px 2px rgba(11, 20, 23, .06);
  --shadow: 0 10px 30px rgba(11, 32, 28, .10);
  --shadow-lg: 0 24px 60px rgba(11, 32, 28, .16);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Sora", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1417; --bg-elev: #0f1b1f; --surface: #111c20; --surface-2: #16242a; --bg-sunk: #081012;
  --hover: #1c2c33; --border: #1e2e34; --border-strong: #2b3f46;
  --text: #d6e2df; --text-strong: #f1f7f5; --muted: #93a8a4; --faint: #86a09b;
  --accent: #34d399; --accent-soft: #0f3a2f; --info: #38bdf8; --ok: #4ade80; --warn: #e5b454; --bad: #f07a68; --off: #5f7470;
  --primary-bg: #10b981; --primary-hover: #34d399; --primary-text: #04241b; --on-ok: #04241b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 12px 32px rgba(0, 0, 0, .45); --shadow-lg: 0 30px 80px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0b1417; --bg-elev: #0f1b1f; --surface: #111c20; --surface-2: #16242a; --bg-sunk: #081012;
    --hover: #1c2c33; --border: #1e2e34; --border-strong: #2b3f46;
    --text: #d6e2df; --text-strong: #f1f7f5; --muted: #93a8a4; --faint: #86a09b;
    --accent: #34d399; --accent-soft: #0f3a2f; --info: #38bdf8; --ok: #4ade80; --warn: #e5b454; --bad: #f07a68; --off: #5f7470;
    --primary-bg: #10b981; --primary-hover: #34d399; --primary-text: #04241b; --on-ok: #04241b;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 12px 32px rgba(0, 0, 0, .45); --shadow-lg: 0 30px 80px 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.5 var(--font); font-feature-settings: "tnum" 1, "cv11" 1;
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { color: var(--text-strong); line-height: 1.25; margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1, h2 { font-family: var(--display); }
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 15px; }
h3 { font-size: 13px; }
p { margin: 0 0 .75rem; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--primary-bg); color: var(--primary-text); padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* ---- Layout -------------------------------------------------------------- */
.container { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px 24px 48px; }
.container.wide { max-width: 1440px; }
.container.narrow { max-width: 400px; }
.container.reading { max-width: 760px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; }
.stack > * + * { margin-top: 16px; }

.topbar {
  display: flex; align-items: center; gap: 28px; height: 52px; padding: 0 24px;
  background: var(--bg-elev); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text-strong); font-weight: 600; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand svg { color: var(--text-strong); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: var(--radius-sm); }
.nav a:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text-strong); background: var(--surface-2); }
.topbar-end { display: flex; align-items: center; gap: 12px; }
.topbar-end form { margin: 0; }
.footer { padding: 16px 24px; color: var(--faint); font-size: 12px; border-top: 1px solid var(--border); }

/* ---- Buttons --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font: 500 13px/1 var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: color-mix(in srgb, var(--bad) 60%, transparent); color: var(--bad); }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 14%, transparent); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-icon { width: 28px; padding: 0; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.icon { width: 16px; height: 16px; flex: none; }

/* ---- Small data marks ------------------------------------------------------------- */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 12px; }
.tag-x { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 14px; line-height: 1; }
.label { font-size: 12px; color: var(--muted); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 11.5px; text-align: center; line-height: 18px; }
.count-strong { background: var(--primary-bg); color: var(--primary-text); font-weight: 600; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--off); flex: none; }
.dot-ok { background: var(--ok); } .dot-warn, .dot-degraded { background: var(--warn); } .dot-bad, .dot-down { background: var(--bad); }
.dot-live { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.text-ok { color: var(--ok); } .text-warn { color: var(--warn); } .text-bad { color: var(--bad); }
.ident { font-family: var(--mono); font-size: 12.5px; color: var(--text-strong); overflow-wrap: anywhere; }
.ident-cut { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.flag { font-size: 11.5px; color: var(--muted); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 0 5px; line-height: 17px; white-space: nowrap; }
.flag-review { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }

/* Confidence: bar + number; colour reinforces the number, never replaces it. */
.conf { display: inline-flex; align-items: center; gap: 8px; }
.conf-track { width: 56px; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.conf-fill { display: block; height: 100%; background: var(--off); }
.conf-high .conf-fill { background: var(--ok); }
.conf-medium .conf-fill { background: var(--warn); }
.conf-low .conf-fill { background: var(--bad); }
.conf-num { font-family: var(--mono); font-size: 12px; color: var(--text); }

/* ---- Forms ---------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > .label, .field > span:first-child, .field > label:first-child { font-size: 12.5px; color: var(--muted); }
.field.grow { flex: 1; }
.hint { font-size: 12px; color: var(--faint); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea {
  width: 100%; background: var(--bg-sunk); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 7px 10px; font: inherit; min-height: 32px;
}
select {
  appearance: none; padding-right: 28px; font-size: 13.5px; line-height: 1.2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%239aa1ab' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="search"], input[type="text"], input[type="email"], input[type="password"] { font-size: 13.5px; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.check { display: inline-flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check input { margin: 3px 0 0; accent-color: var(--primary-bg); }
.req { color: var(--bad); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.form-actions p { margin: 0; }
.alert { border-radius: var(--radius); padding: 10px 12px; border: 1px solid var(--border-strong); background: var(--surface); margin-bottom: 16px; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert-error { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.alert-warn { border-color: color-mix(in srgb, var(--warn) 50%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.alert-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.alert-info { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }

.tag-input { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 32px; padding: 3px 6px; background: var(--bg-sunk); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: text; }
.tag-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.tag-input .tag-entry { flex: 1; min-width: 7rem; border: 0; background: transparent; padding: 2px; min-height: 0; box-shadow: none; }

/* ---- Tables ------------------------------------------------------------------------ */
.table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover > td { background: color-mix(in srgb, var(--surface) 70%, transparent); }
.table .num { text-align: right; }
.table .shrink { width: 1%; white-space: nowrap; }
.row-link { cursor: pointer; }
.row-link a { color: var(--text-strong); font-weight: 500; }
.table-foot { margin-top: 10px; color: var(--faint); font-size: 12px; }

.empty { padding: 40px 24px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.empty h2 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 440px; margin: 0 auto 16px; }

/* ---- Menus (native <details>) ------------------------------------------------------ */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; padding: 4px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); text-align: left; white-space: normal;
}
.menu-list a, .menu-list button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; border-radius: var(--radius-sm); cursor: pointer; text-align: left; }
.menu-list a:hover, .menu-list button:hover, .menu-list a:focus, .menu-list button:focus { background: var(--hover); text-decoration: none; outline: none; }
.menu-heading { padding: 8px 8px 2px; font-size: 11.5px; color: var(--faint); }
.menu-sep { height: 1px; background: var(--border-strong); margin: 4px 0; }
.menu-note { padding: 4px 8px 6px; font-size: 11.5px; color: var(--faint); }

/* ---- Toasts ---------------------------------------------------------------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: 380px; }
.toast { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); font-size: 13px; }
.toast-error { border-color: color-mix(in srgb, var(--bad) 55%, transparent); }
.toast-close { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; }

/* ---- Public pages ---------------------------------------------------------------- */
.auth { margin-top: 12vh; }
.auth h1 { margin-bottom: 20px; }

/* ---- Dashboard ------------------------------------------------------------------- */
.tools-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tools-notice p { margin: 0; }
.case-row-sub { color: var(--faint); font-size: 12px; margin-top: 2px; }

/* ---- Case header, status and tabs ----------------------------------------------- */
.case-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; }
.case-head-main { min-width: 0; flex: 1; }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumb a { color: var(--muted); }
.targets { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: 13px; }
.targets .t-type { color: var(--faint); margin-right: 6px; }
.targets .tag { margin-left: 4px; }
.case-head-side { display: flex; align-items: center; gap: 10px; }
.case-state { font-size: 12.5px; color: var(--muted); text-align: right; }

.runline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.runline > .status { font-weight: 500; color: var(--text-strong); }
.runline progress { width: 120px; height: 4px; appearance: none; border: 0; background: var(--surface-2); border-radius: 2px; }
.runline progress::-webkit-progress-bar { background: var(--surface-2); border-radius: 2px; }
.runline progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
.runline progress::-moz-progress-bar { background: var(--accent); }
.runline details { flex-basis: 100%; }
.runline summary { cursor: pointer; color: var(--muted); font-size: 12.5px; width: fit-content; }
.run-issues { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.run-issues li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; font-size: 12.5px; }
.run-issues .tool { font-family: var(--mono); color: var(--bad); }
.run-issues .why { color: var(--muted); overflow-wrap: anywhere; }
.run-notes { margin: 8px 0 0; color: var(--faint); font-size: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; overflow-x: auto; }
.tabs a { color: var(--muted); padding: 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--text-strong); }
.tabs .count { margin-left: 6px; }

/* ---- Entities -------------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar input[type="search"] { width: 240px; }
.toolbar select { width: auto; }
.toolbar .spacer { flex: 1; }
.review { margin-bottom: 14px; border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--warn) 5%, var(--surface)); }
.review > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: 13px; }
.review > summary::-webkit-details-marker { display: none; }
.review > summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s; }
.review[open] > summary .chev { transform: rotate(180deg); }
.review-list { list-style: none; margin: 0; padding: 0 12px 6px; }
.review-item { display: flex; align-items: center; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.review-item .pair { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; min-width: 0; }
.review-item .vs { color: var(--faint); font-size: 12px; }
.review-item .pair-wrap { flex: 1; min-width: 240px; }
.review-item .why { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.review-item .acts { display: flex; gap: 6px; }
.review-foot { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0 4px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

.entities .col-confirm { width: 36px; padding-right: 0; }
.entities .col-menu { width: 44px; text-align: right; }
.entity-row { cursor: pointer; }
.entities .col-select { width: 32px; padding-right: 0; }
.entities .col-select input { width: 15px; height: 15px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.entity-row.is-active > td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.entity.is-focused .entity-row > td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.value-cell { max-width: 460px; }
.value-cell .ident { display: block; }
.value-cell .flags { display: flex; gap: 6px; margin-top: 3px; }
.value-cell .flags:empty { display: none; }
.confirm-toggle { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; color: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.confirm-toggle:hover { border-color: var(--ok); color: color-mix(in srgb, var(--ok) 60%, transparent); }
.confirm-toggle[aria-pressed="true"] { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.confirm-toggle svg { width: 13px; height: 13px; }
.rel { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.rel-a, .rel-b { color: var(--ok); } .rel-d, .rel-e { color: var(--warn); }
.sources { color: var(--muted); font-size: 12.5px; }
.sources .failed { color: var(--bad); }
.merge-row > td { background: var(--surface); }
.entity-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 40px; padding: 16px 18px 20px; }
.entity-detail .span-2 { grid-column: 1 / -1; }
.entity-detail h3 { font-size: 12.5px; color: var(--muted); font-weight: 500; margin: 14px 0 6px; }
.entity-detail h3:first-child { margin-top: 0; }
.why-list { margin: 0; padding-left: 16px; color: var(--text); font-size: 13px; }
.why-list li + li { margin-top: 2px; }
.kv { margin: 0; display: grid; gap: 4px; }
.kv > div { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 8px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.plain-list .sub { color: var(--muted); font-size: 12.5px; }
.rel-type { color: var(--muted); font-size: 12px; margin-right: 6px; }
.rel-type.suggested { color: var(--warn); }
.rel-type.rejected { text-decoration: line-through; }
.json { background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; max-height: 300px; overflow: auto; margin: 0; font-size: 12px; }
.merge-picker { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 4px 0; }
.merge-picker select { max-width: 480px; }

/* ---- Graph ---------------------------------------------------------------------- */
.graph-toolbar { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin-bottom: 10px; font-size: 13px; }
.graph-stats { margin-left: auto; color: var(--faint); font-size: 12px; }
.graph-wrap { position: relative; height: 70vh; min-height: 440px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunk); overflow: hidden; }
.graph-canvas { position: absolute; inset: 0; }
.graph-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.graph-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; }
.graph-legend p { margin: 0; color: var(--faint); }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 10px; height: 10px; display: inline-block; flex: none; }
.shape-ellipse { border-radius: 50%; }
.shape-round-rectangle { border-radius: 3px; }
.shape-diamond { transform: rotate(45deg) scale(.78); }
.shape-hexagon, .shape-round-hexagon { clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.shape-octagon { clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.shape-pentagon { clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.shape-tag { clip-path: polygon(0 0, 70% 0, 100% 50%, 70% 100%, 0 100%); }
.shape-vee { clip-path: polygon(0 0, 50% 40%, 100% 0, 50% 100%); }
.shape-barrel { border-radius: 30% / 50%; }
.shape-round-triangle { clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.shape-star { clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.graph-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 92%); background: var(--bg-elev); border-left: 1px solid var(--border-strong); z-index: 3; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.graph-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.graph-panel-body { overflow: auto; }
.graph-panel-body .entity-detail { grid-template-columns: 1fr; }

/* ---- Timeline ------------------------------------------------------------------- */
.compare { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 13px; }
.compare select { width: auto; }
.diff { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.diff h2 { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding-bottom: 8px; border-bottom: 2px solid var(--border-strong); margin-bottom: 4px; }
.diff .new h2 { border-bottom-color: var(--ok); }
.diff .changed h2 { border-bottom-color: var(--accent); }
.diff .gone h2 { border-bottom-color: var(--bad); }
.diff ul { list-style: none; margin: 0; padding: 0; }
.diff li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.diff li a { color: var(--text-strong); display: block; }
.diff li .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.diff li.explained { opacity: .7; }
.diff .none { color: var(--faint); font-size: 12.5px; padding: 8px 0; }

/* ---- Pivots --------------------------------------------------------------------- */
.pivots .skipped td { color: var(--muted); }
.pivots .why { color: var(--warn); font-size: 12.5px; }

/* ---- Settings ------------------------------------------------------------------- */
.settings-section { display: grid; grid-template-columns: 240px 1fr; gap: 32px; padding: 24px 0; border-top: 1px solid var(--border); }
.settings-section:first-of-type { border-top: 0; padding-top: 4px; }
.settings-section > header p { color: var(--muted); font-size: 12.5px; margin: 6px 0 0; }
.settings-section .body { min-width: 0; max-width: 760px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.inline-form .field { flex-direction: row; align-items: center; gap: 8px; }
.inline-form select { width: auto; }
.range { width: 100%; max-width: 420px; accent-color: var(--primary-bg); }
.people { list-style: none; margin: 0 0 12px; padding: 0; }
.people li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.people form { margin: 0; }
.danger header h2 { color: var(--bad); }

@media (max-width: 900px) {
  .container { padding: 16px 14px 40px; }
  .topbar { padding: 0 14px; gap: 14px; }
  .topbar-end .who { display: none; }
  .hide-sm { display: none; }
  .entity-detail { grid-template-columns: 1fr; }
  .diff { grid-template-columns: 1fr; }
  .settings-section { grid-template-columns: 1fr; gap: 12px; }
  .case-state { text-align: left; }
  .toolbar input[type="search"] { width: 100%; }
  .run-issues li { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) { .dot-live { animation: none; } }
.review .review-foot { margin: 0 12px; }
.detail-loading { padding: 12px 18px; margin: 0; }
.form-actions.split { justify-content: space-between; flex-wrap: wrap; }
.mt-8 { margin-top: 8px; }

/* ---- New case form ------------------------------------------------------------ */
.case-form { gap: 0; }
.form-section { display: flex; flex-direction: column; gap: 14px; padding: 22px 0; border-top: 1px solid var(--border); }
.form-section:first-of-type { border-top: 0; padding-top: 0; }
.form-section > .hint { margin: -8px 0 0; }
.lawful { padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; color: var(--text); }
.target-rows { display: flex; flex-direction: column; gap: 10px; }
.target-row { display: grid; grid-template-columns: 130px 1fr 1fr 28px; gap: 8px; align-items: end; }
.target-row .remove-target { margin-bottom: 2px; }
.tools-pick > summary { list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px; }
.tools-pick > summary::-webkit-details-marker { display: none; }


.tool-picks { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.case-form .form-actions { padding-top: 22px; border-top: 1px solid var(--border); }
@media (max-width: 900px) {
  .target-row { grid-template-columns: 1fr 28px; }
  .target-row .t-type-field { grid-column: 1 / -1; }
  .target-row .field.grow { grid-column: 1; }
  .tool-picks { grid-template-columns: 1fr; }
}
.btn[data-full] { width: 100%; height: 36px; }

.show-xs { display: none; }
.flag-type { color: var(--faint); font-size: 12px; margin-right: 2px; }
@media (max-width: 600px) {
  .hide-xs { display: none; }
  .show-xs { display: inline; }
  .topbar { gap: 8px; }
  .topbar-end { gap: 6px; }
  .brand span { display: none; }
  .nav a { padding: 6px 8px; }
  .tabs a { padding: 10px 9px; }
  .entities .ident-cut { max-width: 52vw; }
  .tools thead { display: none; }
  .tools, .tools tbody { display: block; width: 100%; }
  .tools tbody tr { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
  .tools tbody td { border: 0; padding: 0; }
  .tools tbody td.shrink { width: auto; }
  .tools tbody td:first-child { flex-basis: 100%; }
  .review-foot { flex-direction: column; gap: 4px; }
  .case-head-side { width: 100%; }
  .entities .conf-track { display: none; }
  .table th, .table td { padding-left: 6px; padding-right: 6px; }
  .show-xs.tool-detail-xs { display: block; margin-top: 2px; }
}
.target-row input[type="text"]:not(.tag-entry), .target-row select, .target-row .tag-input { height: 34px; min-height: 34px; line-height: 1.2; }
.target-row .tag-input { flex-wrap: nowrap; overflow-x: auto; }
.form-section > .link-btn { align-self: flex-start; }

/* ---- Match strength ------------------------------------------------------------- */
.flag-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.strength { display: inline-flex; align-items: center; gap: 8px; }
.strength-label { font-size: 12.5px; font-weight: 500; }
.strength .conf-track { width: 44px; }
.s-likely, .s-confirmed { color: var(--ok); }
.s-possible { color: var(--warn); }
.s-unlikely, .s-dismissed { color: var(--faint); }
.s-target { color: var(--text-strong); }
.s-likely .conf-fill, .s-confirmed .conf-fill { background: var(--ok); }
.s-possible .conf-fill { background: var(--warn); }
.s-unlikely .conf-fill { background: var(--bad); }

/* ---- Case summary --------------------------------------------------------------- */
.summary { margin-bottom: 16px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.summary h2 { font-size: 17px; margin: 0 0 2px; color: var(--text-strong); }
.summary-head p { margin: 0; font-size: 13px; }
.summary-stats { display: flex; gap: 20px; margin: 0; }
.summary-stats div { text-align: right; }
.summary-stats dt { font-size: 11.5px; color: var(--faint); }
.summary-stats dd { margin: 0; font-size: 17px; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.summary-stats .link-btn { font-size: 17px; font-weight: 600; }
.profile-cards { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.profile-card { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); min-width: 0; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-strong); font-weight: 600; font-size: 14px; }
.profile-main { min-width: 0; flex: 1; }
.profile-main p { margin: 0; }
.profile-site { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-title { font-size: 13px; color: var(--text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-about { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.profile-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: 6px !important; font-size: 12.5px; }
.profile-foot a { white-space: nowrap; }
.profile-foot .icon { width: 12px; height: 12px; margin-left: 3px; vertical-align: -1px; }
.summary-also { margin: 12px 0 0; font-size: 13px; }

/* ---- Scan progress by tool ---------------------------------------------------------- */
.tool-states { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.tool-state { font-size: 12px; padding: 0 7px; line-height: 20px; border-radius: 10px; border: 1px solid var(--border-strong); color: var(--muted); }
.tool-state.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.tool-state.failed { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tool-state.running::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; vertical-align: 1px; }
@media (prefers-reduced-motion: reduce) { .tool-state.running::before { animation: none; } }
.toast-undo { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; padding: 0; margin-left: auto; }
@media (max-width: 600px) {
  .summary-stats { width: 100%; justify-content: flex-start; }
  .summary-stats div { text-align: left; }
}

/* ---- Web tab ------------------------------------------------------------------------ */
.web-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.web-head p { margin: 0; max-width: 760px; }
.web-actions { display: flex; gap: 8px; flex: none; }
.add-finding { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.add-finding > summary { cursor: pointer; padding: 10px 12px; font-size: 13px; font-weight: 500; }
.add-finding[open] > summary { border-bottom: 1px solid var(--border); }
.add-finding-form { display: grid; grid-template-columns: 160px 1.4fr 1fr auto; gap: 8px; align-items: end; padding: 12px 12px 4px; }
.add-finding .hint { margin: 0; padding: 0 12px 12px; }
.web-filter { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.chip-btn { background: none; border: 1px solid var(--border-strong); color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip-btn[aria-pressed="true"] { color: var(--text-strong); background: var(--surface-2); }
.chip-btn .count { margin-left: 4px; }
.web-list { list-style: none; margin: 0; padding: 0; }
.web-item { display: flex; gap: 16px; justify-content: space-between; padding: 14px 0; border-top: 1px solid var(--border); }
.web-main { min-width: 0; flex: 1; }
.web-main p { margin: 2px 0 0; }
.web-title { font-weight: 500; font-size: 14px; }
.web-url { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.web-snippet { font-size: 13px; color: var(--muted); max-width: 820px; }
.web-meta { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; margin-top: 6px !important; }
.web-acts { display: flex; gap: 6px; align-items: flex-start; flex: none; }
.btn.is-on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
@media (max-width: 900px) {
  .add-finding-form { grid-template-columns: 1fr; }
  .web-head { flex-direction: column; }
}
@media (max-width: 600px) {
  .web-item { flex-direction: column; gap: 8px; }
}

/* ---- Accuracy ------------------------------------------------------------------------ */
.accuracy { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--border); }
.accuracy h2 { font-size: 17px; margin: 0 0 4px; }
.accuracy h3 { font-size: 14px; margin: 20px 0 2px; color: var(--text-strong); }
.accuracy .hint { margin: 0 0 8px; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.table.compact th, .table.compact td { padding-top: 7px; padding-bottom: 7px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .acc-grid { grid-template-columns: 1fr; gap: 0; } }

/* ---- Review queue -------------------------------------------------------------------- */
.review-page { max-width: 1000px; }
.review-progress { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.review-card { display: grid; grid-template-columns: 280px 1fr; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.review-card section { padding: 18px 20px; min-width: 0; }
.review-subject { border-right: 1px solid var(--border); background: var(--bg); border-radius: var(--radius) 0 0 var(--radius); }
.review-card h2 { font-size: 13px; color: var(--faint); font-weight: 500; margin: 0 0 8px; }
.review-card h3 { font-size: 12.5px; color: var(--muted); margin: 16px 0 4px; }
.review-subject li { margin-bottom: 6px; }
.review-subject .tag { margin-left: 4px; }
.review-value { font-size: 17px !important; color: var(--text-strong) !important; font-weight: 600 !important; overflow-wrap: anywhere; }
.review-value .icon { width: 13px; height: 13px; margin-left: 5px; }
.review-name { font-size: 15px; color: var(--text-strong); margin: 2px 0 4px; }
.review-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.review-no { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.review-actions kbd, .review-keys kbd { font-family: var(--mono); font-size: 11px; padding: 0 4px; border: 1px solid var(--border-strong); border-radius: 3px; margin-left: 6px; color: var(--muted); }
.btn-primary kbd { color: inherit; border-color: currentColor; opacity: .6; }
.review-keys { margin-top: 16px; }
.review-done { margin-top: 8px; }
.summary-cta { margin-top: 10px !important; }
@media (max-width: 760px) {
  .review-card { grid-template-columns: 1fr; }
  .review-subject { border-right: 0; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
  .review-keys, .review-actions kbd { display: none; }
}

/* ---- New case: depth choice ---------------------------------------------------------------- */
.subhead { font-size: 12.5px; color: var(--muted); margin: 4px 0 -6px; }
.depth-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.depth-option { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface); }
.depth-option:has(input:checked) { border-color: var(--text-strong); }
.depth-option input { margin-top: 3px; }
.tools-pick > summary .pick-link { color: var(--accent); font-size: 13px; }
/* Column labels once: later rows keep them for screen readers only. */
.target-row + .target-row .field > span:first-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 900px) { .target-row + .target-row { padding-top: 10px; border-top: 1px solid var(--border); } }
@media (max-width: 700px) { .depth-choice { grid-template-columns: 1fr; } }

/* ---- Failures -------------------------------------------------------------------------------- */
.failures { list-style: none; margin: 8px 0 0; padding: 0; }
.failure { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.failure-text { min-width: 0; flex: 1; }
.failure-text p { margin: 0; }
.failure-summary { color: var(--text-strong); }
.failure-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px !important; }
.failure-detail { margin-top: 4px; font-size: 12px; }
.failure-detail > summary { cursor: pointer; color: var(--faint); }
.failure-detail p { color: var(--faint); overflow-wrap: anywhere; margin-top: 4px !important; }
.failure-acts { display: flex; gap: 6px; flex: none; }
.failure-hint-inline { color: var(--text); }
@media (max-width: 600px) { .failure { flex-direction: column; gap: 8px; } }

/* ---- App shell ---------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 14px;
  padding: 16px 12px; border-right: 1px solid var(--border); background: var(--bg-elev); overflow-y: auto;
}
.sidebar .brand { padding: 2px 8px 6px; }
.palette-trigger {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 10px; font: inherit; font-size: 13px;
  color: var(--muted); background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); cursor: pointer;
}
.palette-trigger:hover { color: var(--text); border-color: var(--muted); }
.palette-trigger span { flex: 1; text-align: left; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius); color: var(--muted); font-weight: 500; }
.side-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.side-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text-strong); }
.side-nav .icon, .side-btn .icon, .palette-trigger .icon { width: 15px; height: 15px; flex: none; }
.side-nav .count { margin-left: auto; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: 0; border-radius: var(--radius); cursor: pointer; text-align: left; }
.side-btn:hover { background: var(--hover); color: var(--text); }
.side-btn span { flex: 1; }
.side-user { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.side-email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--muted); }
.side-user form { margin: 0; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.shell-main { min-width: 0; }
.mobilebar { display: none; }
kbd { font-family: var(--mono); font-size: 11px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; color: var(--muted); background: var(--surface); white-space: nowrap; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 10px; border-bottom: 1px solid var(--border); background: var(--bg-elev); position: sticky; top: 0; z-index: 30; }
  .sidebar { position: fixed; z-index: 40; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---- Dialogs: command palette, shortcuts --------------------------------------------------- */
dialog { color: var(--text); background: var(--bg-elev); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 0; }
dialog::backdrop { background: rgba(0, 0, 0, .4); }
.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; background: none; padding: 0; min-height: 0; font-size: 15px; box-shadow: none !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 50vh; overflow-y: auto; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); cursor: pointer; }
.palette-list li[aria-selected="true"] { background: var(--surface-2); }
.palette-list .p-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-strong); }
.palette-list .p-hint { color: var(--faint); font-size: 12px; white-space: nowrap; }
.palette-list .p-group { padding: 8px 10px 2px; font-size: 11.5px; color: var(--faint); cursor: default; }
.palette-empty { padding: 14px; color: var(--muted); font-size: 13px; }
.palette-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; }
.shortcuts { width: min(520px, calc(100vw - 32px)); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.shortcut-list { margin: 0; padding: 8px 16px 16px; }
.shortcut-list div { display: flex; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.shortcut-list dt { width: 150px; flex: none; }
.shortcut-list dd { margin: 0; color: var(--muted); }

/* ---- Skeleton loaders --------------------------------------------------------------------- */
.skeleton { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }
.sk { height: 12px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 25%, var(--hover) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; }
.sk.w-40 { width: 40%; } .sk.w-60 { width: 60%; } .sk.w-80 { width: 80%; } .sk.h-lg { height: 44px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

@media print { .sidebar, .mobilebar, .palette, .shortcuts { display: none !important; } .shell { display: block; } }

/* ---- Search page -------------------------------------------------------------------------- */
.search-form { display: flex; gap: 8px; max-width: 720px; margin-bottom: 20px; }
.search-group { margin-top: 20px; }
.search-group h2 { font-size: 14px; margin-bottom: 6px; }
.search-hits { list-style: none; margin: 0; padding: 0; }
.search-hits li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.search-hits a { overflow-wrap: anywhere; }
.footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12.5px; }
.footer nav a { color: var(--muted); }

/* ---- Accessibility --------------------------------------------------------------------------- */
/* The row's evidence toggle: invisible until a keyboard user focuses it. */
.sr-toggle { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; padding: 0; }
.sr-toggle:focus-visible { position: static; width: auto; height: auto; clip: auto; display: block; margin-bottom: 4px; padding: 2px 6px; font: inherit; font-size: 12px; color: var(--accent); background: var(--surface-2); border-radius: var(--radius-sm); }
/* Links inside running text are underlined so they don't rely on colour alone. */
p a:not(.btn), .table-foot a, .hint a { text-decoration: underline; text-underline-offset: 2px; }
.btn.is-on { color: var(--text-strong); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }
.btn.is-on .icon { color: var(--ok); }
.review-item .vs { color: var(--muted); }

/* --- Evidence drawer ----------------------------------------------------------------------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 40; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); overflow-y: auto; overscroll-behavior: contain; }
.drawer[hidden] { display: none; }
.drawer-body { padding: 18px 20px 32px; }
@media (prefers-reduced-motion: no-preference) { .drawer:not([hidden]) { animation: drawer-in .16s ease-out; } }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; }
.drawer-head-text { flex: 1; min-width: 0; }
.drawer-head-text p { margin: 0; }
.drawer-title { font-size: 17px; margin: 2px 0 6px; overflow-wrap: anywhere; }
.drawer-title:focus { outline: none; }
.drawer-title .icon { width: 13px; height: 13px; margin-left: 4px; vertical-align: -1px; }
.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.drawer-section { padding: 14px 0; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: 0; }
.drawer .entity-detail { grid-template-columns: 1fr; padding: 0; gap: 4px; }
.drawer-h3 { display: flex; align-items: center; gap: 6px; font-size: 13px; margin: 0 0 10px; }
.drawer-h3 .count { color: var(--faint); font-weight: 400; }
.note-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; }
.note { background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
.note-meta { margin: 0 0 2px; font-size: 12px; }
.note-body { margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mention { color: var(--accent); font-weight: 600; }
.note-form { display: grid; gap: 8px; justify-items: start; }
.note-form textarea { width: 100%; resize: vertical; }
@media (min-width: 1200px) { body.drawer-open #main { padding-right: min(540px, 40vw); } }

/* --- Bulk bar and views ---------------------------------------------------------------------- */
.bulkbar { position: sticky; top: 8px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow); font-size: 13px; }
.bulkbar[hidden] { display: none; }
.bulkbar > span { margin-right: 6px; }
.views-menu { margin: 0 0 8px; }
.views-list { min-width: 240px; }
.view-row { display: flex; align-items: center; gap: 2px; }
.view-row > button[role="menuitem"] { flex: 1; }
.view-save { display: flex; gap: 6px; padding: 6px 8px; }
.view-save input { flex: 1; min-width: 0; font-size: 13px; }

/* --- Timeline track --------------------------------------------------------------------------- */
.track-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 18px 10px; margin-bottom: 18px; }
.track-title { font-size: 14px; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.track-title .small { font-weight: 400; }
.track { position: relative; height: 96px; margin: 0 14px; }
.track-axis { position: absolute; left: 0; right: 0; bottom: 26px; height: 2px; background: var(--border-strong); border-radius: 1px; }
.track-point { position: absolute; bottom: 0; width: 24px; margin-left: -12px; display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--muted); border-radius: var(--radius-sm); }
.track-point:hover, .track-point:focus-visible { color: var(--text-strong); text-decoration: none; }
.track-point:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.track-bar { width: 8px; border-radius: 2px 2px 0 0; background: color-mix(in srgb, var(--accent) 55%, transparent); margin-bottom: 3px; }
.track-point:hover .track-bar, .track-point.is-current .track-bar { background: var(--accent); }
.track-dot, .key-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); box-sizing: content-box; }
.key-dot { display: inline-block; vertical-align: -2px; margin-right: 5px; border-color: var(--border-strong); }
.trig-watch .track-dot, .key-dot.trig-watch { background: var(--ok); }
.trig-pivot_chain .track-dot, .key-dot.trig-pivot_chain { background: var(--surface); border-color: var(--accent); }
.has-failed .track-dot, .key-dot.has-failed { box-shadow: 0 0 0 2px var(--warn); }
.track-label { font-size: 11px; font-family: var(--mono); margin-top: 3px; line-height: 12px; }
.track-point.is-current .track-label { color: var(--text-strong); font-weight: 600; }
.track-range { display: flex; justify-content: space-between; margin: 4px 0 0; }
.track-key { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 0; padding: 0; }

/* --- Case templates ---------------------------------------------------------------------------- */
.template-picker { margin: 0 0 20px; }
.template-picker .subhead { margin: 0 0 8px; }
.template-picker ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.template-card { display: grid; align-content: start; gap: 3px; height: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; font-size: 12.5px; box-sizing: border-box; }
.template-card strong { font-size: 13.5px; color: var(--text-strong); }
.template-card span { color: var(--muted); line-height: 1.4; }
.template-card:hover { border-color: var(--border-strong); text-decoration: none; }
.template-card[aria-current="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.template-tips ul { margin: 4px 0 0; padding-left: 18px; }
.template-tips p { margin: 0; }

/* --- Home ---------------------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.card-title { font-size: 14px; margin: 0 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.card-title a { font-weight: 400; }
.section-title { font-size: 14px; margin: 6px 0 10px; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-sunk); overflow: hidden; margin: 10px 0 12px; }
.progress > span { display: block; height: 100%; background: var(--ok); border-radius: 3px; }
.empty-actions { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.nav-badge-slot { margin-left: auto; display: inline-flex; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary-bg); color: var(--primary-text); font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; box-sizing: border-box; }
a.side-email { color: var(--muted); }
a.side-email:hover { color: var(--text); }
.sample-banner { margin-top: 14px; }
.sample-banner p { margin: 0; }

/* --- Notifications, account, activity ------------------------------------------------------------ */
.notif-list, .activity { list-style: none; margin: 0; padding: 0; }
.notif-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.notif-list li.is-unread { font-weight: 500; }
.notif-list li.is-unread .notif-dot { background: var(--accent); }
.notif-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; }
.notif-list p { margin: 0; }
.settings-form fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 16px; }
.settings-form legend { font-weight: 600; font-size: 13.5px; padding: 0 4px; }
.settings-form .check { margin: 6px 0; }
.activity li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.activity-icon { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-sunk); color: var(--muted); }
.activity-icon svg { width: 13px; height: 13px; }
.activity p { margin: 0; }
.activity .quote { margin-top: 4px; padding-left: 10px; border-left: 2px solid var(--border-strong); color: var(--text); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.activity .ident { font-size: 12.5px; }
.day-head { font-size: 12px; font-weight: 600; color: var(--muted); margin: 18px 0 2px; text-transform: none; }

/* --- Snapshots, exports, share links --------------------------------------------------------------- */
.snap-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.snapshot-meta { margin: 0 0 8px; }
.snapshot-meta > div { grid-template-columns: 120px 1fr; align-items: baseline; }
.wrap { overflow-wrap: anywhere; }
.snapshot-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; font-size: 13px; line-height: 1.55; max-height: 70vh; overflow: auto; }
.export-form { align-items: flex-end; flex-wrap: wrap; }
.shared-note { margin: 0; font-size: 13px; color: var(--muted); }

/* --- Phones: findings as cards; selection and bulk editing stay on larger screens --------------------- */
@media (max-width: 600px) {
  .entities thead { display: none; }
  .entities .col-select, #bulkbar, .views-menu .view-save { display: none !important; }
  .entities, .entities tbody.entity { display: block; width: 100%; }
  .entities tbody.entity { border-bottom: 1px solid var(--border); }
  .entities tr.entity-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 36px; grid-template-areas: "confirm value menu" ". match menu"; align-items: start; padding: 10px 2px; }
  .entities tr.entity-row > td { border: 0; padding: 0; background: none; }
  .entities tr.entity-row > .col-confirm { grid-area: confirm; padding-top: 1px; }
  .entities tr.entity-row > .value-cell { grid-area: value; max-width: none; }
  .entities tr.entity-row > .col-match { grid-area: match; padding-top: 4px; }
  .entities tr.entity-row > .col-menu { grid-area: menu; }
  .entities .ident-cut { max-width: 100%; }
  .entities tr.merge-row, .entities tr.merge-row > td { display: block; }
  .drawer { width: 100vw; border-left: 0; }
  .drawer-body { padding: 14px 14px 40px; }
  .drawer-actions .btn { flex: 1 1 auto; justify-content: center; }
  .snapshot-meta > div { grid-template-columns: 1fr; gap: 0; }
  .report-actions .shared-note { flex-basis: 100%; }
}

/* --- Legal and trust pages -------------------------------------------------------------------------- */
.container.legal { max-width: 1120px; }
.legal-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 40px; align-items: start; }
.legal-nav { position: sticky; top: 20px; font-size: 13px; }
.legal-nav ul, .legal-toc { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 2px; }
.legal-nav a { display: block; padding: 4px 8px; border-radius: var(--radius-sm); color: var(--muted); }
.legal-nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.legal-nav a[aria-current="page"] { background: var(--surface-2); color: var(--text-strong); font-weight: 500; }
.legal-nav-title { font-size: 11.5px; font-weight: 600; color: var(--faint); margin: 0 0 6px 8px; text-transform: uppercase; letter-spacing: .04em; }
.legal-doc { max-width: 74ch; font-size: 14.5px; line-height: 1.65; color: var(--text); }
.legal-doc h1 { font-size: 28px; margin: 2px 0 4px; }
.legal-doc h2 { font-size: 17px; margin: 30px 0 8px; scroll-margin-top: 16px; }
.legal-doc section { scroll-margin-top: 16px; }
.legal-doc p { margin: 0 0 10px; }
.legal-kicker { font-size: 12px; color: var(--faint); margin: 0; text-transform: uppercase; letter-spacing: .05em; }
.legal-meta { color: var(--muted); font-size: 13px; }
.legal-summary { border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius); padding: 12px 16px; margin: 16px 0 6px; }
.legal-summary p:last-child { margin-bottom: 0; }
.legal-list { margin: 0 0 12px; padding-left: 22px; display: grid; gap: 6px; }
.legal-defs { margin: 0; display: grid; gap: 8px; }
.legal-defs dt { font-weight: 600; color: var(--text-strong); }
.legal-defs dd { margin: 0 0 4px; }
.legal-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 8px 0 14px; }
.legal-table th, .legal-table td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.legal-table thead th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.legal-table tbody th { font-weight: 500; color: var(--text-strong); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-links a { color: var(--muted); }
.side-legal { display: flex; gap: 10px; padding: 2px 10px 6px; font-size: 12px; }
.side-legal a { color: var(--faint); }
.side-legal a:hover { color: var(--text); }
.accept-card .legal-list { font-size: 14px; }
.accept-form { gap: 10px; margin-top: 14px; }
.decline-form { margin-top: 10px; }
@media (max-width: 900px) {
  .legal-wrap { grid-template-columns: 1fr; gap: 12px; }
  .legal-nav { position: static; }
  .legal-toc, .legal-nav .legal-nav-title + .legal-toc { display: none; }
  .legal-nav ul { display: flex; flex-wrap: wrap; gap: 4px; }
}
.legal-doc a, .accept-card a, .legal-summary a { text-decoration: underline; text-underline-offset: 2px; }
.tools-unset { margin-top: 14px; font-size: 13.5px; }
.tools-unset summary { cursor: pointer; color: var(--muted); }
.tools-unset p { margin: 6px 0 8px; }

/* --- Integrations -------------------------------------------------------------------------------- */
.integ-group { margin-bottom: 10px; }
.integ-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; margin-bottom: 18px; }
.integ-card { margin: 0; display: flex; flex-direction: column; gap: 6px; scroll-margin-top: 16px; }
.integ-card.is-on { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.integ-card p { margin: 0; }
.integ-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.integ-head h3 { margin: 0; font-size: 14.5px; }
.integ-adds { font-size: 13.5px; }
.integ-form { gap: 8px; margin-top: 6px; }
.integ-form .field > span { font-size: 12.5px; }
.integ-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.integ-results { list-style: none; margin: 4px 0; padding: 8px 10px; border-radius: var(--radius); background: var(--bg-sunk); font-size: 12.5px; display: grid; gap: 4px; }
.integ-results .ok strong { color: var(--ok); }
.integ-results .bad strong { color: var(--bad); }
.integ-card .icon { width: 11px; height: 11px; margin-left: 2px; vertical-align: -1px; }

/* ==== Brand refresh: components ======================================================= */
.mark { width: 24px; height: 24px; flex: none; color: var(--accent); }
.lockup { display: inline-flex; align-items: center; gap: 9px; }
.lockup-text { display: inline-flex; flex-direction: column; line-height: 1.1; }
.wordmark { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: .09em; color: var(--text-strong); }
.descriptor { font-family: var(--display); font-weight: 500; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.brand { gap: 9px; }
.brand svg { color: inherit; }

/* Buttons: emerald primary with a soft top highlight; softer secondary. */
.btn { border-radius: var(--radius); border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm); transition: background-color .12s, border-color .12s, color .12s; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--primary-text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 1px 2px rgba(4, 36, 27, .18); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { box-shadow: none; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { box-shadow: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Inputs */
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="url"], input[type="number"], select, textarea {
  border-radius: var(--radius); }

/* Cards and surfaces */
.card { border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.table-wrap { border-radius: var(--radius-lg); }
.empty { border-radius: var(--radius-lg); background: var(--surface); }
.alert { border-radius: var(--radius-lg); }

/* Sidebar: tinted rail, emerald active item. */
.sidebar { background: var(--bg-elev); }
.sidebar .brand { padding: 4px 8px 10px; }
.side-nav a { position: relative; }
.side-nav a[aria-current="page"] { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text-strong); }
.side-nav a[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-nav a[aria-current="page"] .icon { color: var(--accent); }

/* Tabs: emerald underline. */
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); }

/* Top bar for signed-out pages. */
.topbar { background: color-mix(in srgb, var(--bg-elev) 85%, transparent); backdrop-filter: saturate(1.4) blur(10px); }

/* Home stat tiles */
.progress > span { background: var(--brand-gradient); }
.empty-art { width: 56px; height: 56px; margin: 0 auto 12px; color: color-mix(in srgb, var(--accent) 55%, var(--border-strong)); }

/* Sign in and accept-terms: split layout with a brand panel. */
.auth-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); min-height: calc(100vh - 57px); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-form .auth { width: 100%; max-width: 380px; }
.auth h1 { font-size: 26px; margin-bottom: 4px; }
.auth .lead { color: var(--muted); margin-bottom: 20px; }
.auth-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 56px; color: #e8f4f0;
  background: radial-gradient(120% 90% at 10% 0%, #134e3f 0%, #0b1f22 45%, #081215 100%); }
.auth-panel::after { content: ""; position: absolute; inset: auto -20% -40% auto; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 165, 233, .28), transparent 65%); pointer-events: none; }
.auth-panel .mark { width: 64px; height: 64px; }
.auth-panel h2 { font-family: var(--display); font-size: 30px; line-height: 1.15; color: #f1f7f5; max-width: 16ch; letter-spacing: -0.02em; }
.auth-panel p { color: #b9d1ca; max-width: 42ch; margin: 0; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: #d6e8e2; font-size: 14px; }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .icon { color: #34d399; }
@media (max-width: 900px) { .auth-split { grid-template-columns: 1fr; } .auth-panel { display: none; } }
.auth-main { width: 100%; }
.auth-legal { margin-top: 16px; }
.auth-legal a { text-decoration: underline; }
.lawful a { text-decoration: underline; text-underline-offset: 2px; }

/* ==== Home ============================================================================ */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; margin: 4px 0 20px; }
.home-head h1 { font-size: 28px; letter-spacing: -0.025em; }
.home-summary { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.home-actions { display: flex; align-items: center; gap: 10px; }
.home-search { width: 280px; height: 34px; }

.continue-bar { display: flex; align-items: center; gap: 14px; padding: 14px 16px; margin: 0 0 22px; border-radius: var(--radius-lg);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  color: var(--text); box-shadow: var(--shadow-sm); }
.continue-bar:hover { text-decoration: none; border-color: var(--accent); }
.continue-bar.kind-failed { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 7%, var(--surface)); }
.continue-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; flex: none; background: var(--accent-soft); color: var(--accent); }
.kind-failed .continue-icon { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.continue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.continue-text strong { color: var(--text-strong); font-size: 14.5px; }
.continue-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.cases-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.cases-head h2 { font-size: 16px; }
.view-tabs { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; }
.view-tabs a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 7px; color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.view-tabs a:hover { color: var(--text-strong); text-decoration: none; }
.view-tabs a[aria-current="page"] { background: var(--surface); color: var(--text-strong); box-shadow: var(--shadow-sm); }
.view-tabs .count { font-size: 11.5px; color: var(--faint); }

.case-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.case-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px 120px auto; align-items: center; gap: 16px; padding: 14px 16px; }
.case-row + .case-row { border-top: 1px solid var(--border); }
.case-row:hover { background: color-mix(in srgb, var(--accent) 3%, var(--surface)); }
.case-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: var(--text); }
.case-main:hover { text-decoration: none; }
.case-main:hover .case-name { color: var(--accent); }
.case-name { font-weight: 600; color: var(--text-strong); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-targets { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.chip-target { display: inline-flex; align-items: center; gap: 5px; max-width: 220px; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; }
.chip-target .mono { font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.chip-type { color: var(--faint); font-size: 11px; }
.chip-more { font-size: 12px; color: var(--faint); align-self: center; }
.case-status { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.status-line { display: inline-flex; align-items: center; gap: 8px; }
.status-warn { color: var(--warn); }
.run-bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.run-bar > span { display: block; height: 100%; background: var(--brand-gradient); border-radius: 2px; }
.case-review { display: flex; align-items: center; gap: 8px; }
.review-pill { min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; display: inline-grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 600 12.5px/1 var(--font); }
.case-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 12.5px; }
.meta-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.meta-tag .icon { width: 13px; height: 13px; }
.case-meta form { margin: 0; }
.case-list-empty { padding: 28px; text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); }
.case-row.is-sample { background: var(--bg-sunk); }
.sample-head { font-size: 13px; margin: 22px 0 8px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

.home-empty { text-align: center; padding: 48px 24px; border: 1px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface); }
.home-empty h2 { font-size: 20px; margin-bottom: 8px; }
.home-empty p { color: var(--muted); max-width: 48ch; margin: 0 auto 18px; }
.home-empty .empty-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.home-empty .empty-actions form { margin: 0; }
.template-quick { margin: 18px auto 0 !important; }

.home-rail { display: flex; flex-direction: column; gap: 14px; }
.rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.rail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rail-head h2 { font-size: 14px; flex: 1; margin: 0; }
.rail-head form { margin: 0; }
.progress-ring { --p: 0; width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); }
.progress-ring > span { width: 26px; height: 26px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font: 600 10px/1 var(--font); color: var(--text-strong); }
.rail-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rail-steps li { display: flex; flex-direction: column; gap: 2px; font-size: 13.5px; }
.rail-steps a { font-weight: 600; }
.rail-more { margin-top: 10px; }
.rail-more summary { cursor: pointer; color: var(--muted); }
.rail-all { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; }
.rail-all li { display: flex; align-items: center; gap: 6px; color: var(--text); }
.rail-all li.is-done { color: var(--muted); }
.rail-all .icon { width: 13px; height: 13px; color: var(--ok); }
.rail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rail-list li { display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.sys-line { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--border); color: var(--muted); font-size: 13px; background: var(--bg-elev); }
.sys-line:hover { text-decoration: none; color: var(--text-strong); border-color: var(--border-strong); }
.sys-line span:nth-child(2) { flex: 1; }
.sys-line.is-bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--border)); }
.sys-chev { transform: rotate(-90deg); width: 14px; height: 14px; }

@media (max-width: 1100px) {
  .case-row { grid-template-columns: minmax(0, 1fr) 150px 130px; }
  .case-meta { display: none; }
}
@media (max-width: 900px) {
  .home-layout { grid-template-columns: minmax(0, 1fr); }
  .home-search { display: none; }
  .case-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main review" "status status"; gap: 8px 12px; }
  .case-main { grid-area: main; }
  .case-review { grid-area: review; }
  .case-status { grid-area: status; flex-direction: row; align-items: center; gap: 10px; }
  .case-status .run-bar { flex: 1; }
  .case-review .faint { display: none; }
}

.view-tabs { max-width: 100%; min-width: 0; }
.cases-head > h2 { flex: none; }
.case-targets { flex-wrap: nowrap; overflow: hidden; }
.chip-target { flex: 0 1 auto; min-width: 0; }
.chip-more { flex: none; }
@media (min-width: 901px) { .home-rail { position: sticky; top: 16px; } }
.sys-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sys-text strong { font-weight: 600; }
.sys-line span:nth-child(2) { flex: 1; }
.chip-target { max-width: 200px; }
.sys-main { color: var(--text-strong); font-weight: 500; }
.sys-line.is-bad .sys-main { color: var(--text-strong); }
.sys-sub { font-size: 12px; color: var(--muted); }
.sys-text strong { color: var(--bad); font-size: 12.5px; }
