/* Layout: instrument panel (left) + full-bleed map (right); stacks map-over-panel on phones.
   Palette: Alpine & Sedge — olive neutral spine, anodized-copper accent. */
:root {
  --bg: #f1f0e4;          /* Sedge base */
  --surface: #e7e6d6;
  --raised: #fbfaf2;
  --fg: #22271d;
  --muted: #5e6553;
  --line: #cdcbb8;
  --accent: #f2833c;      /* anodized copper */
  --accent-ink: #b4541a;  /* copper for text on light */
  --on-accent: #1d1209;
  --warn: #9a6a00;
  --focus: #f2833c;
  --font-ui: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181c15;        /* Alpine base */
    --surface: #20251c;
    --raised: #272d22;
    --fg: #e5e4d5;
    --muted: #9ea392;
    --line: #363d2f;
    --accent: #f2833c;
    --accent-ink: #f49a5f;
    --on-accent: #1d1209;
    --warn: #e2b24a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14px/1.45 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.app { display: grid; grid-template-columns: minmax(320px, 380px) 1fr; height: 100%; }
.panel { overflow-y: auto; border-right: 1px solid var(--line); padding-block: 20px 24px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: 18px; display: flex; flex-direction: column; gap: 22px; }
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

.brand h1 { margin: 0; font-size: 26px; font-stretch: 78%; font-weight: 800; letter-spacing: -0.01em; text-transform: uppercase; }
.brand p { margin: 2px 0 0; color: var(--muted); }

.step { display: flex; flex-direction: column; gap: 10px; }
.step h2 { margin: 0; font-size: 12px; font-weight: 700; font-stretch: 85%; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.step h2 .n { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--fg); color: var(--bg); font-size: 11px; letter-spacing: 0; }
.hint { margin: 0; color: var(--muted); font-size: 13px; }

.drop { position: relative; display: grid; gap: 2px; justify-items: center; text-align: center; padding: 18px 12px; border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop span { color: var(--muted); font-size: 13px; }

.filecard { background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.filecard-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.fname { font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.tag { font: 500 11px var(--font-mono); text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--surface); color: var(--muted); flex: none; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; font-size: 13px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; font-family: var(--font-mono); font-variant-numeric: tabular-nums; text-align: right; }
.warnings { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.warnings li { font-size: 12.5px; color: var(--warn); padding-left: 14px; position: relative; }
.warnings li::before { content: "!"; position: absolute; left: 2px; font-weight: 800; }
.layers { border: 0; padding: 0; margin: 0; display: grid; gap: 4px; }
.layers legend { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
#layerlist { display: grid; gap: 2px; max-height: 140px; overflow-y: auto; }

.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-size: 12.5px; font-weight: 600; }
.unit { font-weight: 400; color: var(--muted); }
input, select { font: inherit; color: var(--fg); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r); padding: 7px 9px; width: 100%; min-width: 0; }
input.mono { font-family: var(--font-mono); font-size: 13px; }
input[aria-invalid="true"] { border-color: #c4372b; }
.range-row { display: grid; grid-template-columns: 1fr 76px; gap: 8px; align-items: center; }
input[type="range"] { padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.check input { width: auto; accent-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.span2 { grid-column: span 2; }
.size { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { font: 600 13px var(--font-ui); padding: 7px 12px; border-radius: var(--r); border: 1px solid var(--line); background: var(--raised); color: var(--fg); cursor: pointer; }
.btn:hover:not(:disabled) { border-color: var(--fg); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.06); border-color: var(--accent); }
.btn.small { padding: 3px 9px; font-size: 12px; }

.summary { font-size: 13px; display: grid; gap: 2px; }
.summary strong { font-family: var(--font-mono); font-weight: 500; }
.routes { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-top: 1px solid var(--line); max-height: 320px; overflow-y: auto; }
.routes li { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 7px 2px; border-bottom: 1px solid var(--line); }
.routes .sw { width: 10px; height: 10px; border-radius: 2px; }
.routes .rn { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; }
.routes .rm { font: 12px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.routes .rm .warnc { color: var(--warn); }

.foot { margin-top: auto; font-size: 12px; color: var(--muted); }

.busy { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; background: var(--raised); color: var(--fg); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; box-shadow: 0 2px 10px rgb(0 0 0 / .12); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
.dropveil { position: fixed; inset: 0; display: grid; place-items: center; font: 800 28px var(--font-ui); font-stretch: 78%; text-transform: uppercase; color: var(--on-accent); background: color-mix(in srgb, var(--accent) 70%, transparent); z-index: 50; pointer-events: none; }

/* map handles */
.handle { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 1px 4px rgb(0 0 0 / .45); cursor: grab; }
.handle.move { width: 26px; height: 26px; border-radius: 6px; background: #fff; border: 2px solid var(--accent); display: grid; place-items: center; }
.handle.move::before { content: ""; width: 12px; height: 12px; background:
  linear-gradient(var(--accent), var(--accent)) center/12px 2px no-repeat,
  linear-gradient(var(--accent), var(--accent)) center/2px 12px no-repeat; }
.handle:active { cursor: grabbing; }
.maplibregl-ctrl-attrib { font-size: 11px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 52vh auto; height: auto; min-height: 100%; }
  .mapwrap { grid-row: 1; height: 52vh; position: sticky; top: 0; z-index: 2; }
  .panel { grid-row: 2; border-right: 0; overflow: visible; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-bottom: max(24px, env(safe-area-inset-bottom, 0px)); }
}
