/* ORGIN RiverineGIS map — page styles (release 20261131; D81 dam-watch symbol + sort buttons; D72 dam-watch sort; D45 tokens, D49 weather, D50 3D button, D52 pin label, D56 notes + shortcuts, D58 shortcuts button).
 * Moved out of index.html. One set of design tokens on :root; dark theme follows the system setting
 * (prefers-color-scheme) and can be forced with <html data-theme="dark|light">.
 * The map image itself is never re-coloured: only the page chrome (header, docks, panels, popups) changes.
 */

/* ---------- Design tokens ---------- */
:root {
  --navy: #243F51;            /* ORGIN brand: header, primary buttons */
  --on-navy: #ffffff;
  --amber: #f0a020;           /* active tool, focus */
  --amber-ring: rgba(240,160,32,.55);
  --amber-ring-strong: rgba(240,160,32,.75);
  --sea: #0066cc;             /* map background behind the image */

  --surface: #ffffff;         /* panels, popups, About, search pills */
  --surface-glass: rgba(255,255,255,.94);   /* docks */
  --readout: rgba(255,255,255,.8);          /* coordinates, zoom readout */
  --ink: #243F51;             /* text on surfaces */
  --muted: #8a9aa6;
  --muted-strong: #5a6b77;
  --line: #e3e8ec;
  --line-strong: #d5dde3;
  --chip: #e3e8ec;            /* secondary pill buttons */
  --btn: #243F51;             /* primary pill buttons and dock hover */
  --btn-ink: #ffffff;
  --toast: rgba(36,63,81,.95);
  --busy: rgba(36,63,81,.92);
  --field-edge: rgba(255,255,255,.55);
  --header-pill: rgba(255,255,255,.12);
  --legend-plate: transparent;

  --shadow-sm: 0 2px 6px rgba(0,0,0,.28);
  --shadow-md: 0 2px 10px rgba(0,0,0,.35);
  --shadow-lg: 0 4px 18px rgba(0,0,0,.4);
  --shadow-dock: 0 4px 14px rgba(0,0,0,.28), 0 1px 3px rgba(0,0,0,.18);
  --inset-field: inset 0 1px 2px rgba(36,63,81,.08);

  --font: Arial, Helvetica, sans-serif;
  --radius-card: 8px;
  --pill: 999px;

  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23243F51' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.8' fill='none' stroke='%238a9aa6' stroke-width='1.8'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%238a9aa6' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: light;
}

/* Dark tokens — used by the system setting unless the page is forced light, or when forced dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #17283a; --on-navy: #eef4f8;
    --surface: #1d2a33; --surface-glass: rgba(29,42,51,.94); --readout: rgba(29,42,51,.85);
    --ink: #e6eef2; --muted: #9fb0bb; --muted-strong: #b8c6cf; --line: #33444f; --line-strong: #3d505c;
    --chip: #2c3c47; --btn: #4a7591; --btn-ink: #ffffff; --toast: rgba(23,40,58,.96); --busy: rgba(23,40,58,.94);
    --field-edge: rgba(255,255,255,.18); --header-pill: rgba(255,255,255,.10); --legend-plate: #ffffff;
    --shadow-sm: 0 2px 6px rgba(0,0,0,.5); --shadow-md: 0 2px 12px rgba(0,0,0,.6); --shadow-lg: 0 4px 20px rgba(0,0,0,.65);
    --shadow-dock: 0 4px 14px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.4); --inset-field: inset 0 1px 2px rgba(0,0,0,.3);
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e6eef2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.8' fill='none' stroke='%239fb0bb' stroke-width='1.8'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%239fb0bb' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #17283a; --on-navy: #eef4f8;
  --surface: #1d2a33; --surface-glass: rgba(29,42,51,.94); --readout: rgba(29,42,51,.85);
  --ink: #e6eef2; --muted: #9fb0bb; --muted-strong: #b8c6cf; --line: #33444f; --line-strong: #3d505c;
  --chip: #2c3c47; --btn: #4a7591; --btn-ink: #ffffff; --toast: rgba(23,40,58,.96); --busy: rgba(23,40,58,.94);
  --field-edge: rgba(255,255,255,.18); --header-pill: rgba(255,255,255,.10); --legend-plate: #ffffff;
  --shadow-sm: 0 2px 6px rgba(0,0,0,.5); --shadow-md: 0 2px 12px rgba(0,0,0,.6); --shadow-lg: 0 4px 20px rgba(0,0,0,.65);
  --shadow-dock: 0 4px 14px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.4); --inset-field: inset 0 1px 2px rgba(0,0,0,.3);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23e6eef2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --magnifier: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='6.8' cy='6.8' r='4.8' fill='none' stroke='%239fb0bb' stroke-width='1.8'/%3E%3Cpath d='M10.4 10.4 14 14' stroke='%239fb0bb' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  color-scheme: dark;
}

/* ---------- Page and header ---------- */
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; background: var(--navy); font-family: var(--font); }
#bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 10px;
       padding: 6px 12px; background: var(--navy); color: var(--on-navy); font-size: 14px; }
#map { flex: 1 1 auto; min-height: 0; background: var(--sea); }

/* Oval drop-down and search box (D42); the search box also takes lat, lon (D43) */
#bar select, #placeSearch { box-sizing: border-box; height: 2.1rem; border: 1px solid var(--field-edge); border-radius: var(--pill);
        background-color: var(--surface); color: var(--ink); font: 14px var(--font);
        box-shadow: var(--shadow-sm), var(--inset-field); transition: box-shadow .15s ease, border-color .15s ease; }
#bar select { max-width: 460px; width: 100%; -webkit-appearance: none; appearance: none; cursor: pointer; padding: 0 2.3rem 0 1rem;
        background-image: var(--chevron); background-repeat: no-repeat; background-position: right .9rem center; background-size: 12px 8px; }
#placeSearch { margin-left: .5rem; width: 14rem; max-width: 100%; padding: 0 1rem 0 2.1rem;
        background-image: var(--magnifier); background-repeat: no-repeat; background-position: .8rem center; background-size: 14px; }
#placeSearch::placeholder { color: var(--muted); }
#bar select:hover, #placeSearch:hover { box-shadow: 0 3px 10px rgba(0,0,0,.35), var(--inset-field); }
#bar select:focus-visible, #placeSearch:focus-visible { outline: none; border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-ring), var(--shadow-sm); }
#barToggle { display: none; }

/* ---------- Map readouts, loading, toast ---------- */
.ol-mouse-position { top: auto; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 3px;
                     background: var(--readout); font-size: 12px; color: var(--ink); }
.ol-scale-line { left: 8px; bottom: 8px; }
.zoom-ro { position: absolute; left: 8px; bottom: 30px; padding: 1px 6px; border-radius: 3px; background: var(--readout);
           color: var(--ink); font: 600 11px var(--font); pointer-events: none; }
#busy { position: fixed; left: 50%; top: 5.5rem; transform: translateX(-50%); z-index: 1000;
        padding: .35rem .9rem; border-radius: 1rem; background: var(--busy); color: #fff;
        font: 600 13px/1.4 system-ui, sans-serif; box-shadow: 0 1px 4px rgba(0,0,0,.3); pointer-events: none; }
#busy::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .5em; vertical-align: -.1em;
        border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: busyspin .8s linear infinite; }
#busy[hidden] { display: none; }
@keyframes busyspin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: 3.5rem; transform: translateX(-50%); z-index: 1001; max-width: calc(100vw - 2rem);
         padding: .4rem .9rem; border-radius: 1rem; background: var(--toast); color: #fff; font: 13px/1.4 var(--font);
         box-shadow: 0 1px 4px rgba(0,0,0,.3); overflow-wrap: anywhere; }
#toast[hidden] { display: none; }

/* ---------- Floating docks: zoom, tools, Layers (D44) ---------- */
.ol-zoom, .tb-ctl, .lyr-ctl { background: var(--surface-glass); border-radius: var(--pill); padding: 4px;
        box-shadow: var(--shadow-dock); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ol-zoom { top: .6em; left: .6em; }
.tb-ctl { top: calc(.6em + 92px); left: .6em; display: flex; flex-direction: column; gap: 2px; }
.lyr-ctl { top: .6em; right: .6em; }
.ol-zoom .ol-zoom-in, .ol-zoom .ol-zoom-out, .tb-ctl > button, .lyr-ctl .lyr-btn {
        width: 34px; height: 34px; margin: 0; padding: 0; border: 0; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        background: transparent; color: var(--ink); font: 600 20px/1 var(--font); cursor: pointer;
        transition: background-color .15s ease, color .15s ease, transform .15s ease, box-shadow .15s ease; }
.tb-ctl > button[hidden] { display: none; }
.ol-zoom .ol-zoom-in { margin-bottom: 2px; }
.tb-ctl > button svg, .lyr-ctl .lyr-btn svg { width: 19px; height: 19px; }
.ol-zoom .ol-zoom-in:hover, .ol-zoom .ol-zoom-out:hover, .tb-ctl > button:hover, .lyr-ctl .lyr-btn:hover {
        background: var(--btn); color: var(--btn-ink); transform: scale(1.06); box-shadow: 0 2px 6px rgba(36,63,81,.35); }
.ol-zoom .ol-zoom-in:active, .ol-zoom .ol-zoom-out:active, .tb-ctl > button:active, .lyr-ctl .lyr-btn:active { transform: scale(.95); }
.tb-ctl > button.on, .lyr-ctl .lyr-btn[aria-expanded="true"] { background: var(--amber); color: #243F51; box-shadow: inset 0 0 0 2px rgba(36,63,81,.15); }
.ol-zoom button:focus, .tb-ctl > button:focus, .lyr-ctl .lyr-btn:focus { outline: none; }
.ol-zoom button:focus-visible, .tb-ctl > button:focus-visible, .lyr-ctl .lyr-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--amber-ring-strong); }
.tb-ctl > button:nth-child(4), .tb-ctl > button:nth-child(6), .tb-ctl > button:nth-child(8), .tb-ctl > button:nth-child(10) { position: relative; margin-top: 7px; }
.tb-ctl > button:nth-child(4)::before, .tb-ctl > button:nth-child(6)::before, .tb-ctl > button:nth-child(8)::before, .tb-ctl > button:nth-child(10)::before {
        content: ""; position: absolute; top: -5px; left: 8px; right: 8px; height: 1px; background: var(--line-strong); }
@media (hover: hover) and (pointer: fine) {
  .tb-ctl > button, .lyr-ctl .lyr-btn { position: relative; }
  .tb-ctl > button[data-tip]::after, .lyr-ctl .lyr-btn[data-tip]::after {
        content: attr(data-tip); position: absolute; top: 50%; left: calc(100% + 12px); transform: translate(-6px, -50%);
        padding: .3rem .7rem; border-radius: var(--pill); background: var(--btn); color: var(--btn-ink); white-space: nowrap;
        font: 600 12px/1.2 var(--font); box-shadow: 0 2px 8px rgba(0,0,0,.3);
        opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; z-index: 5; }
  .lyr-ctl .lyr-btn[data-tip]::after { left: auto; right: calc(100% + 12px); transform: translate(6px, -50%); }
  .tb-ctl > button[data-tip]:hover::after, .tb-ctl > button[data-tip]:focus-visible::after,
  .lyr-ctl .lyr-btn[data-tip]:hover::after, .lyr-ctl .lyr-btn[data-tip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
  .lyr-ctl .lyr-btn[aria-expanded="true"]::after, .tb-ctl > button.on::after { opacity: 0 !important; }
}

/* ---------- Measure bar (D30) ---------- */
.ms-bar { position: absolute; left: calc(100% + 10px); top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; width: max-content;
          max-width: calc(100vw - 5rem); padding: .3rem .4rem; background: var(--surface); border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.ms-bar[hidden] { display: none; }
.tb-ctl .ms-bar button { width: auto; height: auto; margin: 0; padding: .2rem .55rem; font: 600 12px var(--font);
          color: var(--ink); background: var(--chip); border: 0; border-radius: var(--pill); cursor: pointer; }
.tb-ctl .ms-bar button.on { background: var(--btn); color: var(--btn-ink); }
.ms-hint { font: 11px var(--font); color: var(--muted-strong); }

/* ---------- Layers panel (D24) and legends (D26, D40) ---------- */
.lyr-panel { position: absolute; top: calc(100% + 8px); right: 0; width: 17rem; max-width: calc(100vw - 2rem);
             max-height: calc(100vh - 10rem); overflow: auto; box-sizing: border-box; padding: .5rem .65rem;
             background: var(--surface); color: var(--ink); border-radius: 6px; box-shadow: var(--shadow-md);
             font: 13px/1.35 var(--font); text-align: left; }
.lyr-panel[hidden] { display: none; }
.lyr-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: .3rem; }
.lyr-legsw { font-weight: 400; display: flex; align-items: center; gap: .3rem; cursor: pointer; }
.lyr-row { border-top: 1px solid var(--line); padding: .2rem 0; }
.lyr-row label { display: flex; align-items: center; gap: .45rem; cursor: pointer; }
.lyr-row.out .lyr-name { color: var(--muted); }
.lyr-hint { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
.lyr-leg[hidden] { display: none; }
.lyr-leg img { display: block; max-width: 100%; margin: .2rem 0 .1rem 1.5rem; background: var(--legend-plate); border-radius: 4px; }
.lyr-panel input[type=checkbox] { margin: 0; width: 1rem; height: 1rem; accent-color: var(--btn); }
.lyr-foot { margin-top: .45rem; display: flex; gap: .5rem; }
.lyr-ctl .lyr-panel button { display: inline-block; width: auto; height: auto; margin: 0; padding: .22rem .8rem;
             font: 600 12px var(--font); color: var(--btn-ink); background: var(--btn); border: 0; border-radius: var(--pill); cursor: pointer; }
.lyr-ctl .lyr-panel button:focus-visible, .lyr-panel input:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.rl { margin: .25rem 0 .15rem 1.5rem; }
.rl-bar { display: flex; height: 12px; border: 1px solid var(--muted); }
.rl-sw { flex: 1 1 0; }
.rl-tk { position: relative; height: 13px; font-size: 10px; color: var(--muted-strong); }
.rl-tk span { position: absolute; top: 1px; transform: translateX(-50%); white-space: nowrap; }
.rl-tk span:first-child { transform: none; }
.rl-cap { font-size: 10px; color: var(--muted); margin-top: 1px; }

/* ---------- Click popup (D28, D39) ---------- */
.pp { position: relative; min-width: 11rem; max-width: min(17rem, calc(100vw - 3rem)); padding: .5rem .7rem .45rem;
      background: var(--surface); color: var(--ink); border-radius: 6px; box-shadow: var(--shadow-md); font: 13px/1.35 var(--font); }
.pp::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -7px; border: 7px solid transparent; border-bottom: 0; border-top-color: var(--surface); }
.pp-x { position: absolute; top: 2px; right: 4px; border: 0; background: none; font: 700 18px/1 var(--font); color: var(--muted); cursor: pointer; padding: 2px 4px; }
.pp-st { color: var(--muted); padding-right: 1rem; }
.pp-item { padding: .15rem 1rem .25rem 0; }
.pp-item + .pp-item { border-top: 1px solid var(--line); padding-top: .3rem; }
.pp-type { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pp-name { font-weight: 700; }
.pp-ex { font-size: 12px; }
.pp-xy { display: flex; align-items: center; gap: .4rem; margin-top: .35rem; padding-top: .3rem; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted-strong); }
.pp-fmt { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.pp-fmt:hover { text-decoration: underline; }
.pp-cp { margin-left: auto; border: 0; border-radius: var(--pill); padding: .12rem .6rem; background: var(--btn); color: var(--btn-ink); font: 600 11px var(--font); cursor: pointer; }
.pp-cp + .pp-cp { margin-left: .3rem; }
.pp-x:focus-visible, .pp-cp:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* ---------- About (D30) ---------- */
.about { position: fixed; z-index: 1002; left: 50%; top: 5.5rem; transform: translateX(-50%); width: min(26rem, calc(100vw - 2rem));
         max-height: calc(100vh - 8rem); overflow: auto; box-sizing: border-box; padding: .8rem 1rem; background: var(--surface); color: var(--ink);
         border-radius: var(--radius-card); box-shadow: var(--shadow-lg); font: 13px/1.45 var(--font); }
.about[hidden] { display: none; }
.about h2 { margin: 0 1.5rem .4rem 0; font-size: 16px; }
.about p { margin: .35rem 0; }
.about .about-by { margin-top: .7rem; padding-top: .55rem; border-top: 1px solid var(--line); }
.about .about-v { color: var(--muted); font-size: 11px; margin-top: .6rem; }
.about .pp-x { position: absolute; top: 4px; right: 6px; }

/* ---------- Weather (live) and Dam watch (D49) ---------- */
.lyr-wx { margin-top: .55rem; padding-top: .35rem; border-top: 2px solid var(--line-strong); }
.lyr-wxh { font-weight: 700; margin-bottom: .2rem; }
.lyr-wxn { font-size: 11px; color: var(--muted); margin-top: .25rem; }
.wx-leg { margin: .25rem 0 .15rem 1.5rem; }
.wx-bar { height: 12px; border: 1px solid var(--muted); background: #ffffff;
          background-image: linear-gradient(90deg, rgba(110,110,205,0) 0%, rgba(110,110,205,.3) 31.8%, rgba(80,80,225,.7) 63.6%, rgba(20,20,255,.9) 100%); }
.wx-tk { position: relative; height: 13px; font-size: 10px; color: var(--muted-strong); }
.wx-tk span { position: absolute; top: 1px; transform: translateX(-50%); white-space: nowrap; }
.wx-tk span:last-child { transform: translateX(-100%); }
.wx-dot { display: inline-block; flex: 0 0 auto; width: 10px; height: 10px; margin-right: .4rem; border-radius: 50%;
          vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.lyr-ctl { z-index: 3; }
.dw.ol-control { top: auto; left: auto; right: .6em; bottom: 34px; z-index: 2; width: 18rem; max-width: calc(100vw - 1.2em); padding: 0;
          box-sizing: border-box; background: var(--surface); color: var(--ink); border-radius: var(--radius-card); box-shadow: var(--shadow-md);
          font: 13px/1.35 var(--font); text-align: left; }
.dw[hidden] { display: none; }
.dw-head { display: flex; align-items: center; gap: .4rem; padding: .35rem .55rem; border-bottom: 1px solid var(--line); }
.dw .dw-tg { flex: 1 1 auto; display: flex; align-items: baseline; gap: .4rem; width: auto; height: auto; margin: 0; padding: 0; border: 0;
          background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dw .dw-tg:hover, .dw .dw-tg:focus { background: none; color: inherit; outline: none; }
.dw .dw-tg:focus-visible { box-shadow: 0 0 0 2px var(--amber-ring-strong); border-radius: 3px; }
.dw-t { font-weight: 700; white-space: nowrap; }
.dw-t::before { content: ""; display: inline-block; width: 0; height: 0; margin-right: .35rem; vertical-align: 1px;
          border: 5px solid transparent; border-top-color: currentColor; border-bottom: 0; transition: transform .15s ease; }
.dw-tg[aria-expanded="false"] .dw-t::before { transform: rotate(-90deg); }
.dw-sum { font-size: 12px; color: var(--muted-strong); }
.dw-sum.lv-heavy, .dw-sum.lv-very_heavy, .dw-sum.lv-extreme { font-weight: 700; }
.dw-sum.lv-heavy { color: #a67c00; } .dw-sum.lv-very_heavy { color: #c45f0c; } .dw-sum.lv-extreme { color: #d7191c; }
.dw-time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.dw-body[hidden] { display: none; }
.dw-msg { margin: .35rem .55rem 0; padding: .25rem .4rem; border-radius: 4px; background: var(--chip); font-size: 12px; }
.dw-msg[hidden] { display: none; }
.dw-sortbar { display: flex; align-items: center; gap: .3rem; margin: .3rem .55rem 0; font-size: 11px; color: var(--muted-strong); }
.dw-sortb { border: 0; border-radius: var(--pill); padding: .1rem .55rem; background: var(--chip); color: var(--ink); font: 600 11px var(--font); cursor: pointer; }
.dw-sortb[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.dw-sortb:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
/* D81: OpenLayers' .ol-control button (0,1,1) shrank these to 15 px squares - scoped rules win */
.ol-control .dw-sortb { display: inline-block; width: auto; height: auto; margin: 0; padding: .1rem .55rem;
                        border: 0; border-radius: var(--pill); background: var(--chip); color: var(--ink); font: 600 11px/1.4 var(--font); }
.ol-control .dw-sortb[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }
.ol-control .dw-sortb:hover, .ol-control .dw-sortb:focus { outline: none; filter: brightness(1.08); }
.ol-control .dw-sortb:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
/* D81: Normal dam = red dot in a white ring with a dark rim, as on the map */
.wx-dot.wx-dot-ok { background: #c0392b; box-shadow: 0 0 0 2px #ffffff, 0 0 0 3px #26333d; margin-left: 3px; }
.dw-k .wx-dot.wx-dot-ok { margin-right: .4rem; }
.dw-list { list-style: none; margin: 0; padding: .2rem 0; max-height: min(15rem, 40vh); overflow: auto; }
.dw .dw-row { display: flex; align-items: center; width: 100%; height: auto; margin: 0; padding: .22rem .55rem; border: 0; border-radius: 0;
          background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.dw .dw-row:hover { background: var(--chip); color: inherit; }
.dw .dw-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--amber-ring-strong); }
.dw-nm { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.dw-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-sub { font-size: 11px; color: var(--muted); }
.dw-rt { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; margin-left: .5rem; font-variant-numeric: tabular-nums; }
.dw-now { font-weight: 700; font-size: 12px; }
.dw-f3 { font-size: 11px; color: var(--muted); }
.dw-row.lv-heavy .dw-now, .dw-f3.lv-heavy { color: #a67c00; }
.dw-row.lv-very_heavy .dw-now, .dw-f3.lv-very_heavy { color: #c45f0c; }
.dw-row.lv-extreme .dw-now, .dw-f3.lv-extreme { color: #d7191c; }
.dw-row.lv-stale .dw-now { color: var(--muted); }
.dw-key { display: flex; flex-wrap: wrap; gap: .15rem .6rem; padding: .3rem .55rem; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted-strong); }
.dw-k { display: inline-flex; align-items: center; } .dw-k .wx-dot { width: 8px; height: 8px; margin-right: .25rem; }
.dw-note { margin: 0; padding: 0 .55rem .45rem; font-size: 11px; color: var(--muted); }
.dw-note a, .wx-cr a { color: inherit; }
.pp-wx .wx-dot { margin-right: .3rem; }
.pp-wx + .pp-st, .pp-wx + .pp-list { margin-top: .3rem; padding-top: .3rem; border-top: 1px solid var(--line); }
.pp-src { color: var(--muted); font-size: 11px; }
.wx-cr.ol-control { top: auto; left: 50%; right: auto; bottom: 8px; transform: translateX(-50%); max-width: calc(100vw - 16rem);
          padding: 2px 8px; border-radius: 3px; background: var(--readout); color: var(--ink); font: 11px/1.3 var(--font); text-align: center; }
.wx-cr[hidden] { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .dw-sum.lv-heavy, :root:not([data-theme="light"]) .dw-row.lv-heavy .dw-now, :root:not([data-theme="light"]) .dw-f3.lv-heavy { color: #f2c94c; }
  :root:not([data-theme="light"]) .dw-sum.lv-very_heavy, :root:not([data-theme="light"]) .dw-row.lv-very_heavy .dw-now, :root:not([data-theme="light"]) .dw-f3.lv-very_heavy { color: #f6a05a; }
  :root:not([data-theme="light"]) .dw-sum.lv-extreme, :root:not([data-theme="light"]) .dw-row.lv-extreme .dw-now, :root:not([data-theme="light"]) .dw-f3.lv-extreme { color: #ff6b6b; }
}
:root[data-theme="dark"] .dw-sum.lv-heavy, :root[data-theme="dark"] .dw-row.lv-heavy .dw-now, :root[data-theme="dark"] .dw-f3.lv-heavy { color: #f2c94c; }
:root[data-theme="dark"] .dw-sum.lv-very_heavy, :root[data-theme="dark"] .dw-row.lv-very_heavy .dw-now, :root[data-theme="dark"] .dw-f3.lv-very_heavy { color: #f6a05a; }
:root[data-theme="dark"] .dw-sum.lv-extreme, :root[data-theme="dark"] .dw-row.lv-extreme .dw-now, :root[data-theme="dark"] .dw-f3.lv-extreme { color: #ff6b6b; }

/* ---------- Focus (general) ---------- */
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

/* ---------- Field notes and keyboard shortcuts (D56) ---------- */
.tb-ctl .ms-bar button.warn { background: #d7191c; color: #ffffff; }
.noting { cursor: crosshair; }
.nt-form { display: flex; flex-direction: column; gap: .35rem; padding-right: 1rem; }
.nt-form select, .nt-form textarea { box-sizing: border-box; width: 100%; font: 13px var(--font); color: var(--ink); background: var(--surface);
          border: 1px solid var(--line-strong); border-radius: 6px; padding: .3rem .45rem; }
.nt-form textarea { resize: vertical; min-height: 4.2rem; }
.nt-form textarea.bad { border-color: #d7191c; box-shadow: 0 0 0 2px rgba(215,25,28,.2); }
.nt-form select:focus-visible, .nt-form textarea:focus-visible { outline: 2px solid var(--amber); outline-offset: 0; }
.nt-act { display: flex; gap: .3rem; }
.nt-act .pp-cp { margin-left: 0; }
.nt-act .nt-cancel, .nt-del { background: var(--chip); color: var(--ink); }
.nt-body { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; margin: .15rem 0; }
.nt-item .pp-type .wx-dot { margin-right: .3rem; }
.nt-del { margin: .3rem 0 0; }
.about .about-keys { margin: .1rem 0 0; }
.help .kb { border-collapse: collapse; width: 100%; margin-top: .2rem; }
.help .kb th { text-align: left; white-space: nowrap; padding: .22rem .8rem .22rem 0; vertical-align: top; font-weight: 400; }
.help .kb td { padding: .22rem 0; }
.help .kb tr + tr th, .help .kb tr + tr td { border-top: 1px solid var(--line); }
.help kbd { display: inline-block; min-width: 1.2em; padding: .05rem .4rem; border: 1px solid var(--line-strong); border-bottom-width: 2px;
          border-radius: 4px; background: var(--chip); color: var(--ink); font: 600 12px var(--font); text-align: center; }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  #bar { flex-direction: column; align-items: stretch; padding: 6px 8px; font-size: 13px; }
  #bar label { text-align: center; }
  #bar select { max-width: none; }
  #bar select, #placeSearch { height: 2.6rem; font-size: 16px; }
  #placeSearch { margin: .4rem 0 0; width: 100%; }
  #barToggle { display: block; width: 100%; padding: 8px 14px; border: 0; border-radius: var(--pill); background: var(--header-pill);
               color: var(--on-navy); font: 600 15px var(--font); text-align: left; cursor: pointer; }
  #bar.collapsed > label, #bar.collapsed > select, #bar.collapsed > input { display: none; }
  .ol-mouse-position { display: none; }
  .tb-ctl { top: 128px; }
  .tb-ctl > button, .ol-zoom .ol-zoom-in, .ol-zoom .ol-zoom-out, .lyr-ctl .lyr-btn { width: 40px; height: 40px; }
  .tb-ctl .ms-bar { left: calc(100% + 8px); }
  .lyr-panel { font-size: 15px; }
  .lyr-row label { padding: .25rem 0; }
  .dw.ol-control { left: .5em; right: .5em; bottom: 8px; width: auto; max-width: none; }
  .dw-list { max-height: 35vh; }
  .wx-cr.ol-control { bottom: auto; top: 8px; max-width: calc(100vw - 7rem); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  #busy::before { animation: none; }
  .ol-zoom button, .tb-ctl > button, .lyr-ctl .lyr-btn, [data-tip]::after, #bar select, #placeSearch, .dw-t::before { transition: none; }
}
