:root {
  color-scheme: light;
  --ink: #10212d;
  --muted: #607180;
  --subtle: #d8e4eb;
  --soft: #eef5f7;
  --paper: #ffffff;
  --app: #f5f8f7;
  --navy: #062b3f;
  --cyan: #049fd1;
  --teal: #0a7d74;
  --green: #16864b;
  --amber: #ba7416;
  --red: #b83232;
  --gold: #f1b72c;
  --map-complete: #138a52;
  --map-current: #ff8a00;
  --map-upcoming: #9aa9b5;
  --map-intercept: #f1b72c;
  --map-origin: #0a7d74;
  --map-destination: #062b3f;
  --map-partial: #7c4dff;
  --map-waiting: #ba7416;
  --shadow: 0 16px 38px rgba(9, 35, 54, 0.12);
  --radius: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e7f1f5;
  --muted: #9ab0bd;
  --subtle: #294658;
  --soft: #102b39;
  --paper: #0b2230;
  --app: #06151f;
  --navy: #9ed8ff;
  --cyan: #44bfe8;
  --teal: #4fc0aa;
  --green: #63cf92;
  --amber: #f0b75b;
  --red: #ff7b7b;
  --gold: #f1c45a;
  --map-complete: #63cf92;
  --map-current: #ffb15f;
  --map-upcoming: #7890a0;
  --map-intercept: #f1c45a;
  --map-origin: #4fc0aa;
  --map-destination: #9ed8ff;
  --map-partial: #b39cff;
  --map-waiting: #f0b75b;
  --shadow: 0 16px 38px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--app);
  scroll-behavior: smooth;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(4, 159, 209, 0.08), rgba(245, 248, 247, 0) 22rem),
    var(--app);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(68, 191, 232, 0.12), rgba(6, 21, 31, 0) 22rem),
    var(--app);
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus,
select:focus,
input:focus,
textarea:focus,
a:focus {
  outline: none;
}

button {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  max-width: 100%;
  margin: 0 auto;
  padding-bottom: calc(5.6rem + env(safe-area-inset-bottom));
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0.75rem;
  background: rgba(245, 248, 247, 0.94);
  border-bottom: 1px solid rgba(16, 33, 45, 0.08);
  backdrop-filter: blur(14px);
}

:root[data-theme="dark"] .app-header {
  background: rgba(6, 21, 31, 0.94);
  border-bottom-color: rgba(231, 241, 245, 0.1);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.7rem;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-mark {
  display: block;
  width: 3.05rem;
  height: 3.05rem;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 0.12rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(4, 159, 209, 0.24);
}

.home-welcome {
  display: grid;
  grid-template-columns: 3.5rem minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
}

.home-logo {
  width: 3.5rem;
  height: 3.5rem;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(4, 159, 209, 0.18);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.network-pill,
.status-pill,
.mini-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.32rem 0.58rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.network-pill {
  color: var(--navy);
  background: #dff2ed;
  border: 1px solid rgba(10, 125, 116, 0.18);
}

.app-main {
  display: grid;
  gap: 1rem;
  padding: 1rem 1rem calc(6.5rem + env(safe-area-inset-bottom));
}

.launch-screen {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 8.5rem);
  min-height: calc(100svh - 8.5rem);
  min-height: calc(100dvh - 8.5rem);
  padding: 1rem;
}

.splash-screen {
  align-content: center;
  gap: 1rem;
  text-align: center;
}

.launch-brand {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

.launch-logo {
  display: block;
  width: clamp(6.5rem, 28vw, 9.25rem);
  height: clamp(6.5rem, 28vw, 9.25rem);
  object-fit: contain;
  padding: 0.35rem;
  background: #fff;
  border: 1px solid rgba(4, 159, 209, 0.14);
  border-radius: 22px;
  box-shadow: 0 24px 54px rgba(4, 159, 209, 0.22);
}

.launch-brand h2 {
  margin: 0;
  color: var(--navy);
  font-size: 1.65rem;
}

.launch-loader {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(4, 159, 209, 0.16);
  border-top-color: var(--cyan);
  border-radius: 999px;
  animation: launchSpin 780ms linear infinite;
}

.launch-note {
  max-width: 18rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.startup-panel {
  display: grid;
  grid-template-columns: 3.3rem minmax(0, 1fr);
  align-items: center;
  gap: 0.85rem;
  min-height: 7.5rem;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(9, 35, 54, 0.06);
}

.startup-mark {
  display: grid;
  width: 3.3rem;
  height: 3.3rem;
  place-items: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(4, 159, 209, 0.18);
}

.startup-mark img {
  display: block;
  width: 3rem;
  height: 3rem;
  object-fit: contain;
}

.startup-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  line-height: 1.2;
}

.startup-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.startup-panel.is-error {
  border-color: rgba(184, 50, 50, 0.22);
}

.startup-panel .btn {
  width: max-content;
  margin-top: 0.8rem;
}

.auth-screen {
  align-content: start;
  padding: clamp(0.65rem, 2.5svh, 1.35rem) 0.75rem calc(0.75rem + env(safe-area-inset-bottom));
}

.auth-card {
  display: grid;
  width: min(92vw, 36.5rem);
  gap: clamp(0.7rem, 1.7svh, 1.15rem);
  padding: clamp(1rem, 3svh, 2.4rem);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(16, 33, 45, 0.06);
  border-radius: 24px;
  box-shadow: 0 26px 62px rgba(9, 35, 54, 0.14);
}

.auth-intro {
  display: grid;
  justify-items: center;
  gap: clamp(0.35rem, 1svh, 0.7rem);
  text-align: center;
}

.auth-security-badge {
  display: grid;
  width: clamp(3.25rem, 10svh, 5.2rem);
  height: clamp(3.25rem, 10svh, 5.2rem);
  place-items: center;
  color: var(--cyan);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.98) 0 58%, rgba(234, 247, 252, 0.88) 59% 100%);
  border: 1px solid rgba(4, 159, 209, 0.13);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(4, 159, 209, 0.16);
}

.auth-badge-icon {
  width: clamp(1.4rem, 3.3svh, 2rem);
  height: clamp(1.4rem, 3.3svh, 2rem);
}

.auth-intro h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.65rem, 5.4vw, 2.55rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.auth-intro p {
  max-width: 24rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(0.88rem, 3vw, 1.15rem);
  font-weight: 800;
  line-height: 1.35;
}

.auth-provider-btn,
.guest-btn {
  min-height: clamp(2.95rem, 6.3svh, 4.05rem);
}

.auth-provider-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 14px;
  font-size: clamp(0.95rem, 2.7vw, 1.02rem);
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(9, 35, 54, 0.07);
  cursor: pointer;
}

.auth-provider-mark {
  display: inline-grid;
  width: 1.85rem;
  height: 1.85rem;
  place-items: center;
  color: transparent;
  background: linear-gradient(90deg, #4285f4 0 25%, #ea4335 25% 50%, #fbbc05 50% 75%, #34a853 75% 100%);
  background-clip: text;
  -webkit-background-clip: text;
  border-radius: 999px;
  font-size: 1.68rem;
  font-weight: 950;
  line-height: 1;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.25rem;
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 15px;
}

.auth-tabs button {
  display: inline-flex;
  min-width: 0;
  min-height: clamp(2.55rem, 5.4svh, 3.05rem);
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 1rem;
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.is-active {
  color: var(--cyan);
  background: rgba(4, 159, 209, 0.08);
  box-shadow: 0 8px 18px rgba(9, 35, 54, 0.08);
}

.tab-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.auth-form {
  display: grid;
  gap: clamp(0.55rem, 1.45svh, 0.9rem);
}

.auth-form .input-wrap {
  gap: 0.32rem;
}

.auth-form .input-label {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 900;
  text-transform: none;
  letter-spacing: 0;
}

.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input[type="text"] {
  min-height: clamp(2.85rem, 6.1svh, 4rem);
  padding: 0 1.15rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 13px;
  font-size: 1rem;
  font-weight: 800;
}

.auth-form input::placeholder {
  color: #93a0aa;
  opacity: 1;
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 13px;
}

.password-field input {
  min-width: 0;
  border: 0;
  background: transparent;
}

.password-field button,
.link-button {
  color: var(--cyan);
  background: transparent;
  border: 0;
  font-weight: 900;
  cursor: pointer;
}

.password-field button {
  display: grid;
  min-width: 3.15rem;
  place-items: center;
  padding: 0 0.9rem;
  color: var(--muted);
}

.password-eye {
  width: 1.35rem;
  height: 1.35rem;
}

.auth-submit {
  justify-content: center;
  gap: 0.65rem;
  min-height: clamp(2.95rem, 6.3svh, 4.1rem);
  border-radius: 14px;
  font-size: 1.03rem;
  box-shadow: 0 12px 24px rgba(0, 103, 224, 0.18);
}

.auth-submit .btn-icon {
  width: 1.3rem;
  height: 1.3rem;
}

.link-button {
  width: max-content;
  justify-self: center;
  padding: 0.1rem 0;
  font-size: 0.95rem;
}

.auth-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.9rem;
}

.auth-link-row .link-button {
  width: auto;
  min-height: 1.45rem;
  justify-self: auto;
  font-size: 0.88rem;
}

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  background: var(--subtle);
}

.auth-helper,
.auth-coming-soon span {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
}

.auth-helper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.helper-icon {
  flex: 0 0 auto;
  width: 1.45rem;
  height: 1.45rem;
  padding: 0.24rem;
  color: var(--cyan);
  background: rgba(4, 159, 209, 0.1);
  border-radius: 999px;
}

.guest-btn {
  gap: 0.55rem;
  color: var(--cyan);
  background: #fff;
  border: 1.5px solid var(--cyan);
  border-radius: 14px;
  font-size: 1rem;
}

.auth-coming-soon {
  display: grid;
  gap: 0.3rem;
  padding: 1.2rem;
  color: var(--navy);
  background: var(--soft);
  border: 1px dashed rgba(4, 159, 209, 0.28);
  border-radius: 14px;
  text-align: center;
}

.panel,
.next-card,
.train-row,
.station-card,
.import-panel {
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(9, 35, 54, 0.06);
}

.panel {
  padding: 1rem;
}

.panel-header,
.row-between {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem;
}

.panel-header {
  margin-bottom: 0.8rem;
}

.panel-title,
.section-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.2;
}

.panel-note,
.muted {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.guide-message {
  display: flex;
  align-items: center;
  min-height: 2.45rem;
  padding: 0.56rem 0.68rem;
  color: #075985;
  background: #eaf7ff;
  border: 1px solid rgba(4, 159, 209, 0.22);
  border-radius: 8px;
  font-weight: 850;
}

.guide-highlight {
  border-radius: 8px;
  border-color: rgba(255, 138, 0, 0.78);
  outline: 2px solid rgba(255, 138, 0, 0.55);
  outline-offset: 3px;
  box-shadow: 0 0 0 3px rgba(255, 138, 0, 0.14);
}

.home-help-button {
  grid-column: 1 / -1;
  justify-self: start;
}

.home-install-slot {
  display: grid;
  gap: 0.85rem;
}

.install-card {
  align-items: start;
}

.install-card-copy {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  min-width: 0;
}

.install-card-icon {
  display: grid;
  width: 2.6rem;
  height: 2.6rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--navy);
  background: #eaf7ff;
  border: 1px solid rgba(4, 159, 209, 0.2);
  border-radius: 8px;
}

.install-card-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.install-card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.7rem;
}

.install-button {
  min-width: 9.5rem;
}

.install-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.install-instructions {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.55;
}

.panel-note {
  margin: 0.2rem 0 0;
}

.search-grid,
.journey-grid,
.quick-grid,
.station-meta-grid,
.db-grid {
  display: grid;
  gap: 0.72rem;
}

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

.station-pair-grid {
  position: relative;
}

.station-swap-button {
  position: absolute;
  z-index: 5;
  top: 62%;
  left: 50%;
  width: 2.4rem;
  height: 2.4rem;
  background: var(--paper);
  border: 1px solid var(--subtle);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
}

.input-wrap {
  display: grid;
  gap: 0.34rem;
}

.input-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.form-helper {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
}

.input-shell,
select,
input[type="search"],
input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"],
input[type="number"],
textarea {
  width: 100%;
  min-height: 3rem;
  color: var(--ink);
  background: #f9fcfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.8rem;
}

.input-shell .field-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  color: var(--cyan);
}

input[type="search"] {
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"],
input[type="number"],
textarea {
  padding: 0 0.75rem;
  outline: 0;
}

textarea {
  min-height: 5.25rem;
  padding-top: 0.72rem;
  padding-bottom: 0.72rem;
  resize: vertical;
}

select {
  padding: 0 2.1rem 0 0.75rem;
  outline: 0;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 1.05rem) 52%,
    calc(100% - 0.72rem) 52%;
  background-size: 0.35rem 0.35rem, 0.35rem 0.35rem;
  background-repeat: no-repeat;
}

:root[data-theme="dark"] .input-shell,
:root[data-theme="dark"] select,
:root[data-theme="dark"] input[type="search"],
:root[data-theme="dark"] input[type="text"],
:root[data-theme="dark"] input[type="email"],
:root[data-theme="dark"] input[type="password"],
:root[data-theme="dark"] input[type="time"],
:root[data-theme="dark"] input[type="number"],
:root[data-theme="dark"] textarea {
  color: var(--ink);
  background-color: #0f2a3a;
  border-color: var(--subtle);
}

.next-card {
  overflow: hidden;
  padding: 1rem;
}

.next-card.is-delayed {
  border-color: rgba(186, 116, 22, 0.35);
}

.next-card.is-cancelled {
  border-color: rgba(184, 50, 50, 0.42);
}

.train-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.train-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.route-summary {
  margin: 0.16rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.countdown-lockup {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.8rem;
  margin: 0.5rem 0 0.85rem;
}

.countdown-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.countdown-time {
  display: block;
  margin-top: 0.05rem;
  font-size: clamp(2.3rem, 13vw, 4.6rem);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
}

.arrival-time {
  justify-self: end;
  color: var(--navy);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: right;
}

.progress-block {
  margin: 0.4rem 0 0.9rem;
}

.progress-track {
  overflow: hidden;
  height: 0.58rem;
  background: #e2ebef;
  border-radius: 999px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
  border-radius: inherit;
  transition: width 240ms ease;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
}

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

.info-tile {
  min-height: 5.4rem;
  padding: 0.78rem;
  background: var(--soft);
  border: 1px solid rgba(16, 33, 45, 0.06);
  border-radius: 8px;
}

.info-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.info-tile strong {
  display: block;
  margin-top: 0.26rem;
  font-size: 0.98rem;
  line-height: 1.2;
}

.status-pill.on-schedule,
.mini-pill.on-schedule {
  color: #0c5f36;
  background: #dff2e7;
}

.status-pill.delayed,
.mini-pill.delayed {
  color: #86520f;
  background: #fff0d1;
}

.status-pill.cancelled,
.mini-pill.cancelled {
  color: #982828;
  background: #ffe0df;
}

.status-pill.neutral,
.mini-pill.neutral {
  color: var(--navy);
  background: #e6f0f5;
}

.action-row,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.action-row {
  margin-top: 0.9rem;
}

.btn,
.icon-btn,
.chip {
  min-height: 2.7rem;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.btn:active,
.icon-btn:active,
.chip:active,
.nav-button:active,
.route-option-main:active,
.group-toggle:active {
  transform: scale(0.97);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0 0.86rem;
  color: #fff;
  font-weight: 800;
  background: var(--navy);
}

.btn:disabled,
select:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn.secondary {
  color: var(--navy);
  background: #eaf3f6;
  border-color: rgba(6, 43, 63, 0.12);
}

.btn.warning {
  color: #7a4707;
  background: #fff0cf;
  border-color: rgba(186, 116, 22, 0.25);
}

.btn .btn-icon,
.icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
}

.icon-btn {
  display: grid;
  width: 2.7rem;
  flex: 0 0 auto;
  place-items: center;
  color: var(--navy);
  background: #eef5f7;
}

.chip {
  padding: 0 0.75rem;
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 800;
  background: #f8fbfc;
  border-color: var(--subtle);
}

.chip.is-active {
  color: #fff;
  background: var(--navy);
}

.train-list,
.station-list,
.saved-list {
  display: grid;
  gap: 0.72rem;
}

.station-corridor {
  display: grid;
  gap: 0.52rem;
}

.station-corridor + .station-corridor {
  margin-top: 0.95rem;
}

.station-corridor-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.station-line-group {
  overflow: hidden;
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
  min-height: 3.25rem;
  padding: 0.72rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.group-toggle strong,
.group-toggle small,
.group-toggle b {
  display: block;
}

.group-toggle small {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.group-toggle b {
  color: var(--cyan);
  font-size: 0.78rem;
}

.group-stations {
  display: grid;
  gap: 0.4rem;
  padding: 0 0.55rem 0.55rem;
}

.train-row,
.station-card {
  padding: 0.85rem;
}

.train-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
}

.train-row-title,
.station-card-title {
  margin: 0;
  font-weight: 900;
  line-height: 1.2;
}

.train-row-sub,
.station-card-sub {
  margin: 0.16rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.time-stack {
  min-width: 4.6rem;
  text-align: right;
}

.time-stack strong {
  display: block;
  font-size: 1.08rem;
}

.time-stack span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.route-example-view {
  grid-column: 1 / -1;
}

.route-line-landing {
  display: grid;
  gap: 1rem;
}

.route-region-list,
.route-region-block,
.station-route-list {
  display: grid;
  gap: 0.72rem;
}

.route-region-block p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.station-route-choice {
  width: 100%;
  min-height: 3.8rem;
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.station-route-choice.is-active {
  border-color: rgba(4, 159, 209, 0.42);
  background: #eef7fa;
}

.route-example-main {
  padding: 1rem;
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(9, 35, 54, 0.06);
}

.route-titlebar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.9rem;
  min-width: 0;
  max-width: 100%;
}

.route-titlebar > * {
  min-width: 0;
}

.route-titlebar h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 8vw, 2.7rem);
  line-height: 1;
}

.route-titlebar p {
  margin: 0.35rem 0 0;
  color: #0b4d83;
  font-size: 1.04rem;
  font-weight: 700;
}

.train-status-card,
.current-time-card,
.route-trip-card,
.route-stat {
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(9, 35, 54, 0.04);
}

.train-status-card {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 0.62rem;
  padding: 0.75rem;
}

.train-status-card .icon {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  color: var(--navy);
  background: #eff5f8;
  border-radius: 50%;
}

.train-status-card strong,
.train-status-card span {
  display: block;
}

.train-status-card strong {
  font-size: 0.98rem;
}

.train-status-card span {
  margin-top: 0.12rem;
  color: var(--green);
  font-size: 0.82rem;
  font-weight: 900;
}

.route-toggle-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
  margin: 1.15rem 0 0;
  max-width: 100%;
}

.route-toggle {
  min-width: 0;
  min-height: 3.2rem;
  padding: 0 0.7rem;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  font-weight: 900;
  cursor: pointer;
}

.route-toggle.is-active {
  color: #fff;
  background: linear-gradient(135deg, #09273c, #0b4362);
  border-color: transparent;
}

.route-orientation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.24rem;
  margin-top: 0.9rem;
  padding: 0.72rem;
  color: var(--navy);
  background: #eef7fa;
  border: 1px solid rgba(4, 159, 209, 0.18);
  border-radius: 8px;
  font-size: 0.84rem;
}

.route-orientation strong,
.route-orientation span {
  display: block;
}

.route-orientation strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.route-control-label {
  margin: 1rem 0 -0.55rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.route-schedule-controls {
  display: grid;
  gap: 0.62rem;
  margin-top: 0.85rem;
  padding: 0.72rem;
  color: var(--ink);
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  max-width: 100%;
}

.route-control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-width: 0;
}

.route-control-heading strong {
  color: var(--ink);
  font-size: 0.92rem;
}

.route-schedule-button {
  min-height: 2.35rem;
  padding: 0 0.72rem;
  font-size: 0.82rem;
  white-space: nowrap;
}

.schedule-type-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
  max-width: 100%;
}

.schedule-type-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 0;
  min-height: 2.45rem;
  padding: 0 0.45rem;
  color: var(--navy);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.schedule-type-button.is-active {
  color: #fff;
  background: linear-gradient(135deg, #09273c, #0b4362);
  border-color: transparent;
}

.schedule-type-button .chip-check {
  flex: 0 0 auto;
}

.schedule-control-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 850;
}

.schedule-control-status span {
  min-width: 0;
  overflow-wrap: break-word;
}

.compact-route-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding: 0.62rem 0.72rem;
  color: var(--ink);
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  font-size: 0.84rem;
}

.compact-route-status strong {
  color: var(--muted);
  font-size: 0.78rem;
}

.compact-route-status span {
  font-weight: 900;
}

.compact-route-status small {
  flex-basis: 100%;
  color: var(--muted);
  line-height: 1.35;
}

.announcement-stack {
  display: grid;
  gap: 0.55rem;
  margin: 0.85rem 0;
}

.announcement-banner {
  display: grid;
  gap: 0.16rem;
  padding: 0.72rem;
  border-radius: 8px;
  border: 1px solid transparent;
}

.announcement-banner span {
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.announcement-banner strong {
  font-size: 0.9rem;
  line-height: 1.35;
}

.announcement-banner.warning {
  color: #754706;
  background: #fff1cf;
  border-color: rgba(186, 116, 22, 0.24);
}

.announcement-banner.cancellation,
.announcement-banner.disruption,
.announcement-banner.emergency {
  color: #8d2020;
  background: #ffe2e2;
  border-color: rgba(184, 50, 50, 0.26);
}

.announcement-banner.info {
  color: #064b7a;
  background: #e4f3ff;
  border-color: rgba(4, 159, 209, 0.2);
}

.day-selector {
  display: grid;
  gap: 0.5rem;
}

.day-selector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.day-selector-head strong {
  color: var(--navy);
}

.day-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.day-tabs .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  min-height: 2.35rem;
  padding: 0 0.2rem;
}

.chip-check {
  width: 0.9rem;
  height: 0.9rem;
}

.route-selector-panel {
  display: grid;
  gap: 0.72rem;
  margin-bottom: 1rem;
  padding: 0.72rem;
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.schedule-panel + .route-selector-panel {
  margin-top: 1rem;
  margin-bottom: 0;
}

.route-selector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.route-selector-head span,
.route-region p {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.route-selector-head strong {
  display: block;
  margin-top: 0.12rem;
  font-size: 1rem;
}

.route-region {
  display: grid;
  gap: 0.42rem;
}

.route-option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.45rem;
}

.route-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.65rem;
  align-items: stretch;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--subtle);
  border-left: 0.28rem solid var(--route-color);
  border-radius: 8px;
}

.route-option.is-active {
  border-color: rgba(6, 43, 63, 0.42);
  box-shadow: 0 7px 18px rgba(9, 35, 54, 0.08);
}

.route-option-main,
.route-pin-button {
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.route-option-main {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 0.5rem;
  padding: 0.55rem 0.58rem;
  text-align: left;
}

.route-color-dot {
  width: 0.72rem;
  height: 0.72rem;
  flex: 0 0 auto;
  background: var(--route-color);
  border-radius: 50%;
}

.route-option-main strong,
.route-option-main small {
  display: block;
}

.route-option-main strong {
  font-size: 0.9rem;
}

.route-option-main small {
  margin-top: 0.08rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.route-pin-button {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  place-items: center;
  color: #7d8e9a;
  border-left: 1px solid var(--subtle);
}

.route-option-alerts {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 0.58rem 0.58rem;
}

.route-option-alert {
  display: inline-flex;
  min-height: 1.55rem;
  align-items: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  line-height: 1.1;
}

.route-option-alert.info {
  color: #064b7a;
  background: #e4f3ff;
}

.route-option-alert.warning {
  color: #754706;
  background: #fff1cf;
}

.route-option-alert.disruption,
.route-option-alert.emergency {
  color: #8d2020;
  background: #ffe2e2;
}

.route-pin-button.is-pinned {
  color: var(--gold);
  background: #fff8df;
}

.route-pin-button .icon {
  width: 1.08rem;
  height: 1.08rem;
}

.route-example-content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  min-width: 0;
  max-width: 100%;
}

.route-line-card {
  --route-row-height: 4.15rem;
  --marker-left: 5.225rem;
  display: grid;
  position: relative;
  gap: 0;
  padding: 0.35rem 0;
  touch-action: pan-y;
  min-width: 0;
  max-width: 100%;
}

.route-schedule-button {
  white-space: nowrap;
}

.schedule-image-page {
  display: grid;
  gap: 0.65rem;
}

.schedule-back-button {
  min-height: 2.45rem;
}

.schedule-line-indicator {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.68rem 0.72rem;
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.schedule-line-indicator small,
.schedule-line-indicator em {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 850;
}

.schedule-line-indicator strong {
  display: block;
  margin: 0.12rem 0;
  color: var(--navy);
  font-size: 0.94rem;
  line-height: 1.2;
}

.schedule-period-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.38rem;
}

.schedule-time-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.62rem 0.72rem;
  color: #07445a;
  background: linear-gradient(135deg, #e7f7fb, #f6fbf7);
  border: 1px solid rgba(4, 159, 209, 0.22);
  border-radius: 8px;
}

.schedule-time-indicator small,
.schedule-time-indicator span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.schedule-time-indicator strong {
  display: block;
  margin-top: 0.15rem;
  color: var(--navy);
  font-size: 0.88rem;
  line-height: 1.35;
}

.schedule-time-indicator.active {
  background: #e8f8ee;
  border-color: rgba(22, 134, 75, 0.24);
}

.schedule-time-indicator.weekend {
  color: #76500b;
  background: #fff6df;
  border-color: rgba(186, 116, 22, 0.24);
}

.schedule-app-board {
  display: grid;
  gap: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.schedule-board-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
  padding: 0.68rem 0.72rem;
  background: #f8f9fb;
  border-bottom: 1px solid var(--subtle);
}

.schedule-board-head strong {
  display: block;
  color: #2766c8;
  font-size: 0.96rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
}

.schedule-board-head small,
.schedule-board-head span {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.schedule-grid-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  background: var(--paper);
  border-bottom: 1px solid var(--subtle);
}

.schedule-day-pill,
.schedule-direction-chip {
  min-height: 2.05rem;
  padding: 0 0.52rem;
  border: 1px solid var(--subtle);
  border-radius: 6px;
  background: #f7f9fb;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.schedule-direction-chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  cursor: pointer;
}

.schedule-direction-chip.is-active {
  color: #245da9;
  background: #eef6ff;
  border-color: #c8ddf8;
}

.schedule-direction-chip .btn-icon {
  width: 0.9rem;
  height: 0.9rem;
}

.schedule-grid-wrap {
  overflow-x: auto;
  max-height: min(70vh, 42rem);
  overflow-y: auto;
  background: #fff;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

.schedule-grid {
  width: 100%;
  min-width: calc(8.8rem + (var(--train-count, 4) * 4.05rem));
  border-collapse: collapse;
  table-layout: fixed;
}

.schedule-grid th,
.schedule-grid td {
  height: 2.28rem;
  padding: 0.32rem 0.42rem;
  border-right: 1px solid #d5dbe2;
  border-bottom: 1px solid #d5dbe2;
  text-align: center;
  vertical-align: middle;
}

.schedule-grid thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f4f6;
  color: #15202d;
  font-size: 0.72rem;
  font-weight: 900;
}

.schedule-grid thead th span,
.schedule-grid thead th small {
  display: block;
}

.schedule-service-label {
  margin-top: 0.12rem;
  color: #5e6a76;
  font-size: 0.52rem;
  font-weight: 850;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: normal;
}

.schedule-service-label.starts_at_intercept,
.schedule-service-label.terminates_at_intercept {
  color: #9a5a00;
}

.schedule-service-label.through {
  color: #14644f;
}

.schedule-grid thead th:first-child,
.schedule-grid tbody th {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 8.8rem;
  text-align: left;
}

.schedule-grid thead th:first-child {
  background: #f3f4f6;
}

.schedule-grid tbody th {
  overflow: hidden;
  color: #151d29;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.schedule-grid tbody tr.is-endpoint th {
  color: #1c477c;
  background: #eef6ff;
}

.schedule-grid tbody tr.is-endpoint td {
  background: #f7fbff;
}

.schedule-grid th.is-focus-col,
.schedule-grid td.is-focus-col {
  color: #183f78;
  background: #dcecff;
}

.schedule-grid td {
  color: #1d2632;
  font-size: 0.84rem;
  font-weight: 750;
}

.schedule-grid td.is-empty {
  color: #c8ced5;
}

.schedule-grid-summary {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.65rem;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--subtle);
  font-size: 0.72rem;
  font-weight: 850;
}

.schedule-grid-summary strong {
  color: var(--navy);
}

.schedule-close-bar {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0 0;
}

.schedule-close-button {
  width: min(15rem, 100%);
  min-height: 2.45rem;
  background: #2f67e8;
  font-size: 0.82rem;
}

.mini-route-map {
  display: grid;
  gap: 0;
  margin-top: 0.9rem;
  padding: 0.25rem 0;
}

.mini-route-map span {
  position: relative;
  display: grid;
  grid-template-columns: 1.35rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  min-height: 2.35rem;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.mini-route-map span.outside-selected {
  color: #9aa7b0;
}

.mini-route-map span.selected-segment {
  color: var(--ink);
  font-weight: 900;
}

.mini-route-map span::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0.57rem;
  width: 0.16rem;
  background: #b9c6ce;
}

.mini-route-map span.selected-segment::before {
  background: #ff8a00;
}

.mini-route-map span.outside-selected::before {
  background: #d5dee4;
}

.mini-route-map span:first-child::before {
  top: 50%;
}

.mini-route-map span:last-child::before {
  bottom: 50%;
}

.mini-route-map i {
  position: relative;
  z-index: 1;
  width: 0.82rem;
  height: 0.82rem;
  justify-self: center;
  background: var(--cyan);
  border: 0.14rem solid var(--paper);
  border-radius: 50%;
}

.mini-route-map span.selected-segment i {
  background: #ff8a00;
}

.mini-route-map .terminal {
  color: var(--ink);
}

.mini-route-map .terminal i {
  background: var(--navy);
}

.mini-route-map .selected-origin i,
.mini-route-map .selected-destination i {
  background: #ff8a00;
  box-shadow: 0 0 0 0.18rem rgba(255, 138, 0, 0.14);
}

.schedule-route-map-card {
  display: grid;
  gap: 0.7rem;
  margin: 0.75rem 0;
  padding: 0.78rem;
  background: #fff;
  border: 1px solid var(--subtle);
  border-left: 0.28rem solid var(--route-color, var(--cyan));
  border-radius: 8px;
}

.schedule-route-map-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.schedule-route-map-head small,
.schedule-route-map-head strong {
  display: block;
}

.schedule-route-map-head small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.schedule-route-map-head strong {
  margin-top: 0.12rem;
  font-size: 0.92rem;
}

.schedule-route-map-line {
  display: grid;
  gap: 0.18rem;
}

.schedule-route-map-line span {
  position: relative;
  display: grid;
  grid-template-columns: 1.1rem minmax(0, 1fr) auto;
  align-items: center;
  min-height: 1.85rem;
  gap: 0.5rem;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.schedule-route-map-line span::before {
  position: absolute;
  top: 50%;
  bottom: -50%;
  left: 0.42rem;
  width: 2px;
  background: color-mix(in srgb, var(--route-color, var(--cyan)) 58%, var(--subtle));
  content: "";
  transform: translateY(0.2rem);
}

.schedule-route-map-line span:last-child::before {
  display: none;
}

.schedule-route-map-line i {
  position: relative;
  z-index: 1;
  width: 0.85rem;
  height: 0.85rem;
  background: #fff;
  border: 3px solid var(--route-color, var(--cyan));
  border-radius: 999px;
}

.schedule-route-map-line b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-route-map-line em {
  padding: 0.2rem 0.4rem;
  color: var(--muted);
  background: var(--soft);
  border-radius: 999px;
  font-size: 0.66rem;
  font-style: normal;
  font-weight: 900;
}

.schedule-route-map-line .is-intercept i {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(186, 116, 22, 0.16);
}

.schedule-route-map-line .is-intercept b {
  color: var(--amber);
}

.moving-train-indicator {
  position: absolute;
  z-index: 4;
  top: calc((100% - var(--route-row-height)) * var(--train-ratio) + (var(--route-row-height) / 2));
  left: 4.575rem; /* Centered in the 2.45rem marker column: 3.35 + (2.45/2) */
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  color: #fff;
  background: var(--map-current);
  border: 0.24rem solid #fff;
  padding: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 0.28rem rgba(255, 138, 0, 0.18), 0 10px 24px rgba(9, 35, 54, 0.18);
  transform: translate(-50%, -50%);
  transition: top 900ms cubic-bezier(0.4, 0, 0.2, 1);
  animation: routePulse 1.45s ease-in-out infinite;
  cursor: pointer;
  touch-action: manipulation;
  will-change: top;
}

.moving-train-indicator .icon {
  width: 1.2rem;
  height: 1.2rem;
}

.route-train-popover {
  position: absolute;
  z-index: 5;
  top: calc((100% - var(--route-row-height)) * var(--train-ratio) + (var(--route-row-height) / 2));
  left: 6.35rem;
  display: grid;
  gap: 0.1rem;
  max-width: min(15rem, calc(100% - 7rem));
  padding: 0.62rem 0.72rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid rgba(255, 138, 0, 0.32);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(9, 35, 54, 0.14);
  transform: translateY(-50%);
}

.route-train-popover span,
.route-train-popover small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.example-route-stop {
  position: relative;
  display: grid;
  grid-template-columns: 3.35rem 2.45rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
  min-height: 4.15rem;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: default;
  touch-action: pan-y;
}

.example-time {
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.example-marker {
  position: relative;
  display: grid;
  align-self: stretch;
  place-items: center;
}

.example-marker::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0.22rem;
  transform: translateX(-50%);
  background: var(--map-upcoming);
}

.example-route-stop:first-child .example-marker::before {
  top: 50%;
}

.example-route-stop:last-child .example-marker::before {
  bottom: 50%;
}

.example-route-stop.passed .example-marker::before,
.example-route-stop.complete .example-marker::before {
  background: var(--map-complete);
}

.example-route-stop.active .example-marker::before {
  background: linear-gradient(180deg, var(--map-complete) 0 50%, var(--map-current) 50% 100%);
}

.example-route-stop.next .example-marker::before {
  background: linear-gradient(180deg, var(--map-current) 0 50%, var(--map-upcoming) 50% 100%);
}

.example-route-stop.upcoming .example-marker::before,
.example-route-stop.standby .example-marker::before {
  background: repeating-linear-gradient(180deg, #b8c4cc 0 0.38rem, transparent 0.38rem 0.7rem);
}

.example-route-stop.inactive .example-marker::before {
  background: color-mix(in srgb, var(--map-upcoming) 45%, transparent);
}

.example-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 1.16rem;
  height: 1.16rem;
  place-items: center;
  background: color-mix(in srgb, var(--map-current) 36%, #fff);
  border: 0.18rem solid var(--paper);
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(16, 33, 45, 0.08);
}

.example-route-stop.is-terminal .example-dot {
  background: var(--map-destination);
}

.example-route-stop.upcoming .example-dot,
.example-route-stop.standby .example-dot {
  background: var(--map-upcoming);
}

.example-route-stop.passed .example-dot,
.example-route-stop.active .example-dot,
.example-route-stop.complete .example-dot {
  background: var(--map-complete);
}

.example-route-stop.next .example-dot {
  background: var(--paper);
  border-color: var(--map-current);
  box-shadow: 0 0 0 0.18rem rgba(255, 138, 0, 0.12);
}

.example-route-stop.is-intercept .example-dot {
  display: grid;
  place-items: center;
  background: var(--map-intercept);
  border-color: var(--map-waiting);
  box-shadow: 0 0 0 0.18rem rgba(245, 130, 0, 0.16);
}

.example-route-stop.is-intercept .example-dot::after {
  content: "!";
  color: #fff;
  font-size: 0.72rem;
  font-weight: 950;
  line-height: 1;
}

.example-route-stop.next.is-intercept .example-dot {
  animation: interceptBlink 900ms ease-in-out infinite;
}

@keyframes interceptBlink {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0.18rem rgba(245, 130, 0, 0.16);
  }
  50% {
    transform: scale(1.18);
    box-shadow: 0 0 0 0.42rem rgba(245, 130, 0, 0.28);
  }
}

.example-name {
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 800;
}

.example-route-stop.active .example-name,
.example-route-stop.standby .example-name,
.example-route-stop.next .example-name {
  color: var(--ink);
  font-weight: 950;
}

.example-route-stop.upcoming .example-name {
  color: #7f8d99;
}

.example-route-stop.inactive .example-time,
.example-route-stop.inactive .example-name {
  color: #9aa7b0;
}

.example-route-stop.inactive .example-dot {
  background: color-mix(in srgb, var(--map-upcoming) 45%, transparent);
}

.example-route-stop.inactive.is-intercept .example-dot {
  background: var(--map-intercept);
  opacity: 0.78;
}

.example-route-stop.outside-selected .example-name,
.example-route-stop.outside-selected .example-time {
  color: #9aa7b0;
}

.example-route-stop.outside-selected .example-marker::before {
  background: color-mix(in srgb, var(--map-upcoming) 45%, transparent);
}

.example-route-stop.selected-segment .example-marker::before {
  background: var(--map-current);
}

.example-route-stop.selected-segment .example-dot {
  background: var(--map-current);
}

.example-route-stop.selected-origin .example-dot,
.example-route-stop.selected-destination .example-dot {
  background: var(--paper);
  border-color: var(--map-current);
  box-shadow: 0 0 0 0.22rem rgba(255, 138, 0, 0.18);
}

.selected-journey-notice {
  display: grid;
  gap: 0.16rem;
  margin-top: 0.75rem;
}

.selected-journey-notice span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.example-platform,
.next-meta em,
.after-stop-box em {
  min-width: 3.1rem;
  padding: 0.42rem 0.5rem;
  color: var(--navy);
  background: #fff0c6;
  border-radius: 8px;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.route-insight-panel {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
  max-width: 100%;
}

.current-time-card {
  display: grid;
  min-height: 5rem;
  place-items: center;
  padding: 0.65rem;
  text-align: center;
}

.current-time-card strong {
  display: block;
  font-size: 1.65rem;
}

.current-time-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.route-trip-card {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  min-width: 0;
  max-width: 100%;
}

.simulation-disclaimer {
  display: grid;
  gap: 0.08rem;
  padding: 0.7rem;
  color: #734804;
  background: #fff4d4;
  border: 1px solid rgba(186, 116, 22, 0.2);
  border-radius: 8px;
}

.simulation-disclaimer strong,
.simulation-disclaimer span {
  display: block;
}

.simulation-disclaimer strong {
  font-size: 0.9rem;
}

.simulation-disclaimer span {
  font-size: 0.8rem;
  font-weight: 800;
}

.trip-pair {
  display: grid;
  grid-template-columns: 7.2rem minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
  font-size: 1rem;
}

.trip-pair span {
  color: var(--ink);
}

.trip-pair strong {
  color: #064b8c;
}

.trip-pair strong.accent,
.movement-strip strong,
.next-station-box strong {
  color: #f58200;
}

.movement-strip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  min-width: 0;
  padding-top: 0.85rem;
  border-top: 1px solid #e2e9ee;
  font-size: 0.92rem;
}

.movement-strip span {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: normal;
  line-height: 1.35;
}

.movement-strip .icon {
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0.35rem;
  color: var(--navy);
  background: #eef3f6;
  border-radius: 8px;
}

.mini-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--stop-count, 10), minmax(0, 1fr));
  align-items: center;
  gap: 0.32rem;
  margin: 0.2rem 0;
}

.mini-track::before {
  content: "";
  position: absolute;
  right: 0;
  left: 0;
  height: 0.26rem;
  background: #b9c5ce;
  border-radius: 999px;
}

.mini-track span {
  position: relative;
  z-index: 1;
  display: block;
  width: 0.82rem;
  height: 0.82rem;
  justify-self: center;
  background: #fff;
  border: 0.18rem solid #9fb0bd;
  border-radius: 50%;
}

.mini-track span.done {
  border-color: #138a52;
  background: #138a52;
}

.mini-track span.now {
  width: 2rem;
  height: 2rem;
  background: #fff;
  border-color: #ff8a00;
  box-shadow: 0 0 0 0.2rem rgba(255, 138, 0, 0.12);
}

.stops-complete {
  margin: -0.1rem 0 0.2rem;
  color: var(--navy);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
}

.next-station-box,
.after-stop-box {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem;
  background: #fbfdfe;
  border: 1px solid #dfe8ee;
  border-radius: 8px;
}

.next-station-box span,
.after-stop-box span,
.next-station-box small,
.after-stop-box small {
  color: var(--muted);
  font-weight: 700;
}

.next-station-box strong {
  font-size: 1.22rem;
}

.next-station-box b {
  color: var(--navy);
  font-size: 1.7rem;
}

.next-meta,
.after-stop-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

.next-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--navy);
}

.next-meta .icon {
  width: 1rem;
  height: 1rem;
}

.after-stop-box {
  flex-wrap: wrap;
}

.after-stop-box strong {
  color: var(--navy);
}

.route-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.52rem;
  color: var(--ink);
  font-size: 0.78rem;
}

.route-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-line {
  display: inline-block;
  width: 1.8rem;
  height: 0.22rem;
  background: var(--map-upcoming);
  border-radius: 999px;
}

.legend-line.travelled {
  background: var(--map-complete);
}

.legend-line.active,
.legend-line.selected {
  background: var(--map-current);
}

.legend-line.remaining {
  background: repeating-linear-gradient(90deg, var(--map-upcoming) 0 0.42rem, transparent 0.42rem 0.72rem);
}

.legend-dot {
  display: inline-block;
  width: 0.82rem;
  height: 0.82rem;
  background: var(--map-upcoming);
  border-radius: 50%;
}

.legend-dot.current {
  background: var(--paper);
  border: 0.18rem solid var(--map-current);
}

.legend-dot.waiting {
  background: var(--map-waiting);
}

.legend-dot.passed {
  background: var(--map-complete);
}

.legend-dot.origin {
  background: var(--paper);
  border: 0.18rem solid var(--map-current);
}

.legend-dot.destination {
  background: var(--paper);
  border: 0.18rem solid var(--map-current);
}

.legend-dot.intercept {
  background: var(--map-intercept);
  border: 0.15rem solid var(--map-waiting);
}

.legend-dot.partial {
  background: var(--map-partial);
}

.movement-summary-card {
  display: grid;
  gap: 0.18rem;
  padding: 0.68rem;
  background: var(--soft);
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.movement-summary-card span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.movement-summary-card strong {
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.25;
}

.movement-summary-card small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.route-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.72rem;
  margin-top: 1rem;
}

.route-stat {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.15rem 0.7rem;
  align-items: center;
  padding: 0.78rem;
}

.route-stat .icon {
  grid-row: span 2;
  width: 1.55rem;
  height: 1.55rem;
  color: var(--navy);
}

.route-stat span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.route-stat strong {
  color: var(--navy);
  font-size: 1.02rem;
}

.route-stat strong.success {
  color: var(--green);
}

.schedule-panel {
  margin-top: 1rem;
  padding: 1rem;
  background: #f7fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.schedule-panel .icon {
  width: 1.4rem;
  height: 1.4rem;
  color: var(--cyan);
}

.schedule-table {
  display: grid;
  gap: 0.48rem;
  margin-top: 0.85rem;
}

.schedule-split {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.schedule-group {
  display: grid;
  gap: 0.45rem;
}

.schedule-row {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.65rem;
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: 8px;
}

.schedule-row strong {
  color: var(--navy);
}

.schedule-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.schedule-row small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.3;
}

.schedule-row em {
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.schedule-row em.on-schedule {
  color: #0c5f36;
  background: #dff2e7;
}

.schedule-row em.delayed {
  color: #86520f;
  background: #fff0d1;
}

.schedule-row em.cancelled {
  color: #982828;
  background: #ffe0df;
}

@keyframes routePulse {
  0%, 100% {
    box-shadow: 0 0 0 0.2rem rgba(255, 138, 0, 0.16), 0 10px 24px rgba(9, 35, 54, 0.18);
  }
  50% {
    box-shadow: 0 0 0 0.38rem rgba(255, 138, 0, 0.24), 0 10px 24px rgba(9, 35, 54, 0.18);
  }
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(0.35rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.route-timeline {
  position: relative;
  display: grid;
  gap: 0.15rem;
  margin: 0.2rem 0 0;
}

.route-stop {
  position: relative;
  display: grid;
  grid-template-columns: 1.8rem minmax(0, 1fr) auto;
  gap: 0.72rem;
  align-items: center;
  min-height: 3.7rem;
  padding: 0.3rem 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.route-stop::before {
  content: "";
  position: absolute;
  left: 0.82rem;
  top: 0;
  bottom: 0;
  width: 0.16rem;
  background: #cddfe7;
}

.route-stop:first-child::before {
  top: 50%;
}

.route-stop:last-child::before {
  bottom: 50%;
}

.stop-dot {
  position: relative;
  z-index: 1;
  display: grid;
  width: 1.8rem;
  height: 1.8rem;
  place-items: center;
  color: #fff;
  background: var(--cyan);
  border: 0.24rem solid #eaf7fb;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 900;
}

.route-stop.is-terminal .stop-dot {
  background: var(--navy);
}

.stop-name {
  font-weight: 900;
}

.stop-meta {
  display: block;
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.platform-tag {
  align-self: center;
  min-width: 3.2rem;
  padding: 0.38rem 0.45rem;
  color: var(--navy);
  background: #fff5d8;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.map-asset {
  overflow: auto;
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.map-asset img {
  display: block;
  width: 920px;
  max-width: none;
  height: auto;
}

.station-card {
  display: grid;
  gap: 0.65rem;
  border: 0;
  box-shadow: none;
}

.station-card.is-selected {
  background: var(--soft);
  border: 1px solid var(--subtle);
}

.station-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

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

.layout-map {
  display: grid;
  gap: 0.48rem;
  padding: 0.8rem;
  background:
    linear-gradient(90deg, rgba(16, 33, 45, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(16, 33, 45, 0.05) 1px, transparent 1px),
    #f9fcfc;
  background-size: 1.2rem 1.2rem;
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.layout-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.48rem;
}

.layout-item {
  min-height: 2.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.42rem;
  color: var(--navy);
  background: #fff;
  border: 1px solid rgba(16, 33, 45, 0.1);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
  text-align: center;
}

.layout-item.track {
  min-height: 3.15rem;
  color: #fff;
  background: var(--navy);
}

.layout-item.bridge {
  grid-column: 1 / -1;
  color: #734804;
  background: #fff1c9;
}

.layout-item.exit {
  background: #e7f4ef;
}

.layout-item.taxi {
  background: #e7f2fb;
}

.layout-item.office {
  background: #f7e9e9;
}

.import-panel {
  padding: 1rem;
}

.settings-view {
  grid-column: 1 / -1;
  display: grid;
  gap: 1rem;
}

.settings-list,
.document-list,
.admin-section {
  display: grid;
  gap: 0.72rem;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(6.4rem, auto);
  gap: 0.75rem;
  align-items: center;
  padding: 0.75rem;
  background: var(--soft);
  border: 1px solid rgba(16, 33, 45, 0.06);
  border-radius: 8px;
}

.setting-row strong,
.setting-row small {
  display: block;
}

.setting-row small {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.status-badge {
  justify-self: end;
  padding: 0.42rem 0.68rem;
  color: var(--cyan);
  background: rgba(4, 159, 209, 0.09);
  border: 1px solid rgba(4, 159, 209, 0.18);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 900;
}

.status-badge.warning {
  color: #754706;
  background: #fff1cf;
  border-color: rgba(186, 116, 22, 0.24);
}

.account-status-card,
.verification-card {
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--soft);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: 10px;
}

.account-status-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.account-status-card strong,
.verification-card h3,
.verification-card strong {
  color: var(--ink);
}

.account-status-card p,
.verification-card p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.42;
}

.account-status-card.is-warning,
.verification-card {
  background: #fff8e8;
  border-color: rgba(186, 116, 22, 0.18);
}

.verification-card h3 {
  margin: 0;
  font-size: 1rem;
}

.settings-auth-panel {
  display: grid;
  gap: 0.72rem;
  margin-top: 0.75rem;
}

.settings-auth-google {
  justify-content: center;
  gap: 0.65rem;
  min-height: 2.9rem;
}

.settings-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.settings-auth-actions .btn,
.settings-auth-actions .link-button {
  min-height: 2.65rem;
}

.settings-auth-form {
  display: grid;
  gap: 0.7rem;
  padding: 0.8rem;
  background: var(--soft);
  border: 1px solid rgba(16, 33, 45, 0.06);
  border-radius: 12px;
}

.password-requirements {
  display: grid;
  gap: 0.32rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.password-requirements li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.password-requirements li span:first-child {
  display: inline-grid;
  width: 1.15rem;
  height: 1.15rem;
  place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
}

.password-requirements li.is-met {
  color: #0b6b47;
}

.password-requirements li.is-met span:first-child {
  color: #ffffff;
  background: #0b6b47;
}

.password-requirements li.is-unmet span:first-child {
  color: var(--muted);
  background: rgba(16, 33, 45, 0.08);
}

.admin-tool-panel {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.85rem;
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.admin-wide-field,
.admin-checkbox-row {
  grid-column: 1 / -1;
}

.admin-checkbox-row {
  margin: 0;
}

.setting-row input[type="checkbox"] {
  width: 1.35rem;
  height: 1.35rem;
  justify-self: end;
  accent-color: var(--cyan);
}

.document-list article,
.notice-card,
.admin-section {
  padding: 0.8rem;
  background: var(--soft);
  border: 1px solid rgba(16, 33, 45, 0.06);
  border-radius: 8px;
}

.document-list h3,
.document-list p {
  margin: 0;
}

.document-list h3 {
  font-size: 0.95rem;
}

.document-list p {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.notice-card {
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 800;
}

.notice-card.warning {
  color: #754706;
  background: #fff1cf;
  border-color: rgba(186, 116, 22, 0.24);
}

.intercept-status {
  position: absolute;
  top: 0.35rem;
  left: 5.35rem;
  z-index: 5;
  display: inline-grid;
  width: fit-content;
  max-width: min(16rem, calc(100% - 1rem));
  gap: 0.08rem;
  margin: 0;
  padding: 0.42rem 0.58rem;
  color: #754706;
  background: rgba(255, 241, 207, 0.88);
  border: 1px solid rgba(186, 116, 22, 0.28);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(9, 35, 54, 0.12);
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.intercept-status strong {
  font-size: 0.76rem;
  line-height: 1.05;
}

.intercept-status span {
  color: inherit;
  font-size: 0.7rem;
  font-weight: 850;
  line-height: 1.1;
}

.intercept-toast {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.68rem 0.72rem;
  color: #5f3d00;
  background: #fff3d6;
  border: 1px solid rgba(186, 116, 22, 0.28);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(78, 52, 10, 0.1);
}

.intercept-toast strong,
.intercept-toast span {
  display: block;
}

.intercept-toast strong {
  font-size: 0.85rem;
  line-height: 1.2;
}

.intercept-toast span {
  margin-top: 0.15rem;
  font-size: 0.78rem;
  line-height: 1.3;
}

.intercept-toast .icon-btn {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.68);
  border-color: rgba(186, 116, 22, 0.24);
}

.intercept-inline {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  margin: 0.22rem 0 0;
  padding: 0.18rem 0.38rem;
  color: #754706;
  background: rgba(255, 241, 207, 0.92);
  border: 1px solid rgba(186, 116, 22, 0.24);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1.1;
}

.intercept-warning-icon {
  width: 0.9rem;
  height: 0.9rem;
  color: #f58200;
}

.service-badge {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  justify-content: center;
  margin-left: 0.28rem;
  padding: 0.22rem 0.42rem;
  color: #754706;
  background: #fff1cf;
  border: 1px solid rgba(186, 116, 22, 0.24);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1.1;
  vertical-align: middle;
  white-space: normal;
}

.service-badge.through {
  color: #0c5f36;
  background: #dff2e7;
  border-color: rgba(19, 138, 82, 0.22);
}

.service-badge.starts_at_intercept,
.service-badge.terminates_at_intercept {
  color: #754706;
  background: #fff1cf;
  border-color: rgba(186, 116, 22, 0.24);
}

.service-badge.partial_service {
  color: #364653;
  background: #edf3f6;
  border-color: rgba(87, 105, 118, 0.22);
}

.service-badge.no_service {
  color: #7f1f1f;
  background: #ffe0df;
  border-color: rgba(152, 40, 40, 0.2);
}

.service-badge.intercept {
  margin-left: 0;
}

.intercept-service-card,
.intercept-station-notice,
.intercept-summary {
  display: grid;
  gap: 0.45rem;
  padding: 0.7rem;
  background: #fff8e8;
  border: 1px solid rgba(186, 116, 22, 0.22);
  border-radius: 8px;
}

.intercept-service-card strong,
.intercept-station-notice strong,
.intercept-summary strong,
.intercept-summary small {
  display: block;
}

.intercept-service-card strong,
.intercept-station-notice strong,
.intercept-summary strong {
  color: #754706;
  font-size: 0.84rem;
}

.intercept-service-card p,
.intercept-station-notice p {
  margin: 0;
  color: #754706;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.intercept-summary {
  margin-top: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.intercept-summary .service-badge {
  grid-column: 1 / -1;
  justify-self: start;
}

.intercept-summary small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.station-direction-schedule {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.form-grid {
  display: grid;
  gap: 0.72rem;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.admin-panel {
  display: grid;
  gap: 1rem;
}

.admin-section .section-title {
  margin-bottom: 0.2rem;
}

.contact-card,
.bank-card {
  display: grid;
  gap: 0.12rem;
  padding: 0.82rem;
  color: var(--navy);
  background: #eef7fa;
  border: 1px solid rgba(4, 159, 209, 0.18);
  border-radius: 8px;
}

.contact-card span,
.bank-card span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contact-card strong,
.bank-card strong {
  font-size: 1.2rem;
}

.contact-number-section {
  display: grid;
}

.compact-contact-card {
  color: inherit;
  text-decoration: none;
}

.compact-contact-card:active {
  transform: translateY(1px);
}

.app-footer {
  display: grid;
  gap: 0.25rem;
  width: min(100%, 760px);
  margin: 0.25rem auto 0;
  padding: 0.4rem 0.45rem 0.2rem;
  color: var(--muted);
  text-align: center;
}

.app-footer-copy,
.app-footer-note {
  margin: 0;
}

.app-footer-copy {
  font-size: 0.78rem;
  font-weight: 850;
}

.app-footer-note {
  max-width: 42rem;
  margin-inline: auto;
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.4;
}

.notice-card .inline-action {
  width: auto;
  min-height: 2.15rem;
  margin-top: 0.55rem;
  padding: 0 0.75rem;
  font-size: 0.82rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 1rem;
  background: rgba(6, 21, 31, 0.48);
  backdrop-filter: blur(10px);
}

.support-modal {
  width: min(34rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1rem;
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.support-copy {
  display: grid;
  gap: 0.72rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.support-copy p,
.support-copy ul {
  margin: 0;
}

.support-copy ul {
  padding-left: 1.1rem;
}

.upload-box {
  display: grid;
  gap: 0.5rem;
  align-items: center;
  justify-items: center;
  min-height: 9rem;
  padding: 1rem;
  color: var(--navy);
  background: #f7fbfc;
  border: 1px dashed #9ec5d7;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
}

.compact-upload {
  min-height: 6.6rem;
  margin-top: 0.75rem;
}

.upload-box input {
  display: none;
}

.upload-title {
  margin: 0;
  font-weight: 900;
}

.upload-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.import-steps {
  display: grid;
  gap: 0.44rem;
  margin: 0.85rem 0 0;
  padding: 0;
  list-style: none;
}

.import-steps li {
  display: flex;
  align-items: center;
  gap: 0.52rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.step-dot {
  width: 0.7rem;
  height: 0.7rem;
  flex: 0 0 auto;
  background: #bfd0da;
  border-radius: 50%;
}

.import-steps li.done {
  color: var(--ink);
}

.import-steps li.done .step-dot {
  background: var(--green);
}

.import-steps li.warn .step-dot {
  background: var(--amber);
}

.db-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.db-stat {
  padding: 0.78rem;
  background: var(--soft);
  border-radius: 8px;
}

.db-stat strong {
  display: block;
  font-size: 1.3rem;
}

.db-stat span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.empty-state {
  padding: 1rem;
  color: var(--muted);
  background: #f8fbfc;
  border: 1px solid var(--subtle);
  border-radius: 8px;
  text-align: center;
}

.terms-gate {
  grid-column: 1 / -1;
  display: grid;
  min-height: calc(100vh - 8rem);
  place-items: center;
}

.terms-panel {
  width: min(42rem, 100%);
  padding: 1rem;
  background: var(--paper);
  border: 1px solid rgba(16, 33, 45, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.terms-scroll {
  overflow: auto;
  max-height: 18rem;
  padding: 0.85rem;
  background: var(--soft);
  border: 1px solid var(--subtle);
  border-radius: 8px;
}

.terms-scroll h3 {
  margin: 0.8rem 0 0.24rem;
  font-size: 0.96rem;
}

.terms-scroll h3:first-child {
  margin-top: 0;
}

.terms-scroll p {
  margin: 0 0 0.72rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.accept-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.85rem 0 0.4rem;
  font-weight: 800;
}

.accept-row input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--cyan);
}

.btn:disabled,
.accept-row input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Material Design FAB */
.fab {
  position: fixed;
  right: 1.5rem;
  bottom: calc(6.5rem + env(safe-area-inset-bottom));
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 16px;
  background: var(--cyan);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(4, 159, 209, 0.4);
  border: none;
  cursor: pointer;
  z-index: 30;
  transition: transform 0.2s, background 0.2s;
}

.fab:active {
  transform: scale(0.9);
  background: var(--teal);
}

:root[data-theme="dark"] .fab {
  background: var(--cyan);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.fab .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.bottom-nav {
  position: fixed;
  right: auto;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.25rem;
  width: min(calc(100% - 2rem), 18.9rem);
  padding: 0.42rem;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 28px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(22px) saturate(1.25);
  animation: navFloat 400ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

body[data-launch-screen="splash"] .bottom-nav,
body[data-launch-screen="auth"] .bottom-nav {
  display: none;
}

body[data-launch-screen="splash"] .app-header {
  display: none;
}

body[data-launch-screen="splash"] .app-shell,
body[data-launch-screen="auth"] .app-shell {
  min-height: 100svh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}

body[data-launch-screen="splash"] .app-main {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  padding: 0;
}

body[data-launch-screen="splash"] .launch-screen {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
}

body[data-launch-screen="auth"] .app-main {
  min-height: calc(100svh - 4.6rem);
  min-height: calc(100dvh - 4.6rem);
  padding: 0;
}

body[data-launch-screen="auth"] .app-header {
  padding: calc(0.58rem + env(safe-area-inset-top)) 0.9rem 0.5rem;
}

body[data-launch-screen="auth"] .brand-lockup {
  gap: 0.55rem;
}

body[data-launch-screen="auth"] .brand-mark {
  width: 2.45rem;
  height: 2.45rem;
  border-radius: 8px;
}

body[data-launch-screen="auth"] .app-header .eyebrow {
  font-size: 0.64rem;
  line-height: 1.1;
}

body[data-launch-screen="auth"] .app-header h1 {
  font-size: 1.08rem;
  line-height: 1.05;
}

@keyframes navFloat {
  from { transform: translateX(-50%) translateY(100%) scale(0.9); opacity: 0; }
  to { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
}

.nav-button {
  display: grid;
  min-width: 0;
  min-height: 3.05rem;
  place-items: center;
  gap: 0.14rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 900;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.nav-button.is-active {
  color: var(--navy);
  background: rgba(234, 243, 246, 0.8);
}

body[data-input-mode="keyboard"] button:focus-visible,
body[data-input-mode="keyboard"] select:focus-visible,
body[data-input-mode="keyboard"] input:focus-visible,
body[data-input-mode="keyboard"] textarea:focus-visible,
body[data-input-mode="keyboard"] a:focus-visible {
  outline: 3px solid rgba(255, 138, 0, 0.7);
  outline-offset: 2px;
}

.nav-icon svg,
.field-icon svg,
.btn-icon svg,
.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.nav-icon {
  width: 1.22rem;
  height: 1.22rem;
}

:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .next-card,
:root[data-theme="dark"] .train-row,
:root[data-theme="dark"] .station-card,
:root[data-theme="dark"] .import-panel,
:root[data-theme="dark"] .route-example-main,
:root[data-theme="dark"] .terms-panel,
:root[data-theme="dark"] .auth-card {
  background: var(--paper);
  border-color: rgba(231, 241, 245, 0.1);
  box-shadow: none;
}

:root[data-theme="dark"] .install-card-icon {
  color: var(--navy);
  background: #0f2a3a;
  border-color: var(--subtle);
}

:root[data-theme="dark"] .network-pill,
:root[data-theme="dark"] .nav-button.is-active,
:root[data-theme="dark"] .btn.secondary,
:root[data-theme="dark"] .icon-btn,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .route-selector-panel,
:root[data-theme="dark"] .route-option,
:root[data-theme="dark"] .auth-tabs,
:root[data-theme="dark"] .auth-provider-mark,
:root[data-theme="dark"] .station-route-choice,
:root[data-theme="dark"] .schedule-line-indicator,
:root[data-theme="dark"] .schedule-route-map-card,
:root[data-theme="dark"] .schedule-time-indicator,
:root[data-theme="dark"] .schedule-app-board,
:root[data-theme="dark"] .schedule-grid-tools,
:root[data-theme="dark"] .schedule-grid-summary,
:root[data-theme="dark"] .train-status-card,
:root[data-theme="dark"] .current-time-card,
:root[data-theme="dark"] .route-trip-card,
:root[data-theme="dark"] .route-stat,
:root[data-theme="dark"] .route-schedule-controls,
:root[data-theme="dark"] .schedule-type-button,
:root[data-theme="dark"] .compact-route-status,
:root[data-theme="dark"] .schedule-panel,
:root[data-theme="dark"] .schedule-row,
:root[data-theme="dark"] .station-line-group,
:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .upload-box {
  color: var(--ink);
  background: #0f2a3a;
  border-color: var(--subtle);
}

:root[data-theme="dark"] .support-modal {
  background: var(--paper);
  border-color: var(--subtle);
}

:root[data-theme="dark"] .contact-card,
:root[data-theme="dark"] .bank-card {
  background: #102f40;
  border-color: var(--subtle);
}

:root[data-theme="dark"] .schedule-board-head,
:root[data-theme="dark"] .schedule-grid thead th,
:root[data-theme="dark"] .schedule-grid thead th:first-child,
:root[data-theme="dark"] .schedule-grid tbody th,
:root[data-theme="dark"] .schedule-grid tbody tr.is-endpoint th,
:root[data-theme="dark"] .schedule-grid tbody tr.is-endpoint td,
:root[data-theme="dark"] .schedule-grid-wrap {
  background: var(--paper);
}

:root[data-theme="dark"] .schedule-grid th.is-focus-col,
:root[data-theme="dark"] .schedule-grid td.is-focus-col {
  color: #d8ebff;
  background: #183c5d;
}

:root[data-theme="dark"] .bottom-nav {
  background: rgba(6, 21, 31, 0.2);
  border-top-color: rgba(231, 241, 245, 0.1);
}

:root[data-theme="dark"] .nav-button.is-active {
  background: rgba(15, 42, 58, 0.8);
}

:root[data-theme="dark"] .info-tile,
:root[data-theme="dark"] .db-stat,
:root[data-theme="dark"] .setting-row,
:root[data-theme="dark"] .account-status-card,
:root[data-theme="dark"] .verification-card,
:root[data-theme="dark"] .settings-auth-form,
:root[data-theme="dark"] .document-list article,
:root[data-theme="dark"] .notice-card,
:root[data-theme="dark"] .admin-section,
:root[data-theme="dark"] .terms-scroll,
:root[data-theme="dark"] .password-field,
:root[data-theme="dark"] .auth-provider-btn,
:root[data-theme="dark"] .layout-map {
  background: var(--soft);
  border-color: var(--subtle);
}

:root[data-theme="dark"] .status-badge.warning,
:root[data-theme="dark"] .account-status-card.is-warning,
:root[data-theme="dark"] .verification-card,
:root[data-theme="dark"] .notice-card.warning {
  color: #ffd99a;
  background: rgba(117, 71, 6, 0.22);
  border-color: rgba(255, 217, 154, 0.24);
}

:root[data-theme="dark"] .announcement-banner.info,
:root[data-theme="dark"] .route-option-alert.info {
  color: #b9e8ff;
  background: rgba(4, 159, 209, 0.16);
  border-color: rgba(185, 232, 255, 0.2);
}

:root[data-theme="dark"] .announcement-banner.warning,
:root[data-theme="dark"] .route-option-alert.warning {
  color: #ffd99a;
  background: rgba(117, 71, 6, 0.22);
  border-color: rgba(255, 217, 154, 0.24);
}

:root[data-theme="dark"] .announcement-banner.disruption,
:root[data-theme="dark"] .announcement-banner.emergency,
:root[data-theme="dark"] .route-option-alert.disruption,
:root[data-theme="dark"] .route-option-alert.emergency {
  color: #ffc4c4;
  background: rgba(141, 32, 32, 0.24);
  border-color: rgba(255, 196, 196, 0.24);
}

:root[data-theme="dark"] .password-requirements li.is-met {
  color: #8cf0bf;
}

:root[data-theme="dark"] .password-requirements li.is-met span:first-child {
  color: #06151f;
  background: #8cf0bf;
}

:root[data-theme="dark"] .route-orientation,
:root[data-theme="dark"] .simulation-disclaimer {
  color: var(--ink);
  background: #172f3d;
  border-color: var(--subtle);
}

:root[data-theme="dark"] .schedule-type-button.is-active {
  color: #041520;
  background: linear-gradient(135deg, #9ed8ff, #44bfe8);
}

:root[data-theme="dark"] .route-toggle {
  color: var(--ink);
  background: #0f2a3a;
  border-color: var(--subtle);
}

:root[data-theme="dark"] .route-toggle.is-active {
  color: #041520;
  background: linear-gradient(135deg, #9ed8ff, #44bfe8);
}

:root[data-theme="dark"] .compact-route-status strong,
:root[data-theme="dark"] .compact-route-status small,
:root[data-theme="dark"] .schedule-control-status {
  color: var(--muted);
}

:root[data-theme="dark"] .schedule-grid thead th,
:root[data-theme="dark"] .schedule-grid tbody th,
:root[data-theme="dark"] .schedule-grid td,
:root[data-theme="dark"] .trip-pair strong,
:root[data-theme="dark"] .after-stop-box strong,
:root[data-theme="dark"] .schedule-board-head strong,
:root[data-theme="dark"] .schedule-time-indicator strong,
:root[data-theme="dark"] .schedule-line-indicator strong {
  color: var(--ink);
}

:root[data-theme="dark"] .trip-pair strong.accent,
:root[data-theme="dark"] .next-station-box strong {
  color: var(--map-current);
}

:root[data-theme="dark"] .layout-item,
:root[data-theme="dark"] .next-station-box,
:root[data-theme="dark"] .after-stop-box {
  color: var(--ink);
  background: #0f2a3a;
  border-color: var(--subtle);
}

@media (min-width: 900px) {
  .app-shell {
    width: min(calc(100% - 2.5rem), 900px);
    padding-bottom: calc(6.25rem + env(safe-area-inset-bottom));
  }

  .app-header {
    border-right: 1px solid rgba(16, 33, 45, 0.08);
    border-left: 1px solid rgba(16, 33, 45, 0.08);
  }

  .app-main {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    align-content: start;
    grid-auto-rows: auto;
    width: min(100%, 860px);
    max-width: 860px;
    margin-inline: auto;
    padding: 1.25rem 1.5rem calc(6.5rem + env(safe-area-inset-bottom));
    gap: 1.1rem;
  }

  .home-welcome,
  .app-main > .notice-card,
  .announcement-stack,
  .home-primary,
  .home-result-slot,
  .home-secondary,
  .home-install-slot,
  .app-footer {
    grid-column: 1 / -1;
    width: min(100%, 760px);
    margin-inline: auto;
  }

  .home-welcome .home-help-button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .home-welcome {
    grid-template-columns: 3.5rem minmax(0, 1fr);
  }

  .routes-view,
  .stations-view,
  .saved-view {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(22rem, 0.82fr);
    gap: 1rem;
    align-items: start;
  }

  .settings-view {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    width: min(100%, 760px);
    margin-inline: auto;
  }

  .settings-view > * {
    min-width: 0;
  }

  .admin-panel {
    grid-column: 1 / -1;
  }

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

  .route-example-main {
    width: min(100%, 980px);
    margin-inline: auto;
    padding: 1.6rem;
  }

  .route-example-content {
    grid-template-columns: minmax(0, 1.35fr) minmax(20rem, 0.78fr);
    gap: 1.6rem;
  }

  .route-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .bottom-nav {
    right: auto;
    bottom: 1.25rem;
    left: 50%;
    width: min(calc(100% - 2rem), 720px);
    border: 1px solid rgba(16, 33, 45, 0.1);
    border-radius: 12px;
  }
}

@media (min-width: 768px) and (max-width: 899px) {
  .app-shell {
    width: min(calc(100% - 2.5rem), 900px);
    padding-bottom: calc(6.25rem + env(safe-area-inset-bottom));
  }

  .app-main {
    width: min(100%, 860px);
    max-width: 860px;
    margin-inline: auto;
    padding: 1.15rem 1.25rem calc(6.5rem + env(safe-area-inset-bottom));
  }

  .home-welcome,
  .home-primary,
  .home-result-slot,
  .home-secondary,
  .home-install-slot,
  .settings-view,
  .app-footer {
    width: min(100%, 760px);
    margin-inline: auto;
  }

  .settings-view {
    grid-template-columns: minmax(0, 1fr);
  }

  .route-example-main,
  .schedule-image-page,
  .stations-view,
  .routes-view,
  .saved-view {
    width: min(100%, 900px);
    margin-inline: auto;
  }

  .settings-view {
    width: min(100%, 760px);
    margin-inline: auto;
  }

  .bottom-nav {
    width: min(calc(100% - 2rem), 720px);
  }
}

@media (min-width: 1200px) {
  .app-shell {
    width: min(calc(100% - 3rem), 900px);
  }

  .route-example-view,
  .route-example-main {
    width: min(100%, 980px);
    margin-inline: auto;
  }

  .schedule-image-page,
  .stations-view,
  .routes-view,
  .saved-view {
    width: min(100%, 1080px);
    margin-inline: auto;
  }
}

@media (max-width: 520px) {
  .route-titlebar {
    align-items: start;
    gap: 0.65rem;
  }

  .route-titlebar h2 {
    font-size: 1.02rem;
  }

  .route-titlebar p,
  .route-orientation,
  .train-status-card span {
    font-size: 0.72rem;
  }

  .train-status-card {
    min-height: 2.35rem;
    padding: 0.46rem 0.55rem;
  }

  .route-toggle-row {
    gap: 0.35rem;
  }

  .route-toggle {
    min-height: 2.35rem;
    font-size: 0.72rem;
  }

  .route-control-label {
    margin-top: 0.75rem;
  }

  .route-schedule-controls {
    gap: 0.5rem;
    padding: 0.58rem;
  }

  .route-control-heading {
    align-items: flex-start;
  }

  .route-schedule-button {
    min-height: 2.15rem;
    padding: 0 0.5rem;
    font-size: 0.74rem;
  }

  .schedule-type-row {
    gap: 0.32rem;
  }

  .schedule-type-button {
    min-height: 2.25rem;
    padding: 0 0.28rem;
    font-size: 0.74rem;
  }

  .schedule-control-status,
  .compact-route-status {
    font-size: 0.76rem;
  }

  .route-trip-card,
  .route-stat {
    padding: 0.72rem;
  }
}

@media (max-width: 520px) {
  .station-pair-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .station-swap-button {
    position: static;
    justify-self: center;
    transform: none;
  }
}

@media (max-height: 760px) {
  body[data-launch-screen="auth"] .app-header {
    padding: calc(0.48rem + env(safe-area-inset-top)) 0.82rem 0.42rem;
  }

  body[data-launch-screen="auth"] .brand-mark {
    width: 2.25rem;
    height: 2.25rem;
  }

  body[data-launch-screen="auth"] .app-header .eyebrow {
    font-size: 0.6rem;
  }

  body[data-launch-screen="auth"] .app-header h1 {
    font-size: 1rem;
  }

  .auth-screen {
    padding: 0.55rem 0.65rem calc(0.65rem + env(safe-area-inset-bottom));
  }

  .auth-card {
    gap: 0.62rem;
    padding: 0.95rem;
    border-radius: 19px;
  }

  .auth-security-badge {
    width: 3rem;
    height: 3rem;
    box-shadow: 0 8px 18px rgba(4, 159, 209, 0.12);
  }

  .auth-badge-icon {
    width: 1.3rem;
    height: 1.3rem;
  }

  .auth-intro h2 {
    font-size: 1.55rem;
  }

  .auth-intro p {
    max-width: 20rem;
    font-size: 0.84rem;
    line-height: 1.25;
  }

  .auth-provider-btn,
  .guest-btn,
  .auth-submit {
    min-height: 2.8rem;
    border-radius: 12px;
  }

  .auth-tabs button {
    min-height: 2.45rem;
    font-size: 0.92rem;
  }

  .auth-form input[type="email"],
  .auth-form input[type="password"],
  .auth-form input[type="text"] {
    min-height: 2.75rem;
    border-radius: 11px;
    font-size: 0.95rem;
  }

  .password-field {
    border-radius: 11px;
  }

  .auth-divider {
    font-size: 0.76rem;
  }
}

@media (max-height: 680px) {
  body[data-launch-screen="auth"] .app-header {
    padding: calc(0.38rem + env(safe-area-inset-top)) 0.75rem 0.32rem;
  }

  body[data-launch-screen="auth"] .brand-mark {
    width: 2rem;
    height: 2rem;
  }

  body[data-launch-screen="auth"] .app-header .eyebrow {
    font-size: 0.56rem;
  }

  body[data-launch-screen="auth"] .app-header h1 {
    font-size: 0.95rem;
  }

  .auth-screen {
    padding: 0.45rem 0.58rem calc(0.55rem + env(safe-area-inset-bottom));
  }

  .auth-card {
    gap: 0.5rem;
    padding: 0.78rem;
    border-radius: 17px;
    box-shadow: 0 12px 30px rgba(9, 35, 54, 0.1);
  }

  .auth-security-badge,
  .auth-helper {
    display: none;
  }

  .auth-intro {
    gap: 0.22rem;
  }

  .auth-intro h2 {
    font-size: 1.38rem;
  }

  .auth-intro p {
    font-size: 0.8rem;
    line-height: 1.2;
  }

  .auth-provider-btn,
  .guest-btn,
  .auth-submit {
    min-height: 2.75rem;
  }

  .auth-tabs button {
    min-height: 2.3rem;
  }

  .auth-form {
    gap: 0.46rem;
  }

  .auth-form .input-label {
    font-size: 0.82rem;
  }

  .auth-form input[type="email"],
  .auth-form input[type="password"],
  .auth-form input[type="text"] {
    min-height: 2.65rem;
    padding: 0 0.8rem;
  }

  .auth-link-row {
    gap: 0.25rem 0.7rem;
  }

  .auth-link-row .link-button {
    font-size: 0.82rem;
  }
}

@media (max-width: 380px) {
  .countdown-lockup,
  .journey-grid,
  .quick-grid,
  .station-meta-grid,
  .db-grid,
  .route-toggle-row,
  .route-stat-grid,
  .route-legend,
  .setting-row,
  .schedule-row {
    grid-template-columns: 1fr;
  }

  .day-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .arrival-time {
    justify-self: start;
    text-align: left;
  }

  .route-stop {
    grid-template-columns: 1.8rem minmax(0, 1fr);
  }

  .platform-tag {
    grid-column: 2;
    justify-self: start;
  }

  .route-titlebar {
    display: grid;
  }

  .intercept-summary {
    grid-template-columns: 1fr;
  }

  .train-status-card {
    width: 100%;
  }

  .example-route-stop {
    grid-template-columns: 2.7rem 2.25rem minmax(0, 1fr);
    gap: 0.46rem;
  }

  .moving-train-indicator {
    left: 3.825rem; /* 2.7 + (2.25/2) */
  }

  .intercept-status {
    left: 4.45rem;
    max-width: calc(100% - 4.8rem);
  }

  .route-line-card {
    padding: 0.35rem 0;
  }

  .example-name {
    font-size: 0.92rem;
  }
}
