:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #11151b;
  --panel-2: #171c23;
  --panel-3: #1e252e;
  --line: rgba(255,255,255,.09);
  --text: #f3f0e9;
  --muted: #929aa6;
  --gold: #e5b65d;
  --gold-soft: rgba(229,182,93,.14);
  --green: #7bd29b;
  --green-soft: rgba(123,210,155,.13);
  --orange: #f07142;
  --red: #f07878;
  --purple: #b69aff;
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.fine-print { color: var(--muted); font-size: 11px; line-height: 1.5; }
.eyebrow { margin: 0 0 8px; color: var(--gold); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.04em; }
h2 { margin-bottom: 8px; font-size: 25px; letter-spacing: -.03em; }
h3 { margin-bottom: 4px; font-size: 15px; }

.auth-screen { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); min-height: 100vh; background: radial-gradient(circle at 15% 20%, rgba(229,182,93,.11), transparent 32%), var(--bg); }
.auth-art { display: flex; flex-direction: column; justify-content: center; padding: 8vw; background: linear-gradient(135deg, rgba(255,255,255,.02), transparent 52%), url('/assets/track_mode_map.jpeg') center/cover; position: relative; isolation: isolate; }
.auth-art::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(9,11,15,.94), rgba(9,11,15,.65), rgba(9,11,15,.9)); z-index: -1; }
.auth-art h1 { max-width: 520px; margin: 14px 0; font-size: clamp(54px, 7vw, 94px); line-height: .92; }
.auth-art h1 span { color: var(--gold); }
.auth-art > .muted { max-width: 360px; }
.brand-mark { width: 58px; height: 58px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 18px; color: var(--gold); font-weight: 900; letter-spacing: -.08em; }
.auth-card { width: min(440px, calc(100% - 48px)); align-self: center; justify-self: center; padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: rgba(17,21,27,.84); box-shadow: 0 24px 90px rgba(0,0,0,.3); }
.brand-lockup, .sidebar-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 17px; font-weight: 800; letter-spacing: -.04em; text-decoration: none; }
.brand-dot { width: 12px; height: 12px; display: inline-block; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 6px rgba(229,182,93,.12); }
.auth-card .eyebrow { margin-top: 62px; }
.auth-card h2 { font-size: 33px; }
label { display: grid; gap: 8px; margin: 18px 0; color: #cbd0d8; font-size: 12px; font-weight: 700; }
input, select { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #0d1015; color: var(--text); }
textarea { width: 100%; min-height: 90px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; resize: vertical; background: #0d1015; color: var(--text); }
input:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.button { min-height: 42px; padding: 0 17px; border: 1px solid transparent; border-radius: 10px; color: var(--text); background: var(--panel-3); font-weight: 800; transition: .2s ease; }
.button:hover { transform: translateY(-1px); filter: brightness(1.1); }
.button-primary { background: var(--gold); color: #17120a; }
.button-danger { background: var(--red); color: #211010; }
.button-ghost { border-color: var(--line); background: transparent; color: var(--text); }
.button-subtle { padding: 0 11px; min-height: 34px; border-color: var(--line); background: transparent; color: var(--muted); font-size: 12px; }
.button-wide { width: 100%; margin-top: 9px; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 250px; flex: 0 0 250px; min-height: 100vh; display: flex; flex-direction: column; padding: 28px 16px 18px; border-right: 1px solid var(--line); background: #0c0f14; }
.sidebar-brand { padding: 0 13px 30px; }
.demo-banner, .global-notice { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.demo-banner { margin: 0 9px 28px; padding: 9px 11px; border: 1px solid var(--gold-soft); border-radius: 8px; background: rgba(229,182,93,.06); }
.status-dot { width: 7px; height: 7px; flex: 0 0 7px; display: inline-block; border-radius: 50%; }
.status-green { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.status-gold { background: var(--gold); box-shadow: 0 0 0 4px var(--gold-soft); }
.status-red { background: var(--red); }
.nav-label { margin: 21px 12px 9px; color: #606975; font-size: 10px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.nav-item { width: 100%; display: flex; align-items: center; gap: 12px; margin: 2px 0; padding: 11px 13px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; text-align: left; font-size: 13px; font-weight: 700; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--panel-3); }
.nav-item.active { box-shadow: inset 3px 0 var(--gold); }
.nav-icon { width: 17px; color: var(--gold); text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; }
.mini-user { display: flex; align-items: center; gap: 10px; margin: 20px 8px 0; padding-top: 17px; border-top: 1px solid var(--line); font-size: 12px; }
.mini-user small, .mini-user strong { display: block; }
.mini-user small { margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 500; }
.avatar { width: 34px; height: 34px; display: inline-grid; place-items: center; flex: 0 0 34px; border: 1px solid rgba(229,182,93,.5); border-radius: 50%; color: var(--gold); background: var(--gold-soft); font-size: 11px; font-weight: 900; }
.avatar-small { width: 28px; height: 28px; flex-basis: 28px; font-size: 10px; }

.main-content { width: calc(100% - 250px); min-width: 0; }
.topbar { min-height: 92px; display: flex; align-items: center; justify-content: space-between; padding: 25px clamp(22px, 4vw, 58px); border-bottom: 1px solid var(--line); background: rgba(9,11,15,.9); }
.topbar h1 { font-size: 27px; }
.topbar-actions, .profile-chip { display: flex; align-items: center; gap: 12px; }
.icon-button, .profile-chip, .mobile-menu { position: relative; border: 0; background: transparent; color: var(--text); }
.icon-button { font-size: 21px; }
.notification-badge { position: absolute; top: -4px; right: -5px; width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: var(--orange); color: #fff; font-size: 8px; }
.profile-chip { padding: 4px; font-size: 12px; font-weight: 700; }
.chevron { color: var(--muted); }
.mobile-menu { display: none; font-size: 22px; }
.global-notice { margin: 22px clamp(22px, 4vw, 58px) 0; padding: 11px 13px; border: 1px solid rgba(229,182,93,.16); border-radius: 10px; background: rgba(229,182,93,.05); }
.global-notice button { margin-left: auto; border: 0; color: var(--muted); background: transparent; font-size: 20px; }
.view-root { padding: 29px clamp(22px, 4vw, 58px) 80px; }
.view-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-heading p { margin-bottom: 0; }
.actions { display: flex; gap: 9px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.card:hover { border-color: rgba(229,182,93,.25); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.card-header h2, .card-header h3 { margin: 0; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 100px; background: var(--panel-3); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.tag-gold { color: var(--gold); background: var(--gold-soft); }
.tag-green { color: var(--green); background: var(--green-soft); }
.tag-purple { color: var(--purple); background: rgba(182,154,255,.12); }
.metric { font-size: 28px; font-weight: 800; letter-spacing: -.06em; }
.metric-label { margin-top: 4px; color: var(--muted); font-size: 11px; }
.metric-up { color: var(--green); font-size: 11px; font-weight: 800; }
.hero-card { min-height: 230px; display: grid; grid-template-columns: 1.25fr .75fr; overflow: hidden; background: linear-gradient(110deg, #171b20, #16191f 48%, rgba(104,75,34,.43)), url('/assets/bike_image.jpg') right/cover; }
.hero-card .hero-copy { display: flex; flex-direction: column; justify-content: center; }
.hero-card h2 { max-width: 440px; font-size: clamp(27px, 4vw, 45px); line-height: 1.02; }
.hero-card .muted { max-width: 410px; }
.hero-card .actions { margin-top: 12px; }
.stat-card { min-height: 124px; }
.stat-card .card-header { margin-bottom: 13px; }
.stat-icon { color: var(--gold); font-size: 21px; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; margin-top: 16px; }
.list { display: grid; gap: 9px; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.015); }
.list-row:hover { background: var(--panel-2); }
.list-main { min-width: 0; display: flex; align-items: center; gap: 11px; }
.list-main > div { min-width: 0; }
.list-main strong, .list-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-main small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.list-value { color: var(--gold); font-weight: 800; white-space: nowrap; }
.bike-thumb { width: 37px; height: 37px; flex: 0 0 37px; border-radius: 9px; object-fit: cover; }
.event-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--gold); }
.event-dot.green { background: var(--green); }.event-dot.purple { background: var(--purple); }
.section-space { margin-top: 16px; }
.empty-state { padding: 35px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }
.empty-state .mode-symbol { margin-bottom: 10px; }
.trace { position: relative; height: 190px; overflow: hidden; border-radius: 12px; background: linear-gradient(145deg, rgba(45,58,55,.9), rgba(21,31,34,.95)), url('/assets/track_mode_map.jpeg') center/cover; }
.trace::before, .trace::after { content: ""; position: absolute; inset: 24px 9%; border: 3px solid rgba(229,182,93,.9); border-radius: 48% 52% 47% 53% / 42% 40% 60% 58%; transform: rotate(-17deg); box-shadow: 0 0 0 7px rgba(229,182,93,.1), 0 0 22px rgba(229,182,93,.35); }
.trace::after { inset: 48px 22%; border-width: 2px; border-color: rgba(123,210,155,.8); box-shadow: none; transform: rotate(-17deg); }
.trace-label { position: absolute; bottom: 12px; left: 13px; z-index: 1; padding: 5px 8px; border-radius: 6px; background: rgba(9,11,15,.72); color: var(--muted); font-size: 10px; }
.route-svg { position: absolute; inset: 13px 8%; width: 84%; height: calc(100% - 26px); overflow: visible; filter: drop-shadow(0 0 7px rgba(229,182,93,.35)); }
.analysis-line { margin-top: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(9,11,15,.42); }
.analysis-line svg { display: block; width: 100%; height: 170px; overflow: visible; }
.line-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; color: var(--muted); font-size: 11px; }
.line-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; }
.legend-actual { background: var(--gold); }
.legend-ideal { background: var(--green); }
.progress { height: 7px; overflow: hidden; border-radius: 99px; background: var(--panel-3); }.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--green)); }
.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 17px; }.filter-bar input { max-width: 240px; }.filter-bar select { width: auto; min-width: 120px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }.form-grid label { margin: 18px 0 0; }
.record-card { display: grid; grid-template-columns: 1fr .8fr; gap: 20px; align-items: center; background: linear-gradient(120deg, var(--panel), rgba(104,75,34,.25)); }
.record-card h2 { font-size: 33px; }.record-card .mode-pills { display: flex; gap: 8px; margin: 18px 0; }.mode-pill { padding: 8px 10px; border-radius: 100px; color: var(--muted); background: var(--panel-3); font-size: 11px; font-weight: 800; }.mode-pill.active { color: var(--gold); background: var(--gold-soft); }
.record-readiness { display: grid; gap: 9px; }.readiness-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px; border-radius: 9px; background: rgba(0,0,0,.2); color: var(--muted); font-size: 12px; }.readiness-row strong { color: var(--green); font-size: 11px; }
.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }.metric-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 15px 0; }.metric-box { padding: 14px; border-radius: 11px; background: var(--panel-2); }.metric-box .metric { font-size: 22px; }.metric-box small { color: var(--muted); font-size: 10px; }
.profile-cover { display: flex; align-items: center; gap: 18px; padding: 23px; background: linear-gradient(100deg, rgba(229,182,93,.14), transparent 60%), var(--panel); }.profile-avatar { width: 70px; height: 70px; display: grid; place-items: center; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); background: var(--gold-soft); font-size: 21px; font-weight: 900; }.profile-cover h2 { margin-bottom: 4px; }.profile-cover p { margin: 0; color: var(--muted); }
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }.profile-grid .wide { grid-column: 1 / -1; }
.skill-ring { width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--gold) 0 78%, var(--panel-3) 78% 100%); }.skill-ring::before { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; background: var(--panel); }.skill-ring span { position: relative; font-size: 20px; font-weight: 800; }
.tracker { min-height: 350px; display: grid; place-items: center; background: linear-gradient(145deg, rgba(35,61,58,.85), rgba(15,26,30,.97)), url('/assets/track_mode_map.jpeg') center/cover; }.tracker-inner { width: 68%; height: 70%; display: grid; place-items: center; border: 3px solid rgba(123,210,155,.75); border-radius: 48% 52% 42% 58%; transform: rotate(-13deg); box-shadow: 0 0 0 13px rgba(123,210,155,.08), 0 0 45px rgba(123,210,155,.25); }.tracker-pin { width: 18px; height: 18px; border: 4px solid #fff; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 10px rgba(240,113,66,.18); }
.tuner-card { display: flex; align-items: center; gap: 15px; }.tuner-logo { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 12px; color: var(--gold); background: var(--gold-soft); font-weight: 900; }.tuner-card .list-main { flex: 1; }
.challenge-card { min-height: 160px; background: linear-gradient(135deg, rgba(182,154,255,.14), transparent 70%), var(--panel); }
.modal { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; padding: 20px; background: rgba(0,0,0,.75); }.modal-card { position: relative; width: min(510px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 24px 90px #000; }.modal-close { position: absolute; top: 14px; right: 16px; border: 0; color: var(--muted); background: transparent; font-size: 25px; }.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }.mode-card { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; color: var(--text); background: var(--panel-2); text-align: left; }.mode-card:hover { border-color: var(--gold); background: var(--gold-soft); }.mode-card small { color: var(--muted); }.mode-symbol { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; color: var(--gold); background: var(--gold-soft); font-size: 20px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: 360px; padding: 13px 16px; border: 1px solid var(--green); border-radius: 10px; opacity: 0; transform: translateY(10px); background: #102118; color: var(--green); pointer-events: none; transition: .2s ease; }.toast.show { opacity: 1; transform: translateY(0); }
.mobile-nav { display: none; }

@media (max-width: 1050px) { .grid-4 { grid-template-columns: repeat(2, 1fr); }.hero-card { grid-template-columns: 1fr; }.hero-card::after { display: none; }.split, .detail-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .auth-screen { display: block; }.auth-art { min-height: 38vh; padding: 40px 28px 32px; }.auth-art h1 { margin: 8px 0; font-size: 50px; }.auth-art > .muted { display: none; }.auth-card { width: calc(100% - 32px); margin: -20px auto 30px; padding: 28px 22px; position: relative; }.auth-card .eyebrow { margin-top: 40px; }.sidebar { position: fixed; z-index: 8; top: 0; bottom: 0; left: -270px; transition: left .2s ease; }.sidebar.open { left: 0; }.main-content { width: 100%; padding-bottom: 64px; }.topbar { min-height: 80px; padding: 19px 18px; }.mobile-menu { display: inline-block; margin-right: 12px; }.topbar > div:first-of-type { margin-right: auto; }.topbar .eyebrow { font-size: 8px; }.topbar h1 { font-size: 22px; }.desktop-only { display: none; }.global-notice { margin: 14px 18px 0; font-size: 10px; }.view-root { padding: 22px 18px 42px; }.view-heading { display: block; }.view-heading .actions { margin-top: 14px; }.grid-4, .grid-3, .grid-2, .profile-grid { grid-template-columns: 1fr; }.profile-grid .wide { grid-column: auto; }.record-card { grid-template-columns: 1fr; }.metric-strip { grid-template-columns: repeat(2, 1fr); }.mode-grid { grid-template-columns: 1fr; }.mobile-nav { position: fixed; z-index: 7; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 7px 6px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(12,15,20,.97); }.mobile-nav button { display: grid; gap: 3px; place-items: center; border: 0; color: var(--muted); background: transparent; font-size: 9px; }.mobile-nav button span { color: var(--gold); font-size: 17px; }.mobile-nav button.active { color: var(--text); }.tracker { min-height: 280px; } }
