:root {
  color-scheme: dark;
  --bg: #080d1a;
  --surface: #11182a;
  --surface-raised: #172137;
  --surface-soft: #0d1424;
  --text: #f6f8ff;
  --muted: #a9b3c9;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #6e8eff;
  --accent-strong: #91a7ff;
  --success: #53d6a0;
  --warning: #f2bd63;
  --radius: 18px;
  --shadow: 0 20px 55px rgba(0, 0, 0, 0.34);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100dvh; color: var(--text); background: radial-gradient(circle at 80% 0%, rgba(78, 108, 220, 0.16), transparent 34rem), var(--bg); line-height: 1.5; }
button, input, select { font: inherit; }
button, select, a { touch-action: manipulation; }
a { color: inherit; }

.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; border-radius: 10px; background: var(--text); color: var(--bg); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(18px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(8, 13, 26, 0.86); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 11px; min-height: 44px; text-decoration: none; font-size: 19px; font-weight: 750; letter-spacing: -0.02em; }
.brand svg { width: 30px; height: 30px; fill: var(--accent-strong); }
.service-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(83, 214, 160, 0.12); }

.page-shell { width: min(1520px, 100%); margin: 0 auto; padding: clamp(28px, 4vw, 58px) clamp(16px, 4vw, 64px) 44px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 6px; color: var(--accent-strong); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 800px; margin-bottom: 12px; font-size: clamp(34px, 5vw, 68px); line-height: 1.01; letter-spacing: -0.055em; }
.intro-copy { max-width: 670px; margin-bottom: 0; color: var(--muted); font-size: clamp(16px, 1.6vw, 20px); }
.metric { flex: 0 0 auto; min-width: 168px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.metric span { display: block; font-size: 35px; font-weight: 780; line-height: 1; font-variant-numeric: tabular-nums; }
.metric small { color: var(--muted); }

.filters { display: grid; grid-template-columns: minmax(250px, 1.45fr) minmax(180px, 0.55fr) auto; align-items: end; gap: 12px; margin-bottom: 18px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 650; }
.input-wrap { position: relative; display: block; }
.input-wrap svg { position: absolute; top: 50%; left: 15px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; transform: translateY(-50%); pointer-events: none; }
input, select, .reset-button { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--surface-raised); outline: none; transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease; }
input { padding: 11px 14px 11px 46px; }
select { padding: 10px 38px 10px 13px; }
.reset-button { width: auto; padding: 10px 18px; cursor: pointer; font-weight: 700; }
input:hover, select:hover, .reset-button:hover { border-color: rgba(145, 167, 255, 0.5); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, .station-card:focus-visible { outline: 3px solid rgba(110, 142, 255, 0.46); outline-offset: 2px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.75fr); min-height: 620px; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.map-panel { position: relative; min-width: 0; background: #0c1322; }
#map { width: 100%; height: 100%; min-height: 620px; background: #0c1322; }
.map-caption { position: absolute; z-index: 500; left: 12px; bottom: 12px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(8, 13, 26, 0.82); color: var(--muted); font-size: 11px; pointer-events: none; }
.map-fallback { display: none; position: absolute; inset: 0; place-items: center; padding: 32px; text-align: center; color: var(--muted); background: var(--surface-soft); }
.tiles-unavailable .map-fallback { display: grid; }
.tiles-unavailable #map { visibility: hidden; }

.results { display: flex; min-height: 0; flex-direction: column; border-left: 1px solid var(--line); }
.results-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; padding: 22px 20px 16px; border-bottom: 1px solid var(--line); }
.results-head h2 { margin: 0; font-size: 24px; letter-spacing: -0.035em; }
#result-summary { color: var(--muted); font-size: 13px; white-space: nowrap; }
.station-list { display: grid; gap: 10px; padding: 12px; overflow-y: auto; overscroll-behavior: contain; }
.station-card { padding: 16px; border: 1px solid transparent; border-radius: 15px; background: var(--surface-soft); cursor: pointer; transition: border-color 180ms ease, background-color 180ms ease; }
.station-card:hover, .station-card.is-active { border-color: rgba(145, 167, 255, 0.46); background: #15203a; }
.station-top { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.station-name { margin: 0 0 3px; font-size: 17px; }
.station-address, .station-meta { margin: 0; color: var(--muted); font-size: 13px; }
.load-badge { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; color: #9fe8c9; background: rgba(83, 214, 160, 0.12); font-size: 11px; font-weight: 750; }
.load-badge.busy { color: #f5cf8b; background: rgba(242, 189, 99, 0.12); }
.fuel-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 13px 0; }
.fuel-chip { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; color: #d9e0f1; font-size: 12px; font-variant-numeric: tabular-nums; }
.station-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.route-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 9px 13px; border-radius: 10px; color: white; background: #365dcc; text-decoration: none; font-size: 13px; font-weight: 750; transition: background-color 180ms ease; }
.route-link:hover { background: #466fe0; }
.empty-state { padding: 36px 18px; text-align: center; color: var(--muted); }
.noscript { margin: 20px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
footer { padding: 24px; border-top: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 13px; }

.leaflet-container { font-family: inherit; }
.leaflet-control-zoom a { color: var(--text) !important; background: var(--surface) !important; border-color: var(--line) !important; }
.station-marker { display: grid; width: 32px; height: 32px; place-items: center; border: 3px solid white; border-radius: 50% 50% 50% 12%; color: white; background: #5275e8; box-shadow: 0 7px 20px rgba(0, 0, 0, 0.4); transform: rotate(-45deg); }
.station-marker span { font-size: 11px; font-weight: 900; transform: rotate(45deg); }

@media (max-width: 900px) {
  .topbar { min-height: 64px; }
  .service-state { display: none; }
  .page-shell { padding-top: 28px; }
  .intro { align-items: start; }
  .metric { display: none; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .workspace { grid-template-columns: 1fr; overflow: visible; }
  #map { min-height: 46vh; height: 46vh; }
  .results { border-top: 1px solid var(--line); border-left: 0; }
  .station-list { max-height: none; overflow: visible; }
}

@media (max-width: 560px) {
  h1 { font-size: 39px; }
  .filters { grid-template-columns: 1fr; }
  .search-field { grid-column: auto; }
  .reset-button { width: 100%; }
  .results-head { align-items: start; }
  .station-actions { align-items: start; flex-direction: column; }
  .route-link { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
