:root {
  --paper: #faf8f3;
  --card: #ffffff;
  --ink: #1c2321;
  --muted: #66706c;
  --line: #e2ded3;
  --accent: #1f4d3f;
  --accent-ink: #faf8f3;
  --gold: #a9812f;
  --danger: #a33a2c;
  --shadow: 0 18px 50px rgb(28 35 33 / 18%);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161b19;
    --card: #1f2522;
    --ink: #f0ede4;
    --muted: #a0a9a4;
    --line: #333b37;
    --accent: #a8cdbb;
    --accent-ink: #161b19;
    --gold: #d4b26a;
    --danger: #eda193;
    --shadow: 0 18px 50px rgb(0 0 0 / 50%);
  }
}

* { box-sizing: border-box; }

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

body {
  position: relative;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 14.5px/1.55 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

#map { position: absolute; inset: 0; }

[hidden] { display: none !important; }

.panel {
  position: absolute;
  z-index: 1000;
  top: 20px;
  bottom: 20px;
  left: 20px;
  width: 400px;
  overflow-y: auto;
  padding: 28px 28px 32px;
  border-radius: 4px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

h1 { margin: 0; font-size: 34px; line-height: 1.1; }
h2 { margin: 28px 0 4px; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }

a { color: var(--accent); text-underline-offset: 2px; }

.tabs {
  display: flex;
  gap: 24px;
  margin: 20px 0 0;
  border-bottom: 1px solid var(--line);
}

.tab {
  padding: 8px 0;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-weight: 500;
}

.tab[aria-selected="true"] { border-bottom-color: var(--gold); color: var(--ink); }

#status { min-height: 1.5em; margin: 12px 0; color: var(--muted); font-size: 13px; }
#status.error { color: var(--danger); }

label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; }

input, select, button { font: inherit; color: inherit; }

input[type="search"], input[type="number"], select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--card);
}

button {
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

button:hover { opacity: 0.88; }
button.tab { min-height: 0; }
button.quiet { background: transparent; color: var(--accent); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.search-box { display: flex; gap: 8px; }
.search-box input { min-width: 0; }

.hint { margin: 6px 0; color: var(--muted); font-size: 12.5px; }

.result { margin-top: 8px; padding-top: 4px; }
.result h2 { margin-top: 12px; }

.meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 6px 0 16px;
  color: var(--muted);
  font-size: 12.5px;
}

.fact {
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fact-value { font-family: "Cormorant Garamond", Georgia, serif; font-size: 22px; font-weight: 600; }

.steps { margin: 16px 0; padding: 0; list-style: none; counter-reset: step; }

.steps li {
  position: relative;
  padding: 0 0 12px 30px;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: -3px;
  left: 0;
  color: var(--gold);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 20px;
  font-weight: 600;
}

.dropzone {
  display: block;
  padding: 26px 20px;
  border: 1px dashed var(--muted);
  border-radius: 2px;
  background: var(--card);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.dropzone:hover, .dropzone.dragging { border-color: var(--gold); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.dropzone-title { display: block; margin-bottom: 4px; font-size: 14.5px; font-weight: 500; }

.file-summary { margin: 14px 0 0; font-weight: 500; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

.progress { height: 3px; margin: 12px 0; background: var(--line); }
.progress span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 0.3s ease; }

.batch-list, .radius-list { margin: 8px 0 0; padding: 0; list-style: none; }

.batch-list li, .radius-list li { border-top: 1px solid var(--line); }

.batch-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 0;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--ink);
  font-weight: 400;
  text-align: left;
}

.batch-row small { display: block; color: var(--muted); font-size: 12px; }
.batch-row .badge { flex: none; color: var(--muted); font-size: 12.5px; }
.batch-row .badge.failed { color: var(--danger); }

.radius-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.radius-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; }
.radius-list span:last-child { flex: none; color: var(--muted); }

.pin {
  width: 18px !important;
  height: 18px !important;
  margin: -9px 0 0 -9px !important;
  border: 3px solid #faf8f3;
  border-radius: 50%;
  background: #1f4d3f;
  box-shadow: 0 2px 8px rgb(0 0 0 / 45%);
}

.north-arrow {
  width: 38px;
  padding: 6px 7px 3px;
  border-radius: 2px;
  background: rgb(28 35 33 / 88%);
}

.north-arrow svg { display: block; fill: #faf8f3; stroke: #faf8f3; stroke-width: 0.8; }
.north-arrow .hollow { fill: transparent; }
.north-arrow text { font: 600 11px Inter, system-ui, sans-serif; text-anchor: middle; stroke: none; }

.leaflet-control-scale-line {
  border-color: #1c2321;
  background: rgb(250 248 243 / 85%);
  color: #1c2321;
}

@media (max-width: 760px) {
  body { overflow: auto; }
  #map { position: relative; inset: auto; height: 45vh; }
  .panel {
    position: static;
    width: auto;
    overflow: visible;
    padding: 20px 16px 28px;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
