/* Kaxi — one stylesheet. Tokens first, then layout, components, views. */

@font-face {
  font-family: "Jakarta";
  src: url("/fonts/jakarta-latin.woff2") format("woff2");
  font-weight: 400 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: "Jakarta";
  src: url("/fonts/jakarta-latin-ext.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #F6F5F1;
  --bg-2: #EEECE6;
  --surface: #FFFFFF;
  --surface-2: #F7F6F2;
  --ink: #14151C;
  --ink-2: #3A3C47;
  --muted: #6E717D;
  --faint: #A3A5AE;
  --line: #E8E6E0;
  --line-2: #DCDAD3;
  --accent: #FFC93C;
  --accent-2: #FFB21E;
  --accent-ink: #14151C;
  --accent-soft: #FFF4D1;
  --primary: #14151C;
  --primary-ink: #FFFFFF;
  --ok: #148A55;
  --ok-soft: #E3F5EC;
  --warn: #B86E00;
  --warn-soft: #FFF1DB;
  --bad: #D23F3F;
  --bad-soft: #FDE9E9;
  --shadow-sm: 0 1px 2px rgba(20, 21, 28, .06), 0 1px 1px rgba(20, 21, 28, .04);
  --shadow: 0 10px 30px -12px rgba(20, 21, 28, .18), 0 2px 6px rgba(20, 21, 28, .05);
  --shadow-lg: 0 24px 60px -20px rgba(20, 21, 28, .35);
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D0E12; --bg-2: #14151B; --surface: #17181F; --surface-2: #1E1F28;
    --ink: #F3F3F5; --ink-2: #CFD0D6; --muted: #9A9DAA; --faint: #6A6D79;
    --line: #262833; --line-2: #31333F;
    --accent-soft: #3A2F12; --primary: #FFC93C; --primary-ink: #14151C;
    --ok: #3CCB8A; --ok-soft: #12291F; --warn: #F2A93B; --warn-soft: #2E2312; --bad: #FF6B6B; --bad-soft: #2F1719;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D0E12; --bg-2: #14151B; --surface: #17181F; --surface-2: #1E1F28;
  --ink: #F3F3F5; --ink-2: #CFD0D6; --muted: #9A9DAA; --faint: #6A6D79;
  --line: #262833; --line-2: #31333F;
  --accent-soft: #3A2F12; --primary: #FFC93C; --primary-ink: #14151C;
  --ok: #3CCB8A; --ok-soft: #12291F; --warn: #F2A93B; --warn-soft: #2E2312; --bad: #FF6B6B; --bad-soft: #2F1719;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 60px -16px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

/* ---- base ---------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 500 15px/1.45 "Jakarta", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }
.ic-lg { width: 24px; height: 24px; }
.ic-fill { fill: currentColor; }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2.5px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }

/* ---- layout -------------------------------------------------------------------------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-t) + 8px) 16px calc(var(--tabbar-h) + var(--safe-b) + 24px);
}
.app.no-tabs { padding-bottom: calc(var(--safe-b) + 24px); }
.view { animation: view-in .35s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

.topbar {
  display: flex; align-items: center; gap: 12px;
  min-height: 56px; margin: 0 -4px 8px;
}
.topbar h1 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.topbar .sub { display: block; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.page-title { font-size: 30px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; margin: 14px 0 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 26px 2px 10px; }
.section-title button { text-transform: none; letter-spacing: 0; }

/* ---- tab bar ------------------------------------------------------------------------- */

.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + var(--safe-b));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  flex: 1; max-width: 150px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0 4px; border-radius: 14px;
  font-size: 11.5px; font-weight: 650; color: var(--muted);
  transition: color .2s;
}
.tabbar a .ic { width: 24px; height: 24px; padding: 2px; border-radius: 10px; box-sizing: content-box; width: 22px; height: 22px; padding: 4px 18px; transition: background .25s var(--ease), color .2s; }
.tabbar a.active { color: var(--ink); }
.tabbar a.active .ic { background: var(--accent); color: var(--accent-ink); }

/* ---- buttons ------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 14px; white-space: nowrap;
  font-weight: 700; font-size: 15px;
  background: var(--surface-2); color: var(--ink);
  transition: transform .12s var(--ease), background .2s, opacity .2s, box-shadow .2s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-line { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn-danger { background: var(--bad-soft); color: var(--bad); }
.btn-block { width: 100%; }
.btn-lg { min-height: 56px; font-size: 16px; border-radius: 16px; }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 13.5px; border-radius: 11px; }
.btn .spinner { width: 18px; height: 18px; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 42px; height: 42px; border-radius: 13px; border: 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: transform .12s var(--ease), background .2s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.flat { background: transparent; box-shadow: none; }
.link-btn { border: 0; background: none; padding: 6px 4px; font-weight: 700; color: var(--ink-2); font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- cards & lists ------------------------------------------------------------------- */

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.card-pad { padding: 18px; }

.list { background: var(--surface); border-radius: var(--r-lg); border: 1px solid var(--line); overflow: hidden; }
.row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; min-height: 58px;
  border: 0; background: none; text-align: left;
  border-top: 1px solid var(--line);
  transition: background .15s;
}
.row:first-child { border-top: 0; }
button.row:active, a.row:active { background: var(--surface-2); }
.row .grow { flex: 1; min-width: 0; }
.row .title, .row .sub { display: block; }
.row .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .lead {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--surface-2); color: var(--ink-2);
}
.row .lead.accent { background: var(--accent-soft); color: var(--warn); }
.row .trail { color: var(--faint); }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
  background: var(--surface-2); color: var(--ink-2);
  border: 0; white-space: nowrap;
}
.chip .ic { width: 15px; height: 15px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.accent { background: var(--accent); color: var(--accent-ink); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-scroll { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chip-scroll::-webkit-scrollbar { display: none; }
button.chip { cursor: pointer; transition: background .2s, color .2s, transform .12s; }
button.chip:active { transform: scale(.95); }
button.chip[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); }

/* ---- forms --------------------------------------------------------------------------- */

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin: 0 2px 7px; }
.input {
  width: 100%; height: 52px; padding: 0 16px;
  border-radius: 14px; border: 1.5px solid var(--line-2);
  background: var(--surface); color: var(--ink);
  font-size: 16px; font-weight: 550;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: var(--faint); font-weight: 500; }
.input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 52px; }
.input-wrap .icon-btn { position: absolute; right: 5px; top: 5px; box-shadow: none; background: transparent; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.alert .ic { margin-top: 1px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.info { background: var(--surface-2); color: var(--ink-2); }

/* ---- login --------------------------------------------------------------------------- */

.login { min-height: calc(100dvh - var(--safe-t) - 40px); display: flex; flex-direction: column; justify-content: center; padding: 24px 4px; }
.login-hero { position: relative; margin-bottom: 30px; }
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center;
  background: linear-gradient(135deg, #FFD85C, #FFB21E); color: #14151C;
  box-shadow: 0 12px 28px -10px rgba(255, 178, 30, .7);
}
.brand-mark svg { width: 46px; height: 46px; --accent: #FFC93C; }
.brand-name { font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
.login h1 { font-size: 34px; line-height: 1.08; letter-spacing: -.03em; font-weight: 800; margin: 28px 0 10px; }
.login h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--accent) 62%, var(--accent) 92%, transparent 92%); }
.login .lede { color: var(--muted); font-size: 15.5px; max-width: 34ch; }
.login form { margin-top: 6px; }
.login-foot { margin-top: 22px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.login-foot .ic { margin-top: 1px; }

/* ---- home / search ------------------------------------------------------------------- */

.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 18px; }
.hello small { display: block; color: var(--muted); font-size: 14px; font-weight: 600; }
.hello h1 { font-size: 27px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 800; font-size: 17px;
}
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }

.search-card { padding: 8px; border-radius: var(--r-xl); box-shadow: var(--shadow); }
.route-picker { position: relative; }
.stop-btn {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 64px 14px 14px; min-height: 66px;
  border: 0; background: none; text-align: left; border-radius: 18px;
  transition: background .15s;
}
.stop-btn:active { background: var(--surface-2); }
.stop-btn .dot { width: 14px; height: 14px; border-radius: 50%; border: 3.5px solid var(--ink); flex: none; margin: 0 4px; }
.stop-btn .dot.to { border-radius: 4px; background: var(--accent); border-color: var(--ink); }
.stop-btn small { display: block; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stop-btn strong { display: block; font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stop-btn strong.placeholder { color: var(--faint); font-weight: 600; }
.route-picker .divider { height: 1px; background: var(--line); margin: 0 14px 0 50px; }
.route-picker .connector { position: absolute; left: 24px; top: 46px; bottom: 46px; width: 2px; background: repeating-linear-gradient(var(--line-2) 0 4px, transparent 4px 8px); }
.swap-btn { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); }
.swap-btn.spin .ic { animation: swap .35s var(--ease); }
@keyframes swap { from { transform: rotate(-180deg); } }

.when { padding: 12px 10px 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.when-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 10px; }
.when-label strong { color: var(--ink); }
.when .chip-scroll { margin: 0 -10px; padding: 2px 10px; }
.when .chip { height: 36px; padding: 0 14px; font-size: 13.5px; }
.dt-input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.search-card .btn-primary { margin: 10px 2px 2px; width: calc(100% - 4px); }

.next-ride {
  display: block; position: relative; overflow: hidden;
  padding: 18px; border-radius: var(--r-lg);
  background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow);
}
:root[data-theme="dark"] .next-ride { background: var(--accent); color: var(--accent-ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .next-ride { background: var(--accent); color: var(--accent-ink); } }
.next-ride::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 45%, transparent), transparent); pointer-events: none; }
.next-ride .eyebrow { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; opacity: .7; display: flex; gap: 8px; align-items: center; }
.next-ride .eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 1.8s infinite; }
:root[data-theme="dark"] .next-ride .eyebrow .pulse { background: var(--accent-ink); }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.next-ride .when-big { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 6px 0 2px; }
.next-ride .route-line { font-weight: 650; opacity: .85; font-size: 14.5px; }
.next-ride .meta { display: flex; gap: 14px; margin-top: 12px; font-size: 13px; font-weight: 700; opacity: .8; }
.next-ride .meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ---- ride cards ---------------------------------------------------------------------- */

.ride {
  display: block; width: 100%; text-align: left;
  padding: 16px 16px 14px; margin-bottom: 12px;
  border-radius: var(--r-lg); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), box-shadow .2s;
  animation: view-in .4s var(--ease) both;
}
button.ride:active { transform: scale(.985); }
.ride.off { opacity: .6; }
.ride-times { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.ride-times .t { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.ride-track { position: relative; height: 22px; display: flex; align-items: center; }
.ride-track::before { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; background: var(--line-2); }
.ride-track .a, .ride-track .b { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--ink); flex: none; }
.ride-track .b { margin-left: auto; background: var(--accent); }
.ride-track .dur { position: absolute; left: 50%; transform: translateX(-50%); background: var(--surface); padding: 0 8px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ride-places { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.ride-places span:last-child { text-align: right; }
.ride-places span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ride-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line-2); }
.ride-foot .go { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 14px; }
.ride-foot .go .ic { width: 18px; height: 18px; }

.day-head { display: flex; align-items: baseline; gap: 10px; margin: 22px 2px 10px; }
.day-head strong { font-size: 15px; font-weight: 800; }
.day-head span { font-size: 13px; color: var(--muted); font-weight: 600; }

.empty { text-align: center; padding: 44px 20px; }
.empty .art { width: 76px; height: 76px; margin: 0 auto 16px; border-radius: 24px; display: grid; place-items: center; background: var(--accent-soft); color: var(--warn); }
.empty .art .ic { width: 34px; height: 34px; }
.empty h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 32ch; margin: 0 auto 18px; }

.skeleton { border-radius: var(--r-lg); height: 132px; margin-bottom: 12px; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.3s linear infinite; border: 1px solid var(--line); }
@keyframes shimmer { to { background-position: -150% 0; } }

/* ---- trips --------------------------------------------------------------------------- */

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px; background: var(--bg-2); margin-bottom: 18px; position: relative; }
.segmented button { position: relative; z-index: 1; height: 38px; border: 0; background: none; font-weight: 700; color: var(--muted); border-radius: 11px; transition: color .2s; }
.segmented button[aria-selected="true"] { color: var(--ink); }
.segmented .thumb { position: absolute; z-index: 0; top: 4px; left: 4px; width: calc(50% - 4px); height: 38px; border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .3s var(--ease); }
.segmented[data-i="1"] .thumb { transform: translateX(100%); }

.trip { display: flex; gap: 14px; align-items: stretch; width: 100%; text-align: left; padding: 14px; margin-bottom: 10px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); transition: transform .15s var(--ease); animation: view-in .4s var(--ease) both; }
.trip:active { transform: scale(.985); }
.trip .date-tile { flex: none; width: 58px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px 0; }
.trip.soon .date-tile { background: var(--accent); color: var(--accent-ink); }
.trip .date-tile b { font-size: 21px; font-weight: 800; line-height: 1.05; }
.trip .date-tile small { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; opacity: .75; }
.trip .body { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.trip .time { font-weight: 800; font-size: 16px; }
.trip .stations { font-size: 13.5px; color: var(--ink-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trip .stations .ic { width: 13px; height: 13px; vertical-align: -2px; color: var(--faint); margin: 0 2px; }
.trip .tags { display: flex; gap: 6px; margin-top: 6px; }
.trip .tags .chip { height: 24px; font-size: 11.5px; padding: 0 8px; }
.trip.past .date-tile { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }

/* ---- sheets -------------------------------------------------------------------------- */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 11, 15, .45);
  backdrop-filter: blur(2px);
  animation: fade .25s ease both;
}
.sheet-backdrop.closing { animation: fade .22s ease reverse both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: calc(100dvh - var(--safe-t) - 24px);
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-lg);
  animation: sheet-up .38s var(--ease) both;
  overscroll-behavior: contain;
}
.sheet.closing { animation: sheet-down .25s ease-in both; }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
.sheet.full { top: 0; max-height: none; border-radius: 0; padding-top: var(--safe-t); }
.sheet .grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line-2); margin: 9px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.sheet-body { overflow-y: auto; padding: 4px 16px calc(20px + var(--safe-b)); flex: 1; -webkit-overflow-scrolling: touch; }
.sheet-foot { flex: none; padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg); }
@media (min-width: 600px) {
  .sheet:not(.full) { bottom: 50%; transform: translateY(50%); border-radius: var(--r-xl); animation: sheet-pop .3s var(--ease) both; max-height: min(86dvh, 820px); }
  .sheet:not(.full).closing { animation: fade .2s ease reverse both; }
  .sheet:not(.full) .grabber { display: none; }
  .sheet.full { max-width: 560px; top: 4vh; bottom: 4vh; border-radius: var(--r-xl); }
}
@keyframes sheet-pop { from { opacity: 0; transform: translateY(calc(50% + 16px)) scale(.98); } }

/* stop picker */
.picker-search { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 4px 16px 10px; }
.picker-search .input { padding-left: 46px; }
.picker-search .ic.lead { position: absolute; left: 32px; top: 20px; color: var(--muted); }
.stop-row .grow { overflow: hidden; }
.stop-row .star { border: 0; background: none; color: var(--faint); padding: 8px; margin: -8px -8px -8px 0; border-radius: 10px; }
.stop-row .star.on { color: var(--accent-2); }
.stop-row .star.on .ic { fill: currentColor; }
.stop-row mark { background: var(--accent-soft); color: inherit; border-radius: 4px; padding: 0 1px; }
.stop-row .dist { font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }

/* booking sheet */
.map { height: 168px; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); margin-bottom: 14px; border: 1px solid var(--line); position: relative; z-index: 0; }
.map .leaflet-tile-pane { filter: saturate(.35) contrast(.95); }
:root[data-theme="dark"] .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) saturate(.3) contrast(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .map .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.85) saturate(.3) contrast(.9); } }
.map .leaflet-control-attribution { font-size: 9px; background: color-mix(in srgb, var(--surface) 80%, transparent); color: var(--muted); }
.map .leaflet-control-attribution a { color: var(--muted); }
.map-pin { width: 18px; height: 18px; border-radius: 50%; border: 4px solid #14151C; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.map-pin.to { border-radius: 5px; background: #FFC93C; }

.timeline { position: relative; padding: 4px 0 4px 30px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 18px; bottom: 18px; width: 2px; background: var(--line-2); }
.timeline .stop { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.timeline .stop::before { content: ""; position: absolute; left: -27px; top: 13px; width: 12px; height: 12px; border-radius: 50%; border: 3px solid var(--ink); background: var(--bg); }
.timeline .stop.to::before { border-radius: 4px; background: var(--accent); }
.timeline .stop b { font-size: 16px; font-weight: 750; }
.timeline .stop small { display: block; color: var(--muted); font-weight: 600; font-size: 13px; }
.timeline .stop .t { font-size: 18px; font-weight: 800; white-space: nowrap; }
.timeline .mid { color: var(--muted); font-size: 13px; font-weight: 650; padding: 4px 0; display: flex; gap: 12px; flex-wrap: wrap; }
.timeline .mid span { display: inline-flex; gap: 5px; align-items: center; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; padding: 14px 16px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; display: flex; gap: 8px; align-items: center; }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.kv dd a { text-decoration: underline; text-underline-offset: 3px; }

.stepper-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.stepper-row + .stepper-row { border-top: 1px solid var(--line); }
.stepper-row b { display: block; font-weight: 700; }
.stepper-row small { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 13px; padding: 3px; }
.stepper button { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--surface); box-shadow: var(--shadow-sm); display: grid; place-items: center; }
.stepper button[disabled] { opacity: .35; }
.stepper output { min-width: 28px; text-align: center; font-weight: 800; font-size: 16px; }

.confirm-box { text-align: center; padding: 8px 4px 2px; }
.confirm-box .summary { font-size: 15px; color: var(--ink-2); margin: 4px 0 16px; }
.btn-row { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

.success { text-align: center; padding: 18px 8px 4px; }
.success .tick { width: 84px; height: 84px; border-radius: 50%; margin: 6px auto 18px; display: grid; place-items: center; background: var(--ok); color: #fff; animation: pop .5s var(--ease) both; }
.success .tick .ic { width: 42px; height: 42px; stroke-width: 2.6; stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .45s .25s ease forwards; }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.success h3 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.success p { color: var(--muted); margin-bottom: 20px; }
.stack { display: grid; gap: 10px; }

/* ---- toasts -------------------------------------------------------------------------- */

.toasts { position: fixed; z-index: 80; left: 0; right: 0; top: calc(var(--safe-t) + 12px); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 520px; padding: 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 650; font-size: 14px; box-shadow: var(--shadow-lg); animation: toast-in .35s var(--ease) both; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok .ic { color: var(--ok); }
.toast.out { animation: toast-in .25s ease reverse both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(.97); } }

/* ---- account ------------------------------------------------------------------------- */

.profile { display: flex; align-items: center; gap: 16px; padding: 18px; }
.profile h2 { font-size: 20px; font-weight: 800; }
.profile p { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.seg-inline { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 11px; gap: 2px; }
.seg-inline button { border: 0; background: none; height: 30px; padding: 0 10px; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg-inline button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.foot-note { text-align: center; color: var(--faint); font-size: 12px; margin-top: 26px; }

/* ---- desktop polish ------------------------------------------------------------------ */

@media (min-width: 900px) {
  body { background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg); background-attachment: fixed; }
  .app { padding-top: 32px; }
  .tabbar { left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); width: 420px; border-radius: 22px; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
