:root {
  --bg: #0e1012;
  --surface: #15181b;
  --surface-2: #1b1f23;
  --line: #262b30;
  --line-strong: #333a41;
  --text: #e4e6e8;
  --text-2: #a3a9b0;
  --text-3: #6e757d;
  --accent: #f2a93b;          /* amber: something moved */
  --accent-dim: rgba(242, 169, 59, .12);
  --warn: #d9775b;
  --warn-dim: rgba(217, 119, 91, .12);
  --ok: #6fbf8e;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
  --r-data: 3px;
  --r-ctl: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
h1, h2 { font-family: var(--display); margin: 0; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---- masthead ---------------------------------------------------------- */
.masthead { border-bottom: 1px solid var(--line); background: linear-gradient(var(--surface), var(--bg)); }
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-top: 28px; padding-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand-mark {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line-strong); display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, var(--accent-dim), transparent 70%);
}
.brand-mark span { width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--accent); }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.01em; line-height: 1.1; text-transform: uppercase; }
.tagline { margin: 4px 0 0; color: var(--text-2); }

.live { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font: 500 12px var(--mono); color: var(--text-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live[data-state="live"] .dot { background: var(--ok); box-shadow: 0 0 0 0 rgba(111,191,142,.5); animation: pulse 2.4s ease-out infinite; }
.live[data-state="botdown"] .dot { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111,191,142,.45); } 70%,100% { box-shadow: 0 0 0 7px rgba(111,191,142,0); } }

/* ---- stats ------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-data);
  margin: 28px 0 20px; background: var(--surface); }
.stat { padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font: 600 30px/1.15 var(--display); font-variant-numeric: tabular-nums; }
.stat-lead .stat-value { color: var(--accent); font-size: 38px; }
.stat-time { font-size: 22px; padding-top: 6px; }
.stat-sub { font: 12px var(--mono); color: var(--text-3); }

/* ---- panels ------------------------------------------------------------ */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-data); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--line); }
h2 { font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none; }
.toggle input { appearance: none; width: 28px; height: 16px; border-radius: 999px; background: var(--line-strong); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(12px); background: var(--bg); }

/* ---- feed -------------------------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.ev { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 12px 18px; border-top: 1px solid var(--line); }
.ev:first-child { border-top: 0; }
.ev.fresh { animation: arrive 2.5s ease-out; }
@keyframes arrive { from { background: var(--accent-dim); } to { background: transparent; } }
.ev-time { font: 12px/1.6 var(--mono); color: var(--text-3); padding-top: 1px; }
.ev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ev-who { font-weight: 600; text-decoration: none; }
.ev-who:hover { text-decoration: underline; }
.ev-diff { font: 13px/1.5 var(--mono); margin-top: 4px; overflow-wrap: anywhere; }
.ev-diff:empty { display: none; }
.ev-diff .old { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-3); }
.ev-diff .arrow { color: var(--text-3); padding: 0 6px; }
.ev-diff .new { color: var(--accent); }
.ev-note { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.ev.baseline .ev-diff .new { color: var(--text-2); }
.empty { color: var(--text-3); padding: 28px 18px; margin: 0; }

.tag { display: inline-block; font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 6px; border-radius: var(--r-data); border: 1px solid var(--line-strong); color: var(--text-2); white-space: nowrap; }
.tag-hot { border-color: transparent; background: var(--accent-dim); color: var(--accent); }
.tag-warn { border-color: transparent; background: var(--warn-dim); color: var(--warn); }
.tag-ok { color: var(--ok); border-color: rgba(111,191,142,.3); }

/* ---- notes ------------------------------------------------------------- */
.notes { padding: 14px 18px 18px; }
.notes h2 { margin-bottom: 12px; }
.notes dl { margin: 0; }
.notes dt { margin-top: 14px; }
.notes dt:first-child { margin-top: 0; }
.notes dd { margin: 6px 0 0; color: var(--text-2); font-size: 13px; }
.method { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12.5px; }

/* ---- roster ------------------------------------------------------------ */
.roster-panel { margin-top: 20px; }
.roster-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-ctl); overflow: hidden; }
.seg button { font: 500 12.5px var(--sans); color: var(--text-2); background: none; border: 0; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-selected="true"] { background: var(--surface-2); color: var(--text); }
.seg button:hover { color: var(--text); }
.search { font: 13px var(--mono); color: var(--text); background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
  padding: 6px 10px; width: 240px; outline: none; }
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--text-3); }

.table-scroll { overflow-x: auto; }
.roster { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.roster th { text-align: left; font: 500 11.5px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--text-3);
  padding: 10px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.roster td { padding: 9px 18px; border-top: 1px solid var(--line); vertical-align: top; }
.roster tbody tr.row { cursor: pointer; }
.roster tbody tr.row:hover td { background: var(--surface-2); }
.roster tbody tr.row.open td { background: var(--surface-2); }
.roster .num { text-align: right; white-space: nowrap; }
.roster .mono { font-family: var(--mono); font-size: 12.5px; }
.roster .dim { color: var(--text-3); }
.roster .moved { color: var(--accent); }
.roster .listed { font-weight: 500; }
.roster .listed small { color: var(--text-3); font-weight: 400; margin-left: 6px; }
.roster .uuid { display: block; font: 11px var(--mono); color: var(--text-3); margin-top: 2px; }
.roster td.num { font: 12px var(--mono); color: var(--text-2); }
.detail td { padding: 0 18px 14px; background: var(--surface-2); border-top: 0; }
.detail ol { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px dashed var(--line-strong); }
.detail li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 4px 0; font-size: 13px; }
.detail li time { font: 12px var(--mono); color: var(--text-3); }
.detail .links { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }

/* ---- footer ------------------------------------------------------------ */
.footer { padding-top: 36px; padding-bottom: 48px; }
.credit { margin: 0; font-family: var(--display); font-size: 16px; color: var(--text-2); }
.credit strong { color: var(--accent); font-weight: 600; }
.fine { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); max-width: 760px; }

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 960px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .masthead-inner { flex-direction: column; align-items: flex-start; gap: 14px; padding-top: 20px; }
  h1 { font-size: 22px; }
  .ev { grid-template-columns: 1fr; gap: 2px; }
  .search { width: 100%; }
  .roster-tools { width: 100%; }
  .roster th:nth-child(3), .roster td:nth-child(3) { display: none; }
  .detail li { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ev.fresh, .live .dot { animation: none; }
}

/* ---- finding summary --------------------------------------------------- */
.finding { margin: 0 0 18px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.finding h2 { color: var(--accent); margin-bottom: 8px; }
.finding p { margin: 0 0 10px; font-size: 13px; color: var(--text); }
.surnames { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: pointer;
  font: 500 12.5px var(--mono); color: var(--text); background: var(--accent-dim);
  border: 1px solid transparent; border-radius: var(--r-ctl); padding: 4px 8px; }
.chip:hover { border-color: var(--accent); }
.chip-n { color: var(--accent); }
