:root {
  --bg: #0b2540;
  --bg-pane: #102e54;
  --fg: #f0f4fa;
  --muted: #aab4c5;
  --accent: #4cc9f0;
  --green: #5cb85c;
  --yellow: #f0ad4e;
  --gray: #7d8893;
  --red: #d9534f;
  --blue: #3b82f6;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  /* #session-bar floats over the map; keep parcels above it when fitting/panning. */
  --session-bar-height: 44px;
  --map-bottom-inset: calc(var(--session-bar-height) + env(safe-area-inset-bottom, 0px) + 22px);
  --tfp-env-banner-height: 0px;
  /* JW Library — style purple. Used exclusively for Field Service
   * Location pins so they read as "spiritual / set apart" and never
   * get confused with the contact-state palette (red/amber/green/
   * grey) that the address dots use. Two shades so the inner core
   * is brighter than the halo. */
  --fsl-purple:       #6d28d9;
  --fsl-purple-glow:  #a78bfa;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* User-tunable font scale. Multiplies the document's root
   * font-size; every typography rule in the app keys off `rem`
   * inherently because Leaflet/native widgets respect the html
   * font-size, and the popup / drawer / panel text inherits the
   * body's font-size. Set by Prefs IIFE on boot from /api/me/prefs
   * (with a localStorage cache for instant offline paint) and on
   * every drawer A-/A/A+ tap. Default 1.0 → 16 px root.
   * Allowed values: sm=0.875 md=1.0 lg=1.125 xl=1.25. */
  --app-font-scale: 1;
}
html {
  font-size: calc(16px * var(--app-font-scale));
}

* { box-sizing: border-box; }

/* HTML `hidden` attribute must beat #id rules that set display:flex/block. */
[hidden] { display: none !important; }

html, body {
  height: 100%; margin: 0; background: var(--bg); color: var(--fg);
  overscroll-behavior: none;
  /* Belt-and-suspenders against horizontal scrolling on any page
   * that uses app.css. The old topbar with 17 pills was the worst
   * offender; this guarantees no descendant can ever introduce a
   * sideways scrollbar at the document level. */
  overflow-x: hidden;
}
body { display: flex; flex-direction: column; }

/* ----------------------------------------------------------------
   Topbar (app bar). Post-redesign: a strict single-line surface
   with the menu button, title, state pill, and reviews badge —
   nothing else. flex-wrap: nowrap + overflow: hidden + min-width:
   0 on the title cell makes it impossible for any descendant to
   force a horizontal scrollbar. The bar respects the iOS notch
   via env(safe-area-inset-top) and remains sticky at the top.
   ---------------------------------------------------------------- */
html.tfp-has-env-banner {
  --tfp-env-banner-height: 36px;
}
#tfp-env-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10001;
  padding: 6px 12px;
  font-size: calc(12px * var(--app-font-scale, 1));
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
#tfp-env-banner.dev {
  background: #e8620a;
  color: #1a1208;
}
#tfp-env-banner.test {
  background: #e6c200;
  color: #1a1608;
}
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top, 0px) + var(--tfp-env-banner-height) + 10px) 14px 10px;
  background: linear-gradient(180deg, #0e2d52 0%, var(--bg) 100%);
  border-bottom: 1px solid #1e3a5f;
  position: sticky; top: 0; z-index: 1000;
  flex-wrap: nowrap;
  overflow: hidden;
  min-height: 56px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
#topbar #menu-btn {
  background: transparent; border: 0; color: var(--fg);
  font-size: calc(22px * var(--app-font-scale, 1)); cursor: pointer; padding: 8px 10px;
  position: relative; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  flex: 0 0 auto;
}
#topbar #menu-btn:hover { background: #1a3866; }
#topbar #menu-btn:active { background: #214178; }
#topbar #menu-btn .menu-btn-icon { font-size: calc(22px * var(--app-font-scale, 1)); line-height: 1; }
/* Small dot on the hamburger that summarises connectivity + sync:
 * green = online & queue idle, amber = queued items, red = offline.
 * Lets users see at a glance whether work is uploading without
 * opening the drawer. JS sets the class via paintStatusDot(). */
#topbar #menu-btn .status-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid var(--bg);
  background: var(--gray);
  box-sizing: content-box;
}
.status-dot-online   { background: var(--green) !important; }
.status-dot-queued   { background: var(--yellow) !important; }
.status-dot-syncing  { background: var(--accent) !important; }
.status-dot-offline  { background: var(--red) !important; }
.status-dot-unknown  { background: var(--gray) !important; }

/* The title cell is the visible "selected card combo" AND a
 * button — tap it to open the territory picker. Two-line layout:
 * territory number in cyan monospace (the card id), locality
 * muted underneath. A small chevron on the right is the
 * affordance for "this opens something". */
#title {
  flex: 1 1 auto;
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  margin: 0 -2px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--fg);
  text-align: left;
  font-family: inherit;
}
#title:hover, #title:focus-visible { background: rgba(76, 201, 240, 0.10); outline: none; }
#title:active { background: rgba(76, 201, 240, 0.18); }
#title .title-text {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-width: 0; line-height: 1.2;
}
#title strong {
  font-size: calc(17px * var(--app-font-scale, 1)); font-weight: 700;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
  letter-spacing: 0.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#title #locality-label {
  font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
#title .title-chevron {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: calc(14px * var(--app-font-scale, 1)); line-height: 1;
  opacity: 0.7;
  transition: opacity 120ms ease;
}
#title:hover .title-chevron { opacity: 1; }
/* No-territory empty state: the title becomes a muted "no territory"
 * line and the chevron implies the picker. */
body.no-territory #title strong {
  color: var(--muted); font-family: inherit; font-weight: 600;
  letter-spacing: 0; font-size: calc(15px * var(--app-font-scale, 1));
}
body.no-territory #title #locality-label { display: none; }

.boot-msg {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: rgba(11, 37, 64, 0.92);
  color: #fff;
  font-size: calc(16px * var(--app-font-scale, 1));
  line-height: 1.4;
}
.boot-msg[hidden] { display: none !important; }

/* ----------------------------------------------------------------
   Info strip — sits between the topbar and the map. Surfaces the
   "other info" the user wanted to see at a glance (visit progress,
   when this territory was last worked, current lease state) plus
   admin/manage quick-jump links. Renders as a horizontal row of
   subtle chips; on narrow viewports it wraps to two rows rather
   than scroll. Hidden entirely when no territory is selected.
   ---------------------------------------------------------------- */
#info-strip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: rgba(11, 37, 64, 0.85);
  border-bottom: 1px solid #1e3a5f;
  font-size: calc(12px * var(--app-font-scale, 1));
  position: sticky; top: 0; z-index: 999;
  flex-wrap: wrap;
  min-height: 36px;
  box-sizing: border-box;
}
.info-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 99px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  font-size: calc(12px * var(--app-font-scale, 1));
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.info-chip-icon {
  font-size: calc(11px * var(--app-font-scale, 1)); opacity: 0.8; line-height: 1;
}
.info-chip-text { line-height: 1.2; }
#info-progress {
  background: rgba(125, 136, 147, 0.18);
  color: #d3dae3;
  border-color: rgba(125, 136, 147, 0.28);
  font-variant-numeric: tabular-nums;
}
.info-progress-stats {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.2;
}
.ip-seg {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  white-space: nowrap;
}
.ip-ic { font-size: calc(10px * var(--app-font-scale, 1)); opacity: 0.85; line-height: 1; }
.ip-n { font-weight: 600; min-width: 1ch; }
.ip-c .ip-ic, .ip-c .ip-n { color: #9fd4a0; }
.ip-nat .ip-ic, .ip-nat .ip-n { color: #f8d699; }
.ip-u .ip-ic, .ip-u .ip-n { color: #b8c5d3; }
.ip-s .ip-ic, .ip-s .ip-n { color: #d1a8a8; }
#info-last-worked { background: rgba(125, 136, 147, 0.20); color: #d3dae3; }
#info-lease { background: rgba(76, 201, 240, 0.16); color: #b8e9fa; border-color: rgba(76, 201, 240, 0.28); }
#info-lease.tone-warning { background: rgba(240, 173, 78, 0.20); color: #f8d699; border-color: rgba(240, 173, 78, 0.32); }
#info-lease.tone-expired { background: rgba(217, 83, 79, 0.20); color: #f1bcbb; border-color: rgba(217, 83, 79, 0.32); }
.info-strip-spacer { flex: 1 1 auto; min-width: 0; }
.info-jump {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 8px;
  background: rgba(76, 201, 240, 0.14);
  color: var(--accent);
  font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(76, 201, 240, 0.30);
  white-space: nowrap;
}
.info-jump:hover { background: rgba(76, 201, 240, 0.26); }
.info-jump-icon { font-size: calc(12px * var(--app-font-scale, 1)); line-height: 1; }
@media (max-width: 540px) {
  /* On phones, collapse the admin/manage jumps to icon-only to keep
   * the strip readable when progress + last-worked are also showing. */
  .info-jump-label { display: none; }
  .info-jump { padding: 4px 8px; }
}

/* ----------------------------------------------------------------
   Territory picker (modal bottom sheet). Slides up from the bottom
   on phones; floats centered on desktop. Full territory list plus
   live search. Z-index above everything else so it's the focal
   surface when open. Backdrop click + Esc close. The picker replaces
   the territory-list+search that used to live inside the drawer.
   ---------------------------------------------------------------- */
#picker-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 3100; cursor: pointer;
  animation: drawer-backdrop-in 160ms ease-out;
}
#territory-picker-sheet {
  position: fixed; left: 0; right: 0;
  bottom: 0;
  max-height: 78vh;
  background: var(--bg-pane);
  border-top: 1px solid #1e3a5f;
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  z-index: 3150;
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: picker-slide-up 220ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes picker-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
/* Wider, centered, dialog-like on desktop. */
@media (min-width: 720px) {
  #territory-picker-sheet {
    left: 50%; right: auto; bottom: 50%;
    transform: translate(-50%, 50%);
    width: min(520px, 92vw);
    max-height: 70vh;
    border-radius: 14px;
    animation: picker-pop 180ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes picker-pop {
    from { transform: translate(-50%, calc(50% + 24px)); opacity: 0; }
    to   { transform: translate(-50%, 50%); opacity: 1; }
  }
}
.picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 8px;
  flex: 0 0 auto;
}
.picker-head strong { font-size: calc(15px * var(--app-font-scale, 1)); letter-spacing: 0.2px; }
.picker-head button {
  background: transparent; border: 0; color: var(--fg);
  font-size: calc(18px * var(--app-font-scale, 1)); cursor: pointer; padding: 4px 8px;
  border-radius: 6px; line-height: 1;
}
.picker-head button:hover { background: #1a3866; }
#territory-picker-sheet input#search {
  margin: 6px 14px 8px; padding: 10px 12px;
  border-radius: 10px; border: 1px solid #1e3a5f;
  background: #0a1d33; color: var(--fg); font-size: calc(15px * var(--app-font-scale, 1));
  width: calc(100% - 28px); box-sizing: border-box;
  flex: 0 0 auto;
}
#territory-picker-sheet #territory-list {
  list-style: none; margin: 0; padding: 4px 0 8px;
  overflow-y: auto;
  flex: 1 1 auto;
  max-height: none;
}
#territory-picker-sheet #territory-list li {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer; display: flex; gap: 10px; align-items: baseline;
  min-height: 48px;
}
#territory-picker-sheet #territory-list li:hover,
#territory-picker-sheet #territory-list li.active {
  background: #1a3866;
}
#territory-picker-sheet #territory-list li strong {
  min-width: 56px; font-family: monospace; color: var(--accent);
  font-size: calc(14px * var(--app-font-scale, 1)); font-weight: 700;
}
#territory-picker-sheet #territory-list li .meta {
  font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted); margin-left: auto;
}
/* Right-side topbar pills (state + reviews) never shrink; the title
 * is the only flexible cell, so long territory names ellipsize while
 * status stays fully readable. */
#topbar > .pill, #topbar > #state-pill, #topbar > #reviews-btn {
  flex: 0 0 auto;
}

.pill { font-size: calc(11px * var(--app-font-scale, 1)); padding: 2px 8px; border-radius: 99px; background: #1e3a5f; color: var(--muted); white-space: nowrap; border: 0; font-family: inherit; cursor: default; text-decoration: none; display: inline-flex; align-items: center; }
button.pill, a.pill { cursor: pointer; }
button.pill:hover, a.pill:hover { background: #2a4a73; color: var(--fg); }
.pill.cta { background: var(--accent); color: #02233a; font-weight: 600; }
.pill.cta:hover { background: #6fd6f5; color: #02233a; }
.pill.ghost { background: transparent; }
.pill.online { background: rgba(92, 184, 92, 0.25); color: #b3e3b3; }
.pill.offline { background: rgba(217, 83, 79, 0.25); color: #f1bcbb; }
.pill.idle { color: var(--muted); }
.pill.queued { background: rgba(240, 173, 78, 0.25); color: #f8d699; }
.pill.syncing { background: rgba(76, 201, 240, 0.25); color: #b8e9fa; }
/* version-mismatch: shown on #version-pill when the page-side
   APP_VERSION disagrees with the active SW's shell cache name —
   visual cue that a v-bump is staged but hasn't activated yet. */
.pill.version-mismatch { background: rgba(240, 173, 78, 0.25); color: #f8d699; font-family: monospace; }
#version-pill { font-family: monospace; }
#user-pill { font-family: monospace; }

main { flex: 1; position: relative; min-height: 0; }
/* Map fills main; #session-bar floats above the bottom edge. */
#map { position: absolute; inset: 0; background: #0a1d33; }

/* ----------------------------------------------------------------
   Drawer (#sidepanel) — slide-in left panel that now hosts every
   secondary control (offline maps, alerts, links, account, status)
   that used to live as a pill in the topbar. The semi-transparent
   #drawer-backdrop intercepts taps outside the drawer to close it,
   matching native Android/iOS navigation drawer behavior.

   Layout is a vertical flex column with scrollable middle. Each
   section is a labelled group of full-width tappable rows so the
   drawer reads like a real settings page, not a tag cloud.
   ---------------------------------------------------------------- */

/* Ghost-text wrapper for incremental search inputs. Both the topbar
 * territory picker (#search inside #territory-picker-sheet) and the
 * drawer's #address-search inside #address-section use this pattern:
 * the live <input> sits on top with transparent background, and a
 * sibling .search-ghost layer renders the unmatched suffix of the
 * unique top-match in muted text — verbatim user input is rendered
 * transparent so it acts as a width-accurate spacer that anchors
 * the suffix at the caret. See TerritorySearch / AddressSearch in
 * static/app.js. */
.search-wrap {
  position: relative;
  margin: 8px 12px;
}
.search-wrap input[type="search"] {
  display: block; width: 100%;
  padding: 8px 10px; border-radius: 6px; border: 1px solid #1e3a5f;
  background: transparent; color: var(--fg); font-size: 14px;
  position: relative; z-index: 2;
}
.search-ghost {
  position: absolute; inset: 0;
  padding: 8px 10px;
  border: 1px solid transparent; border-radius: 6px;
  background: #0a1d33;
  font: inherit; font-size: 14px; line-height: normal;
  white-space: pre; overflow: hidden;
  pointer-events: none; z-index: 1;
  color: transparent;
}
.search-ghost .ghost-suffix { color: var(--muted); }
/* Modal navigation drawer pattern: backdrop + sliding panel both
 * sit above EVERYTHING else (topbar, geo-banner, lease-banner). We
 * picked z-indices >2500 deliberately so the drawer always wins —
 * any other banner that pre-existed (geo at 1200, lease at 2400,
 * DNC at 2500) would otherwise punch through the panel and look
 * like the layout broke. */
#drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 2900; cursor: pointer;
  animation: drawer-backdrop-in 160ms ease-out;
}
@keyframes drawer-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#sidepanel {
  position: fixed; top: 0; bottom: 0; left: 0;
  width: min(340px, 88vw);
  background: var(--bg-pane); border-right: 1px solid #1e3a5f;
  display: flex; flex-direction: column; z-index: 2950;
  box-shadow: var(--shadow);
  /* Honor the iOS safe area so the close button and user row
   * aren't tucked under the notch when the drawer is open. */
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  animation: drawer-slide-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes drawer-slide-in {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-bottom: 1px solid #1e3a5f;
  flex: 0 0 auto;
}
.panel-head strong { font-size: calc(15px * var(--app-font-scale, 1)); letter-spacing: 0.3px; }
.panel-head button {
  background: transparent; border: 0; color: var(--fg);
  font-size: calc(18px * var(--app-font-scale, 1)); cursor: pointer; padding: 4px 8px;
  border-radius: 6px; line-height: 1;
}
.panel-head button:hover { background: #1a3866; }

/* Account header row at the top of the drawer. Shows the signed-in
 * user with a right-aligned sign-out icon button. */
.drawer-userbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid #1e3a5f;
  flex: 0 0 auto;
}
.drawer-user {
  flex: 1; font-family: monospace; font-size: calc(13px * var(--app-font-scale, 1)); color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drawer-user:empty::before {
  content: "signed out"; color: var(--muted); font-style: italic;
}
.drawer-icon-btn {
  background: transparent; border: 0; color: var(--muted);
  font-size: calc(16px * var(--app-font-scale, 1)); cursor: pointer; padding: 6px 10px;
  border-radius: 6px; line-height: 1;
}
.drawer-icon-btn:hover { background: #1a3866; color: var(--fg); }

/* Install prompt — bright accent CTA when the browser fires
 * beforeinstallprompt. Lives just under the account row so it
 * grabs attention without crowding any one section. */
.drawer-cta {
  margin: 10px 14px 4px;
  padding: 10px 14px; border-radius: 10px; border: 0;
  background: var(--accent); color: #02233a;
  font-size: calc(14px * var(--app-font-scale, 1)); font-weight: 600; cursor: pointer;
  text-align: left; font-family: inherit;
  display: flex; align-items: center; gap: 8px;
  flex: 0 0 auto;
}
.drawer-cta:hover { background: #6fd6f5; }

/* The middle scrollable region. The first .drawer-section sets
 * flex: 1 so the territories list takes the remaining height; the
 * rest sit beneath in normal flow. We achieve that by giving the
 * sidepanel itself overflow: hidden and the territories list its
 * own overflow-y: auto, while wrapping everything else in a single
 * scrollable container via an internal wrapper. To keep this CSS
 * simple without restructuring the HTML, we let the WHOLE sidepanel
 * scroll vertically as one column. */
#sidepanel {
  overflow-y: auto;
}

.drawer-section {
  border-top: 1px solid #1e3a5f;
  padding: 8px 0 10px;
  flex: 0 0 auto;
}
.drawer-section:first-of-type { border-top: 0; }
.drawer-section-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 6px 14px 4px;
  font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700;
}
.drawer-section-head .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Full-width tappable row inside a drawer section. Replaces the
 * topbar's tiny .pill targets — taller hit area (44px+), icon on
 * the left, label on the right. Mirrors native settings rows. */
.drawer-row {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 16px); margin: 2px 8px;
  padding: 10px 12px;
  background: transparent; color: var(--fg); border: 0;
  border-radius: 8px; cursor: pointer;
  font-size: calc(14px * var(--app-font-scale, 1)); font-family: inherit; text-align: left;
  text-decoration: none;
  min-height: 44px;
  transition: background 120ms ease;
}
.drawer-row:hover { background: #1a3866; }
.drawer-row:active { background: #214178; }
.drawer-row .drawer-row-icon {
  flex: 0 0 24px; font-size: calc(16px * var(--app-font-scale, 1)); text-align: center; opacity: 0.9;
}
.drawer-row .drawer-row-label { flex: 1; line-height: 1.25; }

/* Toggle rows reflect their on/off state with an accent fill on
 * the left edge + a brighter background tint. JS already toggles
 * the `.on` class on these elements; we wire the new visual here.
 * `aria-pressed="true"` is the alternate trigger so screen-reader
 * users get the same affordance. */
.drawer-row-toggle.on,
.drawer-row-toggle[aria-pressed="true"] {
  background: rgba(76, 201, 240, 0.18);
  color: var(--fg);
  box-shadow: inset 3px 0 0 var(--accent);
}
.drawer-row-toggle.muted {
  /* alert-toggle uses .muted (defined elsewhere) for the muted state */
  background: rgba(217, 83, 79, 0.18);
  color: #f1bcbb;
  box-shadow: inset 3px 0 0 var(--red);
}

/* Static informational drawer rows. Used for the "Auto-downloads on
 * Wi-Fi" line (no toggle, just a status statement) — the user
 * removed the wifi toggle in v79 because wifi is free and gating it
 * was needless friction, but we still want the publisher to know
 * the wifi auto-download is happening. Render dimmed + non-
 * interactive so it doesn't look like a button the user should
 * tap. .drawer-row already pads + lays out icon/label, this rule
 * just turns off the hover/active affordances. */
.drawer-row.drawer-row-info {
  cursor: default;
  opacity: 0.78;
}
.drawer-row.drawer-row-info:hover,
.drawer-row.drawer-row-info:active {
  background: transparent;
}

/* Display preferences row: label on the left, segmented control
 * on the right. Each button shows the same letter at four sizes
 * so the user sees the actual effect on a glyph before committing.
 * The `.active` class is set by the Prefs IIFE when the value
 * matches the user's current pref. */
.drawer-pref-row {
  display: flex; align-items: center; gap: 12px;
  width: calc(100% - 16px); margin: 4px 8px;
  padding: 8px 12px;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.drawer-pref-label { flex: 1; color: var(--fg); }
.drawer-pref-controls {
  display: inline-flex; gap: 4px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px; padding: 3px;
}
.drawer-pref-btn {
  background: transparent; color: var(--muted);
  border: 0; border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
  font-family: serif; line-height: 1;
  min-width: 32px; min-height: 32px;
}
.drawer-pref-btn[data-pref-value="sm"] { font-size: calc(11px * var(--app-font-scale, 1)); }
.drawer-pref-btn[data-pref-value="md"] { font-size: calc(14px * var(--app-font-scale, 1)); }
.drawer-pref-btn[data-pref-value="lg"] { font-size: calc(18px * var(--app-font-scale, 1)); }
.drawer-pref-btn[data-pref-value="xl"] { font-size: calc(22px * var(--app-font-scale, 1)); }
.drawer-pref-btn:hover { color: var(--fg); }
.drawer-pref-btn.active {
  background: var(--accent); color: #0b2540; font-weight: 700;
}

/* Status footer pinned at the bottom of the drawer column. Shows
 * the raw net / sync / version pills for users who want exact
 * detail beyond the topbar's combined status dot. */
.drawer-footer {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  border-top: 1px solid #1e3a5f;
  margin-top: auto;
  flex: 0 0 auto;
}

/* Territory list and search live in the #territory-picker-sheet
 * now (a dedicated bottom-sheet picker), not in the drawer. The
 * picker has its own scoped styles further down. */

/* ----------------------------------------------------------------
   Session bar (bottom). Now a two-row container: the action row
   (Start/End + stats) stays a single line, while the contextual
   status pills (field-status, territory-session, drive, motion)
   live on a second wrap row below. The bar respects the iOS
   home-indicator safe area and clamps to viewport width via
   max-width: 100vw so it never causes horizontal overflow.
   ---------------------------------------------------------------- */
#session-bar {
  position: absolute; left: 10px; right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 6px);
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(11, 37, 64, 0.88); backdrop-filter: blur(8px);
  border-radius: 10px; padding: 6px 10px; box-shadow: var(--shadow);
  z-index: 1050;
  max-width: calc(100vw - 20px);
}
#session-bar .session-bar-row {
  display: flex; gap: 6px; align-items: center;
}
#session-bar .session-bar-pills {
  display: flex; gap: 6px; flex-wrap: wrap;
  /* The pills inside are [hidden] until the relevant runtime
   * condition fires. We don't try to suppress the wrapper when
   * every pill is hidden — flex with all-hidden children
   * collapses to zero intrinsic size and just contributes the
   * parent's `gap` (8px), which is invisible against the bar's
   * existing padding. Keeps the CSS portable and predictable. */
}
#session-bar button.primary {
  background: var(--accent); color: #02233a; font-weight: 600; border: 0;
  border-radius: 10px; padding: 11px 18px; font-size: calc(14px * var(--app-font-scale, 1)); cursor: pointer;
  flex: 0 0 auto;
}
#session-bar button.primary.active { background: var(--red); color: #fff; }
#session-stats { font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted); flex: 1; min-width: 0; text-align: right; }

/* Ministry chip — single control for Gather / Work / Done */
.ministry-chip {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 1 1 auto; min-width: 0; max-width: 100%;
  border: 1px solid #1e3a5f; border-radius: 999px;
  padding: 7px 12px; cursor: pointer;
  font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 700;
  background: rgba(0, 0, 0, 0.2); color: var(--muted);
  text-align: left; line-height: 1.2;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.ministry-chip:hover:not([data-busy]) { color: var(--fg); background: rgba(255,255,255,0.06); }
.ministry-chip[data-busy] { opacity: 0.72; cursor: wait; }
.ministry-chip-glyph { flex: 0 0 auto; font-size: calc(14px * var(--app-font-scale, 1)); }
.ministry-chip-label {
  flex: 1 1 auto; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ministry-chip[data-state="done"] {
  border-color: #2a3f5c; color: var(--muted);
}
.ministry-chip[data-state="done"][data-ready] {
  border-color: #3d7a9e;
  color: #b8e4f8;
  background: rgba(56, 189, 248, 0.08);
  cursor: pointer;
}
.ministry-chip:not([data-actionable]) {
  flex: 0 1 auto; max-width: 10rem;
  opacity: 0.78; font-weight: 600;
  padding: 7px 12px;
  font-size: calc(12px * var(--app-font-scale, 1));
}
.ministry-chip[data-offline] {
  opacity: 0.75; cursor: pointer;
}
#session-bar[data-ministry-idle] .ministry-chip {
  box-shadow: none;
}
.ministry-chip[data-state="gathering"] {
  border-color: #3d7a9e; background: rgba(56, 189, 248, 0.12); color: #9fdcff;
}
.ministry-chip[data-pending-sync] {
  cursor: wait;
  animation: ministry-chip-pending 1.35s ease-in-out infinite alternate;
}
.ministry-chip[data-state="gathering"][data-pending-sync] {
  border-color: #4cc9f0;
  background: rgba(76, 201, 240, 0.16);
}
@keyframes ministry-chip-pending {
  from {
    opacity: 0.82;
    box-shadow: 0 0 0 0 rgba(76, 201, 240, 0);
  }
  to {
    opacity: 1;
    box-shadow: 0 0 10px 2px rgba(76, 201, 240, 0.38);
  }
}
.ministry-chip[data-state="working"] {
  border-color: #2d6a4f; background: rgba(74, 222, 128, 0.14); color: #86efac;
}
.ministry-chip[data-break] {
  border-color: #6b5a2e; background: rgba(251, 191, 36, 0.1); color: #fcd34d;
}

/* Bottom sheets — FSL picker + ministry actions */
.fsl-picker-backdrop, .ministry-action-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 12000;
}
.fsl-picker-sheet, .ministry-action-sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(420px, 100vw); max-height: min(70vh, 520px); overflow: auto;
  background: #0f2744; color: var(--fg);
  border-radius: 14px 14px 0 0; padding: 16px; z-index: 12001;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
}
.fsl-picker-title, .ministry-action-title {
  font-weight: 700; font-size: calc(15px * var(--app-font-scale, 1));
}
.fsl-picker-sub, .ministry-action-sub {
  color: var(--muted); font-size: calc(12px * var(--app-font-scale, 1));
  margin: 4px 0 12px; line-height: 1.35;
}
.fsl-picker-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.fsl-picker-loading {
  padding: 12px 4px; color: var(--muted);
  font-size: calc(13px * var(--app-font-scale, 1)); text-align: center;
}
.fsl-picker-opt, .ministry-action-opt, .fsl-picker-cancel, .ministry-action-cancel {
  display: block; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 10px; border: 1px solid #1e3a5f;
  background: #132f52; color: var(--fg); font-weight: 600; cursor: pointer;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.fsl-picker-opt:hover, .ministry-action-opt:hover { background: #1a3d66; }
.ministry-action-opt-primary {
  background: #1a4d7a;
  font-weight: 700;
  border-color: #3ecf8e;
}
.fsl-picker-opt-near { border-color: #3d7a9e; }
.fsl-picker-opt-meta { display: block; font-weight: 400; font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted); margin-top: 2px; }
.fsl-picker-cancel, .ministry-action-cancel { background: transparent; color: var(--muted); margin-top: 4px; }

/* Topbar ministry status — countdown + short leader messages */
#topbar #ministry-status {
  flex: 1 1 auto; min-width: 0; max-width: 42vw;
  font-size: calc(11px * var(--app-font-scale, 1)); font-weight: 600;
  color: #9fdcff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 6px;
}
#topbar #ministry-status[data-phase="wrapping_up"],
#topbar #ministry-status[data-phase="soft_closed"] {
  color: #f6dca0;
}
@media (max-width: 480px) {
  #topbar #ministry-status { display: none; }
  #session-bar .session-stats-clock { display: block; font-weight: 600; color: var(--accent); }
}

#visit-prompt {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 2000;
}
#visit-prompt .dialog {
  background: var(--bg-pane); padding: 18px; border-radius: 12px; width: 100%;
  max-width: 340px; box-shadow: var(--shadow);
}
#visit-prompt h3 { margin: 0 0 6px; font-size: calc(16px * var(--app-font-scale, 1)); }
#visit-prompt p { margin: 0 0 14px; color: var(--muted); font-size: calc(14px * var(--app-font-scale, 1)); }
/* Visit prompt header row carries the Experimental badge + the
 * "Suggested visit" eyebrow text per the geofence-first pivot
 * (PROPOSAL_GEOFENCE_FIRST_VISITS.md, Session C). The badge is
 * permanent — the whole prompt is gated behind
 * experimental.parcel_visit_detection, so its presence implies the
 * gate is on. */
.visit-prompt-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.visit-prompt-eyebrow {
  font-size: calc(11px * var(--app-font-scale, 1)); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
#visit-prompt .row { display: flex; gap: 8px; margin-top: 8px; }
#visit-prompt button {
  flex: 1; padding: 12px; border: 0; border-radius: 8px; font-size: calc(14px * var(--app-font-scale, 1));
  cursor: pointer; font-weight: 600;
}
#visit-prompt button[data-status="contacted"] { background: var(--green); color: #fff; }
#visit-prompt button[data-status="not_contacted"] { background: var(--yellow); color: #2a2103; }
#visit-prompt button.ghost { background: #1e3a5f; color: var(--muted); font-weight: 400; }

#toast {
  position: absolute; left: 50%;
  bottom: calc(var(--session-bar-height, 44px) + env(safe-area-inset-bottom, 0px) + 10px);
  transform: translateX(-50%);
  background: rgba(11, 37, 64, 0.95); color: var(--fg);
  padding: 8px 14px; border-radius: 8px; font-size: calc(13px * var(--app-font-scale, 1));
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  z-index: 1500;
}
#toast.show { opacity: 1; }

#alert-toggle.muted { background: #4a2828; color: #f1bcbb; }
#alert-toggle:not(.muted) { background: rgba(217, 83, 79, 0.25); color: #f8b3b3; }

/* Motion pill: live accelerometer-derived class. Colours mirror the
 * semantic of each state — stationary is calm grey, walking is
 * neutral, running is hot. The pill is informational; the same
 * signal silently gates DNC hard alarms.
 */
#motion-pill { font-family: monospace; }
#motion-pill.motion-stationary     { background: rgba(125, 136, 147, 0.30); color: #d3dae3; }
#motion-pill.motion-walking_slow   { background: rgba(76, 201, 240, 0.20); color: #b8e9fa; }
#motion-pill.motion-walking_normal { background: rgba(92, 184, 92, 0.25);  color: #b3e3b3; }
#motion-pill.motion-running        { background: rgba(240, 173, 78, 0.30); color: #f8d699; }
#motion-pill.motion-unknown        { background: #2a3a52; color: #aab4c5; }

/* Admin debug toggle for the territory card outline. The "on" state
 * uses the same cyan as the outline itself so it's instantly obvious
 * what's being shown.
 */
#debug-card-outline { font-family: monospace; }
#debug-card-outline.on {
  background: rgba(76, 201, 240, 0.25);
  color: var(--accent);
  border: 1px dashed var(--accent);
}

/* Offline-map auto-download toggle. "On" reuses the accent colour
 * so users can spot the state at a glance from across a parking lot.
 * The icon doesn't change (📶 either way); the textual suffix and
 * accent fill carry the state.
 */
#tiles-auto-btn.on {
  background: rgba(76, 201, 240, 0.25);
  color: var(--accent);
}

#dnc-banner {
  position: absolute; left: 12px; right: 12px; top: 12px;
  z-index: 2500;
  animation: dnc-pulse 1.0s ease-in-out infinite alternate;
}
/* Soft variant: DNC nearby but the publisher is walking past or
 * through, not approaching the door. No animation, calmer amber
 * palette, no audio/vibrate (gated in maybeFireDncAlert). The
 * publisher still sees the warning, they just don't get the loud
 * alarm reserved for door-approach.
 */
#dnc-banner.soft { animation: none; }
#dnc-banner.soft .dnc-banner-inner {
  background: #5a4214; color: #f8d699;
  border: 1px solid #f0ad4e;
}
#dnc-banner.soft strong { color: #fce0a8; }
#dnc-banner.soft button {
  background: #f0ad4e; color: #3a2a08;
}
#dnc-banner .dnc-banner-inner {
  display: flex; align-items: center; gap: 10px;
  background: #d9534f; color: #fff;
  padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(217, 83, 79, 0.6);
  border: 2px solid #fff;
}
#dnc-banner strong { font-size: calc(15px * var(--app-font-scale, 1)); letter-spacing: 0.5px; }
#dnc-banner span { flex: 1; font-size: calc(13px * var(--app-font-scale, 1)); }
#dnc-banner button {
  background: #fff; color: #d9534f; border: 0;
  padding: 6px 12px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
@keyframes dnc-pulse {
  from { box-shadow: 0 6px 24px rgba(217, 83, 79, 0.45); }
  to   { box-shadow: 0 8px 32px rgba(217, 83, 79, 0.95); }
}

/* Experimental feature badge. Used inline next to UI surfaces that
 * are gated behind an Experimental:true descriptor (see
 * PROPOSAL_GEOFENCE_FIRST_VISITS.md, Session C). The badge tells the
 * publisher "this behavior is non-default; the recorded outcome is
 * still whatever you tap, never what GPS guessed." Tone matches the
 * admin-UI badge in static/admin.html — same warning-yellow tokens,
 * same uppercase letterforms, so the two surfaces feel like one
 * system. The dnc-banner override switches the badge to a contrast
 * pair that reads against the red banner background. */
.experimental-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--yellow);
  color: #2a2103;
  border: 1px solid var(--yellow);
  vertical-align: middle;
  cursor: help;
  flex-shrink: 0;
}
/* Override the generic "#dnc-banner span { flex: 1 }" rule above —
 * the badge is a fixed-width chip, only the body span should stretch
 * to push the dismiss button to the right edge. */
#dnc-banner .experimental-badge {
  flex: 0 0 auto;
  background: #fff; color: #d9534f; border-color: #fff;
}
#dnc-banner.soft .experimental-badge {
  flex: 0 0 auto;
  background: #fce0a8; color: #5a4214; border-color: #f0ad4e;
}

/* --- Assignment / lease state pill ---------------------------------- */
/*
 * The state pill is the authoritative on-screen indicator of the
 * publisher's current activity-lease state. Color-coded so the
 * publisher sees the band (active / warning / expired) at a glance.
 */
.state-pill { font-weight: 600; }
.pill.state-none    { background: #2a3a52; color: #aab4c5; }
.pill.state-pending { background: rgba(76, 201, 240, 0.20); color: #b8e9fa; }
.pill.state-active  { background: rgba(92, 184, 92, 0.30);  color: #b3e3b3; }
.pill.state-warning {
  background: rgba(240, 173, 78, 0.30); color: #f8d699;
  animation: state-pulse 1.5s ease-in-out infinite alternate;
}
.pill.state-expired   { background: rgba(217, 83, 79, 0.30); color: #f1bcbb; }
.pill.state-ended     { background: #2a3a52; color: #aab4c5; }
.pill.state-cancelled { background: #2a3a52; color: #aab4c5; text-decoration: line-through; }

/* F2e: field-status chip. Distinct color per state so a publisher
   can tell at-a-glance whether they're at the meeting (yellow), on
   their way (cyan-pulsing), or actively working (green). Idle is
   the catch-all and is hidden by default — see field-status-idle's
   display:none rule below. */
.field-status { font-weight: 600; }
.pill.field-status-in_meeting   {
  background: rgba(248, 214, 153, 0.28); color: #f8d699;
}
.pill.field-status-in_transit   {
  background: rgba(76, 201, 240, 0.22); color: #b8e9fa;
  animation: state-pulse 2.4s ease-in-out infinite alternate;
}
.pill.field-status-in_territory {
  background: rgba(92, 184, 92, 0.30); color: #b3e3b3;
}
.pill.field-status-idle { display: none; }
@keyframes state-pulse {
  from { background: rgba(240, 173, 78, 0.18); }
  to   { background: rgba(240, 173, 78, 0.42); }
}

#reviews-btn { background: rgba(240, 173, 78, 0.22); color: #f8d699; font-weight: 600; }
#reviews-btn:hover { background: rgba(240, 173, 78, 0.36); }

#drive-badge {
  background: rgba(125, 136, 147, 0.30); color: #d3dae3;
  font-weight: 600; letter-spacing: 0.04em;
}

/* --- Sidepanel "My assignments" section ----------------------------- */
/* The list itself reuses the drawer-section frame and sits
 * directly under the .drawer-section-head. Capped height so a
 * long assignment list doesn't push the offline-maps / alerts /
 * account sections off-screen — the section becomes a mini scroll
 * area, same pattern as the territories list above it. */
.muted { color: var(--muted); }

/* --- Sidepanel "Find address" section ------------------------------ */
/* Powers the drawer's #address-section (the loaded-territory-scoped
 * address finder, distinct from the global #address-search-panel
 * dialog). Address list rows mirror #territory-list's spacing so the
 * panel feels consistent. Unit pill goes on the left like the tnum
 * chip; building/floor metadata is right-aligned and dimmed. */
#address-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 220px; overflow-y: auto;
}
#address-list li {
  padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer; display: flex; gap: 8px; align-items: baseline;
  font-size: calc(13px * var(--app-font-scale, 1));
}
#address-list li:hover { background: #1a3866; }
#address-list li .unit-chip {
  min-width: 56px; font-family: monospace; color: var(--accent);
  font-size: calc(12px * var(--app-font-scale, 1));
}
#address-list li .addr-line { flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#address-list li .addr-meta { color: var(--muted); font-size: calc(11px * var(--app-font-scale, 1)); }
/* Building rows are the empty-filter view of the address finder —
 * one per building in the current territory. Tinted accent so they
 * read as "tap to fit" affordances distinct from unit rows. */
#address-list li.building-row {
  background: rgba(76, 201, 240, 0.06);
  cursor: pointer;
}
#address-list li.building-row:hover { background: rgba(76, 201, 240, 0.18); }
#address-list li.building-row .bldg-chip {
  min-width: 56px; font-family: monospace; color: var(--accent);
  font-weight: 700; font-size: calc(12px * var(--app-font-scale, 1));
}
#address-list li.address-hint {
  padding: 10px 12px; color: var(--muted); font-size: calc(12px * var(--app-font-scale, 1));
  cursor: default;
}
#address-list li.address-hint:hover { background: transparent; }
.address-overflow { padding: 6px 12px; font-size: calc(11px * var(--app-font-scale, 1)); }
.building-jump {
  display: block; margin: 0 12px 6px;
  padding: 6px 10px; border-radius: 6px;
  background: rgba(76, 201, 240, 0.15); color: var(--accent);
  border: 1px solid rgba(76, 201, 240, 0.35);
  font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 600; cursor: pointer; text-align: left;
}
.building-jump:hover { background: rgba(76, 201, 240, 0.28); }

#assignment-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 28vh; overflow-y: auto;
}
#assignment-list li {
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.04);
  display: flex; flex-direction: column; gap: 4px; cursor: pointer;
}
#assignment-list li:hover { background: #1a3866; }
#assignment-list li.active { background: #214178; }
#assignment-list .row1 { display: flex; gap: 8px; align-items: baseline; }
#assignment-list .tnum { font-family: monospace; color: var(--accent); }
#assignment-list .countdown { margin-left: auto; font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted); }

/* --- WARNING banner ------------------------------------------------- */
#lease-banner {
  position: absolute; left: 12px; right: 12px; top: 12px;
  z-index: 2400;
}
#lease-banner .lease-banner-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--yellow); color: #2a2103;
  padding: 10px 14px; border-radius: 10px;
  box-shadow: 0 6px 24px rgba(240, 173, 78, 0.55);
  border: 2px solid #fff;
  font-weight: 600;
}
#lease-banner strong { font-size: calc(14px * var(--app-font-scale, 1)); }
#lease-banner span   { flex: 1; font-size: calc(13px * var(--app-font-scale, 1)); font-weight: 500; }
#lease-banner button { background: #2a2103; color: var(--yellow); border: 0; }
#lease-banner button:hover { background: #3d3104; }

/* --- EXPIRED block-screen overlay ----------------------------------- */
/*
 * Per spec: when the lease lands on EXPIRED, ALL access is revoked
 * (GPS visit creation, parcel tracking, map access, new sessions).
 * The overlay sits above #map at z-index 3000 and fully covers the
 * map, leaving only the "Sync now" affordance and a non-destructive
 * dismiss (closes the modal but keeps the underlying lockout enforced
 * via separate body-level CSS — see body.lease-locked below).
 */
#lease-expired-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.78);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 3000;
}
#lease-expired-overlay .dialog {
  background: var(--bg-pane); padding: 22px; border-radius: 12px;
  width: 100%; max-width: 380px; box-shadow: var(--shadow);
  border-top: 4px solid var(--red);
}
#lease-expired-overlay h3 { margin: 0 0 10px; color: var(--red); }
#lease-expired-overlay p  { margin: 0 0 10px; font-size: calc(14px * var(--app-font-scale, 1)); }
#lease-expired-overlay .row { display: flex; gap: 8px; margin-top: 12px; }
#lease-expired-overlay button {
  flex: 1; padding: 10px; border-radius: 8px; border: 0;
  font-size: calc(14px * var(--app-font-scale, 1)); cursor: pointer; font-weight: 600;
}
#lease-expired-overlay button.primary { background: var(--accent); color: #02233a; }
#lease-expired-overlay button.ghost { background: #1e3a5f; color: var(--muted); font-weight: 400; }

/*
 * body.lease-locked is set by app.js whenever the projected state is
 * EXPIRED / ENDED / CANCELLED. It hard-disables the session toggle and
 * dims the map so the publisher sees the lockout even after dismissing
 * the modal. Pointer events on the map remain enabled (so they can
 * still pan / read prior visits) but session controls are dead.
 */
body.lease-locked #map { filter: grayscale(0.7) brightness(0.6); }
body.lease-locked #session-bar button.primary {
  background: #4a2828 !important; color: #f1bcbb !important;
  cursor: not-allowed;
}
body.lease-locked #session-bar button.primary:disabled { opacity: 0.7; }

/* --- Review queue modal --------------------------------------------- */
#review-modal {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 2200;
}
#review-modal .dialog {
  background: var(--bg-pane); padding: 16px; border-radius: 12px;
  width: 100%; max-width: 420px; max-height: 80vh; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow);
}
#review-modal .dialog.wide { max-width: 480px; }
#review-modal .dialog-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px;
}
#review-modal h3 { margin: 0; font-size: calc(16px * var(--app-font-scale, 1)); }
#review-modal #review-empty { margin: 16px 4px; font-size: calc(13px * var(--app-font-scale, 1)); }
#review-modal ul {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1;
}
#review-modal li {
  padding: 10px 4px; border-top: 1px solid rgba(255,255,255,0.06);
  display: flex; flex-direction: column; gap: 6px;
}
#review-modal .review-meta { font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted); }
#review-modal .review-actions { display: flex; gap: 6px; }
#review-modal .review-actions button {
  flex: 1; padding: 7px; border-radius: 6px; border: 0;
  font-size: calc(12px * var(--app-font-scale, 1)); cursor: pointer; font-weight: 600;
}
#review-modal button.contacted     { background: var(--green);  color: #fff; }
#review-modal button.not_contacted { background: var(--yellow); color: #2a2103; }
#review-modal button.unknown       { background: #1e3a5f;       color: var(--muted); font-weight: 400; }

/* --- Map controls (follow-self + find-publisher) -------------------- */
/* Stack on the right side of the map, just below the Leaflet zoom
 * control. Pure CSS positioning so we can stay out of Leaflet's
 * control mechanism (the picker bottom sheet needs its own z-index
 * stacking anyway). */
#map-controls {
  position: absolute; top: 92px; right: 12px;
  display: flex; flex-direction: column; gap: 6px;
  z-index: 1040;
}
#map-controls button {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(11, 37, 64, 0.92); border: 1px solid #1e3a5f;
  color: var(--fg); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
#map-controls button:hover { background: #1a3866; }
body[data-gathering] #gathering-place-btn:not([hidden]) {
  background: rgba(109, 40, 217, 0.92);
  border-color: #a78bfa;
  color: #f5f3ff;
}
body[data-gathering] #gathering-place-btn:not([hidden]):hover {
  background: rgba(124, 58, 237, 0.98);
}
#map-controls button.on {
  background: var(--accent); color: #02233a; border-color: var(--accent);
}
/* Follow-self cycle. Three classes set by paintFollowSelfButton:
   .mode-off (passive), .mode-follow (camera-locks-on-fix),
   .mode-heading (locks AND shows heading arrow). The two locked
   modes keep the existing accent fill from .on; .mode-heading
   gets a small upward chevron in the corner so it's visually
   distinct from .mode-follow at a glance. */
#map-controls button.mode-heading {
  background: var(--green); color: #02233a; border-color: var(--green);
}
#map-controls button.mode-heading::after {
  content: "↑"; position: absolute; top: 2px; right: 5px;
  font-size: calc(11px * var(--app-font-scale, 1)); font-weight: 700;
}
#map-controls button { position: relative; }
#map-controls svg {
  width: 20px; height: 20px;
  fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}

/* While a Leaflet popup is open, dim and disable the floating map
 * tools so they stop covering popup content on narrow phones. The
 * popup itself can fill nearly the entire viewport width (its body
 * is up to 280px plus Leaflet chrome), and on screens around or
 * below 540px both the top-left zoom (+/-) cluster and the
 * top-right map-controls / address-search-panel were sitting on top
 * of the popup, hiding part of the information. We toggle
 * body.popup-open from popupopen/popupclose handlers in initMap()
 * so the hide is purely visual + non-interactive (pointer-events:
 * none) and snaps back the instant the popup closes. We fade with
 * opacity rather than display:none so Leaflet's control DOM keeps
 * its layout slot (avoids reflow churn) and so an accidental tap
 * during the transition can't hit a half-hidden button. */
body.popup-open #map-controls,
body.popup-open .leaflet-control-zoom,
body.popup-open #address-search-panel[hidden] {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease-out;
}
/* Keep an explicitly open address-search panel usable (✕ dismiss)
   even if a map popup is still open underneath. */
body.popup-open #address-search-panel:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  z-index: 1200;
}
#map-controls,
.leaflet-control-zoom,
#address-search-panel {
  transition: opacity 160ms ease-in;
}

/* Heading-up arrow overlay drawn by paintHeadingMarker. Wraps the
   user dot when FollowSelf is in HEADING mode and the platform
   reports a heading angle. transform: rotate(...) is set inline. */
.heading-arrow-icon { background: transparent; border: 0; }
.heading-arrow {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  transform-origin: 50% 50%;
  transition: transform 250ms ease-out;
  pointer-events: none;
}
.heading-arrow svg {
  width: 28px; height: 28px;
  fill: var(--accent);
  stroke: #02233a; stroke-width: 1.5; stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

/* --- Walking pin (other publishers on the map) --------------------- */
/* Leaflet stamps inline `transform: translate3d(...)` on the marker
 * wrapper to position it. CSS transition picks that up and gives the
 * pin a visible "walking" interpolation between successive
 * heartbeats. 800ms matches roughly half the throttle and keeps the
 * motion legible without lagging the live position. */
.leaflet-marker-icon.walking-pin {
  transition: transform 800ms ease-in-out;
  background: transparent; border: 0;
  pointer-events: auto;
}
.walking-pin-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--green);
  background: rgba(11, 37, 64, 0.85);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}
.walking-pin-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: #1e3a5f; color: var(--fg);
  font-size: calc(11px * var(--app-font-scale, 1)); font-weight: 700; letter-spacing: 0.04em;
}
.walking-pin-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.walking-pin-initials {
  display: inline-flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
}
.walking-pin-tag {
  position: absolute; top: 38px; left: 50%; transform: translateX(-50%);
  background: rgba(11, 37, 64, 0.92); color: var(--fg);
  font-size: calc(10px * var(--app-font-scale, 1)); padding: 1px 6px; border-radius: 8px;
  white-space: nowrap; max-width: 120px; overflow: hidden;
  text-overflow: ellipsis;
}
/* Status ring color encodes the walking-pin status. Defaults to
 * green (walking); at_door is yellow (publisher is engaged at a
 * door); idle is gray (no recent fix); offline shouldn't render
 * because the Drop is emitted, but we cover it for safety. */
.walking-pin-walking  .walking-pin-ring { border-color: var(--green); }
.walking-pin-at_door  .walking-pin-ring { border-color: var(--yellow); }
.walking-pin-idle     .walking-pin-ring { border-color: var(--gray); }
.walking-pin-available .walking-pin-ring { border-color: var(--accent); }

/* Motion-class overlays: layered on top of status so the ring color
 * still answers "what are they doing in the workflow?" while the
 * animation answers "is the device actually moving?". Stationary
 * pins are visibly still; walking variants bounce in cadence with
 * the publisher's actual step rate; running pulses with a faster,
 * tighter ring. respect prefers-reduced-motion. */
@keyframes walking-pin-footfall {
  0%, 100% { transform: translateY(0);    }
  50%      { transform: translateY(-2px); }
}
@keyframes walking-pin-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0);  }
}
.walking-pin-motion-stationary    .walking-pin-ring {
  animation: none;
  filter: saturate(0.7);
}
.walking-pin-motion-walking_slow   .walking-pin-ring {
  animation: walking-pin-footfall 1100ms ease-in-out infinite;
}
.walking-pin-motion-walking_normal .walking-pin-ring {
  animation: walking-pin-footfall 750ms ease-in-out infinite;
}
.walking-pin-motion-running        .walking-pin-ring {
  animation:
    walking-pin-footfall 480ms ease-in-out infinite,
    walking-pin-pulse    480ms ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .walking-pin-motion-walking_slow   .walking-pin-ring,
  .walking-pin-motion-walking_normal .walking-pin-ring,
  .walking-pin-motion-running        .walking-pin-ring {
    animation: none;
  }
}

/* --- Slice B: "presenting at door" badge -------------------------- */
/* The "show" badge appears on the publisher's pin whenever their
 * Slice B AND-gate is active (held_reading + stationary + slow +
 * in-visit, sustained for >= PRESENTING_SUSTAIN_MS client-side).
 * The element is always rendered in the HTML but hidden by default;
 * the .walking-pin-presenting modifier on the wrapper reveals it.
 * Solid amber to read at a glance against both light and dark map
 * tiles; the gentle pulse echoes the at_door pin's color cue
 * without competing with the motion-class animations on the ring. */
.walking-pin-badge {
  position: absolute;
  top: -6px; right: -8px;
  padding: 1px 6px;
  font-size: calc(9px * var(--app-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #2b1f00;
  background: #ffb302;
  border: 1.5px solid #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  display: none;             /* hidden until walking-pin-presenting opts it in */
  pointer-events: none;
}
.walking-pin-presenting .walking-pin-badge {
  display: inline-block;
  animation: walking-pin-badge-pulse 1500ms ease-in-out infinite;
}
.walking-pin-presenting .walking-pin-ring {
  /* A double-ring "presenting" cue that complements the
   * status-color border without overriding it; survives the
   * motion-class filter:saturate dim that "stationary" applies. */
  box-shadow: 0 0 0 2px #ffb302, 0 0 0 4px rgba(255, 179, 2, 0.35);
  filter: saturate(1);       /* override the stationary dim */
}
@keyframes walking-pin-badge-pulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
  50%      { transform: scale(1.08); box-shadow: 0 2px 6px rgba(255,179,2,0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .walking-pin-presenting .walking-pin-badge { animation: none; }
}

/* --- Find-publisher picker bottom sheet ---------------------------- */
#publisher-picker {
  position: absolute; left: 12px; right: 12px;
  bottom: calc(var(--session-bar-height, 44px) + env(safe-area-inset-bottom, 0px) + 10px);
  max-height: 50vh; overflow: hidden;
  background: var(--bg-pane); border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  z-index: 1060;
}
.publisher-picker-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid #1e3a5f;
}
#publisher-picker-close {
  background: transparent; border: 0; color: var(--fg);
  font-size: calc(16px * var(--app-font-scale, 1)); cursor: pointer;
}
#publisher-picker ul {
  list-style: none; margin: 0; padding: 0; overflow-y: auto;
}
.publisher-picker-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-top: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
}
.publisher-picker-row:first-child { border-top: 0; }
.publisher-picker-row:hover { background: #1a3866; }
.publisher-picker-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: #1e3a5f; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 700;
}
.publisher-picker-avatar img {
  width: 100%; height: 100%; object-fit: cover;
}
.publisher-picker-initials { color: var(--muted); }
.publisher-picker-meta {
  display: flex; flex-direction: column; min-width: 0; flex: 1;
}
.publisher-picker-meta strong {
  font-size: calc(14px * var(--app-font-scale, 1)); color: var(--fg);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.publisher-picker-meta span { font-size: calc(11px * var(--app-font-scale, 1)); }
.publisher-picker-age { font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted); margin-left: auto; }
.publisher-picker-empty {
  padding: 14px; text-align: center; color: var(--muted); font-size: calc(13px * var(--app-font-scale, 1));
}
.publisher-picker-row.status-at_door .publisher-picker-avatar {
  box-shadow: 0 0 0 2px var(--yellow);
}
.publisher-picker-row.status-walking .publisher-picker-avatar {
  box-shadow: 0 0 0 2px var(--green);
}
.publisher-picker-row.status-idle .publisher-picker-avatar {
  box-shadow: 0 0 0 2px var(--gray);
}

/* ----------------------------------------------------------------
   Phase G: geolocation capability banner + Fix-it modal.

   The banner is a full-width strip the page chooses to anchor right
   after the topbar (or right after <body> on /manage, which has no
   topbar of its own). Color tone is driven by the data-tone attr
   set by geo-ui.js so the JS only renders text — no class-juggling.
   ---------------------------------------------------------------- */
.geo-banner {
  position: sticky;
  top: 0;
  z-index: 1200;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  font-size: calc(13px * var(--app-font-scale, 1)); line-height: 1.3;
  border-bottom: 1px solid rgba(0,0,0,0.2);
  background: rgba(240, 173, 78, 0.18);
  color: #f6dca0;
}
.geo-banner[data-tone="red"]    { background: rgba(217, 83, 79, 0.22);  color: #f5c6c4; }
.geo-banner[data-tone="yellow"] { background: rgba(240, 173, 78, 0.20); color: #f6dca0; }
.geo-banner[data-tone="gray"]   { background: rgba(125, 136, 147, 0.20); color: #cfd6df; }
.geo-banner-headline { font-weight: 600; white-space: nowrap; }
.geo-banner-detail   { flex: 1; min-width: 0; color: inherit; opacity: 0.92;
                       overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geo-banner-fix {
  background: var(--accent); color: #02233a; font-weight: 600; border: 0;
  padding: 4px 12px; border-radius: 99px; cursor: pointer; font-family: inherit;
  font-size: calc(12px * var(--app-font-scale, 1));
}
.geo-banner-fix:hover { background: #6fd6f5; }
.geo-banner-dismiss {
  background: transparent; border: 0; color: inherit; opacity: 0.7;
  font-size: calc(16px * var(--app-font-scale, 1)); padding: 0 4px; cursor: pointer; line-height: 1;
}
.geo-banner-dismiss:hover { opacity: 1; }

/* On narrow viewports collapse the detail line to keep the banner
   single-row. Headline + Fix-it button are the must-haves. */
@media (max-width: 540px) {
  .geo-banner-detail { display: none; }
}

/* v89 meeting clock — primary display is #ministry-status in topbar */
.meeting-clock-banner { display: none !important; }
.attendance-clock-hint {
  font-size: calc(11px * var(--app-font-scale, 1));
  padding: 0 12px 8px; line-height: 1.35;
}

/* Duration picker sheet (declare meeting / take lead) */
.duration-picker-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 12000;
}
.duration-picker-sheet {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(420px, 100vw); background: #0f2744; color: var(--fg);
  border-radius: 14px 14px 0 0; padding: 16px; z-index: 12001;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.35);
}
.duration-picker-title { font-weight: 700; font-size: calc(15px * var(--app-font-scale, 1)); }
.duration-picker-sub { color: var(--muted); font-size: calc(12px * var(--app-font-scale, 1)); margin: 4px 0 12px; }
.duration-picker-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.duration-picker-opt, .duration-picker-custom, .duration-picker-cancel {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #1e3a5f;
  background: #132f52; color: var(--fg); font-weight: 600; cursor: pointer;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.duration-picker-opt:hover, .duration-picker-custom:hover { background: #1a3d66; }
.duration-picker-custom { width: 100%; margin-bottom: 8px; }
.duration-picker-cancel { width: 100%; background: transparent; color: var(--muted); }

/* ----------------------------------------------------------------
   Geo modal. Uses the native <dialog>; we only style its inner card
   plus the ::backdrop. Falls back to a plain attribute-driven layout
   on browsers that don't support showModal(), since geo-ui.js
   degrades to setAttribute("open").
   ---------------------------------------------------------------- */
.geo-modal {
  border: 0; padding: 0; background: transparent; color: inherit;
  max-width: 92vw; width: 460px;
}
.geo-modal::backdrop { background: rgba(0, 0, 0, 0.55); }
.geo-modal[open] {
  animation: geo-modal-pop 140ms ease-out;
}
@keyframes geo-modal-pop {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.geo-modal-card {
  background: var(--bg-pane);
  color: var(--fg);
  border: 1px solid #1e3a5f;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px 16px 16px;
}
.geo-modal-head {
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid #1e3a5f; padding-bottom: 8px; margin-bottom: 10px;
}
.geo-modal-head h2 { margin: 0; font-size: calc(16px * var(--app-font-scale, 1)); flex: 1; }
.geo-modal-close {
  background: transparent; border: 0; color: var(--muted);
  font-size: calc(16px * var(--app-font-scale, 1)); cursor: pointer; padding: 4px 8px;
}
.geo-modal-close:hover { color: var(--fg); }
.geo-status { display: grid; gap: 4px; margin-bottom: 12px; }
.geo-status-row {
  display: grid; grid-template-columns: 90px auto 1fr;
  gap: 8px; align-items: center; font-size: calc(13px * var(--app-font-scale, 1));
}
.geo-status-label { color: var(--muted); }
.geo-status-value { color: var(--fg); }
.geo-status-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  background: var(--gray);
}
.geo-tone-green  { background: var(--green); }
.geo-tone-yellow { background: var(--yellow); }
.geo-tone-red    { background: var(--red); }
.geo-tone-gray   { background: var(--gray); }
.geo-instructions {
  background: #0a1d33; border: 1px solid #1e3a5f; border-radius: 8px;
  padding: 10px 12px 10px 28px; margin-bottom: 12px; font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1.45;
}
.geo-steps { margin: 0; padding: 0 0 0 4px; }
.geo-steps li { margin: 4px 0; color: var(--fg); }
.geo-steps li strong { color: var(--accent); }
.geo-steps li em { color: var(--yellow); font-style: normal; font-weight: 600; }
.geo-modal-foot { display: flex; gap: 8px; justify-content: flex-end; }
.geo-modal-foot button {
  background: #1e3a5f; color: var(--fg); border: 0;
  padding: 6px 14px; border-radius: 6px; cursor: pointer; font-family: inherit;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.geo-modal-foot button:hover { background: #2a4a73; }
.geo-modal-test { font-weight: 600; }
.geo-modal-ok   { background: var(--accent) !important; color: #02233a !important; font-weight: 600; }
.geo-modal-ok:hover { background: #6fd6f5 !important; }

/* G6 admin geo-override chip — appears inline in /manage publisher
   rows next to the state pill. Two visual states keyed off the
   `.active` class: neutral (off) and accent green (on, with the
   minutes left in the label). */
.geo-override-chip {
  background: transparent; border: 1px dashed #1e3a5f; color: var(--muted);
  padding: 2px 8px; border-radius: 99px; font-size: calc(11px * var(--app-font-scale, 1)); cursor: pointer;
  font-family: inherit; line-height: 1.4;
}
.geo-override-chip:hover { color: var(--fg); border-color: var(--accent); }
.geo-override-chip.active {
  background: var(--green); color: #02233a; border: 1px solid var(--green);
  font-weight: 600;
}
.geo-override-chip.active:hover { background: #4ec07c; }

/* iOS Add-to-Home-Screen hint. Bottom-anchored fixed strip so it
   doesn't compete with the (top-anchored) geo banner. ios-install.js
   shows it once on iOS Safari tabs that aren't already standalone;
   user dismissal is persisted via localStorage. Subtle accent
   border + gentle blue background to read as "info, not alarm". */
.ios-install-banner {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  z-index: 1300;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(11, 37, 64, 0.95);
  border: 1px solid var(--accent);
  color: var(--fg); font-size: calc(13px * var(--app-font-scale, 1)); line-height: 1.35;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
}
.ios-install-icon { font-size: calc(20px * var(--app-font-scale, 1)); line-height: 1; }
.ios-install-text { flex: 1; min-width: 0; }
.ios-install-text strong { color: var(--accent); }
.ios-share-glyph {
  display: inline-block; padding: 0 2px; color: var(--accent);
  font-weight: 700;
}
.ios-install-dismiss {
  background: transparent; border: 0; color: var(--muted);
  font-size: calc(16px * var(--app-font-scale, 1)); padding: 4px 8px; cursor: pointer; line-height: 1;
}
.ios-install-dismiss:hover { color: var(--fg); }

/* G-Device platform glyph rendered inline next to the cap-dot in
   /manage rows. Pure-emoji content; the .device-glyph wrapper is
   only there to give it a stable hover target and a consistent
   line-height with the surrounding flex row. cursor:help cues that
   the tooltip is the value (full capability rundown). */
.device-glyph {
  display: inline-block; line-height: 1; font-size: calc(14px * var(--app-font-scale, 1));
  cursor: help; user-select: none;
  /* Light desaturation so the emoji doesn't out-shout the cap dot;
     hover restores full color. */
  filter: saturate(0.7);
}
.device-glyph:hover { filter: saturate(1); }

/* Capability dot used inline in /manage publisher rows (G5). Same
   tone palette as the modal status dots so the visual language is
   consistent. */
.cap-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--gray); flex: none;
}
.cap-dot[data-cap="precise"]   { background: var(--green); }
.cap-dot[data-cap="imprecise"] { background: var(--yellow); }
.cap-dot[data-cap="coarse"]    { background: var(--red); }
.cap-dot[data-cap="denied"]    { background: var(--red); box-shadow: 0 0 0 2px rgba(217,83,79,0.3); }
.cap-dot[data-cap="unknown"]   { background: var(--gray); }


/* --- In-app updater (Capacitor APK only) ----------------------------- */
/*
 * The banner sits below #topbar and above the map. It's intentionally
 * less aggressive than #lease-banner / #dnc-banner -- "an update is
 * available" is informational, not urgent, and a publisher in the
 * middle of a session shouldn't have it hijack visual attention.
 *
 * Z-index 2400 puts it above the map / map-controls / sidepanel
 * (all 1000-1500) but below the lease-warning banner (2400) and the
 * EXPIRED overlay (3000). Functionally the banner and lease-banner
 * never coexist (the lease-banner appears in WARNING; the EXPIRED
 * overlay covers everything in EXPIRED) so the equal z-index is
 * fine.
 *
 * #tfp-update-modal is the must-update full-screen path, used when
 * the running APK is below min_supported_version_code. It mirrors
 * #lease-expired-overlay structurally so users in the field see a
 * familiar layout.
 */
#tfp-update-banner {
  position: absolute; left: 12px; right: 12px; top: 12px;
  z-index: 2400;
}
#tfp-update-banner .tfp-update-banner-inner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-pane); color: var(--fg);
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--accent);
  box-shadow: 0 6px 24px rgba(76, 201, 240, 0.25);
  font-weight: 500;
}
#tfp-update-banner .tfp-update-banner-title {
  font-size: calc(14px * var(--app-font-scale, 1)); color: var(--accent); letter-spacing: 0.3px;
}
#tfp-update-banner .tfp-update-banner-meta {
  font-size: calc(13px * var(--app-font-scale, 1)); color: var(--fg);
}
#tfp-update-banner .tfp-update-banner-notes {
  flex-basis: 100%; font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted);
  margin: 0; padding-left: 0;
}
#tfp-update-banner .tfp-update-banner-cta {
  margin-left: auto;
  text-decoration: none;
}
#tfp-update-banner .tfp-update-banner-dismiss {
  background: transparent; color: var(--muted); border: 0;
  font-size: calc(16px * var(--app-font-scale, 1)); cursor: pointer; padding: 4px 8px;
}
#tfp-update-banner .tfp-update-banner-dismiss:hover { color: var(--fg); }

#tfp-update-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  z-index: 3100;
}
#tfp-update-modal .tfp-update-modal-inner {
  background: var(--bg-pane); padding: 22px; border-radius: 12px;
  width: 100%; max-width: 420px; box-shadow: var(--shadow);
  border-top: 4px solid var(--accent);
}
#tfp-update-modal h3 { margin: 0 0 10px; color: var(--accent); }
#tfp-update-modal p { margin: 0 0 10px; font-size: calc(14px * var(--app-font-scale, 1)); }
#tfp-update-modal .tfp-update-modal-meta { font-weight: 600; }
#tfp-update-modal .tfp-update-modal-notes { font-size: calc(13px * var(--app-font-scale, 1)); color: var(--muted); white-space: pre-line; }
#tfp-update-modal .row { display: flex; gap: 8px; margin-top: 12px; }
#tfp-update-modal .tfp-update-modal-cta {
  flex: 1; padding: 12px; border-radius: 8px; border: 0;
  font-size: calc(14px * var(--app-font-scale, 1)); font-weight: 600; text-align: center;
  background: var(--accent); color: #02233a; text-decoration: none;
}

/* ===========================================================
   Web shell updater (#tfp-web-update-banner / #tfp-web-update-modal).

   Coexists with the Capacitor APK updater above. Distinguished by
   an AMBER accent (the APK updater uses the app's cyan --accent)
   so a publisher seeing two simultaneous banners can immediately
   tell which is which: amber = "reload your browser", cyan = "go
   install the new APK". Driven by static/web-updater.js.
   =========================================================== */

#tfp-web-update-banner {
  position: absolute; left: 12px; right: 12px;
  /* Sit below the APK banner if both are present (APK banner is at
   * top: 12px). Slightly bigger gap on phones via clamp so the two
   * never visually overlap on a narrow viewport. */
  top: clamp(58px, 12vh, 84px);
  z-index: 2401;
}
#tfp-web-update-banner .tfp-web-update-banner-inner {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--bg-pane); color: var(--fg);
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid #f59e0b;       /* amber-500 */
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.25);
  font-weight: 500;
}
#tfp-web-update-banner .tfp-web-update-banner-icon {
  font-size: calc(18px * var(--app-font-scale, 1)); color: #f59e0b;
  /* Slow spin so the banner reads as "in-flight / refresh me". */
  animation: tfp-web-update-spin 2.2s linear infinite;
}
#tfp-web-update-banner .tfp-web-update-banner-text {
  display: flex; flex-direction: column; gap: 1px; flex: 1;
  min-width: 200px;
}
#tfp-web-update-banner .tfp-web-update-banner-title {
  font-size: calc(14px * var(--app-font-scale, 1)); color: #f59e0b; letter-spacing: 0.3px;
}
#tfp-web-update-banner .tfp-web-update-banner-meta {
  font-size: calc(13px * var(--app-font-scale, 1)); color: var(--fg);
}
#tfp-web-update-banner .tfp-web-update-banner-notes {
  font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted);
}
#tfp-web-update-banner .tfp-web-update-banner-actions {
  display: flex; gap: 6px; margin-left: auto;
}
#tfp-web-update-banner .tfp-web-update-banner-reload {
  background: #f59e0b; color: #1a1102; border: 0;
  font-size: calc(13px * var(--app-font-scale, 1)); font-weight: 700;
  padding: 8px 14px; border-radius: 6px; cursor: pointer;
}
#tfp-web-update-banner .tfp-web-update-banner-reload:hover {
  filter: brightness(1.05);
}
#tfp-web-update-banner .tfp-web-update-banner-later {
  background: transparent; color: var(--muted);
  border: 1px solid rgba(255,255,255,0.15);
  font-size: calc(13px * var(--app-font-scale, 1)); padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
#tfp-web-update-banner .tfp-web-update-banner-later:hover {
  color: var(--fg); border-color: rgba(255,255,255,0.30);
}

@keyframes tfp-web-update-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  #tfp-web-update-banner .tfp-web-update-banner-icon { animation: none; }
}

#tfp-web-update-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.88);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  /* Above the APK modal (z=3100) and above #lease-expired-overlay so
   * a wire-incompatible web client can't be hidden behind anything. */
  z-index: 3200;
}
#tfp-web-update-modal .tfp-web-update-modal-card {
  background: var(--bg-pane); padding: 22px; border-radius: 12px;
  width: 100%; max-width: 440px; box-shadow: var(--shadow);
  border-top: 4px solid #f59e0b;
}
#tfp-web-update-modal h3 {
  margin: 0 0 10px; color: #f59e0b; font-size: calc(18px * var(--app-font-scale, 1));
}
#tfp-web-update-modal p { margin: 0 0 10px; font-size: calc(14px * var(--app-font-scale, 1)); }
#tfp-web-update-modal .tfp-web-update-modal-meta { font-weight: 600; }
#tfp-web-update-modal .muted { color: var(--muted); }
#tfp-web-update-modal .tfp-web-update-modal-notes {
  font-size: calc(13px * var(--app-font-scale, 1)); color: var(--muted); white-space: pre-line;
}
#tfp-web-update-modal .tfp-web-update-modal-actions {
  display: flex; gap: 8px; margin-top: 14px;
}
#tfp-web-update-modal .tfp-web-update-modal-reload {
  flex: 1; padding: 12px; border-radius: 8px; border: 0;
  font-size: calc(14px * var(--app-font-scale, 1)); font-weight: 700; text-align: center;
  background: #f59e0b; color: #1a1102; cursor: pointer;
}
#tfp-web-update-modal .tfp-web-update-modal-reload:hover {
  filter: brightness(1.05);
}


/* ===========================================================
 * Global Leaflet popup sizing (applies to every popup variant:
 * address-dot, parcel, FSL "I'm here", search-result, Where Am
 * I). The popup is the priority — it's the surface the publisher
 * reads to make a decision (declare, mark contacted, navigate,
 * etc.), so the geometry rules in this section are biased toward
 * "always fully readable" over "never covers the anchor dot".
 *
 * Width comes from the popupOpts() helper in app.js (Math.min of
 * 440px and viewport-minus-32px) so popups grow wide on tablets/
 * desktops and shrink to fit phones. autoPanPadding (also set in
 * popupOpts) gives Leaflet permission to pan the dot off-screen
 * if that's what's required to get the popup body fully visible.
 * These CSS rules add three guarantees on top of that:
 *
 *   1. Defense-in-depth viewport clamp. If anything ever opens a
 *      popup without going through popupOpts (third-party plugin,
 *      future code path we forgot to update, etc.), the wrapper
 *      still can't grow past the viewport.
 *   2. Vertical overflow safety. A tall popup (e.g. the address-
 *      dot popup with the declaration form expanded, or a long
 *      Where-Am-I block) used to extend past the bottom of the
 *      map; we cap height to (100vh - chrome) and let the body
 *      scroll instead. The publisher can read the whole popup
 *      without zooming or rotating the device.
 *   3. Tighter chrome on phones. Leaflet's default content margin
 *      is 13/24/13/20px (T/R/B/L) which burns ~44px of horizontal
 *      space on chrome before content even starts. On narrow
 *      screens we trim it so the body has room to breathe.
 *
 * We use !important sparingly: Leaflet writes max-width inline
 * on the wrapper from the JS maxWidth option, and we want our
 * defense-in-depth cap to win when the inline value would
 * overflow the viewport.
 * =========================================================== */
.leaflet-popup .leaflet-popup-content-wrapper {
  max-width: calc(100vw - 16px);
  box-sizing: border-box;
}
.leaflet-popup .leaflet-popup-content {
  /* Cap height to the viewport minus top chrome and the floating
   * session bar so tall popups scroll inside the bubble instead of
   * extending under #session-bar. */
  max-height: calc(100vh - var(--map-bottom-inset, 66px) - 96px);
  overflow-y: auto;
  /* Subtle inertial-scroll on iOS so the inner scroll doesn't
   * feel sticky compared to native overlays. */
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 480px) {
  /* Trim the close-button gutter from 24px to 20px and the left
   * margin from 20px to 12px so the body gets ~12px more usable
   * width. The close button itself stays in the same place — it
   * has its own absolute positioning. */
  .leaflet-popup-content {
    margin: 10px 20px 10px 12px !important;
  }
  /* Slightly smaller close button hit target so it can sit
   * tighter against the corner without colliding with content. */
  .leaflet-popup-close-button {
    padding: 2px 4px !important;
  }
}


/* "Where am I?" popup — opens when the publisher taps their GPS
   dot. Styled to fit the dark UI; matches the parcel-popup palette
   for visual consistency. The default Leaflet popup chrome (white
   bubble) is left alone elsewhere, so we override only when the
   .where-am-i-popup className is applied via bindPopup options. */
.leaflet-popup.where-am-i-popup .leaflet-popup-content-wrapper {
  background: #102e54;
  color: var(--fg);
  border: 1px solid #1e3a5f;
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.leaflet-popup.where-am-i-popup .leaflet-popup-tip {
  background: #102e54;
  border: 1px solid #1e3a5f;
}
.leaflet-popup.where-am-i-popup .leaflet-popup-content {
  margin: 10px 14px;
  font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1.4;
}
.leaflet-popup.where-am-i-popup .leaflet-popup-close-button {
  color: var(--muted);
}
.where-am-i-popup .wai-body { min-width: 0; }
.where-am-i-popup .wai-loading {
  color: var(--muted); font-style: italic; padding: 4px 0;
}
.where-am-i-popup .wai-title {
  font-weight: 600; margin-bottom: 8px;
}
.where-am-i-popup .wai-title strong { color: var(--accent); }
.where-am-i-popup .wai-sub {
  font-size: calc(11px * var(--app-font-scale, 1)); color: var(--muted); font-family: monospace;
}
.where-am-i-popup .wai-row {
  display: flex; gap: 8px; margin: 4px 0;
  font-size: calc(12px * var(--app-font-scale, 1));
}
.where-am-i-popup .wai-label {
  color: var(--muted); flex: 0 0 56px;
}
.where-am-i-popup .wai-value {
  color: var(--fg); font-weight: 500; flex: 1;
  /* Allow long owner/proxy lists to wrap cleanly inside the
     280px-max popup width. */
  overflow-wrap: anywhere;
}
.where-am-i-popup .wai-cta {
  margin-top: 10px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.where-am-i-popup .wai-cta-link {
  display: inline-block; font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 600;
  padding: 6px 10px; border-radius: 6px;
  background: var(--accent); color: #02233a;
  text-decoration: none;
}
.where-am-i-popup .wai-cta-link:hover { filter: brightness(1.05); }

/* ===== Address-dot popup (label + parcel + declare/contact actions) =====
   Rendered by Declarations.popupHTML() in app.js. Same dark-theme
   palette as the WhereAmI popup so the two read as a family.
   width: 100% lets the body grow up to the leaflet wrapper's
   max-width (capped by the global rule above + the maxWidth: 280
   option on bindPopup), so we never leave dead space inside the
   wrapper just because the natural content width was smaller. */
.leaflet-popup .addr-popup { min-width: 0; width: 100%; }
.addr-popup .addr-popup-title {
  font-size: calc(13px * var(--app-font-scale, 1)); font-weight: 600; color: var(--accent);
  line-height: 1.25; margin-bottom: 2px;
  /* Long street names should wrap rather than blow out the popup
     width — overflow-wrap: anywhere is safe because the title is
     wrapped in its own block. */
  overflow-wrap: anywhere;
}
.addr-popup .addr-popup-sub {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #b9c2cf; margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.addr-popup .addr-popup-meta {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #7d8893; margin-bottom: 6px;
}
/* Compress vertical spacing on phone-class viewports so the popup
 * shows more useful content without the user needing to scroll. We
 * keep the breathing room on tablets/desktops where screen real
 * estate isn't the bottleneck. */
@media (max-width: 480px) {
  .addr-popup .addr-popup-title { margin-bottom: 1px; }
  .addr-popup .addr-popup-sub { margin-bottom: 2px; }
  .addr-popup .addr-popup-meta { margin-bottom: 4px; }
  .addr-popup .addr-decl { margin: 6px 0 4px 0; padding: 5px 7px; }
  .addr-popup .addr-decl-actions { margin-top: 4px; }
  .addr-popup .addr-contact-row { margin-top: 4px; gap: 4px; }
  .addr-popup details.addr-declare { margin-top: 6px; padding-top: 4px; }
  .addr-popup .addr-last-contact { margin: 1px 0 4px 0; }
}
.addr-popup .addr-decl {
  margin: 8px 0 6px 0; padding: 6px 8px;
  background: rgba(248, 214, 153, 0.12);
  border-left: 3px solid #f8d699;
  border-radius: 4px;
}
.addr-popup .addr-decl-head {
  font-size: calc(12px * var(--app-font-scale, 1)); color: #f8d699;
}
.addr-popup .addr-decl-head strong { color: #fff5dd; }
.addr-popup .addr-decl-reason {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #d9e1ec;
  font-style: italic; margin-top: 2px;
}
.addr-popup .addr-decl-meta {
  font-size: calc(10px * var(--app-font-scale, 1)); color: #9aa3af; margin-top: 2px;
}
.addr-popup .addr-decl-actions {
  margin-top: 6px;
}
.addr-popup .addr-decl-actions button {
  background: transparent; color: #f8d699;
  border: 1px solid rgba(248,214,153,0.35);
  font-size: calc(11px * var(--app-font-scale, 1)); padding: 3px 8px; border-radius: 4px;
  cursor: pointer;
}
.addr-popup .addr-decl-actions button:hover { background: rgba(248,214,153,0.12); }
.addr-popup .addr-contact-row {
  display: flex; gap: 6px; margin-top: 6px;
}
.addr-popup .addr-contact-row button {
  flex: 1; font-size: calc(11px * var(--app-font-scale, 1)); font-weight: 600;
  padding: 6px 8px; border-radius: 4px; border: 0;
  cursor: pointer;
}
.addr-popup .addr-contact-row button[data-status="contacted"] {
  background: #5cb85c; color: #0f2a0f;
}
.addr-popup .addr-contact-row button[data-status="not_contacted"] {
  background: #f0ad4e; color: #3a2604;
}
.addr-popup .addr-contact-row button[data-status="unknown"] {
  background: #6c757d; color: #f0f3f7;
}
.addr-popup .addr-contact-row button:disabled,
.addr-popup .addr-contact-row button[data-current="true"] {
  opacity: 0.42;
  cursor: default;
  box-shadow: none;
}
.addr-popup .addr-contact-row button:hover { filter: brightness(1.08); }
.addr-popup .addr-contact-row button:disabled:hover,
.addr-popup .addr-contact-row button[data-current="true"]:hover {
  filter: none;
}
/* "Check this territory out…" hint shown in place of the contact
 * row when the caller has no active assignment on the address's
 * territory. Less visually heavy than disabled buttons because
 * the action isn't unavailable forever — it's gated on a state
 * the user can change in two taps. */
.addr-popup .addr-contact-hint {
  margin-top: 8px; padding: 6px 8px;
  font-size: calc(11px * var(--app-font-scale, 1)); color: #b9c2cf;
  background: rgba(255,255,255,0.04);
  border-radius: 4px; text-align: center;
}
/* "Last worked by X · 3d ago" header rendered right under the
 * popup title. Pulls in last_contact data from /api/addresses/
 * {id} so any publisher (not just the current user) is reflected
 * in the popup state. Renders nothing when nobody has worked the
 * address yet. */
.addr-popup .addr-last-contact {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 4px; margin: 2px 0 6px 0;
  font-size: calc(11px * var(--app-font-scale, 1)); color: #d9e1ec;
}
.addr-popup .addr-last-contact-status { color: var(--accent); font-weight: 600; }
.addr-popup .addr-last-contact-sep    { color: #4a5664; }
.addr-popup .addr-last-contact-when   { color: #9aa3af; }
.addr-popup .addr-last-contact-by     { color: #d9e1ec; }
.addr-popup details.addr-declare {
  margin-top: 8px; padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.addr-popup details.addr-declare summary {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #b9c2cf; cursor: pointer; list-style: none;
}
.addr-popup details.addr-declare summary::-webkit-details-marker { display: none; }
.addr-popup details.addr-declare[open] summary { color: var(--accent); }
.addr-popup .addr-declare-form {
  display: flex; flex-direction: column; gap: 3px; margin-top: 6px;
}
.addr-popup .addr-declare-form label {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #d9e1ec; cursor: pointer;
}
.addr-popup .addr-declare-form input[type="text"] {
  font-size: calc(11px * var(--app-font-scale, 1)); padding: 5px 6px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.18); color: #f0f3f8;
  margin-top: 4px;
}
.addr-popup .addr-declare-actions {
  margin-top: 6px;
}
.addr-popup .addr-declare-actions button {
  background: var(--accent); color: #02233a; border: 0;
  font-size: calc(11px * var(--app-font-scale, 1)); font-weight: 600;
  padding: 5px 10px; border-radius: 4px; cursor: pointer;
}
.addr-popup .addr-declare-actions button:hover { filter: brightness(1.05); }

/* Lock-icon overlay marker (the 🔒 / 📖 / 🏠 / 🤝 glyph on top of
   declared address dots). Drawn via L.divIcon by Declarations
   .renderLockLayer(); the .predeclared-lock-marker class is the
   Leaflet wrapper, the inner .predeclared-lock holds the glyph. */
.leaflet-marker-icon.predeclared-lock-marker {
  background: transparent !important;
  border: 0 !important;
}
.predeclared-lock {
  font-size: calc(14px * var(--app-font-scale, 1)); line-height: 1; cursor: pointer;
  text-shadow: 0 0 3px rgba(0,0,0,0.85);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.7));
}
/* publisher_residence variant ("Friend's house" / blue-house badge,
   2026-06-15). Bigger than the standard lock glyph + a saturated
   blue circular background so the marker reads as "this is a known
   home" at any zoom level. Same tap behaviour: click on the badge
   opens the underlying address-dot popup. */
.predeclared-lock.predeclared-lock--house {
  display: inline-flex; align-items: center; justify-content: center;
  /* Dimensions scale with --app-font-scale so the disc tracks the
     glyph font-size at sm/md/lg/xl. The L.divIcon iconSize on the
     JS side is also multiplied by the same factor (scalePx()) so
     the Leaflet wrapper, the inner badge, and the glyph all move
     together — no clipped emoji at xl or floating glyph at sm. */
  width: calc(26px * var(--app-font-scale, 1));
  height: calc(26px * var(--app-font-scale, 1));
  font-size: calc(15px * var(--app-font-scale, 1));
  background: #1e6fd9;
  color: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  text-shadow: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.45);
  filter: none;
}
/* Resident names line inside the address popup (below the Kind
   header, above any reason / declarer meta). 2026-06-15. */
.addr-decl-names {
  margin: 2px 0 4px;
  font-size: calc(13px * var(--app-font-scale, 1));
  color: var(--fg);
  line-height: 1.3;
}
.addr-decl-names strong { color: var(--accent); margin-right: 4px; }
/* Declare-form field grouping + helper text (2026-06-15). The
   form had a single bare <input> with a passive placeholder; the
   names path needs a labelled field + a small helper line so the
   "comma-separated" affordance is discoverable. */
.addr-declare-field {
  display: flex; flex-direction: column; gap: 2px;
  margin: 4px 0;
}
.addr-declare-field-label {
  font-size: calc(12px * var(--app-font-scale, 1));
  color: var(--muted, #8a93a0);
  letter-spacing: 0.2px;
}
.addr-declare-help {
  font-size: calc(11px * var(--app-font-scale, 1));
  color: var(--muted, #8a93a0);
  line-height: 1.3;
  margin: 2px 0 6px;
}

/* ===========================================================
   Field Service Location (FSL) pins.

   FSL pins are visually distinct from address dots: they are
   purple (the JW Library "spiritual" hue), use a chapel/people
   glyph instead of the contact-state palette, and animate.

   Two animation tiers:
     * baseline    — a slow, gentle breathing pulse always on,
                     so a meeting place always stands out from
                     ordinary parcel pins on the map.
     * meeting-now — an intense halo glow + larger scale during
                     a scheduled meeting window (meeting_active_now
                     on the FSL row). Triggers off and on as time
                     crosses the schedule boundary at the next
                     /api/fsls refresh.
   =========================================================== */

/* Leaflet wraps divIcon HTML in a marker container; clear its
   default background/border so the glyph sits cleanly on top. */
.leaflet-marker-icon.fsl-pin-marker {
  background: transparent !important;
  border: 0 !important;
  /* Generous overflow so the meeting-active halo isn't clipped. */
  overflow: visible !important;
}

/* The pin "core" — a purple circular badge with a chapel glyph.
   We use a CSS-shaped circle + an inline SVG via background so
   the icon stays crisp at retina + on Android. */
.fsl-pin {
  position: relative;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--fsl-purple);
  border: 2px solid #ede9fe;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.45),
    0 2px 4px rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  /* Baseline gentle pulse: a very subtle scale + glow that
   * always runs so the pin reads as "alive / special" even
   * outside meeting hours. ~3s period, easy on the eye. */
  animation: fsl-baseline-pulse 3.2s ease-in-out infinite;
  transform-origin: center;
  will-change: transform, box-shadow;
}
.fsl-pin::before {
  /* Chapel / house-of-worship glyph. Kept as a unicode char so
   * we don't ship an extra asset; centered via flexbox above. */
  content: "⛪";
  font-size: calc(16px * var(--app-font-scale, 1)); line-height: 1;
  color: #ffffff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
  filter: drop-shadow(0 0 1px rgba(255,255,255,0.35));
}

/* Halo ring drawn behind the pin core. Hidden by default; the
 * .fsl-pin-active class (set when meeting_active_now is true)
 * promotes it to a strong, pulsing glow so a publisher looking
 * at the map during meeting time can't miss the FSL. */
.fsl-pin::after {
  content: "";
  position: absolute; inset: -8px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(167,139,250,0.55) 0%,
    rgba(167,139,250,0.20) 45%,
    rgba(167,139,250,0.00) 75%);
  opacity: 0;
  transition: opacity 220ms ease-out;
  pointer-events: none;
}

/* Meeting-active treatment: bigger core, brighter ring, and a
 * pronounced two-stage pulse on the halo so the pin visibly
 * "breathes" during the meeting window. */
.fsl-pin.fsl-pin-active {
  background: var(--fsl-purple-glow);
  border-color: #ffffff;
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.5),
    0 0 14px rgba(167,139,250,0.65),
    0 2px 6px rgba(0,0,0,0.6);
  animation: fsl-active-pulse 1.4s ease-in-out infinite;
}
.fsl-pin.fsl-pin-active::after {
  opacity: 1;
  animation: fsl-halo-pulse 1.4s ease-in-out infinite;
}

@keyframes fsl-baseline-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}
@keyframes fsl-active-pulse {
  0%, 100% { transform: scale(1.05); }
  50%      { transform: scale(1.20); }
}
@keyframes fsl-halo-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.92); }
  50%      { opacity: 0.95; transform: scale(1.18); }
}

/* Respect users who've asked the OS to dim motion. We keep the
 * color treatment (still purple, still bigger when active) but
 * drop the animation so nothing flashes/throbs. */
@media (prefers-reduced-motion: reduce) {
  .fsl-pin,
  .fsl-pin.fsl-pin-active,
  .fsl-pin.fsl-pin-active::after {
    animation: none;
  }
  .fsl-pin.fsl-pin-active { transform: scale(1.12); }
}

/* ----- FSL popup ("I'm here" sheet) -----
 * Opened when a publisher taps an FSL pin. The popup is the
 * gate for starting a field-service session FROM a meeting
 * place — it probes Geo and rejects with a toast if the GPS
 * fix puts the user outside the FSL polygon. */
.leaflet-popup.fsl-popup .leaflet-popup-content-wrapper {
  background: linear-gradient(180deg, #2a1a4a 0%, #1a1230 100%);
  color: #f3eaff;
  border: 1px solid rgba(167,139,250,0.45);
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
}
.leaflet-popup.fsl-popup .leaflet-popup-tip {
  background: #1a1230;
  border: 1px solid rgba(167,139,250,0.45);
}
.leaflet-popup.fsl-popup .leaflet-popup-content {
  margin: 10px 12px 12px 12px;
  min-width: 220px;
}
.fsl-popup-body { display: flex; flex-direction: column; gap: 6px; }
.fsl-popup-title {
  font-weight: 700; font-size: calc(13px * var(--app-font-scale, 1));
  color: #ede9fe;
  display: flex; align-items: center; gap: 6px;
}
.fsl-popup-title .fsl-popup-glyph {
  display: inline-block; width: 16px; text-align: center;
}
.fsl-popup-kind {
  font-size: calc(10px * var(--app-font-scale, 1)); text-transform: uppercase; letter-spacing: 0.5px;
  color: #c4b5fd;
}
.fsl-popup-schedule {
  font-size: calc(11px * var(--app-font-scale, 1)); color: #d8d0f0;
  padding: 4px 6px;
  border-radius: 4px;
  background: rgba(167,139,250,0.10);
  border-left: 2px solid rgba(167,139,250,0.45);
}
.fsl-popup-schedule.fsl-popup-now {
  background: rgba(167,139,250,0.22);
  border-left-color: #ffffff;
  color: #ffffff;
  font-weight: 600;
}
.fsl-popup-actions {
  display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap;
}
.fsl-popup-actions .fsl-popup-here {
  flex: 1; min-width: 130px;
  background: var(--fsl-purple-glow);
  color: #1a1230;
  border: 0;
  font-size: calc(12px * var(--app-font-scale, 1)); font-weight: 700;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.fsl-popup-actions .fsl-popup-here:hover { filter: brightness(1.05); }
.fsl-popup-actions .fsl-popup-here:disabled {
  opacity: 0.6; cursor: progress;
}
.fsl-popup-hint {
  font-size: calc(10px * var(--app-font-scale, 1)); color: #b9a8e0; line-height: 1.35;
}

/* The "Meeting place — no door work here" hint shown inside an
 * address-dot popup whose parcel has been turned into an FSL
 * pin. Suppresses the contact/declare UI on those addresses. */
.addr-popup .addr-meeting-place-hint {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: calc(11px * var(--app-font-scale, 1));
  color: #ede9fe;
  background: rgba(109,40,217,0.18);
  border-left: 2px solid var(--fsl-purple);
}
.addr-popup .addr-meeting-place-hint strong {
  color: #ffffff;
}

/* ===========================================================
   Address search panel + empty-state CTA + search-result pin
   (powered by AddressSearch in app.js — the "find an address"
   surface for publishers with no territory).
   =========================================================== */

/* Slide-down panel anchored just below the topbar. Hidden by
   default; shown when find-address-btn (or the empty-state CTA)
   is tapped. Pinned to the right side so it doesn't fight with
   the left-edge drawer; scroll-y on the result list keeps the
   panel compact on phones. */
#address-search-panel {
  position: absolute;
  top: 96px; right: 12px;
  width: min(380px, calc(100vw - 24px));
  max-height: 60vh;
  background: var(--bg-pane);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 1070; /* above #publisher-picker */
  overflow: hidden;
}
#address-search-form {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-bottom: 1px solid #1e3a5f;
}
#address-search-input {
  flex: 1; min-width: 0;
  background: rgba(0,0,0,0.22);
  color: var(--fg);
  border: 1px solid #1e3a5f;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: calc(14px * var(--app-font-scale, 1));
}
#address-search-input:focus {
  outline: none;
  border-color: var(--accent);
}
#address-search-clear {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: calc(16px * var(--app-font-scale, 1));
  cursor: pointer;
  padding: 4px 6px;
}
#address-search-clear:hover { color: var(--fg); }

.addr-search-status {
  padding: 6px 12px;
  font-size: calc(11px * var(--app-font-scale, 1));
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 14px;
}
.addr-search-status.error { color: var(--red); }
.addr-search-status.exact { color: var(--green); }

#address-search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
#address-search-results li.addr-result {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#address-search-results li.addr-result:hover { background: rgba(76,201,240,0.08); }
.addr-result-label {
  font-size: calc(13px * var(--app-font-scale, 1));
  color: var(--fg);
}
.addr-result-sub {
  font-size: calc(11px * var(--app-font-scale, 1));
  color: var(--muted);
}

/* Empty-state CTA on the map when no territory is loaded. Pinned
   to the center of the visible map area; auto-hidden by app.js
   as soon as a bundle loads (no-territory class flips off the
   body, or any search-result pin is active). */
.map-empty-state {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 950;
  pointer-events: none; /* let map drag through */
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: calc(100vw - 24px);
}
.map-empty-card {
  background: rgba(11, 37, 64, 0.94);
  border: 1px solid #1e3a5f;
  border-radius: 14px;
  padding: 18px 22px;
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  max-width: 340px;
}
.map-empty-headline {
  font-size: calc(15px * var(--app-font-scale, 1)); font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.map-empty-sub {
  font-size: calc(12px * var(--app-font-scale, 1));
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 12px;
}
.map-empty-cta {
  background: var(--accent);
  color: #02233a;
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: calc(13px * var(--app-font-scale, 1));
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.map-empty-cta:hover { filter: brightness(1.08); }
/* Hidden unless body carries the no-territory class AND no search
   pin is active (data-search-pin attr toggled by AddressSearch). */
.map-empty-state { display: none; }
body.no-territory .map-empty-state { display: flex; }
body.no-territory[data-gathering] .map-empty-state { display: none; }
body[data-search-pin="1"] .map-empty-state { display: none; }

/* Search-result pin marker: a yellow halo around the address dot
   so it's instantly distinguishable from the regular blue/green/
   orange bundle dots. Drawn via L.divIcon by AddressSearch. */
.leaflet-marker-icon.search-pin-marker {
  background: transparent !important;
  border: 0 !important;
}
.search-pin {
  /* Width / height / tail offsets all multiply by --app-font-scale
     so the pin's hit box, disc, and tail tip move in lockstep with
     the user's font-size preference. The L.divIcon iconSize on the
     JS side is multiplied by the same factor (scalePx()) so the
     Leaflet wrapper rectangle matches what CSS paints inside it. */
  width: calc(28px * var(--app-font-scale, 1));
  height: calc(28px * var(--app-font-scale, 1));
  border-radius: 50%;
  background: #f0ad4e;
  border: 3px solid #fff5dd;
  box-shadow: 0 0 0 3px rgba(240, 173, 78, 0.32),
              0 2px 6px rgba(0,0,0,0.5);
  position: relative;
}
.search-pin::after {
  content: "";
  position: absolute;
  left: 50%; bottom: calc(-7px * var(--app-font-scale, 1));
  transform: translateX(-50%);
  border-width: calc(8px * var(--app-font-scale, 1))
               calc(6px * var(--app-font-scale, 1)) 0
               calc(6px * var(--app-font-scale, 1));
  border-style: solid;
  border-color: #fff5dd transparent transparent transparent;
}
/* Declared variants of the search pin. When the looked-up address
   already carries an active declaration the search-pin badge
   visually mirrors the bundle dots' lock layer instead of the
   default yellow halo — without this swap the yellow pin sits ON
   TOP of the bundle's blue-house badge after a declare and makes
   it look like the declaration never registered. Two flavours:
   - --house: publisher_residence (blue circle, matches
     .predeclared-lock--house background)
   - --declared: bible_study / witness_household / other (purple
     fallback so all three read as "spoken-for" without needing
     per-kind colour rules). */
.search-pin.search-pin--house,
.search-pin.search-pin--declared {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(16px * var(--app-font-scale, 1));
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.45);
}
.search-pin.search-pin--house {
  background: #1e6fd9;
  border-color: #c7e0ff;
  box-shadow: 0 0 0 3px rgba(30,111,217,0.32),
              0 2px 6px rgba(0,0,0,0.5);
}
.search-pin.search-pin--house::after {
  border-top-color: #c7e0ff;
}
.search-pin.search-pin--declared {
  background: #7b59c2;
  border-color: #e0d2ff;
  box-shadow: 0 0 0 3px rgba(123,89,194,0.32),
              0 2px 6px rgba(0,0,0,0.5);
}
.search-pin.search-pin--declared::after {
  border-top-color: #e0d2ff;
}

/* Owner / territory chip rendered inside the search-result popup
   so a rando publisher sees who owns the address's territory. */
.addr-popup .addr-owner-chip {
  margin: 6px 0;
  padding: 5px 8px;
  font-size: calc(11px * var(--app-font-scale, 1));
  color: #d9e1ec;
  background: rgba(76,201,240,0.10);
  border-radius: 5px;
  border-left: 3px solid var(--accent);
}
.addr-popup .addr-owner-chip strong { color: var(--accent); }
.addr-popup .addr-owner-chip .addr-owner-sub {
  display: block;
  font-size: calc(10px * var(--app-font-scale, 1));
  color: var(--muted);
  margin-top: 1px;
}

/* The .bulk-nah-* dialog styles were removed in v82 along with the
   rest of the bulk-NAH feature (the dialog itself + bulk-nah.js).
   See the inline removal note in index.html for the rationale. */

/* ------------------------------------------------------------------
 * Pending-revocation chime + banner + drawer (Phase 2 acknowledgment
 * ledger). The chime pill sits in #topbar next to #reviews-btn and
 * only renders when the owner has at least one open row attributed
 * to them. The banner appears under #topbar (above the map) when the
 * signed-in user is on the receiving end of at least one open row.
 * The drawer is a right-side modal panel that opens on chime click.
 * ------------------------------------------------------------------ */

#pending-chime.pending-chime-pill {
  background: rgba(217, 83, 79, 0.20);
  color: #f3b3b3;
  font-weight: 700;
  cursor: pointer;
  gap: 4px;
  padding: 2px 8px;
  display: inline-flex; align-items: center;
}
#pending-chime.pending-chime-pill:hover {
  background: rgba(217, 83, 79, 0.34);
}
#pending-chime .pending-chime-icon {
  font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1;
}
#pending-chime .pending-chime-count {
  font-size: calc(11px * var(--app-font-scale, 1));
  font-weight: 700;
  min-width: 14px; text-align: center;
}
#pending-chime.has-pending {
  animation: pending-chime-pulse 1.6s ease-in-out infinite alternate;
}
@keyframes pending-chime-pulse {
  from { background: rgba(217, 83, 79, 0.20); }
  to   { background: rgba(217, 83, 79, 0.42); }
}

.pending-banner {
  position: sticky;
  top: 0;
  z-index: 1010;
  background: linear-gradient(180deg, #5a1d1d 0%, #421515 100%);
  color: #f6dada;
  border-bottom: 2px solid #8a2c2c;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 6px;
}

.demo-banner {
  position: sticky;
  top: 0;
  z-index: 1009;
  background: linear-gradient(180deg, #6b4f0a 0%, #4a3707 100%);
  color: #fff3c4;
  border-bottom: 2px solid #c9a227;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  padding: 8px 12px;
  font-size: calc(13px * var(--app-font-scale, 1));
  font-weight: 700;
  text-align: center;
}
.pending-banner-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px;
}
.pending-banner-icon {
  font-size: calc(18px * var(--app-font-scale, 1));
  flex-shrink: 0;
}
.pending-banner-text {
  flex: 1;
  font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1.4;
  color: #f6dada;
}
.pending-banner-text strong { color: #fff; }
.pending-banner-text em { color: #d8aaaa; font-style: normal; }
.pending-banner-ack {
  background: #f8d699;
  color: #2a1010;
  border: 0;
  border-radius: 6px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: calc(12px * var(--app-font-scale, 1));
  cursor: pointer;
  flex-shrink: 0;
}
.pending-banner-ack:hover { background: #ffe9b8; }
.pending-banner-ack:active { background: #e5be7f; }

#pending-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2010;
}
#pending-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: #0e2540;
  color: #e7ecf2;
  z-index: 2020;
  box-shadow: -4px 0 18px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  border-left: 1px solid rgba(255,255,255,0.08);
  transform: translateX(100%);
  transition: transform 180ms ease-out;
}
#pending-drawer.is-open { transform: translateX(0); }

.pending-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.pending-drawer-head strong {
  font-size: calc(15px * var(--app-font-scale, 1));
}
#pending-drawer-close {
  background: transparent;
  color: #c5cfdb;
  border: 0;
  font-size: calc(20px * var(--app-font-scale, 1));
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
#pending-drawer-close:hover { color: #fff; }
.pending-drawer-help {
  padding: 10px 14px 4px;
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #aabac9;
  line-height: 1.4;
  margin: 0;
}
.pending-drawer-list {
  list-style: none;
  padding: 8px 14px 14px;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 10px;
}
.pending-drawer-row {
  background: #142e4e;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.pending-drawer-row-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.pending-drawer-row-head strong {
  font-size: calc(13px * var(--app-font-scale, 1));
}
.pending-drawer-row-tnum {
  background: rgba(255,255,255,0.08);
  color: #c5cfdb;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: calc(11px * var(--app-font-scale, 1));
  font-weight: 700;
}
.pending-drawer-row-body {
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #c5cfdb;
  line-height: 1.4;
}
.pending-drawer-row-body em { color: #97a6b7; font-style: normal; }
.pending-drawer-row-ack {
  background: #2da06a;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: calc(12px * var(--app-font-scale, 1));
  cursor: pointer;
  align-self: flex-end;
}
.pending-drawer-row-ack:hover { background: #36b97a; }
.pending-drawer-row-ack:active { background: #258258; }
.pending-drawer-empty {
  color: #97a6b7;
  text-align: center;
  padding: 20px;
  font-size: calc(13px * var(--app-font-scale, 1));
}
body.pending-drawer-open { overflow: hidden; }

/* ------------------------------------------------------------------
 * User inbox (v92): unread message panel + dialog + chime pill.
 * ------------------------------------------------------------------ */

#inbox-chime.inbox-chime-pill {
  background: rgba(76, 201, 240, 0.18);
  color: #b8ecff;
  font-weight: 700;
  cursor: pointer;
  gap: 4px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
}
#inbox-chime.inbox-chime-pill.is-empty {
  background: rgba(255, 255, 255, 0.06);
  color: #8fa8bc;
  font-weight: 600;
}
#inbox-chime.inbox-chime-pill:hover {
  background: rgba(76, 201, 240, 0.32);
  color: #d8f4ff;
}
#inbox-chime.inbox-chime-pill.is-empty:hover {
  background: rgba(76, 201, 240, 0.16);
  color: #b8ecff;
}
#inbox-chime .inbox-chime-icon {
  font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1;
}
#inbox-chime .inbox-chime-count {
  font-size: calc(11px * var(--app-font-scale, 1));
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}
#inbox-chime.has-unread {
  animation: inbox-chime-pulse 1.8s ease-in-out infinite alternate;
}
@keyframes inbox-chime-pulse {
  from { background: rgba(76, 201, 240, 0.18); }
  to   { background: rgba(76, 201, 240, 0.38); }
}

.inbox-unread-panel {
  position: sticky;
  top: 0;
  z-index: 1005;
  background: linear-gradient(180deg, #123a52 0%, #0d2a3d 100%);
  color: #d8f1ff;
  border-bottom: 2px solid #2a6f8f;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.inbox-unread-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: inherit;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
}
.inbox-unread-row:hover {
  background: rgba(255,255,255,0.06);
}
.inbox-unread-icon {
  flex: 0 0 auto;
  font-size: calc(16px * var(--app-font-scale, 1));
  line-height: 1.2;
}
.inbox-unread-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.inbox-unread-text strong { color: #fff; }
.inbox-unread-text em {
  font-size: calc(11px * var(--app-font-scale, 1));
  color: #9ec9de;
  font-style: normal;
}
.inbox-unread-kind {
  font-size: calc(10px * var(--app-font-scale, 1));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7eb8d4;
}
.inbox-unread-preview {
  font-size: calc(13px * var(--app-font-scale, 1));
  color: #c5e6f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-msg-dlg {
  border: 0;
  padding: 0;
  border-radius: 14px;
  max-width: min(92vw, 420px);
  background: var(--bg-pane, #0f2233);
  color: var(--fg, #e8eef4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
}
.inbox-msg-dlg::backdrop {
  background: rgba(0,0,0,0.55);
}
.inbox-msg-card {
  margin: 0;
  padding: 0;
}
.inbox-msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.inbox-msg-head h2 {
  margin: 0;
  font-size: calc(16px * var(--app-font-scale, 1));
}
.inbox-msg-close {
  background: transparent;
  border: 0;
  color: #aabac9;
  font-size: calc(18px * var(--app-font-scale, 1));
  cursor: pointer;
  padding: 4px 8px;
}
.inbox-msg-meta {
  margin: 10px 14px 4px;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.inbox-msg-kind {
  margin: 0 14px 8px;
  font-size: calc(11px * var(--app-font-scale, 1));
}
.inbox-msg-body {
  margin: 0 14px 14px;
  padding: 12px;
  background: rgba(0,0,0,0.22);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: calc(14px * var(--app-font-scale, 1));
  line-height: 1.45;
  max-height: 40vh;
  overflow-y: auto;
}
.inbox-msg-foot {
  padding: 0 14px 14px;
  display: flex;
  justify-content: flex-end;
}
.inbox-msg-gotit {
  padding: 8px 18px;
  border-radius: 8px;
  border: 0;
  cursor: pointer;
  font-weight: 600;
  background: var(--accent, #4cc9f0);
  color: #0b2540;
}
.manage-inbox-chime {
  margin-left: 8px;
  vertical-align: middle;
}
#inbox-drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 2010;
}
#inbox-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: #0e2540;
  color: #e7ecf2;
  z-index: 2020;
  box-shadow: -4px 0 18px rgba(0,0,0,0.45);
  display: flex; flex-direction: column;
  border-left: 1px solid rgba(255,255,255,0.08);
  transform: translateX(100%);
  transition: transform 180ms ease-out;
}
#inbox-drawer.is-open { transform: translateX(0); }
.inbox-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.inbox-drawer-head strong {
  font-size: calc(15px * var(--app-font-scale, 1));
}
#inbox-drawer-close {
  background: transparent;
  color: #c5cfdb;
  border: 0;
  font-size: calc(20px * var(--app-font-scale, 1));
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
#inbox-drawer-close:hover { color: #fff; }
.inbox-drawer-help {
  padding: 10px 14px 4px;
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #aabac9;
  line-height: 1.4;
  margin: 0;
}
.inbox-drawer-body {
  padding: 8px 0 14px;
  margin: 0;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.inbox-drawer-empty {
  color: #97a6b7;
  text-align: center;
  padding: 28px 18px;
  font-size: calc(13px * var(--app-font-scale, 1));
  margin: 0;
}
body.inbox-drawer-open { overflow: hidden; }
.meeting-roster-msg {
  font-size: calc(11px * var(--app-font-scale, 1));
  padding: 4px 8px;
  margin-left: 4px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.06);
  color: inherit;
  cursor: pointer;
}
.meeting-panel-broadcast {
  margin-right: 6px;
}

/* =========================================================================
   NAH submission inbox dialog (v83 — see index.html for the data flow).
   Shares the geo-modal vocabulary (dark card, rounded corners, top-aligned
   close button) so the publisher modal vocabulary is consistent across
   the app. Stays narrow enough on phones (the card maxes at 460px) that
   the address textarea stays one column.
   ========================================================================= */
.nah-inbox-dlg {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 92vw;
  width: 460px;
}
.nah-inbox-dlg::backdrop {
  background: rgba(7, 14, 26, 0.74);
}
.nah-inbox-card {
  background: #131c2c;
  color: #e8eef7;
  border: 1px solid #2c3a55;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 90vh;
  overflow: auto;
}
.nah-inbox-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nah-inbox-head h2 {
  margin: 0;
  font-size: calc(17px * var(--app-font-scale, 1));
}
.nah-inbox-close,
.queue-errors-close {
  background: transparent;
  border: none;
  color: #97a6b7;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
}
.nah-inbox-pickers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.nah-inbox-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #b9c4d4;
}
.nah-inbox-field span {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.nah-inbox-field input,
.nah-inbox-field select,
.nah-inbox-field textarea,
.nah-inbox-editor textarea {
  background: #0b1322;
  border: 1px solid #2c3a55;
  color: #e8eef7;
  border-radius: 8px;
  padding: 8px;
  font-size: calc(14px * var(--app-font-scale, 1));
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.nah-inbox-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nah-inbox-hint {
  margin: 0;
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #97a6b7;
  line-height: 1.45;
}
.nah-inbox-hint code {
  background: #1f2a40;
  padding: 1px 5px;
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.nah-inbox-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-height: 22px;
}
.nah-inbox-pills li {
  font-size: calc(11px * var(--app-font-scale, 1));
  padding: 3px 8px;
  border-radius: 999px;
  background: #1f2a40;
  border: 1px solid #2c3a55;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nah-inbox-pills li.is-valid {
  border-color: #2d8b57;
  background: rgba(45, 139, 87, 0.18);
  color: #b5edcc;
}
.nah-inbox-pills li.is-invalid {
  border-color: #b94a55;
  background: rgba(185, 74, 85, 0.18);
  color: #f4c3c7;
}
.nah-inbox-pills li.is-dnc {
  border-color: #c69b3a;
  background: rgba(198, 155, 58, 0.18);
  color: #f0dfb6;
}
.nah-inbox-status {
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #97a6b7;
  min-height: 16px;
}
.nah-inbox-status.is-error { color: #f4c3c7; }
.nah-inbox-status.is-ok { color: #b5edcc; }
.nah-inbox-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.nah-inbox-foot button,
.queue-errors-foot button {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #2c3a55;
  cursor: pointer;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.nah-inbox-foot button.ghost,
.queue-errors-foot button.ghost {
  background: transparent;
  color: #b9c4d4;
}
.nah-inbox-foot button.primary {
  background: #2d8b57;
  color: #ffffff;
  border-color: #2d8b57;
}
.nah-inbox-foot button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Sync-pill error state: when ingest_event_errors[] entries land in
   queue_errors, the pill grows a red badge and becomes tappable so
   the publisher can open the queue-errors dialog. */
#sync-pill[data-errors] {
  background: rgba(185, 74, 85, 0.22);
  border: 1px solid #b94a55;
  color: #f4c3c7;
  cursor: pointer;
}

/* Queue-errors dialog (v83 cross-cut): consumes ingest_event_errors[]
   from /api/sync responses. */
.queue-errors-dlg {
  border: none;
  background: transparent;
  padding: 0;
  max-width: 92vw;
  width: 460px;
}
.queue-errors-dlg::backdrop {
  background: rgba(7, 14, 26, 0.74);
}
.queue-errors-card {
  background: #131c2c;
  color: #e8eef7;
  border: 1px solid #2c3a55;
  border-radius: 14px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 90vh;
  overflow: auto;
}
.queue-errors-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.queue-errors-head h2 {
  margin: 0;
  font-size: calc(17px * var(--app-font-scale, 1));
}
.queue-errors-hint {
  margin: 0;
  font-size: calc(12px * var(--app-font-scale, 1));
  color: #97a6b7;
  line-height: 1.45;
}
.queue-errors-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue-errors-list li {
  border: 1px solid #2c3a55;
  border-radius: 8px;
  padding: 10px;
  background: #0b1322;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.queue-errors-list .queue-errors-meta {
  font-size: calc(11px * var(--app-font-scale, 1));
  color: #97a6b7;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.queue-errors-list .queue-errors-reason {
  font-size: calc(13px * var(--app-font-scale, 1));
  color: #f4c3c7;
}
.queue-errors-list .queue-errors-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.queue-errors-list .queue-errors-row-actions button {
  font-size: calc(12px * var(--app-font-scale, 1));
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid #2c3a55;
  background: transparent;
  color: #b9c4d4;
  cursor: pointer;
}
.queue-errors-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.queue-errors-empty {
  text-align: center;
  color: #97a6b7;
  padding: 18px 0;
}

/* ------------------------------------------------------------------ Pairing board (v91) */
.avatar-disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: hsl(var(--avatar-hue, 210), 48%, 34%);
  color: #e8eef5;
  font-weight: 700;
  flex-shrink: 0;
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  box-shadow: 0 0 0 2px hsl(var(--avatar-hue, 210), 72%, 52%);
}
.avatar-disc-photo img {
  box-sizing: border-box;
  border: 2px solid hsl(var(--avatar-hue, 210), 72%, 52%);
}
.avatar-disc-tag {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 8px;
  background: #0b2540;
  border: 1px solid #4cc9f0;
  color: #e8eef5;
  font-size: 9px;
  font-weight: 800;
  line-height: 12px;
  text-align: center;
  z-index: 2;
}
.avatar-disc img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
  border-radius: 50%;
}
.avatar-disc-32 { width: 32px; height: 32px; font-size: calc(11px * var(--app-font-scale, 1)); }
.avatar-disc-36 { width: 36px; height: 36px; font-size: calc(12px * var(--app-font-scale, 1)); }
.avatar-disc-40 { width: 40px; height: 40px; font-size: calc(13px * var(--app-font-scale, 1)); }
.avatar-stack { display: inline-flex; align-items: center; position: relative; }
.avatar-stack-item { margin-left: -10px; }
.avatar-stack-item:first-child { margin-left: 0; }
.avatar-stack-2 .avatar-stack-item:nth-child(2) { margin-left: -14px; }
.avatar-stack-3 .avatar-stack-item { margin-left: -12px; }
.pair-person-chip, .pair-unit-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 10px;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
  min-width: 52px;
}
.pair-person-chip:active, .pair-unit-chip:active { cursor: grabbing; }
.pair-person-chip.pair-pending { outline: 2px dashed #6b9fd4; }
.pair-person-chip.pair-drop-highlight,
.pair-unit-chip.pair-drop-highlight {
  outline: 2px solid #3ecf8e;
  box-shadow: 0 0 0 3px rgba(62, 207, 142, 0.35);
  background: rgba(62, 207, 142, 0.12);
}
.pair-unit-label {
  font-size: calc(10px * var(--app-font-scale, 1));
  color: var(--muted);
  max-width: 72px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.pairing-board-root, .pairing-gather-overlay, .pairing-gather-sheet {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.pair-drag-active {
  -webkit-user-select: none !important;
  user-select: none !important;
  touch-action: none;
}
.pairing-board-root { margin: 8px 0 16px; }
.pairing-board-pool, .pairing-board-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  background: rgba(11, 37, 64, 0.35);
  min-height: 56px;
}
.pairing-board-pool-label, .pairing-board-cards-label {
  font-size: calc(12px * var(--app-font-scale, 1));
  font-weight: 600;
  margin: 8px 0 4px;
  color: var(--muted);
}
.pair-territory-card {
  min-width: 120px;
  padding: 10px;
  border-radius: 10px;
  border: 2px solid #2a4a6e;
  background: #0f2238;
}
.pair-territory-card.pair-drop-highlight { border-color: #3ecf8e; box-shadow: 0 0 0 2px rgba(62, 207, 142, 0.35); }
.pair-territory-title { font-weight: 700; margin-bottom: 8px; }
.pair-territory-stacks { display: flex; flex-direction: column; gap: 6px; min-height: 40px; }
.pair-drag-ghost {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  opacity: 0.92;
  transform: scale(1.05);
  max-width: 88px;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.pair-drag-ghost .avatar-disc {
  width: 40px !important;
  height: 40px !important;
}
.pair-drag-ghost .pair-unit-label { display: none; }
.pair-dragging { opacity: 0.45; pointer-events: none; }
.pair-req-actions { display: flex; gap: 4px; margin-top: 4px; }
.pair-req-accept, .pair-req-decline {
  font-size: calc(11px * var(--app-font-scale, 1));
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #2c3a55;
  background: #152a45;
  color: #e8eef5;
  cursor: pointer;
}
.pairing-gather-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}
.pairing-gather-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow: auto;
  background: #0b2540;
  border-radius: 16px 16px 12px 12px;
  padding: 12px 14px 16px;
  border: 1px solid #1e3a5f;
}
.pairing-gather-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.pairing-gather-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}
.pairing-gather-row { display: flex; flex-wrap: wrap; gap: 10px; }
.pairing-gather-label { font-weight: 600; margin-bottom: 6px; font-size: calc(12px * var(--app-font-scale, 1)); }
.pairing-gather-hint { margin: 10px 0 0; font-size: calc(12px * var(--app-font-scale, 1)); }
.pairing-gather-req { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.pairing-gather-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #1e3a5f;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pairing-gather-send {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 0;
  background: var(--accent, #4cc9f0);
  color: #0b2540;
  font-weight: 700;
  font-size: calc(14px * var(--app-font-scale, 1));
  cursor: pointer;
}
.pairing-gather-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.pairing-gather-cancel-req {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #2c3a55;
  background: #152a45;
  color: #e8eef5;
  font-size: calc(13px * var(--app-font-scale, 1));
  cursor: pointer;
}
.pair-partner-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pair-partner-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 2px solid #1e3a5f;
  background: #0f2238;
  color: #e8eef5;
  cursor: pointer;
  text-align: left;
  font: inherit;
}
.pair-partner-option:hover:not(:disabled) { border-color: #2a4a6e; }
.pair-partner-option.pair-partner-selected {
  border-color: #3ecf8e;
  background: rgba(62, 207, 142, 0.12);
  box-shadow: 0 0 0 1px rgba(62, 207, 142, 0.35);
}
.pair-partner-option:disabled { opacity: 0.5; cursor: not-allowed; }
.pair-partner-name {
  flex: 1;
  font-weight: 600;
  font-size: calc(14px * var(--app-font-scale, 1));
}
.pair-partner-check {
  width: 1.25em;
  color: #3ecf8e;
  font-weight: 700;
  font-size: calc(16px * var(--app-font-scale, 1));
}
.pairing-gather-status {
  margin: 0 0 12px;
  font-size: calc(13px * var(--app-font-scale, 1));
  color: var(--muted);
}
.pair-member-remove {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.pair-member-remove:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pair-member-remove-x {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: calc(18px * var(--app-font-scale, 1));
  height: calc(18px * var(--app-font-scale, 1));
  border-radius: 50%;
  background: #c0392b;
  color: #fff;
  font-size: calc(13px * var(--app-font-scale, 1));
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.45);
  pointer-events: none;
}
.pairing-gather-members {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 8px;
}
.pairing-gather-add-toggle {
  background: transparent;
  border: 1px dashed #3a6ea5;
  color: var(--accent);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: calc(12px * var(--app-font-scale, 1));
  cursor: pointer;
}
.pairing-gather-add-toggle:hover { background: rgba(76,201,240,0.08); }
.pairing-gather-add-guest {
  background: transparent;
  border: 1px dashed #3a6ea5;
  color: var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 44px;
  font-size: calc(13px * var(--app-font-scale, 1));
  cursor: pointer;
  margin-right: 8px;
}
.pairing-gather-add-guest:hover { background: rgba(76,201,240,0.08); }

/* ------------------------------------------------------------------
   Work units page shell + Field Service Work Unit window
   ------------------------------------------------------------------ */
body.work-units-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100%;
  min-height: 100dvh;
  padding: 4px 6px 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.work-units-shell {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.work-units-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  min-height: 32px;
}
.work-units-context {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: calc(11px * var(--app-font-scale, 1));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fsu-boot-error {
  padding: 12px 10px;
  border: 1px solid rgba(217, 83, 79, 0.45);
  border-radius: 8px;
  background: rgba(217, 83, 79, 0.08);
}
.fsu-error {
  margin: 0 0 8px;
  color: #f5b7b1;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.wu-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.wu-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #2a4a6e;
  background: #132a45;
  color: var(--fg);
  font-size: calc(14px * var(--app-font-scale, 1));
  text-decoration: none;
  cursor: pointer;
}
.wu-icon-btn:hover, .wu-icon-btn:focus-visible {
  border-color: var(--accent);
  outline: none;
}
#fsu-root { min-height: 80px; }

.fsu-window { display: flex; flex-direction: column; gap: 4px; }
.fsu-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg, #0b1a2e);
}
.fsu-btn {
  min-height: 32px;
  min-width: 32px;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #2a4a6e;
  background: #132a45;
  color: var(--fg);
  font-size: calc(14px * var(--app-font-scale, 1));
  cursor: pointer;
  line-height: 1;
}
.fsu-hint-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: #0f2840;
}
.fsu-self-slot { display: inline-flex; }
.fsu-btn-primary { background: #1d6fa4; border-color: #2a8fd4; }
.fsu-btn-secondary { background: transparent; }
.fsu-mode-toggle[aria-pressed="true"] { background: #14532d; border-color: #22c55e; }
.fsu-menu-danger-btn {
  min-width: 32px;
  padding: 4px 6px;
  color: #fca5a5;
  border-color: #7f1d1d;
  background: #3f1515;
}
.fsu-floater-menu { display: inline-flex; align-items: center; }
.fsu-hint {
  display: none;
  color: var(--accent);
  font-size: calc(10px * var(--app-font-scale, 1));
  flex: 1 1 100%;
  min-width: 0;
}
.fsu-window.fsu-hints-on .fsu-hint { display: block; }
.fsu-panel {
  background: var(--bg-pane);
  border: 1px solid #1e3a5f;
  border-radius: 8px;
  padding: 6px 8px;
  border-left-width: 4px;
  box-sizing: border-box;
  max-width: 100%;
}
.fsu-panel-clusters {
  border-left-color: #38bdf8;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.08) 0%, var(--bg-pane) 24%);
  overflow: hidden;
}
.fsu-panel-territories {
  order: -1;
  border-left-color: #38bdf8;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, var(--bg-pane) 28%);
}
.fsu-panel-available {
  border-left-color: #4ade80;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.1) 0%, var(--bg-pane) 28%);
}
.fsu-panel-available.fsu-panel-drop-target {
  border-left-color: #fbbf24;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.14) 0%, var(--bg-pane) 28%);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35);
}
.fsu-available-drop {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 8px;
  border: 2px dashed rgba(251, 191, 36, 0.55);
  border-radius: 8px;
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
  font-size: calc(11px * var(--app-font-scale, 1));
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}
.fsu-available-drop:hover,
.fsu-available-drop:focus-visible {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.14);
}
.fsu-menu-hint {
  margin: 0;
  padding: 8px 10px;
  font-size: calc(11px * var(--app-font-scale, 1));
  line-height: 1.35;
}
.fsu-panel-units {
  border-left-color: #fbbf24;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.1) 0%, var(--bg-pane) 28%);
}
.fsu-panel-title {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 4px;
  font-size: calc(10px * var(--app-font-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fsu-panel-territories .fsu-panel-title { color: #7dd3fc; }
.fsu-panel-available .fsu-panel-title { color: #86efac; }
.fsu-panel-units .fsu-panel-title { color: #fcd34d; }
.fsu-panel-glyph { font-size: calc(12px * var(--app-font-scale, 1)); line-height: 1; }
.fsu-chip-row, .fsu-unit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.fsu-territory-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fsu-member-chip, .fsu-unit-main, .fsu-slot {
  min-height: 32px;
  min-width: 32px;
}
.fsu-member-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 2px;
  border-radius: 50%;
  border: 2px solid #2a4a6e;
  background: #0f2238;
  color: var(--fg);
  cursor: pointer;
}
.fsu-member-chip.fsu-guest { border-color: #7c3aed; }
.fsu-member-chip.fsu-leader-self {
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.55);
}
.fsu-member-chip .avatar-disc-tag {
  min-width: 16px;
  height: 16px;
  font-size: 10px;
  line-height: 14px;
  border-width: 2px;
}
.fsu-member-chip.fsu-leader-self::after {
  content: "★";
  position: absolute;
  top: -4px;
  left: -4px;
  font-size: 9px;
  color: #fbbf24;
  text-shadow: 0 0 2px #000;
  pointer-events: none;
}
.fsu-member-chip.fsu-selected, .fsu-unit-card.fsu-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76,201,240,0.25);
}
.fsu-member-chip.fsu-pending-pair { border-color: #f59e0b; }
.fsu-unit-card {
  position: relative;
  border-radius: 8px;
  border: 2px solid #2a4a6e;
  background: #0f2238;
  overflow: hidden;
}
.fsu-unit-card.fsu-origin-self { border-left: 3px solid #22c55e; }
.fsu-unit-card.fsu-origin-leader { border-left: 3px solid #f59e0b; }
.fsu-unit-head {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.fsu-unit-main {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
}
.fsu-unit-menu-btn {
  flex: 0 0 auto;
  width: 28px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-left: 1px solid #1e3a5f;
  background: #132a45;
  color: var(--muted);
  cursor: pointer;
  font-size: calc(14px * var(--app-font-scale, 1));
  line-height: 1;
}
.fsu-origin-badge { font-size: calc(12px * var(--app-font-scale, 1)); flex-shrink: 0; }
.fsu-unit-menu {
  display: flex;
  flex-direction: column;
  border-top: 1px solid #1e3a5f;
}
.fsu-menu-item {
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  background: #132a45;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  font-size: calc(12px * var(--app-font-scale, 1));
}
.fsu-menu-item + .fsu-menu-item { border-top: 1px solid #1e3a5f; }
.fsu-menu-danger { color: #fca5a5; }
.fsu-territory-row-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  border: 1px solid #2a4a6e;
  background: #0f2238;
}
.fsu-territory-row-item.fsu-ter-has-assignees {
  border-color: #1d6fa4;
  background: #0f2840;
}
.fsu-territory-label {
  flex: 0 0 auto;
  min-width: 40px;
  max-width: 56px;
  font-weight: 700;
  font-size: calc(11px * var(--app-font-scale, 1));
  line-height: 1.2;
  color: #e8eef5;
  word-break: break-all;
}
.fsu-slot-strip {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}
.fsu-cluster-row {
  margin-bottom: 4px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  gap: clamp(4px, 1.5vw, 8px);
  padding: 4px;
}
.fsu-cluster-row.fsu-cluster-row-picked {
  outline: 1px solid rgba(76, 201, 240, 0.35);
  outline-offset: 1px;
  border-radius: 8px;
}
.fsu-cluster-row.fsu-cluster-row-source {
  outline: 1px solid rgba(34, 211, 238, 0.55);
  outline-offset: 1px;
  border-radius: 8px;
  background: rgba(34, 211, 238, 0.06);
}
.fsu-cluster-row .fsu-slot-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(2px, 1vw, 4px);
  flex: 1 1 auto;
  min-width: 0;
}
.fsu-cluster-row .fsu-slot {
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: clamp(34px, 11vw, 44px);
}
.fsu-cluster-row .fsu-slot .avatar-stack {
  transform: scale(0.92);
}
.fsu-cluster-label {
  flex: 0 1 auto;
  width: auto;
  min-width: 1.75em;
  max-width: 2.75em;
  min-height: clamp(34px, 11vw, 44px);
  height: clamp(34px, 11vw, 44px);
  padding: 0 2px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-weight: 800;
  font-size: clamp(11px, 3.2vw, calc(14px * var(--app-font-scale, 1)));
  line-height: 1.1;
  color: #c5d4e8;
  cursor: pointer;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.fsu-cluster-label.fsu-cluster-label-disabled {
  opacity: 0.45;
  cursor: default;
}
.fsu-cluster-label.fsu-cluster-label-on {
  color: #4cc9f0;
  background: rgba(29, 111, 164, 0.28);
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.45);
}
.fsu-cluster-label.fsu-cluster-label-source {
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.14);
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.45);
}
.fsu-cluster-row-selected {
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.45);
  background: rgba(29, 111, 164, 0.18);
}
.fsu-cluster-strip {
  display: flex;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  flex-wrap: nowrap;
}
.fsu-cluster-item {
  display: flex;
  flex: 1 1 0;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
  max-width: none;
  border-radius: 8px;
  padding: 2px;
  box-sizing: border-box;
}
.fsu-cluster-item.fsu-cluster-selected {
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.55);
  background: rgba(29, 111, 164, 0.22);
}
.fsu-cluster-enum {
  flex: 0 0 38%;
  max-width: 38%;
  min-width: 26px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: #e8eef5;
  color: #0b2540;
  font-size: calc(15px * var(--app-font-scale, 1));
  font-weight: 800;
  line-height: 1;
  box-sizing: border-box;
}
.fsu-cluster-item .fsu-slot {
  flex: 1 1 62%;
  max-width: 62%;
  min-width: 32px;
}
.fsu-slot-empty {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 12px;
}
.fsu-scope-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: 100%;
  margin-top: 4px;
}
.fsu-scope-btn {
  font-size: calc(10px * var(--app-font-scale, 1));
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #94a3b8;
  background: #f1f5f9;
  color: #0b2540;
  cursor: pointer;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fsu-scope-btn:hover { background: #e2e8f0; }
.fsu-slot {
  flex: 1 1 0;
  min-width: 36px;
  max-width: 56px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 6px;
  border: 2px solid #e5e7eb;
  background: #ffffff;
  color: #0b2540;
  cursor: pointer;
  overflow: hidden;
  box-sizing: border-box;
}
.fsu-slot-low {
  border-bottom: 3px solid #38bdf8;
}
.fsu-slot-high {
  border-bottom: 3px solid #fbbf24;
}
.fsu-slot-num {
  font-size: calc(15px * var(--app-font-scale, 1));
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}
.fsu-slot-pickable {
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.45);
  animation: fsu-slot-pulse 1.2s ease-in-out infinite;
}
@keyframes fsu-slot-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.35); }
  50% { box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.65); }
}
.fsu-slot.fsu-selected {
  border-color: #1d6fa4;
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.55);
}
.fsu-slot .avatar-disc {
  box-shadow: none;
}
.fsu-slot .avatar-stack {
  transform: scale(0.92);
}
.fsu-territory-count {
  flex: 0 0 auto;
  font-size: calc(9px * var(--app-font-scale, 1));
  background: #1d6fa4;
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 4px;
}
.fsu-territory-card {
  padding: 6px;
  border-radius: 8px;
  border: 2px solid #2a4a6e;
  background: #0f2238;
  color: var(--fg);
  cursor: pointer;
  text-align: left;
}
.fsu-territory-card.fsu-ter-has-assignees {
  border-color: #1d6fa4;
  background: #0f2840;
}
.fsu-territory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  margin-bottom: 2px;
}
.fsu-territory-title { font-weight: 700; font-size: calc(12px * var(--app-font-scale, 1)); }
.fsu-territory-count {
  font-size: calc(9px * var(--app-font-scale, 1));
  background: #1d6fa4;
  color: #fff;
  border-radius: 999px;
  min-width: 16px;
  height: 16px;
  line-height: 16px;
  text-align: center;
  padding: 0 3px;
}
.fsu-territory-body { min-height: 28px; }
.fsu-assign-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  min-height: 34px;
  padding: 4px;
  border-radius: 8px;
  border: 2px dashed #2a6a9a;
  background: rgba(29, 111, 164, 0.12);
}
.fsu-ter-has-assignees .fsu-assign-box {
  border-style: solid;
  border-color: #1d6fa4;
  background: rgba(29, 111, 164, 0.2);
}
.fsu-selection-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: relative;
  width: 100%;
  z-index: 10;
  margin: 0;
  padding: 8px 10px;
  background: #0a1e33;
  border-top: 2px solid #1d6fa4;
  font-size: calc(12px * var(--app-font-scale, 1));
  line-height: 1.35;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
}
.fsu-selection-bar[hidden] { display: none !important; }
.fsu-selection-prefix {
  color: #7dd3fc;
  margin-right: 6px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: calc(10px * var(--app-font-scale, 1));
  letter-spacing: 0.04em;
}
.fsu-selection-names {
  color: var(--fg);
  flex: 1 1 auto;
  font-weight: 600;
  word-break: break-word;
}
.fsu-selection-remove {
  flex: 0 0 auto;
  margin-left: auto;
}
.fsu-ter-unit {
  display: inline-flex;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}
.fsu-ter-unit.fsu-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.25);
}
.fsu-ter-unit:focus-visible { outline: 2px solid var(--accent); }
.fsu-ter-person { display: inline-flex; }
.fsu-ter-hint { display: none; font-size: calc(9px * var(--app-font-scale, 1)); color: var(--accent); }
.fsu-window.fsu-hints-on .fsu-ter-hint { display: inline; }
.fsu-ter-empty { color: var(--muted); font-size: calc(12px * var(--app-font-scale, 1)); }
.work-units-toast {
  position: fixed;
  left: 50%;
  bottom: calc(12px + var(--fsu-status-bar-height, 0px) + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 10040;
  max-width: min(92vw, 420px);
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #2a6a9a;
  background: #0f2840;
  color: var(--fg);
  font-size: calc(12px * var(--app-font-scale, 1));
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.work-units-toast.toast-err { border-color: rgba(217, 83, 79, 0.55); }
.work-units-toast.toast-ok { border-color: rgba(92, 184, 92, 0.55); }
.fsu-ghost-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10045;
  overflow: visible;
}
.fsu-ghost {
  position: fixed;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  animation: fsu-ghost-fade 700ms ease-out forwards;
}
.fsu-ghost > * {
  max-width: 100%;
  max-height: 100%;
}
@keyframes fsu-ghost-fade {
  0% { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.88); }
}
.fsu-empty-msg { font-size: calc(11px * var(--app-font-scale, 1)); }

@media (max-width: 479px) {
  .fsu-panel-label { font-size: calc(9px * var(--app-font-scale, 1)); }
  .fsu-panel {
    padding: 5px 6px 5px 8px;
    border-radius: 6px;
    margin-bottom: 4px;
  }
  .fsu-empty-msg { display: none; }
  .fsu-slot { height: 40px; min-width: 32px; }
  .fsu-territory-label { min-width: 36px; font-size: calc(10px * var(--app-font-scale, 1)); }
}

@media (min-width: 480px) {
  body.work-units-body { padding: 8px 10px 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .work-units-context { font-size: calc(12px * var(--app-font-scale, 1)); }
  .wu-icon-btn { width: 36px; height: 36px; }
  .fsu-window { gap: 8px; }
  .fsu-btn { min-height: 36px; min-width: 36px; }
  .fsu-panel { padding: 8px 10px; border-radius: 10px; }
  .fsu-slot { max-width: 64px; height: 48px; }
  .fsu-hint { flex: 1 1 auto; }
}
.fsu-window.fsu-acting {
  opacity: 0.92;
}

.fsu-confirm {
  border: 1px solid #2a4a6e; border-radius: 14px; padding: 0;
  background: var(--bg-pane); color: var(--fg); max-width: min(420px, 92vw);
}
.fsu-confirm-form { padding: 16px; margin: 0; }
.fsu-confirm-msg { margin: 0 0 16px; font-size: calc(15px * var(--app-font-scale, 1)); }
.fsu-confirm-actions { display: flex; gap: 8px; justify-content: flex-end; }
.fsu-confirm::backdrop { background: rgba(0,0,0,0.55); }

.fsu-segment-picker { max-width: min(520px, 94vw); width: 100%; }
.fsu-picker-title { margin: 0 0 6px; font-size: calc(17px * var(--app-font-scale, 1)); }
.fsu-picker-hint { margin: 0 0 10px; font-size: calc(13px * var(--app-font-scale, 1)); }
.fsu-picker-subtitle { margin: 14px 0 8px; font-size: calc(13px * var(--app-font-scale, 1)); color: #fcd34d; }
.fsu-pick-list {
  display: flex; flex-direction: column; gap: 4px;
  max-height: 36vh; overflow-y: auto; margin-bottom: 8px;
}
.fsu-pick-check {
  flex: 0 0 auto;
  width: 1.2em;
  text-align: center;
  opacity: 0.85;
}
.fsu-pick-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  min-height: 40px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid #2a4a6e; background: #0f2238; color: #e8eef5;
  cursor: pointer; font: inherit;
  font-size: calc(14px * var(--app-font-scale, 1));
}
.fsu-pick-row:hover { background: #152a45; }
.fsu-pick-row.fsu-pick-row-on {
  border-color: #1d6fa4;
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.35);
  background: #0f2840;
}
.fsu-pick-tnum { font-weight: 700; min-width: 3em; }
.fsu-pick-locality { flex: 1; font-size: calc(12px * var(--app-font-scale, 1)); color: #94a3b8; }
.fsu-pick-row input { width: 18px; height: 18px; flex-shrink: 0; }
.fsu-pick-nah-list { border-top: 1px solid #2a4a6e; padding-top: 8px; }
.fsu-panel-segments .fsu-panel-title { color: #93c5fd; }
.fsu-panel-territories .fsu-panel-title { color: #86efac; }
.fsu-slate-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fsu-slate-chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid #2a4a6e; background: #0f2238; color: #e8eef5;
  font-weight: 700; font-size: calc(12px * var(--app-font-scale, 1));
  cursor: pointer; font: inherit;
}
.fsu-slate-chip.fsu-slate-chip-on {
  border-color: #1d6fa4;
  background: #0f2840;
  box-shadow: 0 0 0 2px rgba(76, 201, 240, 0.35);
}
.fsu-slate-locality {
  margin-top: 6px;
  font-size: calc(13px * var(--app-font-scale, 1));
  color: #94a3b8;
}
.fsu-seg-filter-row { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.fsu-seg-filter { font-size: calc(12px * var(--app-font-scale, 1)); padding: 4px 10px; }
.fsu-seg-filter-on { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.fsu-segment-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.fsu-segment-row {
  display: grid;
  grid-template-columns: 2.8em minmax(0, 1fr) 2.75em 2.25em 4.25em;
  align-items: center;
  column-gap: 8px;
  padding: 6px 8px; border-radius: 8px; border: 1px solid #2a4a6e; background: #0b1a2e;
  font-size: calc(12px * var(--app-font-scale, 1));
}
.fsu-segment-row.fsu-segment-pickable { cursor: pointer; }
.fsu-segment-row.fsu-segment-await { box-shadow: 0 0 0 2px rgba(59,130,246,0.35); }
.fsu-segment-tnum { font-weight: 700; }
.fsu-segment-street { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsu-segment-parity {
  text-align: left;
  color: #94a3b8; font-weight: 600;
  white-space: nowrap;
}
.fsu-segment-parity.fsu-segment-nah { color: #fbbf24; font-weight: 700; text-transform: uppercase; }
.fsu-segment-parity.fsu-segment-both { color: #94a3b8; font-weight: 700; text-transform: uppercase; }
.fsu-segment-count {
  text-align: right;
  font-weight: 600; color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}
.fsu-segment-assign {
  text-align: right;
  font-weight: 700; color: #93c5fd;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.fsu-segment-status { font-size: calc(12px * var(--app-font-scale, 1)); }
.fsu-segment-row.fsu-segment-selected {
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.55);
  border-color: #3b82f6;
  background: #122a45;
}
.fsu-window-dispatch .fsu-panel-dispatch-search .fsu-panel-title { color: #86efac; }
.fsu-dispatch-seg-note,
.fsu-dispatch-hint {
  margin: 0 0 8px;
  font-size: calc(11px * var(--app-font-scale, 1));
  line-height: 1.35;
}
.fsu-outing-mode-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.fsu-outing-mode-row .fsu-btn-primary {
  align-self: flex-start;
}
.fsu-ministry-row,
.fsu-pub-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.fsu-ministry-chip,
.fsu-pub-filter {
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid #2a4a6e;
  background: #0b1a2e;
  color: var(--fg);
  font-size: calc(12px * var(--app-font-scale, 1));
}
.fsu-ministry-chip-on,
.fsu-pub-filter-on {
  border-color: #3b82f6;
  background: #1e3a5f;
  color: #dbeafe;
}
.fsu-pub-search {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2a4a6e;
  background: #0b1a2e;
  color: var(--fg);
  font-size: calc(14px * var(--app-font-scale, 1));
}
.fsu-pub-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 42vh;
  overflow-y: auto;
}
.fsu-pub-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2a4a6e;
  background: #0f2238;
  color: var(--fg);
  cursor: pointer;
}
.fsu-pub-row:hover { border-color: #3b82f6; }
.fsu-pub-name { font-weight: 600; grid-column: 1; }
.fsu-pub-user { color: var(--muted); font-size: calc(12px * var(--app-font-scale, 1)); grid-column: 2; grid-row: 1; }
.fsu-pub-meta {
  grid-column: 1 / -1;
  color: #94a3b8;
  font-size: calc(11px * var(--app-font-scale, 1));
}

.guest-picker-dialog { max-width: min(480px, 94vw); }
.guest-picker-form { padding: 16px; margin: 0; }
.guest-picker-title { margin: 0 0 4px; font-size: calc(17px * var(--app-font-scale, 1)); }
.guest-picker-sub { margin: 0 0 12px; font-size: calc(13px * var(--app-font-scale, 1)); }
.guest-picker-known-list {
  display: flex; flex-direction: column; gap: 6px;
  max-height: 40vh; overflow-y: auto; margin-bottom: 12px;
}
.guest-picker-known {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 2px solid #2a4a6e; background: #0f2238; color: var(--fg);
  cursor: pointer; text-align: left; width: 100%;
}
.guest-picker-known.selected { border-color: var(--accent); }
.guest-picker-name { font-size: calc(15px * var(--app-font-scale, 1)); font-weight: 600; }
.guest-picker-notes { font-size: calc(12px * var(--app-font-scale, 1)); color: var(--muted); }
.guest-picker-custom-label {
  display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px;
  font-size: calc(13px * var(--app-font-scale, 1));
}
.guest-picker-custom {
  min-height: 44px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid #2a4a6e; background: #0b1a2e; color: var(--fg);
  font-size: calc(15px * var(--app-font-scale, 1));
}
.admin-known-guest-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid #1e3a5f;
}
.admin-known-guest-row input[type="text"] {
  flex: 1 1 140px; min-height: 36px; padding: 6px 10px;
  border-radius: 8px; border: 1px solid #2a4a6e; background: #0b1a2e; color: var(--fg);
}
