:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #16202a;
  --muted: #647083;
  --border: #d9e0ea;
  --surface: #fbfcfe;
  --control: #eef2f7;
  --control-border-hover: #c7d1df;
  --status-bg: #eef2f7;
  --status-ready-bg: #e3f0ff;
  --status-ready-text: #1769aa;
  --status-ok-bg: #dff3ea;
  --status-ok-text: #13764f;
  --status-danger-bg: #ffe6e0;
  --status-danger-text: #a93625;
  --status-warning-bg: #fff3df;
  --status-warning-text: #8a4f0f;
  --status-warning-border: #f0c995;
  --filter-line-pill-text: #ffffff;
  --refresh-bg: #e3f0ff;
  --refresh-text: #1769aa;
  --toggle-bg: #dfe5ee;
  --toggle-border: #b8c3d1;
  --accent: #f6c915;
  --accent-text: #16202a;
  --line: #f6c915;
  --line-soft: #f6c9151f;
  --line-text: #16202a;
  --axis: #b8c2d0;
  --focus: #1769aa;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #101418;
  --panel: #171d23;
  --text: #eef3f8;
  --muted: #a8b4c0;
  --border: #303a46;
  --surface: #131920;
  --control: #222b35;
  --control-border-hover: #445364;
  --status-bg: #222b35;
  --status-ready-bg: #17324f;
  --status-ready-text: #c7e3ff;
  --status-ok-bg: #123329;
  --status-ok-text: #9ee6c5;
  --status-danger-bg: #3a1f1b;
  --status-danger-text: #ffb2a6;
  --status-warning-bg: #352814;
  --status-warning-text: #ffd58c;
  --status-warning-border: #6f562b;
  --filter-line-pill-text: #ffffff;
  --refresh-bg: #17324f;
  --refresh-text: #c7e3ff;
  --toggle-bg: #303a46;
  --toggle-border: #566575;
  --accent-text: #101418;
  --line-text: #101418;
  --axis: #4c5968;
  --focus: #74b9ff;
  color-scheme: dark;
}

:root[data-theme="dark"] .map-shell {
  --map-canvas: #131920;
  --map-panel: #171d23;
}

:root[data-theme="dark"] .map-canvas-wrap {
  background: var(--map-canvas);
}

:root[data-theme="dark"] .map-label {
  fill: #e2e8f0;
  stroke: rgba(19, 25, 32, 0.95);
}
:root[data-theme="dark"] .map-label.is-interchange {
  fill: #f1f5f9;
}
:root[data-theme="dark"] .station:hover .map-label,
:root[data-theme="dark"] .station.is-selected .map-label {
  fill: #ffffff;
}
:root[data-theme="dark"] .node-dot {
  fill: #1a2230;
  stroke: #8a95a3;
}
:root[data-theme="dark"] .node-dot.is-interchange {
  fill: #1a2230;
  stroke: #8a95a3;
}
.station.endpoint .node-dot.is-interchange {
  stroke: var(--station-fill);
}
:root[data-theme="dark"] .node-dot.is-pill {
  fill: #ffffff;
  stroke: #ffffff;
}
:root[data-theme="dark"] .node-pill-dot[data-sev="normal"] {
  fill: #1a2230 !important;
}



:root[data-theme="dark"] .station-panel {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .panel-alert-ok {
  background: #122b1f !important;
}

:root[data-theme="dark"] .panel-alert.sev-closure  { background: #2a1010 !important; }
:root[data-theme="dark"] .panel-alert.sev-reduced { background: #2a1800 !important; }


* {
  box-sizing: border-box;
}

button svg { pointer-events: none; }

[hidden] { display: none !important; }

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

body.welcome-open {
  overflow: hidden;
}

select {
  border-color: var(--border);
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.shell {
  flex: 1;
  overflow: hidden;
  width: min(1080px, calc(100vw - 24px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.panel-viewport {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0;
}

.demo-banner {
  width: 100%;
  padding: 6px 12px;
  background: #1769aa;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.03em;
}

.app-nav,
.topbar,
.controls,
.summary,
.graph-stage {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
}

.lookup-result {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 20px 22px;
  margin-top: 10px;
  display: grid;
  gap: 12px;
  min-width: 0;
  overflow-wrap: break-word;
}

.lookup-result-context {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#lookup-result-description,
#lookup-result-long-risk,
#lookup-result-destination {
  margin: 0;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: break-word;
  min-width: 0;
}

#lookup-result-description .delay-detail-highlight,
#lookup-result-long-risk .delay-risk-word {
  font-weight: 700;
}

#lookup-result-long-risk:empty {
  display: none;
}

#lookup-result-destination:empty {
  display: none;
}

#lookup-result-destination em {
  font-style: normal;
  font-weight: inherit;
  color: var(--muted);
}

/* ---------- My Trips ---------- */

.my-trips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}

.my-trips-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

.my-trips-empty-sub {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.trip-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}


@keyframes trip-glow-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); border-color: rgba(239, 68, 68, 0.5); }
  50% { box-shadow: 0 0 10px 3px rgba(239, 68, 68, 0.35); border-color: rgba(239, 68, 68, 0.9); }
}
@keyframes trip-glow-orange {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); border-color: rgba(245, 158, 11, 0.5); }
  50% { box-shadow: 0 0 10px 3px rgba(245, 158, 11, 0.35); border-color: rgba(245, 158, 11, 0.9); }
}
.trip-alert-red { animation: trip-glow-red 1.3s ease-in-out infinite; }
.trip-alert-orange { animation: trip-glow-orange 1.3s ease-in-out infinite; }

.trip-sev-badge,
.trip-shuttle-badge {
  vertical-align: middle;
  margin-left: 6px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.trip-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.trip-name {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-route {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.trip-arrow {
  color: var(--accent);
  font-weight: 700;
}

.trip-line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  flex-shrink: 0;
}

.trip-station {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trip-eta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.trip-eta-unavailable {
  color: var(--status-warning-text);
}

.trip-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 6px;
}

.trip-load-btn {
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.trip-load-btn svg,
.trip-expand-btn svg,
.trip-delete-btn svg {
  width: 13px;
  height: 13px;
}
.trip-load-label { display: none; }
.trip-load-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}
.trip-load-icon.sev-closure {
  color: color-mix(in srgb, #ef4444 25%, transparent);
  animation: trip-load-pulse-closure 1.3s ease-in-out infinite;
}
.trip-load-icon.sev-reduced {
  color: color-mix(in srgb, #f59e0b 25%, transparent);
  animation: trip-load-pulse-reduced 1.3s ease-in-out infinite;
}
@keyframes trip-load-pulse-closure {
  0%, 100% { color: color-mix(in srgb, #ef4444 25%, transparent); }
  50%       { color: #ef4444; }
}
@keyframes trip-load-pulse-reduced {
  0%, 100% { color: color-mix(in srgb, #f59e0b 25%, transparent); }
  50%       { color: #f59e0b; }
}

.trip-load-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.trip-expand-btn,
.trip-delete-btn {
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.trip-expand-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.trip-delete-btn:hover {
  border-color: #e53e3e;
  color: #e53e3e;
}

.trip-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin-top: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
}

.trip-details.is-open {
  max-height: 200px;
  opacity: 1;
  margin-top: 2px;
}

.my-disruption-section {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

@keyframes my-eta-flash-error {
  0%   { border-color: #d32f2f; background: rgba(211, 47, 47, 0.07); }
  70%  { border-color: #d32f2f; background: rgba(211, 47, 47, 0.07); }
  100% { border-color: var(--border); background: var(--panel); }
}

.my-disruption-section.my-eta-error {
  animation: my-eta-flash-error 1.4s ease-out forwards;
}

.my-disruption-step-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 6px;
}

.my-disruption-section-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 750;
  color: var(--text);
}

.my-disruption-destination-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
}

.my-disruption-destination-input::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.my-disruption-destination-input:focus {
  outline: none;
  border-color: var(--focus, #1769aa);
}

@media (pointer: coarse) {
  .my-disruption-destination-input,
  .controls select {
    font-size: 16px;
  }
}

.my-disruption-empty-note {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.my-eta-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.my-eta-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, background 0.15s;
}

@media (hover: hover) {
  .my-eta-option:hover {
    border-color: var(--control-border-hover);
    background: var(--control);
  }
}

.my-eta-option:has(.my-eta-option-radio:checked) {
  border-color: var(--accent);
  border-width: 2px;
  background: color-mix(in srgb, var(--accent) 12%, var(--panel));
}

.my-eta-option:has(.my-eta-option-radio:checked) .my-eta-option-headline {
  color: var(--text);
  font-weight: 750;
}

.my-eta-option::after {
  content: "";
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border: 2px solid var(--border);
  border-radius: 50%;
  transition: border-color 0.15s, background 0.15s;
}

.my-eta-option:has(.my-eta-option-radio:checked)::after {
  border-color: var(--accent);
  background: radial-gradient(circle, var(--accent) 45%, transparent 45%);
}

.my-eta-option-radio {
  display: none;
}

.my-eta-option-headline {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.my-eta-option-pill .pill-short { display: none; }

@media (max-width: 600px) {
  .my-eta-option-pill .pill-full { display: none; }
  .my-eta-option-pill .pill-short { display: inline; }
}

@media (max-width: 600px) {
  .my-eta-option-headline {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: unset;
  }
}

.my-eta-option-custom {
  margin-top: 0;
}

.my-eta-option-custom .my-eta-option-headline {
  color: var(--muted);
}

.my-eta-option-pill {
  flex-shrink: 0;
}

.my-eta-save-button {
  display: block;
  margin-top: 8px;
  margin-left: auto;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.85rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.my-eta-save-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (hover: hover) {
  .my-eta-save-button:not(:disabled):hover {
    opacity: 0.88;
  }
}

.my-eta-calculate-button {
  display: block;
  width: 100%;
  padding: 13px;
  margin-top: 4px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.95rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}


@media (hover: hover) {
  .my-eta-calculate-button:not(:disabled):hover {
    opacity: 0.88;
  }
}

.my-eta-action-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.my-eta-action-row .my-eta-calculate-button {
  flex: 1;
  margin-top: 0;
}

.my-eta-reset-button {
  width: 48px;
  min-width: 48px;
  aspect-ratio: 1;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--control);
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (hover: hover) {
  .my-eta-reset-button:hover {
    border-color: var(--control-border-hover);
    color: var(--text);
  }
}

.my-disruption-lookup-desc {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Expanded lookup panel */
#my-eta-lookup-form .controls {
  border: none;
  background: none;
  border-radius: 0;
  padding: 0;
}

@media (min-width: 801px) {
  #my-eta-lookup-form .controls {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

.my-eta-right-panel.my-eta-error {
  animation: my-eta-flash-error 1.4s ease-out forwards;
}

.my-eta-right-panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px;
  box-sizing: border-box;
  margin-bottom: 8px;
}

.my-disruption-lookup-button {
  display: inline-block;
  padding: 9px 18px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

@media (hover: hover) {
  .my-disruption-lookup-button:hover {
    border-color: var(--control-border-hover);
  }
}

.app-nav {
  position: relative;
  width: 100%;
  border-radius: 0;
  border-top: none;
  border-left: none;
  border-right: none;
}

.app-nav-inner {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(16px, 1fr) auto;
  gap: 8px;
  padding: 8px;
  width: 100%;
}

.nav-utils {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-spacer {
  min-width: 16px;
}

.nav-button,
.refresh-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--control);
  color: var(--muted);
  font: inherit;
  touch-action: manipulation;
  font-size: 0.86rem;
  font-weight: 850;
  cursor: pointer;
}

@media (hover: hover) {
  .nav-button:hover,
  .refresh-button:hover {
    border-color: var(--control-border-hover);
    color: var(--text);
  }
}

.nav-button:focus,
.refresh-button:focus {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  border-color: var(--focus);
}

.refresh-button {
  min-width: 92px;
  background: var(--refresh-bg);
  color: var(--refresh-text);
}

.refresh-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.utility-button {
  width: 42px;
  min-width: 42px;
  aspect-ratio: 1;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.nav-button.active {
  background: var(--accent);
  color: var(--accent-text);
}

.mobile-panel-toggle,
.mobile-panel-menu {
  display: none;
}

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

.panel-view:not([hidden]) {
  display: block;
}

.welcome-modal[hidden] {
  display: none;
}

.welcome-modal,
.delay-detail-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

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

.welcome-backdrop,
.delay-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 20, 24, 0.58);
  backdrop-filter: blur(3px);
}

:root[data-theme="dark"] .welcome-backdrop,
:root[data-theme="dark"] .delay-detail-backdrop {
  background: rgba(0, 0, 0, 0.68);
}

.welcome-card,
.delay-detail-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(720px, calc(100vh - 36px));
  max-height: min(720px, calc(100dvh - 36px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 22px 60px rgba(22, 32, 42, 0.26);
}

:root[data-theme="dark"] .welcome-card,
:root[data-theme="dark"] .delay-detail-card {
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

.welcome-start-button:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.2);
  outline-offset: 2px;
}

.welcome-image,
.delay-detail-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.welcome-copy {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.delay-detail-copy {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.welcome-copy h1,
.delay-detail-copy h1 {
  font-size: 2rem;
}

#offline-modal-title {
  color: #ef4444;
}

.welcome-copy p,
.delay-detail-copy p {
  margin: 0;
}

#delay-detail-description,
#delay-detail-long-risk {
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.45;
}

.delay-detail-highlight {
  color: var(--accent);
}

.delay-risk-word {
  font-weight: 850;
}

.delay-risk-unlikely {
  color: #13764f;
}

.delay-risk-low {
  color: #c49a00;
}

.delay-risk-likely {
  color: #f59e0b;
}

.delay-risk-medium {
  color: #f59e0b;
}

.delay-risk-high {
  color: #d9251d;
}

.welcome-start-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

@media (hover: hover) {
  .welcome-start-button:hover {
    filter: brightness(0.97);
  }
}

.blank-view {
  min-height: 320px;
}

.live-map-view {
  margin-top: 10px;
}

/* All Disruptions + Delay Duration + My ETA fill the full browser width */
.shell:has(#all-disruptions-view:not([hidden])),
.shell:has(#my-trips-view:not([hidden])),
.shell:has(#delay-duration-view:not([hidden])),
.shell:has(#my-disruption-view:not([hidden])),
.shell:has(#info-view:not([hidden])),
.shell:has(#settings-view:not([hidden])) {
  width: 100%;
  max-width: none;
}

.panel-viewport:has(#all-disruptions-view:not([hidden])),
.panel-viewport:has(#my-trips-view:not([hidden])),
.panel-viewport:has(#delay-duration-view:not([hidden])) {
  padding: 0 8px 8px;
}

.panel-viewport:has(#my-disruption-view:not([hidden])) {
  padding: 8px;
}


.panel-viewport:has(#info-view:not([hidden])),
.panel-viewport:has(#settings-view:not([hidden])) {
  padding: 8px;
}

/* Live map fills the entire space below the nav bar */
.panel-viewport:has(#live-map-view:not([hidden])) {
  padding: 0;
  overflow: hidden;
}

.shell:has(#live-map-view:not([hidden])) {
  width: 100%;
  max-width: none;
}

#live-map-view:not([hidden]) {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-top: 0;
}

#live-map-view:not([hidden]) .map-shell {
  flex: 1;
  margin: 0;
  border-radius: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.live-map-placeholder {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.live-map-placeholder h1 {
  margin: 0;
  font-size: 1.25rem;
}

.live-map-placeholder p:last-child {
  max-width: 620px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.5;
}

.info-view {
  display: grid;
}

.info-section + .info-section {
  margin-top: 8px;
}

.settings-view {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
}

.info-section {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 18px;
}



.info-section h1 {
  margin: 0 0 12px;
  font-size: 24px;
}

.settings-section h1 {
  margin: 0 0 12px;
  font-size: 24px;
}

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

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
}

.setting-title {
  color: var(--text);
  font-size: 1rem;
  font-weight: 650;
}

.setting-action-row {
  cursor: default;
}

.settings-action-button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 12px;
  background: var(--control);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  cursor: pointer;
}

@media (hover: hover) {
  .settings-action-button:hover {
    border-color: var(--control-border-hover);
  }
}

.settings-action-button:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  border-color: var(--focus);
}

.toggle-control {
  position: relative;
  display: inline-grid;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
}

.toggle-control input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-track {
  border: 1px solid var(--toggle-border);
  border-radius: 999px;
  background: var(--toggle-bg);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(22, 32, 42, 0.24);
  transition: transform 0.16s ease;
}

.toggle-control input:checked + .toggle-track {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle-control input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-control input:focus + .toggle-track {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  outline-offset: 2px;
}

.markdown-content {
  color: var(--muted);
  line-height: 1.6;
}

.markdown-content:empty {
  min-height: 24px;
}

.markdown-content p,
.markdown-content ul {
  margin: 0 0 12px;
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin: 18px 0 10px;
  color: var(--text);
}

.markdown-content a {
  color: #1769aa;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 14px 16px;
}

#my-trips-add-btn {
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

#my-trips-add-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.back-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--control);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
  touch-action: manipulation;
}

@media (hover: hover) {
  .back-button:hover {
    border-color: var(--control-border-hover);
  }
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 1.25rem;
}

.title-with-live-status {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.updated-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.live-status-indicator {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateY(1px);
}

.live-status-indicator::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 1px solid currentColor;
  opacity: 0;
}

.live-status-indicator.loading {
  color: var(--muted);
  background: var(--muted);
}

.live-status-indicator.connected {
  color: #16a34a;
  background: #16a34a;
  animation: livePulse 2.1s ease-out infinite;
}

.live-status-indicator.stale {
  color: #f59e0b;
  background: #f59e0b;
  animation: livePulse 2.1s ease-out infinite;
}

.live-status-indicator.disconnected {
  color: var(--status-danger-text);
  background: var(--status-danger-text);
  animation: none;
}

.live-status-indicator.just-updated {
  animation: updatePop 0.8s ease-out;
}

.live-status-indicator.connected::after,
.live-status-indicator.stale::after {
  opacity: 0.32;
  animation: liveRing 2.1s ease-out infinite;
}

.live-status-indicator.just-updated::after {
  opacity: 0.52;
  animation: updateRing 0.8s ease-out;
}

@keyframes livePulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.86);
  }
}

@keyframes liveRing {
  0% {
    transform: scale(0.5);
    opacity: 0.38;
  }
  80%,
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

@keyframes updatePop {
  0% {
    transform: scale(1);
  }
  35% {
    transform: scale(1.85);
    background: #22c55e;
  }
  100% {
    transform: scale(1);
  }
}

@keyframes updateRing {
  0% {
    transform: scale(0.5);
    opacity: 0.62;
  }
  100% {
    transform: scale(2.1);
    opacity: 0;
  }
}

h2 {
  font-size: 0.95rem;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--status-bg);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.all-disruptions-summary {
  display: grid;
  gap: 8px;
  flex: 1 1 auto;
  justify-items: end;
  min-width: min(520px, 100%);
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0;
  flex-wrap: wrap;
}

.summary-status {
  position: relative;
  min-height: 0;
  border-radius: 0;
  padding: 0 10px;
  background: transparent;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-status:first-child {
  padding-left: 0;
}

.summary-status + .summary-status::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 1px;
  background: var(--border);
}

.status.ready {
  background: var(--status-ok-bg);
  color: var(--status-ok-text);
}

#status {
  border-radius: 0;
  padding: 0;
  background: transparent;
  font-size: 0.8rem;
}

#status.ready {
  background: transparent;
  color: var(--status-ready-text);
}

#active-disruptions-status.ready {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

#inactive-disruptions-status.ready {
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
}

#all-disruptions-facilities-status.ready {
  background: var(--status-ready-bg);
  color: var(--status-ready-text);
}

#all-disruptions-announcements-status.ready {
  background: var(--control);
  color: var(--muted);
}

.summary-status.ready,
.summary-status.error,
#active-disruptions-status.summary-status.ready,
#inactive-disruptions-status.summary-status.ready,
#all-disruptions-facilities-status.summary-status.ready,
#all-disruptions-announcements-status.summary-status.ready {
  background: transparent;
}

.status.error {
  background: var(--status-danger-bg);
  color: var(--status-danger-text);
}

.line-filter-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.line-filter-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 2px 4px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.line-filter-option input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--focus);
}

.line-filter-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 3px 9px;
  color: #1a2230;
  font-size: 0.78rem;
  font-weight: 850;
}

.line-filter-reset {
  min-height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
}

@media (hover: hover) {
  .line-filter-reset:hover {
    border-color: var(--control-border-hover);
    color: var(--text);
  }
}

.line-filter-reset:focus-visible {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  border-color: var(--focus);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

label[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}

label[aria-disabled="true"] select {
  pointer-events: none;
}

.coming-soon-tag {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 30px 0 9px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 650;
}

select:focus {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  border-color: var(--focus);
}

.summary {
  margin-top: 10px;
  padding: 12px;
}

.context {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  flex-wrap: wrap;
}

.line-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 3px 9px;
  background: var(--line);
  color: var(--line-text);
  font-size: 0.78rem;
  font-weight: 850;
}

.announcement-line-pill .pill-short { display: none; }
.announcement-line-pill .pill-full  { display: inline; }

@media (pointer: coarse) {
  .announcement-line-pill .pill-short { display: inline; }
  .announcement-line-pill .pill-full  { display: none; }
}

#category-label {
  color: var(--muted);
  font-size: 0.88rem;
}

.context {
  display: none;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.metric {
  min-height: 70px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  white-space: nowrap;
}

.graph-stage {
  margin-top: 10px;
  min-height: 260px;
  padding: 12px;
}

.graph-toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 10px;
}

.graph-toolbar h2 {
  flex: 1;
  font-size: 1rem;
}

.graph-toolbar label {
  width: min(220px, 100%);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.chart-area {
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.disruption-list {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.disruption-group {
  display: grid;
  gap: 10px;
}

.section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  cursor: pointer;
  text-align: left;
}

.section-toggle:focus {
  outline: none;
}

.section-toggle:focus-visible {
  outline: 2px solid rgba(23, 105, 170, 0.28);
  outline-offset: 3px;
  border-radius: 6px;
}

[data-section="active-disruptions"] .section-toggle {
  color: var(--status-danger-text);
}

.section-toggle-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 7px;
  border-color: transparent transparent transparent currentColor;
  font-size: 0;
  overflow: hidden;
}

.section-toggle[aria-expanded="true"] .section-toggle-icon {
  border-width: 7px 5px 0;
  border-color: currentColor transparent transparent;
}

.disruption-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.disruption-card.is-highlighted {
  animation: card-highlight 2s ease forwards;
}

@keyframes card-highlight {
  0%   { border-color: #3b82f6; box-shadow: 0 0 0 4px #3b82f660; }
  40%  { border-color: #3b82f6; box-shadow: 0 0 0 4px #3b82f660; }
  100% { border-color: var(--border); box-shadow: none; }
}

.disruption-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.timeline-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.25;
}

.delay-start-label {
  color: var(--text-muted);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.delay-estimate-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--status-warning-border);
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--status-warning-bg);
  color: var(--status-warning-text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

button.delay-estimate-label {
  cursor: pointer;
  animation: delay-pill-ring 1.3s ease-in-out infinite;
}

@keyframes delay-pill-ring {
  0%   { box-shadow: 0 0 0 0px var(--status-warning-border); }
  80%, 100% { box-shadow: 0 0 0 5px transparent; }
}

@media (hover: hover) {
  button.delay-estimate-label:hover {
    filter: brightness(0.98);
  }
}

@media (prefers-reduced-motion: reduce) {
  button.delay-estimate-label { animation: none; }
}

button.delay-estimate-label:focus-visible {
  outline: 3px solid rgba(227, 111, 30, 0.2);
  outline-offset: 2px;
}

.disruption-card h2 {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.3;
}

.disruption-description {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 550;
  line-height: 1.4;
}

.station-list {
  display: flex;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.station-list li {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.station-pill-dot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 3px;
}

.station-pill-dot.sev-facility {
  color: #3b82f6;
  text-shadow: 0 0 0.3px currentColor, 0.15px 0.15px 0 currentColor;
}

.station-pill-dot.sev-closure {
  color: color-mix(in srgb, #ef4444 25%, transparent);
  animation: station-pill-pulse-closure 1.3s ease-in-out infinite;
}

.station-pill-dot.sev-reduced {
  color: color-mix(in srgb, #f59e0b 25%, transparent);
  animation: station-pill-pulse-reduced 1.3s ease-in-out infinite;
}

@keyframes station-pill-pulse-closure {
  0%, 100% { color: color-mix(in srgb, #ef4444 25%, transparent); }
  50%       { color: #ef4444; }
}

@keyframes station-pill-pulse-reduced {
  0%, 100% { color: color-mix(in srgb, #f59e0b 25%, transparent); }
  50%       { color: #f59e0b; }
}

@media (prefers-reduced-motion: reduce) {
  .station-pill-dot,
  .trip-load-icon { animation: none !important; }
}

.station-pill-btn {
  border: none;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.station-pill-chevron {
  font-size: 0.85em;
  opacity: 0.45;
  line-height: 1;
  margin-top: 0.5px;
}

.station-list li:has(.station-pill-btn):active {
  background: var(--control-border-hover);
}

@media (hover: hover) {
  .station-list li:has(.station-pill-btn):hover {
    border-color: var(--control-border-hover);
    color: var(--text);
  }
}

.facility-stations {
  margin-top: 8px;
}

.facility-station-pill {
  position: relative;
  cursor: help;
}

.facility-station-pill:focus {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  outline-offset: 2px;
}

.facility-popover {
  position: absolute;
  left: 0;
  right: auto;
  bottom: calc(100% + 8px);
  top: auto;
  z-index: 5;
  display: none;
  width: max-content;
  max-width: min(360px, calc(100vw - 48px));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(22, 32, 42, 0.16);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
  white-space: normal;
}

.facility-popover.align-right {
  right: 0;
  left: auto;
}

.facility-popover.align-bottom {
  top: calc(100% + 8px);
  bottom: auto;
}

@media (hover: hover) {
  .facility-station-pill:hover .facility-popover {
    display: block;
  }
}
.facility-station-pill:focus .facility-popover {
  display: block;
}

.disruption-empty {
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.chart-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.chart {
  display: block;
  width: 100%;
  height: 280px;
}

.axis-label {
  fill: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.chart-title {
  fill: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.axis-title {
  fill: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.axis {
  stroke: var(--axis);
  stroke-width: 1;
}

.bars rect {
  fill: var(--line);
}

/* ==========================================================================
   Responsive breakpoints
   desktop-regular : > 800px   (default styles above)
   desktop-narrow  : 501–800px
   mobile          : ≤ 500px
   ========================================================================== */

@media (max-width: 800px) { /* desktop-narrow + mobile shared base */
  .app-nav {
    overflow: visible;
    z-index: 20;
  }

  .app-nav-inner {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .panel-nav-button {
    display: none;
  }

  .mobile-panel-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    min-height: 44px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px 6px 12px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 850;
    cursor: pointer;
    gap: 8px;
  }

  .mobile-panel-toggle:focus {
    outline: 3px solid rgba(23, 105, 170, 0.16);
    border-color: var(--focus);
  }

  .mobile-panel-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-panel-chevron {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
  }

  .mobile-panel-toggle[aria-expanded="true"] .mobile-panel-chevron {
    transform: translateY(2px) rotate(225deg);
  }

  .mobile-panel-toggle.is-empty {
    background: var(--control);
    color: var(--muted);
  }

  .mobile-panel-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 8px;
    right: 96px;
    display: grid;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 16px 32px rgba(22, 32, 42, 0.16);
    z-index: 200;
  }

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

  .nav-spacer {
    display: none;
  }

  .nav-button,
  .refresh-button {
    min-width: 0;
    min-height: 44px;
    padding: 6px 8px;
    line-height: 1.15;
    white-space: normal;
  }

  .utility-button {
    width: 40px;
    min-width: 40px;
    aspect-ratio: 1;
  }

  .all-disruptions-summary {
    justify-items: start;
  }

  #my-trips-view .topbar {
    flex-direction: row;
    align-items: center;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .all-disruptions-summary {
    min-width: 100%;
  }

  .status-row,
  .line-filter-panel {
    justify-content: flex-start;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .metric-row {
    grid-template-columns: repeat(3, 1fr);
  }

  .welcome-card,
  .delay-detail-card {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .welcome-copy,
  .delay-detail-copy {
    padding: 18px;
  }

  .welcome-copy h1,
  .delay-detail-copy h1 {
    font-size: 1.55rem;
  }
}

@media (max-width: 500px) { /* mobile */
  .station-panel {
    max-height: 60%;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .panel-badges {
    justify-content: flex-start;
  }

  .pill-text { display: none !important; }
  .pill-icon { display: inline !important; }

  .metric-row {
    grid-template-columns: 1fr;
  }

}

/* ============================================================
   Live Map (light schematic transit map)
   ============================================================ */
/* Route / wayfinding controls */
.route-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 10px;
  padding: 12px 10px;
  border-bottom: 1px solid var(--map-border);
  background: var(--surface);
}

.route-filter-arrow {
  display: flex;
  align-items: center;
  padding-bottom: 7px;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
}

.route-station-picker {
  position: relative;
  display: grid;
  min-width: 0;
}

.route-station-input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
}

.route-station-input:focus {
  outline: 3px solid rgba(23, 105, 170, 0.16);
  border-color: var(--focus);
}

.route-station-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 50;
  display: grid;
  max-height: min(320px, 48vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(22, 32, 42, 0.18);
}

@media (pointer: coarse) {
  .route-filter {
    position: relative;
    grid-template-columns: 1fr;
  }
  .route-filter-arrow {
    display: none;
  }
  .route-station-picker {
    position: static;
  }
  /* Prevent iOS Safari from zooming in when the input is focused */
  .route-station-input {
    font-size: 16px;
  }
  .route-station-menu {
    /* Span the full bar width, leaving room for the toggle button (34px + 12px gap) */
    left: 10px;
    right: 56px;
    max-height: min(360px, 60vh);
    scrollbar-width: none;
  }
  .route-station-menu::-webkit-scrollbar {
    display: none;
  }
}

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

.route-station-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 5px 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.route-station-option[hidden] {
  display: none;
}

.route-station-option:hover,
.route-station-option:focus-visible {
  border-color: var(--control-border-hover);
  background: var(--control);
  outline: none;
}

.route-station-option-lines {
  display: inline-flex;
  gap: 4px;
}

.route-station-line-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.route-station-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}


.station.off-route {
  opacity: 0.22;
  pointer-events: none;
}

.station.off-route .map-label {
  display: none;
}

.station.off-route .node-dot,
.station.off-route .node-ring,
.station.off-route .node-halo,
.station.off-route .node-pill-dot {
  animation: none !important;
}


.map-shell {
  --map-canvas: #eef2f8;
  --map-panel: #ffffff;
  --map-border: var(--border);
  --map-text: var(--text);
  --map-muted: var(--muted);
  position: relative;
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border: 1px solid var(--map-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
  color: var(--map-text);
}


.map-lines-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 0 18px 12px;
  border-bottom: 1px solid var(--map-border);
}

.legend-line {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--map-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.legend-line-badge {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #1a2230;
  font-size: 0.72rem;
  font-weight: 900;
}

.map-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.map-canvas-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 0;
  background:
    radial-gradient(900px 420px at 70% -10%, #f7faff 0%, rgba(247, 250, 255, 0) 60%),
    var(--map-canvas);
}

.map-input-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: var(--map-canvas);
}

.map-svg {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  user-select: none;
  touch-action: none; /* let the pan/zoom engine handle gestures */
  -webkit-tap-highlight-color: transparent;
}

.map-svg.is-grabbing,
.map-svg.is-grabbing .station {
  cursor: grabbing;
}

.map-line {
  opacity: 1;
}

.map-line.map-line-dimmed {
  stroke: #c8cdd4;
  opacity: 0.7;
}

:root[data-theme="dark"] .map-line.map-line-dimmed {
  stroke: #4a5568;
  opacity: 0.6;
}

/* --- live status on map --- */
.map-route-toggle {
  -webkit-appearance: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 34px;
  height: 34px;
  aspect-ratio: 1 / 1;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--map-border);
  border-radius: 9px;
  background: var(--map-panel);
  box-shadow: 0 2px 6px rgba(22, 32, 42, 0.08);
  color: var(--muted);
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.map-route-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.map-route-save {
  top: 54px;
}



.map-live-status-wrap {
  position: absolute;
  top: 12px;
  left: 12px;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px 0 8px;
  border: 1px solid var(--map-border);
  border-radius: 9px;
  background: var(--map-panel);
  box-shadow: 0 2px 6px rgba(22, 32, 42, 0.08);
  z-index: 10;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.2s ease, transform 0.2s ease;
}


.map-live-updated-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.map-route-eta {
  color: var(--focus);
}

.map-live-status-wrap {
  transition: opacity 0.2s ease;
}

.map-live-status-wrap.is-switching {
  opacity: 0;
}


/* --- stations --- */
.station {
  cursor: pointer;
  outline: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.node-dot {
  fill: #ffffff;
  stroke: #6b7688;
  stroke-width: 2.2;
  transition: r 0.12s ease;
}

.node-dot.is-interchange {
  fill: #ffffff;
  stroke: #1a2230;
  stroke-width: 2.8;
}

.node-dot.is-pill {
  fill: #1a2230;
  stroke: #1a2230;
  stroke-width: 2;
}

.node-pill-group {
  transition: transform 0.12s ease;
  transform-origin: center;
  transform-box: fill-box;
}

.station:hover .node-pill-group,
.station.is-selected .node-pill-group {
  transform: scale(1.15);
}

.node-pill-group.is-diag {
  transform: rotate(-45deg);
}
.station:hover .node-pill-group.is-diag,
.station.is-selected .node-pill-group.is-diag {
  transform: rotate(-45deg) scale(1.15);
}

.node-badge-bg {
  stroke: #ffffff;
  stroke-width: 2;
}

.node-badge-num {
  fill: #1a2230;
  font-size: 14px;
  font-weight: 900;
  font-family: "Segoe UI", Arial, sans-serif;
}

.node-halo {
  fill: rgba(23, 105, 170, 0.18);
  opacity: 0;
  transition: opacity 0.14s ease;
  pointer-events: none;
}

.node-ring {
  fill: none;
  stroke-width: 2.6;
  opacity: 0;
  pointer-events: none;
  /* Scale the ring around its own centre (not the SVG origin) so the pulse
     radiates from each station. */
  transform-box: fill-box;
  transform-origin: center;
}

/* Severity: pulse the dot fill instead of an outer ring */
.station { --sev-base: #ffffff; }
:root[data-facility-colour="on"] .station.has-facility { --sev-base: #3b82f6; }


.station.sev-reduced { --sev-color: #f59e0b; }
.station.sev-closure { --sev-color: #ef4444; }

/* Facility outage only — static blue dot, no animation (exclude pill border path) */
:root[data-facility-colour="on"] .station.has-facility.sev-normal .node-dot:not(.is-pill) { fill: #3b82f6; }

/* Suppress facility blue on pill dots when setting is off */
:root:not([data-facility-colour="on"]) .node-pill-dot[fill="#3b82f6"] { fill: #ffffff !important; }

.station.sev-reduced .node-dot:not(.is-pill),
.station.sev-closure .node-dot:not(.is-pill) {
  animation: dot-pulse 1.3s ease-in-out infinite;
}

/* Pill dots animate individually based on their own line's severity */
.node-pill-dot[data-sev="reduced"] {
  --sev-base: #ffffff;
  --sev-color: #f59e0b;
  animation: dot-pulse 1.3s ease-in-out infinite;
}
.node-pill-dot[data-sev="closure"] {
  --sev-base: #ffffff;
  --sev-color: #ef4444;
  animation: dot-pulse 1.3s ease-in-out infinite;
}
:root[data-facility-colour="on"] .node-pill-dot[data-sev="reduced"][data-facility="true"],
:root[data-facility-colour="on"] .node-pill-dot[data-sev="closure"][data-facility="true"] {
  --sev-base: #3b82f6;
}

@keyframes dot-pulse {
  0%,  100% { fill: var(--sev-base); }
  50%       { fill: var(--sev-color); }
}

@media (prefers-reduced-motion: reduce) {
  .station .node-dot,
  .node-pill-dot { animation: none !important; }
}

.station:hover .node-halo,
.station:focus-visible .node-halo,
.station.is-selected .node-halo {
  opacity: 1;
}

.station.is-selected .node-halo {
  fill: rgba(23, 105, 170, 0.3);
  r: 20;
}

.station:hover .node-dot,
.station.is-selected .node-dot {
  r: 7.5;
  stroke: #16202a;
}

.station:hover .node-dot.is-interchange,
.station.is-selected .node-dot.is-interchange {
  r: 10;
}


/* --- station labels --- */

/* zoom-low (< 1.4×): only interchange and terminus labels */
.zoom-low .station.regular .map-label { display: none; }

.map-label {
  fill: #313c4a;
  font-size: 12px;
  font-weight: 700;
  font-family: "Segoe UI", Arial, sans-serif;
  paint-order: stroke;
  stroke: rgba(238, 242, 248, 0.95);
  stroke-width: 3.5px;
  stroke-linejoin: round;
  pointer-events: none;
  transition: fill 0.12s ease;
}

.map-label.is-interchange {
  fill: #16202a;
  font-size: 13px;
  font-weight: 850;
}

.station:hover .map-label,
.station.is-selected .map-label {
  fill: #0b1118;
}

/* --- station details panel --- */
.station-panel {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  max-height: 40%;
  overflow: visible;
  display: flex;
  flex-direction: column;
  background: var(--map-panel);
  border: 1px solid var(--map-border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(22, 32, 42, 0.13);
}

.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px;
  border-radius: inherit;
}

@media (min-width: 501px) {
  .station-panel {
    max-height: 35%;
  }
}

@media (min-width: 801px) {
  .station-panel {
    max-height: 25%;
    right: auto;
    width: 776px;
  }
}

.panel-close-tab {
  -webkit-appearance: none;
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  z-index: 2;
  /* Mobile: rounded square inside the box */
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  aspect-ratio: 1 / 1;
  line-height: 1;
  background: var(--map-border);
  border-radius: 7px;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Desktop: folder tab above the top-right corner */
@media (min-width: 501px) {
  .station-panel:has(.panel-close-tab) {
    border-top-right-radius: 0;
  }

  .panel-close-tab {
    top: -30px;
    right: -1px;
    width: auto;
    height: 30px;
    padding: 0 12px;
    border-radius: 8px 8px 0 0;
    background: var(--map-panel);
    border: 1px solid var(--map-border);
    border-bottom: none;
    box-shadow: 0 -2px 6px rgba(22, 32, 42, 0.06);
    color: var(--muted);
    font-size: inherit;
    font-weight: inherit;
  }
}

.panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  color: var(--text-muted, #8a96a3);
  font-size: 0.9rem;
  text-align: center;
}

.panel-empty h2 {
  font-size: 1.2rem;
}

.panel-empty-sub {
  margin: 6px 0 14px;
  color: var(--map-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

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

.panel-summary li {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--map-border);
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--map-panel);
  color: var(--map-text);
  font-size: 0.95rem;
  font-weight: 700;
}

.panel-card {
  position: relative;
  animation: panel-in 0.18s ease;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panel-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

.panel-scroll.is-closing {
  animation: panel-out 0.15s ease forwards;
  pointer-events: none;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.panel-head:has(+ .panel-alerts) {
  margin-bottom: 14px;
}

.panel-head-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.panel-lines-mobile { display: none !important; }

@media (max-width: 500px) {
  .panel-lines-desktop { display: none !important; }
  .panel-lines-mobile { display: flex !important; order: -1; }

  .panel-badges {
    flex-direction: column;
    align-items: flex-start;
  }
}

.panel-head-left h2 {
  margin: 0;
  font-size: 1.4rem;
  line-height: 1.2;
}

.panel-badges {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 5px;
}

.pill-icon { display: none; }
.pill-text { display: inline; }

.panel-sev-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 3px 11px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.panel-shuttle-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 3px 11px;
  background: #f59e0b;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.panel-facility-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  padding: 3px 11px;
  background: #00a4e3;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.panel-alert-facility {
  background: #00a4e31a;
}
.panel-alert-facility::before {
  background: #00a4e3 !important;
}


.panel-lines {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.panel-line-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 3px 9px;
  color: #1a2230;
  font-size: 0.86rem;
  font-weight: 900;
}

.panel-alerts {
  display: grid;
  gap: 9px;
}

.panel-alert-ok {
  background: #eafaf2 !important;
}
.panel-alert-ok::before {
  background: #22c55e !important;
}

.panel-ok {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid #bfe6d3;
  border-radius: 11px;
  padding: 13px;
  background: #eafaf2;
}

.panel-ok-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  background: #18a05c;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 900;
}

.panel-ok strong {
  font-size: 1.08rem;
}

.panel-ok p {
  margin: 3px 0 0;
  color: var(--map-muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-alert {
  position: relative;
  border: 1px solid var(--map-border);
  border-left: none;
  border-radius: 11px;
  padding: 12px 12px 12px 16px;
  background: var(--map-panel);
  overflow: hidden;
}

.panel-alert::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 11px 0 0 11px;
  background: var(--map-border);
  transition: width 0.18s ease;
}

.panel-alert.sev-reduced::before { background: #f59e0b; }
.panel-alert.sev-closure::before { background: #ef4444; }
.panel-alert.sev-reduced { background: #fffbeb !important; }
.panel-alert.sev-closure { background: #fef2f2 !important; }

.swipe-hint { display: none; }

/* Swipe-right to navigate — touch devices only */
@media (pointer: coarse) {
  /* Article becomes the accent-color backdrop; inner div is the white card */
  .panel-alert.is-linkable {
    padding: 0;
    user-select: none;
  }
  /* Severity backgrounds move to the inner div; article shows the deep accent */
  .panel-alert.is-linkable.sev-reduced { background: #f59e0b !important; }
  .panel-alert.is-linkable.sev-closure { background: #ef4444 !important; }
  .panel-alert.is-linkable.panel-alert-ok { background: #22c55e !important; }
  .panel-alert.is-linkable.panel-alert-facility { background: #00a4e3 !important; }

  /* >>> hint stays fixed on the left (visible behind the inner div) */
  .panel-alert.is-linkable::before {
    content: "❯❯❯";
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    color: rgba(255, 255, 255, 0.8);
    transition: none;
    background: transparent;
  }

  /* Swipe hint — revealed behind the sliding inner layer */
  .swipe-hint {
    display: flex;
    position: absolute;
    inset: 0;
    align-items: center;
    padding-left: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #fff;
    background: inherit;
    border-radius: 11px;
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
    white-space: nowrap;
  }

  .panel-alert.is-swiping .swipe-hint {
    opacity: 1;
  }

  /* White card layer that slides right, revealing the accent behind */
  .panel-alert-inner {
    background: var(--map-panel);
    padding: 12px 12px 12px 12px;
    margin-left: 28px;
    border-radius: 0 11px 11px 0;
    transition: transform 0.25s ease;
    will-change: transform;
  }
  .panel-alert.is-linkable.sev-reduced .panel-alert-inner { background: #fffbeb; }
  .panel-alert.is-linkable.sev-closure .panel-alert-inner { background: #fef2f2; }
  .panel-alert.is-linkable.panel-alert-ok .panel-alert-inner { background: #eafaf2; }
  .panel-alert.is-linkable.panel-alert-facility .panel-alert-inner { background: #00a4e31a; }

  .panel-alert.is-swiping .panel-alert-inner {
    transition: none;
  }
  .panel-alert.is-swiped-away .panel-alert-inner {
    transform: translateX(120%);
  }
}

/* Expand accent on hover to reveal "View →" — pointer devices only */
@media (pointer: fine) and (hover: hover) {
  .panel-alert.is-linkable {
    cursor: pointer;
    user-select: none;
  }
  .panel-alert.is-linkable::before {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    color: transparent;
    z-index: 1;
    transition: width 0.18s ease, color 0.1s ease 0.08s;
  }
  .panel-alert.is-linkable:hover::before {
    content: "View →";
    width: 62px;
    color: #fff;
  }
  .panel-alert.is-linkable p {
    transition: transform 0.18s ease;
  }
  .panel-alert.is-linkable:hover p {
    transform: translateX(62px);
  }
}

.panel-alert p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
  font-weight: 550;
}

.panel-alert-icon {
  font-size: 1.22rem;
  line-height: 1.2;
}

.panel-alert-body {
  min-width: 0;
}

.panel-alert-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.panel-alert-sev {
  border-radius: 999px;
  padding: 2px 8px;
  color: #1a2230;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.panel-alert-line {
  color: var(--map-muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.panel-alert-body p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.4;
  font-weight: 550;
}

.panel-updated {
  margin: 14px 0 0;
  color: var(--map-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.panel-live-tag {
  color: #13764f;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.5px;
}

}

