/* =====================================================================
   GBRailway.org - Modern British Rail Design System
   Live Departures, Rangers & Rovers with Maps, Rail Fares Lookup
   ===================================================================== */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* National Rail & British Rail Palette */
  --nr-red: #ED1C24;
  --nr-red-hover: #D6131A;
  --nr-red-soft: rgba(237, 28, 36, 0.12);
  --nr-blue: #002F6C;
  --nr-navy: #0B192C;

  /* Dark Canvas Theme (Standard for Railway Departure Displays) */
  --bg-page: #0f141c;
  --bg-card: #161e2b;
  --bg-card-sub: #1b2637;
  --bg-input: #111824;
  --border-color: #27354a;
  --border-subtle: #1e2b3c;

  --text-main: #f0f4f8;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Status Colors */
  --status-ontime: #10b981;
  --status-ontime-bg: rgba(16, 185, 129, 0.14);
  --status-delay: #f59e0b;
  --status-delay-bg: rgba(245, 158, 11, 0.14);
  --status-cancel: #ef4444;
  --status-cancel-bg: rgba(239, 68, 68, 0.16);

  /* Railway Board LED Colors */
  --led-amber: #ffb800;
  --led-yellow: #fde047;
  --led-bg: #090d14;

  /* Staff PRIV Highlight */
  --priv-blue: #0284c7;
  --priv-bg: rgba(2, 132, 199, 0.16);
  --priv-border: #38bdf8;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =====================================================================
   HEADER & NAVIGATION
   ===================================================================== */
.site-header {
  background: rgba(22, 30, 43, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 9px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}

.brand-logo {
  height: 28px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(237, 28, 36, 0.16);
  border: 1px solid rgba(237, 28, 36, 0.45);
  color: #fda4af;
  padding: 1px 6px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-warning {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fcd34d;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(15, 20, 28, 0.85);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
  text-decoration: none;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}

.nav-tab.active {
  color: #fff;
  background: var(--nr-red);
  box-shadow: 0 1px 4px rgba(237, 28, 36, 0.35);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.live-beacon {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--status-ontime-bg);
  color: var(--status-ontime);
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.live-dot {
  width: 8px;
  height: 8px;
  background: var(--status-ontime);
  border-radius: 50%;
  animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* =====================================================================
   MAIN CONTENT CONTAINER
   ===================================================================== */
.site-main {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
  flex: 1;
}

.tab-pane {
  display: none;
}

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

/* Common Control Elements */
.ctl-btn {
  background: var(--bg-card-sub);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
  text-decoration: none;
}

.ctl-btn:hover {
  background: #253347;
  border-color: #3b4d66;
}

.ctl-btn.primary {
  background: var(--nr-red);
  border-color: var(--nr-red);
  color: #fff;
}

.ctl-btn.primary:hover {
  background: var(--nr-red-hover);
}

.chip-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 9999px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.chip-btn:hover, .chip-btn.active {
  color: #fff;
  background: var(--bg-card-sub);
  border-color: var(--nr-red);
}

/* Search Fields & Autocomplete */
.search-field-wrap {
  position: relative;
  flex: 1;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input:focus {
  border-color: var(--nr-red);
  box-shadow: 0 0 0 3px rgba(237, 28, 36, 0.2);
}

.suggest-box {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
  z-index: 500;
}

.suggest-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 14px;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background 0.1s;
}

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

.suggest-item:hover, .suggest-item.highlighted {
  background: var(--bg-card-sub);
  color: #fff;
}

.suggest-crs {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  background: #253347;
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* =====================================================================
   TAB 1: LIVE DEPARTURE BOARD
   ===================================================================== */
.board-lookup-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.board-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.quick-stations-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.quick-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

.nrcc-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  color: #fbbf24;
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.nrcc-banner.hidden {
  display: none;
}

.nrcc-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* Railway Display Frame */
.railway-board {
  background: var(--led-bg);
  border: 2px solid #202b3d;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 20px rgba(0, 0, 0, 0.6);
}

.railway-board-head {
  background: #0d131f;
  border-bottom: 2px solid #202b3d;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.board-station-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  justify-self: start;
}

.board-nr-logo {
  height: 28px;
  width: auto;
}

.board-station-name {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
}

.board-crs-pill {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 800;
  background: var(--nr-red);
  color: #fff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* Direction Filter Group (Up/Down) */
.board-filter-group {
  display: inline-flex;
  align-items: center;
  background: #080d15;
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid #1c2738;
  gap: 3px;
}

.dir-filter-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dir-filter-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.05);
}

.dir-filter-btn.active {
  background: #1e293b;
  color: #fff;
  border-color: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dir-filter-btn.up-filter.active {
  background: rgba(2, 132, 199, 0.25);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.55);
}

.dir-filter-btn.down-filter.active {
  background: rgba(245, 158, 11, 0.22);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
}

/* Direction Legend */
.dir-legend {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid #1a2538;
}

.legend-up {
  color: #38bdf8;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-down {
  color: #fbbf24;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.board-head-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  flex-wrap: wrap;
  gap: 12px;
}

.board-subbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 20px;
  background: #0c121e;
  border-bottom: 1px solid #1a2538;
}

.board-subbar-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.board-subbar-right {
  flex: 1 1 220px;
  max-width: 320px;
}

.board-quick-filter {
  width: 100%;
  padding: 5px 10px !important;
  font-size: 0.8rem !important;
}

.cars-badge,
.rev-badge,
.at-plat-badge,
.plat-change-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.cars-badge {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.rev-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}

.at-plat-badge {
  display: inline-block;
  margin-left: 6px;
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.45);
}

.plat-change-badge {
  display: block;
  margin-top: 3px;
  background: rgba(245, 158, 11, 0.22);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.55);
  animation: platChangePulse 1.1s ease-in-out infinite;
}

@keyframes platChangePulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; box-shadow: 0 0 8px rgba(250, 204, 21, 0.45); }
}

.col-plat.is-changed {
  border: 1px solid #facc15;
  box-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

.cp-item.is-delayed .cp-eta {
  color: #fbbf24;
  font-weight: 700;
}

.cp-item.is-actual {
  color: #86efac;
}

.cp-item.is-cancelled {
  color: #f87171;
  text-decoration: line-through;
}

.cp-toggle-btn {
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #7dd3fc;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 4px;
  cursor: pointer;
  margin: 0 4px;
}

.cp-toggle-btn:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #fff;
}

.delay-mins-tag {
  font-size: 0.78em;
  opacity: 0.9;
}

.bus-badge,
.load-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.bus-badge {
  background: rgba(245, 158, 11, 0.24);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.55);
}

.load-badge.load-low {
  background: rgba(16, 185, 129, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.load-badge.load-med {
  background: rgba(245, 158, 11, 0.18);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.load-badge.load-high {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.hc-badge.is-clickable,
.col-time.is-clickable {
  cursor: pointer;
}

.hc-badge.is-clickable:hover {
  filter: brightness(1.2);
}

.tablet-sound-btn {
  padding: 5px 10px !important;
  font-size: 0.76rem !important;
}

.tablet-sound-btn.is-on {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: rgba(16, 185, 129, 0.55) !important;
  color: #6ee7b7 !important;
}

.tablet-alert-toast {
  padding: 8px 18px;
  background: rgba(37, 99, 235, 0.28);
  border-bottom: 1px solid rgba(96, 165, 250, 0.55);
  color: #dbeafe;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tablet-alert-toast[hidden] {
  display: none !important;
}

/* Service Journey & Formation Modal */
.journey-modal-box {
  max-width: 720px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.journey-modal-box .modal-body {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.journey-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  background: #0a101b;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
}

.journey-last-seen {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
  font-size: 0.84rem;
  font-weight: 600;
}

.formation-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.coach-box {
  min-width: 56px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #111927;
  border: 1px solid #263348;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.coach-box.is-first {
  border-color: rgba(250, 204, 21, 0.6);
  background: rgba(250, 204, 21, 0.08);
}

.coach-box .coach-num {
  font-weight: 800;
  color: #fff;
}

.coach-box .coach-class {
  font-size: 0.64rem;
  color: var(--text-muted);
}

.coach-box .coach-load {
  margin-top: 3px;
  font-size: 0.68rem;
  font-weight: 700;
}

.journey-stops-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journey-stop-row {
  display: grid;
  grid-template-columns: 60px 1fr 54px 120px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  background: #0c1320;
  border: 1px solid #182336;
  font-size: 0.84rem;
}

.journey-stop-row.is-current {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(2, 132, 199, 0.14);
}

.journey-stop-row.is-cancelled {
  opacity: 0.65;
  text-decoration: line-through;
  color: #fca5a5;
}

/* =====================================================================
   UNIT TRACKING TAB
   ===================================================================== */
.unit-recording-note {
  margin-top: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
  font-size: 0.86rem;
}

.unit-stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.unit-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unit-stat-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

.unit-stat-value {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

.unit-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.unit-cards-grid[hidden] {
  display: none !important;
}

.unit-card {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-main);
  transition: border-color 0.15s, transform 0.12s, background 0.15s;
}

.unit-card:hover {
  border-color: rgba(16, 185, 129, 0.6);
  background: #131c2e;
  transform: translateY(-1px);
}

.unit-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.unit-card-count {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-muted);
}

.unit-card-route {
  font-size: 0.84rem;
  font-weight: 600;
  color: #e2e8f0;
}

.unit-card-meta {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--text-dim);
}

.unit-table-header {
  padding: 12px 16px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #fff;
  background: #0e1624;
  border-bottom: 1px solid var(--border-color);
}

.unit-link-btn {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}

.unit-class-summary {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
}

.unit-class-summary[hidden] {
  display: none !important;
}

.unit-status-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.unit-status-pill.is-live {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.55);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.25);
}

.unit-status-pill.is-next {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.unit-status-pill.is-past {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.unit-visual-panel {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.unit-visual-panel[hidden] {
  display: none !important;
}

.unit-hero-card,
.unit-timeline-card,
.unit-map-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}

.unit-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.unit-hero-id {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.unit-hero-number {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.unit-hero-route {
  margin-top: 10px;
  font-size: 0.96rem;
  color: #e2e8f0;
  font-weight: 600;
}

.unit-hero-pills {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.unit-partner-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.38);
  color: #a7f3d0;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.unit-partner-chip:hover {
  background: rgba(16, 185, 129, 0.28);
  color: #fff;
}

.unit-station-chip {
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #cbd5e1;
  font-size: 0.76rem;
}

.unit-viz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.unit-viz-sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-left: 8px;
}

.unit-timeline-card[hidden],
.unit-map-card[hidden] {
  display: none !important;
}

.unit-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.unit-timeline-track {
  position: relative;
  height: 44px;
  background: #080d17;
  border: 1px solid #1e293b;
  border-radius: 8px;
  overflow: hidden;
}

.unit-tl-block {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 5px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.unit-tl-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.85);
  z-index: 3;
}

.unit-map-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.unit-map-canvas {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #1e293b;
}

.board-clock {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--led-amber);
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.4);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 184, 0, 0.3);
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
  justify-self: center;
  text-align: center;
}

.board-table {
  width: 100%;
  display: flex;
  flex-direction: column;
}

.board-row {
  display: grid;
  grid-template-columns: 80px 64px 1fr 72px 136px 60px 140px;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid #162030;
  border-left: 4px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}

.board-row:hover {
  background: rgba(255, 255, 255, 0.025);
}

/* UP Trains: Heading towards London / major regional hub */
.board-row.is-up {
  border-left-color: #0284c7;
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.08) 0%, rgba(2, 132, 199, 0.01) 160px, transparent 240px);
}
.board-row.is-up:hover {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.12) 0%, rgba(2, 132, 199, 0.03) 160px, rgba(255, 255, 255, 0.02) 240px);
}

/* DOWN Trains: Heading away from London / hub */
.board-row.is-down {
  border-left-color: #f59e0b;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.07) 0%, rgba(245, 158, 11, 0.01) 160px, transparent 240px);
}
.board-row.is-down:hover {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.11) 0%, rgba(245, 158, 11, 0.03) 160px, rgba(255, 255, 255, 0.02) 240px);
}

/* Tablet-mode train alerts */
.dest-station.is-alert-trigger {
  cursor: pointer;
}

.dest-station.is-alert-trigger:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.alert-moved-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(96, 165, 250, 0.5);
  color: #bfdbfe;
  white-space: nowrap;
}

.board-row.is-alerted,
.board-row.is-alerted:hover {
  background: rgba(37, 99, 235, 0.22) !important;
  border-left-color: #3b82f6 !important;
}

@keyframes trainAlertPulse {
  0%, 100% {
    background: rgba(37, 99, 235, 0.12);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.25);
  }
  50% {
    background: rgba(59, 130, 246, 0.52);
    box-shadow: inset 0 0 0 2px rgba(147, 197, 253, 0.95), inset 0 0 20px rgba(59, 130, 246, 0.5);
  }
}

.board-row.is-alerted.is-alert-due,
.board-row.is-alerted.is-alert-due:hover {
  animation: trainAlertPulse 1.25s ease-in-out infinite;
}

.board-row.header {
  background: #111824;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 2px solid #202b3d;
  border-left-color: transparent !important;
  padding: 10px 20px;
}

.col-time {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.col-plat {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--led-yellow);
  text-align: center;
  background: rgba(253, 224, 71, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  min-width: 32px;
}

.col-dest {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  padding-right: 16px;
}

.dest-headline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dest-station {
  color: #fff;
  font-weight: 700;
}

.board-row.is-up .dest-station {
  color: #38bdf8;
}

.board-row.is-down .dest-station {
  color: #fbbf24;
}

.hc-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  display: inline-block;
  text-align: center;
  letter-spacing: 0.04em;
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.board-row.is-up .hc-badge {
  background: rgba(2, 132, 199, 0.2);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.45);
}

.board-row.is-down .hc-badge {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.45);
}

.unit-badge {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  text-align: center;
  letter-spacing: 0.03em;
  background: rgba(148, 163, 184, 0.08);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.18);
  max-width: 100%;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
}

.unit-badge.has-unit {
  background: rgba(16, 185, 129, 0.14);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.35);
}

.dest-headcode {
  font-family: var(--font-mono);
  font-size: 0.88em;
  font-weight: 600;
  opacity: 0.85;
}

/* Direction Pills (Up / Down) */
.train-dir-pill {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.05em;
  display: inline-flex;
  align-items: center;
  line-height: 1.25;
  text-transform: uppercase;
  white-space: nowrap;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.train-dir-pill:hover {
  transform: translateY(-1px);
}

/* UP Trains: Heading towards London / major regional hub -> British Rail Blue / Sky Cyan */
.train-dir-pill.up {
  background: rgba(2, 132, 199, 0.22);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.15);
}

/* DOWN Trains: Heading away from London / hub -> Warm Golden Amber */
.train-dir-pill.down {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.15);
}

.col-dest .dest-via {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
}

.col-etd {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
}

.status-ontime {
  color: var(--status-ontime);
}

.status-delay {
  color: var(--status-delay);
}

.status-cancel {
  color: var(--status-cancel);
}

/* Operator Badges */
.op-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  text-align: center;
  background: #253347;
  color: #cbd5e1;
}

.op-badge.op-vt { background: #004354; color: #5eead4; } /* Avanti West Coast */
.op-badge.op-lm { background: #007749; color: #86efac; } /* London Northwestern / WMR */
.op-badge.op-nt { background: #1d4ed8; color: #dbeafe; } /* Northern */
.op-badge.op-tp { background: #0369a1; color: #e0f2fe; } /* TransPennine Express */
.op-badge.op-aw { background: #cc2229; color: #fee2e2; } /* Transport for Wales */
.op-badge.op-xc { background: #660f26; color: #fbcfe8; } /* CrossCountry */
.op-badge.op-gr { background: #ce0e2d; color: #ffffff; } /* LNER */
.op-badge.op-gw { background: #0a493e; color: #a7f3d0; } /* Great Western Railway */
.op-badge.op-sr { background: #1e3a8a; color: #bfdbfe; } /* ScotRail */
.op-badge.op-tl { background: #db2777; color: #fdf2f8; } /* Thameslink */
.op-badge.op-me { background: #facc15; color: #111827; } /* Merseyrail */
.op-badge.op-lo { background: #ea580c; color: #fff7ed; } /* London Overground */
.op-badge.op-xr { background: #6b21a8; color: #f3e8ff; } /* Elizabeth line */
.op-badge.op-sw { background: #0284c7; color: #f0f9ff; } /* South Western Railway */
.op-badge.op-se { background: #1e293b; color: #fde047; border: 1px solid rgba(253, 224, 71, 0.4); } /* Southeastern */
.op-badge.op-sn { background: #15803d; color: #dcfce7; } /* Southern */
.op-badge.op-gx { background: #dc2626; color: #fef2f2; } /* Gatwick Express */
.op-badge.op-le { background: #b91c1c; color: #fee2e2; } /* Greater Anglia */
.op-badge.op-em { background: #581c87; color: #e9d5ff; } /* East Midlands Railway */
.op-badge.op-ch { background: #0891b2; color: #ecfeff; } /* Chiltern Railways */
.op-badge.op-gc { background: #18181b; color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.45); } /* Grand Central */
.op-badge.op-ht { background: #312e81; color: #f472b6; } /* Hull Trains */
.op-badge.op-ld { background: #2563eb; color: #eff6ff; } /* Lumo */
.op-badge.op-cc { background: #be185d; color: #fce7f3; } /* c2c */
.op-badge.op-gn { background: #7e22ce; color: #f3e8ff; } /* Great Northern */
.op-badge.op-hx { background: #4c1d95; color: #ddd6fe; } /* Heathrow Express */
.op-badge.op-cs { background: #115e59; color: #99f6e4; } /* Caledonian Sleeper */
.op-badge.op-il { background: #075985; color: #bae6fd; } /* Island Line */
.op-badge.op-es { background: #0f172a; color: #facc15; border: 1px solid rgba(250, 204, 21, 0.4); } /* Eurostar */

.board-calling-row {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 6px 0 2px;
  line-height: 1.4;
  border-top: 1px dashed #1a2536;
  margin-top: 8px;
}

.service-headcode-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  margin-right: 6px;
}

.board-reason-row {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.board-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 1rem;
}

/* =====================================================================
   TAB 2: RANGERS & ROVERS GUIDE & MAPS
   ===================================================================== */
.rovers-header {
  margin-bottom: 24px;
}

.rovers-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.rovers-header p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 900px;
}

.rovers-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 0.88rem;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus {
  border-color: var(--nr-red);
}

.rovers-grid-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
  align-items: start;
}

/* Rover Selection List (Left column) */
.rovers-list {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-height: 820px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.rover-card-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
  text-align: left;
  border-left: 4px solid transparent;
}

.rover-card-item:hover {
  background: var(--bg-card-sub);
}

.rover-card-item.selected {
  background: #1e2b3c;
  border-left-color: var(--nr-red);
}

.rover-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.rover-item-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.rover-item-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  background: #253347;
  color: #93c5fd;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.rover-item-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.rover-item-price-preview {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}

.price-std-pill {
  font-weight: 700;
  color: #fff;
}

.price-priv-pill {
  font-weight: 700;
  color: #38bdf8;
  background: var(--priv-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Rover Detail & Map Pane (Right column) */
.rover-detail-pane {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.rover-map-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.map-header {
  padding: 12px 18px;
  background: var(--bg-card-sub);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.map-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rover-map-gl-wrap {
  position: relative;
  width: 100%;
  height: 460px;
  background: #e8eef4;
}

.rover-map-gl {
  width: 100%;
  height: 100%;
}

.gl-map-legend {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  border: 1px solid #334155;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  pointer-events: none;
}

.gl-map-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.leg-gw-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2563eb;
  border: 2px solid #ffffff;
  display: inline-block;
}

.leg-st-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ED1C24;
  border: 1.5px solid #ffffff;
  display: inline-block;
}

.leg-line-bar {
  width: 16px;
  height: 4px;
  border-radius: 2px;
  background: #ED1C24;
  display: inline-block;
}

.circuit-map-wrap:active {
  cursor: grabbing;
}

.circuit-svg-host {
  width: 100%;
  height: 100%;
}

.circuit-svg-host svg {
  width: 100%;
  height: 100%;
  display: block;
}

.circuit-line-casing {
  stroke-width: calc(7.5px * var(--inv-stroke, 1));
}

.circuit-line-main {
  stroke-width: calc(4.2px * var(--inv-stroke, 1));
}

.circuit-roundel {
  r: calc(4.8px * var(--inv-node, 1));
  stroke-width: calc(2.2px * var(--inv-node, 1));
}

.circuit-dot {
  r: calc(2.6px * var(--inv-node, 1));
  stroke-width: calc(1.3px * var(--inv-node, 1));
}

.circuit-hit {
  r: calc(8px * var(--inv-node, 1));
}

.circuit-label {
  font-family: Inter, system-ui, sans-serif;
  font-size: calc(var(--base-fs, 10px) * var(--inv-text, 1));
  paint-order: stroke;
  stroke: #090f19;
  stroke-width: calc(3.2px * var(--inv-text, 1));
  stroke-linejoin: round;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.circuit-label.tier-2,
.circuit-label.tier-3 {
  opacity: 0;
}

.circuit-svg-host.zoom-med .circuit-label.tier-2 {
  opacity: 1;
}

.circuit-svg-host.zoom-high .circuit-label.tier-2,
.circuit-svg-host.zoom-high .circuit-label.tier-3 {
  opacity: 1;
}

.circuit-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.circuit-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid #2b3a52;
  background: rgba(15, 23, 42, 0.9);
  color: #e2e8f0;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}

.circuit-btn:hover {
  background: #1e293b;
  border-color: #38bdf8;
  color: #fff;
}

.circuit-legend {
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(11, 17, 28, 0.88);
  border: 1px solid #1f2d42;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  color: #cbd5e1;
  pointer-events: none;
}

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

.leg-roundel {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #38bdf8;
  display: inline-block;
}

.leg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f8fafc;
  border: 1.5px solid #ED1C24;
  display: inline-block;
}

.circuit-tooltip {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid #334155;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  color: #f8fafc;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  white-space: nowrap;
}

/* Pricing Breakdown Section */
.rover-pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.section-h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pricing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.pricing-stat-box {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}

.pricing-stat-box.highlight-priv {
  border-color: var(--priv-border);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.15), rgba(15, 23, 42, 0.4));
}

.pricing-stat-box.highlight-adult {
  border-color: #f59e0b;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(15, 23, 42, 0.4));
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-amount {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Railcards Breakdown Table */
.railcard-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 14px;
}

.railcard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.railcard-table th {
  background: #111824;
  color: var(--text-muted);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.railcard-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.railcard-table tr:hover td {
  background: var(--bg-card-sub);
}

.badge-staff {
  background: var(--priv-bg);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.badge-rc-valid {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.badge-rc-not-valid {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.25);
}

.rc-badge-invalid {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.row-rc-invalid {
  opacity: 0.65;
}

.row-rc-invalid:hover {
  opacity: 0.95;
}

.rc-not-valid-pill {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #fca5a5 !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

.rc-validity-notice {
  margin: 12px 0 6px;
}

.rc-notice-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  line-height: 1.4;
}

.rc-notice-badge.valid {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.rc-notice-badge.alert {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Rover Validity Rules Box */
.rover-rules-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  font-size: 0.88rem;
}

.rule-group h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.rule-group p {
  color: var(--text-main);
  line-height: 1.4;
}

.gateway-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.gateway-chip {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  background: #1e3a8a;
  color: #bfdbfe;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* =====================================================================
   TAB 3: RAIL FARES LOOKUP (POINT-TO-POINT)
   ===================================================================== */
.fares-search-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.fares-route-row {
  display: grid;
  grid-template-columns: 1fr 48px 1fr 220px 140px;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.btn-swap {
  height: 42px;
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-swap:hover {
  color: #fff;
  border-color: var(--nr-red);
}

.fares-results-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.fares-summary-bar {
  background: var(--bg-card-sub);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.fares-route-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.fares-count-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.fares-filter-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* Fares Results Table */
.fares-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.fares-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
}

.fares-table th {
  background: #101722;
  color: var(--text-muted);
  font-weight: 700;
  padding: 12px 14px;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.fares-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  vertical-align: middle;
}

.fares-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.fares-ticket-cell {
  display: flex;
  flex-direction: column;
}

.ticket-name {
  font-weight: 700;
  color: #fff;
  font-size: 0.92rem;
}

.ticket-tty-code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.badge-class {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  white-space: nowrap;
}

.badge-class.std {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
}

.badge-class.fst {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-rest {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  background: #253347;
  color: #60a5fa;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid #3b82f6;
  transition: all 0.15s;
}

.badge-rest:hover {
  background: #3b82f6;
  color: #fff;
}

.price-cell {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.price-cell.discount-highlight {
  color: var(--status-ontime);
}

.price-cell.priv-highlight {
  color: #38bdf8;
  background: rgba(2, 132, 199, 0.1);
  border-radius: var(--radius-sm);
}

/* Modal for Restriction Details */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =====================================================================
   FOOTER
   ===================================================================== */
.site-footer {
  background: #090e16;
  border-top: 1px solid var(--border-color);
  padding: 24px 20px;
  color: var(--text-dim);
  font-size: 0.8rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
}

.footer-left {
  justify-self: start;
}

.footer-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  text-align: right;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  opacity: 0.85;
  transition: opacity 0.15s, transform 0.15s;
}

.footer-brand-link:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.footer-brand-logo {
  height: 28px;
  width: auto;
  border-radius: 6px;
  display: block;
}

.footer-gif-logo {
  height: 42px;
  width: auto;
  max-width: 100%;
  border-radius: 6px;
  display: block;
}

/* =====================================================================
   RESPONSIVE QUERIES
   ===================================================================== */
@media (max-width: 1024px) {
  .rovers-grid-layout {
    grid-template-columns: 1fr;
  }
  .fares-route-row {
    grid-template-columns: 1fr;
  }
  .btn-swap {
    height: 36px;
    font-size: 0.95rem;
  }
}

@media (max-width: 960px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-tabs::-webkit-scrollbar {
    display: none;
  }
  body:not(.tablet-mode) .railway-board-head {
    gap: 12px;
  }
  body:not(.tablet-mode) .board-station-name {
    font-size: 1.35rem;
  }
}

@media (max-width: 768px) {
  /* Release sticky header height on phones so scrolling content has full room */
  .site-header {
    position: static;
  }
  .header-inner {
    padding: 10px 12px;
    gap: 8px;
  }
  .brand-subtitle {
    white-space: normal;
    line-height: 1.3;
  }
  .nav-tab {
    padding: 7px 11px;
    font-size: 0.82rem;
    gap: 5px;
  }
  .site-main {
    padding: 14px 12px 32px;
  }

  /* Prevent iOS Safari auto-zoom on < 16px inputs/selects */
  .search-input,
  .filter-select,
  .board-quick-filter,
  .ticker-input {
    font-size: 16px !important;
  }

  /* Panels & Search Bars */
  .board-lookup-panel,
  .rovers-filter-panel,
  .fares-search-card,
  .rover-pricing-card,
  .rover-rules-card,
  .unit-hero-card,
  .unit-timeline-card,
  .unit-map-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }
  .board-search-bar > .search-field-wrap {
    flex: 1 1 100%;
  }
  .board-search-bar > .ctl-btn {
    flex: 1 1 auto;
    padding: 9px 12px;
    font-size: 0.84rem;
  }

  /* Keep quick chips horizontally swipeable instead of pushing board off-screen */
  .quick-stations-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }
  .quick-stations-row::-webkit-scrollbar {
    display: none;
  }

  /* Departure Board header & filter bar */
  body:not(.tablet-mode) .railway-board-head {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    padding: 12px 14px;
    gap: 10px;
  }
  body:not(.tablet-mode) .board-station-info {
    justify-self: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 10px;
  }
  body:not(.tablet-mode) .board-station-name {
    font-size: 1.2rem;
  }
  body:not(.tablet-mode) .board-clock {
    justify-self: center;
    font-size: 1.15rem;
    padding: 4px 12px;
  }
  body:not(.tablet-mode) .board-head-right {
    width: 100%;
    justify-self: stretch;
    justify-content: center;
    gap: 8px;
  }
  body:not(.tablet-mode) .board-head-right .live-beacon {
    font-size: 0.7rem;
    padding: 4px 8px;
  }
  body:not(.tablet-mode) .board-head-right .kiosk-board-btn {
    font-size: 0.75rem;
    padding: 5px 10px;
  }
  .board-subbar {
    padding: 8px 12px;
  }
  .board-subbar-right {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Bottom scroller settings */
  .ticker-input-wrap,
  .ticker-to-group {
    flex: 1 1 100%;
    max-width: none;
  }

  /* Rovers layout & maps */
  .rovers-filter-panel > .search-field-wrap {
    max-width: none !important;
    flex: 1 1 100%;
  }
  .rovers-filter-panel > select.filter-select {
    flex: 1 1 calc(50% - 7px);
    min-width: 140px;
  }
  .rovers-filter-panel > div:last-child {
    margin-left: 0 !important;
    width: 100%;
    flex-wrap: wrap;
  }
  .rovers-filter-panel > div:last-child select.filter-select {
    flex: 1 1 auto;
  }
  .rovers-list {
    max-height: 280px;
  }
  .map-header {
    padding: 10px 14px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .rover-map-gl-wrap {
    height: 310px;
  }
  .gl-map-legend {
    left: 6px;
    right: 6px;
    bottom: 6px;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 4px 8px;
    font-size: 0.68rem;
  }
  .rules-grid {
    grid-template-columns: 1fr;
  }

  /* Fares & Tables */
  .fares-summary-bar {
    padding: 12px 14px;
  }
  .fares-route-title {
    font-size: 1.05rem;
    flex-wrap: wrap;
  }
  .fares-filter-toolbar {
    width: 100%;
  }
  .fares-filter-toolbar .filter-select {
    flex: 1 1 130px;
  }
  .fares-table-wrap,
  .railcard-table-wrap {
    -webkit-overflow-scrolling: touch;
  }
  .fares-table th,
  .fares-table td,
  .railcard-table th,
  .railcard-table td {
    padding: 9px 10px;
    font-size: 0.82rem;
  }

  /* Unit Tracking */
  .unit-stats-strip,
  .pricing-summary-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .unit-stat-value,
  .stat-amount {
    font-size: 1.2rem;
  }
  .unit-hero-number {
    font-size: 1.25rem;
  }
  .unit-timeline-axis {
    font-size: 0.62rem;
  }
  .unit-map-canvas {
    height: 280px;
  }
  .unit-viz-head {
    gap: 6px;
  }
  .unit-map-controls {
    flex-wrap: wrap;
  }

  /* Modals */
  .modal-overlay {
    padding: 10px;
  }
  .modal-box {
    padding: 16px;
    max-height: 92vh;
  }
  .journey-stop-row {
    grid-template-columns: 50px 1fr auto;
    gap: 4px 8px;
    font-size: 0.8rem;
    padding: 7px 8px;
  }

  /* Footer */
  .site-footer {
    padding: 18px 14px;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 12px;
  }
  .footer-left,
  .footer-brand-link {
    justify-self: center;
  }
  .footer-right {
    justify-self: center;
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 720px) {
  /* Responsive 2-row card layout for Departure Board rows without altering tablet-mode */
  body:not(.tablet-mode) .board-row.header {
    display: none;
  }
  body:not(.tablet-mode) .board-row {
    grid-template-columns: auto auto 1fr auto;
    column-gap: 8px;
    row-gap: 6px;
    padding: 12px;
    align-items: center;
  }
  body:not(.tablet-mode) .board-row > .col-time {
    grid-column: 1;
    grid-row: 1;
    font-size: 1rem;
  }
  body:not(.tablet-mode) .board-row > .col-dest {
    grid-column: 2 / 4;
    grid-row: 1;
    min-width: 0;
    padding-right: 4px;
    font-size: 0.96rem;
  }
  body:not(.tablet-mode) .board-row > div:nth-child(6) {
    grid-column: 4;
    grid-row: 1;
    text-align: right !important;
  }
  body:not(.tablet-mode) .board-row > div:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
  }
  body:not(.tablet-mode) .board-row > div:nth-child(4) {
    grid-column: 2;
    grid-row: 2;
    text-align: left !important;
  }
  body:not(.tablet-mode) .board-row > div:nth-child(5) {
    grid-column: 3;
    grid-row: 2;
    text-align: left !important;
    min-width: 0;
  }
  body:not(.tablet-mode) .board-row > .col-etd {
    grid-column: 4;
    grid-row: 2;
    font-size: 0.82rem;
    text-align: right;
    white-space: normal;
  }
  body:not(.tablet-mode) .dest-headline {
    gap: 5px;
  }
  body:not(.tablet-mode) .board-row .col-plat {
    font-size: 0.95rem;
    min-width: 28px;
  }
  body:not(.tablet-mode) .board-calling-row {
    font-size: 0.78rem;
  }
}

/* =====================================================================
   FULLSCREEN KIOSK DISPLAY (FOR PUBS, WORKPLACES & CONCOURSES)
   ===================================================================== */
.kiosk-top-bar {
  display: none;
  background: #060a11;
  border-bottom: 2px solid #1a2536;
  padding: 10px 24px;
  align-items: center;
  justify-content: space-between;
}

.kiosk-live-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  color: #10b981;
  letter-spacing: 0.08em;
}

.kiosk-paging-info {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
  background: #162030;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  margin-left: 12px;
}

.kiosk-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-right: 14px;
}

.kiosk-exit-btn {
  background: #1f2937;
  color: #f3f4f6;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid #374151;
  cursor: pointer;
}

.kiosk-exit-btn:hover {
  background: var(--nr-red);
  border-color: var(--nr-red);
  color: #fff;
}

.kiosk-launch-btn {
  background: #1e293b;
  border-color: #3b82f6;
  color: #60a5fa;
}

.kiosk-launch-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.kiosk-board-btn {
  font-size: 0.8rem;
  padding: 6px 12px;
  background: #162030;
  border-color: #27354a;
  color: #94a3b8;
}

.kiosk-board-btn:hover {
  color: #fff;
  border-color: #3b82f6;
}

/* Fullscreen Active Mode */
body.kiosk-mode-active {
  overflow: hidden !important;
}

.railway-board.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: none !important;
  background: #04070c !important;
  display: flex !important;
  flex-direction: column !important;
  box-shadow: none !important;
  box-sizing: border-box !important;
}

.railway-board.is-fullscreen .kiosk-top-bar {
  display: flex;
}

.railway-board.is-fullscreen .railway-board-head {
  padding: 16px 36px;
  background: #090e18;
  border-bottom: 3px solid #1a2538;
}

.railway-board.is-fullscreen .board-nr-logo {
  height: 46px;
}

.railway-board.is-fullscreen .board-station-name {
  font-size: 2.8rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

.railway-board.is-fullscreen .board-crs-pill {
  font-size: 1.4rem;
  padding: 4px 14px;
}

.railway-board.is-fullscreen .board-clock {
  font-size: 2.6rem;
  padding: 6px 24px;
  box-shadow: 0 0 20px rgba(255, 184, 0, 0.3);
}

.railway-board.is-fullscreen .board-table {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.railway-board.is-fullscreen .board-row.header {
  font-size: 1.05rem;
  padding: 14px 36px;
  background: #0e1524;
  border-bottom: 2px solid #1e2b40;
}

.railway-board.is-fullscreen .board-row {
  grid-template-columns: 140px 96px 1fr 115px 185px 100px 220px;
  padding: 18px 36px;
  border-bottom: 1px solid #151e2e;
}

.railway-board.is-fullscreen .hc-badge {
  font-size: 1.15rem;
  padding: 6px 12px;
}

.railway-board.is-fullscreen .col-time {
  font-size: 2rem;
}

.railway-board.is-fullscreen .op-badge {
  font-size: 1.1rem;
  padding: 6px 12px;
}

.railway-board.is-fullscreen .col-dest {
  font-size: 1.85rem;
  line-height: 1.25;
}

.railway-board.is-fullscreen .col-dest .dest-via {
  font-size: 1.15rem;
  margin-top: 4px;
}

.railway-board.is-fullscreen .col-plat {
  font-size: 2rem;
  padding: 6px 16px;
  min-width: 56px;
  box-shadow: 0 0 10px rgba(253, 224, 71, 0.2);
}

.railway-board.is-fullscreen .col-etd {
  font-size: 1.75rem;
}

.railway-board.is-fullscreen .board-calling-row {
  font-size: 1.2rem;
  line-height: 1.5;
  padding: 10px 0 4px;
  color: #e2e8f0;
}

.railway-board.is-fullscreen .board-reason-row {
  font-size: 1.2rem;
  padding: 8px 16px;
  margin-top: 8px;
}

.railway-board.is-fullscreen .board-row.is-up {
  border-left-width: 8px;
}

.railway-board.is-fullscreen .board-row.is-down {
  border-left-width: 8px;
}

.railway-board.is-fullscreen .train-dir-pill {
  font-size: 1rem;
  padding: 4px 12px;
  border-radius: 6px;
}

.railway-board.is-fullscreen .dir-filter-btn {
  font-size: 0.95rem;
  padding: 8px 18px;
}

.railway-board.is-fullscreen .dir-legend {
  font-size: 0.95rem;
  padding: 6px 14px;
}

.railway-board.is-fullscreen .kiosk-board-btn {
  display: none;
}

/* Bottom Connection Scroller Settings & Bar */
.board-ticker-settings {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ticker-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
}

.ticker-input-wrap {
  flex: 1 1 200px;
  max-width: 260px;
}

.ticker-input {
  padding: 6px 10px !important;
  font-size: 0.84rem !important;
}

.ticker-arrow {
  color: var(--text-muted);
  font-weight: 700;
}

.ticker-to-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1 1 260px;
}

.ticker-to-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ticker-to-chips:empty {
  display: none;
}

.ticker-to-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.ticker-to-chip-remove {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  padding: 0 2px;
}

.ticker-to-chip-remove:hover {
  color: #f87171;
}

.ticker-add-btn {
  padding: 6px 10px !important;
  font-size: 0.8rem !important;
  white-space: nowrap;
}

.ticker-add-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ticker-buffer-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.ticker-buffer-input {
  width: 62px;
  padding: 5px 7px !important;
  font-size: 0.84rem !important;
  font-family: var(--font-mono);
  text-align: center;
}

/* Connection status line — next arrival + the cutoff applied to the board */
.connection-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid var(--border-color);
  border-left: 3px solid #38bdf8;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.connection-status[hidden] {
  display: none;
}

.conn-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: #38bdf8;
  color: #060910;
  padding: 2px 7px;
  border-radius: 4px;
}

.conn-next {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 800;
  color: #7dd3fc;
}

.conn-detail {
  color: var(--text-dim);
}

.board-bottom-ticker {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #070b12;
  border-top: 2px solid #f59e0b;
  padding: 9px 14px;
  overflow: hidden;
}

.board-bottom-ticker[hidden] {
  display: none;
}

.ticker-badge {
  flex-shrink: 0;
  background: #f59e0b;
  color: #090d16;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 4px;
}

.ticker-viewport {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}

.ticker-track {
  display: inline-block;
  padding-left: 100%;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: #fde68a;
  animation: tickerScroll 42s linear infinite;
}

/* Each entry in the NEXT CONNECTION list gets its own colour so the time of
   each train is easy to pick out while it scrolls. */
.ticker-entry {
  white-space: nowrap;
}

.ticker-entry .ticker-prefix {
  font-weight: 800;
  opacity: 0.75;
  margin-right: 6px;
}

.ticker-entry .ticker-time {
  font-weight: 800;
  margin-right: 6px;
}

.ticker-entry .ticker-meta {
  opacity: 0.82;
}

.ticker-sep {
  color: #64748b;
  margin: 0 14px;
  opacity: 0.6;
}

.ticker-empty {
  color: #94a3b8;
}

/* Colour fallbacks — the inline style carries the exact colour, these keep
   the contrast right if the inline style is ever stripped. */
.ticker-c0 { color: #fde68a; }
.ticker-c1 { color: #7dd3fc; }
.ticker-c2 { color: #86efac; }
.ticker-c3 { color: #f9a8d4; }
.ticker-c4 { color: #c4b5fd; }
.ticker-c5 { color: #fdba74; }
.ticker-c6 { color: #67e8f9; }

.board-bottom-ticker:hover .ticker-track {
  animation-play-state: paused;
}

@keyframes tickerScroll {
  0% { transform: translateX(0%); }
  100% { transform: translateX(-100%); }
}

.railway-board.is-fullscreen .board-bottom-ticker {
  margin-top: auto;
  padding: 14px 20px;
  border-top-width: 3px;
}

.railway-board.is-fullscreen .ticker-badge {
  font-size: 0.95rem;
  padding: 5px 12px;
}

.railway-board.is-fullscreen .ticker-track {
  font-size: 1.25rem;
}

@media (max-width: 768px) {
  .railway-board.is-fullscreen .kiosk-top-bar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .railway-board.is-fullscreen .kiosk-hint {
    display: none;
  }
  .railway-board.is-fullscreen .railway-board-head {
    padding: 12px 14px;
    gap: 10px;
  }
  .railway-board.is-fullscreen .board-nr-logo {
    height: 30px;
  }
  .railway-board.is-fullscreen .board-station-name {
    font-size: 1.45rem;
  }
  .railway-board.is-fullscreen .board-crs-pill {
    font-size: 0.95rem;
    padding: 3px 9px;
  }
  .railway-board.is-fullscreen .board-clock {
    font-size: 1.35rem;
    padding: 4px 12px;
  }
  .railway-board.is-fullscreen .board-bottom-ticker {
    padding: 10px 12px;
  }
  .railway-board.is-fullscreen .ticker-track {
    font-size: 0.95rem;
  }
  .board-bottom-ticker {
    padding: 8px 12px;
    gap: 8px;
  }
}

