:root {
  --brand-navy: #1b3448; --brand-teal: #0099ad; --brand-teal-bright: #3cc6d9;
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a;
  --grid: #e7e9ec; --axis: #c9ced5; --chart-muted: #7f8892;
  --bg: #f2f4f6; --panel: #ffffff; --line: #e1e5ea; --line-strong: #cbd2da; --text: #0f1a24; --muted: #5f6b77;
  --accent: #007f90; --accent-soft: #e0f3f5; --accent-text: #ffffff;
  --ok: #18804a; --ok-soft: #e2f4ea; --warn: #ad5a07; --warn-soft: #fdf0de; --bad: #c03a2b; --bad-soft: #fce7e4;
  --info: #1b5e84; --info-soft: #e2eef6;
  --side: #1b3448; --side-text: #d3e0ea; --side-muted: #8aa3b6; --side-active: #24435b;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0f; --panel: #111317; --line: #22262d; --line-strong: #2f343d; --text: #f4f6f8; --muted: #9aa3ae;
    --accent: #3cc6d9; --accent-soft: #0f2c31; --accent-text: #050607;
    --ok: #4cc283; --ok-soft: #163325; --warn: #f0a24b; --warn-soft: #3a2a16; --bad: #ff6f62; --bad-soft: #3d1f1b;
    --info: #7fb6dc; --info-soft: #15283a; --side: #12263a; --side-active: #1c3650;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --grid: #1f242b; --axis: #2f343d; --chart-muted: #8a939e;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

/* side menu */
.side { background: var(--side); color: var(--side-text); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { padding: 6px 8px 20px; }
.brand .wordmark { display: block; height: 21px; width: auto; }
.brand small { display: block; margin-top: 7px; font-size: 10.5px; color: var(--side-muted); letter-spacing: .9px; text-transform: uppercase; }
.side h6 { margin: 14px 8px 6px; font-size: 10.5px; letter-spacing: .8px; text-transform: uppercase; color: var(--side-muted); font-weight: 600; }
.side a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--side-text); text-decoration: none; font-size: 13.5px; }
.side a:hover { background: var(--side-active); color: #fff; }
.side a.on { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--brand-teal-bright); }
.side a svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.side .count { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.test-flag { margin: 18px 8px 0; font-size: 11px; color: #f3c27f; border: 1px solid rgba(243, 194, 127, .35); border-radius: 8px; padding: 8px 10px; }

/* top bar */
.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.top .crumb { font-weight: 600; font-size: 15px; }
.top .spacer { flex: 1; }
.top label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.menu-btn { display: none; }
.content { padding: 22px 24px 60px; max-width: 1280px; width: 100%; }
.content > * + * { margin-top: 16px; }

/* building blocks */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card h2 { font-size: 14px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card h2 .spacer { flex: 1; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.page-head .spacer { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.kpi .value { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); gap: 20px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; white-space: nowrap; }
th.num { text-align: right; }
tr.click { cursor: pointer; }
td.row { flex-wrap: nowrap; gap: 6px; }
td button, td .btn { padding: 4px 9px; font-size: 12px; }
td .pill { font-size: 11px; }
tr.click:hover td { background: var(--bg); }
.empty { padding: 26px; text-align: center; color: var(--muted); }
button, .btn { font: inherit; font-size: 13px; border: 1px solid var(--line-strong); background: var(--panel); color: var(--text); padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { color: var(--bad); }
button.ghost { border-color: transparent; background: none; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; font-size: 13.5px; color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; min-height: 38px; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 12px; align-items: end; }
.form .wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .spacer { flex: 1; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a, .tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 11px; text-decoration: none; font-size: 13.5px; }
.tabs .on { color: var(--text); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border-radius: 99px; padding: 3px 12px; font-size: 12.5px; }
.chips button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 9px; border-radius: 99px; white-space: nowrap; background: var(--line); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.banner { padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.banner.ok { background: var(--ok-soft); color: var(--ok); }
.banner.bad { background: var(--bad-soft); color: var(--bad); }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.profile-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.profile-head h1 { margin: 0; font-size: 20px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.match { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 10px; }
.match .top2 { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.bar { width: 90px; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--warn); }
.match dl { display: grid; grid-template-columns: 130px 1fr; gap: 3px 12px; margin: 10px 0 0; font-size: 13px; }
.match dt { color: var(--muted); }
.match dd { margin: 0; overflow-wrap: anywhere; }
.decision { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); display: grid; gap: 8px; }
.decided { margin-top: 12px; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.decided.false_positive { background: var(--ok-soft); }
.decided.true_match { background: var(--bad-soft); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.timeline .who { font-weight: 600; }
.postings { margin: 6px 0 2px; font-size: 12px; }
.postings td { padding: 3px 8px; border: 0; }
.tier-table input { width: 100%; }
pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12px; }
code { font-family: var(--mono); font-size: 12px; }

/* centred popup */
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 18, .5); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.modal-back.on { display: flex; }
.modal { background: var(--panel); border-radius: 14px; padding: 20px 22px; max-width: 520px; width: 100%; border: 1px solid var(--line); max-height: 90vh; overflow-y: auto; }
.modal h3 { margin: 0 0 10px; font-size: 16px; }
.modal .row.end { justify-content: flex-end; margin-top: 16px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 9px 15px; border-radius: 8px; font-size: 13px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 60; max-width: 90vw; }
.toast.on { opacity: 1; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .grid2, .grid3, .split { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .top { padding: 10px 16px; }
  .kv { grid-template-columns: 1fr; }
}

/* charts */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--chart-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.tt { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.12); white-space: nowrap; z-index: 3; display: none; }
.tt .tt-head { font-weight: 600; margin-bottom: 4px; }
.tt .tt-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 140px) 1fr auto; gap: 10px; align-items: center; padding: 4px 0; font-size: 13px; }
.hbar-track { height: 14px; position: relative; }
.hbar-fill { height: 14px; border-radius: 0 4px 4px 0; background: var(--series-1); min-width: 2px; }
.hbar-val { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }

/* sign-in */
.auth-back { position: fixed; inset: 0; background: var(--side); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 40; overflow-y: auto; }
.auth-back[hidden] { display: none; }
.auth-card { background: var(--panel); border-radius: 14px; padding: 26px; width: 100%; max-width: 400px; display: grid; gap: 12px; }
.auth-card .wordmark { height: 22px; width: auto; }
.auth-card h1 { font-size: 20px; margin: 4px 0 0; }
.auth-card form { display: grid; gap: 12px; }
.auth-card button.primary { width: 100%; padding: 10px; }
.who { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
[hidden] { display: none !important; }
