:root {
  --ink: #18212b;
  --muted: #62707f;
  --soft: #f6f7f9;
  --surface: rgba(255, 255, 255, 0.92);
  --line: rgba(24, 33, 43, 0.12);
  --blue: #2563eb;
  --green: #0f9f6e;
  --amber: #f59e0b;
  --red: #dc2626;
  --tram: #cf342b;
  --bus: #217a5b;
  --night: #3c4c83;
  --trolleybus: #84cc16;
  --shadow: 0 18px 48px rgba(24, 33, 43, 0.18);
  --tight-shadow: 0 8px 24px rgba(24, 33, 43, 0.14);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

html {
  background: #111827;
}

body {
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.region-hub {
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    var(--safe-top)
    var(--safe-right)
    var(--safe-bottom)
    var(--safe-left);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(15, 159, 110, 0.14), transparent 42%),
    var(--soft);
}

.hub-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 48px;
  width: min(1120px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  align-items: center;
}

.hub-copy h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.92;
  letter-spacing: 0;
}

.hub-copy p:not(.eyebrow) {
  max-width: 620px;
  margin: 24px 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 0 18px;
}

.hub-list {
  display: grid;
  gap: 12px;
}

.region-row {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 18px;
  box-shadow: 0 12px 36px rgba(24, 33, 43, 0.08);
}

.region-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.region-row > span:last-child {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.region-row.muted {
  opacity: 0.68;
}

.region-row.muted > span:last-child {
  color: var(--muted);
}

.app-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #dfe6e3;
  overscroll-behavior: none;
}

.map {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 1;
  background: #dfe6e3;
}

.map.leaflet-container {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.schedule-view {
  position: fixed;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  background: #161c24;
  color: var(--ink);
  padding:
    calc(92px + var(--safe-top))
    calc(18px + var(--safe-right))
    calc(18px + var(--safe-bottom))
    calc(18px + var(--safe-left));
}

.schedule-view[hidden] {
  display: none;
}

.schedule-mode .map,
.schedule-mode .leaflet-control-container,
.schedule-mode .refresh-fab,
.schedule-mode .follow-vehicle-fab,
.schedule-mode .locate-fab,
.schedule-mode .detail-panel {
  visibility: hidden;
  pointer-events: none;
}

.schedule-screen {
  display: flex;
  width: min(1120px, 100%);
  height: 100%;
  min-height: 0;
  flex-direction: column;
  margin: 0 auto;
  overflow: hidden;
}

.schedule-screen-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.schedule-screen-head .eyebrow {
  margin-bottom: 5px;
}

.schedule-screen-head h1 {
  margin: 0;
  color: white;
  font-size: 34px;
  line-height: 1;
}

.schedule-screen-head small {
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.schedule-line-search {
  flex: 0 0 auto;
  max-width: 520px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.schedule-line-search input,
.schedule-line-search svg {
  color: rgba(255, 255, 255, 0.86);
}

.schedule-line-search input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.schedule-route-grid {
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  min-height: 0;
  overflow-y: auto;
  padding: 2px 4px 18px 0;
}

.schedule-route-screen {
  width: min(820px, 100%);
}

.schedule-route-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin: 12px 0 14px;
}

.schedule-route-hero strong,
.schedule-route-hero small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-route-hero strong {
  color: white;
  font-size: 20px;
}

.schedule-route-hero small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 800;
}

.schedule-screen .route-stops {
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.schedule-screen .route-stop-row {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

.schedule-screen .route-stop-row small {
  color: rgba(255, 255, 255, 0.56);
}

.schedule-screen .empty-state {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

.leaflet-container {
  overflow: hidden;
  touch-action: pan-x pan-y;
}

.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  user-select: none;
  -webkit-user-drag: none;
}

.leaflet-tile {
  visibility: hidden;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-zoom-animated {
  transform-origin: 0 0;
}

.leaflet-zoom-anim .leaflet-zoom-animated {
  transition-duration: 420ms;
  transition-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

.leaflet-pane {
  z-index: 400;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  clear: both;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: var(--safe-top);
}

.leaflet-right {
  right: var(--safe-right);
}

.leaflet-bottom {
  bottom: var(--safe-bottom);
}

.leaflet-left {
  left: var(--safe-left);
}

.leaflet-right .leaflet-control {
  float: right;
  margin-right: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-control-zoom a {
  display: block;
  width: 30px;
  height: 30px;
  border-bottom: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 20px;
  font-weight: 800;
  line-height: 30px;
  text-align: center;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0;
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(24, 33, 43, 0.18);
}

.leaflet-interactive {
  cursor: pointer;
}

.leaflet-container .leaflet-tile {
  max-width: none !important;
  max-height: none !important;
}

.topbar {
  position: fixed;
  top: calc(16px + var(--safe-top));
  left: calc(16px + var(--safe-left));
  right: calc(16px + var(--safe-right));
  z-index: 5;
  display: grid;
  grid-template-columns: auto auto auto minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: center;
  pointer-events: none;
}

.menu-trigger,
.search-trigger {
  pointer-events: auto;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--tight-shadow);
  cursor: pointer;
}

.menu-trigger svg,
.search-trigger svg {
  width: 20px;
}

.brand,
.region-switch,
.live-status {
  pointer-events: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--tight-shadow);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  font-weight: 900;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.15;
}

.region-switch {
  justify-self: center;
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 4px;
  padding: 4px;
}

.region-switch a,
.region-switch span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 12px;
}

.region-switch .active {
  background: var(--ink);
  color: white;
}

.live-status {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.14);
}

.live-status.ok .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 159, 110, 0.14);
}

.live-status.error .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
}

.panel {
  position: static;
  z-index: auto;
  display: flex;
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 178px;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: none;
  backdrop-filter: none;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9;
  background: rgba(24, 33, 43, 0.24);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.menu-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.side-menu {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: calc(12px + var(--safe-left));
  bottom: calc(12px + var(--safe-bottom));
  z-index: 10;
  display: flex;
  width: min(390px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  transform: translateX(calc(-100% - 18px));
  flex-direction: column;
  border-radius: 8px;
  background: #075a1d;
  color: rgba(255, 255, 255, 0.88);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.32);
  padding: 16px;
  transition: transform 180ms ease;
}

.side-menu.open {
  transform: translateX(0);
}

.side-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.14);
  color: inherit;
  cursor: pointer;
}

.side-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.side-close svg {
  width: 22px;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding-right: 52px;
}

.side-brand .brand-mark {
  background: white;
  color: #075a1d;
}

.side-brand small {
  display: block;
  color: rgba(255, 255, 255, 0.72);
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav button {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 800;
  padding: 0 16px;
  text-align: left;
}

.side-nav button.active,
.side-nav button:hover {
  background: rgba(0, 0, 0, 0.24);
}

.side-nav svg {
  width: 20px;
}

.side-foot {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 700;
}

.menu-panel-slot {
  min-height: 0;
  flex: 1;
  overflow: hidden;
  margin-top: 14px;
}

.side-schedule {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.side-schedule-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.side-schedule-head strong {
  color: white;
  font-size: 20px;
}

.side-schedule-head small {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 800;
}

.side-line-search {
  flex: 0 0 auto;
  border-color: transparent;
  background: rgba(0, 0, 0, 0.22);
}

.side-line-search input,
.side-line-search svg {
  color: rgba(255, 255, 255, 0.82);
}

.side-line-search input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.side-route-grid {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.side-schedule-route {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin: 12px 0;
}

.side-schedule-route strong,
.side-schedule-route small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-schedule-route strong {
  color: white;
  font-size: 15px;
}

.side-schedule-route small {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 800;
}

.side-variant-picker {
  flex: 0 0 auto;
  margin: 0 0 10px;
}

.side-variant-picker label {
  color: rgba(255, 255, 255, 0.62);
}

.side-variant-picker select {
  border-color: transparent;
  background: rgba(0, 0, 0, 0.22);
  color: white;
}

.side-schedule .route-stops {
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.side-schedule .route-stop-row {
  background: rgba(0, 0, 0, 0.18);
  color: white;
}

.side-schedule .route-stop-row small {
  color: rgba(255, 255, 255, 0.56);
}

.side-schedule .empty-state {
  background: rgba(0, 0, 0, 0.16);
  color: rgba(255, 255, 255, 0.68);
}

.search-modal[hidden],
.timetable-modal[hidden] {
  display: none;
}

.search-modal,
.timetable-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  background: rgba(7, 10, 20, 0.62);
  padding:
    calc(72px + var(--safe-top))
    calc(16px + var(--safe-right))
    calc(16px + var(--safe-bottom))
    calc(16px + var(--safe-left));
  backdrop-filter: blur(10px);
}

.search-modal-shell,
.timetable-modal-shell {
  display: grid;
  width: min(720px, 100%);
  max-height: calc(100dvh - 96px - var(--safe-top) - var(--safe-bottom));
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, var(--surface));
  color: var(--ink);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.36);
}

.timetable-modal-shell {
  grid-template-rows: auto minmax(0, 1fr);
}

.search-modal-head {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.search-modal-head strong {
  display: block;
  font-size: 18px;
}

.search-modal-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-modal-close {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.search-modal-close svg {
  width: 22px;
}

.global-search-box {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.global-search-box svg {
  width: 22px;
  color: var(--muted);
}

.global-search-box input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 800;
}

.global-search-box input::placeholder {
  color: var(--muted);
  font-weight: 700;
}

.global-search-results {
  min-height: 220px;
  overflow-y: auto;
  padding: 14px;
}

.timetable-modal-content {
  min-height: 240px;
  overflow-y: auto;
  padding: 14px;
}

.timetable-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.timetable-toolbar strong {
  font-size: 13px;
}

.timetable-nav {
  display: grid;
  grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.timetable-nav > div {
  min-width: 0;
  text-align: right;
}

.timetable-nav strong,
.course-summary strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timetable-nav small,
.course-summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timetable-back {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-self: start;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px 0 8px;
}

.timetable-back svg {
  width: 16px;
}

.timetable-line-search {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  margin-bottom: 14px;
  padding: 0 14px;
}

.timetable-line-search svg {
  width: 18px;
  color: var(--muted);
}

.timetable-line-search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
}

.timetable-line-search input::placeholder {
  color: var(--muted);
}

.timetable-list {
  display: grid;
  gap: 7px;
}

.timetable-line-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.timetable-line-chip {
  display: inline-flex;
  min-width: 0;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 999px;
  background: #217a5b;
  color: white;
  cursor: pointer;
  font-size: 15px;
  font-weight: 950;
  padding: 0 12px;
  white-space: nowrap;
}

.timetable-line-chip svg {
  width: 16px;
  flex: 0 0 auto;
}

.timetable-line-chip.tram {
  background: #cf342b;
}

.timetable-line-chip.night {
  background: #3c4c83;
}

.timetable-line-chip.trolleybus {
  background: #4b8f16;
}

.timetable-line-chip.compact {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 13px;
}

.timetable-route-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.timetable-route-row,
.course-stop-row {
  display: grid;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.timetable-route-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 58px;
}

.timetable-row {
  display: grid;
  grid-template-columns: 56px auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 10px;
}

.timetable-row-button {
  width: 100%;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.timetable-row > time {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

.timetable-row.current {
  border-color: rgba(124, 58, 237, 0.62);
  background: var(--soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.timetable-route-heading {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.timetable-route-heading strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timetable-route-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timetable-variant-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: -2px 0 12px;
}

.timetable-variant-legend span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  padding: 0 8px;
}

.timetable-variant-legend strong {
  display: grid;
  min-width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: white;
  font-size: 10px;
}

.timetable-hour-table {
  display: grid;
  border-top: 1px solid var(--line);
}

.timetable-hour-head,
.timetable-hour-row {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
}

.timetable-hour-head {
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.timetable-hour-head span,
.timetable-hour-row > strong,
.timetable-hour-row > div {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}

.timetable-hour-head span:first-child,
.timetable-hour-row > strong {
  border-right: 1px solid var(--line);
}

.timetable-hour-row > strong {
  color: var(--ink);
  font-size: 15px;
}

.timetable-hour-row > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.timetable-minute {
  display: inline-flex;
  min-height: 28px;
  align-items: baseline;
  gap: 3px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 950;
  padding: 2px 5px;
}

.timetable-minute small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.timetable-minute.current {
  background: rgba(124, 58, 237, 0.18);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.34);
}

.timetable-minute:hover,
.timetable-line-chip:hover,
.timetable-back:hover {
  filter: brightness(1.08);
}

.course-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  margin-bottom: 12px;
  padding: 10px;
}

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

.course-stop-row {
  grid-template-columns: 58px minmax(0, 1fr) auto;
  min-height: 52px;
}

.course-stop-row time {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.course-stop-row.current {
  border-color: rgba(124, 58, 237, 0.62);
  background: var(--soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.service-run-list,
.vehicle-info-grid {
  display: grid;
  gap: 8px;
}

.service-run-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
}

.service-run-row time {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.vehicle-info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.vehicle-info-grid div {
  display: grid;
  gap: 5px;
  min-height: 64px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.vehicle-info-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.vehicle-info-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.vehicle-info-grid + .secondary-command {
  margin-top: 12px;
  text-decoration: none;
}

.route-variant-picker {
  display: grid;
  gap: 5px;
  margin: 12px 0;
}

.route-variant-picker label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.route-variant-picker select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  padding: 0 10px;
}

.secondary-command {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  padding: 0 11px;
}

.secondary-command svg {
  width: 17px;
}

.stop-departure-list + .secondary-command {
  align-self: flex-start;
  margin-top: 10px;
}

.search-result-section + .search-result-section {
  margin-top: 16px;
}

.search-result-section h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-result-grid {
  display: grid;
  gap: 8px;
}

.search-result-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  padding: 9px 10px;
  text-align: left;
}

.search-result-row:hover {
  border-color: rgba(124, 58, 237, 0.48);
  background: var(--soft);
}

.search-result-row strong,
.search-result-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-result-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.detail-panel {
  position: fixed;
  right: calc(16px + var(--safe-right));
  bottom: calc(16px + var(--safe-bottom));
  z-index: 7;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 32px - var(--safe-left) - var(--safe-right)));
  max-height: calc(100dvh - 112px - var(--safe-top) - var(--safe-bottom));
  transform: translateY(calc(100% + 24px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  transition:
    height 160ms ease,
    transform 180ms ease;
}

.detail-panel.sized {
  height: min(var(--detail-height, 520px), calc(100dvh - 112px - var(--safe-top) - var(--safe-bottom)));
}

.detail-panel.open {
  transform: translateY(0);
}

.detail-panel.collapsed {
  height: 92px;
}

.detail-panel.dragging {
  transition: none;
}

.detail-handle {
  display: grid;
  width: 100%;
  height: 22px;
  place-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: ns-resize;
}

.detail-handle span {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(156, 168, 194, 0.5);
}

.detail-close,
.detail-more {
  position: absolute;
  top: 30px;
  z-index: 1;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  cursor: pointer;
}

.detail-close {
  right: 10px;
}

.detail-more {
  right: 50px;
}

.detail-menu {
  position: absolute;
  top: 70px;
  right: 10px;
  z-index: 3;
  display: grid;
  min-width: 220px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, white);
  box-shadow: var(--tight-shadow);
  padding: 8px;
}

.detail-menu[hidden] {
  display: none;
}

.detail-menu button {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  padding: 0 10px;
  text-align: left;
}

.detail-menu button:hover {
  background: var(--soft);
}

.detail-menu svg {
  width: 18px;
}

.detail-content {
  display: flex;
  min-height: 0;
  max-height: calc(100dvh - 134px);
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px;
  scroll-padding: 16px 0;
  scroll-snap-type: y proximity;
}

.detail-panel.sized .detail-content {
  height: calc(100% - 22px);
}

.detail-route {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 42px;
  scroll-snap-align: start;
}

.detail-route > span {
  display: grid;
  min-width: 52px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: var(--bus);
  color: white;
  font-weight: 900;
}

.detail-route.tram > span {
  background: var(--tram);
}

.detail-route.night > span {
  background: var(--night);
}

.detail-route.trolleybus > span {
  background: var(--trolleybus);
}

.detail-route.faded > span {
  background: #8aa79b;
}

.detail-route.tram.faded > span {
  background: #b8908d;
}

.detail-route.night.faded > span {
  background: #858aa4;
}

.detail-route.trolleybus.faded > span {
  background: #a6b97a;
}

.detail-route strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-route small,
.detail-section p {
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  scroll-snap-align: start;
}

.detail-grid div {
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.detail-alert {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(233, 184, 0, 0.34);
  border-radius: 8px;
  background: rgba(233, 184, 0, 0.12);
  color: var(--ink);
  padding: 12px;
  scroll-snap-align: start;
}

.detail-alert strong {
  color: #e9b800;
  font-size: 12px;
  letter-spacing: 0;
}

.detail-alert span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.detail-section {
  min-height: 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  scroll-snap-align: start;
}

.detail-section.scroll-section {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  overflow: hidden;
}

.detail-section h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.detail-section p {
  margin: 0;
  line-height: 1.45;
}

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

.detail-stop-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
}

.detail-stop-row span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.detail-stop-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-stop-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.detail-stop-row:hover {
  border-color: rgba(37, 99, 235, 0.32);
}

.vehicle-timeline {
  position: relative;
  display: grid;
  align-content: start;
  gap: 0;
  min-height: 0;
  max-height: min(360px, calc(100dvh - 286px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 6px 8px;
  scroll-padding: 6px 0;
  scroll-snap-type: y proximity;
  scrollbar-color: rgba(98, 112, 127, 0.55) transparent;
}

.detail-panel.sized .vehicle-timeline {
  flex: 1 1 auto;
  max-height: none;
}

.vehicle-timeline::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 32px;
  width: 4px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.18);
}

.timeline-stop {
  position: relative;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  border: 0;
  border-bottom: 1px solid rgba(24, 33, 43, 0.08);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 8px 4px 8px 0;
  scroll-snap-align: start;
  text-align: left;
}

.timeline-stop:last-child {
  border-bottom: 0;
}

.timeline-node {
  position: relative;
  z-index: 1;
  display: grid;
  width: 54px;
  min-height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(24, 33, 43, 0.18);
  font-size: 11px;
  font-weight: 900;
}

.timeline-time,
.timeline-node .departure-time {
  align-items: center;
  gap: 2px;
  font-size: 12px;
}

.timeline-time {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--ink);
  font-weight: 900;
  line-height: 1;
}

.timeline-time strong {
  color: inherit;
  font-size: 12px;
  line-height: 1;
}

.timeline-time small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-decoration: line-through;
}

.timeline-time.ontime,
.timeline-status.ontime {
  color: var(--green);
}

.timeline-time.delayed,
.timeline-status.delayed {
  color: var(--red);
}

.timeline-time.early,
.timeline-status.early {
  color: #38bdf8;
}

.timeline-node .departure-time small {
  font-size: 10px;
}

.timeline-copy {
  min-width: 0;
}

.timeline-copy strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-copy small {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.current-badge {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.16);
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
  padding: 0 7px;
  text-transform: uppercase;
}

.timeline-code {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.timeline-stop.passed {
  opacity: 0.58;
}

.timeline-stop.passed .timeline-node {
  background: #9aa5b1;
}

.timeline-stop.current {
  margin: 4px 0;
  border: 1px solid rgba(37, 99, 235, 0.24);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  padding-left: 0;
}

.timeline-stop.current .timeline-node {
  border-color: rgba(37, 99, 235, 0.3);
  background: rgba(37, 99, 235, 0.12);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.timeline-stop.current .timeline-copy small {
  color: var(--blue);
}

.timeline-stop:hover {
  background: rgba(24, 33, 43, 0.04);
}

.panel-section {
  padding: 12px 14px;
}

.search-section {
  border-bottom: 1px solid var(--line);
}

.search-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 0 6px 0 12px;
}

.search-box svg {
  width: 18px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  font-size: 15px;
}

.icon-button,
.refresh-fab,
.follow-vehicle-fab,
.locate-fab {
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.icon-button {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
}

.quick-stats {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  border-bottom: 1px solid var(--line);
}

.quick-stats div {
  min-height: 52px;
  border-radius: 8px;
  background: #f3f5f4;
  padding: 8px 10px;
}

.quick-stats strong {
  display: block;
  font-size: 20px;
  line-height: 1;
}

.quick-stats span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.chip {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 0 11px;
  white-space: nowrap;
}

.chip.active {
  border-color: transparent;
  background: var(--ink);
  color: white;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.tab {
  display: inline-flex;
  min-width: 0;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.tab svg {
  width: 16px;
}

.tab.active {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(24, 33, 43, 0.06);
}

.content-view {
  display: none;
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 12px 14px 14px;
}

.content-view.active {
  display: block;
}

.selection-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 2px 8px rgba(24, 33, 43, 0.04);
}

.route-selection,
.vehicle-selection {
  margin-top: 10px;
}

.route-stops {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.route-stop-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  padding: 6px 8px;
  text-align: left;
}

.route-stop-row span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.route-stop-row strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-stop-row small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.route-stop-row:hover {
  border-color: rgba(37, 99, 235, 0.32);
}

.selection-card h2,
.list-header h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.selection-card .eyebrow {
  margin-bottom: 8px;
}

.selection-card p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.departures-list,
.result-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.list-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.list-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.list-row,
.departure-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: inherit;
  cursor: pointer;
  padding: 10px;
  text-align: left;
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.list-row:hover,
.departure-row:hover {
  border-color: rgba(37, 99, 235, 0.32);
  box-shadow: 0 6px 18px rgba(24, 33, 43, 0.08);
  transform: translateY(-1px);
}

.list-row:focus-visible,
.departure-row:focus-visible,
.chip:focus-visible,
.tab:focus-visible,
.icon-button:focus-visible,
.refresh-fab:focus-visible,
.follow-vehicle-fab:focus-visible,
.locate-fab:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 2px;
}

.route-pill {
  display: inline-flex;
  min-width: 44px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--bus);
  color: white;
  font-size: 12px;
  font-weight: 900;
  padding: 0 8px;
}

.route-pill.tram {
  background: var(--tram);
}

.route-pill.night {
  background: var(--night);
}

.route-pill.trolleybus {
  background: var(--trolleybus);
}

.route-pill.faded {
  background: #8aa79b;
}

.route-pill.tram.faded {
  background: #b8908d;
}

.route-pill.night.faded {
  background: #858aa4;
}

.route-pill.trolleybus.faded {
  background: #a6b97a;
}

.row-main {
  min-width: 0;
}

.row-main strong,
.departure-row strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main small,
.departure-row small {
  display: block;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.departure-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.stop-departure-list {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  max-height: min(360px, calc(100dvh - 230px));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scroll-padding: 0;
  scroll-snap-type: y proximity;
  scrollbar-color: rgba(98, 112, 127, 0.55) transparent;
}

.detail-panel.sized .stop-departure-list {
  flex: 1 1 auto;
  max-height: none;
}

.stop-departure-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong, white);
  color: var(--ink);
  padding: 10px;
  scroll-snap-align: start;
  text-align: left;
}

.stop-departure-row:disabled {
  cursor: default;
  opacity: 0.78;
}

.stop-departure-row.clickable {
  cursor: pointer;
}

.stop-departure-row.clickable:hover {
  border-color: rgba(37, 99, 235, 0.36);
  box-shadow: 0 6px 18px rgba(24, 33, 43, 0.12);
}

.departure-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.departure-time > strong {
  color: inherit;
  font-size: inherit;
  line-height: 1;
}

.departure-time.ontime > strong {
  color: var(--green);
}

.departure-time.delayed > strong {
  color: var(--red);
}

.departure-time.early > strong {
  color: #38bdf8;
}

.departure-time.scheduled > strong {
  color: var(--ink);
}

.departure-time small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: line-through;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  padding: 16px;
  font-size: 13px;
  text-align: center;
}

.refresh-fab,
.follow-vehicle-fab,
.locate-fab {
  position: fixed;
  left: calc(18px + var(--safe-left));
  right: auto;
  z-index: 5;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: white;
  box-shadow: var(--shadow);
}

.refresh-fab {
  bottom: calc(82px + var(--safe-bottom));
  background: var(--ink);
}

.follow-vehicle-fab {
  bottom: calc(146px + var(--safe-bottom));
  background: linear-gradient(135deg, var(--accent), var(--blue));
}

.follow-vehicle-fab[hidden] {
  display: none;
}

.locate-fab {
  bottom: calc(18px + var(--safe-bottom));
  background: var(--surface);
  color: var(--ink);
}

.locate-fab svg,
.follow-vehicle-fab svg,
.refresh-fab svg {
  width: 22px;
  height: 22px;
}

.refresh-fab.loading svg {
  animation: spin 1s linear infinite;
}

.toast {
  position: fixed;
  right: calc(18px + var(--safe-right));
  bottom: calc(82px + var(--safe-bottom));
  z-index: 6;
  max-width: min(420px, calc(100vw - 36px));
  transform: translateY(14px);
  border-radius: 8px;
  background: var(--ink);
  color: white;
  opacity: 0;
  padding: 12px 14px;
  pointer-events: none;
  transition: 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

.vehicle-marker {
  --vehicle-color: var(--bus);
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
}

.vehicle-marker span {
  position: relative;
  z-index: 2;
  display: grid;
  min-width: 30px;
  height: 24px;
  place-items: center;
  border: 2px solid #fff;
  border-radius: 999px;
  background: var(--vehicle-color);
  color: white;
  box-shadow: 0 5px 14px rgba(24, 33, 43, 0.26);
  font-size: 11px;
  font-weight: 900;
  padding: 0 6px;
}

.vehicle-marker i {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%) rotate(var(--vehicle-direction, 0deg)) translateY(-17px);
  border-right: 5px solid transparent;
  border-bottom: 9px solid #fff;
  border-left: 5px solid transparent;
  filter: drop-shadow(0 2px 3px rgba(24, 33, 43, 0.24));
}

.vehicle-marker.selected span {
  border-width: 3px;
  box-shadow:
    0 0 0 4px rgba(124, 58, 237, 0.5),
    0 7px 18px rgba(24, 33, 43, 0.38);
  transform: scale(1.12);
}

.vehicle-marker.mid-zoom span {
  min-width: 28px;
  height: 22px;
  font-size: 10px;
  padding: 0 5px;
}

.vehicle-marker.mid-zoom i {
  transform: translate(-50%, -50%) rotate(var(--vehicle-direction, 0deg)) translateY(-15px);
  border-right-width: 4px;
  border-bottom-width: 8px;
  border-left-width: 4px;
}

.vehicle-marker.low-zoom span {
  min-width: 24px;
  height: 20px;
  font-size: 9px;
  padding: 0 4px;
}

.vehicle-marker.low-zoom i {
  transform: translate(-50%, -50%) rotate(var(--vehicle-direction, 0deg)) translateY(-14px);
  border-right-width: 4px;
  border-bottom-width: 7px;
  border-left-width: 4px;
}

.vehicle-marker.tram {
  --vehicle-color: var(--tram);
}

.vehicle-marker.tram span {
  background: var(--vehicle-color);
}

.vehicle-marker.night {
  --vehicle-color: var(--night);
}

.vehicle-marker.night span {
  background: var(--vehicle-color);
}

.vehicle-marker.trolleybus {
  --vehicle-color: var(--trolleybus);
}

.vehicle-marker.trolleybus span {
  background: var(--vehicle-color);
}

.vehicle-marker.rail {
  --vehicle-color: #e9b800;
}

.vehicle-marker.rail span {
  background: var(--vehicle-color);
  color: #083277;
}

.vehicle-marker.faded {
  --vehicle-color: #8aa79b;
}

.vehicle-marker.tram.faded {
  --vehicle-color: #b8908d;
}

.vehicle-marker.night.faded {
  --vehicle-color: #858aa4;
}

.vehicle-marker.trolleybus.faded {
  --vehicle-color: #a6b97a;
}

.stop-marker {
  position: relative;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 99px;
  background: var(--bus);
  box-shadow:
    0 0 0 1px rgba(33, 122, 91, 0.34),
    0 5px 13px rgba(24, 33, 43, 0.26);
}

.stop-marker::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.stop-marker.selected {
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 6px rgba(124, 58, 237, 0.64),
    0 7px 18px rgba(24, 33, 43, 0.34);
  transform: scale(1.12);
}

.route-stop-hit-icon {
  border: 0;
  background: transparent;
}

.route-stop-hitbox {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.001);
  cursor: pointer;
}

.stop-marker.tram {
  background: var(--tram);
  box-shadow:
    0 0 0 1px rgba(207, 52, 43, 0.3),
    0 5px 13px rgba(24, 33, 43, 0.26);
}

.stop-marker.trolleybus {
  background: var(--trolleybus);
  box-shadow:
    0 0 0 1px rgba(132, 204, 22, 0.34),
    0 5px 13px rgba(24, 33, 43, 0.26);
}

.stop-marker.bus.tram {
  background: linear-gradient(135deg, var(--bus) 0 50%, var(--tram) 50% 100%);
}

.stop-marker.bus.trolleybus {
  background: linear-gradient(135deg, var(--bus) 0 50%, var(--trolleybus) 50% 100%);
}

.stop-marker.tram.trolleybus {
  background: linear-gradient(135deg, var(--tram) 0 50%, var(--trolleybus) 50% 100%);
}

.stop-marker.bus.tram.trolleybus {
  background: conic-gradient(var(--bus) 0 33.33%, var(--tram) 0 66.66%, var(--trolleybus) 0);
}

.rail-station-marker {
  position: relative;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.rail-station-marker span {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.96);
  border-radius: 999px;
  background: #e9b800;
  box-shadow:
    0 0 0 1px rgba(8, 50, 119, 0.4),
    0 5px 13px rgba(24, 33, 43, 0.24);
}

.rail-station-marker span::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: inherit;
  background: #083277;
}

.rail-station-marker.selected span {
  transform: scale(1.2);
  box-shadow:
    0 0 0 3px rgba(233, 184, 0, 0.34),
    0 6px 16px rgba(24, 33, 43, 0.32);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 820px) {
  .hub-shell {
    grid-template-columns: 1fr;
    gap: 28px;
    align-content: center;
    padding: 32px 0;
  }

  .hub-copy h1 {
    font-size: 52px;
  }

  .topbar {
    grid-template-columns: auto auto 1fr auto;
  }

  .region-switch {
    display: none;
  }

  .brand {
    justify-self: start;
  }

  .live-status {
    justify-self: end;
  }

  .panel {
    width: auto;
    height: 100%;
    max-height: none;
  }

  .detail-panel {
    right: calc(10px + var(--safe-right));
    left: calc(10px + var(--safe-left));
    bottom: calc(10px + var(--safe-bottom));
    width: auto;
    max-height: calc(100dvh - 92px - var(--safe-top) - var(--safe-bottom));
  }

  .detail-panel.sized {
    height: min(var(--detail-height, 520px), calc(100dvh - 92px - var(--safe-top) - var(--safe-bottom)));
  }

  .search-modal,
  .timetable-modal {
    align-items: stretch;
    padding:
      calc(10px + var(--safe-top))
      calc(10px + var(--safe-right))
      calc(10px + var(--safe-bottom))
      calc(10px + var(--safe-left));
  }

  .search-modal-shell,
  .timetable-modal-shell {
    width: 100%;
    max-height: calc(100dvh - 20px - var(--safe-top) - var(--safe-bottom));
  }

  .schedule-view {
    padding:
      calc(84px + var(--safe-top))
      calc(10px + var(--safe-right))
      calc(10px + var(--safe-bottom))
      calc(10px + var(--safe-left));
  }

  .schedule-screen-head {
    align-items: start;
  }

  .schedule-screen-head h1 {
    font-size: 28px;
  }

  .schedule-route-grid {
    grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  }

  .timetable-line-grid {
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 7px;
  }

  .timetable-hour-head,
  .timetable-hour-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .timetable-hour-head span,
  .timetable-hour-row > strong,
  .timetable-hour-row > div {
    padding: 9px 8px;
  }

  .timetable-route-heading {
    grid-template-columns: 1fr;
  }

  .filters {
    display: none;
  }

  .tabs {
    padding: 10px;
  }

  .content-view {
    padding: 10px;
  }

  .refresh-fab {
    left: calc(14px + var(--safe-left));
    right: auto;
    bottom: calc(78px + var(--safe-bottom));
  }

  .follow-vehicle-fab {
    left: calc(14px + var(--safe-left));
    right: auto;
    bottom: calc(138px + var(--safe-bottom));
  }

  .locate-fab {
    left: calc(14px + var(--safe-left));
    right: auto;
    bottom: calc(18px + var(--safe-bottom));
  }

  .toast {
    right: calc(14px + var(--safe-right));
    bottom: calc(82px + var(--safe-bottom));
  }
}

@media (max-width: 520px) {
  .brand {
    min-height: 48px;
  }

  .brand span:last-child {
    display: none;
  }

  .live-status {
    min-height: 40px;
    max-width: 190px;
    overflow: hidden;
  }

  .live-status span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tab {
    font-size: 12px;
  }

  .tab svg {
    display: none;
  }
}

body.theme-dark {
  --ink: #e8ecf6;
  --muted: #9ca8c2;
  --soft: #1f2432;
  --surface: rgba(24, 28, 40, 0.92);
  --surface-strong: rgba(31, 36, 52, 0.97);
  --line: rgba(232, 236, 246, 0.12);
  --blue: #6366f1;
  --accent: #7c3aed;
  --tram: #ef4444;
  --bus: #6366f1;
  --night: #7c3aed;
  --trolleybus: #84cc16;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.36);
  --tight-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
  color-scheme: dark;
  background: #111827;
}

body.theme-light {
  --accent: #4f46e5;
  --surface-strong: rgba(255, 255, 255, 0.98);
}

.theme-dark .leaflet-tile-pane {
  filter: brightness(0.62) contrast(1.08) saturate(0.72) hue-rotate(8deg);
}

.theme-dark .leaflet-overlay-pane {
  filter: saturate(0.9);
}

.theme-dark .brand,
.theme-dark .region-switch,
.theme-dark .live-status,
.theme-dark .menu-trigger,
.theme-dark .search-trigger {
  background: var(--surface);
  color: var(--ink);
}

.theme-dark .brand-mark,
.theme-dark .region-switch .active,
.theme-dark .chip.active,
.theme-dark .refresh-fab {
  background: linear-gradient(135deg, var(--accent), var(--blue));
}

.theme-dark .locate-fab {
  background: var(--surface);
  color: var(--ink);
}

.theme-dark .route-pill,
.theme-dark .vehicle-marker span,
.theme-dark .detail-route > span {
  background: #217a5b;
}

.theme-dark .vehicle-marker span {
  background: var(--vehicle-color);
}

.theme-dark .vehicle-marker {
  --vehicle-color: #217a5b;
}

.theme-dark .route-pill.faded,
.theme-dark .detail-route.faded > span {
  background: #6f827c;
}

.theme-dark .vehicle-marker.faded {
  --vehicle-color: #6f827c;
}

.theme-dark .stop-marker {
  background: #217a5b;
  box-shadow:
    0 0 0 1px rgba(33, 122, 91, 0.34),
    0 5px 13px rgba(0, 0, 0, 0.28);
}

.theme-dark .route-pill.tram,
.theme-dark .detail-route.tram > span {
  background: #cf342b;
}

.theme-dark .vehicle-marker.tram {
  --vehicle-color: #cf342b;
}

.theme-dark .route-pill.tram.faded,
.theme-dark .detail-route.tram.faded > span {
  background: #8b6f70;
}

.theme-dark .vehicle-marker.tram.faded {
  --vehicle-color: #8b6f70;
}

.theme-dark .stop-marker.tram {
  background: #cf342b;
  box-shadow:
    0 0 0 1px rgba(207, 52, 43, 0.36),
    0 5px 13px rgba(0, 0, 0, 0.28);
}

.theme-dark .route-pill.night,
.theme-dark .detail-route.night > span {
  background: #3c4c83;
}

.theme-dark .vehicle-marker.night {
  --vehicle-color: #3c4c83;
}

.theme-dark .route-pill.night.faded,
.theme-dark .detail-route.night.faded > span {
  background: #62687c;
}

.theme-dark .vehicle-marker.night.faded {
  --vehicle-color: #62687c;
}

.theme-dark .route-pill.trolleybus,
.theme-dark .detail-route.trolleybus > span {
  background: #84cc16;
}

.theme-dark .vehicle-marker.trolleybus {
  --vehicle-color: #84cc16;
}

.theme-dark .route-pill.rail,
.theme-dark .detail-route.rail > span {
  background: #e9b800;
  color: #083277;
}

.theme-dark .vehicle-marker.rail {
  --vehicle-color: #e9b800;
}

.theme-dark .route-pill.trolleybus.faded,
.theme-dark .detail-route.trolleybus.faded > span {
  background: #7f8d5a;
}

.theme-dark .vehicle-marker.trolleybus.faded {
  --vehicle-color: #7f8d5a;
}

.theme-dark .stop-marker.trolleybus {
  background: #84cc16;
  box-shadow:
    0 0 0 1px rgba(132, 204, 22, 0.34),
    0 5px 13px rgba(0, 0, 0, 0.28);
}

.theme-dark .stop-marker.bus.tram {
  background: linear-gradient(135deg, #217a5b 0 50%, #cf342b 50% 100%);
}

.theme-dark .stop-marker.bus.trolleybus {
  background: linear-gradient(135deg, #217a5b 0 50%, #84cc16 50% 100%);
}

.theme-dark .stop-marker.tram.trolleybus {
  background: linear-gradient(135deg, #cf342b 0 50%, #84cc16 50% 100%);
}

.theme-dark .stop-marker.bus.tram.trolleybus {
  background: conic-gradient(#217a5b 0 33.33%, #cf342b 0 66.66%, #84cc16 0);
}

.theme-dark .rail-station-marker span {
  border-color: rgba(255, 255, 255, 0.92);
  background: #e9b800;
  box-shadow:
    0 0 0 1px rgba(233, 184, 0, 0.42),
    0 5px 13px rgba(0, 0, 0, 0.3);
}

.theme-dark .side-menu {
  background: linear-gradient(180deg, #181c2c, #111525);
}

.theme-dark .side-brand .brand-mark {
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: white;
}

.theme-dark .side-nav button.active,
.theme-dark .side-nav button:hover {
  background: rgba(124, 58, 237, 0.24);
}

.theme-dark .panel,
.theme-dark .selection-card,
.theme-dark .list-row,
.theme-dark .departure-row,
.theme-dark .detail-panel,
.theme-dark .detail-menu,
.theme-dark .detail-stop-row,
.theme-dark .route-stop-row {
  background: var(--surface-strong);
  color: var(--ink);
}

.theme-dark .search-box,
.theme-dark .tab.active,
.theme-dark .quick-stats div,
.theme-dark .detail-grid div,
.theme-dark .timeline-stop.current {
  background: var(--soft);
}

.theme-dark .search-box input {
  color: var(--ink);
}

.theme-dark .icon-button,
.theme-dark .detail-close,
.theme-dark .detail-more {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
}

.theme-dark .empty-state {
  background: rgba(255, 255, 255, 0.06);
}

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  padding: 10px 12px;
}

.theme-toggle small {
  display: block;
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
}

.theme-toggle input {
  width: 42px;
  height: 24px;
  accent-color: var(--accent);
}
