:root {
  --brand-primary: #e11d48;
  --brand-primary-dark: #9f1239;
  --brand-glow: rgba(225, 29, 72, 0.14);
  --accent-blue: #2563eb;
  --bg-page: #f4f6fb;
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --bg-segmented: rgba(15, 23, 42, 0.06);
  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-glass: rgba(255, 255, 255, 0.65);
  --live-green: #16a34a;
  --shadow-soft: 0 10px 28px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-floating: 0 14px 34px rgba(15, 23, 42, 0.14), 0 3px 10px rgba(15, 23, 42, 0.06);
  --shadow-tab: 0 14px 36px rgba(15, 23, 42, 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg-page: #090d16;
  --bg-card: rgba(20, 27, 41, 0.88);
  --bg-elevated: #1e293b;
  --bg-glass: rgba(15, 23, 42, 0.84);
  --bg-segmented: rgba(255, 255, 255, 0.09);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border-subtle: rgba(255, 255, 255, 0.1);
  --border-glass: rgba(255, 255, 255, 0.12);
  --live-green: #22c55e;
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.42);
  --shadow-floating: 0 16px 38px rgba(0, 0, 0, 0.55);
  --shadow-tab: 0 14px 36px rgba(0, 0, 0, 0.68);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-page);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.app-shell {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  position: relative;
  padding-top: max(12px, var(--safe-top));
  padding-bottom: calc(104px + var(--safe-bottom));
  background: radial-gradient(circle at 50% 0%, var(--brand-glow) 0%, transparent 45%), var(--bg-page);
}

/* When installed on iPhone Home Screen (Standalone PWA), reserve space for iOS Status Bar / Dynamic Island */
@media all and (display-mode: standalone) {
  .app-shell {
    padding-top: max(50px, env(safe-area-inset-top, 50px));
    padding-bottom: calc(108px + env(safe-area-inset-bottom, 20px));
  }
}

html.ios-standalone .app-shell {
  padding-top: max(50px, env(safe-area-inset-top, 50px));
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 20px));
}

/* Block any external host badge (e.g. "Powered by Netlify" floating pill) from covering the bottom navigation bar */
body > a[href*="netlify.com"],
body > div:not(#app-shell),
iframe[src*="netlify"],
[data-netlify-deploy-notifications],
.netlify-identity-button {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
  z-index: -1 !important;
}

.hidden {
  display: none !important;
}

/* ==========================================
   COMMON iOS 18 GLASS & KICKER TOKENS
   ========================================== */
.app-kicker-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.1);
  padding: 3px 8px;
  border-radius: 999px;
  margin-bottom: 4px;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

/* ==========================================
   LIVE ACTIVITY FLOATING BANNER (DYNAMIC ISLAND)
   ========================================== */
.live-activity-bar {
  position: sticky;
  top: calc(8px + var(--safe-top));
  z-index: 150;
  margin: 8px 14px 4px;
  padding: 10px 14px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.96) 0%, rgba(49, 11, 21, 0.96) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 12px 28px rgba(225, 29, 72, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.live-activity-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.live-pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.25);
  animation: livePulse 1.6s infinite;
  flex-shrink: 0;
}

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

.live-activity-info {
  min-width: 0;
}

.live-activity-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-activity-sub {
  font-size: 11px;
  color: #fda4af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-activity-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.live-countdown {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 800;
  color: #4ade80;
}

.live-close-btn {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   VIEWS & SCREENS
   ========================================== */
.tab-view {
  display: none;
}

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

.screen {
  display: none;
}

.screen.active {
  display: block;
  animation: fadeIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}

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

/* ==========================================
   TAB 1A: HERO HEADER, QUICK PLACES & OPERATOR CARDS
   ========================================== */
.hero-header {
  padding: 14px 16px 8px;
}

.hero-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.greeting-title {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.15;
}

.header-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.theme-quick-btn,
.lang-quick-btn {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  border-radius: 999px;
  height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}

.theme-quick-btn:active,
.lang-quick-btn:active {
  transform: scale(0.94);
}

/* Search Box & Quick Places (Casa / Trabajo / Favoritos) */
.search-and-favs {
  margin-bottom: 12px;
}

.glass-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  border-radius: 16px;
  padding: 10px 14px;
  gap: 9px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.glass-search-box:focus-within {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(225, 29, 72, 0.14);
}

.search-icon {
  font-size: 15px;
  opacity: 0.75;
}

.search-box input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

.search-clear-btn {
  border: none;
  background: var(--bg-segmented);
  color: var(--text-secondary);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 11px;
  cursor: pointer;
}

/* Visual Quick Places Bar (Casa, Trabajo, Favoritos Dropdown) */
.quick-places-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.quick-place-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
  transition: all 0.16s ease;
  min-width: 0;
}

.quick-place-btn:active {
  transform: scale(0.97);
}

.quick-place-btn.active {
  border-color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.07);
}

.qp-icon {
  font-size: 17px;
  flex-shrink: 0;
}

.qp-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.qp-text strong {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.qp-text small {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favorites-drawer {
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease;
  max-height: 60px;
  opacity: 1;
  margin-top: 8px;
}

.favorites-drawer.collapsed {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  pointer-events: none;
}

.favorites-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 2px 1px;
  scrollbar-width: none;
}

.favorites-strip::-webkit-scrollbar {
  display: none;
}

.fav-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
}

/* Visual Operator Cards (Metro, FGC, TRAM, Rodalies) */
.operator-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.operator-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 16px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.operator-card .op-card-icon {
  font-size: 20px;
  line-height: 1;
  margin-bottom: 2px;
}

.operator-card .op-card-name {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.operator-card .op-card-meta {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
}

.operator-card.active {
  border-color: var(--brand-primary);
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.12) 0%, var(--bg-elevated) 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(225, 29, 72, 0.16);
}

.operator-card.active .op-card-meta {
  color: var(--brand-primary);
}

/* SMART COLLAPSIBLE LINE & DIRECTION SELECTOR CARD */
.smart-selector-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 12px;
  box-shadow: var(--shadow-soft);
  transition: all 0.22s ease;
}

.smart-selector-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.smart-sum-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.smart-sum-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.smart-sum-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-secondary);
}

.smart-sum-dir {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smart-collapse-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--brand-primary);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.smart-selector-body {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.smart-selector-body.collapsed {
  display: none;
}

/* Line Pill Grid */
.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-segmented);
  padding: 7px;
  border-radius: 16px;
}

.line-pill-btn {
  flex: 1 0 auto;
  min-width: 44px;
  border: 2px solid transparent;
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
  text-align: center;
}

.line-pill-btn.active {
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border-color: var(--text-main);
}

.direction-block {
  margin-top: 10px;
}

.direction-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.section-label-sm {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}

.segmented-control {
  display: flex;
  background: var(--bg-segmented);
  padding: 4px;
  border-radius: 14px;
  gap: 4px;
}

.seg-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 11px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* ==========================================
   STATION TIMELINE CARD
   ========================================== */
.stations-section {
  padding: 6px 16px 24px;
}

.stations-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-label {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 0;
}

.stations-count-pill {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-secondary);
  background: var(--bg-segmented);
  padding: 3px 9px;
  border-radius: 999px;
}

.timeline-container {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 6px 12px 6px 12px;
  box-shadow: var(--shadow-soft);
}

.station-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 6px 11px 2px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 0.15s ease, transform 0.12s ease;
  position: relative;
}

.station-row:last-child {
  border-bottom: none;
}

.station-row:active {
  background: var(--bg-segmented);
  border-radius: 10px;
}

.station-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.timeline-node-wrap {
  position: relative;
  width: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
}

.timeline-line-bar {
  position: absolute;
  top: -12px;
  bottom: -12px;
  left: 5px;
  width: 6px;
  background-color: var(--line-color, #9B3697);
}

.station-row:first-child .timeline-line-bar {
  top: 50%;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.station-row:last-child .timeline-line-bar {
  bottom: 50%;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.timeline-tick {
  position: relative;
  z-index: 2;
  width: 12px;
  height: 12px;
  margin-left: 0;
  border-radius: 50%;
  background-color: #ffffff;
  border: 3px solid var(--line-color, #9B3697);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.station-name-text {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.station-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* Line Badges */
.line-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #ffffff;
  background: #64748b;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.14);
}

.line-badge.round-badge {
  border-radius: 50%;
  width: 22px;
  min-width: 22px;
  padding: 0;
}

.line-badge-lg {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}

/* ==========================================
   TAB 1B: STATION DETAIL & 2.5D TRAIN SCHEMATIC
   ========================================== */
#screen-station-detail {
  padding: 12px 16px 26px;
}

.detail-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.circle-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: var(--shadow-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.detail-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill-action-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
  transition: transform 0.14s ease;
}

.pill-action-btn:active {
  transform: scale(0.95);
}

.station-header-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.detail-station-name {
  font-size: 21px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.detail-direction-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

/* 2.5D Interactive Train Consist Card */
.train-diagram-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 14px 12px 12px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.selected-door-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.12) 0%, rgba(225, 29, 72, 0.04) 100%);
  border: 1.5px solid rgba(225, 29, 72, 0.28);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.banner-left-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.banner-type {
  font-size: 11px;
  font-weight: 900;
  color: var(--brand-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.banner-car-door {
  font-size: 17px;
  font-weight: 900;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.banner-visual-badge {
  font-size: 11px;
  font-weight: 800;
  background: var(--brand-primary);
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Platform Orientation Pills */
.orientation-bar {
  display: flex;
  background: var(--bg-segmented);
  padding: 3px;
  border-radius: 999px;
  gap: 4px;
  margin-bottom: 12px;
}

.orientation-pill {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 800;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s ease;
}

.orientation-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.3);
}

/* 2.5D Train Consist Visuals */
.train-consist-wrapper {
  --car-min-w: 74px;
  position: relative;
  padding: 8px 4px 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  scroll-padding: 0 16px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.train-consist-wrapper::-webkit-scrollbar {
  display: none;
}

/* Consist, rail and arrows share the same width so they scroll together */
.train-consist-wrapper > * {
  min-width: calc(var(--cars-count, 5) * var(--car-min-w) + (var(--cars-count, 5) - 1) * 6px);
}

/* Soft fade on the edges only when there are hidden cars */
.train-consist-wrapper.is-scrollable {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
}

.train-consist-wrapper.is-scrollable.at-start {
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 26px), transparent 100%);
}

.train-consist-wrapper.is-scrollable.at-end {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 26px, #000 100%);
}

.train-scroll-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.train-scroll-hint.hidden {
  display: none;
}

.train-scroll-dots {
  display: inline-flex;
  gap: 3px;
}

.train-scroll-dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  transition: all 0.2s ease;
}

.train-scroll-dots span.on {
  width: 14px;
  background: var(--brand-primary);
}

.train-consist {
  display: grid;
  grid-template-columns: repeat(var(--cars-count, 5), minmax(var(--car-min-w, 74px), 1fr));
  gap: 6px;
  align-items: stretch;
}

.train-car {
  scroll-snap-align: center;
  min-width: 0;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 45%, #cbd5e1 100%);
  border: 2px solid #94a3b8;
  border-bottom: 4px solid #64748b;
  border-radius: 9px;
  padding: 5px 4px 6px;
  position: relative;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .train-car {
  background: linear-gradient(180deg, #334155 0%, #1e293b 60%, #0f172a 100%);
  border-color: #64748b;
  border-bottom-color: #475569;
}

.train-car.first-moving-left {
  border-top-left-radius: 18px;
  border-bottom-left-radius: 14px;
}

.train-car.last-moving-right {
  border-top-right-radius: 18px;
  border-bottom-right-radius: 14px;
}

.train-car.active-car {
  border-color: var(--brand-primary);
  border-bottom-color: var(--brand-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(225, 29, 72, 0.28);
}

.car-header-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
  margin-bottom: 4px;
  padding: 0 2px;
  white-space: nowrap;
}

.car-number-label {
  font-size: 10px;
  font-weight: 900;
  color: #1e293b;
}

[data-theme="dark"] .car-number-label {
  color: #f8fafc;
}

.car-occ-mini {
  font-size: 8.5px;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 4px;
  color: #ffffff;
  background: #16a34a;
}

.car-occ-mini.medium {
  background: #ea8c2f;
}

.car-occ-mini.high {
  background: #9333ea;
}

.car-doors-grid {
  display: grid;
  grid-template-columns: repeat(var(--doors-per-car, 4), 1fr);
  gap: 3px;
}

.car-door {
  height: 26px;
  border-radius: 4px;
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  padding: 0;
  cursor: pointer;
  transition: all 0.16s ease;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 8px;
  font-weight: 800;
}

.car-door.has-exit {
  background: linear-gradient(180deg, #fb7185 0%, #e11d48 100%);
  color: #ffffff;
  opacity: 0.85;
}

.car-door.selected-door {
  background: linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  color: #ffffff;
  opacity: 1;
  transform: scaleY(1.16) scaleX(1.06);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.85);
  z-index: 3;
  border-color: #ffffff;
}

.train-track-rail {
  height: 5px;
  margin: 4px 2px 0;
  border-radius: 3px;
  background: repeating-linear-gradient(
    90deg,
    #64748b 0px,
    #64748b 8px,
    transparent 8px,
    transparent 14px
  );
  opacity: 0.55;
}

.train-arrows-row {
  display: grid;
  grid-template-columns: repeat(var(--cars-count, 5), minmax(var(--car-min-w, 74px), 1fr));
  gap: 6px;
  margin-top: 6px;
  min-height: 28px;
}

.car-arrow-slot {
  display: flex;
  justify-content: center;
  align-items: center;
}

.red-up-arrow {
  width: 100%;
  max-width: 44px;
  height: 24px;
  border-radius: 7px;
  background: var(--bg-segmented);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s ease;
}

.red-up-arrow.selected {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(225, 29, 72, 0.4);
}

.door-opening-indicator {
  text-align: center;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ==========================================
   GLASS ACCORDIONS (EXITS, ZONES, ATM FARES)
   ========================================== */
.glass-accordion {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.glass-accordion-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  user-select: none;
}

.glass-accordion-summary::-webkit-details-marker {
  display: none;
}

.acc-sum-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.acc-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.acc-title {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.acc-sub {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
}

.acc-chevron {
  font-size: 14px;
  font-weight: 900;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
}

.glass-accordion[open] .acc-chevron {
  transform: rotate(180deg);
}

.glass-accordion-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}

/* Exits, Transfers & Elevators Cards */
.exits-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exit-card {
  padding: 11px 12px;
  border-radius: 15px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.16s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.exit-card.selected {
  border-color: var(--brand-primary);
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.08) 0%, var(--bg-elevated) 100%);
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.12);
}

.exit-card-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 2px;
}

.exit-card-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 6px;
}

.exit-badges-row {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.facility-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  height: 20px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-main);
  background: var(--bg-card);
}

.exit-car-door-text {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.1);
  padding: 5px 9px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ==========================================
   RELEVANT DEPARTURES & CAR OCCUPANCY WIDGET
   ========================================== */
.relevant-departures-card {
  border-radius: 22px;
  padding: 15px;
  background: linear-gradient(160deg, #be123c 0%, #4c0519 62%, #1f030b 100%);
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(159, 18, 57, 0.28);
}

.rel-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.rel-card-title {
  font-size: 15.5px;
  font-weight: 800;
}

.rel-refresh-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
}

.rel-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.rel-line-dest {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rel-dest-title {
  font-size: 14.5px;
  font-weight: 800;
}

.rel-station-sub {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
}

.rel-times {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.rel-countdown {
  font-size: 17px;
  font-weight: 900;
  color: #4ade80;
}

.rel-next-min {
  font-size: 14px;
  font-weight: 700;
  color: #86efac;
}

.occupancy-section {
  margin-bottom: 12px;
}

.occupancy-pills-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.occ-pill {
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: #ffffff;
  background: #ea8c2f;
}

.occ-pill.low {
  background: #16a34a;
}

.occ-pill.medium {
  background: #ea8c2f;
}

.occ-pill.high {
  background: #9333ea;
}

.occ-avg {
  font-size: 11.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  margin-left: 4px;
}

.occupancy-caption {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.68);
  margin-top: 4px;
}

.rel-card-footer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.live-pin-btn, .timetable-toggle-btn {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.timetable-toggle-btn {
  background: rgba(0, 0, 0, 0.28);
}

.next-trains-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 10px;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.next-trains-strip::-webkit-scrollbar {
  display: none;
}

.next-train-chip {
  background: rgba(0, 0, 0, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  padding: 5px 9px;
  display: flex;
  align-items: baseline;
  gap: 5px;
  white-space: nowrap;
}

.next-train-hhmm {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.next-train-in {
  font-size: 11.5px;
  font-weight: 700;
  color: #4ade80;
}

/* Full Daily Timetable Card */
.full-timetable-card {
  margin-top: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.timetable-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.timetable-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.timetable-badge {
  font-size: 11px;
  font-weight: 800;
  background: rgba(225, 29, 72, 0.12);
  color: var(--brand-primary);
  padding: 3px 8px;
  border-radius: 999px;
}

.timetable-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0 0 10px;
}

.timetable-hours-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
}

.timetable-hour-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
}

.timetable-hour-label {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--brand-primary);
  min-width: 32px;
  padding-top: 2px;
}

.timetable-mins-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.timetable-min-pill {
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-main);
}

.timetable-min-pill.upcoming {
  background: #16a34a;
  color: #ffffff;
}

/* ==========================================
   TAB 2: IMMERSIVE FULL-SCREEN REAL-TIME MAP
   ========================================== */
#view-map {
  padding: 0;
  position: relative;
}

.map-immersive-stage {
  position: relative;
  width: 100%;
  height: calc(100dvh - 82px - var(--safe-top) - var(--safe-bottom));
  min-height: 580px;
  overflow: hidden;
  border-radius: 0 0 24px 24px;
}

.map-canvas-wrapper {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.catalunya-live-map {
  width: 100%;
  height: 100%;
}

/* Dark Mode Map Cartography Filter */
[data-theme="dark"] #catalunya-live-map .leaflet-tile-pane {
  filter: invert(100%) hue-rotate(180deg) brightness(92%) contrast(90%);
}

/* Move Leaflet Zoom Controls to Right Middle so they don't collide with Floating Header or Bottom Sheet */
#catalunya-live-map .leaflet-top.leaflet-left {
  top: 116px;
  left: auto;
  right: 10px;
}

/* Smooth 1-second linear gliding for moving train markers on the map */
.leaflet-marker-pane .custom-train-div-icon {
  transition: transform 0.92s linear;
}

/* FLOATING TOP GLASS CONTROLS OVER MAP */
.map-top-controls {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 450;
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

.map-top-controls > * {
  pointer-events: auto;
}

.map-floating-pill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 8px 12px;
  box-shadow: var(--shadow-floating);
}

.map-pill-left {
  min-width: 0;
  flex: 1;
}

.map-main-title {
  font-size: 16.5px;
  font-weight: 900;
  margin: 0;
  letter-spacing: -0.02em;
}

.map-live-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-filters-toggle-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}

.map-filters-toggle-btn.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

.map-icon-circle {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 14px;
}

/* Network Filter Pills Floating Strip */
.map-network-pills {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.map-network-pills::-webkit-scrollbar {
  display: none;
}

.map-net-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text-main);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.map-net-pill.active {
  background: var(--brand-primary);
  color: #ffffff;
  border-color: var(--brand-primary);
}

/* Collapsible Map Filters Drawer */
.map-filters-drawer {
  background: var(--bg-glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 10px;
  box-shadow: var(--shadow-floating);
  animation: fadeIn 0.18s ease-out;
}

.map-layer-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.map-select-control {
  flex: 1;
  min-width: 130px;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
}

.map-line-select {
  flex: 0 1 115px;
  min-width: 95px;
}

.map-zone-filter-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.map-zone-filter-btn.active {
  background: rgba(22, 163, 74, 0.16);
  color: var(--live-green);
  border-color: var(--live-green);
}

.map-drawer-section-label {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.map-region-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-region-strip::-webkit-scrollbar {
  display: none;
}

/* Live Train Markers on Map */
.live-train-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 900;
  color: #ffffff;
  border: 1.5px solid #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.42);
  white-space: nowrap;
  cursor: pointer;
}

.live-train-marker.selected-train {
  transform: scale(1.18);
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.85), 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 999 !important;
}

/* FLOATING COLLAPSIBLE BOTTOM SHEET ON MAP */
.map-selection-card {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 450;
  background: var(--bg-glass);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 6px 12px 10px;
  box-shadow: var(--shadow-floating);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.bottom-sheet-handle-bar {
  width: 100%;
  border: none;
  background: transparent;
  padding: 2px 0 6px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.sheet-grabber-pill {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--text-muted);
  opacity: 0.45;
}

.map-sheet-collapsible-body.collapsed {
  display: none;
}

.map-sel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.map-sel-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 170px;
}

.map-sel-left > div {
  min-width: 0;
  flex: 1;
}

.map-sel-title {
  font-size: 14px;
  font-weight: 800;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-sel-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 1px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-sel-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.map-follow-btn {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-size: 11px;
  padding: 5px 9px;
}

.map-follow-btn.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.map-open-btn {
  background: var(--brand-primary);
  color: #ffffff;
  border: none;
  flex-shrink: 0;
  font-size: 11px;
  padding: 6px 10px;
}

.map-sel-telemetry {
  margin-bottom: 7px;
  padding: 7px 9px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 11.5px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.telemetry-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.gps-coords-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-weight: 800;
  color: var(--live-green);
  background: rgba(22, 163, 74, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
}

.gps-source-tag {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.telemetry-route-row {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
}

.user-gps-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563eb;
  border: 2.5px solid #ffffff;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.28), 0 2px 6px rgba(0, 0, 0, 0.45);
  animation: gpsPulseRing 2s infinite ease-out;
}

@keyframes gpsPulseRing {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.55), 0 2px 6px rgba(0, 0, 0, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0), 0 2px 6px rgba(0, 0, 0, 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 2px 6px rgba(0, 0, 0, 0.45); }
}

.map-sel-times {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  scrollbar-width: none;
}

.map-sel-times::-webkit-scrollbar {
  display: none;
}

.map-time-pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px 7px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

.live-pin-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4ade80;
}

/* ==========================================
   TAB 2B: MULTI-MODAL ROUTE CALCULATOR (RUTAS)
   ========================================== */
.routes-container {
  padding: 14px 16px 24px;
}

.map-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* Visual Quick Route Presets Row */
.route-quick-presets-row {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 8px;
  padding-bottom: 2px;
}

.route-quick-presets-row::-webkit-scrollbar {
  display: none;
}

.route-preset-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.04);
  transition: all 0.15s ease;
}

.route-preset-pill.active,
.route-preset-pill:active {
  background: rgba(225, 29, 72, 0.1);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.saved-routes-drawer {
  margin-bottom: 8px;
}

.saved-routes-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.saved-routes-strip::-webkit-scrollbar {
  display: none;
}

.saved-route-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.route-planner-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 22px;
  padding: 13px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-soft);
}

.route-inputs-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.route-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.route-dot {
  font-size: 14px;
  flex-shrink: 0;
}

.route-autocomplete-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.route-endpoint-input {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 13px;
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}

.route-endpoint-input:focus {
  border-color: var(--brand-primary);
}

.route-gps-mini-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.route-swap-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.route-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.route-swap-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.route-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  max-height: 210px;
  overflow-y: auto;
  z-index: 200;
}

.route-sug-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}

.route-sug-item:last-child {
  border-bottom: none;
}

.route-sug-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
}

.route-sug-sub {
  font-size: 11px;
  color: var(--text-secondary);
}

.route-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.route-time-picker-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: var(--text-secondary);
}

.route-time-input {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 12px;
  font-weight: 700;
}

.route-now-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.route-main-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.route-fav-save-btn {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.route-calc-primary-btn {
  border: none;
  background: var(--brand-primary);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.3);
}

/* Route Option Cards (Citymapper style) */
.route-options-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.route-options-tabs::-webkit-scrollbar {
  display: none;
}

.route-opt-tab {
  flex: 1;
  min-width: 148px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 16px;
  padding: 9px 11px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: all 0.16s ease;
}

.route-opt-tab.active {
  border-color: var(--brand-primary);
  background: linear-gradient(180deg, rgba(225, 29, 72, 0.1) 0%, var(--bg-elevated) 100%);
  transform: translateY(-1px);
}

.route-opt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 900;
  margin-bottom: 3px;
  white-space: nowrap;
}

.route-opt-tag {
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #ffffff;
  white-space: nowrap;
}

.route-opt-sub {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* Route Summary & Itinerary */
.route-summary-banner {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-soft);
}

.route-sum-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.route-sum-duration {
  font-size: 24px;
  font-weight: 900;
  color: var(--brand-primary);
}

.route-sum-clock {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-main);
}

.last-train-alert {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 800;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  margin-bottom: 10px;
  width: 100%;
}

[data-theme="dark"] .last-train-alert {
  color: #fbbf24;
}

.route-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.route-map-btn {
  flex: 1;
  border: 1.5px solid var(--brand-primary);
  background: rgba(225, 29, 72, 0.08);
  color: var(--brand-primary);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.route-copilot-btn {
  flex: 1;
  border: none;
  background: #16a34a;
  color: #ffffff;
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.25);
}

.atm-zone-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
}

.atm-prices-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.atm-price-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 7px 5px;
  text-align: center;
}

.atm-price-label {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 700;
}

.atm-price-val {
  font-size: 13px;
  font-weight: 900;
  color: var(--text-main);
  margin-top: 2px;
}

.route-steps-timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.route-leg-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-left: 5px solid var(--brand-primary);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.route-leg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.route-leg-times {
  font-size: 12.5px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--live-green);
}

.route-leg-stations {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 6px;
}

.route-car-tip-box {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.11) 0%, rgba(225, 29, 72, 0.04) 100%);
  border: 1px solid rgba(225, 29, 72, 0.25);
  color: var(--text-main);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-top: 7px;
}

.route-transfer-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-subtle);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.route-stops-details {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 6px 10px;
}

.route-stops-details summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text-main);
}

/* ==========================================
   TAB 3: NEARBY DEPARTURES (SALIDAS CERCANAS)
   ========================================== */
#view-departures {
  padding: 14px 16px 24px;
}

.dep-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dep-main-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

.dep-refresh-circle {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--brand-primary);
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dep-filters-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.dep-filter-pill {
  border: none;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #ffffff;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.24);
}

.dep-gps-pill {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.compact-accordion {
  margin-bottom: 12px;
}

.location-zone-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.zone-chip {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.zone-chip.active {
  background: var(--text-main);
  color: var(--bg-page);
  border-color: var(--text-main);
}

.departures-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stop-group-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 13px 14px;
  box-shadow: var(--shadow-soft);
}

.stop-header-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
}

.stop-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
}

.stop-distance {
  font-size: 12px;
  font-weight: 800;
  color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.1);
  padding: 2px 8px;
  border-radius: 999px;
}

.stop-dep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 0;
  gap: 10px;
}

.stop-dep-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  flex: 1 1 auto;
}

.stop-dep-left > div {
  min-width: 0;
  flex: 1 1 auto;
}

.stop-dep-left .occupancy-pills-row {
  flex-wrap: wrap;
}

.stop-dep-dest {
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stop-dep-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}

.dep-time-live {
  font-size: 15px;
  font-weight: 800;
  color: var(--live-green);
}

.dep-time-countdown {
  font-size: 12px;
  font-weight: 800;
  color: var(--live-green);
  background: rgba(34, 197, 94, 0.12);
  padding: 2px 7px;
  border-radius: 999px;
}

.dep-time-next {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ==========================================
   TAB 4: PROFILE & SETTINGS
   ========================================== */
.profile-container {
  padding: 14px 16px 24px;
}

.profile-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0 14px;
}

.settings-card {
  background: var(--bg-card);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 15px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-soft);
}

.settings-card-title {
  font-size: 15.5px;
  font-weight: 800;
  margin: 0 0 10px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  gap: 10px;
  font-size: 13.5px;
  font-weight: 700;
}

.setting-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.setting-input {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13.5px;
  font-weight: 700;
  width: 140px;
  text-align: right;
}

.mini-segmented {
  display: flex;
  background: var(--bg-segmented);
  padding: 3px;
  border-radius: 999px;
}

.mini-seg-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.mini-seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.profile-favs-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.profile-fav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13.5px;
}

.profile-fav-remove {
  border: none;
  background: transparent;
  color: var(--brand-primary);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.ios-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.ios-app-icon-preview {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.pwa-status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  color: var(--live-green);
  background: rgba(22, 163, 74, 0.12);
  padding: 3px 8px;
  border-radius: 999px;
}

.ios-steps-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.license-text {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================
   CLOUD ACCOUNT & PERSONAL LOCATIONS CARDS
   ========================================== */
.account-header-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  border-radius: 999px;
  height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.account-header-pill:active {
  transform: scale(0.95);
}

.account-active-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.12) 0%, rgba(37, 99, 235, 0.08) 100%);
  border: 1px solid rgba(225, 29, 72, 0.25);
  margin-bottom: 10px;
}

.account-banner-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.account-avatar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1.5px solid var(--brand-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  flex-shrink: 0;
}

.account-banner-name {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-main);
}

.account-banner-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--live-green);
}

.account-share-pill {
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.saved-accounts-wrap {
  margin-bottom: 10px;
}

.saved-accounts-label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.saved-accounts-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}

.saved-accounts-strip::-webkit-scrollbar {
  display: none;
}

.saved-acc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.saved-acc-chip.active {
  border-color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.1);
  color: var(--brand-primary);
}

.account-form-accordion {
  margin-bottom: 0;
}

.account-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.account-field label,
.personal-loc-field label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.account-input {
  width: 100%;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 11px;
  padding: 8px 10px;
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
}

.account-input:focus {
  border-color: var(--brand-primary);
}

.avatar-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.avatar-picker-label {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--text-secondary);
}

.avatar-pills {
  display: flex;
  gap: 5px;
}

.avatar-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.avatar-pill.active {
  border-color: var(--brand-primary);
  background: rgba(225, 29, 72, 0.14);
  transform: scale(1.08);
}

.account-actions-row {
  display: flex;
  gap: 8px;
}

.account-btn-secondary {
  flex: 1;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: 12px;
  padding: 9px 10px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}

.account-btn-primary {
  flex: 1;
  border: none;
  background: var(--brand-primary);
  color: #ffffff;
  border-radius: 12px;
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.28);
}

.account-feedback-msg {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(22, 163, 74, 0.14);
  color: var(--live-green);
}

.account-feedback-msg.error {
  background: rgba(225, 29, 72, 0.14);
  color: var(--brand-primary);
}

.personal-loc-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ==========================================
   WELCOME / ONBOARDING MODAL (GUEST OR ACCOUNT)
   ========================================== */
.welcome-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  background: rgba(9, 13, 22, 0.72);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

.welcome-modal-backdrop.hidden {
  display: none !important;
}

.welcome-modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 26px;
  padding: 20px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: modalFadeUp 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeUp {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.welcome-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.welcome-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.28);
}

.welcome-modal-title {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.welcome-modal-sub {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-secondary);
}

.welcome-guest-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border-radius: 16px;
  border: 1.5px solid rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(16, 185, 129, 0.1));
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.welcome-guest-btn:active {
  transform: scale(0.98);
}

.wg-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.wg-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.wg-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wg-text strong {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-main);
}

.wg-text small {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.wg-arrow {
  font-size: 13px;
  font-weight: 800;
  color: var(--brand-primary);
}

.welcome-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.welcome-account-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 13px;
}

.welcome-locations-details {
  margin-top: 9px;
  font-size: 12px;
  color: var(--text-secondary);
}

.welcome-locations-details summary {
  cursor: pointer;
  font-weight: 700;
  padding: 4px 0;
  color: var(--text-main);
}

.welcome-loc-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

/* ==========================================
   FLOATING iOS 18 GLASS BOTTOM TAB BAR
   ========================================== */
.bottom-tab-bar {
  position: fixed;
  bottom: max(16px, calc(12px + var(--safe-bottom)));
  left: 50%;
  transform: translateX(-50%);
  width: min(375px, calc(100vw - 24px));
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-tab);
  z-index: 2147483647 !important;
}

.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 7px 6px;
  border-radius: 999px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
}

.tab-btn.active {
  background: rgba(225, 29, 72, 0.13);
  color: var(--brand-primary);
  transform: translateY(-1px);
}

.tab-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-label {
  font-size: 10px;
  font-weight: 800;
}

.stop-distance {
  white-space: nowrap;
  flex-shrink: 0;
}
