:root {
  color-scheme: dark;
  --bg: #080b10;
  --panel: #101620;
  --panel-2: #171f2c;
  --line: #2c394c;
  --text: #eef3f8;
  --muted: #9aa9ba;
  --accent: #f2aa4c;
  --exact: #66d9ef;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); }
body { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
header {
  min-height: 76px; padding: 12px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(100deg, #101720, #151a22);
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 1.55rem; font-weight: 640; letter-spacing: .01em; }
h2 { margin-bottom: 4px; }
h3 { font-size: .88rem; letter-spacing: .055em; text-transform: uppercase; }
.eyebrow { color: var(--accent); margin-bottom: 2px; text-transform: uppercase; letter-spacing: .14em; font-size: .68rem; }
.target-label { display: grid; grid-template-columns: auto minmax(170px, 260px); align-items: center; gap: 10px; color: var(--muted); }
select, button { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 5px; }
select { min-height: 36px; padding: 6px 28px 6px 10px; }
button { cursor: pointer; padding: 5px 9px; }
button:hover, button:focus-visible, select:focus-visible { border-color: var(--accent); outline: none; }
main { min-height: 0; display: grid; grid-template-columns: 330px 1fr; }
#sidebar { overflow-y: auto; padding: 18px; background: var(--panel); border-right: 1px solid var(--line); }
#sidebar section { border-bottom: 1px solid var(--line); padding-bottom: 15px; margin-bottom: 16px; }
.muted { color: var(--muted); font-size: .84rem; line-height: 1.45; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; }
.section-heading button { font-size: .72rem; padding: 3px 7px; }
.layers { display: grid; gap: 8px; }
.layer { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 8px; background: #131b26; border-radius: 5px; border-left: 3px solid var(--exact); }
.layer.superseded { border-left-color: #8c7f72; opacity: .79; }
.layer input { margin-top: 3px; accent-color: var(--accent); }
.layer-title { display: block; font-size: .82rem; line-height: 1.25; }
.layer-meta { display: block; color: var(--muted); font-size: .69rem; margin-top: 3px; }
.badge { display: inline-block; margin-left: 4px; padding: 1px 4px; border-radius: 3px; background: #40382d; color: #ffd699; text-transform: uppercase; font-size: .58rem; }
#legend-section p { color: var(--muted); font-size: .76rem; line-height: 1.4; }
.swatch { display: inline-block; width: 12px; height: 12px; vertical-align: -2px; margin-right: 5px; border-radius: 2px; }
.swatch.density { background: linear-gradient(135deg, #391d63, #f0a636, #fff1a8); }
.swatch.exact { border: 2px solid var(--exact); border-radius: 50%; }
#record-detail { max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: .7rem; color: #c9d5e1; }
#non-spatial { border: 1px solid #70502d; padding: 14px; background: #201a13; }
#non-spatial p, #non-spatial li { color: #d6c3aa; font-size: .82rem; line-height: 1.5; }
#map-shell { min-width: 0; min-height: 0; position: relative; overflow: hidden; background: #05070a; }
#map { display: block; width: 100%; height: 100%; cursor: grab; }
#map.dragging { cursor: grabbing; }
#map .ol-viewport { background: #05070a; }
#map-message { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 9px 12px; border-radius: 4px; background: #0c121bd9; color: var(--muted); pointer-events: none; }
.map-controls { position: absolute; top: 12px; left: 12px; display: grid; grid-template-columns: 34px 34px auto; gap: 4px; }
.map-controls button { height: 34px; background: #0c121be6; }
#coordinates, .projection-note { position: absolute; bottom: 10px; padding: 5px 8px; background: #0c121bd9; color: #c0cad5; font-size: .7rem; border-radius: 3px; pointer-events: none; }
#coordinates { left: 10px; }
.projection-note { right: 10px; }
@media (max-width: 760px) {
  body { overflow: auto; }
  main { grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 65vh); }
  #sidebar { max-height: none; border-right: 0; }
  header { align-items: stretch; flex-direction: column; gap: 8px; }
  .target-label { grid-template-columns: auto 1fr; }
}
