:root {
  --bg: #ffffff;
  --fg: #1b1f24;
  --muted: #5d6670;
  --line: #d7dce1;
  --accent: #0b6e99;
  --chip: #eef2f5;
  --warn-bg: #fff4d6;
  --warn-fg: #7a5200;
  --shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1d2126; --fg: #e8ebee; --muted: #9aa4ae; --line: #3a4148;
    --accent: #5cc0ea; --chip: #2a3036; --warn-bg: #3d3214; --warn-fg: #f2cf72;
  }
}
:root[data-theme="dark"] {
  --bg: #1d2126; --fg: #e8ebee; --muted: #9aa4ae; --line: #3a4148;
  --accent: #5cc0ea; --chip: #2a3036; --warn-bg: #3d3214; --warn-fg: #f2cf72;
}

html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 14px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#map { position: absolute; inset: 0; background: #aad3df; }

.panel { position: absolute; z-index: 1000; top: 12px; right: 12px; width: 300px;
  max-width: calc(100vw - 32px); max-height: calc(100vh - 120px); overflow: auto;
  background: var(--bg); color: var(--fg); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; }
.panel header { display: flex; align-items: center; justify-content: space-between; }
.panel h1 { font-size: 15px; margin: 0; }
.icon-btn { border: 0; background: var(--chip); color: var(--fg); width: 26px; height: 26px; border-radius: 6px;
  cursor: pointer; font-size: 16px; line-height: 1; }
.panel.collapsed #panel-body { display: none; }

.switch-row { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0 6px; cursor: pointer; }
.switch-row small { display: block; color: var(--muted); font-size: 12px; }
.switch-row.small { margin-top: 12px; font-size: 13px; }

.layer { border-top: 1px solid var(--line); padding: 8px 0; }
.layer-head { display: flex; align-items: center; gap: 8px; }
.layer-head label { flex: 1; display: flex; gap: 8px; align-items: center; cursor: pointer; }
.swatch { width: 12px; height: 12px; border-radius: 3px; border: 2px solid; flex: none; }
.zooms { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.layer.inactive .layer-head label { color: var(--muted); }
.meter { height: 3px; background: var(--chip); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .15s; }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 9px; margin: 6px 4px 0 0;
  background: var(--warn-bg); color: var(--warn-fg); }
.tag.private { background: var(--chip); color: var(--muted); }

.seg { display: flex; margin-top: 8px; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--fg); padding: 5px 6px; cursor: pointer; font: inherit; font-size: 13px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg-note { color: var(--muted); font-size: 12px; margin-top: 4px; }

.btn { width: 100%; margin-top: 10px; padding: 6px; border-radius: 7px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { position: absolute; z-index: 1000; left: 12px; bottom: 26px; max-width: calc(100vw - 32px);
  background: var(--bg); color: var(--fg); border-radius: 8px; box-shadow: var(--shadow);
  padding: 6px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.badge:empty { display: none; }
.badge b { font-weight: 600; }
.badge .row + .row { margin-top: 3px; }
.zoomtag { position: absolute; z-index: 1000; left: 52px; top: 10px; background: var(--bg); color: var(--muted);
  border-radius: 6px; box-shadow: var(--shadow); padding: 3px 8px; font-size: 12px; font-variant-numeric: tabular-nums; }

.maplibregl-ctrl-attrib { font-size: 10px; max-width: 70vw; }
.cov-tip .maplibregl-popup-content { padding: 6px 8px; font-size: 12px; }

@media (max-width: 600px) {
  .panel { top: auto; bottom: 64px; right: 16px; left: 16px; width: auto; max-height: 50vh; }
  .badge { left: 16px; right: 16px; bottom: 20px; }
}

.scene-pop { font-size: 12px; font-variant-numeric: tabular-nums; }
.scene-pop .muted { color: #5d6670; margin: 2px 0 4px; }
.scene-pop table { border-collapse: collapse; margin-top: 4px; }
.scene-pop th, .scene-pop td { text-align: left; padding: 1px 8px 1px 0; }
.scene-pop th { font-weight: 600; border-bottom: 1px solid #d7dce1; }

