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

:root {
  --bg: #0d0d0f;
  --surface: #141418;
  --surface2: #1c1c22;
  --border: #2a2a34;
  --text: #e8e0d0;
  --text-muted: #5c7a7a;
  --accent: #c89010;
  --accent-hover: #a87800;
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --amber: #c89010;
  --header-h: 52px;
  --panel-w: 340px;
  --history-w: 300px;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.app-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  position: relative;
  z-index: 200;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo { font-size: 22px; }

.app-header h1 {
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
  position: relative;
  padding-bottom: 2px;
}

.app-header h1::after {
  content: '';
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  border-bottom: 1px solid var(--accent);
  opacity: 0.5;
}

.tab-nav {
  display: flex;
  gap: 4px;
  margin: 0 auto;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Oswald', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  transition: all 0.15s;
}

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

.tab-btn.active {
  color: var(--accent);
  background: transparent;
  border-color: transparent;
  border-bottom-color: var(--accent);
  border-bottom-width: 2px;
}

.header-right { flex-shrink: 0; }

.live-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--green);
}

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

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

/* ============================================================
   MAIN / TAB PANES
   ============================================================ */
.app-main {
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

.tab-pane { height: 100%; }
.tab-pane[hidden] { display: none; }

/* ============================================================
   MAP TAB LAYOUT
   ============================================================ */
.map-layout {
  display: flex;
  height: 100%;
  position: relative;
}

#map-container {
  flex: 1;
  position: relative;
  min-width: 0;
}

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

/* Map toolbar overlay */
.map-toolbar {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 500;
  display: flex;
  gap: 8px;
  align-items: center;
}

.toolbar-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.15s;
  box-shadow: var(--shadow);
}

.toolbar-btn:hover { background: var(--surface2); }
.toolbar-btn.active { border-color: var(--amber); color: var(--amber); }

.layer-toggle {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  box-shadow: var(--shadow);
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.toggle-label input { cursor: pointer; accent-color: var(--accent); }
.toggle-label input[type="checkbox"] { accent-color: var(--accent); }

.toggle-label select {
  appearance: none;
  background: rgba(18, 16, 14, 0.96);
  border: 1px solid rgba(255, 178, 44, 0.22);
  color: #f5e8ce;
  border-radius: 7px;
  padding: 4px 24px 4px 8px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
}

.toggle-label select:focus {
  outline: none;
  border-color: rgba(255, 198, 98, 0.72);
}

.position-filter-label {
  margin-top: 6px;
}

/* Log mode banner */
.log-mode-banner {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  background: rgba(245, 158, 11, 0.95);
  color: #1c1400;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.log-mode-banner button {
  background: rgba(0,0,0,0.15);
  border: none;
  padding: 2px 10px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: #1c1400;
}

/* ============================================================
   HISTORY SIDEBAR
   ============================================================ */
.history-sidebar {
  width: var(--history-w);
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-title {
  font-family: 'Oswald', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 14px 16px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.history-date {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 16px;
  flex-shrink: 0;
}

.history-cards {
  flex: 0 0 auto;
  overflow: visible;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-cards::-webkit-scrollbar { width: 4px; }
.history-cards::-webkit-scrollbar-track { background: transparent; }
.history-cards::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.history-loading {
  text-align: center;
  color: var(--text-muted);
  padding: 24px;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.history-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  transition: border-left-color 0.15s, border-left-width 0.15s;
}

.history-card:hover {
  border-left: 2px solid var(--accent);
}

.history-card-year {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.history-card-text {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}

.history-card-thumb {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 8px;
  display: block;
}

.history-card-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.history-card-type.event { background: #2a1c00; color: var(--accent); }
.history-card-type { font-family: 'Space Mono', monospace; }

.history-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 24px 16px;
  font-size: 13px;
  line-height: 1.6;
}

/* ============================================================
   TRAIN DETAIL PANEL
   ============================================================ */
.train-panel {
  position: fixed;
  inset: 0;
  z-index: 600;
  pointer-events: none;
}

.train-panel[aria-hidden="false"] { pointer-events: auto; }

.panel-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.3s;
}

.train-panel[aria-hidden="false"] .panel-backdrop { opacity: 1; }

.panel-content {
  position: absolute;
  top: 0;
  right: 0;
  width: var(--panel-w);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.panel-content::-webkit-scrollbar { width: 4px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.train-panel[aria-hidden="false"] .panel-content {
  transform: translateX(0);
}

.panel-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 1;
}

.panel-close:hover { background: var(--surface2); border-color: var(--red); color: var(--red); }

#panelBody {
  padding: 20px 16px 24px;
  flex: 1;
}

/* Panel content styles */
.panel-route-name {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.panel-train-number {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 12px;
}

.panel-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.badge-speed { background: #1e3a5f; color: #93c5fd; }
.badge-speed-unknown { background: #3a2a0e; color: #ffd693; }
.badge-ontime { background: #2a1c00; color: var(--accent); }
.badge-delay { background: #450a0a; color: #fca5a5; }
.badge-early { background: #14532d; color: #86efac; }
.badge-position-live {
  background: rgba(34, 197, 94, 0.16);
  color: #b4f4c8;
  border: 1px solid rgba(74, 222, 128, 0.28);
}

.badge-position-estimated {
  background: rgba(245, 158, 11, 0.16);
  color: #ffe1a3;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-position-station {
  background: rgba(56, 189, 248, 0.16);
  color: #c8efff;
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.panel-section {
  margin-bottom: 16px;
}

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

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px solid var(--surface2);
  font-size: 13px;
}

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

.panel-row-label { color: var(--text-muted); }
.panel-row-value {
  font-weight: 500;
  max-width: 62%;
  text-align: right;
}

.panel-note {
  margin-top: 8px;
  color: #ccb88f;
  font-size: 11px;
  line-height: 1.5;
}

/* Route progress bar */
.route-progress {
  margin-top: 8px;
}

.progress-bar-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin: 6px 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
}

/* Stops list */
.stops-list {
  margin-top: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.stop-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  font-size: 12px;
}

.stop-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 4px;
  flex-shrink: 0;
}

.stop-dot.passed { background: var(--border); }
.stop-dot.next { background: var(--accent); box-shadow: 0 0 0 2px rgba(200,144,16,0.3); }
.stop-dot.future { background: var(--surface2); border: 1px solid var(--border); }

.stop-info { flex: 1; }
.stop-name { font-weight: 500; }
.stop-time { color: var(--text-muted); font-size: 11px; }
.stop-late { color: var(--red); font-size: 11px; }

/* ============================================================
   SPOTTER TAB LAYOUT
   ============================================================ */
.spotter-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: 100%;
  overflow: hidden;
}

.spotter-form-panel {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 16px;
  overflow-y: auto;
}

.spotter-form-panel h2,
.spotter-list-panel h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 16px;
}

.spotter-form { display: flex; flex-direction: column; gap: 12px; }

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.form-row input,
.form-row textarea,
.form-row select {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  resize: vertical;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-row input::placeholder,
.form-row textarea::placeholder { color: var(--text-muted); }

.coords-row .coord-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.coord-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.form-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ============================================================
   SPOTTER LIST
   ============================================================ */
.spotter-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 16px;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
  flex-shrink: 0;
}

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

.list-controls input[type="search"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 12px;
  font-family: inherit;
  width: 180px;
}

.list-controls input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}

.spotter-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.spotter-list::-webkit-scrollbar { width: 4px; }
.spotter-list::-webkit-scrollbar-track { background: transparent; }
.spotter-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.spotter-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  transition: border-color 0.15s;
}

.spotter-entry:hover { border-color: var(--amber); }

.entry-main { min-width: 0; }

.entry-loco {
  font-size: 18px;
  font-weight: 800;
  color: var(--amber);
  line-height: 1;
}

.entry-railroad {
  font-size: 13px;
  font-weight: 500;
  margin: 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.entry-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.entry-notes {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.entry-photo {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  margin-top: 8px;
  border: 1px solid rgba(255, 178, 44, 0.3);
}

.entry-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

.entry-delete {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  transition: all 0.15s;
}

.entry-delete:hover { border-color: var(--red); color: var(--red); background: rgba(239,68,68,0.1); }

.empty-state {
  color: var(--text-muted);
  text-align: center;
  padding: 40px 20px;
  font-size: 13px;
}

/* ============================================================
   RAILCAMS TAB
   ============================================================ */
.railcams-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  height: 100%;
  overflow: hidden;
}

.railcam-list-panel {
  background:
    linear-gradient(180deg, rgba(18, 16, 14, 0.98), rgba(11, 10, 10, 0.98)),
    radial-gradient(420px 260px at 0% 0%, rgba(255, 178, 44, 0.08), transparent 72%);
  border-right: 1px solid rgba(255, 178, 44, 0.2);
  padding: 18px 14px;
  overflow-y: auto;
}

.railcam-list-panel h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffcc73;
  margin-bottom: 4px;
}

.railcams-subtitle {
  color: #cbb88f;
  font-size: 12px;
  margin-bottom: 12px;
}

.railcam-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.railcam-filter-chip {
  border: 1px solid rgba(255, 178, 44, 0.28);
  border-radius: 999px;
  background: rgba(25, 22, 19, 0.9);
  color: #e8d6b2;
  padding: 4px 10px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.railcam-filter-chip:hover {
  border-color: rgba(255, 178, 44, 0.6);
}

.railcam-filter-chip.active {
  background: linear-gradient(180deg, #ffd98f, #ffb22c);
  color: #2b1800;
  border-color: rgba(255, 194, 88, 0.74);
}

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

.railcam-item {
  background: linear-gradient(180deg, rgba(26, 23, 21, 0.94), rgba(19, 17, 16, 0.94));
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 10px;
  color: #f2e6cd;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.railcam-item:hover {
  border-color: rgba(255, 178, 44, 0.55);
  box-shadow: var(--glow-soft);
}

.railcam-item.active {
  border-color: rgba(255, 198, 98, 0.78);
  background: linear-gradient(180deg, rgba(55, 39, 13, 0.65), rgba(29, 22, 12, 0.75));
}

.railcam-item-title {
  font-size: 14px;
  font-weight: 700;
}

.railcam-item-region {
  color: #d8c39b;
  font-size: 12px;
}

.railcam-status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(255, 178, 44, 0.22);
  color: #e5cf9d;
  background: rgba(41, 35, 22, 0.72);
}

.railcam-status-badge.status-live {
  border-color: rgba(45, 206, 137, 0.55);
  background: rgba(9, 69, 45, 0.62);
  color: #abffd6;
}

.railcam-status-badge.status-ended {
  border-color: rgba(255, 178, 44, 0.6);
  background: rgba(89, 53, 10, 0.56);
  color: #ffd998;
}

.railcam-status-badge.status-offline,
.railcam-status-badge.status-blocked {
  border-color: rgba(255, 95, 95, 0.45);
  background: rgba(75, 20, 20, 0.55);
  color: #ffc3c3;
}

.railcam-item-quality {
  color: #bda980;
  font-size: 11px;
}

.railcam-item-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.railcam-item-tags em {
  font-style: normal;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 178, 44, 0.25);
  border-radius: 999px;
  padding: 2px 7px;
  color: #f0d59c;
}

.railcam-main-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
}

.railcam-player-shell {
  border: 1px solid rgba(255, 178, 44, 0.24);
  border-radius: 12px;
  background: rgba(12, 11, 10, 0.9);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 460px;
  display: flex;
  flex-direction: column;
}

.railcam-player-header {
  padding: 12px 12px 10px;
  border-bottom: 1px solid rgba(255, 178, 44, 0.2);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.railcam-kicker {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #d4bf93;
}

.railcam-meta {
  color: #d9c7a0;
  font-size: 12px;
}

.railcam-actions {
  display: flex;
  gap: 6px;
}

.railcam-link-btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.railcam-player {
  width: 100%;
  flex: 1;
  min-height: 340px;
  border: 0;
  background: #0a0a0a;
}

.railcam-fallback {
  margin: 14px;
  border: 1px solid rgba(255, 178, 44, 0.32);
  border-radius: 10px;
  background: rgba(36, 29, 20, 0.78);
  padding: 12px;
}

.railcam-fallback-title {
  color: #ffe1a9;
  font-weight: 700;
}

.railcam-fallback-copy {
  color: #d7c298;
  font-size: 12px;
  margin-top: 4px;
}

.railcam-fallback-actions {
  display: flex;
  gap: 8px;
  margin-top: 9px;
}

.railcam-notes {
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 178, 44, 0.16);
  color: #c8b589;
  font-size: 12px;
}

.freight-intel-panel {
  border: 1px solid rgba(255, 178, 44, 0.24);
  border-radius: 12px;
  background: rgba(16, 14, 13, 0.92);
  padding: 12px;
}

.freight-intel-panel h3 {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffd58c;
}

.freight-intel-subtitle {
  color: #ccb991;
  font-size: 12px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.freight-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.freight-signal-card {
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 10px;
  background: rgba(25, 22, 19, 0.9);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.freight-signal-card:hover {
  border-color: rgba(255, 178, 44, 0.58);
  box-shadow: var(--glow-soft);
}

.freight-signal-title {
  color: #ffe7ba;
  font-size: 12px;
  font-weight: 700;
}

.freight-signal-detail {
  color: #cbb892;
  font-size: 11px;
}

.freight-spotter-summary {
  margin-top: 10px;
  border-top: 1px solid rgba(255, 178, 44, 0.17);
  padding-top: 10px;
}

.freight-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.freight-stat {
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 8px;
  padding: 8px;
  background: rgba(22, 20, 17, 0.88);
}

.freight-stat-label {
  display: block;
  color: #cbb892;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.freight-stat-value {
  display: block;
  color: #ffe9bf;
  font-size: 18px;
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.04em;
}

.freight-summary-note {
  margin-top: 8px;
  color: #cfbb8f;
  font-size: 12px;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s;
  flex: 1;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.15s;
}

.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  width: 360px;
  box-shadow: var(--shadow);
}

.modal h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
}

.modal-location {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
}

/* ============================================================
   LEAFLET OVERRIDES
   ============================================================ */
/* Shift ORM orange → amber-gold, thin the visual weight */
.rail-overlay-tiles {
  filter: invert(1) sepia(1) hue-rotate(-30deg) saturate(2) brightness(1.3);
  mix-blend-mode: screen;
}

.leaflet-control-attribution {
  background: rgba(13, 13, 15, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}

.leaflet-control-attribution a { color: var(--accent) !important; }

.leaflet-bar a {
  background: var(--surface) !important;
  color: var(--text) !important;
  border-color: var(--border) !important;
}

.leaflet-bar a:hover { background: var(--surface2) !important; }

.leaflet-top.leaflet-left .leaflet-control-zoom {
  margin-top: 96px;
}

.sidebar-toggle-btn {
  position: absolute;
  top: 50%;
  right: calc(var(--history-w) - 17px);
  transform: translateY(-50%);
  z-index: 560;
  height: 124px;
  width: 34px;
  border: none;
  border-left: 1px solid rgba(255, 178, 44, 0.2);
  border-right: 1px solid rgba(255, 178, 44, 0.2);
  background: linear-gradient(180deg, rgba(23, 21, 19, 0.98), rgba(12, 12, 12, 0.98));
  color: #e9d8b5;
  font-family: 'Rajdhani', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  transition: right 0.24s ease, background 0.2s ease, color 0.2s ease;
  border-radius: 10px;
}

.sidebar-toggle-btn:hover {
  color: #ffdca0;
  background: linear-gradient(180deg, rgba(44, 37, 29, 0.98), rgba(22, 19, 16, 0.98));
}

.sidebar-toggle-icon {
  font-size: 13px;
  line-height: 1;
}

.sidebar-toggle-label {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  line-height: 1;
}

.history-sidebar {
  transition: width 0.24s ease, opacity 0.24s ease, flex-basis 0.24s ease;
}

.map-layout.sidebar-collapsed .history-sidebar {
  width: 0;
  flex-basis: 0;
  opacity: 0;
  border-left: 0;
  pointer-events: none;
}

.map-layout.sidebar-collapsed .sidebar-toggle-btn {
  right: 6px;
}

/* ============================================================
   CUSTOM TRAIN MARKERS — tooltip
   ============================================================ */
.train-tooltip {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: normal;
  line-height: 1.45;
  max-width: 240px;
}

.tooltip-position {
  display: inline-flex;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tooltip-position-live {
  background: rgba(34, 197, 94, 0.16);
  color: #abf3c0;
}

.tooltip-position-estimated {
  background: rgba(245, 158, 11, 0.16);
  color: #ffe2a4;
}

.tooltip-position-station {
  background: rgba(56, 189, 248, 0.16);
  color: #c7efff;
}

.leaflet-tooltip.leaflet-tooltip-bottom::before {
  border-bottom-color: var(--border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .history-sidebar { display: none; }

  .railcams-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .railcam-list-panel {
    border-right: none;
    border-bottom: 1px solid rgba(255, 178, 44, 0.2);
    max-height: 42vh;
  }

  .freight-signal-grid {
    grid-template-columns: 1fr;
  }

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

  .spotter-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .spotter-form-panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 40vh;
  }
}

@media (max-width: 600px) {
  :root { --panel-w: 100vw; }

  .app-header h1 { display: none; }

  .tab-nav { margin: 0; }

  .modal { width: calc(100vw - 32px); }

  .railcam-player-header {
    flex-direction: column;
  }

  .railcam-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .railcam-fallback-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   SCROLLBARS (global)
   ============================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }

/* ============================================================
   VISUAL OVERHAUL V2 (black + amber operations center)
   ============================================================ */
:root {
  --bg: #070707;
  --surface: #101011;
  --surface2: #191817;
  --surface3: #252220;
  --border: #3a3229;
  --text: #efe6d2;
  --text-muted: #baa57a;
  --accent: #ffb22c;
  --accent-hover: #ffcb67;
  --accent-soft: #ffe2a3;
  --amber-deep: #7a4d00;
  --green: #4ade80;
  --yellow: #facc15;
  --red: #fb7185;
  --radius: 10px;
  --header-h: 64px;
  --panel-w: 380px;
  --history-w: 332px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  --glow-soft: 0 0 0 1px rgba(255, 178, 44, 0.25), 0 0 20px rgba(255, 178, 44, 0.15);
}

html,
body {
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  letter-spacing: 0.01em;
  background:
    radial-gradient(1200px 600px at 20% -15%, rgba(255, 178, 44, 0.1), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(255, 122, 24, 0.08), transparent 65%),
    linear-gradient(180deg, #090909 0%, #060606 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(transparent 96%, rgba(255, 178, 44, 0.03) 100%);
  background-size: 100% 4px;
  opacity: 0.45;
  z-index: 1;
}

.app-header,
.app-main {
  position: relative;
  z-index: 2;
}

.app-header {
  height: var(--header-h);
  padding: 0 18px;
  background:
    linear-gradient(180deg, rgba(27, 24, 20, 0.96), rgba(16, 15, 14, 0.98)),
    linear-gradient(90deg, rgba(255, 178, 44, 0.12), transparent 18%, transparent 82%, rgba(255, 178, 44, 0.12));
  border-bottom: 1px solid rgba(255, 178, 44, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.logo {
  font-size: 20px;
  filter: drop-shadow(0 0 8px rgba(255, 178, 44, 0.4));
}

.app-header h1 {
  font-size: 1.52rem;
  letter-spacing: 0.22em;
  text-shadow: 0 0 16px rgba(255, 178, 44, 0.32);
}

.app-header h1::after {
  border-bottom-color: rgba(255, 178, 44, 0.62);
}

.tab-nav {
  gap: 8px;
}

.tab-btn {
  border: 1px solid rgba(255, 178, 44, 0.15);
  border-bottom-width: 1px;
  background: rgba(255, 178, 44, 0.04);
  color: #d9c49b;
  padding: 7px 16px;
  border-radius: 999px;
  font-family: 'Rajdhani', sans-serif;
  font-size: 14px;
  letter-spacing: 0.09em;
}

.tab-btn:hover {
  color: var(--accent-soft);
  border-color: rgba(255, 178, 44, 0.35);
  background: rgba(255, 178, 44, 0.13);
}

.tab-btn.active {
  color: #111;
  border-color: rgba(255, 194, 88, 0.7);
  border-bottom-color: rgba(255, 194, 88, 0.7);
  background: linear-gradient(180deg, #ffc967, #ffb22c);
  box-shadow: 0 0 16px rgba(255, 178, 44, 0.34);
}

.live-indicator {
  font-family: 'Space Mono', monospace;
  color: #81f5aa;
  padding: 5px 8px;
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 999px;
  background: rgba(9, 31, 16, 0.6);
}

.live-indicator.stale {
  color: #ffd38c;
  border-color: rgba(250, 204, 21, 0.4);
  background: rgba(63, 45, 9, 0.55);
}

.live-indicator.stale .pulse-dot {
  background: #facc15;
}

#map-container::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 350;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 178, 44, 0.08), transparent 36%),
    radial-gradient(circle at 90% 12%, rgba(255, 178, 44, 0.06), transparent 34%),
    linear-gradient(180deg, transparent 72%, rgba(8, 8, 8, 0.25));
}

.map-toolbar {
  top: 14px;
  left: 14px;
  gap: 10px;
}

.toolbar-btn,
.layer-toggle {
  background: rgba(12, 12, 12, 0.88);
  border: 1px solid rgba(255, 178, 44, 0.28);
  backdrop-filter: blur(2px);
}

.toolbar-btn {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: var(--shadow);
}

.toolbar-btn:hover {
  color: var(--accent-soft);
  border-color: rgba(255, 178, 44, 0.48);
  box-shadow: var(--glow-soft);
}

.toolbar-btn.active {
  color: #1a1201;
  border-color: rgba(255, 194, 88, 0.75);
  background: linear-gradient(180deg, #ffd98f, #ffb22c);
}

.toggle-label {
  color: #d8c39b;
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  letter-spacing: 0.03em;
}

.overlay-opacity {
  margin-top: 6px;
  justify-content: space-between;
}

.overlay-opacity input[type="range"] {
  width: 82px;
}

.log-mode-banner {
  background: linear-gradient(180deg, #ffd88a, #ffb22c);
  color: #2a1800;
  border: 1px solid rgba(255, 244, 220, 0.4);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.history-sidebar {
  width: var(--history-w);
  flex-basis: var(--history-w);
  background:
    linear-gradient(180deg, rgba(21, 19, 17, 0.98), rgba(13, 13, 13, 0.99)),
    radial-gradient(500px 360px at 20% 0%, rgba(255, 178, 44, 0.09), transparent 70%);
  border-left: 1px solid rgba(255, 178, 44, 0.2);
}

.sidebar-title {
  font-size: 15px;
  padding: 16px 18px 10px;
  border-bottom: 1px solid rgba(255, 178, 44, 0.2);
  text-shadow: 0 0 10px rgba(255, 178, 44, 0.22);
}

.history-date {
  padding: 8px 18px;
  font-family: 'Space Mono', monospace;
  color: #dfcda5;
}

.history-cards {
  padding: 10px;
  gap: 10px;
}

.history-card {
  background: linear-gradient(180deg, rgba(36, 32, 28, 0.9), rgba(28, 24, 22, 0.9));
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 12px;
}

.history-card:hover {
  border-left: 1px solid rgba(255, 178, 44, 0.2);
  border-color: rgba(255, 178, 44, 0.55);
  box-shadow: var(--glow-soft);
}

.history-card-year {
  font-size: 20px;
}

.history-card-text {
  color: #f2e4c7;
}

.history-source {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  color: #ffd389;
  text-decoration: none;
}

.history-source:hover {
  text-decoration: underline;
}

.history-card-type.event {
  background: rgba(122, 77, 0, 0.34);
  color: #ffd28d;
  border: 1px solid rgba(255, 178, 44, 0.2);
}

.panel-content {
  width: var(--panel-w);
  background:
    linear-gradient(180deg, rgba(23, 21, 19, 0.98), rgba(14, 13, 12, 0.98)),
    radial-gradient(420px 200px at 100% 0%, rgba(255, 178, 44, 0.08), transparent 75%);
  border-left: 1px solid rgba(255, 178, 44, 0.26);
}

.panel-close {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 178, 44, 0.25);
}

.panel-close:hover {
  background: rgba(255, 99, 99, 0.12);
  border-color: var(--red);
}

#panelBody {
  padding: 24px 18px 24px;
}

.panel-route-name {
  font-family: 'Space Mono', monospace;
  font-size: 12px;
  color: #dccca8;
}

.panel-train-number {
  color: #fff2d7;
  text-shadow: 0 0 14px rgba(255, 178, 44, 0.2);
}

.badge {
  border: 1px solid transparent;
}

.badge-speed {
  background: rgba(30, 58, 95, 0.45);
  color: #b8d8ff;
  border-color: rgba(147, 197, 253, 0.3);
}

.badge-ontime {
  background: rgba(122, 77, 0, 0.3);
  color: #ffd28d;
  border-color: rgba(255, 178, 44, 0.28);
}

.badge-delay {
  background: rgba(89, 19, 35, 0.35);
  color: #ffc0cc;
  border-color: rgba(251, 113, 133, 0.35);
}

.badge-early {
  background: rgba(21, 83, 45, 0.3);
  color: #b6f2ca;
  border-color: rgba(74, 222, 128, 0.3);
}

.badge-speed-unknown {
  background: rgba(122, 77, 0, 0.3);
  color: #ffd99a;
  border-color: rgba(255, 178, 44, 0.28);
}

.badge-position-live {
  background: rgba(21, 83, 45, 0.3);
  color: #b6f2ca;
  border-color: rgba(74, 222, 128, 0.3);
}

.badge-position-estimated {
  background: rgba(89, 53, 10, 0.34);
  color: #ffe0a1;
  border-color: rgba(255, 178, 44, 0.3);
}

.badge-position-station {
  background: rgba(14, 83, 110, 0.3);
  color: #c8efff;
  border-color: rgba(56, 189, 248, 0.32);
}

.panel-section-title {
  font-family: 'Space Mono', monospace;
  color: #d9c6a0;
}

.panel-row {
  border-bottom-color: rgba(255, 178, 44, 0.12);
}

.panel-row-value {
  color: #fff0d2;
  max-width: 62%;
  text-align: right;
}

.panel-note {
  color: #ccb88f;
}

.progress-bar-track {
  background: rgba(255, 178, 44, 0.15);
  border: 1px solid rgba(255, 178, 44, 0.2);
}

.progress-bar-fill {
  background: linear-gradient(90deg, #ffcb67, #ff9f1a);
  box-shadow: 0 0 12px rgba(255, 178, 44, 0.45);
}

.spotter-form-panel {
  background:
    linear-gradient(180deg, rgba(18, 17, 16, 0.98), rgba(13, 12, 12, 0.98)),
    radial-gradient(460px 300px at 0% 0%, rgba(255, 178, 44, 0.08), transparent 70%);
  border-right: 1px solid rgba(255, 178, 44, 0.2);
}

.spotter-form-panel h2,
.spotter-list-panel h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffcc73;
}

.form-row label {
  font-family: 'Space Mono', monospace;
  color: #cfbb8e;
}

.form-row input,
.form-row textarea,
.form-row select,
.list-controls input[type="search"] {
  background: rgba(20, 18, 17, 0.95);
  border-color: rgba(255, 178, 44, 0.26);
  color: #f7ead1;
}

.form-row input:focus,
.form-row textarea:focus,
.list-controls input[type="search"]:focus {
  border-color: rgba(255, 198, 98, 0.75);
  box-shadow: var(--glow-soft);
}

.spotter-list-panel {
  background: linear-gradient(180deg, rgba(13, 13, 13, 0.98), rgba(8, 8, 8, 0.98));
}

.spotter-entry {
  background: linear-gradient(180deg, rgba(26, 23, 21, 0.94), rgba(19, 17, 16, 0.94));
  border: 1px solid rgba(255, 178, 44, 0.22);
  border-radius: 12px;
}

.spotter-entry:hover {
  border-color: rgba(255, 178, 44, 0.65);
  box-shadow: var(--glow-soft);
}

.entry-loco {
  font-family: 'Oswald', sans-serif;
  color: #ffca72;
  letter-spacing: 0.05em;
}

.entry-meta,
.entry-notes,
.coord-hint,
.empty-state {
  color: #c9b793;
}

.btn-primary {
  background: linear-gradient(180deg, #ffd98f, #ffb22c);
  color: #2e1b00;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.btn-primary:hover {
  background: linear-gradient(180deg, #ffe5b0, #ffcb67);
}

.btn-secondary {
  background: rgba(20, 18, 17, 0.92);
  border-color: rgba(255, 178, 44, 0.3);
  color: #ead9b6;
}

.btn-secondary:hover {
  border-color: rgba(255, 178, 44, 0.7);
  color: #fff0d2;
}

.btn-secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: rgba(161, 161, 170, 0.35);
  color: #b7b7bb;
}

.modal-overlay {
  backdrop-filter: blur(2px);
}

.modal {
  background:
    linear-gradient(180deg, rgba(24, 22, 20, 0.98), rgba(15, 14, 13, 0.98)),
    radial-gradient(340px 160px at 10% 0%, rgba(255, 178, 44, 0.11), transparent 75%);
  border: 1px solid rgba(255, 178, 44, 0.35);
  width: 390px;
}

.modal h3 {
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd084;
}

.modal-location {
  border-color: rgba(255, 178, 44, 0.24);
  color: #f0e2c8;
}

.rail-overlay-tiles {
  filter: invert(1) sepia(1) hue-rotate(-24deg) saturate(2.25) brightness(1.2) contrast(1.05);
  mix-blend-mode: screen;
  opacity: 0.94;
}

.leaflet-control-attribution {
  border-top: 1px solid rgba(255, 178, 44, 0.16);
}

.leaflet-bar a {
  border-color: rgba(255, 178, 44, 0.3) !important;
  color: #f3e4c8 !important;
}

.leaflet-bar a:hover {
  color: var(--accent-soft) !important;
  background: rgba(255, 178, 44, 0.14) !important;
}

.train-tooltip {
  background: rgba(14, 13, 13, 0.95);
  border-color: rgba(255, 178, 44, 0.34);
  font-family: 'Space Mono', monospace;
  color: #fff0d2;
}

.tab-pane.active .map-layout,
.tab-pane.active .spotter-layout,
.history-card,
.spotter-entry,
.panel-content {
  animation: fadeUp 0.38s ease-out;
}

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

@media (max-width: 1100px) {
  :root {
    --history-w: 300px;
    --panel-w: 350px;
  }
}

@media (max-width: 900px) {
  :root {
    --header-h: 70px;
  }

  .app-header {
    flex-wrap: wrap;
    align-content: center;
    row-gap: 6px;
    padding: 8px 12px;
  }

  .tab-nav {
    order: 3;
    width: 100%;
    justify-content: center;
  }

  .header-right {
    margin-left: auto;
  }

  .map-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
  }

  .leaflet-top.leaflet-left .leaflet-control-zoom {
    margin-top: 140px;
  }

  .sidebar-toggle-btn {
    display: none;
  }
}

@media (max-width: 600px) {
  :root {
    --panel-w: 100vw;
  }

  .app-header {
    padding: 8px 10px;
    gap: 10px;
  }

  .app-header h1 {
    display: block;
    font-size: 1.1rem;
    letter-spacing: 0.14em;
  }

  .tab-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .toolbar-btn,
  .layer-toggle {
    width: 100%;
  }

  .log-mode-banner {
    width: calc(100% - 20px);
    white-space: normal;
    text-align: center;
    border-radius: 14px;
    justify-content: center;
  }

  .spotter-list-panel,
  .spotter-form-panel {
    padding: 16px 12px;
  }

  .list-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .list-controls {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .list-controls input[type="search"],
  .list-controls .btn-secondary {
    width: 100%;
  }

  .modal {
    width: calc(100vw - 20px);
    padding: 18px;
  }
}

.map-hud {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 520;
  width: 220px;
  background: rgba(12, 11, 10, 0.88);
  border: 1px solid rgba(255, 178, 44, 0.32);
  border-radius: 12px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
  overflow: hidden;
}

.hud-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffe2a3;
  padding: 9px 11px 7px;
  border-bottom: 1px solid rgba(255, 178, 44, 0.2);
}

.hud-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.hud-metric {
  padding: 8px 10px;
  border-right: 1px solid rgba(255, 178, 44, 0.14);
  border-bottom: 1px solid rgba(255, 178, 44, 0.14);
}

.hud-metric:nth-child(2n) {
  border-right: none;
}

.hud-label {
  display: block;
  color: #ccb88f;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-value {
  display: block;
  color: #fff1d1;
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  line-height: 1.1;
  margin-top: 2px;
}

.hud-position-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(255, 178, 44, 0.14);
}

.hud-position-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.hud-position-pill strong {
  font-size: 11px;
}

.hud-position-pill.live {
  background: rgba(34, 197, 94, 0.15);
  color: #adf3c2;
  border-color: rgba(74, 222, 128, 0.3);
}

.hud-position-pill.estimated {
  background: rgba(245, 158, 11, 0.15);
  color: #ffe0a0;
  border-color: rgba(245, 158, 11, 0.3);
}

.hud-position-pill.station {
  background: rgba(56, 189, 248, 0.15);
  color: #caefff;
  border-color: rgba(56, 189, 248, 0.3);
}

.train-marker-icon {
  background: transparent;
}

@media (max-width: 900px) {
  .map-hud {
    top: auto;
    bottom: 16px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

.map-legend {
  position: absolute;
  top: 126px;
  left: 14px;
  z-index: 520;
  background: rgba(11, 10, 9, 0.9);
  border: 1px solid rgba(255, 178, 44, 0.3);
  border-radius: 10px;
  padding: 10px 12px;
  width: 228px;
  box-shadow: var(--shadow);
}

.legend-title {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #ffdc99;
  margin-bottom: 8px;
}

.legend-section + .legend-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 178, 44, 0.16);
}

.legend-subtitle {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #cdb88f;
  margin-bottom: 6px;
}

.legend-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: #e9d8b5;
  margin: 4px 0;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-swatch.fast { background: #4ade80; }
.legend-swatch.medium { background: #facc15; }
.legend-swatch.slow { background: #fb7185; }
.legend-swatch.unknown { background: #c89010; }
.legend-swatch.position-live {
  background: #4ade80;
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  border-radius: 0;
}

.legend-swatch.position-estimated {
  background: #fbbf24;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  border-radius: 0;
}

.legend-swatch.position-station {
  background: #7dd3fc;
  border-radius: 2px;
}

.feature-card {
  margin: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 178, 44, 0.24);
  border-radius: 10px;
  background: rgba(22, 20, 17, 0.8);
}

.feature-card.is-actionable {
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.feature-card.is-actionable:hover,
.feature-card.is-actionable:focus-visible {
  border-color: rgba(255, 178, 44, 0.56);
  box-shadow: 0 0 0 1px rgba(255, 178, 44, 0.18), 0 8px 18px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
  outline: none;
}

.feature-card.is-actionable[aria-disabled="true"] {
  cursor: default;
}

.feature-card.is-actionable[aria-disabled="true"]:hover,
.feature-card.is-actionable[aria-disabled="true"]:focus-visible {
  transform: none;
  box-shadow: none;
  border-color: rgba(255, 178, 44, 0.24);
}

.feature-card h3 {
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd58c;
  margin-bottom: 6px;
}

.feature-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.feature-card-head h3 {
  margin-bottom: 0;
}

.feature-kicker {
  color: #bfa987;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
}

.feature-main {
  color: #f5e8ce;
  font-size: 15px;
  font-weight: 600;
}

.feature-meta {
  color: #d2bf95;
  font-size: 12px;
}

.map-search-label {
  display: block;
  margin-bottom: 6px;
  color: #bfa987;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
}

.map-search-input {
  width: 100%;
  background: rgba(16, 15, 14, 0.96);
  border: 1px solid rgba(255, 178, 44, 0.26);
  color: #f6e9cf;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 8px;
}

.map-search-input:focus {
  outline: none;
  border-color: rgba(255, 198, 98, 0.7);
  box-shadow: 0 0 0 1px rgba(255, 198, 98, 0.16);
}

.map-search-results,
.watch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.map-search-results {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 2px;
}

.map-search-results::-webkit-scrollbar,
.watch-list::-webkit-scrollbar {
  width: 4px;
}

.map-search-results::-webkit-scrollbar-thumb,
.watch-list::-webkit-scrollbar-thumb {
  background: rgba(255, 178, 44, 0.24);
  border-radius: 999px;
}

.map-result-row,
.watch-item {
  border: 1px solid rgba(255, 178, 44, 0.16);
  border-radius: 9px;
  background: rgba(14, 13, 11, 0.72);
  padding: 9px 10px;
}

.map-result-copy {
  min-width: 0;
}

.map-result-title,
.watch-item-title {
  color: #f4e5c4;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.35;
}

.map-result-train {
  color: #ffd08b;
}

.map-result-meta,
.watch-item-meta,
.watch-item-status {
  color: #c6b18a;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 3px;
}

.map-result-actions,
.watch-item-actions {
  display: flex;
  gap: 6px;
  margin-top: 9px;
}

.watch-item-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.btn-inline {
  padding: 5px 9px;
  font-size: 11px;
  line-height: 1.2;
}

.btn-inline.is-active {
  border-color: rgba(255, 191, 70, 0.42);
  color: #ffd08b;
  background: rgba(255, 191, 70, 0.08);
}

.empty-state.compact {
  font-size: 12px;
  padding: 4px 0;
}

.checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.checklist li {
  color: #ccb991;
  font-size: 12px;
  position: relative;
  padding-left: 18px;
}

.checklist li::before {
  content: '○';
  position: absolute;
  left: 0;
  color: #9b8660;
}

.checklist li.done {
  color: #f3e3c4;
}

.checklist li.done::before {
  content: '●';
  color: #ffbf46;
}

.provider-status-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.provider-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.provider-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.provider-name {
  color: #e7d8ba;
}

.provider-meta {
  color: #bda881;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.provider-pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.provider-pill.ok {
  background: rgba(34, 197, 94, 0.2);
  color: #9df7bf;
  border-color: rgba(74, 222, 128, 0.35);
}

.provider-pill.pending {
  background: rgba(148, 163, 184, 0.12);
  color: #d7e1eb;
  border-color: rgba(148, 163, 184, 0.28);
}

.provider-pill.cached {
  background: rgba(245, 158, 11, 0.18);
  color: #ffd59b;
  border-color: rgba(251, 191, 36, 0.34);
}

.provider-pill.throttled {
  background: rgba(250, 204, 21, 0.18);
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.35);
}

.provider-pill.warn {
  background: rgba(251, 113, 133, 0.18);
  color: #ffbdc8;
  border-color: rgba(251, 113, 133, 0.35);
}

.provider-pill.idle {
  background: rgba(250, 204, 21, 0.16);
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.3);
}

.provider-pill.off {
  background: rgba(148, 163, 184, 0.15);
  color: #c9d4df;
  border-color: rgba(148, 163, 184, 0.35);
}

.provider-config-row {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.provider-config-row input {
  width: 100%;
  background: rgba(18, 16, 14, 0.96);
  border: 1px solid rgba(255, 178, 44, 0.25);
  color: #f6e8cd;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 12px;
}

.provider-config-row input:focus {
  outline: none;
  border-color: rgba(255, 198, 98, 0.75);
  box-shadow: var(--glow-soft);
}

.provider-config-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.list-subtitle {
  color: #bda881;
  font-size: 12px;
  margin-bottom: 8px;
}

.panel-header-block {
  margin-bottom: 10px;
}

.panel-status-chip {
  margin-top: 8px;
}

.panel-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.panel-chip.good {
  background: rgba(34, 197, 94, 0.18);
  color: #9df7bf;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.panel-chip.caution {
  background: rgba(234, 179, 8, 0.18);
  color: #ffe38f;
  border: 1px solid rgba(250, 204, 21, 0.35);
}

.panel-chip.late {
  background: rgba(244, 63, 94, 0.2);
  color: #ffb8c6;
  border: 1px solid rgba(251, 113, 133, 0.35);
}

.panel-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.panel-action-btn {
  flex: 1;
}

/* ============================================================
   LIBRARY TAB
   ============================================================ */
.library-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100%;
  overflow: hidden;
}

.library-filter-panel {
  background: linear-gradient(180deg, rgba(20, 18, 16, 0.98), rgba(12, 12, 12, 0.98));
  border-right: 1px solid rgba(255, 178, 44, 0.22);
  padding: 18px 14px;
  overflow-y: auto;
}

.library-filter-panel h2 {
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd08b;
}

.library-subtitle {
  margin-top: 6px;
  color: #c8b289;
  font-size: 12px;
  line-height: 1.5;
}

.library-search-wrap {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.library-search-wrap label,
.library-filter-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #bfa987;
  font-family: 'Space Mono', monospace;
}

.library-search-wrap input {
  width: 100%;
  background: rgba(16, 15, 14, 0.96);
  border: 1px solid rgba(255, 178, 44, 0.26);
  color: #f6e9cf;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.library-search-wrap input:focus {
  outline: none;
  border-color: rgba(255, 196, 89, 0.75);
  box-shadow: var(--glow-soft);
}

.library-filter-group {
  margin-top: 13px;
}

.library-chip-group {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

#libraryOperatorFilters {
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

#libraryOperatorFilters::-webkit-scrollbar {
  width: 4px;
}

#libraryOperatorFilters::-webkit-scrollbar-thumb {
  background: rgba(255, 178, 44, 0.24);
  border-radius: 999px;
}

.library-chip {
  border: 1px solid rgba(255, 178, 44, 0.25);
  background: rgba(28, 24, 21, 0.85);
  color: #dfc79b;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.library-chip:hover {
  color: #ffe2b0;
  border-color: rgba(255, 196, 89, 0.55);
}

.library-chip.active {
  background: linear-gradient(180deg, #ffd98f, #ffb22c);
  color: #2b1800;
  border-color: rgba(255, 225, 160, 0.85);
  font-weight: 700;
}

.library-filter-actions {
  margin-top: 15px;
}

.library-main-panel {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.library-section {
  background: linear-gradient(180deg, rgba(21, 19, 17, 0.98), rgba(13, 12, 12, 0.98));
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 12px;
  padding: 12px;
}

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

.library-section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-section-header h3 {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd08a;
}

.library-result-count {
  font-size: 11px;
  color: #d8c39f;
  font-family: 'Space Mono', monospace;
}

.library-category-overview {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.library-category-card {
  border: 1px solid rgba(255, 178, 44, 0.25);
  border-radius: 10px;
  background: rgba(27, 24, 20, 0.9);
  color: #e9d9ba;
  padding: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}

.library-category-card:hover {
  border-color: rgba(255, 196, 89, 0.55);
  box-shadow: var(--glow-soft);
}

.library-category-name {
  font-size: 12px;
}

.library-category-count {
  font-family: 'Oswald', sans-serif;
  font-size: 20px;
  line-height: 1;
  color: #ffd08a;
}

.library-resource-grid {
  column-count: 3;
  column-gap: 10px;
}

.resource-card {
  background: rgba(24, 21, 18, 0.96);
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  break-inside: avoid;
  margin: 0 0 10px;
}

.resource-card-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-compare-btn {
  margin-left: auto;
  border: 1px solid rgba(255, 178, 44, 0.28);
  background: rgba(39, 30, 20, 0.92);
  color: #f0d7a6;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.resource-compare-btn:hover {
  border-color: rgba(255, 196, 89, 0.56);
  color: #ffe2b0;
}

.resource-compare-btn.active {
  background: linear-gradient(180deg, #ffd98f, #ffb22c);
  color: #2b1800;
  border-color: rgba(255, 225, 160, 0.85);
  font-weight: 700;
}

.resource-type-pill,
.resource-format-pill {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid rgba(255, 178, 44, 0.26);
  color: #f2dfba;
  background: rgba(46, 36, 22, 0.8);
}

.resource-card h4 {
  font-size: 15px;
  color: #fff0d3;
  line-height: 1.3;
}

.resource-summary {
  color: #d6c2a0;
  font-size: 12px;
  line-height: 1.5;
}

.resource-meta {
  color: #bda884;
  font-size: 11px;
}

.tech-visual-shell {
  margin: 10px 0 6px;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 17, 15, 0.97), rgba(13, 12, 12, 0.94)),
    radial-gradient(240px 110px at 100% 0%, rgba(125, 211, 252, 0.06), transparent 72%);
}

.tech-visual-blueprint {
  background:
    linear-gradient(180deg, rgba(14, 19, 26, 0.97), rgba(9, 12, 18, 0.95)),
    radial-gradient(220px 120px at 100% 0%, rgba(96, 165, 250, 0.08), transparent 72%);
}

.tech-visual-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 0;
  flex-wrap: wrap;
}

.tech-visual-controls,
.atlas-visual-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 0;
}

.tech-visual-mode-btn,
.atlas-visual-mode-btn {
  appearance: none;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 999px;
  background: rgba(29, 24, 20, 0.82);
  color: #d9c6a0;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  min-height: 28px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.tech-visual-mode-btn:hover,
.atlas-visual-mode-btn:hover {
  border-color: rgba(255, 208, 139, 0.3);
  color: #ffebbf;
}

.tech-visual-mode-btn.active,
.atlas-visual-mode-btn.active {
  background: linear-gradient(180deg, rgba(255, 215, 151, 0.16), rgba(255, 178, 44, 0.12));
  border-color: rgba(255, 208, 139, 0.45);
  color: #fff1cf;
}

.tech-visual-kicker,
.tech-visual-badge,
.tech-visual-note,
.tech-legend-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  line-height: 1.35;
}

.tech-visual-kicker {
  border: 1px solid rgba(255, 178, 44, 0.18);
  background: rgba(38, 30, 21, 0.75);
  color: #ffe2ad;
  font-family: 'Space Mono', monospace;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tech-visual-badge {
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: rgba(16, 35, 48, 0.62);
  color: #cdefff;
}

.tech-visual-blueprint .tech-visual-badge {
  border-color: rgba(96, 165, 250, 0.28);
  background: rgba(19, 42, 71, 0.7);
}

.tech-visual-svg {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 5 / 3;
}

.tech-visual-bg {
  fill: rgba(10, 10, 11, 0.96);
  stroke: rgba(255, 178, 44, 0.14);
  stroke-width: 1.1;
}

.tech-visual-blueprint .tech-visual-bg {
  fill: rgba(7, 11, 18, 0.98);
  stroke: rgba(96, 165, 250, 0.18);
}

.tech-engine-block,
.tech-engine-module,
.tech-engine-cylinder,
.tech-engine-manifold,
.tech-engine-lower,
.tech-engine-shaft,
.tech-engine-piston,
.tech-engine-flow,
.tech-engine-callout {
  vector-effect: non-scaling-stroke;
}

.tech-engine-block {
  fill: rgba(255, 178, 44, 0.08);
  stroke: rgba(255, 208, 139, 0.22);
  stroke-width: 1.8;
}

.tech-engine-block-ge {
  fill: rgba(245, 158, 11, 0.07);
}

.tech-engine-block-op {
  fill: rgba(74, 222, 128, 0.06);
}

.tech-engine-module {
  fill: rgba(56, 189, 248, 0.18);
  stroke: rgba(191, 232, 255, 0.5);
  stroke-width: 1.6;
}

.tech-engine-module-green {
  fill: rgba(74, 222, 128, 0.16);
  stroke: rgba(187, 247, 208, 0.55);
}

.tech-engine-module-cyan {
  fill: rgba(96, 165, 250, 0.16);
  stroke: rgba(191, 219, 254, 0.5);
}

.tech-engine-module-blue {
  fill: rgba(56, 189, 248, 0.12);
  stroke: rgba(125, 211, 252, 0.44);
}

.tech-engine-cylinder {
  fill: rgba(255, 208, 139, 0.22);
  stroke: rgba(255, 232, 189, 0.5);
  stroke-width: 1.2;
}

.tech-engine-cylinder-muted {
  fill: rgba(255, 178, 44, 0.12);
}

.tech-engine-cylinder-op {
  fill: rgba(56, 189, 248, 0.12);
}

.tech-engine-manifold,
.tech-engine-lower,
.tech-engine-shaft {
  fill: rgba(255, 242, 212, 0.14);
  stroke: rgba(255, 242, 212, 0.32);
  stroke-width: 1.1;
}

.tech-engine-manifold-ge {
  fill: rgba(191, 219, 254, 0.14);
}

.tech-engine-shaft-upper {
  fill: rgba(255, 208, 139, 0.2);
}

.tech-engine-shaft-lower {
  fill: rgba(56, 189, 248, 0.18);
}

.tech-engine-piston {
  fill: rgba(255, 232, 189, 0.88);
  stroke: rgba(255, 178, 44, 0.38);
  stroke-width: 1;
}

.tech-engine-flow {
  fill: none;
  stroke: rgba(74, 222, 128, 0.9);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 6 7;
}

.tech-engine-flow-secondary {
  stroke: rgba(96, 165, 250, 0.9);
}

.tech-engine-callout {
  fill: none;
  stroke: rgba(255, 232, 189, 0.72);
  stroke-width: 1.2;
  stroke-linecap: round;
}

.tech-engine-label,
.tech-blueprint-label {
  fill: #f5e5c2;
  font-family: 'Space Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.02em;
}

.tech-engine-label-muted {
  fill: #c1ae89;
}

.tech-engine-label-small {
  font-size: 6px;
}

.tech-visual-layer-blueprint .tech-blueprint-outline,
.tech-visual-layer-blueprint .tech-blueprint-line,
.tech-visual-layer-blueprint .tech-blueprint-callout {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.tech-blueprint-outline {
  stroke: rgba(147, 197, 253, 0.88);
  stroke-width: 1.7;
}

.tech-blueprint-line {
  stroke: rgba(191, 219, 254, 0.75);
  stroke-width: 1.2;
  stroke-dasharray: 4 4;
}

.tech-blueprint-callout {
  stroke: rgba(96, 165, 250, 0.9);
  stroke-width: 1.1;
}

.tech-flow-air,
.tech-flow-exhaust,
.tech-flow-fuel,
.tech-flow-electric {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-width: 2.8;
  stroke-dasharray: 7 7;
}

.tech-flow-air {
  stroke: rgba(125, 211, 252, 0.95);
}

.tech-flow-exhaust {
  stroke: rgba(255, 174, 66, 0.95);
}

.tech-flow-fuel {
  stroke: rgba(255, 226, 138, 0.95);
}

.tech-flow-electric {
  stroke: rgba(74, 222, 128, 0.95);
}

.tech-flow-label {
  fill: #d5efff;
  font-family: 'Space Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.02em;
}

.tech-flow-label-muted {
  fill: #f2dcc0;
}

.tech-flow-label-exhaust {
  fill: #ffd4a7;
}

.tech-flow-label-fuel {
  fill: #fff1ba;
}

.tech-flow-label-electric {
  fill: #d8ffd7;
}

.tech-visual-caption,
.tech-visual-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 0;
}

.tech-visual-legend {
  padding: 8px 10px 10px;
}

.tech-visual-note {
  border: 1px solid rgba(255, 178, 44, 0.15);
  background: rgba(31, 25, 20, 0.72);
  color: #d9c7a5;
}

.tech-visual-note-accent {
  color: #fff0d2;
  border-color: rgba(255, 208, 139, 0.22);
}

.tech-legend-chip {
  border: 1px solid rgba(255, 178, 44, 0.14);
  background: rgba(24, 21, 18, 0.76);
  color: #ead9b6;
}

.tech-tone-gold {
  border-color: rgba(255, 208, 139, 0.22);
  color: #ffe0a8;
}

.tech-tone-amber {
  border-color: rgba(251, 191, 36, 0.22);
  color: #fcd88b;
}

.tech-tone-cyan {
  border-color: rgba(125, 211, 252, 0.22);
  color: #cceeff;
}

.tech-tone-green {
  border-color: rgba(134, 239, 172, 0.22);
  color: #d7ffd9;
}

.tech-tone-blue {
  border-color: rgba(96, 165, 250, 0.22);
  color: #d8e6ff;
}

.resource-spec-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(33, 28, 23, 0.8);
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 8px;
  padding: 7px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.spec-key {
  color: #d2bc94;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
}

.spec-value {
  color: #f4e3c3;
  text-align: right;
}

.resource-dossier {
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 8px;
  background: rgba(29, 25, 20, 0.85);
  padding: 7px 8px;
}

.resource-dossier summary {
  cursor: pointer;
  color: #ffd28f;
  font-weight: 600;
}

.resource-dossier p {
  margin-top: 6px;
  font-size: 12px;
  color: #ddc8a4;
  line-height: 1.45;
}

.resource-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 7px;
}

.resource-media-card {
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 8px;
  background: rgba(31, 27, 22, 0.86);
  padding: 6px;
}

.resource-media-card img {
  width: 100%;
  height: 118px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(255, 178, 44, 0.18);
  background: rgba(12, 12, 12, 0.7);
}

.media-caption,
.media-credit,
.media-license {
  margin-top: 4px;
  font-size: 10px;
  color: #ccb892;
}

.resource-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.resource-tag {
  font-size: 10px;
  color: #f4ddb0;
  border: 1px solid rgba(255, 178, 44, 0.24);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(35, 28, 22, 0.78);
}

.resource-link {
  color: #ffd08b;
  text-decoration: none;
  font-weight: 600;
}

.resource-link:hover {
  text-decoration: underline;
}

.resource-links {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-compare-selection {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.compare-pill-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 10px;
  background: rgba(28, 24, 20, 0.86);
  padding: 9px 10px;
}

.compare-pill-copy {
  min-width: 0;
}

.compare-pill-title {
  color: #f5e7c7;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.compare-pill-meta {
  color: #c7b38d;
  font-size: 11px;
  margin-top: 3px;
}

.library-compare-table-wrap {
  margin-top: 12px;
}

.library-compare-table-scroll {
  overflow-x: auto;
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 10px;
}

.library-compare-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: rgba(24, 21, 18, 0.94);
}

.library-compare-table thead th {
  position: sticky;
  top: 0;
  background: rgba(38, 30, 21, 0.98);
  color: #ffdca1;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.library-compare-table th,
.library-compare-table td {
  border-bottom: 1px solid rgba(255, 178, 44, 0.12);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
  line-height: 1.45;
}

.library-compare-table tbody th {
  width: 180px;
  color: #d7c198;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(31, 26, 21, 0.92);
}

.library-compare-table td {
  color: #f0e0bf;
}

.atlas-section {
  background:
    linear-gradient(180deg, rgba(24, 21, 18, 0.96), rgba(17, 16, 15, 0.96)),
    radial-gradient(420px 140px at 100% 0%, rgba(255, 178, 44, 0.08), transparent 72%);
}

.library-atlas-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.atlas-stat-card {
  border: 1px solid rgba(255, 178, 44, 0.16);
  border-radius: 10px;
  background: rgba(28, 24, 20, 0.88);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.atlas-stat-label {
  color: #c9b48b;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-family: 'Space Mono', monospace;
}

.atlas-stat-value {
  color: #fff0d2;
  font-size: 28px;
  line-height: 1;
  font-family: 'Oswald', sans-serif;
}

.atlas-stat-meta {
  color: #c7b38d;
  font-size: 11px;
  line-height: 1.4;
}

.library-atlas-chip-group {
  margin-top: 10px;
}

.library-atlas-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.atlas-card {
  border: 1px solid rgba(255, 178, 44, 0.2);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(27, 23, 20, 0.96), rgba(18, 16, 15, 0.94)),
    radial-gradient(180px 90px at 100% 0%, rgba(125, 211, 252, 0.05), transparent 76%);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.atlas-card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.atlas-location {
  color: #ffd492;
  font-family: 'Space Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.atlas-visual-shell {
  margin: 2px 0 4px;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(20, 17, 15, 0.96), rgba(14, 12, 12, 0.94)),
    radial-gradient(220px 110px at 100% 0%, rgba(125, 211, 252, 0.06), transparent 72%);
  box-shadow: inset 0 1px 0 rgba(255, 178, 44, 0.08);
}

.atlas-visual-inline {
  margin-top: 10px;
}

.atlas-visual-feature {
  margin-top: 4px;
}

.atlas-visual-svg {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 5 / 3;
}

.atlas-visual-bg {
  fill: rgba(12, 11, 11, 0.96);
  stroke: rgba(255, 178, 44, 0.14);
  stroke-width: 1.2;
}

.atlas-track-primary,
.atlas-track-secondary,
.atlas-track-branch,
.atlas-track-yard,
.atlas-track-flow {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.atlas-track-primary {
  stroke: #ffd084;
  stroke-width: 5;
}

.atlas-track-secondary {
  stroke: rgba(247, 231, 193, 0.88);
  stroke-width: 3.4;
}

.atlas-track-branch {
  stroke: rgba(117, 214, 167, 0.94);
  stroke-width: 3;
  stroke-dasharray: 6 7;
}

.atlas-track-yard {
  stroke: rgba(125, 211, 252, 0.9);
  stroke-width: 2.8;
}

.atlas-track-flow {
  stroke: rgba(255, 226, 138, 0.95);
  stroke-width: 3.4;
  stroke-dasharray: 8 8;
}

.atlas-node {
  stroke-width: 1.8;
}

.atlas-node-hub {
  fill: #1c1508;
  stroke: #ffd084;
}

.atlas-node-camera {
  fill: #7dd3fc;
  stroke: #e0f2fe;
}

.atlas-node-scanner {
  fill: #4ade80;
  stroke: #dcfce7;
}

.atlas-shape-facility {
  fill: rgba(255, 178, 44, 0.08);
  stroke: rgba(255, 178, 44, 0.2);
  stroke-width: 1.2;
}

.atlas-shape-terminal {
  fill: rgba(255, 208, 139, 0.08);
  stroke: rgba(255, 208, 139, 0.28);
  stroke-width: 1.2;
}

.atlas-shape-water {
  fill: rgba(77, 163, 255, 0.16);
  stroke: rgba(125, 211, 252, 0.32);
  stroke-width: 1.2;
}

.atlas-shape-terrain {
  fill: rgba(74, 222, 128, 0.08);
  stroke: rgba(187, 247, 208, 0.18);
  stroke-width: 1.2;
}

.atlas-shape-terrain-soft {
  fill: rgba(255, 178, 44, 0.04);
  stroke: rgba(255, 178, 44, 0.1);
  stroke-width: 1;
}

.atlas-visual-label {
  fill: #f4e6c5;
  font-family: 'Space Mono', monospace;
  font-size: 7px;
  letter-spacing: 0.03em;
}

.atlas-visual-label-muted {
  fill: #bca987;
}

.atlas-visual-label-water {
  fill: #bfe7ff;
}

.atlas-visual-caption {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px 10px;
  border-top: 1px solid rgba(255, 178, 44, 0.12);
}

.atlas-visual-note {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 178, 44, 0.14);
  border-radius: 999px;
  background: rgba(31, 25, 20, 0.74);
  color: #d7c49c;
  font-size: 10px;
  line-height: 1.35;
}

.atlas-visual-note-accent {
  color: #fff0d2;
  border-color: rgba(255, 208, 139, 0.22);
}

.atlas-learning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.atlas-learning-card {
  border: 1px solid rgba(255, 178, 44, 0.14);
  border-radius: 10px;
  background: rgba(27, 23, 20, 0.84);
  padding: 8px 9px;
}

.atlas-learning-label {
  display: inline-block;
  color: #ffdba4;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.atlas-learning-card p {
  color: #dbc7a5;
  font-size: 11px;
  line-height: 1.5;
}

.atlas-line-list,
.atlas-pairing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.atlas-line-chip,
.atlas-pairing-chip {
  border: 1px solid rgba(255, 178, 44, 0.22);
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  color: #efd8a6;
  background: rgba(34, 28, 22, 0.82);
}

.atlas-pairings {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.atlas-pairings-label {
  color: #cab48a;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.atlas-action-row,
.atlas-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.atlas-source-row {
  margin-top: auto;
  padding-top: 2px;
}

.atlas-source-row .resource-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 999px;
  padding: 4px 10px;
  background: rgba(31, 25, 20, 0.84);
}


.source-quality-pill {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  padding: 2px 8px;
  border: 1px solid transparent;
}

.source-quality-pill.source-quality-official {
  color: #9df7bf;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(34, 197, 94, 0.18);
}

.source-quality-pill.source-quality-archive {
  color: #ffe2a6;
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(234, 179, 8, 0.18);
}

.source-quality-pill.source-quality-reference {
  color: #e6d9be;
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(100, 116, 139, 0.2);
}

.resource-link.source-quality-official {
  color: #9df7bf;
}

.resource-link.source-quality-archive {
  color: #ffd88f;
}

.resource-link.source-quality-reference {
  color: #d7d2c7;
}

.glossary-section {
  margin-top: 2px;
}

.glossary-search-wrap {
  margin-top: 2px;
  margin-bottom: 8px;
}

.glossary-chip-group {
  margin-bottom: 10px;
}

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

.glossary-term-card {
  border: 1px solid rgba(255, 178, 44, 0.22);
  border-radius: 10px;
  background: rgba(24, 21, 18, 0.95);
  padding: 10px;
}

.glossary-term-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.glossary-term-head h4 {
  font-size: 15px;
  color: #fff0d3;
}

.glossary-definition {
  color: #d8c6a8;
  font-size: 12px;
  line-height: 1.5;
}

.glossary-subline {
  margin-top: 4px;
  font-size: 11px;
  color: #bba684;
}

@media (max-width: 1100px) {
  .library-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .library-filter-panel {
    border-right: none;
    border-bottom: 1px solid rgba(255, 178, 44, 0.22);
    max-height: 280px;
  }

  .library-resource-grid {
    column-count: 2;
  }

  .library-atlas-overview,
  .library-atlas-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .library-main-panel {
    padding: 10px;
  }

  .library-section {
    padding: 10px;
  }

  .library-resource-grid {
    column-count: 1;
  }

  .resource-spec-grid {
    grid-template-columns: 1fr;
  }

  .library-atlas-overview,
  .library-atlas-grid {
    grid-template-columns: 1fr;
  }

  .atlas-learning-grid {
    grid-template-columns: 1fr;
  }

}

/* ============================================================
   OPERATIONS DESK V3
   ============================================================ */
.operations-desk-layout {
  background:
    radial-gradient(900px 420px at 78% 0%, rgba(255, 178, 44, 0.08), transparent 66%),
    radial-gradient(560px 340px at 8% 12%, rgba(125, 211, 252, 0.06), transparent 70%);
}

.operations-feed-panel {
  position: relative;
}

.operations-kicker {
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #cdb78a;
}

.operations-desk-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0 14px;
}

.operations-mini-stat {
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(31, 27, 23, 0.95), rgba(17, 15, 14, 0.94)),
    repeating-linear-gradient(90deg, rgba(255, 178, 44, 0.04) 0 1px, transparent 1px 22px);
  padding: 10px;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}

.operations-mini-stat-label {
  color: #bea87d;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.operations-mini-stat-value {
  color: #fff0cf;
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  letter-spacing: 0.04em;
  line-height: 1;
}

.operations-mini-stat-meta {
  color: #cfbc93;
  font-size: 11px;
  line-height: 1.35;
}

.operations-main-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.operations-overview-panel,
.operations-side-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 178, 44, 0.22);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(19, 17, 15, 0.96), rgba(12, 11, 11, 0.95)),
    repeating-linear-gradient(0deg, rgba(255, 178, 44, 0.025) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(90deg, rgba(255, 178, 44, 0.025) 0 1px, transparent 1px 28px);
  box-shadow: var(--shadow);
}

.operations-overview-panel::after,
.operations-side-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(420px 220px at 100% 0%, rgba(255, 178, 44, 0.08), transparent 72%);
  opacity: 0.85;
}

.operations-overview-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  overflow: visible;
}

.operations-overview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  gap: 16px;
}

.operations-overview-head > :first-child {
  min-width: 0;
}

.operations-overview-head h2 {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.04em;
  color: #fff0cf;
  margin: 4px 0 8px;
}

.operations-overview-copy {
  max-width: 720px;
  color: #d5c39f;
  font-size: 13px;
  line-height: 1.55;
}

.operations-overview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-self: start;
}

.operations-overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  position: relative;
  z-index: 1;
}

.operations-stat-card {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 12px;
  padding: 12px;
  min-height: 108px;
  background:
    linear-gradient(180deg, rgba(28, 24, 20, 0.94), rgba(17, 15, 13, 0.9)),
    radial-gradient(180px 80px at 100% 0%, rgba(74, 222, 128, 0.06), transparent 70%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
}

.operations-stat-label {
  color: #c9b38a;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.operations-stat-value {
  color: #fff2d4;
  font-family: 'Oswald', sans-serif;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.operations-stat-meta {
  color: #d4bf92;
  font-size: 12px;
  line-height: 1.4;
}

.operations-desk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(420px, 1.02fr);
  gap: 12px;
  align-items: start;
}

.operations-desk-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.operations-player-shell {
  min-height: 0;
}

.operations-player-shell .railcam-player {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
}

.operations-side-panel {
  padding: 12px;
}

.operations-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.operations-panel-head h3 {
  color: #ffedc5;
  font-size: 23px;
  line-height: 1;
  margin-top: 4px;
}

.operations-panel-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 178, 44, 0.28);
  background: rgba(46, 38, 22, 0.72);
  color: #ffdc96;
  padding: 5px 10px;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.operations-panel-copy {
  position: relative;
  z-index: 1;
  color: #cfbc95;
  font-size: 12px;
  line-height: 1.5;
  margin: 6px 0 10px;
}

.metro-monitor-board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  position: relative;
  z-index: 1;
  align-items: start;
}

.metro-monitor-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid rgba(255, 178, 44, 0.14);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(24, 21, 19, 0.94), rgba(16, 15, 14, 0.94)),
    radial-gradient(160px 84px at 100% 0%, rgba(255, 178, 44, 0.05), transparent 74%);
  padding: 12px;
}

.metro-monitor-group-title {
  color: #d3bd92;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.metro-monitor-card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metro-card {
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(27, 23, 20, 0.96), rgba(18, 16, 15, 0.94)),
    radial-gradient(200px 84px at 100% 0%, rgba(125, 211, 252, 0.06), transparent 75%);
  padding: 10px;
}

.metro-card-watchlist {
  background:
    linear-gradient(180deg, rgba(23, 23, 23, 0.96), rgba(16, 15, 15, 0.94)),
    radial-gradient(180px 84px at 100% 0%, rgba(255, 178, 44, 0.05), transparent 75%);
}

.metro-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.metro-card-title {
  font-size: 15px;
  color: #fff0cf;
}

.metro-card-subtitle {
  color: #cfbc95;
  font-size: 11px;
  line-height: 1.4;
  margin-top: 3px;
}

.metro-card-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border: 1px solid rgba(255, 178, 44, 0.18);
  background: rgba(46, 38, 22, 0.6);
  color: #edd7aa;
  white-space: nowrap;
}

.metro-card-status.state-ok {
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(21, 77, 43, 0.58);
  color: #b7ffd5;
}

.metro-card-status.state-cached,
.metro-card-status.state-throttled {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(109, 76, 16, 0.44);
  color: #ffe3a0;
}

.metro-card-status.state-empty {
  border-color: rgba(125, 211, 252, 0.3);
  background: rgba(16, 54, 77, 0.46);
  color: #c3efff;
}

.metro-card-status.state-offline {
  border-color: rgba(248, 113, 113, 0.36);
  background: rgba(91, 24, 24, 0.48);
  color: #ffc2c2;
}

.metro-card-status.state-checking,
.metro-card-status.state-watchlist {
  border-color: rgba(255, 178, 44, 0.22);
  background: rgba(39, 33, 23, 0.62);
  color: #f0ddb5;
}

.metro-card-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.metro-card-stat {
  border: 1px solid rgba(255, 178, 44, 0.15);
  border-radius: 9px;
  padding: 7px;
  background: rgba(22, 19, 17, 0.84);
}

.metro-card-stat-label {
  display: block;
  color: #bca67f;
  font-family: 'Space Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metro-card-stat-value {
  display: block;
  color: #ffedc8;
  font-size: 13px;
  line-height: 1.25;
  margin-top: 3px;
}

.metro-card-note {
  color: #d5c197;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 10px;
}

.metro-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.metro-card-button,
.metro-card-link {
  text-decoration: none;
}

.scanner-console-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
}

.scanner-console-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.scanner-bank-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scanner-bank-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 999px;
  background: rgba(28, 24, 22, 0.88);
  color: #d9c18f;
  padding: 7px 11px;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, background 140ms ease;
}

.scanner-bank-chip-label {
  display: inline-block;
}

.scanner-bank-chip-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: rgba(255, 178, 44, 0.12);
  color: #ffd88f;
  font-size: 9px;
  line-height: 1;
}

.scanner-bank-chip:hover {
  border-color: rgba(255, 178, 44, 0.46);
  transform: translateY(-1px);
}

.scanner-bank-chip.active {
  border-color: rgba(255, 196, 92, 0.72);
  background: linear-gradient(180deg, rgba(73, 50, 14, 0.86), rgba(31, 23, 12, 0.94));
  color: #fff0cf;
}

.scanner-bank-chip.active .scanner-bank-chip-count {
  background: rgba(255, 215, 140, 0.2);
  color: #fff0cf;
}

.scanner-channel-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  gap: 8px;
}

.scanner-console-item {
  text-align: left;
  border: 1px solid rgba(255, 178, 44, 0.18);
  border-radius: 12px;
  background: rgba(24, 20, 18, 0.92);
  color: #f1e0bd;
  padding: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.scanner-console-item:hover {
  border-color: rgba(255, 178, 44, 0.52);
  transform: translateY(-1px);
  box-shadow: var(--glow-soft);
}

.scanner-console-item.active {
  border-color: rgba(255, 196, 92, 0.72);
  background: linear-gradient(180deg, rgba(55, 39, 13, 0.64), rgba(24, 19, 12, 0.92));
}

.scanner-console-item-name {
  font-size: 13px;
  font-weight: 700;
}

.scanner-console-item-region {
  color: #ccb78f;
  font-size: 11px;
  line-height: 1.35;
}

.scanner-console-item-frequency {
  color: #ffcf75;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.scanner-console-detail {
  border: 1px solid rgba(255, 178, 44, 0.16);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(24, 21, 19, 0.94), rgba(16, 15, 14, 0.94)),
    radial-gradient(180px 84px at 100% 0%, rgba(255, 178, 44, 0.06), transparent 74%);
  padding: 12px;
  min-height: 200px;
}

.scanner-deck-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scanner-deck-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.scanner-console-kicker {
  color: #cbb58d;
  font-family: 'Space Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scanner-console-title {
  color: #fff0cf;
  font-size: 18px;
  margin-top: 6px;
}

.scanner-feed-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 178, 44, 0.2);
  background: rgba(41, 34, 24, 0.76);
  color: #eddbb0;
  padding: 5px 10px;
  font-size: 10px;
  font-family: 'Space Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.scanner-feed-pill.is-scanning {
  border-color: rgba(74, 222, 128, 0.34);
  background: rgba(19, 73, 44, 0.62);
  color: #bbffd9;
}

.scanner-readout {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(255, 178, 44, 0.16);
  border-radius: 12px;
  padding: 11px 12px;
  background:
    linear-gradient(180deg, rgba(23, 20, 17, 0.95), rgba(16, 14, 13, 0.92)),
    radial-gradient(140px 80px at 100% 0%, rgba(255, 178, 44, 0.08), transparent 72%);
}

.scanner-readout-frequency {
  color: #fff0cf;
  font-family: 'Space Mono', monospace;
  font-size: 16px;
  letter-spacing: 0.04em;
}

.scanner-readout-name {
  color: #ffd78b;
  font-size: 13px;
}

.scanner-readout-meta {
  color: #baa57e;
  font-size: 11px;
  line-height: 1.4;
}

.scanner-tuner-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.scanner-audio-player {
  width: 100%;
  margin: 2px 0 0;
  accent-color: #ffb22c;
}

.scanner-console-copy,
.scanner-console-note {
  color: #d5c29d;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 8px;
}

.scanner-console-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.scanner-console-tags em {
  font-style: normal;
  border: 1px solid rgba(255, 178, 44, 0.24);
  border-radius: 999px;
  padding: 3px 8px;
  color: #f1d59b;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.scanner-console-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.scanner-console-link {
  text-decoration: none;
}

.scanner-coverage-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scanner-coverage-item {
  border: 1px solid rgba(255, 178, 44, 0.14);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(22, 18, 16, 0.84);
  color: #ead5a7;
  font-size: 11px;
  line-height: 1.45;
}

.scanner-utility-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.scanner-utility-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  border: 1px solid rgba(255, 178, 44, 0.16);
  border-radius: 10px;
  padding: 10px;
  background: rgba(21, 18, 16, 0.88);
  color: #f4e3be;
  text-decoration: none;
  transition: border-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
}

.scanner-utility-card:hover {
  border-color: rgba(255, 178, 44, 0.46);
  transform: translateY(-1px);
  box-shadow: var(--glow-soft);
}

.scanner-utility-card-title {
  color: #ffe9bf;
  font-size: 12px;
}

.scanner-utility-card-detail {
  color: #c9b58c;
  font-size: 11px;
  line-height: 1.45;
}

.operations-freight-panel .freight-signal-grid {
  position: relative;
  z-index: 1;
  grid-template-columns: 1fr;
}

.operations-freight-panel .freight-spotter-summary {
  position: relative;
  z-index: 1;
}

.operations-freight-panel .freight-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .operations-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operations-desk-grid {
    grid-template-columns: 1fr;
  }

  .operations-player-shell {
    min-height: 480px;
  }

  .metro-monitor-board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .operations-desk-summary {
    grid-template-columns: 1fr 1fr;
  }

  .operations-overview-head {
    grid-template-columns: 1fr;
  }

  .operations-overview-actions {
    justify-content: flex-start;
  }

  .scanner-console-layout {
    grid-template-columns: 1fr;
  }

  .scanner-utility-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .operations-overview-grid,
  .operations-freight-panel .freight-summary-grid,
  .metro-card-stats,
  .scanner-tuner-controls,
  .scanner-coverage-grid {
    grid-template-columns: 1fr;
  }

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

  .operations-freight-panel .freight-signal-grid {
    grid-template-columns: 1fr;
  }
}
