/* Layout: header bar, list panel on the left, satellite map filling the rest. */
:root {
  --ink: #17201c; --muted: #5b6862; --paper: #f6f7f4; --panel: #ffffff; --line: #dde2dc;
  --accent: #0f6b52; --accent-ink: #ffffff; --new: #c2410c;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #e6ebe7; --muted: #9aa7a0; --paper: #111614; --panel: #171d1a; --line: #2a332e; --accent: #3fb68e; --accent-ink: #0b1210; --new: #fb923c; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--sans); color: var(--ink); background: var(--paper); display: flex; flex-direction: column; }
button { font: inherit; cursor: pointer; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 6px 12px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.ghost { background: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.small { font-size: 12px; }
.bar { display: flex; align-items: center; gap: 16px; padding: 10px max(16px, env(safe-area-inset-left)); border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.mark { width: 14px; height: 14px; border: 2px solid var(--accent); border-radius: 2px; transform: rotate(45deg); }
.meta { color: var(--muted); font-size: 12px; margin-left: auto; }
.meta .preview { color: var(--new); font-weight: 600; }
.only-narrow { display: none; }
.shell { flex: 1; position: relative; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.panel { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; border-radius: 0; padding: 10px; color: var(--muted); background: transparent; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: 8px; padding: 12px 16px 4px; }
.filters input, .filters select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); min-width: 0; }
.filters input { flex: 1 1 60%; }
.filters select { flex: 0 1 40%; }
.count { margin: 4px 16px 8px; color: var(--muted); font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; flex: 1; }
.list li { padding: 10px 8px; border-radius: 6px; cursor: pointer; display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 10px; align-items: start; }
.list li:hover, .list li.active { background: var(--paper); }
.swatch { width: 10px; height: 10px; border-radius: 2px; margin-top: 5px; }
.list .name { font-weight: 600; }
.list .sub { grid-column: 2 / 4; color: var(--muted); font-size: 12px; }
.list .when { font: 12px var(--mono); color: var(--muted); }
.badge { font: 600 10px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--new); border: 1px solid var(--new); border-radius: 4px; padding: 0 4px; margin-left: 6px; vertical-align: 1px; }
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }
.tools { position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.layers { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.legend { position: absolute; left: 12px; bottom: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; display: grid; grid-template-columns: 12px auto; gap: 3px 8px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 2px; display: block; }
.hint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 8px 12px; border-radius: 6px; display: flex; gap: 10px; align-items: center; }
.hint button { color: var(--paper); border-color: var(--paper); padding: 2px 8px; }
.box { position: absolute; border: 2px dashed #fff; background: rgba(255,255,255,.12); box-shadow: 0 0 0 9999px rgba(0,0,0,.35); pointer-events: none; }
.exportcard { position: absolute; right: 12px; top: 12px; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.exportcard h2 { font-size: 15px; margin: 0; }
.exportcard p { margin: 0; color: var(--muted); font-size: 13px; }
.exportcard .row { display: flex; gap: 8px; flex-wrap: wrap; }
.maplibregl-popup-content { background: var(--panel); color: var(--ink); font: 13px/1.45 var(--sans); padding: 12px 14px; max-width: 300px; }
.maplibregl-popup-tip { display: none; }
.pop h3 { margin: 0 0 4px; font-size: 15px; }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 8px 0 0; }
.pop dt { color: var(--muted); }
.pop dd { margin: 0; }
@media (max-width: 760px) {
  .only-narrow { display: inline-block; }
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .panel { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; height: 45%; border-right: 0; border-top: 1px solid var(--line); }
  .panel.closed { display: none; }
  .exportcard { left: 12px; right: 12px; width: auto; }
  .legend { display: none; }
  .meta { display: none; }
  .layers { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.lyr-title { font: 600 11px var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.lyr-groups { display: flex; flex-direction: column; gap: 4px; }
.layers label { display: flex; align-items: center; gap: 6px; }
.layers .sw { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex: none; }
.layers .n { margin-left: auto; padding-left: 10px; font: 12px var(--mono); color: var(--muted); }
.layers .newrow { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
