* { box-sizing: border-box; }
:root {
  --bg: #0f172a;
  --bg-soft: #111c34;
  --panel: #020617;
  --panel-2: #0b1220;
  --border: #1e293b;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #60a5fa;
  --success: #10b981;
  --warning: #f59e0b;
}
html, body { margin: 0; height: 100%; font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--text); }
body { display: flex; }
#sidebar { width: 410px; max-width: 44vw; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--border); padding: 16px; }
#map-wrap { flex: 1; height: 100vh; }
#map { width: 100%; height: 100%; }
.sidebar-header h1 { margin: 0; font-size: 24px; }
.sidebar-subtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.panel { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-top: 14px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel-header-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.list-hint { font-size: 11px; color: var(--muted); text-align: right; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 12px; color: var(--muted); }
.field input, .field select { width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #0f172a; color: var(--text); padding: 10px 12px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.toggle-row, .action-row, .line-actions, .direction-nav, .direction-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.switch-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.btn { border: 1px solid var(--border); background: #13213a; color: var(--text); border-radius: 10px; padding: 9px 12px; cursor: pointer; transition: 0.2s ease; }
.btn:hover { background: #1a2b49; }
.btn-primary { background: var(--accent); color: #062033; border-color: transparent; font-weight: 700; }
.btn-primary:hover { background: #62d3ff; }
.btn-muted { background: #111827; }
.btn-accent { background: #1d4ed8; border-color: transparent; }
.btn-accent:hover { background: #2563eb; }
.btn-small { padding: 7px 10px; font-size: 12px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 4px 10px; border-radius: 999px; background: #0f172a; border: 1px solid var(--border); font-size: 12px; color: var(--accent); }
.hidden { display: none !important; }
#line-summary, #compare-summary, #loading-status, #direction-nav-label { font-size: 13px; color: var(--muted); line-height: 1.5; }
.stops-list, .interchanges-panel { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.stops-list { max-height: 320px; overflow-y: auto; }
.stop-item, .interchange-item, .line-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--border); background: #0f172a; color: var(--text); border-radius: 10px; padding: 9px 10px; cursor: pointer; }
.stop-item:hover, .interchange-item:hover, .line-item:hover { background: #15213a; }
.stop-item.active-stop { border-color: var(--accent); background: #10253a; }
.stop-index { min-width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: #1e293b; font-size: 11px; color: var(--muted); }
.stop-meta, .interchange-meta { display: flex; flex-direction: column; gap: 2px; }
.stop-name, .line-name { font-size: 13px; font-weight: 600; }
.stop-sub, .interchange-sub, .line-sub { font-size: 12px; color: var(--muted); }
#sidebar-sections { display: flex; flex-direction: column; gap: 14px; }
.line-section { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: #09111f; }
.line-section-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px; background: #0c1628; border-bottom: 1px solid var(--border); }
.line-section-title-wrap { display: flex; flex-direction: column; gap: 3px; }
.line-section-title { font-size: 14px; font-weight: 700; }
.line-section-subtitle { font-size: 11px; color: var(--muted); }
.line-section-actions { display: flex; gap: 6px; }
.line-section-actions button { border: 1px solid var(--border); background: #111827; color: var(--text); border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 12px; }
.section-lines { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.route { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #0b1220; }
.route-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; cursor: pointer; }
.route-header:hover { background: #111b31; }
.route-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.route-tools { display: flex; gap: 6px; }
.route-tools button { border: 1px solid var(--border); background: #111827; color: var(--text); border-radius: 8px; padding: 5px 8px; cursor: pointer; font-size: 12px; }
.directions-wrapper { display: none; border-top: 1px solid var(--border); padding: 8px; gap: 6px; }
.directions-wrapper.open { display: flex; flex-direction: column; }
label.direction-row { display: flex; align-items: center; gap: 8px; border-radius: 10px; padding: 8px 10px; cursor: pointer; }
label.direction-row:hover { background: #14213a; }
.color-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.compare-shared-list { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.compare-chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: rgba(56, 189, 248, 0.15); color: var(--accent); padding: 4px 8px; font-size: 12px; margin-right: 6px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #0f172a; color: var(--text); }
.stop-popup { min-width: 230px; }
.stop-popup-title { font-weight: 700; margin-bottom: 4px; }
.stop-popup-subtitle { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.stop-popup-lines { display: flex; flex-direction: column; gap: 8px; }
.stop-line-block { border-top: 1px solid var(--border); padding-top: 8px; }
.stop-line-block:first-child { border-top: 0; padding-top: 0; }
.stop-line-link, .stop-direction-link { width: 100%; text-align: left; border: 1px solid var(--border); background: #111827; color: var(--text); border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.stop-direction-link { margin-top: 6px; background: #0b1220; }
.stop-line-link:hover, .stop-direction-link:hover { background: #16233d; }
@media (max-width: 1100px) {
  body { flex-direction: column; }
  #sidebar { width: 100%; max-width: none; height: 50vh; border-right: 0; border-bottom: 1px solid var(--border); }
  #map-wrap, #map { height: 50vh; }
}
