:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f1f5f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #0f766e;
  --primary-hover: #115e59;
  --danger: #dc2626;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  background: #0f172a;
  color: white;
  position: relative;
  z-index: 1000;
}
.topbar h1 { margin: 0; font-size: 22px; }
.topbar p { margin: 3px 0 0; color: #cbd5e1; font-size: 13px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; height: calc(100vh - 72px); height: calc(100dvh - 72px); }
.map-shell { position: relative; min-width: 0; }
#map { width: 100%; height: 100%; background: #dbeafe; }
.map-tools {
  position: absolute;
  z-index: 700;
  top: 14px;
  left: 56px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
}
.search-box { width: min(440px, 100%); pointer-events: auto; }
.search-box input {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, .8);
  border-radius: 12px;
  padding: 12px 14px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}
.legend {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  max-width: 460px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: auto;
}
.legend span { white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.dot.unknown { background: #2563eb; }
.dot.available { background: #16a34a; }
.dot.unavailable { background: #dc2626; }
.dot.queue { background: #d97706; }
.dot.closed { background: #475569; }

.sidebar { overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
.panel { padding: 22px; position: relative; }
.panel h2 { margin: 0 40px 8px 0; font-size: 24px; }
.panel h3 { margin: 26px 0 10px; font-size: 17px; }
.muted { color: var(--muted); line-height: 1.45; }
.hidden { display: none !important; }
.stats { padding: 14px; border-radius: 12px; background: #f8fafc; margin: 18px 0; line-height: 1.55; }

button {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--primary);
  color: white;
  font-weight: 700;
}
button:hover { background: var(--primary-hover); }
.secondary-button { background: #334155; }
.secondary-button:hover { background: #475569; }
.full { width: 100%; }
.icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  background: #e2e8f0;
  color: #0f172a;
  font-size: 25px;
}
.icon-button:hover { background: #cbd5e1; }

.form-stack { display: grid; gap: 11px; }
.form-stack label { display: grid; gap: 6px; font-size: 13px; font-weight: 650; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px 11px;
  background: white;
  color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(15,118,110,.18); border-color: var(--primary); }
.honeypot { position: fixed !important; left: -10000px !important; opacity: 0 !important; }

.meta-grid { display: grid; gap: 8px; margin: 15px 0; }
.meta-row { padding: 10px 12px; background: #f8fafc; border-radius: 9px; font-size: 13px; }
.meta-row strong { display: block; margin-bottom: 3px; }
.fuel-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.fuel-tag { padding: 4px 7px; background: #e2e8f0; border-radius: 999px; font-size: 12px; }

.feed { display: grid; gap: 9px; margin-top: 12px; }
.feed-item { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.feed-item header { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.feed-item time { color: var(--muted); font-size: 11px; }
.feed-item p { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.status-badge { display: inline-block; padding: 4px 7px; border-radius: 999px; font-weight: 700; font-size: 12px; background: #e2e8f0; }
.empty { color: var(--muted); padding: 10px 0; }

.station-marker { stroke: white; stroke-width: 2; }

.toast {
  position: fixed;
  z-index: 3000;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  background: #0f172a;
  color: white;
  padding: 11px 16px;
  border-radius: 10px;
  transition: .2s ease;
  pointer-events: none;
  max-width: min(500px, calc(100vw - 30px));
  text-align: center;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #991b1b; }

 dialog {
  width: min(520px, calc(100vw - 24px));
  border: 0;
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow);
 }
dialog::backdrop { background: rgba(15, 23, 42, .55); }
.dialog-title { position: relative; }
.dialog-title h2 { margin: 0 45px 5px 0; }
.dialog-title .icon-button { top: -8px; right: -8px; }
.coordinate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  body { overflow: hidden; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 58dvh) minmax(0, 1fr);
    height: calc(100vh - 72px);
    height: calc(100dvh - 72px);
    overflow: hidden;
  }
  .map-shell { min-height: 0; }
  .sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .legend { display: none; }
  .map-tools { right: 10px; left: 54px; }
  .panel { padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}

@media (max-width: 560px) {
  .topbar { height: 62px; padding: 8px 10px; gap: 10px; }
  .topbar > div { min-width: 0; }
  .topbar h1 { font-size: 19px; }
  .topbar p { font-size: 11px; }
  .topbar button { flex: 0 0 auto; padding: 9px 10px; font-size: 12px; border-radius: 9px; }
  .layout {
    grid-template-rows: minmax(330px, 56dvh) minmax(0, 1fr);
    height: calc(100vh - 62px);
    height: calc(100dvh - 62px);
  }
  .map-tools { top: 10px; left: 48px; right: 10px; }
  .search-box input { padding: 10px 12px; border-radius: 10px; }
  .panel { padding: 16px; }
  .panel h2 { font-size: 21px; line-height: 1.15; }
  .panel h3 { margin-top: 22px; }
  .stats { margin: 14px 0; padding: 12px; }
  button { min-height: 42px; }
  .form-stack { gap: 10px; }
  .feed-item header { display: grid; gap: 3px; }
  .coordinate-grid { grid-template-columns: 1fr; }
  dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 16px;
    border-radius: 12px;
  }
  .toast { bottom: max(14px, env(safe-area-inset-bottom)); }
}
