/* Race Insights: modern, clean, sporty. */
:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --line: #e5e7eb;
    --line-2: #eef0f3;
    --night: #0b1220;
    --night-2: #131c2e;
    --accent: #ff5a1f;
    --accent-2: #ff7a45;
    --accent-ink: #c2410c;
    --accent-soft: #fff1ea;
    --teal: #0d9488;
    --teal-soft: #e6f6f4;
    --blue: #2563eb;
    --blue-soft: #eaf1fe;
    --green: #16a34a;
    --green-soft: #e8f7ee;
    --red: #dc2626;
    --red-soft: #fdecec;
    --amber: #d97706;
    --amber-soft: #fdf3e2;
    --violet: #7c3aed;
    --violet-soft: #f1ebfe;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
    --shadow-lg: 0 10px 40px rgba(15, 23, 42, .14);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-head: 'Barlow Condensed', 'Inter', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; background: var(--bg); color: var(--ink);
    font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased;
    min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.1; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(30px, 4.5vw, 46px); font-weight: 800; }
h2 { font-size: 26px; font-weight: 700; }
h3 { font-size: 20px; font-weight: 700; }
h4 { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 1em; }
small, .small { font-size: 13px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 28px; } .mt-4 { margin-top: 44px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 28px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 860px; }
.inline { display: inline; }
.hidden { display: none !important; }
.flex { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- top bar ---------- */
.topbar { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-head); font-size: 22px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark svg { display: block; }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav > a { color: #cbd5e1; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 14.5px; }
.nav > a:hover { color: #fff; background: rgba(255,255,255,.07); text-decoration: none; }
.nav > a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav > a.nav-admin { color: #ffb38f; }
.nav-sep { width: 1px; height: 24px; background: rgba(255,255,255,.14); margin: 0 8px; }
.nav-user { display: flex; align-items: center; gap: 8px; color: #e2e8f0; padding: 4px 8px; border-radius: 8px; }
.nav-user:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.linklike { background: none; border: 0; color: #94a3b8; cursor: pointer; font: inherit; font-size: 14px; padding: 8px; }
.linklike:hover { color: #fff; }
.view-as select { background: var(--night-2); color: #e2e8f0; border: 1px solid rgba(255,255,255,.15); border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 13px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 8px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: #fff; margin: 5px 0; border-radius: 2px; }
.preview-bar { background: var(--amber); color: #fff; text-align: center; padding: 8px 12px; font-size: 14px; }
.preview-bar .btn { margin-left: 10px; }
.subnav { background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.subnav .wrap { display: flex; gap: 4px; }
.subnav a { padding: 12px 14px; color: var(--ink-2); font-weight: 500; font-size: 14px; border-bottom: 2px solid transparent; white-space: nowrap; }
.subnav a:hover { text-decoration: none; color: var(--ink); }
.subnav a.active { border-color: var(--accent); color: var(--ink); }

@media (max-width: 960px) {
    .nav-toggle { display: block; }
    .nav { display: none; position: absolute; left: 0; right: 0; top: 64px; background: var(--night); flex-direction: column; align-items: stretch; padding: 10px 16px 18px; gap: 2px; box-shadow: var(--shadow-lg); }
    .nav.open { display: flex; }
    .nav-sep { width: 100%; height: 1px; margin: 8px 0; }
    .view-as select { width: 100%; }
    .brand-text { font-size: 19px; overflow: hidden; text-overflow: ellipsis; max-width: 70vw; }
}

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font: 600 14px/1.2 var(--font); cursor: pointer; text-decoration: none; transition: .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #cbd5e1; background: var(--surface-2); }
.btn-accent, .btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover, .btn-primary:hover { background: #f04d12; border-color: #f04d12; color: #fff; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1e293b; color: #fff; }
.btn-light { background: rgba(255,255,255,.95); color: var(--ink); border-color: transparent; }
.btn-danger { color: var(--red); border-color: #f5c2c2; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-xs { padding: 3px 9px; font-size: 12px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--line-2); }

label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); display: block; margin-bottom: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d5dae1; border-radius: var(--radius-sm); background: #fff; font: 14.5px/1.4 var(--font); color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.6; min-height: 380px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 90, 31, .15); }
input[type=file] { padding: 8px; background: var(--surface-2); }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 17px; height: 17px; vertical-align: -3px; }
.field { margin-bottom: 16px; }
.field .hint, .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 18px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.form-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 18px; }
.span-2 { grid-column: span 2; }
@media (max-width: 720px) { .form-grid-2, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
fieldset { border: 0; padding: 0; margin: 0; }
.input-group { display: flex; gap: 8px; }
.input-group > * { flex: 1; }
.input-group > .shrink { flex: 0 0 110px; }

/* ---------- alerts ---------- */
.flashes { margin-top: 18px; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 10px; font-size: 14px; border: 1px solid; }
.alert-ok { background: var(--green-soft); border-color: #bfe5cd; color: #14532d; }
.alert-error { background: var(--red-soft); border-color: #f6c4c4; color: #7f1d1d; }
.alert-info { background: var(--blue-soft); border-color: #c9d9fb; color: #1e3a8a; }
.alert-warn { background: var(--amber-soft); border-color: #f5d9a8; color: #7c2d12; }

/* ---------- cards & sections ---------- */
.section { padding: 34px 0; }
.section-tight { padding: 20px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.eyebrow { font: 700 12.5px/1 var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 8px; display: block; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; border: 1px solid rgba(15,23,42,.04); }
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3, .card-head h2 { margin: 0; }
.card-flat { box-shadow: none; border: 1px solid var(--line); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-main { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.page-head { padding: 34px 0 10px; }
.page-head p { color: var(--muted); max-width: 720px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.empty .big { font-size: 34px; margin-bottom: 6px; }

/* ---------- hero ---------- */
.hero { background: radial-gradient(1200px 500px at 85% -10%, rgba(255,90,31,.35), transparent 60%), radial-gradient(900px 500px at -10% 120%, rgba(13,148,136,.28), transparent 60%), var(--night); color: #fff; padding: 56px 0 66px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(115deg, transparent 0 60px, rgba(255,255,255,.025) 60px 62px); pointer-events: none; }
.hero .wrap { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.hero h1 { color: #fff; margin-bottom: 14px; }
.hero h1 .accent { color: var(--accent-2); }
.hero p.lead { color: #cbd5e1; font-size: 17px; max-width: 580px; }
.hero-stats { display: flex; gap: 28px; margin-top: 26px; flex-wrap: wrap; }
.hero-stat .n { font: 800 38px/1 var(--font-head); color: #fff; }
.hero-stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; margin-top: 4px; }
@media (max-width: 900px) { .hero .wrap { grid-template-columns: 1fr; } }

.next-card { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 24px; backdrop-filter: blur(6px); }
.next-card .label { font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: #fdba74; font-weight: 700; }
.next-card h2 { color: #fff; font-size: 30px; margin: 10px 0 6px; }
.next-card h2 a { color: #fff; }
.next-card .meta { color: #cbd5e1; font-size: 14px; }
.countdown { display: flex; gap: 10px; margin: 18px 0 6px; }
.countdown .unit { background: rgba(255,255,255,.08); border-radius: 12px; padding: 12px 10px; min-width: 74px; text-align: center; }
.countdown .unit b { display: block; font: 800 40px/1 var(--font-head); color: #fff; }
.countdown .unit span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: #94a3b8; }
.countdown-race-day b { color: var(--accent-2) !important; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kpis, .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; border: 1px solid rgba(15,23,42,.04); }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc, var(--accent)); }
.kpi .k-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.kpi .k-value { font: 800 34px/1.05 var(--font-head); margin-top: 6px; color: var(--ink); }
.kpi .k-value small { font-size: 18px; font-weight: 600; color: var(--muted); }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kc-teal { --kc: var(--teal); } .kc-blue { --kc: var(--blue); } .kc-green { --kc: var(--green); } .kc-red { --kc: var(--red); } .kc-amber { --kc: var(--amber); } .kc-violet { --kc: var(--violet); } .kc-ink { --kc: var(--ink); }
.kpis-on-hero { margin-top: -38px; position: relative; z-index: 2; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.st-upcoming { background: var(--blue-soft); color: var(--blue); }
.st-done { background: var(--green-soft); color: var(--green); }
.st-failed { background: var(--red-soft); color: var(--red); }
.st-crew { background: var(--violet-soft); color: var(--violet); }
.st-double { background: var(--amber-soft); color: var(--amber); }
.st-dns { background: #eef0f3; color: var(--muted); }
.st-awaiting { background: #fff7d6; color: #a16207; }
.badge-pb { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.badge-a { background: var(--accent); color: #fff; }
.badge-soft { background: var(--line-2); color: var(--ink-2); }
.badge-ok { background: var(--green-soft); color: var(--green); }
.badge-todo { background: var(--red-soft); color: var(--red); }
.badge-na { background: #eef0f3; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--line-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.cat { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: var(--line-2); color: var(--ink-2); }
.cat-5k { background: #e0f2fe; color: #0369a1; }
.cat-10k { background: #dcfce7; color: #15803d; }
.cat-15-20k { background: #ecfccb; color: #4d7c0f; }
.cat-half-marathon { background: #ffedd5; color: #c2410c; }
.cat-25-30k { background: #fef3c7; color: #b45309; }
.cat-marathon { background: #fee2e2; color: #b91c1c; }
.cat-ultra { background: #ede9fe; color: #6d28d9; }
.cat-triathlon { background: #cffafe; color: #0e7490; }
.lvl { font-size: 12px; font-weight: 600; white-space: nowrap; }
.lvl-0 { color: var(--green); } .lvl-1 { color: var(--blue); } .lvl-2 { color: var(--muted); }

/* ---------- race lists ---------- */
.race-list { display: flex; flex-direction: column; gap: 10px; }
.race-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 16px; align-items: center; background: var(--surface); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); color: var(--ink); border: 1px solid rgba(15,23,42,.04); transition: transform .12s, box-shadow .12s; }
.race-row:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.date-tile { text-align: center; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); padding: 6px 0 7px; }
.date-tile .d { font: 800 28px/1 var(--font-head); }
.date-tile .m { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent-ink); font-weight: 700; }
.date-tile .y { font-size: 11px; color: var(--muted); }
.race-row .name { font-weight: 700; font-size: 16px; line-height: 1.3; }
.race-row .meta { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.race-row .result { text-align: right; }
.race-row .result .time { font: 800 26px/1 var(--font-head); }
.race-row .result .pace { font-size: 12.5px; color: var(--muted); }
.race-row .icons { display: flex; gap: 6px; justify-content: flex-end; margin-top: 4px; font-size: 13px; color: var(--muted); }
@media (max-width: 620px) {
    .race-row { grid-template-columns: 56px minmax(0, 1fr); }
    .race-row .result { grid-column: 2; text-align: left; }
    .race-row .icons { justify-content: flex-start; }
}
.year-head { font: 800 22px/1 var(--font-head); color: var(--muted); margin: 26px 0 10px; display: flex; align-items: center; gap: 12px; }
.year-head::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 86px minmax(0, 1fr) auto; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line-2); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font: 700 15px/1.2 var(--font-head); text-transform: uppercase; color: var(--accent-ink); }
.timeline .when small { display: block; color: var(--muted); font: 500 12px var(--font); text-transform: none; }
.timeline .what a { font-weight: 600; color: var(--ink); }
.timeline .what .meta { font-size: 12.5px; color: var(--muted); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; background: var(--surface); padding: 12px; border-radius: var(--radius); box-shadow: var(--shadow); }
.filters input, .filters select { width: auto; min-width: 140px; padding: 8px 10px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.seg-links { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; }
.seg-links a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.seg-links a:hover { text-decoration: none; }
.seg-links a.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ---------- PB cards ---------- */
.pb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.pb { background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); border-top: 4px solid var(--accent); color: var(--ink); display: block; }
.pb:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.pb .cat-name { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; color: var(--muted); }
.pb .time { font: 800 40px/1.05 var(--font-head); margin: 6px 0 2px; }
.pb .pace { color: var(--accent-ink); font-weight: 600; font-size: 13.5px; }
.pb .race { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ---------- goals ---------- */
.goal { margin-bottom: 16px; }
.goal:last-child { margin-bottom: 0; }
.goal .g-top { display: flex; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.goal .g-top span { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
.progress { height: 10px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.progress.done > i { background: linear-gradient(90deg, var(--green), #22c55e); }
.progress-sm { height: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfcfd; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.table-compact td, .table-compact th { padding: 7px 10px; }
.bar-cell { position: relative; }
.bar-cell .bar { position: absolute; left: 0; top: 6px; bottom: 6px; border-radius: 4px; opacity: .18; }
.bar-fast { background: var(--green); } .bar-slow { background: var(--red); }
.split-faster { color: var(--green); font-weight: 600; }
.split-slower { color: var(--red); font-weight: 600; }

/* ---------- race page ---------- */
.race-hero { background: var(--night); color: #fff; padding: 34px 0 30px; position: relative; overflow: hidden; }
.race-hero.has-cover::before { content: ""; position: absolute; inset: 0; background: var(--cover) center/cover no-repeat; opacity: .35; }
.race-hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,18,32,.95) 0%, rgba(11,18,32,.7) 60%, rgba(11,18,32,.4) 100%); }
.race-hero .wrap { position: relative; z-index: 1; }
.race-hero h1 { color: #fff; margin: 10px 0 8px; }
.race-hero .meta { color: #cbd5e1; display: flex; gap: 14px; flex-wrap: wrap; font-size: 14.5px; }
.race-hero .links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.race-hero .btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.18); color: #fff; }
.race-hero .btn:hover { background: rgba(255,255,255,.18); }
.race-hero .btn-accent { background: var(--accent); border-color: var(--accent); }
.breadcrumbs { font-size: 13px; color: #94a3b8; }
.breadcrumbs a { color: #cbd5e1; }
.result-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); margin-top: -22px; position: relative; z-index: 2; overflow: hidden; }
.result-band > div { padding: 16px 20px; border-right: 1px solid var(--line-2); }
.result-band > div:last-child { border-right: 0; }
.result-band .l { font-size: 11.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.result-band .v { font: 800 30px/1.1 var(--font-head); margin-top: 4px; }
.result-band .s { font-size: 12.5px; color: var(--muted); }
.result-band .v.good { color: var(--green); } .result-band .v.bad { color: var(--red); }

.stat-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat-list .s { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line-2); }
.stat-list .l { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; }
.stat-list .v { font: 700 24px/1.15 var(--font-head); margin-top: 3px; }
.stat-list .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
@media (max-width: 520px) { .dl { grid-template-columns: 1fr; gap: 2px; } .dl dd { margin-bottom: 8px; } }
.prose { font-size: 15.5px; line-height: 1.7; color: var(--ink-2); }
.prose p:last-child { margin-bottom: 0; }

.device-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; }
.watch-icon { width: 64px; height: 64px; border-radius: 18px; background: var(--night); display: grid; place-items: center; }
.battery { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.battery .cell { display: flex; align-items: center; gap: 8px; }
.battery-icon { width: 46px; height: 22px; border: 2px solid var(--ink-2); border-radius: 5px; position: relative; padding: 2px; }
.battery-icon::after { content: ""; position: absolute; right: -6px; top: 6px; width: 4px; height: 8px; background: var(--ink-2); border-radius: 0 2px 2px 0; }
.battery-icon i { display: block; height: 100%; border-radius: 2px; background: var(--green); }
.battery-icon.low i { background: var(--red); } .battery-icon.mid i { background: var(--amber); }
.battery .arrow { color: var(--muted); font-size: 20px; }

.map { height: 440px; border-radius: var(--radius); overflow: hidden; z-index: 1; background: #e5e7eb; }
.map-tall { height: calc(100vh - 220px); min-height: 480px; }
.chart-box { position: relative; height: 280px; }
.chart-box-sm { height: 220px; }
.chart-box-lg { height: 340px; }
.legend-inline { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend-inline i { display: inline-block; width: 12px; height: 4px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.gallery a { display: block; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--line-2); position: relative; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.gallery a:hover img { transform: scale(1.04); }
.gallery .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; font-size: 12px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.65)); }
.doc-list { display: flex; flex-direction: column; gap: 8px; }
.doc { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.doc:hover { text-decoration: none; border-color: #cbd5e1; background: var(--surface-2); }
.doc .ico { width: 40px; height: 40px; border-radius: 8px; background: var(--red-soft); color: var(--red); display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: none; overflow: hidden; }
.doc .ico img { width: 100%; height: 100%; object-fit: cover; }
.doc .t { font-weight: 600; font-size: 14px; }
.doc .s { font-size: 12px; color: var(--muted); }

.lightbox { position: fixed; inset: 0; background: rgba(5, 8, 15, .92); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 88vh; text-align: center; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 8px; margin: 0 auto; }
.lightbox figcaption { color: #cbd5e1; margin-top: 10px; font-size: 14px; }
.lightbox button { position: absolute; background: rgba(255,255,255,.1); border: 0; color: #fff; font-size: 34px; width: 52px; height: 52px; border-radius: 50%; cursor: pointer; line-height: 1; }
.lightbox button:hover { background: rgba(255,255,255,.22); }
.lb-close { top: 18px; right: 18px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }

/* ---------- owner panels ---------- */
.owner-panel { border: 2px dashed #ffd2bf; background: #fffaf7; }
.owner-panel > .card-head h3::before { content: "🔒 "; }
.owner-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 8px; border-radius: 6px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 600 14px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--ink); border-color: var(--accent); }
.tab-panel[hidden] { display: none; }

.checklist { list-style: none; margin: 0; padding: 0; }
.checklist .sec { font: 700 13px var(--font); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 0 6px; }
.checklist li.item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.checklist li.item:last-child { border-bottom: 0; }
.checklist .txt { flex: 1; font-size: 14.5px; }
.checklist li.done .txt { color: var(--muted); text-decoration: line-through; }
.checklist .due { font-size: 12px; color: var(--muted); white-space: nowrap; }
.checklist .due.overdue { color: var(--red); font-weight: 600; }
.checklist .del { background: none; border: 0; color: #cbd5e1; cursor: pointer; font-size: 18px; padding: 0 4px; line-height: 1; }
.checklist .del:hover { color: var(--red); }
.checkbox-btn { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #cbd5e1; background: #fff; cursor: pointer; flex: none; display: grid; place-items: center; padding: 0; margin-top: 1px; }
.checkbox-btn:hover { border-color: var(--accent); }
li.done .checkbox-btn { background: var(--green); border-color: var(--green); }
li.done .checkbox-btn::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; }

.travel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .travel-grid { grid-template-columns: 1fr; } }
.travel-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.travel-box .head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.travel-box .head b { font-size: 15px; }
.seg-form { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-form button { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; }
.seg-form button.on-booked { background: var(--green); color: #fff; }
.seg-form button.on-todo { background: var(--red); color: #fff; }
.seg-form button.on-na { background: #94a3b8; color: #fff; }

/* permissions matrix */
.perm-table td { vertical-align: middle; }
.perm-table .desc { font-size: 12.5px; color: var(--muted); }
.seg { display: inline-flex; background: var(--line-2); border-radius: 999px; padding: 3px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { margin: 0; padding: 6px 12px; border-radius: 999px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.seg input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg input:checked + label.l0 { color: var(--green); }
.seg input:checked + label.l1 { color: var(--blue); }
.seg input:checked + label.l2 { color: var(--ink); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); }

/* todo list */
.todo { list-style: none; margin: 0; padding: 0; }
.todo li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.todo li:last-child { border-bottom: 0; }
.todo .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.todo .danger .dot, .dot-danger { background: var(--red); }
.todo .warn .dot, .dot-warn { background: var(--amber); }
.todo .info .dot, .dot-info { background: var(--blue); }
.todo .muted .dot, .dot-muted { background: #cbd5e1; }
.todo a { color: var(--ink); }
.todo li > a { flex: 1; }

/* cache page */
.cache-tests td:first-child { font-weight: 600; }
.code-inline, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--line-2); padding: 2px 6px; border-radius: 5px; }
pre.code { background: var(--night); color: #e2e8f0; padding: 16px; border-radius: 10px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.cache-section h3 { font-size: 21px; margin: 24px 0 4px; }
.cache-section h3 small { font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--muted); }

/* login */
.auth-wrap { min-height: calc(100vh - 220px); display: grid; place-items: center; padding: 40px 16px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 34px; }

/* footer */
.footer { background: var(--night); color: #cbd5e1; padding: 28px 0; margin-top: 50px; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }
.footer strong { color: #fff; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer a { color: #fdba74; }
.footer .muted { color: #94a3b8; }

.leaflet-popup-content { font: 13.5px/1.45 var(--font); }
.leaflet-popup-content b { font-size: 14px; }
.map-pop-race { padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.map-pop-race:last-child { border-bottom: 0; }
.km-label { background: #fff; border: 2px solid var(--ink); border-radius: 50%; width: 24px !important; height: 24px !important; font: 700 10px/20px var(--font); text-align: center; color: var(--ink); margin-left: -12px !important; margin-top: -12px !important; }
.pin-start, .pin-finish { border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pin-start { background: var(--green); } .pin-finish { background: var(--ink); }

@media print {
    .topbar, .footer, .subnav, .owner-panel, .btn, .preview-bar { display: none !important; }
    body { background: #fff; }
    .card, .kpi { box-shadow: none; border: 1px solid #ddd; }
}

@media (max-width: 620px) {
    .timeline li { grid-template-columns: 70px minmax(0, 1fr); }
    .timeline li > div:last-child { display: none; }
    .hero { padding: 36px 0 56px; }
    .countdown .unit { min-width: 64px; }
}

/* metric info & verdicts */
.mtip { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; background: var(--line-2); color: var(--muted); font-size: 11px; font-weight: 700; cursor: help; margin-left: 4px; vertical-align: 1px; text-transform: none; letter-spacing: 0; }
.mtip:hover, .mtip:focus { background: var(--accent); color: #fff; outline: none; }
.verdict { font-size: 12px; font-weight: 700; }
.verdict.good { color: var(--green); } .verdict.mid { color: var(--amber); } .verdict.bad { color: var(--red); }
.glossary dt { font-weight: 700; margin-top: 14px; }
.glossary dd { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.glossary .how { color: var(--muted); font-size: 13px; }
.chart-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.chart-tools select { width: auto; padding: 6px 10px; font-size: 13px; }
.stat-note { font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 14px; }

/* statistics tabs */
.stat-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 6px 0 22px; }
.stat-tabs a { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); box-shadow: var(--shadow); transition: .15s; }
.stat-tabs a:hover { text-decoration: none; border-color: #cbd5e1; transform: translateY(-1px); }
.stat-tabs a.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 90, 31, .18), var(--shadow); }
.stat-tabs .ico { font-size: 24px; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.stat-tabs a.active .ico { background: var(--accent-soft); }
.stat-tabs b { display: block; font-size: 15px; }
.stat-tabs small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
@media (max-width: 980px) { .stat-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .stat-tabs small { display: none; } .stat-tabs a { padding: 10px; } .stat-tabs .ico { width: 34px; height: 34px; font-size: 19px; } }
.glossary-box summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; list-style: none; }
.glossary-box summary::-webkit-details-marker { display: none; }
.glossary-box[open] summary { margin-bottom: 8px; }

.check-tag { display: inline-block; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--line-2); border-radius: 5px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; text-decoration: none; }
li.done .check-tag { opacity: .6; }

/* maps: provider fallback notice and the map check page */
.map { position: relative; }
.map-notice { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 500; background: rgba(255,255,255,.95); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow); }
.check-list { list-style: none; margin: 0 0 8px; padding: 0; }
.check-list li { padding: 8px 0 8px 28px; position: relative; border-bottom: 1px solid var(--line-2); font-size: 14px; }
.check-list li:last-child { border-bottom: 0; }
.check-list li::before { position: absolute; left: 0; top: 7px; font-weight: 800; }
.check-list li.ok::before { content: "✓"; color: var(--green); }
.check-list li.bad::before { content: "✗"; color: var(--red); }
.check-list li.wait::before { content: "…"; color: var(--muted); }
.check-list li.bad { color: var(--red); }
.tile-samples { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.tile-sample { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.tile-sample img { width: 100%; height: auto; aspect-ratio: 1; background: #e5e7eb; }
.tile-sample figcaption { padding: 8px 10px; font-size: 13px; }
