/*!
 * State-Leader Portal, accessible, mobile-first styling.
 * Copyright (c) 2026 Evening Star System. Proprietary; all rights reserved. Hives for Heroes holds a license of use.
 * Older, non-technical audience: large type, high contrast, 44px+ tap targets, word labels on colour.
 * Dark by default (Justin 2026-07-23) with a Light toggle. All colours are tokens so both themes stay AA.
 */

/* ---- DARK is the default theme (palette shared with the BeeXchange Command deck) ---- */
:root {
  --bg: #0e0e10; --bg2: #141417;
  --card: #17171a; --surface2: #202024;
  --ink: #f4f2ee; --muted: #a8a49c;
  --amber: #f5a623; --amber-bg: rgba(245,166,35,.12); --amber-line: rgba(245,166,35,.38);
  --green: #34d399; --green-bg: rgba(52,211,153,.12); --green-line: rgba(52,211,153,.38);
  --brand: #f5a623; --brand-text: #f5a623;   /* brand amber; AA on --card */
  --accent: #f5a623; --btn-ink: #1a1200;
  --line: #2c2c31; --danger: #fb7185; --danger-line: rgba(251,113,133,.42); --focus: #f5a623;
  --shadow: 0 10px 30px -18px rgba(0,0,0,.65);
  --glow: 0 12px 44px -20px color-mix(in oklab, var(--accent) 45%, transparent);
  --info-bg: rgba(245,166,35,.10); --info-line: rgba(245,166,35,.35); --info-ink: #e9d3a6;
  font-size: 18px;
  color-scheme: dark;
}
/* No html background: let the body background propagate to the canvas so the fixed honeycomb layer
   (body::before, below) paints over it and under the content, exactly like the command deck. */
/* Warm amber glow at the top, over the flat base. The honeycomb texture is a separate fixed layer. */
body {
  background:
    radial-gradient(70% 100% at 50% 0%, color-mix(in oklab, var(--accent) 10%, transparent) 0%, transparent 70%),
    var(--bg);
  background-repeat: no-repeat; background-attachment: fixed;
}
/* Tessellating honeycomb texture, matching the command deck. Fixed, decorative, never affects layout.
   Served as a file (not a data: URI) so it passes the strict img-src CSP on non-map pages. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: url("/public/honeycomb.svg"); background-repeat: repeat; opacity: .8;
}

/* ---- LIGHT theme (toggle) ---- */
:root[data-theme="light"] {
  --bg: #faf9f6; --bg2: #f2efe8;
  --card: #ffffff; --surface2: #f2f0ea;
  --ink: #1a1a1a; --muted: #5f5c56;
  --amber: #b9770d; --amber-bg: #fbf1dd; --amber-line: rgba(185,119,13,.38);
  --green: #0a7350; --green-bg: #e7f4ee; --green-line: rgba(10,115,80,.32);
  --brand: #b9770d; --brand-text: #b9770d;
  --accent: #f5a623; --btn-ink: #1a1200;
  --line: #e5e3dc; --danger: #c0344b; --danger-line: rgba(192,52,75,.38); --focus: #b9770d;
  --shadow: 0 8px 24px -16px rgba(0,0,0,.22);
  --glow: 0 12px 40px -22px color-mix(in oklab, var(--accent) 40%, transparent);
  --info-bg: #fbf1dd; --info-line: rgba(185,119,13,.35); --info-ink: #6d4708;
  color-scheme: light;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(70% 100% at 50% 0%, color-mix(in oklab, var(--accent) 12%, transparent) 0%, transparent 70%),
    var(--bg);
}

* { box-sizing: border-box; }
/* The [hidden] attribute must always win: several components set display (flex/inline-flex) which would
   otherwise override the UA [hidden]{display:none} at equal specificity, leaving toggled elements stuck
   visible (the assistant panel/fab/settings could not be closed). */
[hidden] { display: none !important; }
body {
  margin: 0; color: var(--ink); min-height: 100vh;
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; line-height: 1.5;
}

/* Keyboard focus (WCAG 2.4.7) */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible,
[tabindex]:focus-visible, .statechoice:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px;
}
.skip { position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--ink); color: var(--bg); padding: 10px 16px; font-weight: 700; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
/* Hexagon brand mark, shared with the command deck. */
.brand-dot {
  width: 1rem; height: 1.12rem; background: var(--accent); flex: 0 0 auto;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); display: inline-block;
}
.topbar-r { display: flex; align-items: center; gap: 8px; }
.themetoggle {
  min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface2);
  color: var(--ink); border-radius: 10px; font-weight: 600; font-size: .9rem; cursor: pointer;
}
.themetoggle:hover { border-color: var(--accent); color: var(--ink); }
main { max-width: 1280px; margin: 0 auto; padding: 20px 24px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px;
  max-width: 880px; margin-left: auto; margin-right: auto; box-shadow: var(--shadow); }
.card.wide { max-width: 100%; }
.card.narrow { max-width: 480px; }
h1 { font-size: 1.6rem; margin: 0 0 12px; line-height: 1.25; }
h2.sect { font-size: 1.2rem; margin: 26px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.lead { font-size: 1.1rem; margin: 0 0 18px; }
.summary { font-size: 1.2rem; margin: 4px 0 20px; }
.muted { color: var(--muted); }
.foot { text-align: center; color: var(--muted); padding: 24px 16px 40px; font-size: .95rem; }
.lead a, .muted a, .foot a { color: var(--brand-text); }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 12px; }
label { font-weight: 700; }
input, select {
  font-size: 1.1rem; padding: 14px; border: 2px solid var(--line); border-radius: 10px;
  width: 100%; background: var(--surface2); color: var(--ink);
}
input:focus, select:focus { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-block; min-height: 48px; padding: 13px 22px; border-radius: 10px;
  font-size: 1.05rem; font-weight: 700; text-decoration: none; text-align: center;
  border: 2px solid transparent; cursor: pointer; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--btn-ink); }
.btn.primary:hover { background: #ffb61f; }
.btn.secondary { background: var(--surface2); color: var(--brand-text); border-color: var(--brand-text); }
.btn.small { min-height: 40px; padding: 8px 14px; font-size: .95rem; }
.linkbtn { background: none; border: none; color: var(--brand-text); font: inherit; cursor: pointer; text-decoration: underline; padding: 6px; }
.linkbtn.danger { color: var(--danger); }
.logout { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }

.alert { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-line); border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.notice { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); border-radius: 10px; padding: 12px 14px; font-weight: 600; }

/* Leader member list */
.members { list-style: none; margin: 8px 0 0; padding: 0; }
.member {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface2);
}
.member.need { background: var(--amber-bg); border-left: 6px solid var(--amber); }
.member.on { background: var(--green-bg); border-left: 6px solid var(--green); }
.who { display: flex; flex-direction: column; }
.who .name { font-weight: 700; }
.who .email { color: var(--muted); font-size: .92rem; word-break: break-all; }
.status { font-weight: 700; white-space: nowrap; font-size: .95rem; }
.status.s-need { color: var(--amber); }
.status.s-on { color: var(--green); }

/* Outreach worklist */
.worklist .member { align-items: flex-start; flex-wrap: wrap; }
.pick { width: 24px; height: 24px; margin-top: 2px; flex: 0 0 auto; accent-color: var(--brand); }
.pick:disabled { opacity: .3; }
.who { flex: 1 1 200px; min-width: 0; gap: 3px; }
.contact { font-size: .92rem; overflow-wrap: anywhere; }
.contact a { color: var(--brand-text); text-decoration: none; }
.tel { font-weight: 700; }
.contact .dot { color: var(--muted); margin: 0 4px; }
.track { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; flex: 0 0 auto; }
.tkbox { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.tk { width: 24px; height: 24px; accent-color: var(--green); }
.att { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.att input { width: 66px; padding: 7px 8px; }
.savehint { color: var(--green); font-weight: 700; align-self: center; }
/* Outreach outcomes (Not interested / Unable to contact): muted, secondary to Emailed/Called. */
.tk-out { color: var(--muted); }
.tk-out .tk { accent-color: var(--muted); }
.member.declined { opacity: .62; }
.member.declined .who .name { text-decoration: line-through; }
.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* Admin coverage */
.refresh { margin: 4px 0 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 16px; }
.toolbar .lbl { font-weight: 700; flex-basis: 100%; color: var(--muted); font-size: .85rem; }
.sortbtn {
  min-height: 40px; padding: 8px 14px; border: 2px solid var(--brand); background: var(--surface2); color: var(--brand-text);
  border-radius: 8px; font-weight: 700; font-size: .95rem; cursor: pointer;
}
.sortbtn[aria-pressed="true"] { background: var(--brand); color: var(--btn-ink); }
.sortbtn .arrow::after { content: ""; }
.sortbtn.asc .arrow::after { content: " \25B2"; }
.sortbtn.desc .arrow::after { content: " \25BC"; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.scard {
  border: 1px solid var(--line); border-radius: 12px; padding: 16px; background: var(--surface2);
  display: flex; flex-direction: column; gap: 12px;
}
.scard.gap { background: var(--amber-bg); border-color: var(--danger-line); }
a.statechoice { text-decoration: none; color: inherit; }
a.statechoice:hover { border-color: var(--brand-text); box-shadow: var(--shadow); }
.scard-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scard-head h2 { font-size: 1.15rem; margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .95rem; color: var(--muted); }
.stats .need { color: var(--amber); }
.manage { display: flex; flex-direction: column; gap: 10px; }
.chip { display: inline-block; font-size: .8rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.chip.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.chip.red { background: var(--surface2); color: var(--danger); border: 1px solid var(--danger-line); }

.assign { display: flex; flex-direction: column; gap: 8px; }
.assign input { width: 100%; font-size: 1rem; padding: 11px 12px; }
.assign button { width: 100%; }
.inline { display: inline; margin: 0; }
.leadinfo { display: flex; flex-direction: column; gap: 4px; }
.leadinfo .name { font-weight: 700; }
.leadinfo .email { color: var(--muted); font-size: .9rem; word-break: break-all; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.small { font-size: .9rem; }
.btn.danger { background: var(--surface2); color: var(--danger); border-color: var(--danger-line); }
.btn.danger:hover { background: var(--danger); color: var(--btn-ink); }
.cardactions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cardactions .inline { display: flex; }
details.replace { border-top: 1px dashed var(--line); padding-top: 10px; }
details.replace summary { cursor: pointer; font-weight: 700; color: var(--brand-text); min-height: 40px; display: flex; align-items: center; }
details.replace[open] summary { margin-bottom: 8px; }

.legal { line-height: 1.6; }
.legal p { margin: 0 0 14px; }
.legal-h { font-size: 1.15rem; margin: 22px 0 8px; }
.backlink { margin: 0 0 10px; }
.backlink a { color: var(--brand-text); font-weight: 700; }
.assist-banner { background: var(--info-bg); border: 1px solid var(--info-line); color: var(--info-ink); border-radius: 10px; padding: 10px 14px; font-weight: 600; margin: 0 0 14px; }

/* Cards lift toward the brand amber on hover, like the command deck's card-hover. */
a.statechoice, .scard { transition: border-color .15s ease, box-shadow .15s ease; }
.scard:hover, a.statechoice:hover { border-color: color-mix(in oklab, var(--accent) 38%, var(--line)); }

/* Hidden "magic door" flower-catching game: the command deck's calm garden, ported to vanilla JS. */
.gamedoor {
  position: fixed; left: 16px; bottom: 16px; z-index: 40; width: 46px; height: 46px;
  padding: 0; border: none; background: none; cursor: pointer; opacity: .55; transition: opacity .15s;
}
.gamedoor:hover, .gamedoor:focus-visible { opacity: 1; }
.gamedoor svg { width: 100%; height: 100%; display: block; }
.gamedoor polygon { fill: none; stroke: var(--accent); stroke-width: 6; transition: fill .15s; }
.gamedoor:hover polygon { fill: color-mix(in oklab, var(--accent) 18%, transparent); }
.gameback {
  position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.6); padding: 16px;
}
.gameback.show { display: flex; }
.gamecard {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--glow);
  padding: 16px; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 12px;
}
.gamecard header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gamecard h2 { margin: 0; font-size: 1.1rem; }
.gamecard .sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.gamescore { font-weight: 700; white-space: nowrap; }
.gameclose { background: none; border: none; color: var(--muted); font-size: 1.25rem; cursor: pointer; min-height: 40px; padding: 0 6px; }
.gameclose:hover { color: var(--ink); }
#gamecanvas { width: 100%; touch-action: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); display: block; }

/* Admin assistant: a floating chat box (no cards), admin-only on /admin. */
.ask-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1100; display: inline-flex; align-items: center; gap: 7px;
  min-height: 48px; padding: 12px 18px; border: none; border-radius: 999px; cursor: pointer;
  background: var(--accent); color: var(--btn-ink); font-weight: 700; font-size: 1rem; box-shadow: var(--glow);
}
.ask-fab:hover { filter: brightness(1.05); }
.ask-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 1101; width: min(400px, calc(100vw - 32px));
  height: min(72vh, 620px); padding: 0; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--glow);
}
.ask-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ask-sub { display: inline-block; }
.ask-head-btns { display: flex; gap: 4px; }
.ask-ic { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.05rem; min-height: 40px; min-width: 36px; border-radius: 8px; }
.ask-ic:hover { color: var(--ink); background: var(--surface2); }
.ask-settings { border-bottom: 1px solid var(--line); background: var(--surface2); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ask-settings label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; }
.ask-settings .asktoggle { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.ask-settings input[type="password"], .ask-settings select { font-size: 1rem; padding: 9px 10px; }
.ask-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ask-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
/* Settings sits inline; the message area (min-height:0) yields space so settings never needs its own scroll. */
/* Themed settings controls (override the portal's chunky global input rule so the provider dropdown and
   the "use my AI" checkbox match the panel instead of rendering as full-width default boxes). */
.ask-settings select, .ask-settings input[type="password"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 1rem;
  background: var(--surface2); color: var(--ink);
}
.ask-settings select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none; cursor: pointer; padding-right: 32px;
  background-image: url("/public/chevron.svg"); background-repeat: no-repeat; background-position: right 12px center; background-size: 11px;
}
.ask-settings .asktoggle { flex-direction: row; align-items: center; gap: 8px; font-weight: 600; }
.ask-settings .asktoggle input[type="checkbox"] {
  width: 20px; height: 20px; padding: 0; border: 1px solid var(--line); border-radius: 4px;
  accent-color: var(--accent); flex: 0 0 auto;
}
/* Custom provider dropdown (replaces the native select so it is rounded and themed, not blocky). */
.ask-field { display: flex; flex-direction: column; gap: 6px; }
.ask-field .ask-lbl { font-weight: 700; font-size: .9rem; }
.dd { position: relative; }
.dd-btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface2); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 14px; font-size: 1rem; font-weight: 600; cursor: pointer;
}
.dd-btn:hover, .dd-btn[aria-expanded="true"] { border-color: var(--accent); }
.dd-caret { width: 0; height: 0; flex: 0 0 auto; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--muted); transition: transform .15s; }
.dd-btn[aria-expanded="true"] .dd-caret { transform: rotate(180deg); }
.dd-menu {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5; margin: 0; padding: 6px;
  list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.dd-opt { padding: 10px 12px; border-radius: 7px; cursor: pointer; font-weight: 600; }
.dd-opt:hover { background: var(--surface2); }
.dd-opt[aria-selected="true"] { background: var(--surface2); color: var(--accent); }

/* Admin export panel: uniform dataset rows (name left, CSV/JSON right), all the same shape. */
.exprow { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); }
.expname { font-weight: 700; }
.expbtns { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
/* Contacts-by-state is the odd one out (it needs a state picker), so it gets its own stacked block
   instead of trying to sit on one line with the uniform rows. */
.expstate-block { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); }
.expstate-controls { display: flex; align-items: center; gap: 8px; }
.expstate-controls .dd { flex: 1 1 auto; min-width: 0; }
.expstate-controls .btn { flex: 0 0 auto; }
/* Compact top actions row + Export popover (options stay out of the way until opened). */
.adminactions { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 4px 0 14px; }
.adminactions .refresh { margin: 0; }
.expwrap { position: static; }
#expbtn { display: inline-flex; align-items: center; gap: 8px; }
[aria-expanded="true"] > .dd-caret { transform: rotate(180deg); }
.exppop {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: min(430px, 92vw); max-width: calc(100vw - 24px);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 12px; display: flex; flex-direction: column; gap: 8px;
}
.dd-menu-scroll { max-height: 260px; overflow-y: auto; }

/* Print / Save-as-PDF: a clean coverage one-pager on white, chrome hidden. */
@media print {
  .topbar, .foot, .skip, .ask-fab, .ask-panel, .gamedoor, .toolbar, .adminactions, .manage, .themetoggle, .backlink { display: none !important; }
  body::before { display: none; }
  :root, :root[data-theme="light"] { --bg: #fff; --card: #fff; --surface2: #fff; --ink: #111; --muted: #555; --line: #ccc; }
  html, body { background: #fff; }
  main { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  .scard { break-inside: avoid; }
}
.ask-b { max-width: 88%; padding: 9px 12px; border-radius: 12px; font-size: .96rem; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-b.me { align-self: flex-end; background: var(--accent); color: var(--btn-ink); font-weight: 600; }
.ask-b.bot { align-self: flex-start; background: var(--surface2); color: var(--ink); border: 1px solid var(--line); }
.ask-b.wait { color: var(--muted); }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 6px; }
.ask-chip { background: var(--surface2); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 6px 11px; font-size: .82rem; cursor: pointer; }
.ask-chip:hover { color: var(--ink); border-color: var(--accent); }
.ask-form { display: flex; align-items: center; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.ask-form input { flex: 1; min-width: 0; font-size: 1rem; padding: 10px 11px; }
.ask-ai { border: 1px solid var(--line); background: var(--surface2); color: var(--muted); border-radius: 8px; min-height: 42px; padding: 0 11px; font-weight: 700; font-size: .8rem; cursor: pointer; }
.ask-ai.on { background: var(--accent); color: var(--btn-ink); border-color: var(--accent); }
@media (max-width: 640px) {
  .ask-panel { right: 8px; left: 8px; bottom: 8px; width: auto; height: min(80vh, 640px); }
}

@media (max-width: 640px) {
  :root { font-size: 17px; }
  .status { align-self: flex-start; }
  .cards { grid-template-columns: 1fr; }
  main { padding: 16px 12px 40px; }
  .card { padding: 18px 14px; }
  .track { width: 100%; padding-top: 8px; border-top: 1px dashed var(--line); }
  /* Keep the top bar on one tidy row on phones: smaller brand + toggle, no wrapped "Sign out". */
  .topbar { padding: 10px 12px; gap: 8px; }
  .brand { font-size: 1.05rem; gap: 8px; }
  .topbar-r { gap: 6px; }
  .themetoggle { padding: 8px 10px; font-size: .82rem; }
}
.linkbtn, .themetoggle { white-space: nowrap; }

/* NewBEE picker: a type-to-filter combobox that replaces the native <select id="nb">. The select stays
   in the DOM (hidden) as the value holder; map.js drives this UI. Themed with the shared vars so it reads
   correctly in both light and dark. */
.nb-wrap { position: relative; display: inline-block; vertical-align: middle; }
.nb-combo {
  min-width: 16rem; min-height: 40px; padding: 8px 14px; font: inherit; font-weight: 600; font-size: .9rem;
  color: var(--ink); background: var(--surface2); border: 1px solid var(--line); border-radius: 10px;
}
.nb-combo::placeholder { color: var(--muted); font-weight: 500; }
.nb-menu {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 1200; margin: 0; padding: 4px;
  list-style: none; min-width: 100%; max-width: 22rem; max-height: 16rem; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.nb-menu[hidden] { display: none; }
.nb-menu li {
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: .9rem; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nb-menu li.active, .nb-menu li:hover { background: var(--amber-bg); color: var(--ink); }

/* Map distance ruler (a Leaflet control button) + its reading label. Themed for light + dark. */
.measure-btn {
  font: inherit; font-weight: 600; font-size: .82rem; padding: 6px 10px; cursor: pointer;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow);
}
.measure-btn:hover { border-color: var(--accent); }
.measure-btn.on { background: var(--amber); color: var(--btn-ink); border-color: var(--amber); }
.leaflet-container.measuring { cursor: crosshair; }
.measure-label {
  background: var(--card); color: var(--ink); border: 1px solid var(--amber-line);
  border-radius: 6px; padding: 1px 6px; font-weight: 700; font-size: .78rem; white-space: nowrap;
  width: auto !important; height: auto !important; box-shadow: var(--shadow);
}
