:root {
  --bg: #efefef;
  --panel: #ffffff;
  --panel-soft: #f7f5f3;
  --text: #38333b;
  --muted: #686369;
  --text-primary: #38333b;
  --text-secondary: #686369;
  --text-tertiary: #999399;
  --accent: #18b8c8;
  --accent-2: #d8d3ce;
  --border: #f0ece8;
  --shadow: 0 -8px 16px rgba(0, 0, 0, 0.05);
  --stop: #ffffff;
  --stop-stroke: #0d4052;
  --mobile-sheet-collapsed-height: 48vh;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: #f2f2f2;
  color: #10252d;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(360px, 402px) 1fr;
  grid-template-areas: "sidebar map";
  height: 100vh;
  overflow: hidden;
  position: relative;
}

.sidebar {
  grid-area: sidebar;
  height: 100vh;
  padding: 14px 0 0;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow);
  position: relative;
  z-index: 2;
  overflow: hidden;
}

.sidebar__viewport {
  min-height: calc(100% - 16px);
  height: calc(100% - 16px);
  display: flex;
  flex-direction: column;
}

.sidebar__handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: #dfd9d3;
  margin: 0 auto 12px;
}

.stats {
  margin: 0;
  padding: 0 16px 8px;
}

.stats__title {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  color: var(--text);
}

.controls,
.line-panel,
.detail-panel {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.controls--sheet {
  padding: 0 16px 24px;
}

.search--sheet {
  position: relative;
  display: block;
}

.search__icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 22px;
  height: 22px;
  color: #999399;
  transform: translateY(-50%);
}

.search__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

input[type="search"] {
  width: 100%;
  border: 1px solid #efebe7;
  border-radius: 0;
  padding: 16px 16px 16px 50px;
  font: inherit;
  font-size: 18px;
  line-height: 24px;
  color: var(--text);
  background: #f8f6f3;
}

input[type="search"]::placeholder {
  color: #a19aa0;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 14px;
  font: inherit;
  font-weight: 600;
  color: #08212a;
  background: linear-gradient(135deg, var(--accent) 0%, #88ecdf 100%);
  cursor: pointer;
}

button.ghost,
.line-panel__header button {
  background: #f3f0ed;
  color: var(--muted);
}

.line-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
  padding: 0 16px 8px;
}

.line-panel__header h2 {
  display: none;
}

.line-panel {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.line-list {
  display: grid;
  gap: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.line-card {
  padding: 0 16px;
  border-radius: 0;
  border: 0;
  background: #ffffff;
  cursor: pointer;
  transition: background 0.16s ease;
}

.line-card:hover {
  background: #fcfaf8;
}

.line-card.is-active {
  background: #fcfaf8;
}

.line-card__top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  width: 100%;
}

.line-chip {
  min-width: 0;
  padding: 6px 8px;
  border-radius: 4px;
  color: white;
  text-align: center;
  font-size: 12px;
  line-height: 12px;
  font-weight: 700;
}

.line-card__content {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  border-bottom: 2px solid #f6f2ee;
}

.line-card__text {
  min-width: 0;
}

.line-card__title {
  font-size: 18px;
  line-height: 24px;
  font-weight: 400;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-card__subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 12px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-card__subtitle-dash {
  width: 20px;
  height: 0;
  border-top: 3px dashed currentColor;
  opacity: 0.7;
}

.line-card__metric {
  min-width: 34px;
  color: var(--muted);
  text-align: right;
}

.line-card__metric-value {
  font-size: 18px;
  line-height: 24px;
  font-weight: 400;
}

.line-card__metric-unit {
  font-size: 12px;
  line-height: 12px;
  font-weight: 300;
}

.detail-panel__placeholder {
  color: var(--muted);
  line-height: 1.5;
  padding: 0 16px 24px;
}

.detail-panel {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  background: #ffffff;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.detail-sheet {
  --detail-hero-fg: #ffffff;
  --detail-hero-secondary: rgba(255, 255, 255, 0.9);
  --detail-hero-tertiary: rgba(255, 255, 255, 0.72);
  --detail-hero-surface: rgba(255, 255, 255, 0.12);
  --detail-hero-surface-strong: rgba(255, 255, 255, 0.14);
  --detail-hero-stroke: rgba(255, 255, 255, 0.82);
  --detail-hero-ring: rgba(255, 255, 255, 0.28);
  --detail-hero-grabber: rgba(255, 255, 255, 0.24);
  min-height: 100%;
  background: #ffffff;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.detail-sheet__hero {
  padding: 12px 16px 16px;
  color: var(--detail-hero-fg);
  background: var(--line-color, #ba3b4b);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.05);
}

.detail-sheet__grabber {
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: var(--detail-hero-grabber);
}

.detail-sheet__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-sheet__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  color: var(--detail-hero-secondary);
  font-size: 14px;
  line-height: 20px;
}

.detail-sheet__line-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--detail-hero-surface-strong);
  color: var(--detail-hero-fg);
  font-size: 12px;
  line-height: 12px;
  font-weight: 700;
}

.detail-panel__close {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--detail-hero-fg);
  display: grid;
  place-items: center;
}

.detail-panel__close svg {
  width: 18px;
  height: 18px;
  display: block;
}

.detail-panel__close--dark {
  color: var(--text-primary);
}

.detail-sheet__inputs {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  position: relative;
}

.detail-sheet__connector {
  position: absolute;
  left: 27px;
  top: 44px;
  bottom: 44px;
  width: 0;
  border-left: 3px dotted var(--detail-hero-stroke);
  opacity: 0.9;
  pointer-events: none;
}

.detail-sheet__input {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 16px;
  border-radius: 2px;
  background: var(--detail-hero-surface);
}

.detail-sheet__input-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
}

.detail-sheet__input-icon::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--detail-hero-fg);
}

.detail-sheet__input-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--detail-hero-secondary);
}

.detail-sheet__input-value {
  font-size: 18px;
  line-height: 24px;
  font-weight: 300;
  color: var(--detail-hero-fg);
}

.detail-sheet__swap {
  position: absolute;
  right: 16px;
  top: 50%;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  background: #ffffff;
  color: var(--line-color, #ba3b4b);
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  border: 3px solid var(--detail-hero-ring);
  transform: translateY(-50%);
  box-shadow: 0 8px 18px rgba(16, 37, 45, 0.18);
  z-index: 1;
}

.detail-sheet__swap svg {
  width: 18px;
  height: 18px;
  display: block;
}

.detail-sheet__body {
  padding: 16px 0 24px;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.detail-sheet__count {
  margin: 0;
  padding: 0 16px 12px;
  font-size: 22px;
  line-height: 28px;
  color: var(--text);
}

.itinerary-list {
  display: grid;
  gap: 12px;
  margin-top: 0;
  padding: 0 16px 24px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.itinerary-card {
  padding: 0;
  border-radius: 0;
  background: transparent;
}

.itinerary-card h3,
.itinerary-card p,
.itinerary-card__stops {
  display: none;
}

.detail-panel__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0;
}

.stop-sequence {
  margin: 0;
  padding: 0 16px;
  list-style: none;
  display: grid;
  gap: 0;
}

.stop-sequence__item {
  display: grid;
  grid-template-columns: 16px 1fr;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
  background: transparent;
  cursor: pointer;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.stop-sequence__item:hover {
  opacity: 0.88;
}

.stop-sequence__rail {
  position: relative;
  min-height: 56px;
  width: 16px;
}

.stop-sequence__rail::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -8px;
  bottom: -8px;
  width: 4px;
  background: var(--line-color, #ba3b4b);
}

.stop-sequence__item.is-optional .stop-sequence__rail::before {
  background: repeating-linear-gradient(
    to bottom,
    var(--line-color, #ba3b4b) 0 8px,
    transparent 8px 16px
  );
}

.stop-sequence__item.is-last .stop-sequence__rail::before {
  height: 24px;
  bottom: auto;
}

.stop-sequence__rail-dot {
  position: absolute;
  left: 2px;
  top: 8px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 3px solid var(--line-color, #ba3b4b);
  z-index: 1;
}

.stop-sequence__item.is-terminal .stop-sequence__rail-dot {
  left: 1px;
  top: 7px;
  width: 14px;
  height: 14px;
}

.stop-sequence__content {
  min-width: 0;
}

.stop-sequence__title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stop-sequence__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 18px;
  line-height: 24px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-sequence__code {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 20px;
  color: var(--muted);
}

.stop-sequence__transfers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.stop-sequence__transfer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 12px;
  font-weight: 700;
}

.stop-sequence__tag {
  margin-top: 6px;
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(186, 59, 75, 0.1);
  color: var(--line-color, #ba3b4b);
  font-size: 12px;
  line-height: 12px;
  font-weight: 600;
}

.stop-sheet {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.stop-sheet__header {
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  background: #ffffff;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05);
}

.stop-sheet__topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.stop-sheet__title-block {
  display: grid;
  gap: 12px;
}

.stop-sheet__title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.stop-sheet__title {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: var(--text-primary);
}

.stop-sheet__id {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
}

.stop-sheet__filters {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.stop-sheet__filters::-webkit-scrollbar {
  display: none;
}

.stop-sheet__filter-chip {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 12px;
  font-weight: 700;
  background: var(--chip-color, #ba3b4b);
  color: var(--chip-text, #ffffff);
  opacity: 0.42;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.stop-sheet__filter-chip.is-active,
.stop-sheet__filter-chip:hover {
  opacity: 1;
}

.stop-sheet__list-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 24px 0 0;
}

.stop-sheet__history-toggle {
  align-self: flex-start;
  margin: 0 16px 16px;
  padding: 8px 12px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 300;
  font-size: 18px;
  line-height: 24px;
}

.stop-sheet__history-toggle svg {
  width: 20px;
  height: 20px;
  color: #e04b4b;
  transition: transform 0.16s ease;
}

.stop-sheet__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.stop-arrival {
  padding: 0 16px;
  cursor: pointer;
}

.stop-arrival__row {
  display: flex;
  align-items: stretch;
  gap: 12px;
  border-radius: 4px;
  transition: background 0.16s ease;
}

.stop-arrival__line {
  display: flex;
  align-items: flex-start;
  padding: 20px 0;
}

.stop-arrival__content {
  flex: 1 1 auto;
  min-width: 0;
  border-bottom: 2px solid #f6f2ee;
  padding: 14px 0;
  display: grid;
  gap: 12px;
}

.stop-arrival__main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stop-arrival__text {
  flex: 1 1 auto;
  min-width: 0;
}

.stop-arrival__destination {
  font-size: 18px;
  line-height: 24px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-arrival__times {
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 12px;
}

.stop-arrival__time.is-struck {
  text-decoration: line-through;
  color: var(--text-tertiary);
}

.stop-arrival__time--live {
  color: #d44b4b;
  font-weight: 600;
}

.stop-arrival__eta {
  flex: 0 0 auto;
  min-width: 42px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
}

.stop-arrival__eta--now {
  min-width: 58px;
}

.stop-arrival__eta-value {
  font-size: 18px;
  line-height: 24px;
  color: var(--text-primary);
}

.stop-arrival__eta-unit {
  font-size: 12px;
  line-height: 12px;
  color: var(--text-secondary);
}

.stop-arrival__alert {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 4px;
  background: #f8dbe0;
  color: #b43953;
  font-size: 14px;
  line-height: 20px;
}

.stop-arrival__alert-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.stop-arrival.is-past .stop-arrival__row,
.stop-arrival:hover .stop-arrival__row {
  background: rgba(0, 0, 0, 0.03);
}

.stop-arrival:active .stop-arrival__row {
  background: rgba(0, 0, 0, 0.06);
}

.trip-sheet {
  --detail-hero-fg: #ffffff;
  --detail-hero-secondary: rgba(255, 255, 255, 0.9);
  --detail-hero-tertiary: rgba(255, 255, 255, 0.72);
  --detail-hero-surface: rgba(255, 255, 255, 0.12);
  --detail-hero-surface-strong: rgba(255, 255, 255, 0.14);
  --detail-hero-stroke: rgba(255, 255, 255, 0.82);
  --detail-hero-ring: rgba(255, 255, 255, 0.28);
  --detail-hero-grabber: rgba(255, 255, 255, 0.24);
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #ffffff;
}

.trip-sheet__hero {
  position: relative;
  flex: 0 0 auto;
  padding: 12px 16px 16px;
  color: var(--detail-hero-fg);
  background: var(--line-color, #ba3b4b);
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  box-shadow: 0 -8px 16px rgba(0, 0, 0, 0.05);
}

.trip-sheet__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.trip-sheet__title-block {
  display: grid;
  gap: 4px;
  margin-top: 16px;
}

.trip-sheet__title {
  margin: 0;
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
  color: var(--detail-hero-fg);
}

.trip-sheet__subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--detail-hero-secondary);
}

.trip-sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 0 24px;
  background: #ffffff;
}

.trip-sheet__banner {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  margin: 0 16px 16px;
  padding: 12px 16px;
  border: 2px solid #ffdce3;
  border-radius: 4px;
  background: #ffdce3;
}

.trip-sheet__banner-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #ff4258;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
}

.trip-sheet__banner-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.trip-sheet__banner-copy strong {
  font-size: 18px;
  line-height: 24px;
  font-weight: 400;
  color: var(--text-primary);
}

.trip-sheet__banner-copy span {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
}

.trip-stop-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.trip-stop {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding: 8px 16px;
  background: #ffffff;
}

.trip-stop__rail {
  position: relative;
  width: 16px;
  min-height: 56px;
}

.trip-stop__rail::before {
  content: "";
  position: absolute;
  left: 6px;
  top: -8px;
  bottom: -8px;
  width: 4px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.4) 100%),
    linear-gradient(90deg, var(--line-color, #ba3b4b) 0%, var(--line-color, #ba3b4b) 100%);
}

.trip-stop.is-first-visible .trip-stop__rail::before {
  top: 8px;
}

.trip-stop.is-terminal .trip-stop__rail::before {
  height: 24px;
  bottom: auto;
}

.trip-stop__dot {
  position: absolute;
  left: 5px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-color, #ba3b4b);
  z-index: 1;
}

.trip-stop.is-current .trip-stop__dot,
.trip-stop.is-terminal .trip-stop__dot {
  left: 2px;
  top: 8px;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 3px solid var(--line-color, #ba3b4b);
}

.trip-stop.is-past .trip-stop__rail::before,
.trip-stop.is-past .trip-stop__dot {
  opacity: 0.46;
}

.trip-stop__content {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding-bottom: 8px;
}

.trip-stop__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.trip-stop__name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 18px;
  line-height: 24px;
  color: var(--text-primary);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-stop.is-current .trip-stop__name,
.trip-stop.is-terminal .trip-stop__name {
  font-weight: 600;
}

.trip-stop.is-past .trip-stop__name,
.trip-stop.is-past .trip-stop__time {
  color: #969395;
}

.trip-stop__times {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 12px;
  margin-left: auto;
}

.trip-stop__time {
  font-size: 18px;
  line-height: 24px;
  color: var(--text-primary);
  white-space: nowrap;
}

.trip-stop__time--scheduled {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.trip-stop__time--live {
  color: #d44b4b;
}

.trip-stop__alert {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 4px;
  background: #f8dbe0;
  color: #b43953;
  font-size: 14px;
  line-height: 20px;
}

.trip-stop.is-past .trip-stop__alert {
  opacity: 0.78;
}

.trip-stop.has-alert {
  padding-bottom: 0;
}

.trip-stop__alert-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex: 0 0 auto;
}

.bus-vehicle-marker {
  background: transparent;
  border: 0;
}

.bus-vehicle {
  position: relative;
  width: 34px;
  height: 34px;
  transform: rotate(var(--vehicle-angle, 0deg));
  transform-origin: center;
  filter: drop-shadow(0 12px 14px rgba(16, 37, 45, 0.2));
}

.bus-vehicle::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 1px;
  bottom: 1px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0));
}

.bus-vehicle__body {
  position: absolute;
  inset: 2px 7px;
  border-radius: 11px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--vehicle-color, #ba3b4b) 72%, #ffd56e) 0%,
    color-mix(in srgb, var(--vehicle-color, #ba3b4b) 82%, #f3b54e) 48%,
    var(--vehicle-color, #ba3b4b) 100%
  );
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.22),
    0 10px 16px rgba(16, 37, 45, 0.22);
}

.bus-vehicle__body::before,
.bus-vehicle__body::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, #0d3952 0%, #17374d 100%);
}

.bus-vehicle__body::before {
  left: 2px;
}

.bus-vehicle__body::after {
  right: 2px;
}

.bus-vehicle__roof {
  position: absolute;
  inset: 6px 11px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.08));
}

.bus-vehicle__windshield {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 4px;
  height: 7px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #103b55 0%, #0c2d43 100%);
}

.bus-vehicle__rear-window {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 4px;
  height: 7px;
  border-radius: 4px 4px 8px 8px;
  background: linear-gradient(180deg, #0c2d43 0%, #103b55 100%);
}

.bus-vehicle::after {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 13px;
  bottom: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}

.bus-vehicle--past {
  opacity: 0.5;
}

.bus-vehicle--upcoming {
  opacity: 0.84;
}

.bus-vehicle--active .bus-vehicle__body {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 0 0 3px rgba(255, 255, 255, 0.4),
    0 12px 18px rgba(16, 37, 45, 0.28);
}

.map-area {
  grid-area: map;
  position: relative;
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

.map-toolbar {
  position: absolute;
  top: 26px;
  left: 26px;
  right: 26px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(8, 33, 42, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(16, 37, 45, 0.15);
}

.map-toolbar__action {
  padding: 10px 14px;
  border-radius: 999px;
  background: #f3f0ed;
  color: #38333b;
  font-size: 0.84rem;
  font-weight: 600;
}

.toolbar-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #27424a;
  font-size: 0.84rem;
  font-weight: 600;
}

.toolbar-toggle input {
  width: 16px;
  height: 16px;
  accent-color: #0b6070;
}

#map {
  width: 100%;
  height: 100vh;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
}

.stop-tooltip {
  border: 0;
  border-radius: 12px;
  background: rgba(16, 37, 45, 0.92);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(16, 37, 45, 0.22);
}

.stop-tooltip .leaflet-tooltip-content {
  margin: 8px 10px;
  font-size: 12px;
  line-height: 12px;
  font-weight: 600;
}

.stop-tooltip.leaflet-tooltip-top::before {
  border-top-color: rgba(16, 37, 45, 0.92);
}

.transfer-node-marker {
  background: transparent;
  border: 0;
}

.transfer-node {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.transfer-node-marker.is-dimmed .transfer-node {
  transform: scale(0.96);
}

.transfer-node__shell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 8px;
  border: 3px solid #101f25;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 16px rgba(16, 31, 37, 0.16);
}

.transfer-node__shell--vertical {
  flex-direction: column;
  min-width: 24px;
}

.transfer-node__shell--horizontal {
  flex-direction: row;
  min-height: 24px;
}

.transfer-node__shell--diagonal {
  flex-direction: row;
  min-height: 24px;
  transform: rotate(var(--transfer-angle, 45deg));
  transform-origin: center;
}

.transfer-node__dot,
.transfer-node__count {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.transfer-node__dot {
  background: var(--dot-color, #18b8c8);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.96);
}

.transfer-node__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid rgba(16, 31, 37, 0.14);
  background: #eff7f8;
  color: #14343e;
  font-size: 0.58rem;
  font-weight: 700;
}

.schematic-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
}

.schematic-modal.is-hidden {
  display: none;
}

.schematic-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 13, 18, 0.7);
  backdrop-filter: blur(8px);
}

.schematic-modal__dialog {
  position: relative;
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 18px;
  border-radius: 24px;
  background: white;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.28);
  overflow: auto;
}

.schematic-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.schematic-modal__header h2 {
  margin: 0;
}

.schematic-modal__image {
  width: 100%;
  height: auto;
  border-radius: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

@media (max-width: 1100px) {
  .app-shell {
    display: block;
  }

  .map-area {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    height: 100vh;
    padding: 0;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    z-index: 1200;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--mobile-sheet-collapsed-height);
    padding-top: 12px;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
    overflow: hidden;
    transition: height 0.24s ease, border-radius 0.24s ease;
    box-shadow: 0 -18px 40px rgba(16, 37, 45, 0.18);
  }

  .app-shell.is-mobile-sheet-expanded .sidebar {
    height: 100vh;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .sidebar__viewport {
    height: calc(100% - 16px);
    padding-bottom: 24px;
  }

  .line-list,
  .itinerary-list,
  .stop-sheet__list,
  .trip-sheet__body {
    overflow-y: hidden;
  }

  .app-shell.is-mobile-sheet-expanded .line-list,
  .app-shell.is-mobile-sheet-expanded .itinerary-list,
  .app-shell.is-mobile-sheet-expanded .stop-sheet__list,
  .app-shell.is-mobile-sheet-expanded .trip-sheet__body {
    overflow-y: auto;
  }

  #map {
    min-height: 100vh;
    height: 100vh;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 680px) {
  .map-toolbar {
    top: 12px;
    left: 12px;
    right: 12px;
    padding: 8px 12px;
    border-radius: 16px;
  }

  .line-card {
    padding: 0 12px;
  }

  .line-panel__header,
  .controls--sheet,
  .stats,
  .itinerary-list,
  .stop-sheet__list,
  .stop-sequence,
  .detail-sheet__body,
  .detail-sheet__count {
    padding-left: 12px;
    padding-right: 12px;
  }

  .detail-sheet__hero,
  .stop-sheet__header {
    padding-left: 12px;
    padding-right: 12px;
  }

  .stop-sheet__history-toggle {
    margin-left: 12px;
    margin-right: 12px;
  }
}
