:root {
  --fg: #1f2933; --muted: #6b7785; --faint: #9aa5b1; --bg: #f5f7f9; --card: #fff; --line: #e3e8ed;
  --accent: #1a7f72; --loss: #b3261e; --loss-bg: #fdf0ef; --review: #8a6100; --review-bg: #fff7e0;
  --ok: #1d7a35; --pill: #eef1f4;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--fg);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.light { font-weight: 400; }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.error { color: var(--loss); }
code { font-size: .9em; }

header { display: flex; align-items: center; justify-content: space-between; padding: .6rem 1.5rem;
  background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; color: var(--fg); }
main { max-width: 1100px; margin: 1.25rem auto 3rem; padding: 0 1.5rem; }
input { font: inherit; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 4px; }
button { font: inherit; padding: .5rem 1rem; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--accent); color: #fff; cursor: pointer; }
button.link { background: none; border: none; color: var(--accent); padding: 0; }
.logout { display: flex; gap: .75rem; align-items: center; margin: 0; }

/* login */
.login { max-width: 320px; margin: 3rem auto; display: flex; flex-direction: column; gap: .75rem; }
.login label { display: flex; flex-direction: column; gap: .25rem; }

/* search box */
.search { display: flex; gap: .5rem; margin-bottom: 1.25rem; }
.search input { flex: 1; }

/* search results table */
.res-head { font-size: .85rem; margin-bottom: .4rem; }
table.results { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); font-size: .88rem; }
table.results th { text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted); background: var(--pill); padding: .55rem .75rem; }
table.results td { padding: .55rem .75rem; border-top: 1px solid var(--line); vertical-align: top; }
table.results tbody tr:nth-child(even) { background: #f8fafb; }
table.results tbody tr:hover { background: #eef6f5; }
.role { color: var(--muted); }

/* person header + current memberships */
.who { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.who h1 { font-size: 1.45rem; margin: 0; }
.who .meta { font-size: .9rem; }
.current { margin: .75rem 0 1.25rem; display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: .7rem 1rem; font-size: .9rem; }
.current .label { color: var(--muted); font-size: .8rem; font-weight: 600; margin-bottom: .2rem; }
.gone { text-decoration: line-through; color: var(--faint); }

/* verdict */
.verdict { border-radius: 6px; padding: .9rem 1.1rem; margin-bottom: 1rem; border: 1px solid var(--line); background: var(--card); }
.verdict h2 { font-size: 1rem; margin: 0 0 .5rem; }
.verdict.loss { border-left: 4px solid var(--loss); }
.verdict.loss h2 { color: var(--loss); }
.verdict.review { border-left: 4px solid var(--review); }
.verdict.review h2 { color: var(--review); }
.verdict.ok { border-left: 4px solid var(--ok); }
.verdict.ok h2 { color: var(--ok); margin: 0; font-weight: 500; }
.cand { padding: .5rem 0; border-top: 1px solid var(--line); }
.cand:first-of-type { border-top: none; padding-top: 0; }
.cand .what { font-weight: 500; }
.cand .why { font-size: .88rem; margin-top: .15rem; }
.diff { font-size: .85rem; margin-top: .3rem; font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); }
.diff .old { color: var(--faint); }
.diff .new { color: var(--fg); }

/* one badge per removal */
.badge { font-size: .75rem; font-weight: 600; border-radius: 3px; padding: .05rem .4rem; margin-left: .35rem; vertical-align: 1px; cursor: default; }
.badge.loss { background: var(--loss-bg); color: var(--loss); }
.badge.review { background: var(--review-bg); color: var(--review); }
.badge.quiet { background: var(--pill); color: var(--muted); font-weight: 500; }

/* history */
.hist-head { display: flex; align-items: center; justify-content: space-between; margin: 1.5rem 0 .4rem; }
.hist-head h2 { font-size: 1rem; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; font-size: .85rem; }
.seg button { font: inherit; border: none; border-radius: 0; background: var(--card); padding: .25rem .7rem; color: var(--muted); }
.seg button.on { background: var(--fg); color: #fff; }
.hist { background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.row { display: grid; grid-template-columns: 9.5rem 9.5rem 1fr auto; gap: .75rem; padding: .55rem .9rem;
  border-top: 1px solid var(--line); font-size: .9rem; }
.hist .row:first-child { border-top: none; }
.row .date { color: var(--muted); font-variant-numeric: tabular-nums; }
.row .author { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sys { font-style: italic; }
.chg { margin: 0; padding: 0; list-style: none; }
.chg li { padding: .05rem 0; }
.add { color: var(--ok); }
.rem { color: var(--loss); }
.ent { color: var(--fg); }
.typ, .rl { color: var(--muted); font-size: .85em; }
details.more summary { cursor: pointer; color: var(--muted); font-size: .82rem; list-style: none; margin-top: .2rem; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: " ▸"; }
details.more[open] summary::after { content: " ▾"; }
.row.folded, .row.folded .date, .row.folded .author { color: var(--faint); }
.row.folded { font-size: .85rem; }
.json { font-size: .75rem; color: var(--faint); visibility: hidden; }
.row:hover .json { visibility: visible; }

/* Removals / All changes filter */
.hist[data-filter-mode="removals"] .row:not([data-kind="removal"]):not([data-kind="note"]) { display: none; }
.hist[data-filter-mode="all"] .row[data-kind="note"] { display: none; }
