/* ---------------------------------------------------------------
   Raassilla RX — ühine stiil
   NB! Kaubamärgivärvid on siin ühes kohas. Kui saadad täpsed
   Raassilla RX / Tarvastu Motoklubi värvikoodid, muutub kogu
   süsteemi välimus ühe ploki vahetamisega.
   --------------------------------------------------------------- */
:root {
  --bg:        #0b0d10;
  --panel:     #14181d;
  --panel-2:   #1b2026;
  --line:      #262d35;
  --text:      #eef2f6;
  --muted:     #8b97a5;
  --accent:    #e02020;   /* Raassilla punane — täpsustada */
  --accent-2:  #ff3b30;
  --live:      #2fd66b;
  --wait:      #f5b301;
  --off:       #ff4d4d;
  --done:      #8b97a5;
  --radius:    10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

/* Ajad: alati sama laius, et numbrid ei hüppaks */
.t, .time, td.t, .big-time {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-family: "SF Mono", "JetBrains Mono", "Consolas", ui-monospace, monospace;
  letter-spacing: -0.01em;
}

header.top {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--panel); border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; font-size: 15px; }
.brand span { color: var(--accent); }
.spacer { flex: 1; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ONLINE, .dot.LIVE { background: var(--live); box-shadow: 0 0 8px var(--live); }
.dot.OFFLINE, .dot.ERROR { background: var(--off); }
.dot.CONNECTING, .dot.READY { background: var(--wait); }
.dot.FINISHED, .dot.DISABLED { background: var(--done); }

.wrap { padding: 16px; max-width: 1600px; margin: 0 auto; }
.tracks { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel > h2 {
  margin: 0; padding: 12px 16px; font-size: 16px; letter-spacing: 0.06em;
  text-transform: uppercase; background: var(--panel-2); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.panel-body { padding: 12px 16px 16px; }
.sub { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line);
}
td { padding: 8px; border-bottom: 1px solid var(--line); }
td.num, th.num { text-align: right; }
tr.best td.best { color: var(--live); font-weight: 700; }
tr:last-child td { border-bottom: none; }
.pos { color: var(--muted); width: 28px; }
.name { font-weight: 600; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 10px 14px; min-height: 44px;   /* puutesõbralik */
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); }
button.go { background: var(--live); border-color: var(--live); color: #06240f; }
button.warn { background: var(--wait); border-color: var(--wait); color: #2a1e00; }
button:disabled { opacity: 0.35; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

input, select {
  font: inherit; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; min-height: 44px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; min-width: min(520px, 92vw);
}
dialog::backdrop { background: rgba(0,0,0,0.7); }

.empty { color: var(--muted); padding: 20px 0; text-align: center; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(47,214,107,0.28); } to { background: transparent; } }

@media (max-width: 700px) {
  .wrap { padding: 10px; }
  .tracks { grid-template-columns: 1fr; }
  body { font-size: 16px; }
}
