:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(9, 19, 31, 0.94);
  --panel-2: rgba(13, 28, 44, 0.96);
  --muted: #a9bfd4;
  --text: #f2f6fb;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #39d98a;
  --accent-2: #19593b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --sheet-height: 42vh;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top, rgba(57, 217, 138, 0.15), transparent 26%),
    radial-gradient(circle at bottom right, rgba(59, 167, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #071019 0%, #091827 100%);
  color: var(--text);
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f3f4f6;
  --panel-2: #ffffff;
  --muted: #6b7280;
  --text: #111827;
  --line: #e5e7eb;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --shadow: 0 18px 40px rgba(17, 24, 39, 0.12);
  background:
    radial-gradient(circle at top, rgba(34, 197, 94, 0.12), transparent 26%),
    radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.08), transparent 30%),
    linear-gradient(180deg, #071019 0%, #091827 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 12px;
}

.screen {
  width: min(100%, 430px);
  height: min(100vh - 24px, 932px);
  position: relative;
  overflow: hidden;
  background: #0c1522;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 32px;
  box-shadow: var(--shadow);
}

/* Fill the lower frame area so the map never bleeds through beneath sheet/nav. */
.screen::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 98px;
  background: linear-gradient(180deg, rgba(9, 18, 31, 0.98), rgba(8, 15, 26, 0.99));
  z-index: 12;
  pointer-events: none;
}

body[data-theme="light"] .screen {
  background: #ffffff;
  border-color: var(--line);
}

body[data-theme="light"] .screen::after {
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
}

.map-canvas {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 20%, rgba(57, 217, 138, 0.08), transparent 18%),
    linear-gradient(180deg, #102133 0%, #09131f 100%);
}

.map-real-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.selected-stop-card {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 84px;
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: rgba(7, 16, 25, 0.92);
  border: 1px solid color-mix(in srgb, var(--route) 36%, rgba(255, 255, 255, 0.12));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.selected-stop-card-copy {
  min-width: 0;
  flex: 1;
}

.selected-stop-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--route) 68%, #ffffff 32%);
}

.selected-stop-name {
  margin-top: 3px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.selected-stop-route-button,
.selected-stop-close {
  flex-shrink: 0;
  border-radius: 12px;
}

.selected-stop-route-button {
  padding: 10px 12px;
  background: color-mix(in srgb, var(--route) 72%, #ffffff 28%);
  color: #08121b;
  font-weight: 800;
}

.selected-stop-close {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.map-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.map-canvas--real {
  background: linear-gradient(180deg, #0b121c 0%, #090f18 100%);
}

body[data-theme="light"] .map-canvas {
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
}

body[data-theme="light"] .selected-stop-card {
  background: rgba(255, 255, 255, 0.92);
  border-color: color-mix(in srgb, var(--route) 28%, rgba(17, 24, 39, 0.12));
  box-shadow: 0 16px 30px rgba(17, 24, 39, 0.12);
}

body[data-theme="light"] .selected-stop-close {
  background: rgba(17, 24, 39, 0.08);
}

body[data-theme="light"] .map-canvas--real {
  background: linear-gradient(180deg, #ffffff 0%, #eef2f7 100%);
}

.map-canvas--real .map-grid {
  opacity: 0.08;
}

.map-canvas--real::before,
.map-canvas--real::after {
  opacity: 0.14;
}

.map-canvas--real .campus-glow {
  display: none;
}

.map-canvas--real .map-grid,
.map-canvas--real::before,
.map-canvas--real::after {
  display: none;
}

.map-grid,
.map-canvas::before,
.map-canvas::after {
  position: absolute;
  inset: 0;
  content: "";
}

.map-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.2;
}

.map-canvas::before {
  background:
    linear-gradient(110deg, transparent 0 24%, rgba(255, 255, 255, 0.08) 24% 26%, transparent 26% 100%),
    linear-gradient(18deg, transparent 0 48%, rgba(255, 255, 255, 0.06) 48% 50%, transparent 50% 100%);
  opacity: 0.45;
}

.map-canvas::after {
  background:
    radial-gradient(circle at 30% 62%, rgba(31, 209, 132, 0.1), transparent 25%),
    radial-gradient(circle at 72% 24%, rgba(59, 167, 255, 0.08), transparent 20%);
}

.campus-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(18px);
}

.campus-glow-a {
  width: 180px;
  height: 180px;
  left: 58%;
  top: 58%;
  background: rgba(57, 217, 138, 0.1);
}

.campus-glow-b {
  width: 140px;
  height: 140px;
  left: 8%;
  top: 18%;
  background: rgba(59, 167, 255, 0.08);
}

.campus-label {
  position: absolute;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: rgba(217, 242, 225, 0.78);
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.label-a {
  left: 13%;
  top: 20%;
  width: 120px;
}

.label-b {
  left: 61%;
  top: 41%;
  width: 120px;
  color: rgba(255, 208, 213, 0.82);
}

.label-c {
  left: 49%;
  top: 71%;
  width: 110px;
  color: rgba(220, 232, 247, 0.82);
}

.route-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transition: opacity 280ms ease;
  pointer-events: none;
}

.route-svg.is-dimmed {
  opacity: 0.12;
}

.leaflet-bus-marker,
.leaflet-stop-marker,
.leaflet-pin-marker {
  background: transparent;
  border: 0;
}

.leaflet-bus-marker {
  pointer-events: auto;
}

.leaflet-bus-badge {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--route) 28%, #f4f8fc 72%);
  border: 2px solid color-mix(in srgb, var(--route) 78%, white 22%);
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--route) 16%, transparent), 0 10px 16px rgba(0, 0, 0, 0.34);
  transform-origin: center;
}

.leaflet-bus-marker.pulse .leaflet-bus-badge {
  animation: busPulse 2.4s ease-in-out infinite;
}

.leaflet-stop-marker {
  width: 18px;
  height: 18px;
}

.leaflet-stop-marker.is-current {
  z-index: 700;
}

.leaflet-stop-badge {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: rgba(245, 249, 255, 0.98);
  border: 3px solid color-mix(in srgb, var(--route) 70%, white 30%);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.06);
}

.leaflet-stop-marker.is-current .leaflet-stop-badge {
  box-shadow: 0 0 0 10px rgba(104, 151, 255, 0.18);
}

.leaflet-pin-marker {
  width: 140px;
  height: 52px;
  pointer-events: none;
}

.leaflet-user-dot,
.leaflet-origin-dot,
.leaflet-dest-dot {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -10px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}

.leaflet-user-dot {
  background: linear-gradient(135deg, #5da0ff 0%, #a9cafc 100%);
  box-shadow: 0 0 0 3px rgba(79, 137, 255, 0.3), 0 2px 12px rgba(0, 0, 0, 0.45);
}

.leaflet-origin-dot {
  background: linear-gradient(135deg, #39d98a 0%, #a3eec7 100%);
  box-shadow: 0 0 0 3px rgba(57, 217, 138, 0.22), 0 2px 12px rgba(0, 0, 0, 0.45);
}

.leaflet-dest-dot {
  background: linear-gradient(135deg, #fff 0%, #d0e8ff 100%);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.2), 0 2px 12px rgba(0, 0, 0, 0.45);
}

.leaflet-pin-label {
  position: absolute;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  background: rgba(8, 15, 28, 0.9);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.route-polyline {
  fill: none;
  stroke: var(--route);
  stroke-width: 3.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.42;
  filter: drop-shadow(0 0 18px var(--glow));
  transition: opacity 220ms ease, stroke-width 220ms ease;
}

.route-polyline.is-highlighted {
  opacity: 1;
  stroke-width: 4.4;
}

/* Ridden portion of a bus route — drawn on top, full opacity */
.route-polyline--ridden {
  opacity: 1;
  stroke-width: 5.5;
  filter: drop-shadow(0 0 10px var(--glow));
}

/* Full route shown faintly as context behind the ridden segment */
.route-polyline.is-ridden-base {
  opacity: 0.18;
  stroke-width: 2.5;
}

/* Full-map SVG overlay for walk legs and journey lines */
.journey-overlay-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 6;
}

/* Dashed walk leg polyline */
.walk-leg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1.2 2.2;
  filter: drop-shadow(0 0 1.5px rgba(0,0,0,0.7));
}

body[data-theme="light"] .walk-leg {
  stroke: #1d4ed8;
  filter: drop-shadow(0 0 1.5px rgba(191, 219, 254, 0.9));
}

/* Destination pin */
.dest-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 8;
  pointer-events: none;
}

.dest-pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #fff 0%, #d0e8ff 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.45), 0 0 0 3px rgba(255,255,255,0.25);
}

.dest-pin-label {
  background: rgba(8, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Origin pin (custom start location) */
.origin-pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 8;
  pointer-events: none;
}

.origin-pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #4f89ff 0%, #a0c4ff 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.45), 0 0 0 3px rgba(79,137,255,0.3);
}

.origin-pin-label {
  background: rgba(8, 15, 28, 0.88);
  backdrop-filter: blur(8px);
  color: #a0c4ff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid rgba(79,137,255,0.25);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

/* Journey stop markers — larger, glowing */
.stop-marker.is-journey-stop {
  width: 22px;
  height: 22px;
  border-width: 4px;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--route) 25%, transparent),
              0 0 12px color-mix(in srgb, var(--route) 50%, transparent);
  z-index: 7;
}

.stop-marker,
.bus-marker {
  position: absolute;
  transform: translate(-50%, -50%);
}

.icon {
  display: inline-block;
  position: relative;
  flex: 0 0 auto;
}

.icon-bus {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid currentColor;
}

.icon-bus::before,
.icon-bus::after {
  content: "";
  position: absolute;
}

.icon-bus::before {
  left: 2px;
  right: 2px;
  top: 2px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.28;
}

.icon-bus::after {
  width: 8px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  bottom: 3px;
  left: 2px;
  box-shadow: 0 -5px 0 color-mix(in srgb, currentColor 65%, transparent 35%);
}

.icon-stop {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 3px solid currentColor;
}

.icon-stop::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: currentColor;
}

.icon-calendar {
  width: 16px;
  height: 14px;
  border: 1.8px solid currentColor;
  border-radius: 4px;
}

.icon-calendar::before,
.icon-calendar::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
}

.icon-calendar::before {
  top: 3px;
  border-top: 1.8px solid currentColor;
}

.icon-calendar::after {
  top: -3px;
  height: 3px;
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  left: 3px;
  box-shadow: 7px 0 0 currentColor;
}

.stop-marker {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
  border: 4px solid color-mix(in srgb, var(--route) 70%, white 30%);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.07);
  pointer-events: auto;
}

.stop-marker.is-current {
  box-shadow: 0 0 0 10px rgba(104, 151, 255, 0.18);
}

.bus-marker {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--route) 38%, #f7fbff 62%);
  border: 2px solid color-mix(in srgb, var(--route) 78%, #ffffff 22%);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--route) 24%, transparent), 0 0 16px rgba(0, 0, 0, 0.35);
  color: #152235;
  display: grid;
  place-items: center;
  transition: left 1.9s linear, top 1.9s linear, transform 220ms ease;
  pointer-events: auto;
}

.map-bus-emoji {
  font-size: 20px;
  line-height: 1;
  transform: translateY(-1px);
}

.bus-marker.pulse {
  animation: busPulse 2.4s ease-in-out infinite;
}

.user-marker {
  position: absolute;
  transform: translate(-50%, -50%);
}

.user-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #4f89ff;
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(79, 137, 255, 0.18);
}

.user-pulse {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid rgba(79, 137, 255, 0.4);
  animation: pulse 2.8s ease-out infinite;
}

.top-search-stack {
  position: absolute;
  inset: 20px 20px auto;
  z-index: 10;
}

.toast-stack {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 92px;
  z-index: 22;
  display: grid;
  gap: 10px;
  pointer-events: none;
}

.toast-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 18px;
  background: rgba(9, 19, 31, 0.94);
  border: 1px solid color-mix(in srgb, var(--route) 32%, rgba(255, 255, 255, 0.12));
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
  pointer-events: auto;
}

.toast-copy {
  min-width: 0;
  flex: 1;
}

.toast-title {
  color: color-mix(in srgb, var(--route) 72%, #ffffff 28%);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toast-body {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 700;
}

.toast-dismiss {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.top-bar {
  position: relative;
  display: flex;
  gap: 12px;
}

.top-search-suggestions {
  margin-top: 8px;
  border-radius: 16px;
  background: rgba(9, 19, 31, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.45);
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(56vh, 360px);
  backdrop-filter: blur(14px);
}

body[data-theme="light"] .top-search-suggestions {
  background: rgba(255, 255, 255, 0.98);
  border-color: var(--line);
  box-shadow: 0 18px 42px rgba(17, 24, 39, 0.12);
}

body[data-theme="light"] .toast-card {
  background: rgba(255, 255, 255, 0.96);
  border-color: color-mix(in srgb, var(--route) 28%, rgba(17, 24, 39, 0.12));
  box-shadow: 0 16px 30px rgba(17, 24, 39, 0.12);
}

body[data-theme="light"] .toast-dismiss {
  background: rgba(17, 24, 39, 0.08);
}

.top-search-suggestions.is-hidden {
  display: none;
}

.top-suggestion-item {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  color: var(--text);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-weight: 600;
}

body[data-theme="light"] .top-suggestion-item {
  border-bottom-color: var(--line);
}

.top-suggestion-item:last-child {
  border-bottom: 0;
}

.top-suggestion-item:hover {
  background: rgba(125, 182, 255, 0.14);
}

.search-shell {
  flex: 1;
  height: 58px;
  border-radius: 18px;
  padding: 0 10px 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f4f8fc;
  background: rgba(12, 20, 32, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

body[data-theme="light"] .search-shell {
  background: rgba(255, 255, 255, 0.98);
  color: #374151;
  border-color: var(--line);
  box-shadow: 0 16px 34px rgba(17, 24, 39, 0.08);
}

.search-shell input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: #f4f8fc;
  font-size: 1rem;
}

.search-shell input::placeholder {
  color: rgba(244, 248, 252, 0.7);
}

body[data-theme="light"] .search-shell input {
  color: #111827;
}

body[data-theme="light"] .search-shell input::placeholder {
  color: #6b7280;
}

.search-submit {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(180deg, #1f2e43, #172131);
  color: #f4f8fc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22);
  flex: 0 0 auto;
}

body[data-theme="light"] .search-submit,
body[data-theme="light"] .filter-button,
body[data-theme="light"] .ghost-button,
body[data-theme="light"] .theme-button {
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  color: #374151;
  border-color: var(--line);
  box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
}

.theme-button {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1f2e43, #172131);
  color: #f4f8fc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  font-weight: 800;
  display: grid;
  place-items: center;
}

.theme-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.filter-button,
.ghost-button {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1f2e43, #172131);
  color: #f4f8fc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Filter modal ─────────────────────────────────────────── */

.filter-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 40;
  backdrop-filter: blur(2px);
  cursor: pointer;
}

.filter-modal {
  position: absolute;
  top: 20px;
  left: 16px;
  right: 16px;
  z-index: 41;
  background: linear-gradient(180deg, rgba(13, 24, 40, 0.99), rgba(9, 17, 30, 0.99));
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 24px;
  background: rgba(10, 18, 29, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-direction: column;
  max-height: calc(100% - 108px); /* never overlap nav bar */
  overflow: hidden;
}

.route-unsave-backdrop {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.route-unsave-modal {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 51;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(13, 24, 40, 0.98), rgba(9, 17, 30, 0.98));
  box-shadow: 0 22px 40px rgba(0, 0, 0, 0.42);
  padding: 18px;
}

.route-unsave-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.route-unsave-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.route-unsave-actions {
  margin-top: 14px;
  display: flex;
  gap: 10px;
}

body[data-theme="light"] .route-unsave-modal {
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  border-color: var(--line);
}

body[data-theme="light"] .filter-modal,
body[data-theme="light"] .bottom-sheet,
body[data-theme="light"] .panel-page,
body[data-theme="light"] .route-unsave-modal {
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  border-color: var(--line);
  color: #111827;
}

body[data-theme="light"] .sheet-handle,
body[data-theme="light"] .filter-modal-header,
body[data-theme="light"] .sheet-header,
body[data-theme="light"] .page-head,
body[data-theme="light"] .sheet-header--sticky {
  border-color: var(--line);
}

body[data-theme="light"] .sheet-handle {
  background: #9ca3af;
}

body[data-theme="light"] .input-pill,
body[data-theme="light"] .origin-pill,
body[data-theme="light"] .origin-editor-wrap,
body[data-theme="light"] .suggestion-item,
body[data-theme="light"] .recent-card,
body[data-theme="light"] .route-option,
body[data-theme="light"] .quick-card,
body[data-theme="light"] .saved-card,
body[data-theme="light"] .list-card,
body[data-theme="light"] .alert-card,
body[data-theme="light"] .nav-bar {
  background: #ffffff;
  border-color: var(--line);
  color: #111827;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.08);
}

body[data-theme="light"] .input-label,
body[data-theme="light"] .eyebrow,
body[data-theme="light"] .page-subtitle,
body[data-theme="light"] .status-copy,
body[data-theme="light"] .recent-subtitle,
body[data-theme="light"] .list-window,
body[data-theme="light"] .saved-meta,
body[data-theme="light"] .stop-status,
body[data-theme="light"] .route-option-label,
body[data-theme="light"] .route-hero-subtitle,
body[data-theme="light"] .filter-count,
body[data-theme="light"] .chevron,
body[data-theme="light"] .seg,
body[data-theme="light"] .seg-arrow {
  color: #4b5563;
  font-weight: 600;
}

body[data-theme="light"] .route-option.is-selected,
body[data-theme="light"] .saved-card.soft,
body[data-theme="light"] .stop-row.is-bus-location {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.14), rgba(34, 197, 94, 0.06));
  border-color: rgba(34, 197, 94, 0.26);
}

body[data-theme="light"] .route-chip,
body[data-theme="light"] .saved-chip,
body[data-theme="light"] .route-badge {
  color: #ffffff;
}

body[data-theme="light"] .filter-modal-close,
body[data-theme="light"] .favorite-toggle,
body[data-theme="light"] .calendar-button,
body[data-theme="light"] .ghost-action-button {
  background: #ffffff;
  color: #374151;
  border: 1px solid var(--line);
}

body[data-theme="light"] .filter-modal-title,
body[data-theme="light"] .page-title,
body[data-theme="light"] .route-hero-title,
body[data-theme="light"] .recent-title,
body[data-theme="light"] .stop-name,
body[data-theme="light"] .saved-name,
body[data-theme="light"] .list-title,
body[data-theme="light"] .alert-card-title,
body[data-theme="light"] .alert-card-message,
body[data-theme="light"] .nav-item,
body[data-theme="light"] .text-action,
body[data-theme="light"] .route-option-time,
body[data-theme="light"] .route-option-eta,
body[data-theme="light"] .select-route-button,
body[data-theme="light"] .filter-route-name,
body[data-theme="light"] .filter-route-meta {
  color: #111827;
}

body[data-theme="light"] .select-route-button {
  color: #ffffff;
  background: color-mix(in srgb, var(--accent) 92%, #0f1724 8%);
}

body[data-theme="light"] .nav-bar {
  background: rgba(255, 255, 255, 0.96);
}

body[data-theme="light"] .nav-item {
  color: #6b7280;
}

body[data-theme="light"] .nav-item.active {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

body[data-theme="light"] .status-pill.active {
  background: rgba(34, 197, 94, 0.14);
  color: #166534;
}

body[data-theme="light"] .status-pill.inactive {
  background: #f3f4f6;
  color: #6b7280;
}

body[data-theme="light"] .eta-pill {
  background: rgba(34, 197, 94, 0.12);
  color: #166534;
}

body[data-theme="light"] .top-search-stack .search-submit,
body[data-theme="light"] .top-search-stack .filter-button,
body[data-theme="light"] .top-search-stack .theme-button {
  color: #374151;
}

.filter-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(125, 182, 255, 0.18);
}

.filter-modal-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}

.filter-modal-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-action-link {
  background: transparent;
  color: #7db6ff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 8px;
}

.filter-action-link:hover {
  background: rgba(125, 182, 255, 0.1);
}

.filter-modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  margin-left: 6px;
  display: grid;
  place-items: center;
}

.filter-search-wrap {
  padding: 12px 16px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-search-input {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
  padding: 0 14px;
  outline: none;
  font-size: 0.95rem;
}

body[data-theme="light"] .filter-search-input {
  background: #ffffff;
  border-color: var(--line);
  color: #111827;
}

.filter-search-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

body[data-theme="light"] .filter-search-input::placeholder {
  color: #9ca3af;
}

.filter-search-input:focus {
  border-color: rgba(125, 182, 255, 0.45);
  background: rgba(255, 255, 255, 0.09);
}

body[data-theme="light"] .filter-search-input:focus {
  background: #ffffff;
}

.filter-route-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 8px 0;
}

.filter-route-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  cursor: pointer;
  transition: background 120ms ease;
}

.filter-route-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.filter-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: background 140ms ease, border-color 140ms ease;
}

.filter-checkbox:checked {
  background: color-mix(in srgb, var(--route) 80%, white 20%);
  border-color: var(--route);
}

.filter-checkbox:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.filter-route-badge {
  min-width: 44px;
  height: 32px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--route) 22%, rgba(9, 19, 31, 0.9));
  border: 1px solid color-mix(in srgb, var(--route) 45%, transparent);
  color: color-mix(in srgb, var(--route) 80%, white 20%);
  font-size: 0.82rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 8px;
}

.filter-route-name {
  flex: 1;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.filter-route-meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.filter-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.filter-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.filter-count {
  font-size: 0.85rem;
  color: var(--muted);
}

.filter-done-button {
  height: 42px;
  padding: 0 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #1ea663);
  color: #06140c;
  font-weight: 800;
  font-size: 0.9rem;
}

.bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 72px;
  /* Drive the sheet via top so it is physically clamped and cannot bleed behind the top bar */
  top: max(88px, calc(100% - 72px - var(--sheet-height)));
  background: linear-gradient(180deg, rgba(9, 18, 31, 0.98), rgba(8, 15, 26, 0.98));
  border-radius: 30px 30px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  z-index: 15;
  transition: top 220ms ease, transform 220ms ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bottom-sheet.is-dragging {
  transition: none;
}

.bottom-sheet.is-hidden {
  top: calc(100% - 72px - 44px);
  transform: none;
}

.bottom-sheet.is-hidden .sheet-content,
.bottom-sheet.is-hidden .sheet-header {
  display: none;
}

.panel-page {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 72px;
  background: linear-gradient(180deg, rgba(9, 18, 31, 0.98), rgba(8, 15, 26, 0.98));
  border-radius: 0;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: var(--shadow);
  z-index: 15;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.sheet-handle {
  width: 64px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 12px auto 8px;
  cursor: grab;
  flex-shrink: 0;
}

.sheet-header {
  cursor: grab;
  user-select: none;
}

.sheet-content,
.saved-grid,
.alerts-page {
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  min-height: 0;
  padding: 10px 18px 28px;
}

.sheet-header,
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.page-head {
  padding: 18px 20px 8px;
}

.green-head {
  background: linear-gradient(135deg, rgba(57, 217, 138, 0.22), rgba(57, 217, 138, 0.08));
}

.eyebrow,
.page-subtitle,
.status-copy,
.recent-subtitle,
.list-window,
.saved-meta,
.stop-status,
.route-option-label {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.4;
}

h2,
.page-title,
.route-hero-title {
  margin: 0;
  font-size: 1.92rem;
  line-height: 1;
}

.text-action {
  background: transparent;
  color: #7db6ff;
}

.routing-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.search-stack {
  display: grid;
  gap: 10px;
}

.origin-stack {
  display: grid;
  gap: 10px;
}

.origin-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.origin-pill {
  flex: 1;
  min-height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: var(--text);
  text-align: left;
}

.origin-pill-value {
  font-weight: 700;
}

.origin-pill-hint {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
  font-weight: 700;
}

[data-origin-suggestions] {
  margin-top: -2px;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  overflow: hidden;
}

[data-origin-suggestions] .suggestion-item {
  border-radius: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

[data-origin-suggestions] .suggestion-item:last-child {
  border-bottom: 0;
}

.origin-editor-wrap {
  display: grid;
  gap: 8px;
}

.origin-editor-input {
  height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: white;
  padding: 0 16px;
  outline: none;
}

body[data-theme="light"] .origin-editor-input {
  color: #111827;
}

.origin-editor-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

body[data-theme="light"] .origin-editor-input::placeholder {
  color: #9ca3af;
}

.input-pill {
  height: 54px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
}

.input-label {
  width: 38px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.88rem;
}

.search-input input {
  width: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  color: white;
}

body[data-theme="light"] .search-input input {
  color: #111827;
}

body[data-theme="light"] .search-input input::placeholder {
  color: #9ca3af;
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion-item,
.recent-card,
.route-option,
.quick-card,
.saved-card,
.list-card {
  width: 100%;
  text-align: left;
}

.suggestion-item {
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.recent-list,
.route-option-list,
.route-list-page,
.alert-feed {
  display: grid;
  gap: 14px;
}

.saved-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.recent-card,
.saved-card,
.list-card,
.route-option {
  border-radius: 22px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(18, 34, 53, 0.96), rgba(10, 20, 33, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.recent-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.route-chip,
.saved-chip,
.route-badge {
  width: 66px;
  min-width: 66px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--route) 82%, #ffffff 10%), color-mix(in srgb, var(--route) 62%, #0f1724 38%));
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(15, 23, 36, 0.12);
}

.recent-title,
.stop-name,
.saved-name,
.list-title {
  font-size: 1.1rem;
  font-weight: 800;
}

.chevron {
  margin-left: auto;
  color: rgba(255, 255, 255, 0.35);
  font-size: 1.6rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.quick-card {
  border-radius: 22px;
  padding: 22px 16px;
  background: rgba(11, 18, 29, 0.96);
  color: #f4f8fc;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  display: grid;
  justify-items: center;
  gap: 10px;
}

.quick-card .icon {
  color: rgba(224, 236, 255, 0.95);
}

body[data-theme="light"] .quick-card .icon {
  color: #374151;
}

.route-option.is-selected,
.saved-card.soft,
.stop-row.is-bus-location {
  background: linear-gradient(180deg, rgba(78, 108, 191, 0.18), rgba(26, 39, 63, 0.45));
  border-color: rgba(125, 182, 255, 0.32);
}

.route-option-top,
.status-stack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.route-option-time {
  font-size: 1.38rem;
  font-weight: 800;
}

.route-option-legs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 8px;
}

.seg,
.seg-arrow {
  color: rgba(255, 255, 255, 0.78);
}

.favorite-toggle,
.calendar-button {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(14, 22, 35, 0.94);
  color: #f4f8fc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-grid;
  place-items: center;
}

.select-route-button {
  margin-top: 8px;
  height: 54px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 88%, #0f1724 12%);
  color: #06140c;
  font-weight: 800;
}

.route-details-sheet .sheet-content {
  padding-top: 6px;
}

.sheet-header--sticky {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px 14px;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  margin-bottom: 0;
}

.sheet-header--sticky h2 {
  font-size: 1.5rem;
}

.sheet-header--sticky .ghost-button {
  flex-shrink: 0;
}

.sheet-header--sticky .eta-pill {
  margin-left: auto;
  flex-shrink: 0;
}

.eta-pill,
.status-pill {
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 800;
  background: rgba(84, 126, 255, 0.18);
  color: #9fc1ff;
}

.status-pill.active {
  background: rgba(57, 217, 138, 0.14);
  color: #79edb0;
}

.status-pill.inactive {
  background: rgba(255, 255, 255, 0.08);
  color: #b0bfd0;
}

.stop-list {
  display: grid;
  gap: 18px;
}

.stop-row {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stop-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin-top: 6px;
  border: 4px solid #c58b88;
}

.stop-icon.current {
  border-color: #4f89ff;
  box-shadow: 0 0 0 8px rgba(79, 137, 255, 0.16);
}

.stop-icon.approaching {
  border-color: #e2b76a;
}

.stop-icon.departed,
.stop-icon.upcoming {
  border-color: #b7847d;
}

.route-hero-subtitle {
  color: rgba(255, 255, 255, 0.68);
  margin-top: 6px;
}

.routes-page .route-list-page {
  padding: 0 16px 24px;
}

.routes-kicker {
  padding: 0 20px 14px;
  color: var(--muted);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.route-list-page {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 18px 28px;
}

.list-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: start;
}

.route-badge {
  border: 0;
}

/* ── Timetable panel ──────────────────────────────────────── */

.list-card.is-timetable-open {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(22, 40, 62, 0.98), rgba(12, 22, 38, 0.98));
}

.calendar-button.is-active {
  background: color-mix(in srgb, var(--accent) 22%, rgba(255,255,255,0.06));
  color: var(--accent);
}

.timetable-panel {
  grid-column: 1 / -1;
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timetable-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px 10px;
}

.timetable-label {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: color-mix(in srgb, var(--route) 85%, white 15%);
}

.timetable-note {
  font-size: 0.74rem;
  color: var(--muted);
}

/* Per-stop rows */
.timetable-stops {
  display: flex;
  flex-direction: column;
}

.timetable-stop-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timetable-stop-row:last-child {
  border-bottom: none;
}

.timetable-stop-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  padding: 10px 10px 10px 2px;
  flex-shrink: 0;
}

.timetable-stop-dot {
  width: 10px;
  height: 10px;
  min-width: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.35);
  position: relative;
}

.timetable-stop-dot.is-first,
.timetable-stop-dot.is-last {
  background: color-mix(in srgb, var(--route) 70%, white 30%);
  border-color: var(--route);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--route) 20%, transparent);
}

/* Horizontally scrollable time chips */
.timetable-times-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 0;
  mask-image: linear-gradient(to right, transparent 0%, black 6%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 6%, black 88%, transparent 100%);
}

.timetable-times-scroll::-webkit-scrollbar {
  display: none;
}

.timetable-times {
  display: flex;
  gap: 6px;
  width: max-content;
  padding: 0 8px;
}

.timetable-time {
  padding: 5px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--route) 14%, rgba(9, 19, 31, 0.9));
  border: 1px solid color-mix(in srgb, var(--route) 30%, transparent);
  color: color-mix(in srgb, var(--route) 75%, white 25%);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

/* Continuous loop notice */
.timetable-loop-notice {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 4px 6px;
}

.timetable-loop-icon {
  font-size: 1.4rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 2px;
}

.timetable-loop-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.timetable-loop-body {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}

.panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 24px;
}

.saved-page,
.alerts-page {
  padding-bottom: 0;
}

.bottom-sheet .sheet-header:not(.sheet-header--sticky),
.saved-page .page-head,
.alerts-page .page-head {
  border-radius: 20px;
  border: 1px solid rgba(74, 181, 130, 0.22);
  background: rgba(20, 43, 42, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.bottom-sheet .sheet-header:not(.sheet-header--sticky) {
  padding: 14px 16px;
  margin-bottom: 14px;
}

.saved-page .page-head,
.alerts-page .page-head {
  margin: 14px 16px 12px;
  padding: 16px 18px;
}

.saved-page .page-title,
.alerts-page .page-title,
.bottom-sheet .sheet-header h2 {
  font-size: 1.56rem;
}

.saved-page .page-subtitle,
.alerts-page .page-subtitle,
.bottom-sheet .sheet-header .eyebrow {
  color: rgba(232, 241, 255, 0.78);
}

.saved-grid {
  padding: 0 16px 24px;
}

.saved-card {
  display: grid;
  gap: 10px;
  position: relative;
  height: 140px;
}

.saved-card,
.alert-card {
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 26, 40, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 5px 12px rgba(0, 0, 0, 0.16);
}

.saved-card .favorite-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
}

.edit-option-button {
  position: absolute;
  top: 10px;
  right: 54px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: background 140ms ease, color 140ms ease;
  z-index: 1;
}

.edit-option-button:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.option-name-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(125, 182, 255, 0.45);
  border-radius: 8px;
  color: white;
  padding: 6px 8px;
  font-size: 1rem;
  font-weight: 800;
  outline: none;
}

.saved-top {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-right: 90px;
}

.empty-state,
.alert-card {
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.82);
}

.alert-form {
  display: grid;
  gap: 14px;
  padding: 0 16px 20px;
  flex-shrink: 0;
}

.alert-form label,
.alert-form fieldset {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  border: 0;
}

.alert-form label span,
.alert-form legend {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.alert-form select {
  height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  padding: 0 16px;
  outline: none;
}

.alert-form select:focus {
  border-color: rgba(125, 182, 255, 0.45);
  background: rgba(255, 255, 255, 0.09);
}

.alert-form select option {
  background: rgba(9, 19, 31, 0.95);
  color: white;
}

.day-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  font-weight: 700;
}

.day-pill.is-selected {
  background: rgba(57, 217, 138, 0.16);
  color: #98f2be;
}

.alert-feed {
  display: grid;
  gap: 12px;
  padding: 0 16px 8px;
}

.compact-button {
  width: auto;
  min-width: 88px;
  margin-top: 0;
  padding: 0 18px;
}

.alert-card {
  display: grid;
  gap: 14px;
}

.alert-card.is-disabled {
  opacity: 0.72;
}

.alert-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.alert-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: white;
}

.alert-card-message {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 600;
  line-height: 1.45;
}

.alert-status {
  flex: 0 0 auto;
  min-width: 52px;
  padding: 8px 10px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 800;
}

.alert-status.is-enabled {
  background: rgba(57, 217, 138, 0.16);
  color: #98f2be;
}

.alert-status.is-disabled {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.68);
}

.alert-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.alert-card-meta span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.82rem;
  font-weight: 600;
}

.alert-card-actions {
  display: flex;
  gap: 10px;
}

.ghost-action-button {
  flex: 1;
  min-height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-weight: 700;
}

body[data-theme="light"] .empty-state {
  background: #ffffff;
  color: #4b5563;
  border: 1px solid var(--line);
}

body[data-theme="light"] .bottom-sheet .sheet-header:not(.sheet-header--sticky),
body[data-theme="light"] .saved-page .page-head,
body[data-theme="light"] .alerts-page .page-head {
  border-color: #cfe8da;
  background: #f3faf5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 3px 10px rgba(17, 24, 39, 0.05);
}

body[data-theme="light"] .saved-page .page-subtitle,
body[data-theme="light"] .alerts-page .page-subtitle,
body[data-theme="light"] .bottom-sheet .sheet-header .eyebrow {
  color: #4b5563;
}

body[data-theme="light"] .saved-card,
body[data-theme="light"] .alert-card {
  background: #ffffff;
  border-color: var(--line);
  box-shadow: 0 4px 12px rgba(17, 24, 39, 0.06);
}

body[data-theme="light"] .alert-form label span,
body[data-theme="light"] .alert-form legend {
  color: #111827;
}

body[data-theme="light"] .alert-form select {
  background: #ffffff;
  border-color: var(--line);
  color: #111827;
}

body[data-theme="light"] .alert-form select option {
  background: #ffffff;
  color: #111827;
}

body[data-theme="light"] .day-pill {
  background: #ffffff;
  color: #374151;
  border: 1px solid var(--line);
}

body[data-theme="light"] .day-pill.is-selected {
  background: rgba(34, 197, 94, 0.14);
  border-color: rgba(34, 197, 94, 0.28);
  color: #166534;
}

body[data-theme="light"] .alert-status.is-disabled {
  background: #f3f4f6;
  color: #6b7280;
}

body[data-theme="light"] .alert-card-meta span {
  background: #f9fafb;
  color: #4b5563;
  border: 1px solid var(--line);
}

.danger-button {
  background: rgba(255, 95, 109, 0.12);
  color: #ff9aa3;
}

.nav-bar {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  height: 64px;
  border-radius: 24px;
  background: rgba(8, 15, 26, 0.9);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 8px;
  z-index: 30;
}

.nav-item {
  border-radius: 18px;
  background: transparent;
  color: rgba(255, 255, 255, 0.54);
  font-weight: 700;
}

.nav-item.active {
  background: rgba(101, 136, 255, 0.16);
  color: #dce8ff;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

@keyframes busPulse {
  0%,
  100% {
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.05), 0 0 20px rgba(0, 0, 0, 0.32);
  }
  50% {
    box-shadow: 0 0 0 14px rgba(255, 255, 255, 0.08), 0 0 32px rgba(0, 0, 0, 0.42);
  }
}

@media (max-width: 480px) {
  .shell {
    padding: 0;
  }

  .screen {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
}
/* ── Journey detail sheet ──────────────────────────────────── */

.journey-leg {
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.journey-leg:last-child {
  border-bottom: none;
}

.journey-leg-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.journey-leg-title {
  font-weight: 800;
  font-size: 1rem;
  flex: 1;
}

.journey-leg-eta {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.journey-transfer-divider {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.stop-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}

.board-tag {
  background: rgba(57, 217, 138, 0.18);
  color: #79edb0;
  border: 1px solid rgba(57, 217, 138, 0.3);
}

.alight-tag {
  background: rgba(255, 95, 109, 0.18);
  color: #ff9aa2;
  border: 1px solid rgba(255, 95, 109, 0.3);
}

/* ── All Stops page ────────────────────────────────────────── */

.stops-page {
  bottom: 72px;
}

.stops-head {
  background: linear-gradient(135deg, rgba(255, 138, 61, 0.18), rgba(255, 138, 61, 0.06));
}

.stops-search-wrap {
  position: relative;
  flex-shrink: 0;
  padding: 0 16px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
 
.stops-search-input {
  flex: 1;
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  padding: 0 40px 0 14px;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease;
}
 
.stops-search-input::placeholder {
  color: var(--muted);
}
 
.stops-search-input:focus {
  border-color: rgba(255, 138, 61, 0.45);
  background: rgba(255, 255, 255, 0.1);
}
 
.stops-search-clear {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-60%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: background 140ms ease;
}
 
.stops-search-clear:hover {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text);
}
 
.stops-empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.stops-list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 24px;
}

.stops-section-letter {
  padding: 10px 20px 4px;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(9, 18, 31, 0.6);
  position: sticky;
  top: 0;
  z-index: 2;
}

.stops-list-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  background: transparent;
  color: var(--text);
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 140ms ease;
}

.stops-list-row:hover,
.stops-list-row:active {
  background: rgba(255, 255, 255, 0.04);
}

.stops-list-dot {
  width: 18px;
  height: 18px;
  min-width: 18px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.stops-list-copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stops-list-name {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stops-list-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.stop-route-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: color-mix(in srgb, var(--route) 22%, rgba(255,255,255,0.06));
  color: color-mix(in srgb, var(--route) 80%, white 20%);
  border: 1px solid color-mix(in srgb, var(--route) 40%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--glow, var(--route)) 35%, transparent);
}
