/* VoteMetrics — situation-room design system
   Palette from the logo: frame green, leaf greens, acid lime on a deep field-green ink. */
:root {
  --ink: #050F0A;
  --panel: #0A1912;
  --panel-2: #0F241A;
  --line: #1C3828;
  --line-2: #2A4F3A;
  --text: #E4F0E7;
  --muted: #8DA898;
  --lime: #B8F23C;
  --leaf: #D3F566;
  --green: #0E8A50;
  --deep: #064B2A;
  --amber: #FFB547;
  --red: #FF5A4E;
  --blue: #6CB8FF;
  --display: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 2px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--text); font: 15px/1.55 var(--body); }
a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 19px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 500; }
.num, td.n, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ───── Console shell ───── */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 18px 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--ink); }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 18px 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.brand img { width: 34px; height: 34px; }
.brand b { font: 600 18px/1 var(--display); }
.brand span { display: block; font: 11px/1.3 var(--mono); color: var(--muted); margin-top: 3px; }
.nav-group { padding: 10px 18px 4px; font: 500 12px var(--display); color: var(--muted); }
.side a.nav { display: flex; justify-content: space-between; padding: 6px 18px; color: var(--text); border-left: 2px solid transparent; font-size: 14px; }
.side a.nav:hover { background: var(--panel); text-decoration: none; }
.side a.nav.on { border-left-color: var(--lime); background: var(--panel); color: var(--lime); }
.side .badge { font: 11px var(--mono); background: var(--amber); color: #000; border-radius: 9px; padding: 0 6px; }
.side .badge.red { background: var(--red); color: #fff; }
.who { padding: 14px 18px; border-top: 1px solid var(--line); margin-top: 14px; font-size: 13px; }
.main { padding: 26px 32px 60px; max-width: 1500px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 16px; }
.top p { margin: 4px 0 0; color: var(--muted); }

/* ───── Panels with corner brackets ───── */
.panel { position: relative; background: var(--panel); border: 1px solid var(--line); padding: 18px 20px; margin-bottom: 18px; }
.panel::before, .panel::after { content: ""; position: absolute; width: 12px; height: 12px; border: 2px solid var(--lime); pointer-events: none; }
.panel::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.panel::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.panel.quiet::before, .panel.quiet::after { border-color: var(--line-2); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }

.kpi { border-top: 1px solid var(--line-2); padding-top: 10px; }
.kpi .v { font: 600 34px/1 var(--mono); font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 6px; }
.kpi.alert .v { color: var(--amber); }
.kpi.bad .v { color: var(--red); }
.kpi.good .v { color: var(--lime); }

/* ───── Tables ───── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font: 500 12px var(--display); color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:hover td { background: rgba(184, 242, 60, .03); }
td.n, th.n { text-align: right; }
.scroll { overflow-x: auto; }

/* ───── Status chips ───── */
.chip { display: inline-block; font: 500 12px var(--mono); padding: 1px 8px; border: 1px solid currentColor; border-radius: 10px; white-space: nowrap; }
.s-validated, .s-match, .s-resolved, .s-approved, .s-published { color: var(--lime); }
.s-pending, .s-awaiting, .s-in_review, .s-acknowledged, .s-draft { color: var(--blue); }
.s-flagged, .s-mismatch, .s-dispatched, .s-late { color: var(--amber); }
.s-rejected, .s-open, .s-missing, .s-diverted, .s-tampered, .s-suspended, .s-withdrawn { color: var(--red); }
.s-none, .s-na, .s-false_alarm, .s-deactivated { color: var(--muted); }
.sev { font: 600 12px var(--mono); }
.sev-5, .sev-4 { color: var(--red); } .sev-3 { color: var(--amber); } .sev-2, .sev-1 { color: var(--muted); }

/* ───── Forms ───── */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
input, select, textarea { width: 100%; background: var(--ink); color: var(--text); border: 1px solid var(--line-2); border-radius: var(--r); padding: 9px 11px; font: 14px var(--body); }
input:focus, select:focus, textarea:focus { border-color: var(--lime); outline: none; }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.row > .shrink { flex: 0; min-width: auto; }
.btn { display: inline-block; border: 1px solid var(--lime); background: var(--lime); color: #0A1A06; font: 600 14px var(--display); padding: 9px 16px; border-radius: var(--r); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--leaf); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--lime); }
.btn.warn { background: var(--amber); border-color: var(--amber); }
.btn.danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--text); border-bottom-color: var(--lime); }
.tabs a .num { margin-left: 6px; }
.flash { padding: 12px 16px; margin-bottom: 18px; border-left: 3px solid var(--lime); background: var(--panel-2); }
.flash.err { border-left-color: var(--amber); }
.bar { height: 6px; background: var(--line); position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--lime); }
.reasons { margin: 0; padding-left: 18px; }
.reasons li { margin-bottom: 4px; }
.hash { font: 11px var(--mono); color: var(--muted); word-break: break-all; }
.evidence-img { width: 100%; border: 1px solid var(--line-2); background: #000; }
#map, .map { height: calc(100vh - 160px); min-height: 480px; border: 1px solid var(--line); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ───── Auth / bare pages ───── */
.bare { min-height: 100vh; display: grid; place-items: center; padding: 30px; }
.card { width: min(440px, 100%); }
.card .logo { width: 64px; margin-bottom: 18px; }

/* ───── Video wall ───── */
.wall { height: 100vh; overflow: hidden; padding: 28px 36px; position: relative; display: flex; flex-direction: column; }
.wall .ghost { position: absolute; right: 2vw; bottom: -6vh; font: 700 46vh/1 var(--display); color: rgba(184, 242, 60, .045); pointer-events: none; user-select: none; }
.wall header { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line-2); padding-bottom: 14px; margin-bottom: 22px; position: relative; }
.wall header h1 { font-size: clamp(26px, 2.4vw, 46px); margin: 0; }
.wall header .clock { font: 500 clamp(18px, 1.6vw, 30px) var(--mono); color: var(--lime); }
.wall .meta { color: var(--muted); font-size: clamp(13px, .9vw, 17px); }
.wall .body { flex: 1; min-height: 0; position: relative; }
.wall .stale { position: absolute; top: 10px; right: 36px; color: var(--red); font: 12px var(--mono); display: none; }
.wall.is-stale .stale { display: block; }
.wall table { font-size: clamp(13px, .95vw, 19px); }
.wall .kpi .v { font-size: clamp(32px, 3.4vw, 72px); }
.wall .kpi .l { font-size: clamp(12px, .9vw, 17px); }
.party-row { display: grid; grid-template-columns: 7em 1fr 8em 5em; gap: 14px; align-items: center; margin-bottom: 14px; }
.party-row b { font: 600 clamp(18px, 1.5vw, 30px) var(--display); }
.party-row .track { height: clamp(14px, 1.4vw, 28px); background: var(--line); }
.party-row .track i { display: block; height: 100%; }
.party-row .v { font: 600 clamp(18px, 1.5vw, 30px) var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.party-row .p { color: var(--muted); font: clamp(14px, 1vw, 20px) var(--mono); text-align: right; }
.wall-index a { display: block; padding: 22px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.wall-index a:hover { border-color: var(--lime); text-decoration: none; }
.wall-index .big { font: 700 44px/1 var(--display); color: var(--lime); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed li.critical { border-left: 3px solid var(--red); padding-left: 10px; }
.feed li.high { border-left: 3px solid var(--amber); padding-left: 10px; }
.pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 18px; }
  .g2, .g4 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
