:root {
  color-scheme: light;
  --page: #f6f6f3;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7974;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ring: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-wash: #e6f0fc;

  /* verdicts (categorical, fixed order) */
  --v-advance: #2a78d6;
  --v-hm: #eb6834;
  --v-recruiter: #1baf7a;
  --v-reject: #c3c2b7;
  --v-none: #e1e0d9;

  /* pipeline states */
  --s-action: #d03b3b;
  --s-decide: #ec835a;
  --s-candidate: #a3a29b;
  --s-auto: #2a78d6;
  --s-done: #0ca30c;
  --s-stopped: #52514e;
  --s-unknown: #9085e9;

  --radius: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e;
    --surface: #1a1a19;
    --surface-2: #242422;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #8f8e88;
    --grid: #2c2c2a;
    --axis: #383835;
    --ring: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-wash: #17263a;
    --v-advance: #3987e5;
    --v-hm: #d95926;
    --v-recruiter: #199e70;
    --v-reject: #5d5c57;
    --v-none: #383835;
    --s-candidate: #6d6c66;
    --s-auto: #3987e5;
    --s-stopped: #a3a29b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e;
  --surface: #1a1a19;
  --surface-2: #242422;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #8f8e88;
  --grid: #2c2c2a;
  --axis: #383835;
  --ring: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-ink: #86b6ef;
  --accent-wash: #17263a;
  --v-advance: #3987e5;
  --v-hm: #d95926;
  --v-recruiter: #199e70;
  --v-reject: #5d5c57;
  --v-none: #383835;
  --s-candidate: #6d6c66;
  --s-auto: #3987e5;
  --s-stopped: #a3a29b;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.45 var(--font); }
a { color: var(--accent-ink); }
h1, h2 { text-wrap: balance; margin: 0; }
h1 { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, select, input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--axis); border-radius: var(--radius); padding: 5px 9px;
}
button { cursor: pointer; }
button:hover { background: var(--surface-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--ring); position: sticky; top: 0; z-index: 5; }
.top-inner, .tabs, main { max-width: 1320px; margin: 0 auto; padding-inline: 20px; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-block: 12px 6px; }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 12px; }
.fresh { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; }
.tabs a {
  padding: 8px 12px; color: var(--ink-2); text-decoration: none; border-bottom: 2px solid transparent;
  white-space: nowrap; font-weight: 550;
}
.tabs a[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabs a:hover { color: var(--ink); }

main { padding-block: 18px 48px; display: flex; flex-direction: column; gap: 16px; }
.tab { display: flex; flex-direction: column; gap: 16px; }
.banner { border: 1px solid var(--s-action); color: var(--ink); background: var(--surface); border-radius: var(--radius); padding: 10px 12px; }

.panel { background: var(--surface); border: 1px solid var(--ring); border-radius: 8px; padding: 14px 16px; min-width: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; }
.ext { font-size: 12px; text-decoration: none; }
.ext:hover { text-decoration: underline; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--ring); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.tile .k { color: var(--ink-2); font-size: 12px; }
.tile .v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }
.tile .d { color: var(--muted); font-size: 12px; }
.tile.alert .v { color: var(--s-action); }


/* tables */
.scroll { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 13px; }
table.data th {
  text-align: left; font-weight: 600; color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 6px 8px; border-bottom: 1px solid var(--axis); white-space: nowrap; user-select: none;
}
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:focus-visible { outline-offset: -2px; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data th .arrow { color: var(--accent); }
table.data td { padding: 7px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.zero { color: var(--muted); }
table.clickable tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
.nowrap { white-space: nowrap; }
.trunc { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--muted); padding: 12px 0; }

/* chips */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px 1px 6px; border-radius: 999px;
  border: 1px solid var(--ring); background: var(--surface-2); font-size: 12px; white-space: nowrap; color: var(--ink);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip.sq i { border-radius: 2px; }
.flag { display: inline-block; font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--s-decide); color: var(--ink); margin-left: 4px; white-space: nowrap; }
.links { display: flex; gap: 8px; flex-wrap: wrap; }
.links a { font-size: 12px; text-decoration: none; white-space: nowrap; }
.links a:hover { text-decoration: underline; }

/* legend */
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }

/* stacked bar (verdicts per role) */
.stack { display: flex; gap: 2px; height: 12px; min-width: 160px; width: 100%; }
.stack > span { height: 100%; background: var(--c); min-width: 3px; }
.stack > span:first-child { border-radius: 4px 0 0 4px; }
.stack > span:last-child { border-radius: 0 4px 4px 0; }
.stack > span:only-child { border-radius: 4px; }

/* horizontal bars (stages) */
.hbars { display: grid; grid-template-columns: max-content 1fr max-content; gap: 8px 10px; align-items: center; }
.hbars .lbl { font-size: 13px; color: var(--ink-2); }
.hbars .n { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; min-width: 2ch; }
.hbars .track { height: 14px; position: relative; border-left: 1px solid var(--axis); }
.hbars .track .stack { height: 14px; min-width: 0; }
.hbars .track .stack > span:first-child { border-radius: 0; }
.hbars .track .stack > span:last-child { border-radius: 0 4px 4px 0; }
.hbars .track .stack > span:only-child { border-radius: 0 4px 4px 0; }

/* column chart (invites per day) */
.cols { display: flex; align-items: flex-end; gap: 6px; height: 140px; border-bottom: 1px solid var(--axis); padding-top: 18px; }
.cols .col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.cols .bar { width: 100%; max-width: 36px; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; }
.cols .val { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.cols-x { display: flex; gap: 6px; margin-top: 4px; }
.cols-x span { flex: 1 1 0; text-align: center; font-size: 10px; color: var(--muted); min-width: 0; overflow: hidden; white-space: nowrap; }

/* attention list */
.att { display: flex; flex-direction: column; }
.att-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 9px 0; border-bottom: 1px solid var(--grid); cursor: pointer; }
.att-row:last-child { border-bottom: 0; }
.att-row:hover { background: var(--surface-2); }
.att-row .who { font-weight: 550; overflow-wrap: anywhere; }
.att-row .what { grid-column: 1 / -1; color: var(--ink-2); font-size: 12px; }

/* drawer */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.35); z-index: 20; display: flex; justify-content: flex-end; }
.drawer-inner { background: var(--surface); width: min(640px, 100%); height: 100%; overflow-y: auto; padding: 16px 20px 40px; border-left: 1px solid var(--ring); }
.drawer-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 12px; position: sticky; top: 0; background: var(--surface); padding-block: 4px 8px; }
.drawer-head h2 { font-size: 16px; overflow-wrap: anywhere; }
dl.kv { display: grid; grid-template-columns: minmax(110px, 180px) 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 12px; }
dl.kv dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.scores { display: grid; grid-template-columns: minmax(0, 1fr) 120px 3ch; gap: 6px 10px; align-items: center; font-size: 12px; margin-bottom: 14px; }
.scores .sb { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.scores .sb > span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.scores .sv { text-align: right; font-variant-numeric: tabular-nums; }
.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin: 16px 0 8px; }

/* tooltip */
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--surface); font-size: 12px; padding: 5px 8px; border-radius: 5px; max-width: 280px; }

@media (max-width: 640px) {
  .top-inner, .tabs, main { padding-inline: 16px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }

}
@media (prefers-reduced-motion: no-preference) {
  .tabs a, button { transition: background-color .12s, color .12s, border-color .12s; }
}

/* ---- brand ---- */
.brand { align-items: center; }
.logo { width: 30px; height: 30px; border-radius: 7px; display: block; }

/* ---- filter bar ---- */
.filterbar { display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 3; }
.frow { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: end; }
.fl { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; min-width: 0; }
.fl[hidden] { display: none; }
.fl select, .fl input { text-transform: none; letter-spacing: 0; font-size: 13px; min-width: 0; max-width: 100%; height: 32px; }
.fl.grow { flex: 1 1 200px; }
.fl.grow2 { flex: 2 1 260px; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; }
.quick button { font-size: 12px; padding: 5px 9px; height: 32px; }
.quick button[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.factions { display: flex; gap: 6px; flex-wrap: wrap; }
.factions button { height: 32px; font-size: 12px; }
.active { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 24px; }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--accent-wash); border-color: transparent; color: var(--ink); }
.pill b { color: var(--accent-ink); margin-left: 2px; }
.pill:hover { border-color: var(--accent); background: var(--accent-wash); }

/* multi-select */
details.ms { position: relative; }
details.ms > summary {
  list-style: none; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
}
details.ms > summary::-webkit-details-marker { display: none; }
.ms-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ms-val {
  display: block; height: 32px; line-height: 30px; padding: 0 28px 0 9px; border: 1px solid var(--axis); border-radius: var(--radius);
  background: var(--surface); font-size: 13px; max-width: 220px; min-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative;
}
.ms-val::after { content: "▾"; position: absolute; right: 9px; color: var(--muted); }
details.ms.on .ms-val { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-ink); font-weight: 600; }
.ms-pop {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 10; width: 300px; max-width: calc(100vw - 40px);
  background: var(--surface); border: 1px solid var(--axis); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.ms-find { width: 100%; height: 30px; }
.ms-actions { display: flex; gap: 6px; }
.ms-actions button { font-size: 12px; padding: 3px 8px; }
.ms-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; }
.ms-opt { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: start; padding: 5px 4px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.ms-opt[hidden] { display: none; }
.ms-opt:hover { background: var(--surface-2); }
.ms-opt .t { overflow-wrap: anywhere; }
.ms-opt .c { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.ms-opt.zero .t { color: var(--muted); }

/* ---- misc ---- */
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tools button { font-size: 12px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; font-size: 12px; }
.pager label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.pager button:disabled { opacity: .45; cursor: default; }
.strong { font-weight: 550; overflow-wrap: anywhere; }
.err { color: var(--s-action); margin-top: 3px; }
button.tile { text-align: left; font: inherit; color: inherit; cursor: pointer; }
button.tile:hover { border-color: var(--accent); background: var(--surface); }
button.linkish { background: none; border: 0; padding: 0; color: var(--accent-ink); font-weight: 550; text-align: left; }
button.linkish:hover { text-decoration: underline; background: none; }
.hbars button.lbl { background: none; border: 0; padding: 0; text-align: left; color: var(--ink-2); font-size: 13px; }
.hbars button.lbl:hover { color: var(--accent-ink); text-decoration: underline; background: none; }
.stack > span[data-click], .cols .col { cursor: pointer; }
.cols .col:hover .bar { background: var(--accent-ink); }
tr[data-click] { cursor: pointer; }
.drawer[hidden] { display: none; }

/* ---- setup timeline (Gantt) ---- */
#roles-gantt { display: flex; flex-direction: column; gap: 18px; }
.g-role { display: flex; flex-direction: column; gap: 4px; }
.g-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 2px; }
.g-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr minmax(120px, 150px); gap: 10px; align-items: center; min-height: 22px; border-radius: 4px; }
.g-row[data-setup] { cursor: pointer; }
.g-row[data-setup]:hover { background: var(--surface-2); }
.g-lbl { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-track { position: relative; height: 12px; border-left: 1px solid var(--axis); background: linear-gradient(var(--grid), var(--grid)) center / 100% 1px no-repeat; }
.g-bar { position: absolute; top: 1px; height: 10px; background: var(--c); border-radius: 3px; min-width: 4px; }
.g-mark { position: absolute; top: -3px; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 6px solid var(--ink-2); transform: translateX(-4px); }
.g-done { position: absolute; top: -4px; font-size: 11px; line-height: 1; color: var(--s-done); transform: translateX(-3px); font-weight: 700; }
.g-dates { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-axisrow { min-height: 16px; }
.g-axis { position: relative; height: 16px; border-bottom: 1px solid var(--axis); }
.g-axis span { position: absolute; bottom: 2px; font-size: 10px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.g-axis span.g-today { bottom: -4px; height: 8px; width: 2px; background: var(--accent); transform: none; }
@media (max-width: 640px) { .g-row { grid-template-columns: 90px 1fr; } .g-dates { display: none; } }
