/* Spokane River Boating Zones — one stylesheet for the app and its pages. */
:root {
  --bg: #eef2f5; --panel: #ffffff; --panel-2: #f6f8fa; --ink: #0f2233; --ink-2: #4c6172; --ink-3: #5a6d7c;
  --line: #d8e0e6; --accent: #0f6fa8; --accent-ink: #ffffff; --deep: #0b2f4a; --good: #1f8a4c; --bad: #c62f3c;
  --warn: #b7791f; --good-ink: #17693a; --warn-ink: #8a5a00; --shadow: 0 1px 2px rgba(15,34,51,.06), 0 8px 24px rgba(15,34,51,.10);
  --c-idle: #e8364a; --c-cruise: #ff9124; --c-tow: #ffd83b; --c-surf: #7d55e8; --c-runs: #19d3f5; --c-nwz: #8a1630;
  --radius: 12px;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a141b; --panel: #111d26; --panel-2: #0d1820; --ink: #e6eef4; --ink-2: #9db2c1; --ink-3: #869cab;
    --line: #22343f; --accent: #4fb0e8; --accent-ink: #06202f; --deep: #a9d4f0; --good: #3ccf7d; --bad: #ff6b76;
    --warn: #f0b44c; --good-ink: #3ccf7d; --warn-ink: #f0b44c; --shadow: 0 1px 2px rgba(0,0,0,.35), 0 10px 28px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a141b; --panel: #111d26; --panel-2: #0d1820; --ink: #e6eef4; --ink-2: #9db2c1; --ink-3: #869cab;
  --line: #22343f; --accent: #4fb0e8; --accent-ink: #06202f; --deep: #a9d4f0; --good: #3ccf7d; --bad: #ff6b76;
  --warn: #f0b44c; --good-ink: #3ccf7d; --warn-ink: #f0b44c; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.svgdefs { position: absolute; width: 0; height: 0; overflow: hidden; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.45;
       -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72em; border: 1px solid var(--line);
      border-bottom-width: 2px; border-radius: 4px; padding: 0 .3em; background: var(--panel-2); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--panel-2);
       padding: .05em .3em; border-radius: 4px; }

/* ---- header ---------------------------------------------------------------- */
.top { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; gap: 1rem; padding: .5rem 1rem;
       background: linear-gradient(90deg, #0b2f4a, #0f4569); color: #fff; min-height: 56px;
       box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; flex: 0 1 auto; }
.brand img { flex: none; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-title { margin: 0; font-weight: 700; font-size: 1.02rem; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: .72rem; opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conds { display: flex; gap: .4rem; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
.conds > :first-child { margin-left: auto; } .conds > :last-child { margin-right: auto; }   /* centred, but never clipped when it overflows */
.conds::-webkit-scrollbar { display: none; }
.cond { flex: none; display: inline-flex; align-items: baseline; gap: .35rem; font-size: .72rem; padding: .2rem .55rem;
        border-radius: 999px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); white-space: nowrap; }
.cond b { font-variant-numeric: tabular-nums; font-weight: 700; }
.cond.ok b { color: #8ff0b6; } .cond.warn b { color: #ffd479; }
.cond a { color: inherit; text-decoration: none; }
.topnav { display: flex; gap: .2rem; flex: none; }
.topnav a { color: #dcebf5; text-decoration: none; font-size: .8rem; padding: .3rem .55rem; border-radius: 7px; }
.topnav a:hover { background: rgba(255,255,255,.12); color: #fff; }

/* ---- app ------------------------------------------------------------------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 390px; height: calc(100dvh - var(--toph, 56px)); min-height: 520px; }
.mapcol { position: relative; min-width: 0; min-height: 0; isolation: isolate; }
#lmap { position: absolute; inset: 0; background: #0d2231; }
.panel { overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .8rem; border-left: 1px solid var(--line);
         background: var(--bg); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: .9rem 1rem; }

/* map overlays */
.views { position: absolute; z-index: 800; top: .7rem; left: 3.4rem; display: flex; gap: 2px; padding: 3px;
         background: rgba(9,24,35,.86); border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.3);
         max-width: calc(100% - 7.5rem); overflow-x: auto; scrollbar-width: none; }
.views::-webkit-scrollbar { display: none; }
.view { flex: none; font: 600 .78rem var(--font); color: #cfe2ee; background: transparent; border: 0; border-radius: 8px;
        padding: .42rem .7rem; cursor: pointer; white-space: nowrap; }
.view:hover { color: #fff; background: rgba(255,255,255,.08); }
.view.on { background: #fff; color: #0b2f4a; }
.rulepick { position: absolute; z-index: 800; top: 3.45rem; left: 3.4rem; display: flex; align-items: center; gap: .3rem;
            background: rgba(9,24,35,.82); color: #cfe2ee; padding: .3rem .45rem; border-radius: 9px; font: .74rem var(--font); }
.chip { font: 600 .74rem var(--font); border-radius: 999px; border: 1px solid rgba(255,255,255,.25); background: transparent;
        color: #e6f0f6; padding: .2rem .6rem; cursor: pointer; }
.chip.on { background: #fff; color: #0b2f4a; border-color: #fff; }
.busy { position: absolute; z-index: 800; top: .8rem; right: 3.6rem; font: 600 .72rem var(--font); color: #fff;
        background: rgba(9,24,35,.8); border-radius: 999px; padding: .25rem .65rem; opacity: 0; transition: opacity .15s;
        pointer-events: none; }
.busy.on { opacity: 1; }
.legend { position: absolute; z-index: 800; left: .7rem; bottom: 1.6rem; max-width: min(320px, calc(100% - 1.4rem)); max-height: 56%; overflow-y: auto;
          background: rgba(255,255,255,.95); color: #0f2233; border-radius: 11px; padding: .55rem .7rem .6rem;
          box-shadow: 0 6px 22px rgba(0,0,0,.28); font: .76rem/1.35 var(--font); }
.legend h4 { margin: 0 0 .35rem; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: #4c6172; display: flex;
             justify-content: space-between; align-items: center; gap: .5rem; }
.legend h4 button { font: inherit; border: 0; background: none; color: #0f6fa8; cursor: pointer; padding: 0; letter-spacing: 0; text-transform: none; }
.legend .row { display: flex; align-items: flex-start; gap: .45rem; margin: .18rem 0; }
.legend .row small { display: block; color: #5d7182; font-size: .68rem; }
.legend.min .row small, .legend.min .more { display: none; }
@media (min-width: 1200px) and (min-height: 700px) {      /* wide maps: two short columns cover less of the river */
  .legend:not(.min) { max-width: 600px; }
  .legend:not(.min) .rows { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 1rem; }
}
.legend.min { padding: .35rem .45rem; }
.lstrip { display: flex; flex-wrap: wrap; gap: .2rem .55rem; align-items: center; }
.lchip { display: inline-flex; align-items: center; font-size: .7rem; white-space: nowrap; }
.lchip .sw { width: .8rem; height: .8rem; margin: 0 .25rem 0 0; }
.lstrip button { font: 600 .7rem var(--font); border: 0; background: none; color: #0f6fa8; cursor: pointer; padding: 0 0 0 .1rem; }
.sw { display: inline-block; flex: none; width: .95rem; height: .95rem; border-radius: 3px; margin-top: .1rem;
      border: 1px solid rgba(0,0,0,.15); vertical-align: -.15em; margin-right: .3rem; }
.sw.line { height: .3rem; margin-top: .45rem; border: 0; border-radius: 2px; }
.sw.hatch { background: repeating-linear-gradient(135deg, var(--c-nwz) 0 3px, rgba(138,22,48,.35) 3px 6px); }
.sw.hatch-nm { background: repeating-linear-gradient(45deg, #c2185b 0 2px, transparent 2px 5px), repeating-linear-gradient(-45deg, #c2185b 0 2px, rgba(194,24,91,.3) 2px 5px); }
.sw.hatch-ne { background: repeating-linear-gradient(45deg, #111 0 3px, rgba(224,0,0,.55) 3px 6px); }
.sw.dot { border-radius: 50%; width: .75rem; height: .75rem; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.sw.lsym { display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35);
           font: 800 .55rem/1 var(--font); color: #062033; }
.sw.lsym.sq { border-radius: 3px; background: #0b2f4a; color: #ffd83b; border-color: #ffd83b; box-shadow: none; }
.sw.lsym.turn { background: rgba(11,47,74,.85); color: #fff; font-size: .62rem; }
.sw.lsym.rm { border-radius: 3px; background: #33434f; color: #fff; font-size: .45rem; border: 0; box-shadow: none; }
.s-idle { background: var(--c-idle); } .s-cruise { background: var(--c-cruise); } .s-tow { background: var(--c-tow); }
.s-surf { background: var(--c-surf); } .s-runs { background: transparent; border: 2px solid var(--c-runs); }
.reviewcard { position: absolute; z-index: 850; left: 50%; bottom: 1.4rem; transform: translateX(-50%); width: min(520px, calc(100% - 1.4rem));
              background: var(--panel); color: var(--ink); border-radius: 14px; box-shadow: 0 10px 34px rgba(0,0,0,.35);
              padding: .8rem .9rem; font: .84rem var(--font); border: 1px solid var(--line); }
.reviewcard .rc-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.reviewcard .rc-prog { height: 4px; background: var(--line); border-radius: 4px; margin: .45rem 0 .6rem; overflow: hidden; }
.reviewcard .rc-prog i { display: block; height: 100%; background: var(--accent); }
.reviewcard .btnrow { margin-top: .5rem; }
/* edit bar: the mapping tools on the map itself, where the eyes are */
.editbar { position: absolute; z-index: 840; top: .6rem; left: 3.4rem; right: 3.9rem; display: flex; flex-direction: column; gap: .3rem;
           padding: .4rem .45rem .35rem; background: rgba(9,24,35,.96); color: #e6f0f6; border-radius: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.35);
           font: .76rem var(--font); }
.eb-row { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.ebb { font: 600 .76rem var(--font); color: #e6f0f6; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.22); border-radius: 7px;
       padding: .3rem .55rem; cursor: pointer; white-space: nowrap; }
.ebb:hover:not(:disabled) { background: rgba(255,255,255,.17); }
.ebb.on { background: #fff; color: #0b2f4a; border-color: #fff; }
.ebb.primary { background: #ffd83b; color: #0b2f4a; border-color: #ffd83b; }
.ebb:disabled { opacity: .35; cursor: not-allowed; }
.eb-seg { display: inline-flex; }
.eb-seg .ebb { border-radius: 0; margin-left: -1px; }
.eb-seg .ebb:first-child { border-radius: 7px 0 0 7px; margin-left: 0; } .eb-seg .ebb:last-child { border-radius: 0 7px 7px 0; }
.eb-tag { display: inline-flex; align-items: center; gap: .3rem; }
.eb-dot { width: .85rem; height: .85rem; border-radius: 50%; border: 2px solid #fff; flex: none; }
.editbar select { background: #fff; color: #0f2233; border-color: transparent; padding: .28rem .35rem; max-width: 10.4rem; color-scheme: light; }
.eb-sweep { display: inline-flex; align-items: center; gap: .3rem; }
#ebRm { font-variant-numeric: tabular-nums; min-width: 5.6rem; text-align: center; color: #cfe2ee; }
#ebDone { margin-left: auto; }
.eb-hint { display: flex; gap: .6rem; align-items: baseline; justify-content: space-between; color: #cfe2ee; font-size: .72rem; padding: 0 .15rem; }
.eb-hint b { color: #fff; }
.eb-count { flex: none; color: #8ff0b6; font-variant-numeric: tabular-nums; }
.eb-flash { flex: none; color: #ffd479; text-align: right; }
.eb-flash:not([hidden]) + .eb-count { display: none; }
.mapcol.editing .views, .mapcol.editing .rulepick { display: none !important; }
.mapcol.editing #hwBanner.hwbanner { top: calc(var(--ebh, 5.6rem) + .4rem); }   /* under the edit bar (app.js measures it), whatever the view */
.mapcol.editing .busy { top: auto; bottom: 3.4rem; right: .6rem; }
.howto-docks { margin: .2rem 0 .6rem; padding-left: 1.2rem; font-size: .76rem; color: var(--ink-2); }
.howto-docks li { margin: .15rem 0; }

/* GPS banner — readable from the helm */
.gpsbar { position: fixed; z-index: 2000; left: 0; right: 0; top: 0; display: none; padding: .65rem 1rem; text-align: center;
          font: 700 1.02rem var(--font); color: #fff; font-variant-numeric: tabular-nums; box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.gpsbar.on { display: block; }
.gpsbar.out { background: #1f5f9e; } .gpsbar.mid { background: #a35b0b; } .gpsbar.bad { background: #a32633; } .gpsbar.warn { background: #4b5560; }
.gpsbar small { font-weight: 500; opacity: .9; margin-left: .4rem; }
.gpsbar button { margin-left: .8rem; font: 600 .75rem var(--font); color: #fff; background: rgba(255,255,255,.18);
                 border: 1px solid rgba(255,255,255,.35); border-radius: 7px; padding: .15rem .55rem; cursor: pointer; }

/* high-water override */
.hwbanner { position: absolute; z-index: 820; left: 50%; top: 3.6rem; transform: translateX(-50%); width: min(640px, calc(100% - 1.4rem));
            background: #a32633; color: #fff; font: .84rem var(--font); padding: .55rem .8rem; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.35); text-align: center; }
#rulepick:not([hidden]) ~ .hwbanner { top: 6rem; }

/* hero (executive summary) */
.hero-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.hero h2, .card h2 { margin: 0; font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.whatif { font-size: .7rem; font-weight: 700; color: #7a4b00; background: #ffe6a8; border-radius: 999px; padding: .12rem .55rem; }
.linkbtn { font: inherit; border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; padding: 0 0 0 .2rem; }
.headline { margin: .45rem 0 .7rem; font-size: 1.02rem; line-height: 1.4; }
.headline b { font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.tile { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .6rem .5rem .75rem; background: var(--panel-2);
        overflow: hidden; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; }
.t-tow::before { background: var(--c-tow); } .t-surf::before { background: var(--c-surf); }
.t-idle::before { background: var(--c-idle); } .t-runs::before { background: var(--c-runs); }
.tile b { display: block; font-size: 1.32rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile span { display: block; font-size: .68rem; color: var(--ink-2); line-height: 1.2; margin-top: .12rem; }
.tile em { position: absolute; right: .5rem; top: .45rem; font-style: normal; font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile em.up { color: var(--good); } .tile em.down { color: var(--bad); }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; margin: .75rem 0 .3rem; background: var(--line); }
.stack i { display: block; height: 100%; }
.fine { margin: .35rem 0 0; font-size: .72rem; color: var(--ink-2); }

/* tabs */
.tabs { display: flex; gap: .15rem; border-bottom: 1px solid var(--line); margin: -.35rem -.4rem .8rem; }
.tab { flex: 1 1 0; font: 600 .8rem var(--font); color: var(--ink-2); background: none; border: 0; border-bottom: 2px solid transparent;
       padding: .5rem .2rem .55rem; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--accent); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.note { font-size: .76rem; color: var(--ink-2); margin: 0 0 .6rem; }
.sub { font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin: .9rem 0 .45rem; font-weight: 700; }

/* scenario presets */
.presets { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .7rem; }
.pre { font: 600 .72rem var(--font); border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 999px; padding: .28rem .65rem; cursor: pointer; }
.pre:hover { border-color: var(--accent); color: var(--accent); }
.pre.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* rule controls */
.rule { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem .6rem; margin-bottom: .5rem; background: var(--panel-2); }
.rule.changed { border-color: #e0a526; box-shadow: inset 3px 0 0 #e0a526; }
.rule-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.rule-top b { font-size: .84rem; }
.rule-top .who { font-size: .68rem; color: var(--ink-3); }
.rule-val { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; }
.rule-val input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.num { width: 4.6rem; font: 600 .86rem var(--font); text-align: right; padding: .2rem .35rem; border-radius: 6px;
       border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-variant-numeric: tabular-nums; }
.unit { font-size: .74rem; color: var(--ink-2); }
.rule-from { display: flex; gap: .8rem; margin-top: .3rem; font-size: .72rem; color: var(--ink-2); flex-wrap: wrap; }
.rule-from label { display: inline-flex; gap: .25rem; align-items: center; cursor: pointer; }
.check { display: flex; gap: .5rem; align-items: flex-start; font-size: .8rem; margin: .35rem 0; cursor: pointer; }
.check input { margin-top: .15rem; accent-color: var(--accent); width: 1rem; height: 1rem; flex: none; }
.check em { font-style: normal; color: var(--ink-3); font-size: .72rem; }
.check.big { font-size: .86rem; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: .5rem .6rem; }
.waterfall .wf { display: grid; grid-template-columns: 8.4rem 1fr 3.3rem; align-items: center; gap: .45rem; font-size: .74rem; margin: .22rem 0; }
.waterfall .wf .bar { height: 12px; background: var(--line); border-radius: 3px; position: relative; overflow: hidden; }
.waterfall .wf .bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.waterfall .wf .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.waterfall .wf .k { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* plan a run */
.seg { display: flex; gap: 2px; padding: 3px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; }
.segb { flex: 1 1 0; font: 600 .78rem var(--font); border: 0; background: transparent; color: var(--ink-2); border-radius: 8px; padding: .4rem .3rem; cursor: pointer; }
.segb.on { background: var(--accent); color: var(--accent-ink); }
.runset { margin: .2rem 0 .7rem; }
.runcards { display: grid; gap: .45rem; }
.rc { display: grid; grid-template-columns: 2rem 1fr; gap: .1rem .6rem; align-items: start; text-align: left; padding: .5rem .6rem; border-radius: 10px;
      border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; font: .76rem var(--font); }
.rc:hover { border-color: var(--accent); }
.rc .lt { grid-row: span 3; width: 2rem; height: 2rem; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: .95rem;
          color: #ffd83b; background: #0b2f4a; border: 2px solid #ffd83b; }
.rc.surf .lt { color: #d7c9ff; border-color: #a88bff; }
.rc .lt.launch { background: #16a34a; color: #fff; font-size: .8rem; }
.rc b { font-size: .84rem; }
.rc .meta { color: var(--ink-2); }
.rc .badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .15rem; }
.rc .bdg { font-size: .64rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--line); color: var(--ink); }
.rc .bdg.good { background: rgba(31,138,76,.16); color: var(--good-ink); } .rc .bdg.warn { background: rgba(183,121,31,.18); color: var(--warn-ink); }
.corr-label { width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; font: 800 13px var(--font); color: #ffd83b;
              background: #0b2f4a; border: 2px solid #ffd83b; box-shadow: 0 1px 6px rgba(0,0,0,.5); }
.corr-label.surf { color: #d7c9ff; border-color: #a88bff; }
.leaflet-container[data-zb="far"] .corr-label { transform: scale(.7); }
.turn-mk { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font: 700 13px var(--font); color: #fff;
           background: rgba(11,47,74,.85); border: 1.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.rm-tick { font: 700 10px var(--font); color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000, 0 0 1px #000; white-space: nowrap; transform: translate(-50%, -50%);
           pointer-events: none; opacity: .92; }
.leaflet-container[data-zb="far"] .rm-tick.minor, .leaflet-container[data-zb="far"] .rm-tick.half { display: none; }
.leaflet-container[data-zb="far"] .turn-mk { display: none; }

/* edit */
.editstate { font-size: .76rem; padding: .45rem .6rem; border-radius: 9px; background: var(--panel-2); border: 1px dashed var(--line);
             margin-bottom: .55rem; color: var(--ink-2); }
.editstate.dirty { border-color: #e0a526; background: rgba(224,165,38,.1); color: var(--ink); }
.editstate.unsaved { border: 2px solid var(--bad); background: rgba(198,47,60,.1); }
.bootfail { position: absolute; z-index: 900; left: 1rem; right: 1rem; top: 4rem; max-width: 560px; margin: 0 auto; padding: .8rem 1rem;
            background: #a32633; color: #fff; border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.4); font: .88rem/1.4 var(--font); }
.bootfail .btnrow { margin-top: .6rem; }
.palette { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .3rem; margin: .55rem 0; }
.ptag { display: flex; align-items: center; gap: .4rem; font: .74rem var(--font); text-align: left; padding: .32rem .45rem;
        border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); cursor: pointer; min-width: 0; }
.ptag .nm { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.2; min-width: 0; }
.ptag.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.ptag .g { flex: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; display: inline-grid; place-items: center;
           font-size: .62rem; font-weight: 800; color: #062033; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3); }
.ptag .st { font-size: .6rem; color: var(--ink-3); margin-left: auto; flex: none; }
.btnrow { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }
.btn { font: 600 .78rem var(--font); border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px;
       padding: .38rem .7rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.file { position: relative; }
select { font: .78rem var(--font); padding: .35rem .4rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.tagcounts { display: flex; flex-wrap: wrap; gap: .3rem .6rem; font-size: .72rem; color: var(--ink-2); }
.tagcounts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.msg { font-size: .76rem; color: var(--accent); min-height: 1.1em; margin-top: .45rem; }

/* downloads tab */
.dlgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; margin-bottom: .6rem; }
.dl { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; padding: .5rem .65rem;
      border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink); cursor: pointer; font-family: var(--font); }
.dl b { font-size: .9rem; } .dl span { font-size: .7rem; color: var(--ink-2); }
.dl:hover { border-color: var(--accent); }

/* leaflet tweaks */
.leaflet-container { font-family: var(--font); }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip, .leaflet-control-layers, .leaflet-bar, .legend { color-scheme: light; }
.leaflet-popup-content { margin: .7rem .85rem; font-size: .8rem; line-height: 1.4; min-width: 220px; }
.pop h3 { margin: 0 0 .25rem; font-size: .92rem; }
.pop .k { color: #5d7182; }
.pop .checks { display: grid; gap: .12rem; margin: .4rem 0; }
.pop .ok { color: #1f8a4c; } .pop .no { color: #c62f3c; }
.pop .zone { font-weight: 700; padding: .2rem .45rem; border-radius: 6px; display: inline-block; margin: .1rem 0 .3rem; }
.pop form { display: grid; gap: .35rem; margin-top: .35rem; }
.pop form label { display: grid; gap: .1rem; font-size: .72rem; color: #5d7182; }
.pop form input[type=text], .pop form textarea, .pop form select { font: .8rem var(--font); padding: .3rem .4rem; border: 1px solid #cfd8de; border-radius: 6px; width: 100%; }
.pop form textarea { min-height: 3.2em; resize: vertical; }
.pop .row2 { display: flex; gap: .35rem; flex-wrap: wrap; }
.pop .coords { font: .7rem ui-monospace, Menlo, monospace; color: #5d7182; }
.pin { display: grid; place-items: center; border-radius: 50%; border: 2px solid #fff; color: #062033; font: 800 10px/1 var(--font);
       box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 2px 5px rgba(0,0,0,.35); }
.pin.t-dock { border-width: 1.5px; }
.pin.unrev { outline: 2px dashed rgba(255,255,255,.9); outline-offset: 1px; }
.pin.sel { box-shadow: 0 0 0 3px #ffde59, 0 0 0 5px rgba(0,0,0,.5); }
.pin.hl { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255,222,89,.55), 0 0 0 9px rgba(0,0,0,.35); } }
.leaflet-container[data-zb="far"] .pin.t-dock { display: none; }
.leaflet-container[data-zb="mid"] .pin.t-dock { transform: scale(.6); outline: none; }
.leaflet-container[data-zb="far"] .pin-label, .leaflet-container[data-zb="mid"] .pin-label { display: none; }
.leaflet-container[data-zb="far"] .pin { transform: scale(.8); }
.leaflet-container[data-zb="far"] .pin:not(.t-launch) { display: none; }
.pin-label { position: absolute; left: 100%; top: 50%; transform: translate(4px, -50%); white-space: nowrap; font: 700 11px var(--font);
             color: #fff; text-shadow: 0 0 3px #000, 0 0 2px #000; pointer-events: none; }
.place-label { font: 700 12px var(--font); color: #fff; text-shadow: 0 0 4px #000, 0 0 2px #000; white-space: nowrap; pointer-events: none; }
.leaflet-control-layers { border-radius: 10px !important; font: .78rem var(--font); }
.leaflet-control-layers-expanded { padding: .5rem .7rem .55rem !important; }
.mapbtn { width: 34px; height: 34px; display: grid !important; place-items: center; font-size: 17px; cursor: pointer; background: #fff;
          color: #0f2233; border: 0; }
.mapbtn.on { background: #0f6fa8; color: #fff; }
.gps-dot { width: 18px; height: 18px; border-radius: 50%; background: #2f7df6; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 0 12px rgba(47,125,246,.8); }

/* ---- pages below the app ----------------------------------------------------- */
.page { padding: 3rem 1rem; background: var(--panel); border-top: 1px solid var(--line); }
.page.alt { background: var(--bg); }
.pagewrap { max-width: 1060px; margin: 0 auto; }
.pagewrap.two { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 2rem; }
.page h2 { margin: 0 0 .6rem; font-size: 1.6rem; letter-spacing: -.015em; color: var(--deep); }
.page h3 { margin: 0 0 .5rem; color: var(--deep); }
.lede { font-size: 1rem; color: var(--ink-2); max-width: 760px; margin: 0 0 1.4rem; }
.lede .sw { margin-right: .2rem; margin-left: .25rem; }
.cards3 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: 1.4rem; }
.dlcard { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--bg); display: flex; flex-direction: column; gap: .35rem; }
.dlcard .fmt { font-weight: 800; font-size: 1.25rem; color: var(--deep); }
.dlcard p { margin: 0; font-size: .82rem; color: var(--ink-2); flex: 1; }
.dlcard .meta { font-size: .7rem; color: var(--ink-3); }
.howto { display: grid; gap: .5rem; max-width: 820px; }
.howto details { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; background: var(--bg); }
.howto summary { cursor: pointer; font-weight: 700; }
.howto ol { margin: .5rem 0 .2rem; padding-left: 1.2rem; font-size: .88rem; color: var(--ink-2); }
.rules { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.rulecard { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--panel); }
.rulecard .who { font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); font-weight: 700; }
.rulecard h3 { margin: .2rem 0 .35rem; font-size: 1.02rem; }
.rulecard p { margin: .3rem 0; font-size: .86rem; color: var(--ink-2); }
.rulecard .cite { font-size: .76rem; }
.force { display: inline-block; font-size: .6rem; font-weight: 800; letter-spacing: .08em; padding: .08rem .4rem; border-radius: 4px; margin-right: .25rem; vertical-align: .05em; }
.force.law { background: #0b2f4a; color: #fff; } .force.guideline { background: #7d55e8; color: #fff; } .force.guidance { background: #d8e0e6; color: #0f2233; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .force.law { background: #a9d4f0; color: #06202f; } }
:root[data-theme="dark"] .force.law { background: #a9d4f0; color: #06202f; }
.asof { font-size: .8rem; color: var(--ink-3); margin: -.8rem 0 1rem; }
.rulecard .dist { float: right; font-weight: 800; font-size: 1.3rem; color: var(--deep); }
.about p { font-size: .9rem; color: var(--ink-2); margin: .4rem 0 .7rem; }
.about b { color: var(--ink); }
.cta { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; background: linear-gradient(160deg, rgba(15,111,168,.08), transparent); align-self: start; }
.cta p, .cta ol { font-size: .88rem; color: var(--ink-2); }
.foot { padding: 1.2rem 1rem 2rem; font-size: .72rem; color: var(--ink-3); text-align: center; border-top: 1px solid var(--line); }
.foot p { max-width: 1000px; margin: .3rem auto; }

/* ---- responsive ------------------------------------------------------------------ */
@media (max-width: 1300px) { .brand-sub { display: none; } }
@media (max-width: 1100px) {
  .top { flex-wrap: wrap; row-gap: .35rem; }
  .conds { order: 3; flex: 1 0 100%; }
  .conds > :first-child { margin-left: 0; }
  .cards3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .top { gap: .5rem; padding: .45rem .7rem; }
  .topnav { display: none; }
  .brand-sub { display: none; }
  .app { grid-template-columns: minmax(0, 1fr); height: auto; }
  .mapcol { height: 64dvh; min-height: 380px; }
  .panel { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .views { left: .6rem; top: .6rem; max-width: calc(100% - 4.2rem); }
  .editbar { left: .5rem; right: 3.9rem; top: .5rem; padding: .35rem .4rem .3rem; }
  .mapcol.editing .legend { display: none; }         /* the edit bar has the zones switch */
  .rulepick { left: .6rem; top: 3.2rem; }
  .hwbanner { left: .6rem; right: 4.2rem; width: auto; transform: none; top: 3.3rem; }
  #rulepick:not([hidden]) ~ .hwbanner { top: 5.9rem; }
  .gpsbar { top: auto; bottom: 0; font-size: .92rem; padding: .5rem .7rem calc(.5rem + env(safe-area-inset-bottom)); }
  .gpsbar small { display: block; margin: .15rem 0 0; font-size: .7rem; }
  .legend { left: .5rem; bottom: 2.6rem; font-size: .72rem; max-width: calc(100% - 5.5rem); }   /* above a two-line imagery credit */
  .leaflet-control-zoom { display: none; }
  .pagewrap.two { grid-template-columns: minmax(0, 1fr); }
  .rules { grid-template-columns: minmax(0, 1fr); }
  .busy { right: 3.2rem; }
}
@media (max-width: 520px) {
  .brand-title { font-size: .92rem; }
  .view { padding: .42rem .5rem; font-size: .74rem; }
  .ebb { padding: .28rem .42rem; font-size: .72rem; }
  .editbar select { max-width: 9.5rem; font-size: .72rem; }
  #ebImg { max-width: 7.2rem; }
  #ebRm { min-width: 0; font-size: .7rem; }
  /* three rows: type + Done / tools + zones + undo / imagery + sweep */
  .eb-tag { order: 1; } #ebDone { order: 2; } .eb-seg { order: 3; } #ebZones { order: 4; } #ebUndo { order: 5; }
  #ebImg { order: 6; } .eb-sweep { order: 7; }
  .eb-more { display: none; }
  .eb-hint { flex-wrap: wrap; row-gap: .1rem; }
  .cards3 { grid-template-columns: minmax(0, 1fr); }
  .dlgrid, .palette { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tiles b { font-size: 1.15rem; }
  .page { padding: 2rem .9rem; }
  .page h2 { font-size: 1.35rem; }
}
@media print { .top, .panel, .views, .legend, .gpsbar, .page, .foot { display: none !important; } }
