/* ============================================================
   Route Map — the whole network on one map.

   The page renders in two shells: the Crew Center (ja_styles.css and the
   type scale are loaded) and the public site (they are not). Every token is
   therefore named with its light-theme value as a fallback, and the page's
   own colours are gathered below so each is spelled once.

   Desktop starts at 1024px, as on Flight Schedules: map and panel side by
   side in one viewport-high card. Below that the panel follows the map.
   ============================================================ */

.route-map-page {
  --rm-bg: var(--app-bg, #F3F5F7);
  --rm-surface: var(--app-surface-solid, #ffffff);
  --rm-wash: var(--row-wash, rgba(0, 56, 117, .028));
  --rm-wash-strong: var(--row-wash-strong, rgba(0, 56, 117, .055));
  --rm-border: var(--app-border, rgba(32, 54, 102, .10));
  --rm-border-hover: var(--app-border-hover, rgba(0, 56, 117, .26));
  --rm-border-focus: var(--app-border-focus, rgba(0, 56, 117, .40));
  --rm-text: var(--app-text, #141250);
  --rm-muted: var(--app-muted, #8a91b3);
  --rm-subtle: var(--app-subtle, #69729B);
  --rm-primary: var(--accent-primary-tint-fg, #003875);
  --rm-primary-tint: var(--accent-primary-tint, #EAF1FF);
  --rm-success: var(--accent-success-tint-fg, #006C43);
  --rm-success-tint: var(--accent-success-tint, #DDF8EC);
  --rm-warning: var(--accent-warning-tint-fg, #8A4A00);
  --rm-warning-tint: var(--accent-warning-tint, #FFF2D9);
  --rm-danger: var(--accent-danger-tint-fg, #A93612);
  --rm-danger-tint: var(--accent-danger-tint, #FFE5DD);
  --rm-shadow: var(--shadow-pop, 0 18px 50px rgba(45, 57, 102, .16));

  /* The map's own line colours (shared/map-theme.js), for the legend. */
  --rm-departures: #F58932;
  --rm-arrivals: #37B6FF;
  --rm-here: #07b96d;
}

[data-bs-theme="dark"] .route-map-page {
  --rm-departures: #FF9B42;
  --rm-arrivals: #73D4FF;
  --rm-here: #00e49a;
}

/* ---------- Public shell ---------- */

.route-map-page--public {
  padding: 32px 0 48px;
  background: var(--rm-bg);
  color: var(--rm-text);
}

.rm-public-header {
  margin-bottom: 20px;
}

.rm-public-eyebrow {
  margin: 0 0 6px;
  color: var(--rm-departures);
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-caps, .05em);
  text-transform: uppercase;
}

.rm-public-title {
  margin: 0 0 6px;
  color: var(--rm-text);
  font-size: var(--type-size-4xl, 1.6rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-public-subtitle {
  margin: 0;
  color: var(--rm-subtle);
  font-size: var(--type-size-base, .95rem);
}

/* The public site's Bootstrap button in JerryAir's own colours. */
.route-map-page--public .btn-primary {
  --bs-btn-bg: var(--accent-primary-solid, #003875);
  --bs-btn-border-color: var(--accent-primary-solid, #003875);
  --bs-btn-color: var(--accent-primary-solid-fg, #ffffff);
  --bs-btn-hover-bg: #002a59;
  --bs-btn-hover-border-color: #002a59;
  --bs-btn-hover-color: var(--accent-primary-solid-fg, #ffffff);
  --bs-btn-border-radius: var(--radius-pill, 999px);
  --bs-btn-font-weight: var(--type-weight-bold, 700);
}

/* The Crew Center card classes do this on the dashboard. */
.route-map-page--public .route-map {
  background: var(--rm-surface);
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-xl, 24px);
  overflow: hidden;
}

/* ---------- Card and stage ---------- */

.route-map {
  position: relative;
  color: var(--rm-text);
}

.rm-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.rm-map-wrap {
  position: relative;
  height: min(62vh, 560px);
  min-height: 340px;
  background: var(--rm-bg);
}

.rm-map {
  position: absolute;
  inset: 0;
}

.rm-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-top: 1px solid var(--rm-border);
  background: var(--rm-surface);
}

.rm-panel-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.route-map.is-failed .rm-panel {
  display: none;
}

@media (min-width: 1024px) {
  .route-map {
    height: max(600px, calc(100dvh - 210px));
  }

  .route-map-page--public .route-map {
    height: max(560px, calc(100dvh - 240px));
  }

  .rm-stage {
    grid-template-columns: minmax(0, 1fr) 400px;
    height: 100%;
  }

  .route-map.is-failed .rm-stage {
    grid-template-columns: minmax(0, 1fr);
  }

  .rm-map-wrap {
    height: auto;
    min-height: 0;
  }

  .rm-panel {
    min-height: 0;
    border-top: 0;
    border-left: 1px solid var(--rm-border);
  }

  .rm-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  /* The list scrolls under its tabs. Stuck, they cover the panel's 16px
     padding, which would otherwise show the list through a gap; in place,
     they fill the 14px gap above them without overlapping the card there. */
  .rm-tabs {
    position: sticky;
    top: -16px;
    z-index: 2;
    margin-top: -14px;
    padding-top: 14px;
    background: var(--rm-surface);
  }
}

/* ---------- Overlay: loading, empty, failed ---------- */

.rm-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  background: var(--rm-surface);
  color: var(--rm-subtle);
  text-align: center;
}

.rm-overlay[hidden] {
  display: none;
}

.rm-overlay .spinner-border {
  color: var(--rm-departures);
}

.rm-overlay i {
  color: var(--rm-departures);
  font-size: var(--type-size-4xl, 1.6rem);
}

.rm-overlay p {
  max-width: 36ch;
  margin: 0;
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-medium, 500);
}

/* ---------- Legend and map chrome ---------- */

.rm-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  max-width: calc(100% - 24px);
  padding: 8px 12px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-surface);
  color: var(--rm-subtle);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-semibold, 600);
  pointer-events: none;
}

.rm-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rm-legend i {
  display: inline-block;
  flex: 0 0 auto;
}

/* Summer / winter: the schedule flying now, or next season's loaded ahead. */
.rm-season {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 3px;
  max-width: calc(100% - 64px);
  padding: 3px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-surface);
  box-shadow: 0 6px 18px rgba(20, 18, 80, .10);
}

.rm-season button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  padding: 6px 12px;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--rm-subtle);
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease;
}

.rm-season button:hover {
  background: var(--rm-wash-strong);
  color: var(--rm-text);
}

.rm-season button strong {
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-bold, 700);
  white-space: nowrap;
}

.rm-season button small {
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-medium, 500);
  opacity: .8;
  white-space: nowrap;
}

.rm-season button[aria-pressed="true"] {
  background: var(--rm-primary);
  color: #ffffff;
}

[data-bs-theme="dark"] .rm-season button[aria-pressed="true"] {
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-season button:disabled {
  cursor: progress;
}

.rm-season button:focus-visible {
  outline: 2px solid var(--rm-border-focus);
  outline-offset: 2px;
}

/* "All routes": the legend's one control. */
.rm-network-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--rm-text);
  font-size: inherit;
  font-weight: var(--type-weight-bold, 700);
  pointer-events: auto;
  cursor: pointer;
}

.rm-network-toggle[hidden] {
  display: none;
}

.rm-switch {
  position: relative;
  width: 26px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill, 999px);
  background: var(--rm-border-hover);
  transition: background-color 140ms ease;
}

.rm-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 140ms ease;
}

.rm-network-toggle.is-on .rm-switch {
  background: var(--rm-primary);
}

.rm-network-toggle.is-on .rm-switch::after {
  transform: translateX(11px);
}

.rm-network-toggle:focus-visible {
  outline: 2px solid var(--rm-border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm, 8px);
}

.rm-legend-line {
  width: 18px;
  height: 3px;
  border-radius: var(--radius-pill, 999px);
  background: var(--rm-departures);
}

.rm-legend-line--in {
  background: var(--rm-arrivals);
}

.rm-legend-hub {
  width: 12px;
  height: 12px;
  border: 2px solid var(--rm-primary);
  border-radius: 50%;
}

.rm-legend-here {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--rm-here);
  box-shadow: 0 0 0 3px rgba(7, 185, 109, .25);
}

/* The pilot's airport. MapLibre positions the marker element itself, so
   only its children are placed here. */
.rm-here-marker {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.rm-here-pulse,
.rm-here-core {
  position: absolute;
  border-radius: 50%;
}

.rm-here-pulse {
  inset: 0;
  background: var(--rm-here);
  opacity: .35;
  animation: rm-here-pulse 2.2s ease-out infinite;
}

.rm-here-core {
  inset: 8px;
  background: var(--rm-here);
  box-shadow: 0 0 0 2px #ffffff, 0 2px 6px rgba(0, 24, 46, .35);
}

@keyframes rm-here-pulse {
  from { transform: scale(.4); opacity: .7; }
  to { transform: scale(1.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .rm-here-pulse {
    animation: none;
  }
}

.rm-popup .maplibregl-popup-content {
  padding: 8px 12px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-sm, 8px);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow);
  color: var(--rm-text);
}

.rm-popup .maplibregl-popup-tip {
  display: none;
}

.rm-popup-body {
  display: grid;
  gap: 1px;
}

.rm-popup-body strong {
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-popup-body span {
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-medium, 500);
}

.rm-popup-body small {
  color: var(--rm-subtle);
  font-size: var(--type-size-2xs, .72rem);
}

/* ---------- Flags (as on Flight Schedules) ---------- */

.route-map-page .flag-wrapper {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--rm-surface);
  box-shadow: inset 0 0 0 1px var(--rm-border);
}

.route-map-page .flag-wrapper > .flag {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* ---------- Search ---------- */

.rm-search {
  position: relative;
  flex: 0 0 auto;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rm-border);
}

.rm-search > .bi-search {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--rm-muted);
  pointer-events: none;
}

.rm-search input {
  width: 100%;
  min-height: var(--btn-h, 44px);
  padding: 0 16px 0 40px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-pill, 999px);
  outline: none;
  background: var(--rm-surface);
  color: var(--rm-text);
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-medium, 500);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.rm-search input::placeholder {
  color: var(--rm-muted);
  font-weight: var(--type-weight-regular, 400);
}

.rm-search input:focus {
  border-color: var(--rm-border-focus);
  box-shadow: 0 0 0 3px var(--rm-primary-tint);
}

.rm-results {
  position: absolute;
  left: 16px;
  right: 16px;
  top: calc(100% - 8px);
  z-index: 6;
  max-height: 340px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-surface);
  box-shadow: var(--rm-shadow);
}

.rm-results[hidden] {
  display: none;
}

.rm-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm, 8px);
  background: transparent;
  color: var(--rm-text);
  text-align: left;
}

.rm-result:hover,
.rm-result.is-active {
  background: var(--rm-wash-strong);
}

.rm-result-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.rm-result-text strong {
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-result-text small,
.rm-result-text span {
  overflow: hidden;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-medium, 500);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-result-count {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: var(--radius-pill, 999px);
  background: var(--rm-wash-strong);
  color: var(--rm-subtle);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-result-empty {
  margin: 0;
  padding: 10px;
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
}

/* ---------- Shared panel pieces ---------- */

.rm-eyebrow {
  margin: 0 0 4px;
  color: var(--rm-departures);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-caps, .05em);
  text-transform: uppercase;
}

.rm-heading {
  margin: 0 0 14px;
  font-size: var(--type-size-2xl, 1.25rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.rm-stats > div {
  padding: 10px 12px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-wash);
}

.rm-stats dt {
  color: var(--rm-subtle);
  font-size: var(--type-size-3xs, .68rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-caps, .05em);
  text-transform: uppercase;
}

.rm-stats dd {
  margin: 2px 0 0;
  font-size: var(--type-size-2xl, 1.25rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-stats--compact dd {
  font-size: var(--type-size-lg, 1.02rem);
}

.rm-section-title {
  margin: 18px 0 8px;
  color: var(--rm-subtle);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-caps, .05em);
  text-transform: uppercase;
}

.rm-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 16px 0 0;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
}

.rm-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md, 14px);
  background: var(--rm-warning-tint);
  color: var(--rm-warning);
  font-size: var(--type-size-sm, .82rem);
}

.rm-note p {
  margin: 0;
}

.rm-note--season {
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-empty {
  margin: 0;
  padding: 18px 8px;
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
  text-align: center;
}

/* ---------- Overview ---------- */

.rm-here-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-md, 14px);
  background: var(--rm-success-tint);
  color: var(--rm-success);
  text-align: left;
  transition: border-color 140ms ease;
}

.rm-here-card:hover,
.rm-here-card:focus-visible {
  border-color: var(--rm-success);
}

.rm-here-card-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--rm-here);
  box-shadow: 0 0 0 4px rgba(7, 185, 109, .22);
}

.rm-here-card-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.rm-here-card-text small {
  font-size: var(--type-size-3xs, .68rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-caps, .05em);
  text-transform: uppercase;
}

.rm-here-card-text strong {
  font-size: var(--type-size-lg, 1.02rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-here-card-text span {
  overflow: hidden;
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-medium, 500);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-here-card-count {
  flex: 0 0 auto;
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-semibold, 600);
}

.rm-airport-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rm-airport-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: transparent;
  color: var(--rm-text);
  text-align: left;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.rm-airport-btn:hover,
.rm-airport-btn:focus-visible {
  border-color: var(--rm-border-hover);
  background: var(--rm-wash);
}

.rm-airport-btn-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.rm-airport-btn-text strong {
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-airport-btn-text small {
  overflow: hidden;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-airport-btn-count {
  flex: 0 0 auto;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
  font-weight: var(--type-weight-semibold, 600);
}

/* ---------- Airport ---------- */

.rm-airport-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.rm-icon-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: var(--btn-h-compact, 34px);
  height: var(--btn-h-compact, 34px);
  margin-top: 3px;
  padding: 0;
  border: 1px solid var(--rm-border);
  border-radius: 50%;
  background: var(--rm-surface);
  color: var(--rm-text);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.rm-icon-btn:hover,
.rm-icon-btn:focus-visible {
  border-color: var(--rm-border-hover);
  background: var(--rm-wash-strong);
}

.rm-airport-title {
  min-width: 0;
}

.rm-airport-title h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: var(--type-size-3xl, 1.4rem);
  font-weight: var(--type-weight-bold, 700);
  line-height: 1.15;
}

.rm-airport-title h2 small {
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-semibold, 600);
}

.rm-airport-name {
  margin: 2px 0 0;
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-semibold, 600);
}

.rm-airport-place {
  margin: 1px 0 0;
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
}

.rm-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-pill, 999px);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-bold, 700);
  letter-spacing: var(--letter-wide, .015em);
}

.rm-badge--hub {
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-badge--here {
  background: var(--rm-success-tint);
  color: var(--rm-success);
}

/* ---------- What the pilot can do here ---------- */

.rm-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  padding: 14px;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-wash);
}

.rm-action--here {
  border-color: transparent;
  background: var(--rm-success-tint);
  color: var(--rm-success);
}

.rm-action--notice {
  border-color: transparent;
  background: var(--rm-warning-tint);
  color: var(--rm-warning);
}

.rm-action--guest {
  border-color: transparent;
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-action--season {
  border-color: transparent;
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-action--jumpseat {
  grid-template-columns: minmax(0, 1fr);
}

.rm-action-icon {
  font-size: var(--type-size-xl, 1.12rem);
  line-height: 1.2;
}

.rm-action-text strong {
  display: block;
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-action-text p {
  margin: 2px 0 0;
  font-size: var(--type-size-sm, .82rem);
  opacity: .9;
}

.rm-action-button {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
}

.rm-action-button .btn {
  width: 100%;
  white-space: nowrap;
}

.rm-jumpseat-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  color: var(--rm-primary);
}

.rm-jumpseat-head .rm-action-text p {
  color: var(--rm-subtle);
}

.rm-jumpseat-facts {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rm-jumpseat-facts li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.rm-jumpseat-facts i {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--rm-primary-tint);
  color: var(--rm-primary);
}

.rm-jumpseat-facts .is-free i {
  background: var(--rm-success-tint);
  color: var(--rm-success);
}

.rm-jumpseat-facts .is-paid i {
  background: var(--rm-warning-tint);
  color: var(--rm-warning);
}

.rm-jumpseat-facts span {
  display: grid;
  min-width: 0;
}

.rm-jumpseat-facts strong {
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-jumpseat-facts small {
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
}

.rm-jumpseat-blocked {
  padding: 10px 12px;
  border-radius: var(--radius-sm, 8px);
  background: var(--rm-danger-tint);
  color: var(--rm-danger);
}

.rm-jumpseat-blocked strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-jumpseat-blocked ul {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: var(--type-size-xs, .76rem);
}

.rm-jumpseat-loading,
.rm-jumpseat-error,
.rm-status-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
}

.rm-jumpseat-error,
.rm-status-note.is-error {
  color: var(--rm-danger);
}

/* ---------- Departures and arrivals ---------- */

.rm-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rm-border);
}

.rm-tab {
  display: inline-flex;
  flex: 1 1 0;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: -1px;
  padding: 10px 8px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--rm-subtle);
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-semibold, 600);
  transition: color 140ms ease, border-color 140ms ease;
}

.rm-tab:hover {
  color: var(--rm-text);
}

.rm-tab.is-active {
  border-bottom-color: var(--rm-departures);
  color: var(--rm-text);
}

.rm-tab.is-active[data-rm-direction="arrivals"] {
  border-bottom-color: var(--rm-arrivals);
}

.rm-tab-count {
  padding: 2px 7px;
  border-radius: var(--radius-pill, 999px);
  background: var(--rm-wash-strong);
  font-size: var(--type-size-2xs, .72rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-routes {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rm-route {
  overflow: hidden;
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-md, 14px);
  background: var(--rm-surface);
  transition: border-color 140ms ease;
}

.rm-route:hover {
  border-color: var(--rm-border-hover);
}

.rm-route-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: var(--rm-text);
  text-align: left;
}

.rm-route-head:hover,
.rm-route-head:focus-visible {
  background: var(--rm-wash);
}

.rm-route-airport {
  display: grid;
  min-width: 0;
}

.rm-route-airport strong {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--type-size-md, .88rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-route-airport small {
  overflow: hidden;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-route-meta {
  display: grid;
  text-align: right;
}

.rm-route-meta span {
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-semibold, 600);
  white-space: nowrap;
}

.rm-route-meta small {
  color: var(--rm-muted);
  font-size: var(--type-size-2xs, .72rem);
  white-space: nowrap;
}

.rm-route-go {
  color: var(--rm-muted);
}

.rm-route-flights {
  margin: 0;
  padding: 0 12px 10px 50px;
  color: var(--rm-subtle);
  font-size: var(--type-size-xs, .76rem);
}

.rm-flights {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0 10px 10px;
  list-style: none;
}

.rm-flight {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm, 8px);
  background: var(--rm-wash);
}

.rm-flight-info {
  display: grid;
  min-width: 0;
}

.rm-flight-info strong {
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-bold, 700);
}

.rm-flight-info small {
  overflow: hidden;
  color: var(--rm-subtle);
  font-size: var(--type-size-2xs, .72rem);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rm-flight .status-chip,
.rm-flight .btn {
  white-space: nowrap;
}

/* On a phone the list stops after a dozen routes until asked for the rest,
   rather than running the page on for screens below the map. */
.rm-show-all {
  display: none;
  width: 100%;
  min-height: var(--btn-h-compact, 34px);
  border: 1px solid var(--rm-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--rm-surface);
  color: var(--rm-primary);
  font-size: var(--type-size-sm, .82rem);
  font-weight: var(--type-weight-semibold, 600);
}

@media (max-width: 1023.98px) {
  .rm-routes:not(.is-expanded) > .rm-route:nth-child(n+13) {
    display: none;
  }

  .rm-show-all {
    display: block;
  }
}

/* Two-line rows on a narrow phone: the chip and the button under the flight. */
@media (max-width: 420px) {
  .rm-flight {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .rm-flight-info {
    grid-column: 1 / -1;
  }

  .rm-stats > div {
    padding: 8px;
  }

  .rm-stats dt {
    font-size: var(--type-size-4xs, .62rem);
    letter-spacing: var(--letter-normal, 0);
  }
}
