:root {
  --bg: #0f172a; --bg2: #16213a; --bg3: #1e2a48; --line: #2b3a5e;
  --fg: #e6edf7; --fg2: #a9b6cf; --fg3: #7b89a6;
  --accent: #38bdf8; --accent2: #f59e0b; --danger: #ef4444; --ok: #22c55e;
  --panel-w: 440px; --top-h: 58px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--fg); font-size: 14px; }
body { display: flex; flex-direction: column; overflow: hidden; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }

#topbar {
  min-height: var(--top-h); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: var(--bg2); border-bottom: 1px solid var(--line); position: relative; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.brand .logo { font-size: 26px; width: 30px; height: 30px; border-radius: 50%; display: block; }
.brand .title { font-weight: 700; font-size: 17px; letter-spacing: .2px; }
.brand .subtitle { font-size: 11px; color: var(--fg3); }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; flex: 1; }
.ctl { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg2); }
.ctl > span:first-child { text-transform: uppercase; letter-spacing: .4px; font-size: 10px; color: var(--fg3); }
.ctl input, .ctl select, .toggles select {
  background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; color: var(--fg); font-size: 12px;
}
.ctl input[type=date] { color-scheme: dark; }
.toggle { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 5px 9px; font-size: 12px; color: var(--fg2); cursor: pointer; }
.toggle.on { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.toggle:hover { filter: brightness(1.15); }
.chip { background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.chip.alerts.hot { background: #7f1d1d; border-color: var(--danger); color: #fff; }
.chip:hover { filter: brightness(1.15); }

#main { position: relative; flex: 1; min-height: 0; display: flex; }
#map-wrap { position: relative; flex: 1; min-height: 0; display: flex; }
#map { flex: 1; height: 100%; }
.maplibregl-popup-content { background: var(--bg2); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--bg2); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--bg2); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--bg2); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--bg2); }
.popup-title { font-weight: 600; margin-bottom: 3px; }
.popup-big { font-size: 20px; font-weight: 700; }
.popup-sub { color: var(--fg2); font-size: 11px; }
.maplibregl-ctrl-group { background: var(--bg2); }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.4); }

.floating { position: absolute; z-index: 5; background: rgba(22, 33, 58, .92); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 12px; backdrop-filter: blur(4px); }
#legend { left: 12px; bottom: 34px; max-width: 220px; max-height: calc(100% - 60px); overflow: auto; }
.legend-toggle { display: none; background: none; border: none; color: var(--fg2); font-size: 12px; padding: 0; cursor: pointer; }
#legend.collapsed #legend-body { display: none; }
#legend h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); }
#legend h4 + h4 { margin-top: 8px; }
.legend-row { display: flex; align-items: center; gap: 7px; line-height: 18px; }
.swatch { width: 13px; height: 13px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35); flex: none; }
.swatch.sq { border-radius: 3px; }
#status { left: 12px; bottom: 8px; padding: 3px 8px; font-size: 11px; color: var(--fg2); }
#status.error { color: #fca5a5; border-color: var(--danger); }

#panel { width: var(--panel-w); background: var(--bg2); border-left: 1px solid var(--line); display: flex; flex-direction: column; transition: width .2s; }
#panel:not(.open) { width: 36px; }
#panel:not(.open) .panel-body, #panel:not(.open) .tabs { display: none; }
.panel-head { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.tabs { display: flex; flex: 1; }
.tab { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; padding: 10px 4px; color: var(--fg2); cursor: pointer; font-size: 13px; }
.tab.on { color: #fff; border-bottom-color: var(--accent); }
.tab:disabled { color: var(--fg3); cursor: default; opacity: .6; }
#panel-toggle { background: none; border: none; color: var(--fg2); font-size: 20px; padding: 6px 10px; cursor: pointer; }
#panel:not(.open) #panel-toggle { transform: rotate(180deg); }
.panel-body { flex: 1; overflow: auto; padding: 12px 14px 24px; }
.tab-pane { display: none; }
.tab-pane.on { display: block; }

h2 { font-size: 16px; margin: 0 0 2px; }
h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); margin: 16px 0 6px; }
.muted { color: var(--fg2); font-size: 12px; }
.small { font-size: 11px; color: var(--fg3); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; }
.kv dt { color: var(--fg3); }
.kv dd { margin: 0; }
.stat-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.stat { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 90px; flex: 1; }
.stat .v { font-size: 20px; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--fg3); margin-top: 2px; }
.stat .s { font-size: 11px; color: var(--fg2); }
.stat.warn .v { color: var(--accent2); }
.stat.bad .v { color: var(--danger); }
.stat.good .v { color: var(--ok); }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; color: var(--fg3); font-weight: 500; border-bottom: 1px solid var(--line); padding: 4px 6px; font-size: 11px; }
table.data td { padding: 4px 6px; border-bottom: 1px solid rgba(43,58,94,.5); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover { background: var(--bg3); }
.chart { width: 100%; height: 220px; margin: 4px 0; }
.chart.tall { height: 280px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.btn { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; font-size: 12px; cursor: pointer; color: var(--fg); }
.btn:hover { filter: brightness(1.15); }
.btn.primary { background: #1d4ed8; border-color: #3b82f6; color: #fff; }
.alert { border-left: 3px solid var(--danger); background: rgba(127,29,29,.25); padding: 6px 8px; border-radius: 4px; margin: 6px 0; font-size: 12px; }
.alert.moderate { border-left-color: var(--accent2); background: rgba(120,53,15,.25); }
.alert.minor { border-left-color: var(--accent); background: rgba(14,116,144,.2); }
.alert .h { font-weight: 600; }
.notice { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; color: var(--fg2); margin: 8px 0; }
.spinner { color: var(--fg3); font-size: 12px; padding: 12px 0; }
.spinner::before { content: "⟳ "; display: inline-block; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hydro-img { width: 100%; border-radius: 6px; background: #fff; margin: 4px 0; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; background: var(--bg3); border: 1px solid var(--line); color: var(--fg2); margin-right: 4px; }
.pill.class { color: #fff; border: none; }
.forecast-row { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; }
.fc { flex: none; width: 92px; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 6px; font-size: 11px; }
.fc .n { font-weight: 600; }
.fc .t { font-size: 15px; font-weight: 700; margin: 2px 0; }
.fc .p { color: var(--accent); }
.fc .d { color: var(--fg2); line-height: 1.2; }

#attrib { flex: none; height: 26px; line-height: 26px; padding: 0 12px; font-size: 11px; color: var(--fg3); background: var(--bg2); border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

}

/* projects */
.form label { display: block; font-size: 11px; color: var(--fg3); margin: 8px 0 2px; text-transform: uppercase; letter-spacing: .4px; }
.form input, .form select, .form textarea { display: block; width: 100%; background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; color: var(--fg); font-size: 13px; text-transform: none; letter-spacing: 0; }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checks { display: flex; flex-direction: column; gap: 3px; margin: 2px 0 6px; }
.chk { display: flex !important; align-items: center; gap: 6px; text-transform: none !important; letter-spacing: 0 !important; font-size: 12px !important; color: var(--fg) !important; margin: 0 !important; }
.chk input { width: auto; display: inline; margin: 0; }
.btn.danger { border-color: var(--danger); color: #fca5a5; margin-left: auto; }
.pcard { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin: 6px 0; cursor: pointer; }
.pcard:hover { border-color: var(--accent); }
.pcard.alert-on { border-color: var(--danger); }
.pcard-head { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pcard-stats { display: flex; gap: 14px; margin-top: 4px; font-size: 12px; color: var(--fg2); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }

.ctl-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg2); }
.ctl-inline input, .ctl-inline select { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; color: var(--fg); font-size: 12px; }
details summary { margin: 6px 0; }
table.data sub { font-size: 9px; }

.save-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 10px 0; padding: 8px; background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; }
.save-row select, .save-row input { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 5px 7px; color: var(--fg); font-size: 12px; }
.save-row input { flex: 1; min-width: 140px; }
.btn.danger { margin-left: 0; }

/* loading bar */
#loadbar { position: relative; height: 0; overflow: visible; flex: none; z-index: 30; }
#loadbar-fill { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, #38bdf8, #22c55e); transition: width .35s ease; opacity: 0; box-shadow: 0 0 8px rgba(56,189,248,.6); }
#loadbar-text { position: absolute; right: 12px; top: 6px; font-size: 11px; color: var(--fg2); background: rgba(22,33,58,.9); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#loadbar.on #loadbar-fill, #loadbar.on #loadbar-text { opacity: 1; }

/* terrain menu */
.menu-wrap { position: relative; }
.menu { position: absolute; top: 34px; left: 0; z-index: 40; width: 320px; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12px; color: var(--fg); text-transform: none; letter-spacing: 0; }
.menu-title { font-weight: 600; margin-bottom: 6px; }
.menu-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--fg); }
.menu-row input[type=checkbox] { margin: 0; }
.menu-row input[type=range] { flex: 1; }
.menu .small { margin-top: 6px; }

details.steps { background: var(--bg3); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 10px 0; font-size: 12px; }
details.steps summary { cursor: pointer; font-weight: 600; color: var(--fg); }
details.steps ol { padding-left: 18px; margin: 6px 0 2px; }
details.steps li { margin: 5px 0; line-height: 1.4; color: var(--fg2); }
details.steps code { background: var(--bg2); padding: 0 4px; border-radius: 3px; font-size: 11px; }

/* search */
.search-wrap { position: relative; }
#ctl-search { width: 250px; background: var(--bg3); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; color: var(--fg); font-size: 12px; }
#ctl-search:focus { outline: none; border-color: var(--accent); }
#search-results { width: 340px; padding: 4px; max-height: 60vh; overflow: auto; }
.sr-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.sr-item:hover, .sr-item.active { background: var(--bg3); }
.sr-kind { width: 16px; text-align: center; flex: none; margin-top: 1px; }
.sr-kind.gauge { color: #f59e0b; } .sr-kind.station { color: #38bdf8; } .sr-kind.project { color: #a78bfa; } .sr-kind.place { color: var(--fg2); }
.sr-empty { padding: 6px 8px; color: var(--fg3); font-size: 12px; }
.step { background: var(--bg3); border: 1px solid var(--line); border-radius: 6px; padding: 4px 7px; font-size: 12px; color: var(--fg2); cursor: pointer; }
.step:hover { color: var(--fg); border-color: var(--accent); }
/* help modal */
.modal[hidden], .menu[hidden], #map-hint[hidden] { display: none !important; }
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 15px; }
.modal-head button { background: none; border: none; color: var(--fg2); font-size: 16px; cursor: pointer; }
.modal-body { padding: 8px 18px 18px; overflow: auto; font-size: 13px; line-height: 1.45; }
.modal-body h4 { margin: 14px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); }
.modal-body ul { padding-left: 18px; margin: 4px 0; }
.modal-body li { margin: 3px 0; }
.hint { background: rgba(56,189,248,.08); border: 1px dashed rgba(56,189,248,.4); border-radius: 6px; padding: 6px 9px; font-size: 12px; color: var(--fg2); margin: 8px 0; }
.legend-toggle-row { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fg2); margin-top: 4px; cursor: pointer; }

/* ---------- mobile / narrow (≤ 900px): compact header, scrolling control strip, bottom-sheet panel ---------- */
@media (max-width: 900px) {
  :root { --top-h: auto; }
  #topbar { flex-wrap: wrap; padding: 6px 8px 4px; gap: 6px 8px; align-items: center; }
  .brand { min-width: 0; flex: 1; gap: 8px; }
  .brand .logo { font-size: 20px; }
  .brand .title { font-size: 15px; }
  .brand .subtitle { display: none; }
  .search-wrap { order: -2; flex: 0 0 auto; }
  #ctl-search { width: 40px; height: 34px; padding: 6px 10px 6px 30px; transition: width .15s; background: var(--bg3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a9b6cf' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E") no-repeat 9px center / 16px 16px; }
  #ctl-search:focus, #ctl-search.open { width: min(70vw, 320px); }
  #ctl-search::placeholder { color: transparent; }
  #ctl-search:focus::placeholder { color: var(--fg3); }
  #search-results { position: fixed; left: 8px; right: 8px; width: auto; top: 96px; }
  .controls { order: 3; flex-basis: 100%; flex-wrap: nowrap; overflow-x: auto; overflow-y: visible; gap: 6px; padding: 2px 0 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .controls::-webkit-scrollbar { display: none; }
  .controls > * { flex: 0 0 auto; }
  .ctl > span:first-child { display: none; }
  .ctl input, .ctl select, .toggles select, .toggle, .chip, .step { min-height: 34px; }
  .toggles { gap: 4px; }
  #btn-help { order: -1; }
  .menu { position: fixed; left: 8px; right: 8px; width: auto; max-height: 60vh; overflow: auto; }
  #main { flex-direction: column; }
  #map-wrap { flex: 1; min-height: 0; }
  #legend { bottom: auto; top: 8px; right: 8px; left: auto; max-width: 200px; }
  #legend-body { max-height: 40vh; overflow: auto; }
  #status { max-width: calc(100% - 24px); }
  /* bottom sheet */
  #panel { width: 100%; border-left: none; border-top: 1px solid var(--line); flex: none; height: 44px; transition: height .2s; box-shadow: 0 -6px 20px rgba(0,0,0,.35); }
  #panel[data-sheet="half"] { height: 52vh; }
  #panel[data-sheet="full"] { height: calc(100% - 4px); }
  #panel:not(.open) { width: 100%; height: 44px; }
  #panel:not(.open) .tabs { display: flex; }
  .panel-head { position: relative; }
  .panel-head::before { content: ""; position: absolute; left: 50%; top: 3px; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--line); }
  .tabs { padding-top: 4px; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 10px 12px; }
  #panel-toggle { transform: none !important; font-size: 18px; padding: 6px 12px; }
  #panel-toggle::after { content: "▴"; }
  #panel[data-sheet="full"] #panel-toggle::after { content: "▾"; }
  #panel-toggle { font-size: 0; }
  #panel-toggle::after { font-size: 16px; }
  .panel-body { padding: 10px 12px 28px; }
  .stat .v { font-size: 17px; }
  .chart { height: 200px; }
  .chart.tall { height: 240px; }
  #attrib { white-space: nowrap; overflow-x: auto; height: 22px; line-height: 22px; font-size: 10px; scrollbar-width: none; }
  .forecast-row .fc { width: 84px; }
  .stat-row { gap: 6px; }
  .stat { min-width: 96px; padding: 6px 8px; }
  table.data { font-size: 11.5px; }
  .modal { padding: 8px; }
  .modal-body { font-size: 12.5px; }
}
@media (max-width: 480px) {
  #legend { max-width: 170px; font-size: 11px; }
  .legend-row { line-height: 16px; }
}

/* panel history */
.nav-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--bg2); font-size: 12px; }
.nav-back { padding: 3px 9px; font-size: 12px; }
.crumbs { display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; color: var(--fg3); min-width: 0; }
.crumb { cursor: pointer; color: var(--accent); overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.crumb.on { color: var(--fg); cursor: default; }
.crumb-sep { color: var(--fg3); }
th.has-tip, .stat .l.has-tip { cursor: help; text-decoration: underline dotted rgba(169,182,207,.5); text-underline-offset: 3px; }
@media (max-width: 900px) { .nav-bar { padding: 4px 8px; } }
details.well { border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; margin: 6px 0; }
details.well summary { cursor: pointer; font-size: 12px; }
details.well .data { margin-top: 4px; }

/* grouped layers menu */
.layers-menu { width: 400px; padding: 10px 12px 8px; }
.layers-menu .menu-title { font-size: 13px; }
.layers-menu .menu-title .small { font-weight: 400; }
.layer-group { margin-top: 8px; }
.group-name { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; color: var(--fg3); margin: 4px 0 2px; }
.layer-row { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; background: none; border: none; border-radius: 6px; padding: 5px 6px; cursor: pointer; color: var(--fg); }
.layer-row:hover { background: var(--bg3); }
.lr-box { width: 15px; height: 15px; border-radius: 4px; border: 1.5px solid var(--fg3); flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; }
.layer-row.on .lr-box { background: #1d4ed8; border-color: #3b82f6; }
.layer-row.on .lr-box::after { content: "✓"; color: #fff; font-weight: 700; }
.lr-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lr-name { font-size: 12.5px; font-weight: 600; }
.lr-desc { font-size: 11px; color: var(--fg2); }
.lr-zoom { font-size: 10px; color: var(--fg3); white-space: nowrap; }
.layer-row.far .lr-zoom { color: var(--accent2); }
.layer-row.far .lr-zoom::after { content: " · zoom in"; }
#map-hint { top: 12px; left: 56px; max-width: 320px; display: flex; gap: 10px; align-items: center; background: rgba(29, 78, 216, .92); border-color: #3b82f6; color: #fff; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
#map-hint button { background: none; border: none; color: #fff; cursor: pointer; font-size: 13px; padding: 0 2px; }
@media (max-width: 900px) { #map-hint { left: 8px; right: 8px; max-width: none; top: 52px; } .layers-menu { width: auto; } }

/* resizable panel, text size */
#panel { position: relative; }
#panel-resize { position: absolute; left: -4px; top: 0; bottom: 0; width: 9px; cursor: col-resize; z-index: 6; }
#panel-resize:hover, #panel.resizing #panel-resize { background: rgba(56,189,248,.35); }
#panel.resizing { transition: none !important; user-select: none; }
#panel:not(.open) #panel-resize { display: none; }
@media (max-width: 900px) { #panel-resize { display: none; } .panel-head { touch-action: pan-x; } #panel.resizing { transition: none !important; } }

/* map tools: locate, measure */
.maplibregl-ctrl-group button { color: var(--fg); }
.maplibregl-ctrl-group button svg { display: block; margin: auto; }
.maplibregl-ctrl-group button.active { background: #1d4ed8; color: #fff; }
.locate-btn.busy svg { animation: spin 1.2s linear infinite; }
.locate-btn.following { color: #60a5fa; }
body.measuring .maplibregl-canvas { cursor: crosshair !important; }
#measure-box { top: 12px; left: 56px; min-width: 180px; z-index: 6; }
#measure-box .mb-title { font-weight: 600; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
#measure-box .mb-x { background: none; border: none; color: var(--fg2); cursor: pointer; font-size: 13px; padding: 0 2px; }
#measure-box .mb-v { font-size: 17px; font-weight: 700; margin: 2px 0; }
/* point panel: coordinates and section jump bar */
.coords { display: flex; flex-wrap: wrap; gap: 3px 10px; align-items: center; font-size: 11.5px; color: var(--fg2); margin: 2px 0 6px; font-variant-numeric: tabular-nums; }
.coords .copy { background: none; border: 1px solid var(--line); border-radius: 4px; color: var(--fg2); cursor: pointer; font-size: 11px; padding: 0 5px; margin-left: -7px; line-height: 1.5; }
.coords .copy:hover { color: var(--fg); border-color: var(--fg3); }
.pt-nav { position: sticky; top: -12px; z-index: 3; background: var(--bg2); display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 0 6px; margin: 0 0 4px; border-bottom: 1px solid var(--line); }
.pt-chip { font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg3); color: var(--fg2); cursor: pointer; }
.pt-chip.ready { color: var(--fg); border-color: #3b82f6; }
.pt-chip.ready:hover { background: #1d4ed8; color: #fff; }
.pt-chip.none { opacity: .4; cursor: default; }
.pt-chip.pending { color: var(--fg3); cursor: default; }
.pt-chip.pending::before { content: "⟳ "; display: inline-block; animation: spin 1.2s linear infinite; }
#tab-point > div[id^="pt-"] { scroll-margin-top: 46px; }
@media (max-width: 900px) { #measure-box { left: 8px; right: auto; top: 52px; } }

/* help dialog tabs */
.modal-head { gap: 10px; }
.modal-tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.mtab { background: none; border: 1px solid transparent; border-radius: 6px; padding: 4px 10px; font-size: 12.5px; color: var(--fg2); cursor: pointer; }
.mtab.on { background: var(--bg3); border-color: var(--line); color: var(--fg); }
.help-pane { display: none; } .help-pane.on { display: block; }
ul.src li { margin: 5px 0; }
ul.src .small { display: block; margin-top: 1px; }
@media (max-width: 900px) { .modal-head { flex-wrap: wrap; } .modal-tabs { order: 3; flex-basis: 100%; justify-content: flex-start; } }
