/* ══════════════════════════════════════════
   DESIGN TOKENS
══════════════════════════════════════════ */
:root {
  --red: #DB0030;
  --bg: #0a0a0b;
  --bg2: #111114;
  --bg3: #1a1a1f;
  --bg4: #222228;
  --border: #2a2a32;
  --border2: #38383f;
  --text: #e8e8f0;
  --muted: #6b6b80;
  --green: #22c55e;
  --yellow: #eab308;
  --orange: #f97316;
  --mono: 'IBM Plex Mono', monospace;
  --sans: 'IBM Plex Sans', sans-serif;
}

/* ══════════════════════════════════════════
   RESET & BASE
══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ══════════════════════════════════════════
   HEADER
══════════════════════════════════════════ */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 11, 0.94);
  backdrop-filter: blur(12px);
  z-index: 100;
}

.logo {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hpill {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
}

/* ══════════════════════════════════════════
   LAYOUT
══════════════════════════════════════════ */
main {
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}

/* ══════════════════════════════════════════
   MODE SWITCHER
══════════════════════════════════════════ */
.mode-row {
  display: flex;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  width: fit-content;
}

.mode-btn {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 8px 20px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--muted);
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  border-right: 1px solid var(--border);
}

.mode-btn:last-child {
  border-right: none;
}

.mode-btn.active {
  background: var(--red);
  color: #fff;
}

.mode-btn:not(.active):hover {
  background: var(--bg3);
  color: var(--text);
}

/* ══════════════════════════════════════════
   SEARCH CARD
══════════════════════════════════════════ */
.search-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 28px;
}

.search-grid {
  display: grid;
  gap: 10px;
  align-items: end;
}

.sg-train {
  grid-template-columns: 1fr auto auto;
}

.sg-route {
  grid-template-columns: 1fr 28px 1fr auto auto;
}

@media (max-width: 700px) {
  .sg-train,
  .sg-route {
    grid-template-columns: 1fr;
  }

  .route-sep {
    display: none !important;
  }
}

.field-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.field-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ══════════════════════════════════════════
   COMBOBOX
══════════════════════════════════════════ */
.combo-wrap {
  position: relative;
}

.combo-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 500;
  padding: 11px 34px 11px 12px;
  outline: none;
  transition: border-color 0.15s;
  cursor: pointer;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-input:focus {
  border-color: var(--red);
}

.combo-input::placeholder {
  color: var(--muted);
  font-weight: 400;
  font-size: 13px;
}

.combo-arrow {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  font-size: 10px;
  transition: transform 0.15s;
}

.combo-wrap.open .combo-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.combo-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 7px;
  z-index: 300;
  max-height: 260px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

.combo-wrap.open .combo-dropdown {
  display: block;
}

.combo-search-row {
  position: sticky;
  top: 0;
  padding: 8px 8px 6px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}

.combo-search-row input {
  width: 100%;
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
}

.combo-search-row input:focus {
  border-color: var(--red);
}

.combo-search-row input::placeholder {
  color: var(--muted);
}

.combo-list {
  padding: 4px;
}

.combo-opt {
  padding: 8px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  transition: background 0.1s;
}

.combo-opt:hover,
.combo-opt.focused {
  background: var(--bg4);
}

.combo-opt.selected {
  background: rgba(219, 0, 48, 0.1);
  color: var(--red);
}

.opt-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
}

.combo-opt.selected .opt-badge {
  background: rgba(219, 0, 48, 0.2);
  color: var(--red);
}

.opt-main {
  flex: 1;
  min-width: 0;
}

.opt-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combo-empty {
  padding: 14px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
}

/* ══════════════════════════════════════════
   ROUTE SEPARATOR
══════════════════════════════════════════ */
.route-sep {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 13px;
  color: var(--muted);
  font-size: 15px;
}

/* ══════════════════════════════════════════
   DATE RANGE TRIGGER
══════════════════════════════════════════ */
.date-trigger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.date-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 11px 14px;
  cursor: pointer;
  white-space: nowrap;
  text-align: left;
  transition: border-color 0.15s;
  outline: none;
}

.date-btn:hover {
  border-color: var(--border2);
}

.date-btn.active,
.date-btn:focus {
  border-color: var(--red);
}

.date-btn .db-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-btn .db-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.date-btn .db-range {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.date-btn .db-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

/* ══════════════════════════════════════════
   SEARCH BUTTON
══════════════════════════════════════════ */
.search-btn {
  background: var(--red);
  border: none;
  border-radius: 6px;
  color: #fff;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  align-self: flex-end;
  height: 44px;
}

.search-btn:hover {
  background: #bf002a;
}

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

/* ══════════════════════════════════════════
   DATE PICKER OVERLAY
══════════════════════════════════════════ */
.dp-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 500;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.dp-overlay.open {
  display: flex;
}

.dp-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}

.dp-panel {
  position: relative;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
  min-width: 320px;
  max-width: 680px;
  width: 100%;
}

/* Preset row */
.dp-presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.dp-preset {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 11px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  color: var(--muted);
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}

.dp-preset:hover {
  color: var(--text);
  border-color: var(--border2);
}

.dp-preset.active {
  background: rgba(219, 0, 48, 0.12);
  border-color: var(--red);
  color: var(--red);
}

/* Month grid */
.dp-calendars {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: center;
}

.dp-cal {
  flex: 1;
  min-width: 220px;
}

.dp-cal-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.dp-nav {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 9px;
  transition: border-color 0.12s, color 0.12s;
}

.dp-nav:hover {
  border-color: var(--border2);
  color: var(--text);
}

.dp-month-label {
  flex: 1;
  text-align: center;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.dp-dow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
  text-transform: uppercase;
}

.dp-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  border-radius: 5px;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s, color 0.1s;
  border: 1px solid transparent;
}

.dp-day:hover:not(.dp-day-empty):not(.dp-day-disabled) {
  background: var(--bg4);
  border-color: var(--border);
}

.dp-day-empty {
  cursor: default;
}

.dp-day-disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.4;
}

.dp-day-in-range {
  background: rgba(219, 0, 48, 0.08);
}

.dp-day-start,
.dp-day-end {
  background: var(--red) !important;
  color: #fff !important;
  border-radius: 5px;
}

.dp-day-start.dp-day-in-range {
  border-radius: 5px 0 0 5px;
}

.dp-day-end.dp-day-in-range {
  border-radius: 0 5px 5px 0;
}

.dp-day-today {
  border-color: var(--border2) !important;
}

/* Picker footer */
.dp-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.dp-selected-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  flex: 1;
}

.dp-selected-label strong {
  color: var(--text);
}

.dp-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.12s;
}

.dp-cancel:hover {
  border-color: var(--border2);
}

.dp-apply {
  background: var(--red);
  border: none;
  border-radius: 5px;
  color: #fff;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.15s;
}

.dp-apply:hover {
  background: #bf002a;
}

/* ══════════════════════════════════════════
   RECENTS
══════════════════════════════════════════ */
.recents {
  margin-bottom: 28px;
}

.recents-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}

.recents-list {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.rc-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 11px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  transition: border-color 0.12s;
}

.rc-chip:hover {
  border-color: var(--border2);
}

.rc-badge {
  background: var(--red);
  color: #fff;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  font-weight: 600;
}

/* ══════════════════════════════════════════
   LOADING
══════════════════════════════════════════ */
.loading {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 48px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.loading.visible {
  display: flex;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ══════════════════════════════════════════
   RESULTS SECTION
══════════════════════════════════════════ */
#results {
  display: none;
}

#results.visible {
  display: block;
}

/* Train / result header */
.train-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.train-badge {
  display: inline-flex;
  align-items: center;
  background: var(--red);
  color: #fff;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  padding: 8px 15px;
  border-radius: 6px;
  flex-shrink: 0;
  letter-spacing: 0.01em;
}

.train-meta {
  flex: 1;
  min-width: 160px;
}

.train-route {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 3px;
}

.train-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.verdict {
  margin-left: auto;
  text-align: right;
  flex-shrink: 0;
}

.verdict-score {
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 3px;
}

.verdict-label {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Color utility classes */
.c-good  { color: var(--green); }
.c-ok    { color: var(--yellow); }
.c-bad   { color: var(--orange); }
.c-ugly  { color: var(--red); }

/* ══════════════════════════════════════════
   KPI GRID
══════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.kpi-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 15px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent, var(--border));
}

.kpi-value {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-label {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.kpi-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}

/* ══════════════════════════════════════════
   TABS
══════════════════════════════════════════ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.tab {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 9px 15px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: color 0.15s, border-color 0.15s;
  text-transform: uppercase;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--red);
}

.tab-pane {
  display: none;
}

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

/* ══════════════════════════════════════════
   CHART SECTIONS
══════════════════════════════════════════ */
.chart-sec {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 12px;
}

.chart-title {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
}

/* Bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 108px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  position: relative;
  cursor: default;
}

.bar-tip {
  display: none;
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
}

.bar:hover .bar-tip {
  display: block;
}

.bar-lbl {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
}

/* Donut chart */
.donut-row {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 160px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  color: var(--muted);
  flex: 1;
}

.legend-val {
  font-family: var(--mono);
  font-size: 12px;
}

/* Heatmap */
.heatmap {
  display: grid;
  grid-template-columns: 44px repeat(7, 1fr);
  gap: 3px;
}

.hm-hdr {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  padding: 2px 0;
}

.hm-row {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 7px;
}

.hm-cell {
  border-radius: 3px;
  height: 26px;
  cursor: default;
  position: relative;
  transition: transform 0.1s;
}

.hm-cell:hover {
  transform: scale(1.12);
  z-index: 3;
}

.hm-tip {
  display: none;
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg4);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.hm-cell:hover .hm-tip {
  display: block;
}

/* Sparkline */
.sparkline {
  width: 100%;
  height: 72px;
  overflow: visible;
}

/* ══════════════════════════════════════════
   STOPS TABLE
══════════════════════════════════════════ */
.stops-table {
  width: 100%;
  border-collapse: collapse;
}

.stops-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.stops-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.stops-table tr:last-child td {
  border-bottom: none;
}

.stops-table tr:hover td {
  background: var(--bg3);
}

/* Delay badges */
.dl-badge {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-block;
}

.dl0 { background: rgba(34, 197, 94, 0.1); color: var(--green); }
.dl1 { background: rgba(234, 179, 8, 0.1);  color: var(--yellow); }
.dl2 { background: rgba(249, 115, 22, 0.1); color: var(--orange); }
.dl3 { background: rgba(219, 0, 48, 0.1);   color: var(--red); }

/* ══════════════════════════════════════════
   FOOTER
══════════════════════════════════════════ */
footer {
  border-top: 1px solid var(--border);
  padding: 18px 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

footer a {
  color: var(--muted);
  text-decoration: none;
}

footer a:hover {
  color: var(--text);
}

/* ══════════════════════════════════════════
   TRIPS TABLE
══════════════════════════════════════════ */
.trips-table {
  width: 100%;
  border-collapse: collapse;
}

.trips-table th {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.trips-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.trips-table tr:last-child td {
  border-bottom: none;
}

.trips-table tr:hover td {
  background: var(--bg3);
}

.trip-time {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.trip-station {
  font-size: 13px;
}

.trip-status {
  font-family: var(--mono);
  font-size: 11px;
}

.trip-status.dl0 { color: var(--green); }
.trip-status.dl1 { color: var(--yellow); }
.trip-status.dl2 { color: var(--orange); }
.trip-status.dl3 { color: var(--red); }

.table-msg {
  padding: 24px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
}

/* ══════════════════════════════════════════
   MAP TAB
══════════════════════════════════════════ */
.map-wrap {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#map {
  width: 100%;
  height: 480px;
}

@media (max-width: 640px) {
  #map { height: 320px; }
}

/* Custom markers */
.map-marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  cursor: pointer;
  transition: transform 0.15s;
}

.map-marker:hover {
  transform: scale(1.5);
}

.map-marker.target {
  width: 16px;
  height: 16px;
}

.map-marker.pulse {
  animation: marker-pulse 1.4s ease-out infinite;
}

@keyframes marker-pulse {
  0%   { box-shadow: 0 0 0 0   rgba(219, 0, 48, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(219, 0, 48, 0); }
  100% { box-shadow: 0 0 0 0   rgba(219, 0, 48, 0); }
}

/* Ranking / info panel over map */
.map-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(17, 17, 20, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  max-width: 260px;
  z-index: 10;
  font-family: var(--mono);
  font-size: 11px;
}

.map-panel-title {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.map-panel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.1s;
  line-height: 1.4;
}

.map-panel-row:hover {
  background: var(--bg4);
}

.map-panel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.map-panel-label {
  flex: 1;
  color: var(--text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-panel-pct {
  font-size: 11px;
  flex-shrink: 0;
}

/* No-data overlay */
.map-no-data {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 11, 0.7);
  backdrop-filter: blur(4px);
  z-index: 10;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

/* MapLibre popup theming */
.maplibregl-popup-content {
  background: var(--bg2) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 10px 12px !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
  font-family: var(--mono);
  font-size: 12px;
  min-width: 140px;
}

.maplibregl-popup-tip {
  border-top-color: var(--border) !important;
  border-bottom-color: var(--border) !important;
}

.maplibregl-popup-close-button {
  color: var(--muted) !important;
  font-size: 14px !important;
  padding: 2px 6px !important;
}

.maplibregl-popup-close-button:hover {
  color: var(--text) !important;
  background: none !important;
}
