:root {
  --ink: #12263a; --muted: #4a5b6c; --line: #c9d3dd; --bg: #f5f7fa; --panel: #fff;
  --brand: #0b6e8a; --brand-dark: #07506a; --focus: #f2a900;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: #fff; padding: 8px; z-index: 10; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.bar { display: flex; gap: 16px; align-items: center; padding: 10px 16px; background: var(--brand-dark); color: #fff; }
.bar h1 { font-size: 1.15rem; margin: 0; }
.bar p { margin: 0 auto 0 0; font-size: .9rem; }
.bar form { margin: 0; }
button { font: inherit; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--brand); background: var(--brand); color: #fff; cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
button.link { background: transparent; border-color: #fff; }
.layout { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 52px); }
.controls { background: var(--panel); border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.controls fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.controls legend, .controls > label { font-weight: 600; font-size: .9rem; }
.controls select, #search { font: inherit; padding: 6px; border: 1px solid var(--muted); border-radius: 6px; width: 100%; }
.controls h2, #tables h2 { font-size: 1rem; margin: 8px 0 4px; }
.legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.legend li { display: flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; vertical-align: middle; width: 28px; height: 18px; border: 1px solid var(--ink); border-radius: 3px; flex: none; background-size: cover; }
main { display: flex; flex-direction: column; min-width: 0; }
#map { height: 62vh; min-height: 380px; }
#tables { padding: 12px 16px 32px; }
.hint { color: var(--muted); margin: 0 0 6px; font-size: .9rem; }
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th button { background: none; border: 0; color: var(--ink); padding: 0; font-weight: 700; }
th[aria-sort] button::after { content: " ⇅"; color: var(--muted); }
th[aria-sort="ascending"] button::after { content: " ▲"; }
th[aria-sort="descending"] button::after { content: " ▼"; }
td.num, th.num { text-align: right; }
.bucket { display: inline-flex; align-items: center; gap: 6px; }
.bucket .swatch { width: 18px; height: 12px; }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.maplibregl-popup-content { font-size: .9rem; color: var(--ink); }
.maplibregl-popup-content a { color: var(--brand-dark); font-weight: 600; }
.login { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: #fff; padding: 28px; border-radius: 10px; border: 1px solid var(--line); width: min(360px, 92vw); }
.login-card form { display: flex; flex-direction: column; gap: 8px; }
.login-card input { font: inherit; padding: 8px; border: 1px solid var(--muted); border-radius: 6px; }
.error { color: #a4161a; font-weight: 600; }
@media (max-width: 800px) { .layout { grid-template-columns: 1fr; } .controls { border-right: 0; border-bottom: 1px solid var(--line); } }
