:root {
  --bg: #f5f5f6;
  --surface: #fff;
  --text: #101114;
  --muted: #70747d;
  --line: #e4e5e8;
  --red: #e83a45;
  --dark: #0b0b0f;
  --shadow: 0 20px 55px rgba(16,17,20,.12);
}
[data-theme=dark] {
  --bg: #090a0d;
  --surface: #12141a;
  --text: #f7f7f8;
  --muted: #a2a6af;
  --line: #272b34;
  --shadow: 0 20px 55px rgba(0,0,0,.34);
}
* { 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;
}
a { color: inherit; text-decoration: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 76px;
  padding: 0 clamp(16px,5vw,72px);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { font-size: 24px; font-weight: 950; white-space: nowrap; }
.brand span { color: var(--red); }
nav { display: flex; gap: 8px; flex: 1; overflow-x: auto; }
nav a, .ghost {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
nav a.active, .ghost:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface);
}
main { padding: clamp(22px,5vw,72px); }
.hero {
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(300px,460px);
  gap: clamp(28px,6vw,88px);
  align-items: center;
  min-height: calc(100vh - 160px);
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--red);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
h1 {
  max-width: 920px;
  margin: 0;
  font-size: clamp(40px,7vw,88px);
  line-height: .96;
  letter-spacing: 0;
}
.lead {
  max-width: 720px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.6;
}
.actions { display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 20px;
  font-weight: 850;
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(16,17,20,.08);
  cursor: pointer;
}
.btn.primary { border-color: var(--red); background: var(--red); color: white; }
.btn.full { width: 100%; }
.panel, .card, .race-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.race-card { display: grid; gap: 18px; }
.metric span { display: block; font-size: 42px; font-weight: 950; }
.metric small { color: var(--muted); text-transform: uppercase; font-size: 11px; font-weight: 850; }
.metric.red span { color: var(--red); }
.bib-preview {
  position: relative;
  min-height: 230px;
  padding: 24px;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--surface) 0 36%, var(--red) 36% 76%, var(--dark) 76%);
}
.bib-preview strong {
  position: absolute;
  left: 28px;
  bottom: 54px;
  color: var(--dark);
  font-size: 82px;
  line-height: 1;
}
.bib-preview span {
  position: absolute;
  right: 24px;
  bottom: 70px;
  color: white;
  font-size: 28px;
  font-weight: 950;
}
.qr-demo {
  position: absolute;
  left: 28px;
  top: 28px;
  width: 80px;
  height: 80px;
  background:
    linear-gradient(90deg,#000 8px,transparent 8px 14px) 0 0/20px 20px,
    linear-gradient(#000 8px,transparent 8px 14px) 0 0/20px 20px,
    #fff;
  border: 8px solid #fff;
}
.page { display: grid; gap: 28px; }
.page-head p { color: var(--muted); font-size: 18px; }
.grid { display: grid; gap: 18px; }
.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.five { grid-template-columns: repeat(5,minmax(0,1fr)); }
.card h3 { margin: 12px 0; font-size: 24px; }
.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(232,58,69,.1);
  color: var(--red);
  font-weight: 850;
  font-size: 12px;
}
.inline { color: var(--red); font-weight: 850; }
.split { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 22px; }
.form-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-bottom: 22px; }
label { display: grid; gap: 8px; }
label span { color: var(--muted); font-size: 13px; font-weight: 850; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: var(--bg);
  font: inherit;
}
textarea { min-height: 120px; padding-top: 12px; }
.receipt img { width: 180px; height: 180px; border-radius: 8px; background: white; }
.search { max-width: 520px; background: var(--surface); }
.table { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tr { display: grid; grid-template-columns: 90px 1fr 140px 130px; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line); }
.tr:last-child { border-bottom: 0; }
.scanner { max-width: 560px; display: grid; gap: 14px; }
.scan-box {
  display: grid;
  place-items: center;
  min-height: 260px;
  border: 2px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 950;
}
.toast { margin: 0; padding: 14px; border-radius: 8px; background: rgba(232,58,69,.1); color: var(--red); font-weight: 850; }
.ok { color: #179b5f; }
.dossard-stage {
  position: relative;
  width: min(100%, 980px);
  aspect-ratio: 1000 / 520;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff 0 35%, #f52717 35% 72%, #fff 72%);
  box-shadow: var(--shadow);
}
.dossard-logo {
  position: absolute;
  left: 38px;
  top: 26px;
  color: #1c7d35;
  font-size: clamp(18px, 3vw, 42px);
  font-weight: 950;
}
.dossard-bib, .dossard-course, .dossard-qr {
  position: absolute;
  transform: translate(-50%, -50%);
}
.dossard-bib {
  font-weight: 950;
  line-height: 1;
}
.dossard-course {
  color: #fff;
  font-weight: 950;
}
.dossard-qr {
  display: grid;
  place-items: center;
  background: #fff;
  border: 6px solid #fff;
  border-radius: 6px;
}
.dossard-qr img { width: 100%; height: 100%; display: block; }
.range-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.admin-layout { display: grid; grid-template-columns: 360px minmax(0,1fr); gap: 22px; align-items: start; }
.stack { display: grid; gap: 16px; }
.mini-table { display: grid; gap: 10px; }
.mini-row {
  display: grid;
  grid-template-columns: 1.3fr .8fr .8fr .8fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.mini-row strong { font-size: 16px; }
.mini-row span { color: var(--muted); font-size: 13px; }
@media (max-width: 980px) {
  .hero, .split { grid-template-columns: 1fr; }
  .three, .five, .form-grid { grid-template-columns: 1fr; }
  h1 { font-size: 44px; }
  .topbar { gap: 12px; }
  .brand { font-size: 19px; }
  .tr { grid-template-columns: 72px 1fr; }
  .range-grid { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .mini-row { grid-template-columns: 1fr; }
}
