/* =====================================================================
   GymCar — Design System & App UI
   Visual language: road signage & transit maps. Warm paper, black print,
   signal yellow for routes and highlights, forest green for success/eco.
   ===================================================================== */

@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage-grotesque-latin-ext-wght-normal.woff2") format("woff2-variations"); font-weight: 200 800; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Bricolage"; src: url("../fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 200 800; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument"; src: url("../fonts/instrument-sans-latin-ext-wght-normal.woff2") format("woff2-variations"); font-weight: 400 700; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Instrument"; src: url("../fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations"); font-weight: 400 700; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --signal: #FFC81E;
  --signal-600: #F2B705;
  --signal-ink: #16140F;
  --signal-50: #FFF4CF;
  --brand: #1E6B45;
  --brand-600: #18583A;
  --brand-700: #12462E;
  --brand-50: #E6F0E9;
  --brand-100: #CFE2D5;
  --accent: #2B4BD8;
  --accent-50: #E8ECFB;
  --ink: #16140F;
  --ink-2: #3B382F;
  --muted: #6E685B;
  --faint: #A29B8B;
  --line: #E5DFD2;
  --line-2: #D5CDBC;
  --bg: #F3EFE6;
  --surface: #FFFDF8;
  --surface-2: #F9F6EF;
  --surface-3: #EEE9DE;
  --danger: #C8382E;
  --danger-50: #F9E5E2;
  --warning: #A86A00;
  --warning-50: #FBF0D9;
  --info: #2B4BD8;
  --info-50: #E8ECFB;
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow-sm: none;
  --shadow: 0 1px 0 rgba(22, 20, 15, .04), 0 6px 18px -10px rgba(22, 20, 15, .18);
  --shadow-lg: 0 18px 48px -18px rgba(22, 20, 15, .35);
  --ring: 0 0 0 3px rgba(255, 200, 30, .6);
  --sidebar: 252px;
  --topbar: 64px;
  --tabbar: 66px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Instrument", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Bricolage", "Instrument", ui-sans-serif, system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #6CC795; --brand-600: #58B583; --brand-700: #8AD8AC; --brand-50: #1B2A21; --brand-100: #223828;
    --accent: #8EA2FF; --accent-50: #1E2340; --signal-50: #2E2712;
    --ink: #F2EEE4; --ink-2: #CFC8B9; --muted: #9B9485; --faint: #6A6457;
    --line: #2C2924; --line-2: #3A3730; --bg: #11100E; --surface: #191815; --surface-2: #1E1D19; --surface-3: #282621;
    --danger: #FF7468; --danger-50: #35191A; --warning: #F2B53C; --warning-50: #33270F; --info: #8EA2FF; --info-50: #1E2340;
    --shadow: 0 8px 24px -12px rgba(0,0,0,.7); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.85);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --brand: #6CC795; --brand-600: #58B583; --brand-700: #8AD8AC; --brand-50: #1B2A21; --brand-100: #223828;
    --accent: #8EA2FF; --accent-50: #1E2340; --signal-50: #2E2712;
    --ink: #F2EEE4; --ink-2: #CFC8B9; --muted: #9B9485; --faint: #6A6457;
    --line: #2C2924; --line-2: #3A3730; --bg: #11100E; --surface: #191815; --surface-2: #1E1D19; --surface-3: #282621;
    --danger: #FF7468; --danger-50: #35191A; --warning: #F2B53C; --warning-50: #33270F; --info: #8EA2FF; --info-50: #1E2340;
    --shadow: 0 8px 24px -12px rgba(0,0,0,.7); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.85);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
}
img { max-width: 100%; display: block; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.12; letter-spacing: -.025em; color: var(--ink); }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 800; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--signal); color: var(--signal-ink); }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
pre.code { background: var(--surface-3); padding: 12px 14px; border-radius: var(--r-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
[hidden] { display: none !important; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

/* ---------- Icons ---------- */
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }
.i-xl { width: 44px; height: 44px; stroke-width: 1.6; }

/* ---------- Utilities ---------- */
.row { display: flex; align-items: center; gap: 8px; }
.row.gap { gap: 14px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .84rem; }
.tiny { font-size: .74rem; }
.center { text-align: center; }
.bold { font-weight: 700; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mt-l { margin-top: 28px; }
.mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.brand-text { color: var(--brand); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.045em; color: var(--ink); text-decoration: none !important; }
.brand img { border-radius: 8px; }

/* ---------- Buttons ---------- */
.btn {
  --h: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--h); padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 650; font-size: .93rem; cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .15s, border-color .15s, color .15s, transform .08s, box-shadow .15s;
  text-decoration: none !important; background: var(--surface-3); color: var(--ink);
}
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.loading { opacity: .55; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-primary { background: var(--ink); color: var(--surface); }
.btn-primary:hover { background: var(--ink-2); }
.btn-signal { background: var(--signal); color: var(--signal-ink); }
.btn-signal:hover { background: var(--signal-600); }
.btn-dark { background: var(--ink); color: var(--surface); }
.btn-soft { background: var(--surface-3); color: var(--ink); }
.btn-soft:hover { background: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); }
.btn-outline { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--faint); }
.btn-danger { background: var(--danger-50); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { --h: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn-lg { --h: 52px; padding: 0 22px; font-size: 1rem; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--h); padding: 0; }
.btn-round { border-radius: 999px; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; }
.card-tight { padding: 14px 16px; }
.card-hover { transition: border-color .15s, box-shadow .15s, transform .15s; cursor: pointer; }
.card-hover:hover { border-color: var(--ink); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 14px; font-size: 1rem; font-weight: 750; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 1.1rem; }

/* ---------- Chips / badges ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 7px; background: var(--surface-3); color: var(--ink-2); font-size: .82rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.chip .i { width: 15px; height: 15px; }
button.chip { cursor: pointer; }
button.chip:hover { border-color: var(--line-2); }
.chip.active { background: var(--ink); color: var(--surface); }
.chip-signal { background: var(--signal); color: var(--signal-ink); }
.chip-brand { background: var(--brand-50); color: var(--brand-700); }
.chip-accent { background: var(--accent-50); color: var(--accent); }
.chip-warn { background: var(--warning-50); color: var(--warning); }
.chip-danger { background: var(--danger-50); color: var(--danger); }
.chip-info { background: var(--info-50); color: var(--info); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #E5432F; color: #fff; font-size: .68rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); display: inline-block; }

/* ---------- Avatar ---------- */
.avatar { --s: 40px; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 750; font-size: calc(var(--s) * .4); color: var(--ink); background: var(--surface-3); overflow: hidden; position: relative; font-family: var(--display); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { --s: 30px; } .avatar.lg { --s: 52px; } .avatar.xl { --s: 88px; }
.avatar .verified { position: absolute; }
.avatar-stack { display: flex; } .avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; } .avatar-stack .avatar:first-child { margin-left: 0; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span, .label { font-size: .82rem; font-weight: 650; color: var(--ink-2); }
.field .hint { font-size: .78rem; color: var(--muted); font-weight: 500; }
.input, .field input, .field select, .field textarea {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { height: auto; min-height: 92px; padding: 12px 14px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--ink); box-shadow: var(--ring); }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .8rem; font-weight: 600; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 42px; }
.input-icon .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; background: var(--line-2); border-radius: 999px; transition: background .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + i { background: var(--ink); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { box-shadow: var(--ring); }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 2px; width: 100%; }
.segmented button { flex: 1; height: 36px; border: 0; background: transparent; border-radius: 9px; font-weight: 650; font-size: .87rem; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; padding: 0 10px; }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.stepper { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-3); border-radius: 12px; padding: 4px; }
.stepper button { width: 38px; height: 38px; border-radius: 9px; border: 0; background: var(--surface); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); }
.stepper button:disabled { opacity: .4; }
.stepper output { min-width: 42px; text-align: center; font-weight: 800; font-size: 1.1rem; }

.daypick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.daypick button { height: 42px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-size: .82rem; cursor: pointer; }
.daypick button.active { background: var(--signal); color: var(--signal-ink); border-color: var(--signal-ink); }

/* ---------- Alerts ---------- */
.alert { padding: 12px 14px; border-radius: var(--r); font-size: .9rem; display: flex; gap: 10px; align-items: flex-start; }
.alert-info { background: var(--info-50); color: var(--info); }
.alert-warn { background: var(--warning-50); color: var(--warning); }
.alert-danger { background: var(--danger-50); color: var(--danger); }
.alert-success { background: var(--brand-50); color: var(--brand-700); }
.alert b { font-weight: 750; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 40;
}
.sidebar .brand { padding: 4px 10px 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav button {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 12px; color: var(--ink-2);
  font-weight: 620; font-size: .93rem; text-decoration: none !important; position: relative; border: 0; background: none; cursor: pointer; width: 100%; text-align: left;
}
.nav a:hover, .nav button:hover { background: var(--surface-3); color: var(--ink); }
.nav a.active { background: var(--surface-3); color: var(--ink); box-shadow: inset 3px 0 0 var(--signal); }
.nav .badge { margin-left: auto; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 750; padding: 18px 12px 6px; }
.nav-cta { margin: 14px 0 6px; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; cursor: pointer; color: inherit; text-decoration: none !important; }
.user-chip:hover { background: var(--surface-3); }

.main { margin-left: var(--sidebar); min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: calc(var(--topbar) + var(--safe-t)); padding: var(--safe-t) 28px 0;
  display: flex; align-items: center; gap: 12px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 800; }
.topbar .back { margin-left: -8px; }
.topbar .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.icon-btn { position: relative; width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; }
.page { padding: 8px 28px 48px; max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 720px; }
.page.full { max-width: none; padding: 0; }

.tabbar { display: none; }
.mobile-only { display: none; }

@media (max-width: 960px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding-bottom: calc(var(--tabbar) + var(--safe-b)); }
  .topbar { padding: var(--safe-t) 12px 0 16px; }
  .page { padding: 4px 16px 28px; }
  .mobile-only { display: initial; }
  .desktop-only { display: none !important; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    height: calc(var(--tabbar) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-top: 1px solid var(--line);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--faint); font-size: .68rem; font-weight: 700; text-decoration: none !important; position: relative; }
  .tabbar a.active { color: var(--ink); }
  .tabbar a.active .i { stroke-width: 2.4; }
  .tabbar a .badge { position: absolute; top: 8px; left: 52%; }
  .tabbar .fab { width: 52px; height: 52px; border-radius: 14px; background: var(--signal); color: #16140F; display: flex; align-items: center; justify-content: center; border: 2px solid #16140F; margin-top: -18px; }
  .tabbar .fab .i { width: 26px; height: 26px; }
}

/* ---------- Ride cards ---------- */
.ride-card { display: grid; grid-template-columns: 1fr auto; gap: 12px 16px; padding: 16px 18px; }
.ride-card .route { display: grid; grid-template-columns: 52px 14px 1fr; gap: 0 10px; align-items: start; }
.ride-card .t { font-family: var(--display); font-weight: 750; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.ride-card .rail { display: flex; flex-direction: column; align-items: center; height: 100%; padding-top: 6px; }
.ride-card .rail i { width: 10px; height: 10px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--surface); flex: none; }
.ride-card .rail b { flex: 1; width: 2px; background: var(--line-2); margin: 3px 0; min-height: 18px; }
.ride-card .rail i.end { background: var(--ink); }
.ride-card .place { font-weight: 650; line-height: 1.3; }
.ride-card .place small { display: block; color: var(--muted); font-weight: 500; font-size: .8rem; margin-top: 1px; }
.ride-card .price { text-align: right; }
.ride-card .price b { font-family: var(--display); font-size: 1.38rem; font-weight: 800; letter-spacing: -.035em; }
.ride-card .foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.ride-card.selected { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--signal); }
.ride-card .walk { color: var(--muted); font-size: .76rem; display: inline-flex; align-items: center; gap: 4px; }
.rating { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: .85rem; }
.rating .i { width: 14px; height: 14px; fill: var(--signal); stroke: var(--signal-ink); stroke-width: 1.5; }
.stars { display: inline-flex; gap: 2px; }
.stars .i { fill: var(--line-2); stroke: var(--line-2); }
.stars .on { fill: var(--signal); stroke: var(--signal-ink); stroke-width: 1.5; }

.timeline { display: flex; flex-direction: column; gap: 0; position: relative; }
.tl-item { display: grid; grid-template-columns: 18px 1fr; gap: 12px; position: relative; padding-bottom: 16px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; left: 8px; top: 16px; bottom: -2px; width: 2px; background: var(--line-2); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--ink); background: var(--surface); margin-top: 2px; z-index: 1; }
.tl-dot.mid { width: 12px; height: 12px; margin: 5px 3px; border-width: 2px; border-color: var(--faint); }
.tl-dot.end { background: var(--ink); border-color: var(--ink); }
.tl-dot.me { border-color: #16140F; background: var(--signal); }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, button.list-item:hover { background: var(--surface-2); }
button.list-item { border-left: 0; border-right: 0; border-top: 0; background: none; width: 100%; text-align: left; cursor: pointer; }
.list-item .meta { margin-left: auto; text-align: right; flex: none; }
.list-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-3); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; }
.list-icon.brand { background: var(--signal); color: #16140F; }
.list-icon.accent { background: var(--accent-50); color: var(--accent); }
.list-icon.warn { background: var(--warning-50); color: var(--warning); }
.list-icon.danger { background: var(--danger-50); color: var(--danger); }
.list-item.unread { background: var(--signal-50); }

/* ---------- Grids & tiles ---------- */
.grid { display: grid; gap: 16px; }
.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)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
.stat { padding: 16px 18px; }
.stat .lbl { font-size: .8rem; color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 6px; }
.stat .val { font-family: var(--display); font-size: 1.9rem; font-weight: 750; letter-spacing: -.045em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .val small { font-size: .9rem; color: var(--muted); font-weight: 650; margin-left: 2px; }

.hero-card {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 26px; color: #16140F; background: var(--signal);
}
.hero-card h1, .hero-card h2 { color: #16140F; }
.hero-card .muted { color: rgba(22,20,15,.68); }
.hero-card::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 260px; pointer-events: none; background: repeating-linear-gradient(-45deg, rgba(22,20,15,.08) 0 14px, transparent 14px 28px); -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%); }

.quick-search { background: var(--surface); border-radius: var(--r-lg); padding: 6px; color: var(--ink); position: relative; z-index: 2; border: 2px solid #16140F; }
.qs-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.qs-row + .qs-row { border-top: 1px solid var(--line); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .i-xl { color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin: 6px 0; }

.badge-tile { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: var(--r); background: var(--surface-2); text-align: center; font-size: .76rem; font-weight: 650; color: var(--muted); }
.badge-tile .ico { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; background: var(--surface-3); color: var(--faint); }
.badge-tile.earned { color: var(--ink); }
.badge-tile.earned .ico { background: var(--signal); color: #16140F; border: 2px solid #16140F; }
.badges-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }

.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--signal); border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(22,20,15,.2); }

/* ---------- Map ---------- */
.map { width: 100%; height: 100%; min-height: 240px; background: var(--surface-3); z-index: 1; }
.map-card { border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line); height: 280px; position: relative; }
.leaflet-container { font-family: var(--font); background: var(--surface-3); }
.leaflet-tile-pane { filter: saturate(.38) sepia(.14) contrast(.96) brightness(1.02); }
.map-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.88) saturate(.7); }
.leaflet-control-attribution { font-size: 10px !important; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: var(--ink) !important; border-color: var(--line) !important; width: 36px !important; height: 36px !important; line-height: 36px !important; }
.leaflet-popup-content-wrapper { border-radius: 14px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; font-size: .88rem; }
.map-pin { width: 22px; height: 22px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.35); background: var(--ink); }
.map-pin.pin-origin { background: #16140F; }
.map-pin.pin-dest { background: #16140F; border-radius: 6px; }
.map-pin.pin-pickup { background: var(--signal); border-color: #16140F; border-width: 3px; }
.map-pin.pin-drop { background: var(--signal); border-color: #16140F; border-width: 3px; border-radius: 5px; }
.map-pin.pin-stop { width: 16px; height: 16px; border-width: 3px; background: #94A3B8; }
.map-pin.pin-req { background: #16140F; border-color: var(--signal); }
.map-pin.pin-me { background: #2F7CF6; box-shadow: 0 0 0 6px rgba(47,124,246,.25); }
.map-school { width: 38px; height: 38px; border-radius: 9px; background: #16140F; color: var(--signal); display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(0,0,0,.35); border: 3px solid #fff; }
.map-school .i { width: 18px; height: 18px; }
.map-car { width: 38px; height: 38px; border-radius: 50%; background: var(--signal); color: #16140F; display: flex; align-items: center; justify-content: center; border: 3px solid #16140F; box-shadow: 0 4px 12px rgba(0,0,0,.3); animation: pulse 2s infinite; }
.map-car .i { width: 18px; height: 18px; }
.map-label { background: var(--surface); color: var(--ink); padding: 4px 9px; border-radius: 999px; font-weight: 750; font-size: .75rem; box-shadow: var(--shadow); white-space: nowrap; border: 1px solid var(--line); }
.map-overlay { position: absolute; z-index: 500; }
.map-center-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); z-index: 600; pointer-events: none; color: var(--ink); filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.map-center-pin .i { width: 44px; height: 44px; fill: var(--signal); stroke: #16140F; stroke-width: 1.6; }

/* Split layout: list + map */
.split { display: grid; grid-template-columns: minmax(380px, 460px) 1fr; height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); }
.split-list { overflow-y: auto; padding: 4px 20px 32px 28px; }
.split-map { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); height: calc(100dvh - var(--topbar)); padding: 0 16px 16px 0; }
.split-map .map { border-radius: var(--r-xl); border: 1px solid var(--line); }
@media (max-width: 960px) {
  .split { display: flex; flex-direction: column; height: auto; }
  .split-map { order: -1; position: relative; top: 0; height: 34vh; min-height: 220px; padding: 8px 16px 0; }
  .split-list { padding: 12px 16px 24px; overflow: visible; }
}

/* ---------- Place input ---------- */
.place-input { position: relative; }
.place-input .dropdown { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); z-index: 1000; max-height: 340px; overflow-y: auto; padding: 6px; }
.place-input .opt { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; }
.place-input .opt:hover, .place-input .opt.hl { background: var(--surface-3); }
.place-input .opt .list-icon { width: 34px; height: 34px; border-radius: 10px; }
.place-input .opt b { font-weight: 650; display: block; line-height: 1.25; }
.place-input .opt small { color: var(--muted); }
.place-input .dd-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 750; padding: 8px 10px 4px; }
.place-field { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.place-field:focus-within { border-color: var(--ink); box-shadow: var(--ring); }
.place-field input { flex: 1; border: 0; outline: 0; background: transparent; height: 100%; min-width: 0; font-weight: 600; }
.place-field input::placeholder { font-weight: 500; color: var(--faint); }
.place-field .mk { width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); flex: none; }
.place-field .mk.end { background: var(--ink); border-radius: 3px; }
.place-field .mk.stop { border-color: var(--faint); width: 10px; height: 10px; }
.swap-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--shadow-sm); }
.place-stack { position: relative; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Modal / sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8, 12, 20, .5); z-index: 900; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade .18s ease; backdrop-filter: blur(2px); }
.modal { background: var(--surface); border-radius: var(--r-xl); width: 100%; max-width: 520px; max-height: calc(100dvh - 40px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .22s cubic-bezier(.2,.9,.3,1.2); }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h3 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 10px 20px 20px; }
.modal-foot { padding: 12px 20px 20px; display: flex; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 640px) {
  .overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 24px 24px 0 0; max-height: 92dvh; animation: up .28s cubic-bezier(.2,.9,.3,1); padding-bottom: var(--safe-b); }
  .modal::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 8px auto 0; }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 420px); pointer-events: none; }
@media (max-width: 960px) { .toasts { bottom: calc(var(--tabbar) + var(--safe-b) + 12px); } }
.toast { pointer-events: auto; background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; animation: up .25s ease; width: 100%; cursor: default; }
.toast.ok .i { color: var(--signal); } .toast.err .i { color: #FF8A7E; }
.toast.click { cursor: pointer; }
.toast .t-body { flex: 1; min-width: 0; }
.toast .t-body small { display: block; opacity: .7; font-weight: 500; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar)); max-width: 820px; margin: 0 auto; }
@media (max-width: 960px) { .chat { height: calc(100dvh - var(--topbar) - var(--tabbar) - var(--safe-b)); } }
.chat-head { padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-body { flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: 78%; padding: 9px 13px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--ink); color: var(--surface); border-color: transparent; border-bottom-right-radius: 4px; }
.msg:not(.mine) { border-bottom-left-radius: 6px; }
.msg-time { font-size: .68rem; color: var(--faint); align-self: flex-start; margin: 0 6px 8px; }
.msg-time.mine { align-self: flex-end; }
.msg a { color: inherit; text-decoration: underline; }
.chat-day { align-self: center; font-size: .72rem; font-weight: 700; color: var(--muted); background: var(--surface-3); padding: 3px 10px; border-radius: 999px; margin: 10px 0; }
.chat-input { display: flex; gap: 8px; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--surface); align-items: flex-end; }
@media (max-width: 960px) { .chat-input { padding-bottom: 10px; } }
.chat-input textarea { flex: 1; resize: none; border: 1px solid var(--line-2); border-radius: 20px; padding: 10px 16px; max-height: 120px; min-height: 42px; height: 42px; background: var(--surface-2); outline: none; }
.chat-input textarea:focus { border-color: var(--ink); }
.quick-replies { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; scrollbar-width: none; background: var(--surface); }
.quick-replies::-webkit-scrollbar { display: none; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { position: relative; overflow: hidden; background: var(--signal); color: #16140F; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art .brand { color: #16140F; }
.auth-art::before { content: ""; position: absolute; z-index: 0; right: -140px; bottom: -140px; width: 380px; height: 380px; border: 34px solid #16140F; border-radius: 50%; border-left-color: transparent; border-bottom-color: transparent; transform: rotate(-20deg); }
.auth-art > * { position: relative; z-index: 1; }
.auth-brand-m { display: none !important; }
@media (max-width: 900px) { .auth-brand-m { display: inline-flex !important; } }
.auth-art h2 { color: #16140F; font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1.1; max-width: 520px; letter-spacing: -.035em; }
.auth-art .points { display: grid; gap: 14px; margin-top: 24px; max-width: 460px; }
.auth-art .points div { display: flex; gap: 12px; align-items: flex-start; color: #16140F; font-weight: 500; }
.auth-art .points .i { color: #16140F; margin-top: 2px; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; background: var(--surface); }
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { margin: 0 0 6px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: .9rem; color: var(--muted); }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth-art { display: none; } .auth-form { align-items: flex-start; padding-top: calc(32px + var(--safe-t)); } }

/* ---------- Misc ---------- */
.status-banner { padding: 12px 14px; border-radius: var(--r); background: var(--surface-3); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.status-banner[data-state="in_progress"] { background: var(--signal); color: #16140F; }
.status-banner[data-state="completed"] { background: var(--info-50); color: var(--info); }
.status-banner[data-state="cancelled"] { background: var(--danger-50); color: var(--danger); }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #E5432F; box-shadow: 0 0 0 0 rgba(229,67,47,.6); animation: pulse 1.6s infinite; flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 650; text-align: right; }
.price-big { font-family: var(--display); font-size: 2.2rem; font-weight: 800; letter-spacing: -.05em; }
.sticky-cta { position: sticky; bottom: 0; padding: 14px 0 4px; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 960px) { .sticky-cta { bottom: calc(var(--tabbar) + var(--safe-b)); } }
.skel { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 10px; }
.skel-card { height: 118px; border-radius: var(--r-lg); margin-bottom: 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 750; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--surface-2); }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; }
.bars > div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 1px; height: 100%; position: relative; }
.bars > div > i { display: block; border-radius: 3px 3px 0 0; min-height: 1px; }
.bars > div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--surface); font-size: .7rem; padding: 4px 7px; border-radius: 6px; white-space: nowrap; z-index: 3; margin-bottom: 4px; }
.legend { display: flex; gap: 14px; font-size: .78rem; color: var(--muted); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { padding: 10px 14px; font-weight: 650; color: var(--muted); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; text-decoration: none !important; display: inline-flex; gap: 6px; align-items: center; font-size: .92rem; }
.tabs .active { color: var(--ink); border-bottom-color: var(--ink); }
.install-banner { display: flex; align-items: center; gap: 14px; }
.wizard-steps { display: flex; gap: 6px; margin-bottom: 20px; }
.wizard-steps i { flex: 1; height: 4px; border-radius: 9px; background: var(--line); }
.wizard-steps i.on { background: var(--ink); }
.pref-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pref-opt { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); cursor: pointer; font-weight: 600; font-size: .88rem; background: var(--surface); }
.pref-opt.active { border-color: var(--ink); background: var(--signal-50); box-shadow: inset 0 0 0 1px var(--ink); }
.tag-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-pick button { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 650; font-size: .85rem; cursor: pointer; }
.tag-pick button.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.star-pick { display: flex; gap: 6px; justify-content: center; }
.star-pick button { border: 0; background: none; cursor: pointer; padding: 4px; }
.star-pick .i { width: 40px; height: 40px; fill: var(--line); stroke: var(--line-2); stroke-width: 1.4; transition: transform .1s; }
.star-pick button.on .i { fill: var(--signal); stroke: #16140F; }
.star-pick button:hover .i { transform: scale(1.12); }
.rank-num { width: 30px; text-align: center; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.rank-1 .rank-num { color: var(--ink); } .rank-2 .rank-num { color: #8C9BAB; } .rank-3 .rank-num { color: #C46F2B; }
.banner-ann { border-radius: var(--r); padding: 12px 16px; border: 1px solid currentColor; margin-bottom: 16px; display: flex; gap: 10px; align-items: center; font-weight: 600; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes up { from { opacity: 0; transform: translateY(24px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(229,67,47,.45); } 70% { box-shadow: 0 0 0 12px rgba(229,67,47,0); } 100% { box-shadow: 0 0 0 0 rgba(229,67,47,0); } }
.fade-in { animation: fade .25s ease; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- display type ---------- */
.topbar h1, .card-title, .section-title h2, .modal-head h3 { font-family: var(--display); }
.tl-item b { font-family: var(--display); font-weight: 700; }
.leaflet-container { background: #EAE6DC; }
