:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f6f7f0;
  background: #0a0d0c;
  font-synthesis: none;
  --acid: #dfff00;
  --orange: #ff5a1f;
  --muted: #9ba39e;
  --panel: #131816;
  --line: #2a322e;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 1080px; background: radial-gradient(circle at 20% -10%, #203228 0, transparent 34rem), #0a0d0c; }
button, input, select, textarea { font: inherit; }
button { border: 0; border-radius: 4px; padding: .72rem 1rem; background: var(--acid); color: #10130d; font-weight: 800; cursor: pointer; }
button:hover { filter: brightness(.9); }
button:disabled { cursor: not-allowed; opacity: .35; }
button.secondary { background: transparent; color: #fff; border: 1px solid var(--line); }
button.danger { background: #ff8c75; color: #230800; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.section-actions { display: flex; gap: .75rem; align-items: center; }
.stop-actions { display: flex; gap: .5rem; margin-top: .6rem; }
#stop-editor-status:empty { display: none; }
code { color: var(--acid); }

.topbar { height: 98px; padding: 1.2rem 2.5rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(10,13,12,.9); position: sticky; top: 0; z-index: 2; backdrop-filter: blur(14px); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.55rem; letter-spacing: -.04em; text-transform: uppercase; }
h1 span { color: var(--acid); }
h2 { margin-bottom: .75rem; font-size: 1.35rem; }
.eyebrow { color: var(--orange); font-size: .7rem; font-weight: 900; letter-spacing: .16em; margin-bottom: .35rem; }
.topbar-actions { display: flex; align-items: end; gap: 1rem; }
.topbar-actions label { font-size: .72rem; color: var(--muted); }
.topbar-actions select { display: block; margin-top: .3rem; }

main { padding: 2rem 2.5rem 4rem; max-width: 1600px; margin: auto; }
.status { min-height: 1.4rem; margin-bottom: 1rem; color: var(--muted); font-size: .82rem; }
.status.error { color: #ff8c75; }
.status.success { color: var(--acid); }
.panel { background: linear-gradient(135deg, rgba(25,32,28,.98), rgba(16,20,18,.98)); border: 1px solid var(--line); border-radius: 7px; padding: 1.35rem; margin-bottom: 1.25rem; box-shadow: 0 18px 60px rgba(0,0,0,.18); }
.panel.warning { border-color: #745321; }
.sign-in { display: grid; grid-template-columns: 1fr 420px; gap: 5rem; padding: 3rem; align-items: center; }
.sign-in p:not(.eyebrow), .hint, .disabled-panel p { color: var(--muted); line-height: 1.55; max-width: 62ch; }
.sign-in form { display: grid; gap: .9rem; }
label { display: grid; gap: .38rem; color: #c7cec9; font-size: .78rem; font-weight: 700; }
input, select, textarea { width: 100%; color: #fff; background: #0b0f0d; border: 1px solid #36403b; border-radius: 4px; padding: .68rem .72rem; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--acid); box-shadow: 0 0 0 2px rgba(223,255,0,.08); }
textarea { min-height: 76px; resize: vertical; }
.check { display: flex; align-items: center; gap: .6rem; }
.check input { width: auto; accent-color: var(--acid); }

.metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: .8rem; margin-bottom: 1.25rem; }
.metrics article { padding: 1rem 1.1rem; background: #111614; border: 1px solid var(--line); border-left: 3px solid var(--acid); }
.metrics span { display: block; color: var(--muted); text-transform: uppercase; font-size: .65rem; font-weight: 800; letter-spacing: .1em; }
.metrics strong { display: block; margin-top: .35rem; font-size: 1.45rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; }
.section-heading p:last-child { color: var(--muted); font-size: .75rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th { color: var(--muted); font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; text-align: left; border-bottom: 1px solid var(--line); padding: .7rem .55rem; }
td { padding: .85rem .55rem; border-bottom: 1px solid rgba(42,50,46,.7); vertical-align: top; }
td:first-child { min-width: 220px; }
td small { display: block; color: var(--muted); margin-top: .2rem; }
td select { min-width: 195px; }
.derived { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { background: #26302b; padding: .25rem .45rem; border-radius: 99px; font-size: .7rem; white-space: nowrap; }
.override-fields { display: grid; gap: .6rem; }
.reason { min-width: 220px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.stack { display: grid; gap: .8rem; }
.disabled-panel { background: repeating-linear-gradient(-45deg, #111513, #111513 14px, #141916 14px, #141916 28px); }
.audit-list { list-style: none; padding: 0; margin: 0; }
.audit-list li { display: grid; grid-template-columns: 160px 210px 1fr; gap: 1rem; padding: .75rem 0; border-bottom: 1px solid var(--line); font-size: .8rem; }
.audit-list time, .audit-list span { color: var(--muted); }

[hidden] { display: none !important; }

.race-context { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.race-context h2 { margin-bottom: 0; font-size: 1.75rem; }
.race-context p:last-child { margin-bottom: 0; }
.current-estimate { border-left: 3px solid var(--acid); background: #0b0f0d; padding: .9rem 1rem; font-weight: 700; line-height: 1.5; }
#sweeper-status { margin: 0; color: var(--acid); line-height: 1.5; }
#sweeper-status:empty { display: none; }
label small { color: var(--muted); font-weight: 400; line-height: 1.5; }
#report-history-status { color: var(--muted); font-size: .85rem; }
#report-rows td { font-size: .85rem; }
.section-actions { flex-wrap: wrap; }
.status { padding: .6rem .8rem; background: #111614; border-radius: 4px; }
@media (max-width: 1100px) {
  body { min-width: 0; }
  main { padding: 1.25rem; }
  .topbar { padding: 1rem 1.25rem; }
  .grid { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .sign-in { grid-template-columns: 1fr; gap: 1.5rem; padding: 1.5rem; }
  .section-heading, .race-context { align-items: start; flex-direction: column; gap: .75rem; }
  .audit-list li { grid-template-columns: 100px 180px 1fr; }
}
@media (max-width: 600px) {
  .topbar { height: auto; flex-wrap: wrap; gap: 1rem; position: static; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 1rem; }
  .audit-list li { grid-template-columns: 1fr; gap: .35rem; }
}
