:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #15181d;
  --muted: #5f6773;
  --border: #dde1e7;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --accent-soft: #e6efff;
  --good: #1a7f4b;
  --warn: #b26b00;
  --bad: #c0392b;
  --area: #1f6feb;
  --area-high: #e8590c;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / .06), 0 8px 24px rgb(0 0 0 / .08);
  color-scheme: light;
}
/* Pages can opt into dark regardless of OS with <html data-theme="dark">. */
:root[data-theme="dark"] {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f242c;
    --text: #e8ebef;
    --muted: #9aa3ae;
    --border: #2b323c;
    --accent: #4c8dff;
    --accent-soft: #1a2a45;
    --good: #3fb97a;
    --warn: #e0a030;
    --bad: #ef6b5b;
    --area: #4c8dff;
    --area-high: #ff8a3d;
    color-scheme: dark;
  }
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f242c;
    --text: #e8ebef;
    --muted: #9aa3ae;
    --border: #2b323c;
    --accent: #4c8dff;
    --accent-soft: #1a2a45;
    --good: #3fb97a;
    --warn: #e0a030;
    --bad: #ef6b5b;
    --area: #4c8dff;
    --area-high: #ff8a3d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 1.6rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

button, .btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: .6em 1em;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
}
button:hover, .btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: not-allowed; }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: .6em .75em;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input:not([type=radio]):not([type=checkbox]):focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=radio]:focus, input[type=checkbox]:focus { outline: none; }
textarea { min-height: 90px; resize: vertical; }
label { font-weight: 600; display: block; margin-bottom: .35em; }
.req::after { content: " *"; color: var(--bad); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.pill {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: .15em .6em;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.pill.high { background: color-mix(in srgb, var(--area-high) 18%, transparent); color: var(--area-high); }
.error-text { color: var(--bad); font-size: .9rem; }

/* Leaflet popups/controls pick up the theme */
.leaflet-container { font: inherit; background: var(--surface-2); }

/* Chrome draws a bounding-box focus ring around clicked SVG shapes; the
   selected area is highlighted by its own outline instead (areaStyle). */
.leaflet-interactive:focus, .leaflet-interactive:focus-visible { outline: none; }

/* MapLibre hover label for areas */
.area-tip .maplibregl-popup-content { padding: 4px 10px; border-radius: 8px; font-weight: 600; font-size: .85rem; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.area-tip .maplibregl-popup-tip { display: none; }
.maplibregl-ctrl-group button { color: #222; }

.sat-toggle { width: auto !important; padding: 0 10px !important; font: 600 12px/29px Inter, system-ui, sans-serif; }
