:root {
  --bg: #eef2f7;
  --ink: #0c1424;
  --ink-2: #38445a;
  --muted: #67728a;
  --line: rgba(12, 20, 36, 0.1);
  --accent: #2e6bf0;
  --accent-2: #5b8cff;
  --accent-grad: linear-gradient(135deg, #2e6bf0 0%, #5b8cff 100%);
  --available: #0a9367;
  --warning: #d78108;
  --none: #d93a2b;
  --unknown: #97a2b5;
  --stale: #7d8aa1;
  --focus: rgba(46, 107, 240, 0.32);
  --glass: rgba(255, 255, 255, 0.68);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --shadow-sm: 0 6px 20px rgba(12, 20, 36, 0.1);
  --shadow-md: 0 16px 40px rgba(12, 20, 36, 0.16);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 11px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input,
textarea {
  font: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
}

button {
  min-height: 44px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
  backdrop-filter: blur(22px) saturate(1.7);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass {
    background: rgba(255, 255, 255, 0.95);
  }
}

.app {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.map-stage,
#map {
  position: absolute;
  inset: 0;
}

#map {
  z-index: 0;
  background: #dde5ee;
}

/* ---------- Top panel ---------- */

.top-panel {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 500;
  display: grid;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-lg);
}

.top-panel > * {
  min-width: 0;
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 8px 18px rgba(46, 107, 240, 0.35);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

h1 {
  font-size: 17px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.brand p {
  max-width: 230px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.icon-button,
.primary,
.secondary,
.route-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: transform 120ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

.icon-button:active,
.primary:active,
.secondary:active,
.fab:active {
  transform: scale(0.96);
}

.icon-button {
  position: relative;
  width: 44px;
  padding: 0;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.badge-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px #fff;
}

.icon-button svg,
.primary svg,
.secondary svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

.primary {
  border: 0;
  background: var(--accent-grad);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(46, 107, 240, 0.32);
}

.secondary {
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink);
  font-weight: 700;
}

button:disabled {
  cursor: progress;
  opacity: 0.55;
}

/* ---------- Chips ---------- */

.fuel-chips,
.mode-switch,
.chip-row,
.status-strip,
.panel,
.station-list {
  scrollbar-width: none;
}

.fuel-chips::-webkit-scrollbar,
.mode-switch::-webkit-scrollbar,
.chip-row::-webkit-scrollbar,
.status-strip::-webkit-scrollbar,
.panel::-webkit-scrollbar,
.station-list::-webkit-scrollbar {
  display: none;
}

.fuel-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-md);
  background: rgba(238, 242, 247, 0.68);
}

.fuel-chips button {
  flex: 1 0 auto;
  min-width: 46px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.fuel-chips button.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 14px rgba(46, 107, 240, 0.32);
}

.mode-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(12, 20, 36, 0.045);
}

.mode-button {
  flex: 1 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mode-button.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(12, 20, 36, 0.12);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chip-row button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 750;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.chip-row button.active {
  border-color: transparent;
  background: var(--accent-grad);
  color: #fff;
  box-shadow: 0 6px 14px rgba(46, 107, 240, 0.28);
}

.status-choice button.active[data-tone="available"] {
  background: var(--available);
  box-shadow: 0 6px 14px rgba(10, 147, 103, 0.3);
}

.status-choice button.active[data-tone="warning"] {
  background: var(--warning);
  box-shadow: 0 6px 14px rgba(215, 129, 8, 0.3);
}

.status-choice button.active[data-tone="none"] {
  background: var(--none);
  box-shadow: 0 6px 14px rgba(217, 58, 43, 0.3);
}

/* ---------- Collect progress ---------- */

.collect-progress {
  position: absolute;
  top: calc(128px + env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 510;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius-md);
}

.collect-progress strong,
.collect-progress > div span {
  display: block;
}

.collect-progress strong {
  font-size: 13px;
}

.collect-progress > div span,
.collect-progress time {
  color: var(--muted);
  font-size: 12px;
}

.collect-progress time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(46, 107, 240, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 850ms linear infinite;
}

.progress-track {
  grid-column: 1 / -1;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(46, 107, 240, 0.14);
}

.progress-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-grad);
  animation: progress-slide 1100ms ease-in-out infinite;
}

/* ---------- Locate FAB ---------- */

.fab {
  position: absolute;
  right: 12px;
  bottom: calc(46dvh + 14px);
  z-index: 480;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 50%;
  color: var(--accent);
  transition: transform 120ms ease, bottom 220ms ease, opacity 180ms ease;
}

.fab svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

body.sheet-collapsed .fab {
  bottom: 132px;
}

body.sheet-expanded .fab {
  opacity: 0;
  pointer-events: none;
}

/* ---------- Bottom sheet ---------- */

.station-list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 450;
  height: 44dvh;
  min-height: 310px;
  overflow: auto;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
  backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: 0 -16px 44px rgba(12, 20, 36, 0.18);
  transition: height 220ms ease, min-height 220ms ease;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .station-list {
    background: rgba(255, 255, 255, 0.97);
  }
}

.sheet-handle {
  position: sticky;
  top: -10px;
  z-index: 5;
  display: flex;
  width: 100%;
  height: 24px;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
}

.sheet-handle:active {
  cursor: grabbing;
}

.sheet-handle span {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(12, 20, 36, 0.18);
}

body.sheet-collapsed .station-list {
  height: 122px;
  min-height: 122px;
  overflow: hidden;
}

body.sheet-collapsed .mode-switch,
body.sheet-collapsed .status-strip,
body.sheet-collapsed .tabs,
body.sheet-collapsed .signals-bar,
body.sheet-collapsed .panel {
  display: none;
}

body.sheet-expanded .station-list {
  height: min(80dvh, calc(100dvh - 108px));
}

.list-head {
  position: sticky;
  top: -10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 10px;
}

.list-head > div {
  min-width: 0;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.event-meta,
.station-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

/* ---------- Status strip (legend + counts) ---------- */

.status-strip {
  display: flex;
  gap: 7px;
  margin: 0 0 10px;
  overflow-x: auto;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status-chip strong {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.legend-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ---------- Tabs and panels ---------- */

.tabs {
  position: sticky;
  top: 52px;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-bottom: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(12, 20, 36, 0.045);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 3px 10px rgba(12, 20, 36, 0.12);
}

.signals-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
}

.signals-bar strong {
  display: block;
  font-size: 13px;
}

.signals-bar .secondary {
  flex: 0 0 auto;
}

.panel {
  display: grid;
  gap: 8px;
  padding-bottom: 6px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ---------- Station cards ---------- */

.station-item {
  width: 100%;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(12, 20, 36, 0.06);
  text-align: left;
  transition: transform 120ms ease, box-shadow 180ms ease, background 180ms ease;
}

.station-item:active {
  transform: scale(0.99);
  background: #fff;
}

.dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(12, 20, 36, 0.14);
}

.station-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.station-title {
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.22;
  text-overflow: ellipsis;
}

.station-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.station-side {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  margin-top: 6px;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill {
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  text-overflow: ellipsis;
}

.badge {
  background: rgba(12, 20, 36, 0.06);
  color: var(--ink-2);
}

.trust {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.status-available {
  background: var(--available);
}

.status-warning,
.status-limit,
.status-cash_only,
.status-queue {
  background: var(--warning);
}

.status-none,
.status-closed {
  background: var(--none);
}

.status-unknown {
  background: var(--unknown);
}

.status-stale {
  background: var(--stale);
}

/* ---------- Map markers ---------- */

.marker {
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 7px;
  transform: rotate(-45deg);
  border: 2px solid #fff;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.75),
    0 8px 18px rgba(12, 20, 36, 0.3);
}

.marker.status-available {
  background: linear-gradient(135deg, #0da173 0%, #0a8059 100%);
}

.marker.status-warning {
  background: linear-gradient(135deg, #e89312 0%, #c47406 100%);
}

.marker.status-none {
  background: linear-gradient(135deg, #e2493a 0%, #c52d1f 100%);
}

.marker.status-stale {
  background: linear-gradient(135deg, #93a0b4 0%, #7d8aa1 100%);
}

.marker.status-unknown {
  background: linear-gradient(135deg, #a4aebf 0%, #8b96a9 100%);
}

.marker span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transform: rotate(45deg);
  color: #fff;
  font-size: 10px;
  font-weight: 900;
}

.cluster {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.4),
    0 10px 22px rgba(12, 20, 36, 0.28);
}

.cluster span {
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.user-marker {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(46, 107, 240, 0.16);
  box-shadow: 0 0 0 8px rgba(46, 107, 240, 0.14);
}

.user-marker span {
  width: 12px;
  height: 12px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(46, 107, 240, 0.4);
}

/* ---------- Signals and history ---------- */

.signal-item,
.history-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(12, 20, 36, 0.06);
}

.signal-top,
.history-head,
.drawer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.signal-top strong {
  font-size: 14px;
}

.signal-item p,
.event-note {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.45;
}

.signal-item a,
.source-link {
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
}

.actions {
  display: flex;
  gap: 8px;
}

.actions .secondary {
  flex: 1 1 0;
  min-height: 40px;
  font-size: 13px;
}

/* ---------- Drawer (station card) ---------- */

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 700;
  max-height: 78dvh;
  overflow: auto;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
  backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: 0 -20px 50px rgba(12, 20, 36, 0.26);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .drawer {
    background: rgba(255, 255, 255, 0.97);
  }
}

.drawer-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.drawer h2 {
  padding-right: 48px;
}

.drawer-status {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.drawer-actions {
  margin-top: 12px;
}

.drawer-actions .primary,
.drawer-actions .secondary {
  flex: 1 1 0;
}

.history {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.history-label {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-label + .history {
  margin-top: 8px;
}

/* ---------- Dialogs ---------- */

dialog.sheet-dialog {
  width: 100%;
  max-width: 640px;
  max-height: calc(100dvh - 40px);
  margin: auto auto 0;
  overflow: auto;
  padding: 0;
  border: 1px solid var(--glass-border);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(24px) saturate(1.7);
  backdrop-filter: blur(24px) saturate(1.7);
  box-shadow: var(--shadow-md);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  dialog.sheet-dialog {
    background: rgba(255, 255, 255, 0.98);
  }
}

dialog::backdrop {
  background: rgba(12, 20, 36, 0.45);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

form {
  display: grid;
  gap: 16px;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

form header,
form footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

form footer .primary,
form footer .secondary {
  flex: 1 1 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

label em {
  color: var(--muted);
  font-style: normal;
  font-weight: 500;
}

.filter-group {
  display: grid;
  gap: 8px;
}

.filter-label {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
}

.filter-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
}

.switch-row strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.switch-row input {
  appearance: none;
  -webkit-appearance: none;
  flex: 0 0 auto;
  width: 50px;
  height: 30px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(12, 20, 36, 0.16);
  cursor: pointer;
  transition: background 180ms ease;
}

.switch-row input::after {
  content: "";
  display: block;
  width: 24px;
  height: 24px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(12, 20, 36, 0.25);
  transition: transform 180ms ease;
}

.switch-row input:checked {
  background: var(--accent);
}

.switch-row input:checked::after {
  transform: translateX(20px);
}

form label,
form .filter-group {
  min-width: 0;
}

select,
input[type="url"],
input[type="datetime-local"],
textarea {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

#observedAt {
  margin-top: 2px;
}

/* ---------- Toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 900;
  transform: translateX(-50%) translateY(20px);
  min-height: 44px;
  max-width: min(520px, calc(100vw - 24px));
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: rgba(12, 20, 36, 0.9);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.leaflet-control-zoom {
  display: none;
}

.leaflet-control-attribution {
  font-size: 9px;
  background: rgba(255, 255, 255, 0.6) !important;
}

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

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }

  55%,
  100% {
    transform: translateX(245%);
  }
}

/* ---------- Desktop ---------- */

@media (min-width: 980px) {
  .top-panel {
    left: 18px;
    right: auto;
    width: 520px;
  }

  .collect-progress {
    top: 146px;
    left: 18px;
    right: auto;
    width: 520px;
  }

  .fab {
    right: 486px;
    bottom: 24px;
  }

  body.sheet-collapsed .fab,
  body.sheet-expanded .fab {
    bottom: 24px;
    opacity: 1;
    pointer-events: auto;
  }

  .station-list {
    top: 18px;
    right: 18px;
    left: auto;
    bottom: 18px;
    width: 450px;
    height: auto;
    min-height: 0;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 14px;
  }

  body.sheet-collapsed .station-list,
  body.sheet-expanded .station-list {
    height: auto;
    min-height: 0;
    overflow: auto;
  }

  body.sheet-collapsed .mode-switch,
  body.sheet-collapsed .status-strip {
    display: flex;
  }

  body.sheet-collapsed .tabs,
  body.sheet-collapsed .panel {
    display: grid;
  }

  body.sheet-collapsed .signals-bar {
    display: flex;
  }

  body.sheet-collapsed .panel[hidden],
  body.sheet-collapsed .signals-bar[hidden] {
    display: none;
  }

  .sheet-handle {
    display: none;
  }

  .list-head {
    top: -14px;
    padding-top: 0;
  }

  .tabs {
    top: 44px;
  }

  .leaflet-control-zoom {
    display: block;
    margin-top: 160px !important;
    margin-left: 18px !important;
    border: 0 !important;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm) !important;
  }

  .drawer {
    left: auto;
    right: 18px;
    bottom: 18px;
    width: min(450px, calc(100vw - 36px));
    max-height: min(720px, calc(100dvh - 36px));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 18px;
  }

  dialog.sheet-dialog {
    margin: auto;
    max-width: 560px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
  }
}

/* ---------- Compact phones ---------- */

@media (max-width: 380px) {
  .top-panel {
    gap: 8px;
    padding: 8px;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .icon-button {
    width: 40px;
    min-height: 40px;
  }

  h1 {
    font-size: 16px;
  }

  .primary span {
    display: none;
  }

  .mode-button {
    padding: 0 11px;
  }

  .station-list {
    min-height: 300px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
