/* Rail Insights product suite — shared operational interface */
:root {
  --ri-ink: #10130f;
  --ri-ink-2: #191d17;
  --ri-paper: #f0efe8;
  --ri-white: #fafaf6;
  --ri-line: rgba(16, 19, 15, .17);
  --ri-signal: #d9ff43;
  --ri-blue: #1857c9;
  --ri-orange: #ef5b2a;
}

body.product-app {
  background: var(--ri-paper);
  color: var(--ri-ink);
  font-family: 'Outfit', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.product-app ::selection { background: var(--ri-signal); color: var(--ri-ink); }

/* Product command bar */
.product-app .app-header {
  position: relative;
  z-index: 1000;
  flex-shrink: 0;
  background: var(--ri-ink);
  color: var(--ri-white);
  border: 0;
  border-bottom: 3px solid var(--ri-signal);
  backdrop-filter: none;
}

.product-app .app-header .nav {
  width: 100%;
  max-width: none;
  height: 72px;
  padding: 0 22px;
  gap: 20px;
}

.product-app .brand { gap: 14px; min-width: 275px; }
.product-app .brand img { width: 176px; height: 42px; object-fit: contain; object-position: left center; }
.product-app .brand-mark { width: auto; height: auto; background: none; }
.product-app .brand-mark img { width: 176px; height: 42px; }
.product-app .brand-name { display: none; }
.product-app .brand-text,
.product-app .brand > span:last-child { display: flex; flex-direction: column; justify-content: center; }
.product-app .brand-sub {
  margin: 0;
  color: var(--ri-signal);
  font: 500 9px/1.2 'IBM Plex Mono', monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.product-app .nav-actions { gap: 0; height: 100%; }
.product-app .nav-btn,
.product-app .nav-link {
  height: 100%;
  padding: 0 16px;
  border: 0;
  border-left: 1px solid rgba(255,255,255,.18);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: rgba(255,255,255,.68);
  font: 500 10px/1 'IBM Plex Mono', monospace;
  letter-spacing: .025em;
  text-transform: uppercase;
}
.product-app .nav-btn:hover,
.product-app .nav-link:hover,
.product-app .nav-btn.active,
.product-app .nav-link.active { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.18); }
.product-app .nav-btn.active,
.product-app .nav-link.active { box-shadow: inset 0 -3px 0 var(--ri-signal); }
.product-app .nav-btn.primary,
.product-app .nav-link.primary {
  height: 42px;
  margin-left: 12px;
  padding: 0 18px;
  align-self: center;
  border: 1px solid var(--ri-signal);
  background: var(--ri-signal);
  color: var(--ri-ink);
  font-weight: 600;
}
.product-app .nav-btn.primary:hover,
.product-app .nav-link.primary:hover { background: white; color: var(--ri-ink); border-color: white; }
.product-app .nav-hamburger { color: white; border-color: rgba(255,255,255,.35); background: transparent; }

/* Shared operational components */
.product-app .panel-label,
.product-app .eyebrow,
.product-app .f-label,
.product-app .kpi-label,
.product-app .vc-label,
.product-app .panel-title {
  color: inherit;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.product-app input,
.product-app select,
.product-app textarea,
.product-app button { border-radius: 0 !important; }

.product-app input:focus,
.product-app select:focus,
.product-app textarea:focus {
  border-color: var(--ri-blue) !important;
  box-shadow: 0 0 0 3px rgba(24,87,201,.13) !important;
}

/* Use the product's own clear button instead of the browser-generated one. */
.signal-desk input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
}
.signal-desk input[type="search"]::-webkit-search-cancel-button,
.signal-desk input[type="search"]::-webkit-search-decoration {
  display: none !important;
  -webkit-appearance: none;
  appearance: none;
  width: 0;
  height: 0;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.product-app .toast { border-radius: 0; font-family: 'IBM Plex Mono', monospace; }

/* Full-screen map products */
.product-map .side-panel {
  width: 300px;
  background: var(--ri-ink-2);
  color: var(--ri-white);
  border-right: 1px solid rgba(255,255,255,.15);
  box-shadow: 12px 0 34px rgba(0,0,0,.18);
}
.product-map .panel-section,
.product-map .detail-section {
  background: rgba(255,255,255,.045);
  color: var(--ri-white);
  border-color: rgba(255,255,255,.13);
  border-radius: 0;
  box-shadow: none;
}
.product-map .panel-section { padding: 17px 18px; }
.product-map .panel-label { color: var(--ri-signal); font-size: 9px; }
.product-map .layer-item { border-color: rgba(255,255,255,.12); background: transparent; }
.product-map .layer-item:hover { background: rgba(255,255,255,.05); }
.product-map .layer-name,
.product-map .legend-item,
.product-map .conn-text,
.product-map .filter-label { color: var(--ri-white); }
.product-map .layer-note,
.product-map .panel-hint,
.product-map .feed-sub,
.product-map .feed-empty,
.product-map .mix-caption,
.product-map .kpi-sub,
.product-map .search-hits,
.product-map .stat-updated,
.product-map .detail-empty { color: rgba(255,255,255,.58); }
.product-map .stat-card,
.product-map .feed-card,
.product-map .info-box { background: rgba(255,255,255,.055); border-color: rgba(255,255,255,.13); border-radius: 0; }
.product-map .stat-val { color: var(--ri-signal); }
.product-map .stat-lbl { color: rgba(255,255,255,.5); }
.product-map .toggle-track { background: rgba(255,255,255,.16); }
.product-map .toggle input:checked + .toggle-track { background: var(--ri-signal); }
.product-map .toggle input:checked + .toggle-track::after { background: var(--ri-ink); }
.product-map .search-wrap input,
.product-map .search-input {
  background: rgba(255,255,255,.07);
  color: white;
  border-color: rgba(255,255,255,.18);
}
.product-map .search-input::placeholder { color: rgba(255,255,255,.46); }
.product-map .search-icon,
.product-map .search-clear { color: rgba(255,255,255,.62); }
.product-map .header-search input {
  height: 42px;
  background: rgba(255,255,255,.07);
  color: white;
  border: 1px solid rgba(255,255,255,.2);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
}
.product-map .header-search input::placeholder { color: rgba(255,255,255,.42); }
.product-map .header-search .search-icon { color: var(--ri-signal); }
.product-map .search-results {
  border-radius: 0;
  border: 1px solid var(--ri-line);
  background: var(--ri-white);
  color: var(--ri-ink);
}
.product-map .search-results .search-item { color: var(--ri-ink); border-color: var(--ri-line); }
.product-map .search-results .search-item:hover { background: #e7edff; }
.product-map .search-results .search-item-name { color: var(--ri-ink); }
.product-map .search-results .search-item-type { color: #686d64; }
.product-map .search-results .search-empty { color: #686d64; }
.product-map .panel-fab { border-radius: 0; background: var(--ri-ink); color: white; border: 1px solid var(--ri-signal); }

/* Network Atlas */
.network-atlas .brand-sub::before { content: '01 / '; color: rgba(255,255,255,.45); }
.network-atlas .side-panel::before {
  content: 'NETWORK ATLAS / LAYER CONTROL';
  display: block;
  padding: 15px 18px;
  color: rgba(255,255,255,.45);
  border-bottom: 1px solid rgba(255,255,255,.12);
  font: 500 9px 'IBM Plex Mono', monospace;
  letter-spacing: .1em;
}
.network-atlas .loading-bar { background: var(--ri-signal); }
.network-atlas .leaflet-control-zoom a { border-radius: 0 !important; }

/* Live Operations */
.live-operations .brand-sub::before { content: '03 / '; color: rgba(255,255,255,.45); }
.live-operations .kpi-strip {
  min-height: 68px;
  height: 68px;
  background: var(--ri-white);
  border-bottom: 1px solid var(--ri-line);
  box-shadow: none;
}
.live-operations .kpi { padding: 8px 18px; border-color: var(--ri-line); gap: 2px; }
.live-operations .kpi-label { color: #686d64; font-size: 8px; }
.live-operations .kpi-val { color: var(--ri-ink); font-size: 24px; letter-spacing: -.04em; }
.live-operations .kpi-val.blue { color: var(--ri-blue); }
.live-operations .kpi-sub { color: #686d64; }
.live-operations .kpi-clock { background: var(--ri-signal); }
.live-operations .kpi-clock .kpi-label,
.live-operations .kpi-clock .kpi-sub { color: rgba(16,19,15,.62); }
.live-operations .side-panel { width: 284px; }
.live-operations .legacy-filter-panel { display: none !important; }
.live-operations .filter-all-btn { color: var(--ri-signal); }
.live-operations .filter-item:hover,
.live-operations .area-row:hover,
.live-operations .move-row:hover { background: rgba(255,255,255,.065); }
.live-operations .filter-count,
.live-operations .area-meter,
.live-operations .mix-bar { background: rgba(255,255,255,.13); }
.live-operations .filter-count,
.live-operations .area-count,
.live-operations .move-arrow,
.live-operations .move-berth,
.live-operations .move-time { color: rgba(255,255,255,.56); }
.live-operations .area-name,
.live-operations .move-loc { color: rgba(255,255,255,.88); }
.live-operations .area-code {
  background: var(--ri-signal);
  color: var(--ri-ink);
}
.live-operations .filter-track { background: rgba(255,255,255,.18); }
.live-operations .filter-toggle input:checked + .filter-track { background: var(--ri-signal) !important; }
.live-operations .filter-toggle input:checked + .filter-track::after { background: var(--ri-ink); }
.live-operations .detail-row { color: rgba(255,255,255,.54); border-color: rgba(255,255,255,.1); }
.live-operations .detail-row span:last-child { color: rgba(255,255,255,.9); }
.live-operations .detail-locate-btn { background: var(--ri-signal); border-color: var(--ri-signal); color: var(--ri-ink); }
.live-operations .panel-close-btn { color: white; border-color: rgba(255,255,255,.18); background: var(--ri-ink-2); }
.live-operations .mix-bar { border-radius: 0; }

/* Document/data products */
.product-document .app-header { position: sticky; top: 0; }
.product-document .shell { max-width: 1460px; padding-left: 36px; padding-right: 36px; }
.product-document main.shell { padding-top: 0; }
.product-document .tool-head {
  position: relative;
  margin: 0 -36px 32px;
  padding: 64px 36px 50px;
  display: grid;
  align-items: end;
  background: var(--ri-ink);
  color: var(--ri-white);
  border: 0;
  overflow: hidden;
}
.product-document .tool-head::after {
  content: '';
  position: absolute;
  width: 330px;
  height: 3px;
  right: -40px;
  bottom: 74px;
  background: var(--ri-signal);
  transform: rotate(-13deg);
  transform-origin: right;
}
.product-document .tool-head .eyebrow { color: var(--ri-signal); font-size: 9px; }
.product-document .tool-head h1 {
  margin: 10px 0 16px;
  color: white;
  font-size: clamp(52px, 6.8vw, 94px);
  font-weight: 560;
  line-height: .9;
  letter-spacing: -.065em;
}
.product-document .tool-head .lead { max-width: 760px; color: rgba(255,255,255,.62); font-size: 16px; }
.product-document .dataset-status,
.product-document .validity-card {
  position: relative;
  z-index: 1;
  min-width: 300px;
  padding: 22px;
  background: var(--ri-signal);
  color: var(--ri-ink);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.product-document .dataset-status strong,
.product-document .vc-range { color: var(--ri-ink); }
.product-document .status-line,
.product-document .vc-divider { border-color: rgba(16,19,15,.2); }

/* Signal Desk */
.signal-desk .brand-sub::before { content: '02 / '; color: rgba(255,255,255,.45); }
.signal-desk .search-panel {
  padding: 0;
  border: 1px solid var(--ri-ink);
  border-radius: 0;
  background: var(--ri-white);
  box-shadow: 6px 6px 0 var(--ri-ink);
}
.signal-desk .search-row { padding: 18px; }
.signal-desk .quick-row { margin: 0; padding: 12px 18px; border-top: 1px solid var(--ri-line); }
.signal-desk .search-box,
.signal-desk .mode-tabs,
.signal-desk .quick-chip,
.signal-desk .geo-toggle { border-radius: 0; }
.signal-desk .mode-tab.active { background: var(--ri-blue); color: white; }
.signal-desk .content-grid { gap: 0; border: 1px solid var(--ri-ink); }
.signal-desk .results-panel,
.signal-desk .detail-panel { border: 0; border-radius: 0; box-shadow: none; }
.signal-desk .results-panel { border-right: 1px solid var(--ri-ink); }
.signal-desk .panel-head { background: var(--ri-ink); color: white; border: 0; }
.signal-desk .panel-head .panel-meta { color: rgba(255,255,255,.5); }

/* Timetable Intelligence */
.timetable-intelligence .brand-sub::before { content: '04 / '; color: rgba(255,255,255,.45); }
.timetable-intelligence .wtt-notice { border-radius: 0; border-left: 4px solid var(--ri-orange); background: #fff1eb; }
.timetable-intelligence .filter-panel { border: 1px solid var(--ri-ink); border-radius: 0; box-shadow: 6px 6px 0 var(--ri-ink); }
.timetable-intelligence .filter-row-1 { background: var(--ri-white); }
.timetable-intelligence .filter-row-2 { background: #e5e4dc; border-color: var(--ri-line); }
.timetable-intelligence .search-btn { background: var(--ri-blue); border-color: var(--ri-blue); }
.timetable-intelligence .type-chip.on,
.timetable-intelligence .sort-btn.on { background: var(--ri-ink); color: white; border-color: var(--ri-ink); }
.timetable-intelligence .day-chip.on { background: var(--ri-signal); color: var(--ri-ink); border-color: var(--ri-ink); }
.timetable-intelligence .results-bar { margin-top: 30px; border-color: var(--ri-ink); }
.timetable-intelligence .service-card { border-radius: 0; border-color: var(--ri-line); box-shadow: none; }
.timetable-intelligence .service-card:hover { border-color: var(--ri-blue); box-shadow: 4px 4px 0 var(--ri-blue); transform: translate(-2px,-2px); }

@media (max-width: 1080px) {
  .product-app .app-header .nav { padding: 0 16px; }
  .product-app .brand { min-width: 220px; }
  .product-app .brand img,
  .product-app .brand-mark img { width: 145px; }
  .product-app .nav-btn,
  .product-app .nav-link { padding: 0 11px; font-size: 9px; }
}

@media (max-width: 760px) {
  .product-app .app-header .nav { height: 64px; }
  .product-app .brand { min-width: 0; }
  .product-app .brand img,
  .product-app .brand-mark img { width: 132px; height: 36px; }
  .product-app .brand > span:last-child { display: none; }
  .product-app .nav-actions > a:not(.primary) { display: none; }
  .product-app .nav-btn.primary,
  .product-app .nav-link.primary { display: none; }
  .product-map .side-panel { width: min(88vw, 330px); }
  .live-operations .kpi-strip { min-height: 62px; height: 62px; }
  .live-operations .kpi { padding: 7px 14px; }
  .live-operations .brand-text { display: flex; min-width: 0; }
  .live-operations .brand-name { display: none; }
  .live-operations .brand-sub {
    display: block;
    max-width: 205px;
    font-size: 8px;
    line-height: 1.35;
    white-space: normal;
  }
  .product-document .shell { padding-left: 18px; padding-right: 18px; }
  .product-document .tool-head { margin: 0 -18px 24px; padding: 48px 18px 36px; grid-template-columns: 1fr; }
  .product-document .tool-head h1 { font-size: clamp(42px, 13.2vw, 62px); line-height: .96; letter-spacing: -.06em; }
  .product-document .tool-head .lead { max-width: 34rem; font-size: 14px; line-height: 1.6; }
  .product-document .dataset-status,
  .product-document .validity-card { min-width: 0; margin-top: 30px; }
  .signal-desk .content-grid { border: 0; }
  .signal-desk .results-panel { border: 1px solid var(--ri-ink); }
  .signal-desk .detail-panel { border: 1px solid var(--ri-ink); }
  .timetable-intelligence .wtt-notice { font-size: 11px; line-height: 1.55; }
  .timetable-intelligence .filter-panel { box-shadow: 4px 4px 0 var(--ri-ink); }
}

@media (max-width: 430px) {
  .product-app .app-header .nav { padding-inline: 14px; }
  .product-app .brand img,
  .product-app .brand-mark img { width: 118px; height: 32px; }
  .product-document .tool-head { padding-top: 42px; padding-bottom: 32px; }
  .product-document .tool-head h1 { font-size: clamp(38px, 12.6vw, 52px); }
  .signal-desk .tool-head h1 { font-size: clamp(44px, 14vw, 56px); }
  .product-document .dataset-status,
  .product-document .validity-card { padding: 18px; }
  .signal-desk .search-row { padding: 13px; }
  .signal-desk .quick-row { padding: 10px 13px; overflow-x: auto; flex-wrap: nowrap; }
  .signal-desk .quick-chip { flex: 0 0 auto; }
  .live-operations .kpi { min-width: 122px; }
  .live-operations .kpi-val { font-size: 22px; }
  .network-atlas .side-panel::before { padding: 12px 14px; font-size: 8px; }
}

/* Live Operations / national digital twin */
.live-operations {
  --twin-bg: #090d0b;
  --twin-panel: #111712;
  --twin-panel-2: #161d17;
  --twin-line: rgba(217,255,67,.16);
  --twin-muted: rgba(236,241,233,.52);
}
.live-operations .app-shell { background: var(--twin-bg); }
.live-operations .twin-map-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: #0b100d;
}
.live-operations .twin-map-stage #map { position: absolute; inset: 0; width: 100%; height: 100%; }
.live-operations .leaflet-tile-pane {
  filter: grayscale(.78) invert(.9) brightness(.49) contrast(1.32) saturate(.5) hue-rotate(82deg);
}
.live-operations .leaflet-overlay-pane { filter: saturate(1.2); }
.live-operations .leaflet-control-zoom {
  margin-top: 12px !important;
  border-color: rgba(217,255,67,.35) !important;
}
.live-operations .leaflet-control-zoom a {
  background: rgba(11,16,13,.92) !important;
  color: white !important;
  border-color: rgba(255,255,255,.12) !important;
}
.live-operations .leaflet-control-attribution {
  background: rgba(8,12,9,.74) !important;
  color: rgba(255,255,255,.45) !important;
}
.live-operations .leaflet-control-attribution a { color: rgba(217,255,67,.72) !important; }
.live-operations .train-pill {
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 3px 12px rgba(0,0,0,.5);
}
.live-operations .train-trajectory {
  stroke-dasharray: none;
  filter: drop-shadow(0 0 3px rgba(0,0,0,.75));
}
.track-tooltip {
  background: rgba(16,19,15,.88);
  border: 1px solid rgba(255,255,255,.18);
  color: white;
  font-size: 11px;
  line-height: 1.5;
  padding: 7px 10px;
  border-radius: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
.track-tooltip b { display: block; margin-bottom: 3px; }
.live-operations .uk-national-boundary {
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 3px rgba(217,255,67,.5));
  stroke-linejoin: round;
  stroke-linecap: round;
}
.map-ctrl-group {
  position: absolute;
  z-index: 470;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: row;
  gap: 4px;
}
.map-ctrl-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(217,255,67,.48);
  background: rgba(8,12,9,.9);
  color: var(--ri-signal);
  cursor: pointer;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 16px rgba(0,0,0,.35);
  transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0;
}
.map-ctrl-btn:hover,
.map-ctrl-btn.active {
  color: var(--ri-ink);
  border-color: var(--ri-signal);
  background: var(--ri-signal);
}
.map-ctrl-btn::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  background: rgba(8,12,9,.92);
  color: white;
  font: 500 9px/1 'IBM Plex Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.18);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
}
.map-ctrl-btn:hover::after { opacity: 1; }

/* keep .tracks-dot hidden — no longer used */
.map-tracks-btn .tracks-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.tracks-legend {
  position: absolute;
  z-index: 460;
  bottom: 76px;
  left: 16px;
  background: rgba(16,19,15,.82);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.16);
  padding: 12px 14px;
  color: white;
  display: none;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}
.tracks-legend.visible { display: flex; }
.tracks-legend-title {
  font: 600 9px/1 var(--ri-mono, monospace);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.5);
  margin-bottom: 4px;
}
.tracks-legend-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font: 400 10px/1.3 var(--ri-mono, monospace);
}
.tracks-legend-swatch {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}


.twin-map-head,
.twin-provenance,
.twin-legend,
.twin-ticker {
  position: absolute;
  z-index: 450;
  color: white;
  background: rgba(8,12,9,.9);
  border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
}
.twin-map-head {
  top: 16px; left: 16px; right: 16px;
  min-height: 68px;
  padding: 13px 14px 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-left: 3px solid var(--ri-signal);
}
.twin-map-head > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.twin-overline {
  color: var(--ri-signal);
  font: 500 8px/1 'IBM Plex Mono', monospace;
  letter-spacing: .14em;
}
.twin-map-head strong { font-size: 19px; line-height: 1; font-weight: 560; letter-spacing: -.025em; }
.twin-map-actions { display: flex; gap: 7px; }
.twin-map-actions button {
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid rgba(255,255,255,.22);
  background: transparent;
  color: rgba(255,255,255,.76);
  font: 500 8px/1 'IBM Plex Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.twin-map-actions button:hover { color: var(--ri-ink); border-color: var(--ri-signal); background: var(--ri-signal); }
.twin-map-actions button.active { color: var(--ri-ink); border-color: var(--ri-signal); background: var(--ri-signal); }
.twin-provenance {
  left: 16px; bottom: 50px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
}
.provenance-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ri-signal); box-shadow: 0 0 0 5px rgba(217,255,67,.1); }
.twin-provenance div { display: flex; flex-direction: column; gap: 2px; }
.twin-provenance strong { color: var(--ri-signal); font: 500 8px/1 'IBM Plex Mono', monospace; letter-spacing: .09em; text-transform: uppercase; }
.twin-provenance span:last-child { color: rgba(255,255,255,.58); font-size: 10px; }
.train-inspector {
  position: absolute;
  z-index: 470;
  left: 16px;
  bottom: 50px;
  width: min(290px, calc(100% - 32px));
  max-height: calc(100% - 120px);
  padding: 15px;
  overflow-y: auto;
  color: #f3f6ef;
  background: rgba(12,17,13,.96);
  border: 1px solid rgba(255,255,255,.16);
  border-left: 3px solid var(--ri-signal);
  box-shadow: 0 18px 46px rgba(0,0,0,.48);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.train-inspector.open { opacity: 1; visibility: visible; transform: translateY(0); }
.train-inspector-label {
  margin: 0 34px 12px 0;
  color: var(--ri-signal);
  font: 600 8px/1 'IBM Plex Mono', monospace;
  letter-spacing: .11em;
  text-transform: uppercase;
}
.train-inspector-close {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.16);
  background: transparent;
  color: rgba(255,255,255,.68);
  cursor: pointer;
}
.train-inspector-close:hover { color: var(--ri-ink); border-color: var(--ri-signal); background: var(--ri-signal); }
.train-inspector .detail-hc { font-size: 27px; line-height: 1; }
.train-inspector .detail-type-badge { margin: 7px 0 13px; }
.observed-speed {
  margin: 0 0 12px;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  background: rgba(217,255,67,.075);
  border: 1px solid rgba(217,255,67,.28);
}
.observed-speed > span {
  color: rgba(255,255,255,.62);
  font: 600 8px/1.2 'IBM Plex Mono', monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.observed-speed > strong {
  grid-row: span 2;
  color: var(--ri-signal);
  font: 650 27px/1 'IBM Plex Mono', monospace;
}
.observed-speed > strong small { margin-left: 4px; color: rgba(217,255,67,.72); font-size: 9px; text-transform: uppercase; }
.observed-speed > small { color: rgba(255,255,255,.48); font: 500 8px/1.25 'IBM Plex Mono', monospace; text-transform: uppercase; }
.observed-speed > em {
  grid-column: 1 / -1;
  overflow: hidden;
  color: rgba(255,255,255,.72);
  font: 500 9px/1.35 'IBM Plex Mono', monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.observed-speed > em { display: none; }
.speed-route {
  grid-column: 1 / -1;
  overflow: hidden;
  color: rgba(255,255,255,.72);
  font: 500 9px/1.35 'IBM Plex Mono', monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.observed-speed.unavailable { background: rgba(255,255,255,.035); border-color: rgba(255,255,255,.12); }
.observed-speed.unavailable > strong { color: rgba(255,255,255,.4); }
.train-inspector .detail-row { color: rgba(255,255,255,.6); border-color: rgba(255,255,255,.1); }
.train-inspector .detail-row span:last-child { color: white; }
.train-inspector .detail-locate-btn { min-height: 36px; }
.twin-legend {
  right: 16px; bottom: 50px;
  padding: 4px;
  display: flex;
  gap: 2px;
  font: 500 8px/1 'IBM Plex Mono', monospace;
  text-transform: uppercase;
}
.twin-filter {
  min-height: 29px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255,255,255,.42);
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.twin-filter:hover { color: white; background: rgba(255,255,255,.06); }
.twin-filter.active { color: white; border-color: rgba(255,255,255,.13); background: rgba(255,255,255,.055); }
.twin-filter:not(.active) i { opacity: .28; }
.twin-filter b { min-width: 17px; color: var(--ri-signal); font: 600 8px/1 'IBM Plex Mono', monospace; text-align: right; }
.twin-filter:not(.active) b { color: rgba(255,255,255,.28); }
.twin-legend span { white-space: nowrap; }
.twin-legend i { width: 7px; height: 7px; background: var(--legend); box-shadow: 0 0 8px color-mix(in srgb, var(--legend) 55%, transparent); }
.twin-ticker {
  left: 0; right: 0; bottom: 0;
  height: 36px;
  display: flex;
  align-items: center;
  border-width: 1px 0 0;
  box-shadow: none;
  font: 500 9px/1 'IBM Plex Mono', monospace;
  letter-spacing: .035em;
}
.ticker-label { align-self: stretch; display: flex; align-items: center; padding: 0 13px; background: var(--ri-signal); color: var(--ri-ink); text-transform: uppercase; font-weight: 700; }
#twinTicker { padding: 0 14px; color: rgba(255,255,255,.72); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.twin-rail {
  position: relative;
  z-index: 210;
  width: 300px;
  flex: 0 0 300px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--twin-panel);
  color: #f0f4ed;
  border-left: 1px solid rgba(255,255,255,.12);
  box-shadow: -12px 0 34px rgba(0,0,0,.22);
}
.twin-rail-head {
  min-height: 66px;
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--twin-line);
}
.twin-rail-head div { display: flex; flex-direction: column; gap: 3px; }
.twin-rail-head span { color: var(--ri-signal); font: 500 8px/1 'IBM Plex Mono', monospace; letter-spacing: .13em; text-transform: uppercase; }
.twin-rail-head strong { font-size: 15px; font-weight: 560; }
.twin-module { padding: 14px 16px 15px; border-bottom: 1px solid rgba(255,255,255,.09); }
.twin-module-title { margin-bottom: 12px; color: rgba(255,255,255,.52); font: 500 8px/1 'IBM Plex Mono', monospace; letter-spacing: .12em; text-transform: uppercase; }
.twin-module-title span { margin-right: 7px; color: var(--ri-signal); }
.health-primary { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.health-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.health-dot.waiting { background: #f59e0b; box-shadow: 0 0 0 5px rgba(245,158,11,.1); }
.health-dot.good { background: var(--ri-signal); box-shadow: 0 0 0 5px rgba(217,255,67,.1); }
.health-dot.degraded { background: #ff8a4c; box-shadow: 0 0 0 5px rgba(255,138,76,.1); }
.health-primary div { display: flex; flex-direction: column; gap: 3px; }
.health-primary strong { font-size: 15px; font-weight: 560; }
.health-primary small { color: var(--twin-muted); font-size: 10px; }
.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(255,255,255,.1); }
.health-grid div { min-width: 0; padding: 9px 8px; }
.health-grid div + div { border-left: 1px solid rgba(255,255,255,.1); }
.health-grid span { display: block; margin-bottom: 6px; color: var(--twin-muted); font: 500 7px/1 'IBM Plex Mono', monospace; letter-spacing: .09em; text-transform: uppercase; }
.health-grid strong { display: block; overflow: hidden; color: white; font: 600 13px/1 'IBM Plex Mono', monospace; white-space: nowrap; text-overflow: ellipsis; }
.freshness-bar { height: 6px; display: flex; overflow: hidden; background: rgba(255,255,255,.08); }
.freshness-bar i { display: block; height: 100%; transition: width .35s ease; }
#freshNow { background: var(--ri-signal); }
#freshAgeing { background: #f59e0b; }
#freshStale { background: #f06445; }
.freshness-key { margin-top: 10px; display: grid; gap: 7px; }
.freshness-key div { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; color: var(--twin-muted); font-size: 10px; }
.freshness-key i { width: 6px; height: 6px; }
.freshness-key i.fresh { background: var(--ri-signal); }
.freshness-key i.ageing { background: #f59e0b; }
.freshness-key i.stale { background: #f06445; }
.freshness-key strong { color: white; font: 500 10px/1 'IBM Plex Mono', monospace; }
.twin-sectors { flex: 1 1 auto; min-height: 170px; overflow: hidden; }
.twin-area-list { display: grid; gap: 5px; }
.twin-area-row {
  width: 100%;
  display: grid;
  grid-template-columns: 35px 1fr 58px 23px;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: white;
  text-align: left;
  cursor: pointer;
}
.twin-area-row:hover { background: rgba(255,255,255,.045); }
.twin-area-code { color: var(--ri-signal); font: 600 10px/1 'IBM Plex Mono', monospace; letter-spacing: .08em; }
.twin-area-name { overflow: hidden; color: rgba(255,255,255,.72); font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.twin-area-meter { height: 3px; background: rgba(255,255,255,.1); }
.twin-area-meter i { display: block; height: 100%; background: var(--ri-signal); }
.twin-area-count { color: white; font: 500 9px/1 'IBM Plex Mono', monospace; text-align: right; }
.twin-transitions { flex: 0 0 auto; }
.twin-event-list { display: grid; gap: 2px; }
.twin-event { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 8px; padding: 5px 0; }
.twin-event strong { font: 600 9px/1 'IBM Plex Mono', monospace; letter-spacing: .06em; }
.twin-event span { overflow: hidden; color: rgba(255,255,255,.62); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.twin-event time { color: var(--twin-muted); font: 500 8px/1 'IBM Plex Mono', monospace; }
.twin-empty { padding: 8px 0; color: var(--twin-muted); font-size: 10px; }
.twin-rail-foot { padding: 9px 16px; color: rgba(255,255,255,.36); font: 500 7px/1.4 'IBM Plex Mono', monospace; letter-spacing: .05em; }
.twin-rail-foot span { margin-right: 6px; color: var(--ri-signal); }
.live-operations .map-wait { left: 0; right: 0; }
.live-operations .detail-locate-btn.secondary {
  margin-top: 12px;
  background: transparent;
  border-color: rgba(217,255,67,.55);
  color: var(--ri-signal);
}
.live-operations .detail-locate-btn.secondary:hover {
  background: rgba(217,255,67,.08);
  border-color: var(--ri-signal);
  color: var(--ri-signal);
}

.live-operations.wallboard .app-header { display: none; }
.live-operations.wallboard .kpi-strip { min-height: 68px; height: 68px; }
.live-operations.wallboard .map-wait { left: 0; }
.live-operations.wallboard .twin-map-head strong { font-size: 22px; }

@media (max-width: 1380px) {
  .twin-rail { display: none; }
  .live-operations .map-wait { right: 0; }
}
@media (max-width: 980px) {
  .twin-legend { left: 12px; right: 12px; overflow-x: auto; scrollbar-width: none; }
  .twin-legend::-webkit-scrollbar { display: none; }
  .twin-filter { flex: 0 0 auto; }
  .twin-map-head { right: 12px; }
  .twin-map-actions button:nth-child(2) { display: none; }
}
@media (max-width: 680px) {
  .live-operations .map-wait { left: 0; }
  .twin-map-head { top: 10px; left: 10px; right: 10px; min-height: 54px; padding: 9px 10px; }
  .twin-map-head strong { font-size: 14px; }
  .twin-map-actions button { min-height: 30px; padding: 0 8px; }
  .twin-map-actions button:last-child { display: none; }
  .twin-provenance { left: 10px; right: 10px; bottom: 96px; }
  .train-selected .twin-provenance { display: none; }
  .train-inspector { left: 10px; bottom: 96px; width: min(290px, calc(100% - 20px)); max-height: calc(100% - 180px); }
  .twin-provenance span:last-child { font-size: 9px; }
  .twin-legend { left: 10px; right: 10px; bottom: 46px; }
  .live-operations .leaflet-control-zoom { margin-top: 79px !important; }
  .twin-ticker { height: 32px; }
  .ticker-label { padding-inline: 9px; }
  #twinTicker { padding-inline: 9px; font-size: 8px; }
}
@media (max-width: 680px) {
  .map-ctrl-group { top: 10px; left: 10px; }
  .map-ctrl-btn { width: 32px; height: 32px; }
  .live-operations .leaflet-control-zoom { margin-top: 10px !important; }
}
