:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1a2026;
  --line: #2b333c;
  --text: #f2f5f7;
  --muted: #9ca8b4;
  --accent: #ffb11b;
  --danger: #ff6b6b;
  --success: #6ee7a8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top right, #222812 0, var(--bg) 35%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); }
.shell { width: min(1100px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0; }
.hero, .results { background: rgba(20, 24, 29, .94); border: 1px solid var(--line); border-radius: 18px; padding: 32px; box-shadow: 0 24px 80px rgba(0,0,0,.35); }
.results { margin-top: 24px; }
.eyebrow { color: var(--accent); font-size: .75rem; letter-spacing: .18em; font-weight: 800; }
h1 { margin: 8px 0 12px; font-size: clamp(2rem, 6vw, 4rem); line-height: 1; }
h2 { margin: 6px 0 0; }
p { color: var(--muted); max-width: 760px; line-height: 1.6; }
label { display: block; margin-bottom: 8px; font-weight: 700; }
form { margin-top: 28px; }
.input-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input, button, .secondary-button { border-radius: 10px; font: inherit; }
input { width: 100%; padding: 15px 16px; border: 1px solid var(--line); background: #0e1115; color: var(--text); }
button { border: 0; min-width: 126px; padding: 0 22px; background: var(--accent); color: #171000; font-weight: 900; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
button:disabled { cursor: wait; opacity: .82; }
.spinner { width: 17px; height: 17px; border: 2px solid rgba(23,16,0,.3); border-top-color: #171000; border-radius: 50%; display: none; animation: spin .7s linear infinite; }
button.is-working .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
#status { min-height: 24px; margin-top: 14px; color: var(--muted); }
#status.error { color: var(--danger); }
#status.success { color: var(--success); }
#status.working { color: var(--accent); }
.result-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0; }
.stat, .official-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stat span, .official-card span { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.stat strong, .official-card strong { display: block; font-size: 1.05rem; }
.officials { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.official-card a { display: inline-block; margin-top: 12px; font-size: .85rem; }
.notice { padding: 18px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
details { margin-top: 26px; }
pre { overflow: auto; max-height: 440px; padding: 16px; background: #090b0d; border: 1px solid var(--line); border-radius: 10px; }
.hidden { display: none; }
.refresh-row { display:flex; align-items:center; gap:.55rem; margin-top:.8rem; font-size:.9rem; color:#cbd5e1; }
.refresh-row input { width:auto; }
.export-strip { display:flex; justify-content:space-between; align-items:center; gap:20px; margin-top:24px; padding-top:20px; border-top:1px solid var(--line); }
.export-strip strong, .export-strip span { display:block; }
.export-strip span { margin-top:4px; color:var(--muted); font-size:.9rem; }
.export-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:8px; }
.secondary-button { text-decoration:none; padding:10px 13px; border:1px solid var(--line); background:var(--panel-2); color:var(--text); font-weight:700; font-size:.85rem; }
.secondary-button:hover { border-color:var(--accent); color:var(--accent); }
@media (max-width: 800px) {
  .summary-grid, .officials { grid-template-columns: 1fr 1fr; }
  .result-header, .export-strip { display: block; }
  .export-actions { justify-content:flex-start; margin-top:14px; }
}
@media (max-width: 520px) {
  .shell { padding: 20px 0; }
  .hero, .results { padding: 20px; }
  .input-row, .summary-grid, .officials { grid-template-columns: 1fr; }
  button { padding: 14px; }
}
.workbook-panel { margin-top:24px; padding-top:24px; border-top:1px solid var(--line); }
.workbook-panel h2 { margin-top:7px; }
.file-row { display:grid; grid-template-columns:1fr auto; gap:10px; align-items:stretch; }
.file-row input[type="file"] { padding:12px; background:var(--panel-2); }
#workbook-status { min-height:24px; margin-top:14px; color:var(--muted); }
#workbook-status.error { color:var(--danger); }
#workbook-status.success { color:var(--success); }
#workbook-status.working { color:var(--accent); }
@media (max-width: 520px) { .file-row { grid-template-columns:1fr; } }
