/* Report Hub — one stylesheet, built on the tokens below. Dark theme by default.
   Contrast: every text token is at least 4.5:1 on --bg and --surface (WCAG AA). */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ================================================================ tokens */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #0b0d10;
  --surface: #12151a;
  --surface-2: #171b21;
  --surface-hover: #1b2028;
  --overlay: #1a1e25;
  --border: #242a33;
  --border-strong: #323946;

  /* text */
  --text: #e6e8eb;
  --text-muted: #9aa2ad;   /* 7.3:1 on --surface */
  --text-subtle: #808894;  /* 5.0:1 on --surface */

  /* accent */
  --accent: #2f6feb;       /* button fill; white text 4.7:1 */
  --accent-hover: #3b7bf5;
  --accent-text: #6ea8fe;  /* links; 7.4:1 on --surface */
  --accent-soft: rgba(47, 111, 235, 0.14);
  --focus: #6ea8fe;

  /* semantic: fg = text/icon colour, bg = tint, bd = border */
  --success-fg: #4ac26b; --success-bg: rgba(46, 160, 67, 0.14); --success-bd: rgba(46, 160, 67, 0.4);
  --warning-fg: #e3b341; --warning-bg: rgba(210, 153, 34, 0.14); --warning-bd: rgba(210, 153, 34, 0.4);
  --danger-fg:  #ff7b72; --danger-bg:  rgba(248, 81, 73, 0.13);  --danger-bd:  rgba(248, 81, 73, 0.42);
  --info-fg:    #6ea8fe; --info-bg:    rgba(56, 139, 253, 0.14); --info-bd:    rgba(56, 139, 253, 0.42);
  --neutral-fg: #a3abb6; --neutral-bg: rgba(139, 148, 158, 0.12); --neutral-bd: rgba(139, 148, 158, 0.32);
  --danger-solid: #c93c37;
  --danger-solid-hover: #da4a44;

  /* spacing (4px grid) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* radius and elevation */
  --r-sm: 4px; --r: 6px; --r-lg: 10px; --r-pill: 999px;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--border-strong);

  /* type */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: 12px; --fs-sm: 13px; --fs-base: 14px; --fs-md: 15px; --fs-lg: 17px; --fs-xl: 21px; --fs-2xl: 26px;
  --lh: 1.5;

  /* controls */
  --control-h: 32px;
  --control-h-sm: 26px;

  --container: 1240px;
  --header-h: 52px;
}

/* ================================================================ base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-md); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}
code { background: var(--surface-2); border: 1px solid var(--border); padding: 0 5px; border-radius: var(--r-sm); }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--r-sm); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--s-4); top: -40px; z-index: 100;
  background: var(--accent); color: #fff; padding: var(--s-2) var(--s-3); border-radius: var(--r);
}
.skip-link:focus { top: var(--s-2); }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; }
.icon-lg { width: 28px; height: 28px; stroke-width: 1.5; }

/* ================================================================ app header */

.app-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 16, 0.86);
  backdrop-filter: saturate(150%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: var(--container); margin: 0 auto; padding: 0 var(--s-6);
  height: var(--header-h); display: flex; align-items: center; gap: var(--s-6);
}
.brand { display: flex; align-items: center; gap: var(--s-2); color: var(--text); font-weight: 600; font-size: var(--fs-md); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 24px; height: 24px; border-radius: var(--r); display: grid; place-items: center;
  background: linear-gradient(135deg, #3b7bf5, #2449a8); color: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}
.brand-mark .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.env-badge {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: var(--r-sm);
  color: var(--warning-fg); background: var(--warning-bg); border: 1px solid var(--warning-bd);
}

.nav { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.nav a {
  display: inline-flex; align-items: center; height: 30px; padding: 0 var(--s-3);
  border-radius: var(--r); color: var(--text-muted); font-weight: 500; white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); }

/* dropdowns: <details class="menu"> with a <summary> trigger */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 30;
  background: var(--overlay); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--s-1);
}
.menu-panel .menu-label { padding: var(--s-2) var(--s-3); color: var(--text-muted); font-size: var(--fs-xs); border-bottom: 1px solid var(--border); margin-bottom: var(--s-1); }
.menu-panel .menu-label strong { display: block; color: var(--text); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.menu-item {
  display: flex; width: 100%; align-items: center; gap: var(--s-2); height: 32px; padding: 0 var(--s-3);
  background: none; border: 0; border-radius: var(--r); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--surface-hover); text-decoration: none; }
.menu-item[aria-current="page"] { background: var(--surface-2); }

.user-menu > summary {
  display: flex; align-items: center; gap: var(--s-2); height: 32px; padding: 0 var(--s-2) 0 var(--s-1);
  border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--text); font-weight: 500;
}
.user-menu > summary:hover { background: var(--surface-hover); }
.avatar {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--text-muted); font-size: 11px; font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.user-name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-mobile { display: none; }
.nav-mobile > summary {
  display: grid; place-items: center; width: 34px; height: 32px; border-radius: var(--r);
  border: 1px solid var(--border); color: var(--text);
}
.nav-mobile .menu-panel { left: auto; right: 0; }

@media (max-width: 860px) {
  .header-inner { padding: 0 var(--s-4); gap: var(--s-3); }
  .nav { display: none; }
  .nav-mobile { display: block; margin-left: auto; }
  .user-name { display: none; }
  .user-menu > summary { padding: 0 var(--s-1); }
}

/* ================================================================ page layout */

.page { flex: 1; width: 100%; max-width: var(--container); margin: 0 auto; padding: var(--s-6) var(--s-6) var(--s-12); }
@media (max-width: 860px) { .page { padding: var(--s-4) var(--s-4) var(--s-10); } }

.page-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--s-3) var(--s-6); margin-bottom: var(--s-5);
}
.page-header .titles { min-width: 0; }
.page-title { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); }
.page-subtitle { margin-top: var(--s-1); color: var(--text-muted); }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.eyebrow { display: block; font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; margin-bottom: var(--s-1); }
.eyebrow a { color: var(--text-muted); }

.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s-2); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); }
.cluster > input { width: auto; flex: 1 1 160px; }
.spread { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.split { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--s-5); align-items: start; }
.split > aside { position: sticky; top: calc(var(--header-h) + var(--s-4)); }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } .split > aside { position: static; } }

.narrow { max-width: 440px; margin: var(--s-12) auto 0; }
.form-width { max-width: 860px; }

/* ================================================================ cards */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); min-width: 0;
}
.card-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); min-height: 48px;
}
.card-header h2 { font-size: var(--fs-base); }
.card-header .count { color: var(--text-muted); font-weight: 500; margin-left: var(--s-1); font-variant-numeric: tabular-nums; }
.card-body { padding: var(--s-4); }
.card-body.flush { padding: 0; }
.card-footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--s-2);
  padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.card-footer.spread { justify-content: space-between; }
.card-footer.stack-sm { flex-direction: column; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; }
.card-footer.inline-form { justify-content: flex-start; align-items: flex-end; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.card + .card, .card + .stack, .stack + .card, .alert + .card { margin-top: var(--s-4); }
.card.danger-zone { border-color: var(--danger-bd); }
.card.danger-zone .card-header { border-bottom-color: var(--danger-bd); }
.card.danger-zone .card-header h2 { color: var(--danger-fg); }

.section-title { font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin: 0 0 var(--s-2); }

.divider { border: 0; border-top: 1px solid var(--border); margin: var(--s-4) 0; }

/* ================================================================ buttons */

.btn, button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: var(--control-h); padding: 0 var(--s-3); border-radius: var(--r);
  font: inherit; font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover, button:hover { background: var(--surface-hover); border-color: #3d4554; text-decoration: none; }
.btn:active, button:active { transform: translateY(0.5px); }
.btn:disabled, button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { /* the default look */ }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-hover); border-color: transparent; color: var(--text); }
.btn-danger { background: var(--danger-solid); border-color: var(--danger-solid); color: #fff; }
.btn-danger:hover { background: var(--danger-solid-hover); border-color: var(--danger-solid-hover); }
.btn-danger-ghost { background: transparent; border-color: var(--danger-bd); color: var(--danger-fg); }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: var(--danger-fg); }
.btn-sm { height: var(--control-h-sm); padding: 0 var(--s-2); font-size: var(--fs-sm); gap: 6px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }
.btn-block { width: 100%; }
.btn-link { height: auto; padding: 0; border: 0; background: none; color: var(--accent-text); font-weight: 500; }
.btn-link:hover { background: none; text-decoration: underline; }

/* copy-to-clipboard: icon button next to IDs */
.copy {
  display: inline-grid; place-items: center; width: 22px; height: 22px; padding: 0; margin-left: 2px;
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-subtle); vertical-align: middle;
}
.copy:hover { background: var(--surface-hover); color: var(--text); border: 0; }
.copy .icon { width: 13px; height: 13px; }
.copy .i-done { display: none; color: var(--success-fg); }
.copy.copied .i-copy { display: none; }
.copy.copied .i-done { display: block; }

/* ================================================================ forms */

input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]), select, textarea {
  width: 100%; min-width: 0; height: var(--control-h); padding: 0 10px;
  background: var(--bg); color: var(--text); font: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea { height: auto; min-height: 84px; padding: 7px 10px; line-height: var(--lh); resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: #3d4554; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--accent-soft);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger-fg); }
select {
  appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239aa2ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
input:disabled, select:disabled, textarea:disabled { opacity: 0.45; cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); flex: none; cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { font-weight: 500; color: var(--text); font-size: var(--fs-sm); }
.field .optional { color: var(--text-subtle); font-weight: 400; }
.hint { color: var(--text-muted); font-size: var(--fs-xs); }
.field-error { color: var(--danger-fg); font-size: var(--fs-xs); display: flex; gap: 6px; align-items: center; }

.check { display: inline-flex; align-items: center; gap: var(--s-2); cursor: pointer; font-size: var(--fs-sm); }
.checks { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }

.form-section { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s-6); padding: var(--s-5) var(--s-4); }
.form-section + .form-section { border-top: 1px solid var(--border); }
.form-section > header h2 { font-size: var(--fs-base); margin-bottom: var(--s-1); }
.form-section > header p { color: var(--text-muted); font-size: var(--fs-sm); }
@media (max-width: 760px) { .form-section { grid-template-columns: 1fr; gap: var(--s-3); } }

.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2); }
.inline-form > .field { flex: 1 1 200px; }
.inline-form > input, .inline-form > select { flex: 1 1 180px; width: auto; }

/* filter toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-2) var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.toolbar .field { flex: 1 1 150px; max-width: 220px; gap: 4px; }
.toolbar .field > label { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; }
.toolbar .toolbar-end { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }
.toolbar .grow-field { max-width: none; flex: 1 1 320px; }
@media (max-width: 720px) {
  .toolbar .field { max-width: none; flex-basis: calc(50% - var(--s-2)); }
  .toolbar .toolbar-end { margin-left: 0; width: 100%; }
}

/* repeatable rows (evidence links) */
.repeat-list { display: flex; flex-direction: column; gap: var(--s-2); }
.repeat-row { display: grid; grid-template-columns: 24px minmax(0, 3fr) minmax(0, 2fr) var(--control-h); gap: var(--s-2); align-items: center; }
.repeat-row .row-num { color: var(--text-subtle); font-size: var(--fs-xs); text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .repeat-row { grid-template-columns: minmax(0, 1fr) var(--control-h); }
  .repeat-row .row-num { display: none; }
  .repeat-row .row-note { grid-column: 1; }
}

/* ================================================================ badges, tags, alerts */

.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  border: 1px solid var(--neutral-bd); background: var(--neutral-bg); color: var(--neutral-fg);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge-success { color: var(--success-fg); background: var(--success-bg); border-color: var(--success-bd); }
.badge-warning { color: var(--warning-fg); background: var(--warning-bg); border-color: var(--warning-bd); }
.badge-danger  { color: var(--danger-fg);  background: var(--danger-bg);  border-color: var(--danger-bd); }
.badge-info    { color: var(--info-fg);    background: var(--info-bg);    border-color: var(--info-bd); }
.badge-lg { height: 26px; padding: 0 10px; font-size: var(--fs-sm); }

.tag {
  display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text); background: var(--surface-2); border: 1px solid var(--border-strong); white-space: nowrap;
}
a.tag:hover { border-color: var(--accent-text); text-decoration: none; }
.tag + .tag { margin-left: 4px; }

.ref { font-family: var(--mono); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.alert {
  display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4);
  border-radius: var(--r-lg); border: 1px solid var(--info-bd); background: var(--info-bg); color: var(--text);
}
.alert + .alert { margin-top: var(--s-2); }
.alert > .icon { margin-top: 2px; color: var(--info-fg); }
.alert-body { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.alert-ok { border-color: var(--success-bd); background: var(--success-bg); }
.alert-ok > .icon { color: var(--success-fg); }
.alert-error { border-color: var(--danger-bd); background: var(--danger-bg); }
.alert-error > .icon { color: var(--danger-fg); }
.alert-warning { border-color: var(--warning-bd); background: var(--warning-bg); }
.alert-warning > .icon { color: var(--warning-fg); }
.flashes { margin-bottom: var(--s-4); }

.banner {
  display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-lg);
  border: 1px solid var(--danger-bd); background: var(--danger-bg); font-weight: 500;
}
.banner .icon { color: var(--danger-fg); margin-top: 2px; }
.banner.neutral { border-color: var(--neutral-bd); background: var(--neutral-bg); }
.banner.neutral .icon { color: var(--neutral-fg); }

/* ================================================================ tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { padding: 0 var(--s-3); height: 40px; text-align: left; vertical-align: middle; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: var(--s-4); }
.table th:last-child, .table td:last-child { padding-right: var(--s-4); }
.table thead th {
  height: 34px; font-size: var(--fs-xs); font-weight: 500; color: var(--text-muted);
  background: var(--surface-2); border-bottom: 1px solid var(--border); position: sticky; top: 0;
}
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: rgba(255, 255, 255, 0.018); }
.table .num, .table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 220px; }
.table td.dense { padding-top: 6px; padding-bottom: 6px; height: auto; }
.table .player { display: flex; flex-direction: column; line-height: 1.3; min-width: 160px; }
.table .player a { color: var(--text); font-weight: 500; }
.table .player a:hover { color: var(--accent-text); }
.table .player .steam { color: var(--text-subtle); font-family: var(--mono); font-size: 11.5px; display: inline-flex; align-items: center; }
.table a.ref { color: var(--accent-text); }
.table time { color: var(--text-muted); }
.table-compact th, .table-compact td { height: 32px; }

/* On phones, tables marked .table-cards turn each row into a small card; cells label themselves */
@media (max-width: 640px) {
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr { display: block; width: 100%; }
  .table-cards tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards tbody td {
    display: flex; justify-content: space-between; align-items: center; gap: var(--s-3);
    height: auto; min-height: 28px; padding: 2px 0 !important; border: 0; white-space: normal; text-align: right;
  }
  .table-cards tbody td::before { content: attr(data-label); color: var(--text-muted); font-size: var(--fs-xs); text-align: left; flex: none; }
  .table-cards tbody td[data-label=""]::before { display: none; }
  .table-cards td.wrap { min-width: 0; }
  .table-cards .player { align-items: flex-end; min-width: 0; }
  .table-cards tbody tr:hover td { background: none; }
}

/* ================================================================ key-value, stats, lists */

.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-2) var(--s-5); margin: 0; font-size: var(--fs-sm); }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: var(--s-2); } }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-4); color: var(--text-muted); font-size: var(--fs-sm); }
.meta > span { display: inline-flex; align-items: center; gap: 6px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: var(--s-4); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.stat .label { font-size: var(--fs-xs); color: var(--text-muted); font-weight: 500; }
.stat .value { font-size: var(--fs-xl); font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .sub { font-size: var(--fs-xs); color: var(--text-subtle); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 260px; min-width: 0; }
.list > li > p { flex-basis: 100%; margin: 0; }

.evidence-list { list-style: none; margin: 0; padding: 0; }
.evidence-list > li { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.evidence-list > li:last-child { border-bottom: 0; }
.evidence-head { display: flex; gap: var(--s-3); align-items: flex-start; }
.evidence-head .n { color: var(--text-subtle); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; width: 18px; padding-top: 2px; text-align: right; flex: none; }
.evidence-head .body { min-width: 0; flex: 1; }
.evidence-head a { overflow-wrap: anywhere; }
.video { position: relative; width: 100%; max-width: 760px; aspect-ratio: 16 / 9; margin-top: var(--s-3); background: #000; border-radius: var(--r); overflow: hidden; border: 1px solid var(--border); }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: var(--s-4); position: relative; }
.timeline > li { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--s-3); padding-bottom: var(--s-4); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 1px; background: var(--border); }
.timeline > li:last-child::before { display: none; }
.tl-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-muted); }
.tl-dot .icon { width: 12px; height: 12px; stroke-width: 2; }
.tl-dot.success { color: var(--success-fg); border-color: var(--success-bd); background: var(--success-bg); }
.tl-dot.warning { color: var(--warning-fg); border-color: var(--warning-bd); background: var(--warning-bg); }
.tl-dot.danger { color: var(--danger-fg); border-color: var(--danger-bd); background: var(--danger-bg); }
.tl-dot.info { color: var(--info-fg); border-color: var(--info-bd); background: var(--info-bg); }
.tl-body { padding-top: 2px; font-size: var(--fs-sm); min-width: 0; }
.tl-body time { color: var(--text-subtle); font-size: var(--fs-xs); margin-left: var(--s-2); white-space: nowrap; }
.tl-body .detail { color: var(--text-muted); margin-top: 2px; }

/* action groups in the report sidebar */
.action-group + .action-group { border-top: 1px solid var(--border); }
.action-group { padding: var(--s-4); }
.decision-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-2); }
.decision-buttons .btn { padding: 0 var(--s-2); }

/* ================================================================ empty state, pager, misc */

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-12) var(--s-4); }
.empty .empty-icon { width: 48px; height: 48px; border-radius: var(--r-lg); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-muted); margin-bottom: var(--s-2); }
.empty h3 { font-size: var(--fs-md); }
.empty p { color: var(--text-muted); max-width: 420px; margin: 0; }
.empty .btn { margin-top: var(--s-3); }
.empty.compact { padding: var(--s-6) var(--s-4); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--border); color: var(--text-muted); font-size: var(--fs-sm); }

.key-reveal { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
.key-reveal code { padding: 6px 10px; font-size: var(--fs-sm); overflow-wrap: anywhere; user-select: all; background: var(--bg); }

.doc { padding: var(--s-6) var(--s-8); max-width: 820px; }
.doc h1 { margin-bottom: var(--s-4); }
.doc h2 { margin: var(--s-6) 0 var(--s-2); font-size: var(--fs-lg); }
.doc ul, .doc ol { padding-left: var(--s-5); }
.doc li { margin: var(--s-1) 0; }
.doc table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; font-size: var(--fs-sm); margin: var(--s-3) 0; }
.doc th, .doc td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--surface-2); }
.doc pre { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r); padding: var(--s-3) var(--s-4); overflow-x: auto; margin: var(--s-3) 0; }
.doc pre code { background: none; border: 0; padding: 0; font-size: var(--fs-sm); white-space: pre; }
.doc td code, .doc th code { white-space: nowrap; }
@media (max-width: 720px) { .doc { padding: var(--s-5) var(--s-4); } }

.auth-card { padding: var(--s-8); text-align: center; }
.auth-card .brand-mark { width: 40px; height: 40px; margin: 0 auto var(--s-4); border-radius: var(--r-lg); }
.auth-card .brand-mark .icon { width: 22px; height: 22px; }
.auth-card h1 { margin-bottom: var(--s-2); }
.auth-card .btn { margin-top: var(--s-5); }
.auth-card .btn + p { margin-top: var(--s-3); }

/* ================================================================ footer */

.app-footer { border-top: 1px solid var(--border); }
.footer-inner {
  max-width: var(--container); margin: 0 auto; padding: var(--s-5) var(--s-6);
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4);
  color: var(--text-subtle); font-size: var(--fs-xs);
}
.footer-inner nav { display: flex; gap: var(--s-4); }
.footer-inner a { color: var(--text-muted); }
@media (max-width: 860px) { .footer-inner { padding: var(--s-4); } }

/* htmx: dim the feed while it reloads */
.htmx-request #feed, #feed.htmx-request { opacity: 0.55; transition: opacity 0.15s; }
