:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #17202a;
  --muted: #65717d;
  --line: #dfe4e8;
  --accent: #e10600;
  --accent-dark: #b60500;
  --success: #2c7a4b;
  --danger: #9c2424;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.45; }
a { color: inherit; }
.wrap { width: min(1500px, calc(100% - 32px)); margin: 0 auto; }
.topbar { position: sticky; top: 0; z-index: 20; background: #10151a; color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.12); }
.nav { display: flex; gap: 24px; align-items: center; justify-content: space-between; min-height: 64px; }
.brand { text-decoration: none; font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; }
.brand span { opacity: .6; font-size: .78rem; font-weight: 600; }
nav { display: flex; gap: 18px; flex-wrap: wrap; }
nav a { text-decoration: none; opacity: .9; }
nav a:hover { opacity: 1; }
main { padding: 28px 0 40px; }
h1 { margin: 0 0 20px; font-size: clamp(1.7rem, 2vw, 2.2rem); }
h2 { margin-top: 0; }
.card, .hero-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px; box-shadow: 0 3px 18px rgba(0,0,0,.04); margin-bottom: 20px; }
.hero-card { display: grid; grid-template-columns: 180px 1fr auto; gap: 22px; align-items: center; }
.landing-branding { display: flex; align-items: center; justify-content: center; }
.f1-logo { display: block; width: 150px; height: auto; max-width: 100%; }
.eyebrow { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 700; }
.hero-card h2 { margin: 6px 0 8px; }
.hero-card p { margin: 0; max-width: 850px; color: #4d5963; }
.leader-box { min-width: 230px; padding: 18px; border-radius: 12px; background: #f7f8fa; border: 1px solid var(--line); }
.leader-box strong, .leader-box span { display: block; }
.leader-box strong { margin-top: 4px; font-size: 1.12rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: middle; }
th { background: #f7f8fa; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: #4b5660; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.round { font-weight: 800; white-space: nowrap; }
.status, .pill { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.status.open { background: #e7f5ed; color: var(--success); }
.status.completed { background: #eef1f4; color: #59646e; }
.muted { color: var(--muted); }
.flash { margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.flash.success { border-color: #a9d2bb; background: #eef9f2; color: #245f3b; }
.flash.error { border-color: #e1b2b2; background: #fff2f2; color: #8a1d1d; }
button, input, textarea { font: inherit; }
button, .button-link { border: 1px solid #c9d0d6; background: #fff; color: var(--text); border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button:hover, .button-link:hover { border-color: #9ea8b0; }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
button.primary:hover { background: var(--accent-dark); }
button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
button:disabled { cursor: not-allowed; opacity: .45; }
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 6px; font-weight: 650; }
input, textarea { width: 100%; border: 1px solid #cfd6dc; border-radius: 8px; padding: 9px 10px; background: #fff; }
textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .86rem; }
.narrow { max-width: 440px; }
.driver-picker { display: grid; gap: 6px; margin-top: 8px; min-width: 290px; max-height: 340px; overflow: auto; padding: 4px; }
.driver-button { text-align: left; display: grid; gap: 1px; }
.driver-button span { color: var(--muted); font-size: .75rem; }
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-top: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline-flex; gap: 6px; align-items: center; }
.inline-reset input { width: 160px; }
.admin-table { margin-bottom: 14px; }
.footer { display: flex; justify-content: space-between; gap: 18px; padding: 0 0 28px; color: var(--muted); font-size: .82rem; }
@media (max-width: 850px) {
  .hero-card { grid-template-columns: 1fr; }
  .landing-branding { justify-content: flex-start; }
  .f1-logo { width: 130px; }
  .leader-box { min-width: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .footer { flex-direction: column; }
  th, td { padding: 10px 8px; }
}

.landing-actions { margin-top: 18px; }
.button-link.primary-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; background: var(--accent); color: #fff; border-color: var(--accent); }
.button-link.primary-link:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.section-heading { display: flex; justify-content: space-between; gap: 18px; align-items: end; margin-bottom: 6px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin-top: 0; }
.vote-history { min-width: 280px; }
.history-list { display: grid; gap: 4px; max-height: 220px; overflow: auto; font-size: .88rem; }
.public-results-table th, .public-results-table td { white-space: nowrap; }
@media (max-width: 850px) {
  .section-heading { align-items: start; flex-direction: column; }
  .vote-history { min-width: 220px; }
}

.schedule-times { display: grid; gap: 6px; min-width: 235px; }
.schedule-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: baseline; }
.schedule-label { color: var(--muted); font-size: .78rem; font-weight: 700; }
.schedule-row strong { white-space: nowrap; font-size: .88rem; }
@media (max-width: 850px) {
  .schedule-times { min-width: 220px; }
  .schedule-row { grid-template-columns: 1fr; gap: 1px; }
}
