*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* NCR brand — from noodlescaninerescue / ncr-site */
  --brand-purple: #4A1C6B;
  --brand-purple-deep: #3A1655;
  --brand-red: #C62828;
  --brand-red-hover: #A81F1F;
  --brand-cream: #F8F5F2;
  --brand-ink: #1A1A2E;

  /* Light mode surfaces */
  --bg: #F8F5F2;
  --surface: #FFFFFF;
  --surface2: #EEEAF2;
  --panel-muted: #F3EFF6;
  --border: rgba(26, 26, 46, 0.12);
  --info-border: #1A1A2E;
  --text: #1A1A2E;
  --muted: #4A4458;
  --accent: #4A1C6B;
  --accent-on: #FFFFFF;
  --accent-dim: #3A1655;
  --accent-light: #EDE6F4;
  --accent-fill: #4A1C6B;
  --accent-fill-dim: #3A1655;
  --live: #0F766E;
  --live-text: #0F766E;
  --ok: #0F766E;
  --warn: #92400E;
  --warn-fill: #B45309;
  --danger: #8A1F1F;
  --danger-fill: #C62828;
  --info: #1D4E89;
  --ring: #6B3FA0;
  --marker-camera: #0891b2;
  --marker-rvp: #6B3FA0;
  --map-canvas: #E4DDE8;
  --overlay: rgba(26, 26, 46, 0.4);
  --glass: rgba(255, 255, 255, 0.94);
  --shadow: 0 4px 20px rgba(26, 26, 46, 0.08);
  --focus: #4A1C6B;
  --font: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --text-caption: 0.6875rem;
  --text-label: 0.75rem;
  --text-body: 1rem;
  --text-title: 1.25rem;
  --text-display: 1.75rem;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --touch: 44px;
  --touch-lg: 48px;
  --z-toast: 1400;
  --z-modal: 1500;
  --map-h: calc(100dvh - 8.8rem);
  --app-chrome-h: 9.5rem;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

[data-theme="dark"] {
  --bg: #0E0C12;
  --surface: #1A1623;
  --surface2: #241E30;
  --panel-muted: #16121C;
  --border: rgba(201, 184, 220, 0.18);
  --info-border: #C9B8DC;
  --text: #F4F0F7;
  --muted: #C9B8DC;
  --accent: #C9B3E8;
  --accent-on: #0E0C12;
  --accent-dim: #E4D4F5;
  --accent-light: #2A1A38;
  --accent-fill: #4A1C6B;
  --accent-fill-dim: #3A1655;
  --live: #5EEAD4;
  --live-text: #5EEAD4;
  --ok: #5EEAD4;
  --warn: #F8D48B;
  --warn-fill: #D97706;
  --danger: #FF8A80;
  --danger-fill: #C62828;
  --info: #93C5FD;
  --ring: #C9B3E8;
  --map-canvas: #141018;
  --overlay: rgba(0, 0, 0, 0.6);
  --glass: rgba(26, 22, 35, 0.96);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --focus: #C9B3E8;
}

html {
  height: 100%;
  height: 100dvh;
}

html,
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.5;
  font-weight: 400;
}

h1, h2, h3 {
  font-weight: 600;
}

h1, h2 {
  font-size: var(--text-title);
  line-height: 1.4;
}

h3 {
  font-size: 1rem;
  line-height: 1.4;
}

.hint,
.muted-line,
.brand-sub,
.topbar-title .brand-sub,
.home-duty-meta,
time, .timestamp {
  font-size: var(--text-caption);
  line-height: 1.45;
  font-weight: 500;
}

label,
.login-form label,
.home-duty-field,
.phone-tab,
.nav-btn,
.tab,
.beta-badge {
  font-weight: 600;
}

#loginUser,
.webhook-apps-script,
.w3w-row input,
input[name="w3w"],
input[id*="w3w" i],
input[id*="callsign" i],
.login-form input[autocomplete="username"] {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.54;
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

button,
.btn,
.nav-btn,
.nav-dropdown-item,
.phone-tab,
.phone-sheet-item,
.login-tab,
.display-choice button,
.task-manager-nav button,
.admin-section-nav button,
.notify-btn,
.online-toggle,
.view-mode-btn,
.map-icon-btn,
.map-dock-btn,
select,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="url"],
textarea {
  min-height: var(--touch);
  box-sizing: border-box;
}

#homeBookOnBtn,
#taskGateAccept,
[data-task-scene="join"],
[data-task-report="help"],
.task-now .task-report-help,
.task-now [data-task-scene="join"] {
  min-height: var(--touch-lg);
}

body:not(.login-page) {
  display: flex;
  flex-direction: column;
  height: var(--app-vh, 100dvh);
  max-height: var(--app-vh, 100dvh);
  overflow: hidden;
}

body.login-page {
  min-height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.35rem 0.75rem;
  min-height: 52px;
  padding: 0.25rem 0.75rem;
  margin: 0.25rem 0.5rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  flex-shrink: 0;
  /* Above app-nav so Alerts / Online menus are not covered */
  z-index: 1400;
  position: relative;
}

.topbar .brand-logo,
.topbar .brand-logo-link {
  width: 36px;
  height: 36px;
}

.topbar .btn,
.topbar .notify-btn,
.topbar .online-toggle,
.topbar .view-mode-btn {
  min-height: var(--touch);
  min-width: var(--touch);
}

.topbar-create-job {
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.admin-teams-fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

.admin-teams-fieldset legend {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0 0.25rem;
}

.webhook-apps-script {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.35;
  padding: 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2, #0b1220);
  color: var(--text);
  resize: vertical;
  margin: 0.35rem 0 0.6rem;
}

.webhook-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.topbar-start {
  display: flex;
  align-items: center;
  justify-self: start;
}

.topbar-title {
  text-align: center;
  min-width: 0;
  justify-self: center;
  padding: 0 0.25rem;
}

.topbar-title {
  min-width: 0;
  overflow: hidden;
}

.app-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-title .brand-sub {
  font-size: 0.68rem;
  margin-top: 0.12rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo-link {
  flex-shrink: 0;
  display: block;
  line-height: 0;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent-light);
  box-shadow: 0 1px 4px rgba(76, 29, 149, 0.15);
}

.brand-logo-link:hover {
  border-color: var(--accent);
}

.brand-logo {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  object-fit: cover;
  background: var(--surface2);
}

.brand h1 {
  font-size: 1rem;
  font-weight: 600;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.brand-sub.ok {
  color: var(--ok);
}

.topbar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  position: relative;
}

.view-mode-toggle {
  margin-left: 0.4rem;
}

.view-mode-btn {
  font-size: 0.7rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--border);
  background: var(--glass);
  white-space: nowrap;
}

.view-mode-btn:hover {
  background: var(--surface2);
}

body.view-mobile .view-mode-btn {
  background: var(--accent-fill);
  color: #fff;
  border-color: var(--accent);
}

/* =========================================
   VIEW MODE OVERRIDES (Desktop vs Mobile)
   Toggle via the prominent button in topbar
   ========================================= */

body.view-desktop {
  /* Denser desktop experience */
  --base-font-size: 15px;
  font-size: 15px;
  line-height: 1.4667;
}

body.view-mobile {
  /* Touch-friendly, simplified mobile experience */
  --base-font-size: 16px;
  font-size: 16px;
  line-height: 1.5;
}

/* Navigation adaptations */
body.view-mobile .app-nav {
  padding: 0.25rem 0.4rem;
}

body.view-mobile .nav-tier-primary {
  gap: 0.15rem;
}

body.view-mobile .nav-tier-secondary {
  font-size: 0.82rem;
}

body.view-mobile .nav-tier-tabs .tab {
  padding: 0.35rem 0.5rem;
  min-height: var(--touch);
}

/* In mobile view, keep the ops nav but make it more scannable */
body.view-mobile .nav-tier-label {
  display: none;
}

body.view-mobile .nav-tier-tabs {
  gap: 0.1rem;
}

/* Map tools: on mobile mode prefer bottom access */
body.view-mobile .map-menu-toggle {
  bottom: 0.5rem;
  top: auto;
  left: 0.5rem;
  z-index: 650;
}

body.view-mobile .map-tools-menu {
  position: fixed;
  bottom: 3.2rem;
  left: 0.5rem;
  right: 0.5rem;
  top: auto;
  max-height: 55vh;
  border-radius: 12px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.25);
}

/* Make dialogs and panels feel more mobile-native in view-mobile */
body.view-mobile dialog.dialog {
  width: 96%;
  max-width: none;
  margin: 4vh auto;
  border-radius: 14px;
}

body.view-mobile .ops-panel.card {
  margin-bottom: 0.75rem;
}

/* Job editor and dispatch get more breathing room on mobile mode */
body.view-mobile .job-form-grid,
body.view-mobile .job-unit-picker {
  gap: 0.4rem;
}

body.view-mobile .job-unit-list {
  min-height: 110px;
}

/* Desktop mode keeps things compact and side-by-side friendly */
body.view-desktop .map-tools-menu {
  top: 0.5rem;
  left: 3.85rem;
  max-height: calc(100% - 1rem);
}

body.view-desktop #mappingMapView:has(#mapQuickActions:not([hidden])) .map-tools-menu {
  top: 3.15rem;
  max-height: calc(100% - 3.65rem);
}

body.view-desktop .nav-tier-tabs .tab {
  padding: 0.2rem 0.45rem;
}

.availability-select select {
  margin: 0;
  padding: 0.3rem 0.45rem;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 7.5rem;
}

.team-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}

.team-tab {
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.team-tab.active {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: #fff;
}

.panel-head {
  padding: 0.5rem 0.75rem 0;
}

.panel-head h2 {
  font-size: var(--text-title);
  line-height: 1.4;
  font-weight: 600;
  margin: 0;
}

.login-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg);
}

.login-card {
  width: min(420px, 100%);
}

.login-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.login-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  padding: 0.5rem 0.5rem;
  min-height: var(--touch);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
}

.login-tab.active {
  color: var(--accent);
  background: var(--surface-2);
}

.login-panel {
  display: none;
}

.login-panel.active {
  display: block;
}

.login-enroll-lead {
  margin: 0 0 0.85rem;
  font-size: 0.78rem;
  line-height: 1.45;
}

.login-field-hint {
  margin: -0.45rem 0 0.65rem;
  font-size: 0.72rem;
}

.login-teams-field {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin: 0 0 0.75rem;
}

.login-teams-field legend {
  font-size: 0.78rem;
  padding: 0 0.25rem;
}

.login-teams-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.login-team-chip {
  font-size: 0.78rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 1rem;
}

.login-org-title {
  font-size: var(--text-title);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.login-app-title {
  font-size: var(--text-title);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.login-logo {
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 0.5rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  font-size: var(--text-label);
  line-height: 1.35;
}

.login-form input,
.login-form select {
  margin: 0;
}

.login-form select {
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
}

.btn-block {
  width: 100%;
}

.login-success {
  color: #3d9a6a;
  font-size: 0.9rem;
  margin: 0.35rem 0 0.5rem;
  line-height: 1.35;
}

.login-dev-link {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: 8px;
  background: rgba(0, 180, 216, 0.08);
  border: 1px solid rgba(0, 180, 216, 0.25);
  word-break: break-all;
}

.login-reset-url {
  color: var(--accent, #00b4d8);
  font-size: 0.85rem;
  font-weight: 600;
}

.login-tabs {
  flex-wrap: wrap;
}

.login-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin: 0 0 0.5rem;
}

.login-foot {
  margin-top: 1rem;
  text-align: center;
}

.ops-panel {
  margin: 0.75rem;
}

.ops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.ops-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.ops-item {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  overflow: hidden;
}

.ops-item.ops-item-priority-urgent {
  border-color: #b91c1c;
}

.ops-item.ops-item-priority-high {
  border-color: #c2410c;
}

.job-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: -0.55rem -0.65rem 0.5rem;
  padding: 0.45rem 0.65rem;
  color: #fff;
}

.job-card-title {
  font-size: 0.95rem;
  font-weight: 700;
}

.job-priority-pill {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  white-space: nowrap;
}

.job-priority-pill-inline {
  background: rgba(15, 23, 42, 0.12);
  color: inherit;
}

[data-theme="dark"] .job-priority-pill-inline {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
}

.job-card-header-priority-low {
  background: linear-gradient(90deg, #475569, #64748b);
}

.job-card-header-priority-normal {
  background: linear-gradient(90deg, #334155, #475569);
}

.job-card-header-priority-high {
  background: linear-gradient(90deg, #c2410c, #ea580c);
}

.job-card-header-priority-urgent {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

.job-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.ops-item.ops-item-archived {
  border-color: rgba(100, 116, 139, 0.35);
  background: var(--panel-muted);
}

.ops-item-archived .archive-closed-line {
  color: var(--muted);
}

.dispatch-jobs-card .dispatch-subtabs {
  display: flex;
  gap: 0.25rem;
  margin: 0.5rem 0 0.75rem;
  border-bottom: 1px solid var(--border);
}

.dispatch-subtab {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.dispatch-subtab:hover {
  color: var(--text);
}

.dispatch-subtab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.dispatch-jobs-panel {
  display: none;
}

.dispatch-jobs-panel.active {
  display: block;
}

.archive-search-label {
  display: block;
  margin: 0.5rem 0 0.35rem;
}

.archive-search-label input[type="search"] {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
}

.archive-meta {
  margin-bottom: 0.35rem;
}

.ops-list-archive .ops-item {
  opacity: 0.98;
}

.my-past-taskings-card {
  margin-top: 0.75rem;
}

.my-task-card-past {
  border-color: rgba(100, 116, 139, 0.3);
  background: var(--panel-muted);
}

.my-task-status-closed {
  /* Colours and marks come from .status-pill--closed */
}

.ops-meta {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.ops-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.admin-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.check-chip {
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.map-context-menu {
  position: absolute;
  z-index: 700;
  display: flex;
  flex-direction: column;
  min-width: 240px;
  max-width: min(320px, 92vw);
  max-height: min(70vh, 520px);
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  overflow: hidden;
}

.map-context-menu[hidden] {
  display: none !important;
}

.map-ctx-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  background: var(--accent-light);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

.map-ctx-head-back,
.map-ctx-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
}

.map-ctx-head-text {
  flex: 1 1 auto;
  min-width: 0;
}
.map-ctx-head:active {
  cursor: grabbing;
}
.map-ctx-head .map-ctx-close {
  cursor: pointer;
}

.map-ctx-head-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.map-ctx-coords {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.map-ctx-hint {
  font-size: 0.68rem;
  color: var(--muted);
  padding: 0.35rem 0.65rem 0.25rem;
  margin: 0;
}

.map-ctx-view {
  padding: 0.2rem 0 0.35rem;
}

.map-ctx-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.map-ctx-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text);
}

.map-ctx-item:hover {
  background: var(--accent-light);
}

.map-ctx-muted-action {
  color: var(--muted);
  font-size: 0.72rem;
}

.map-ctx-back,
.map-ctx-head-back {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 0.4rem 0.65rem;
  border: none;
  background: transparent;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  font-weight: 650;
}

.map-ctx-head-back {
  width: auto;
  justify-content: center;
  padding: 0;
  font-size: 1.15rem;
}

.map-ctx-back:hover {
  background: var(--accent-light);
}

.map-ctx-panel-title {
  font-size: 0.82rem;
  padding: 0.25rem 0.65rem 0.35rem;
  margin: 0;
  color: var(--accent);
}

.map-ctx-panel-body {
  padding: 0 0.65rem 0.5rem;
}

.map-ctx-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.5rem;
  font-size: 0.7rem;
}

.map-ctx-field input,
.map-ctx-field select,
.map-ctx-field textarea {
  margin: 0;
  font-size: 0.78rem;
}

.map-ctx-field textarea {
  min-height: 3rem;
  resize: vertical;
}

.map-ctx-readonly {
  background: var(--surface2);
  color: var(--muted);
}

.map-ctx-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.45rem 0.65rem 0.55rem;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.map-ctx-foot .btn {
  min-height: 44px;
}

.map-ctx-backdrop {
  display: none;
}

.map-layer-sheet {
  position: fixed;
  inset: 0;
  z-index: 1680;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.map-layer-sheet[hidden] {
  display: none !important;
}

.map-layer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: var(--overlay, rgba(15, 23, 42, 0.45));
}

.map-layer-card {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  max-height: min(78dvh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.28);
}

.map-layer-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  touch-action: none;
}

.map-layer-head-text {
  flex: 1 1 auto;
  min-width: 0;
}

.map-layer-kicker {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-layer-head h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.map-layer-back,
.map-layer-close {
  flex: 0 0 auto;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.map-layer-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 0.75rem 0.85rem 1rem;
}

.map-layer-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0 0 0.7rem;
  font-size: 0.82rem;
  font-weight: 650;
}

.map-layer-field input,
.map-layer-field textarea,
.map-layer-field select {
  min-height: 44px;
  font-weight: 500;
}

.map-layer-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin-top: 0.45rem;
  text-align: center;
  text-decoration: none;
}

.map-layer-danger {
  color: var(--danger, #b91c1c);
  border-color: var(--danger, #b91c1c);
  background: transparent;
}

.map-layer-status {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.82rem;
}

.map-layer-status.is-error {
  color: var(--danger, #b91c1c);
}

.map-layer-meta {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.map-layer-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.map-layer-eye {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.map-layer-open {
  flex: 1 1 auto;
  min-height: 44px;
  text-align: left;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted, var(--surface2));
  color: var(--text);
  cursor: pointer;
}

.map-layer-open strong,
.map-layer-open span {
  display: block;
}

.map-layer-open span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.map-layer-request {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.45rem;
}

.home-safety-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
}

.home-safety-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  cursor: pointer;
}

.home-safety-card strong {
  font-size: 1rem;
}

.home-safety-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.leaflet-tooltip.map-layer-tip {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-weight: 650;
  box-shadow: none;
}

.marker-job {
  width: 14px;
  height: 14px;
  background: #b45309;
  border: 2px solid #fff;
  border-radius: 3px;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Distinct marker for IC "go-to / location tasking" pins (different from regular jobs) */
.marker-goto-task {
  width: 16px;
  height: 16px;
  background: #0e7490; /* teal/cyan for tasking */
  border: 2px solid #f0f9ff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  position: relative;
}
.marker-goto-task::after {
  content: "📍";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  font-size: 9px;
  line-height: 1;
  color: white;
  text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}

.online-menu-wrap {
  position: relative;
}

.online-toggle {
  background: var(--surface2);
  color: var(--text);
  min-width: 6.5rem;
}

.online-popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 2000;
  min-width: 200px;
  max-width: 280px;
  max-height: 50vh;
  overflow-y: auto;
  background: var(--glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.6rem 0.65rem;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.15);
}

.online-popover h3 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.online-popover-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.online-popover-list li {
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.online-popover-list li.self {
  color: var(--accent);
  font-weight: 500;
}

.online-popover-list .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
}

.online-popover-list .status-dot.off {
  background: #94a3b8;
}

.app-nav {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  /* Must sit above .panels so absolute/fixed menus are clickable */
  z-index: 1200;
  position: relative;
  gap: 0.35rem;
  padding: 0.2rem 0.4rem;
}

.app-nav .nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
}

.app-nav .nav-btn:hover {
  background: var(--accent-light);
}

.app-nav .nav-btn.active {
  background: var(--accent-fill);
  color: white;
  border-color: var(--accent);
}

.app-nav .nav-group {
  position: relative;
}

.app-nav .nav-dropdown {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.3rem;
  z-index: 1300;
  min-width: 180px;
  display: none;
}

/* UA [hidden] uses display:none !important — beat it when .open is set */
.app-nav .nav-dropdown[hidden] {
  display: none !important;
}

.app-nav .nav-dropdown.open:not([hidden]) {
  display: block !important;
  visibility: visible !important;
  pointer-events: auto;
}

/* Ensure sub menu items are always in a horizontal row as requested */
.app-nav .nav-dropdown-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.app-nav .nav-dropdown-row {
  display: flex;
  flex-direction: row;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.app-nav .nav-dropdown-item {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}

.app-nav .nav-dropdown-item:hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

.app-nav .nav-dropdown-item.active {
  background: var(--accent-fill);
  color: white;
  border-color: var(--accent);
}

.app-nav .nav-dropdown-item.dispatch-only,
.app-nav .nav-dropdown-item.admin-only {
  font-weight: 500;
}

.nav-tier-primary {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.nav-tier-primary .tab {
  flex: 0 0 auto;
  min-width: 5.5rem;
  padding: 0.55rem 1rem;
}

.nav-tier-secondary {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.5rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--panel-muted);
}

.nav-tier-secondary[hidden] {
  display: none !important;
}

.nav-tier-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 0.15rem 0.35rem;
  flex: 0 0 auto;
}

.nav-tier-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  flex: 1 1 auto;
}

.nav-tier-secondary .tab {
  flex: 0 0 auto;
  padding: 0.4rem 0.65rem;
  font-size: 0.72rem;
  border-bottom: 2px solid transparent;
}

.nav-tier-admin {
  border-top: 1px dashed var(--border);
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 0;
}

.nav-tier-admin .nav-tier-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.55rem;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.nav-tier-admin .nav-tier-toggle:hover {
  background: var(--surface);
}

.nav-tier-admin .nav-tier-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.nav-tier-admin .nav-tier-chevron {
  margin-left: auto;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}

.nav-tier-admin.is-collapsed .nav-tier-chevron {
  transform: rotate(-45deg);
}

.nav-tier-admin .nav-admin-active-hint {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}

.nav-tier-admin.is-collapsed .nav-tier-tabs {
  display: none;
}

.nav-tier-admin:not(.is-collapsed) .nav-tier-tabs {
  padding: 0 0.45rem 0.4rem;
}

.administration-panel {
  padding: 0.65rem 0.75rem 1rem;
  max-width: 52rem;
  margin: 0 auto;
}

.admin-subhead {
  margin: 0.75rem 0 0.35rem;
  font-size: 0.85rem;
}

.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: var(--touch);
}

.perm-marker-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.marker-permanent {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  padding: 0.7rem;
  min-height: var(--touch);
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  touch-action: manipulation;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-badge {
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.62rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  margin-left: 0.2rem;
  font-weight: 700;
}

#panel-communications,
#commPanelDm {
  background: var(--bg);
}

.dm-layout {
  display: flex;
  height: 100%;
  min-height: 0;
}

.dm-directory {
  width: min(220px, 32vw);
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dm-directory-head {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.dm-directory-head h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.dm-directory-search {
  width: 100%;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
}

.dm-directory-list,
.dm-thread-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
}

.dm-directory-item,
.dm-thread-item {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}

.dm-directory-item:hover,
.dm-thread-item:hover {
  background: var(--accent-light);
}

.dm-directory-item.active,
.dm-thread-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
}

.dm-directory-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  margin-right: 0.35rem;
  vertical-align: middle;
}

.dm-directory-dot.online {
  background: #16a34a;
}

.dm-directory-name,
.dm-thread-name {
  font-size: 0.82rem;
  font-weight: 600;
}

.dm-directory-meta,
.dm-thread-preview {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dm-folders {
  width: min(200px, 30vw);
  border-right: 1px solid var(--border);
  background: #fafafa;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dm-folder-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.dm-folder-tab {
  flex: 1;
  min-width: 4.5rem;
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  padding: 0.3rem 0.35rem;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  color: var(--muted);
}

.dm-folder-tab.active {
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
}

.dm-folder-badge {
  margin-left: 0.2rem;
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.58rem;
  padding: 0.05rem 0.3rem;
  border-radius: 999px;
}

.dm-unread {
  float: right;
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.6rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.dm-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.dm-chat-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
}

.dm-back {
  padding: 0.2rem 0.45rem;
}

.dm-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem 0.75rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dm-msg {
  max-width: 88%;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.dm-msg.mine {
  align-self: flex-end;
  background: var(--accent-light);
  border-color: rgba(76, 29, 149, 0.2);
}

.dm-msg .dm-meta {
  font-size: 0.65rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.dm-msg .dm-action-btn,
.dm-msg .dm-loc-btn {
  margin-top: 0.35rem;
  margin-right: 0.35rem;
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.dm-compose-tools,
.chat-compose-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  width: 100%;
  margin-bottom: 0.25rem;
}

.dm-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.dm-form input {
  flex: 1;
  min-width: 8rem;
  margin: 0;
}

.chat-form {
  flex-wrap: wrap;
}

.team-member-btn {
  cursor: pointer;
}

.team-member-btn:hover {
  text-decoration: underline;
  color: var(--accent);
}

.map-team-list .team-member-btn {
  flex: 1;
}

.user-action-dialog .user-action-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.user-action-dialog .user-action-buttons .btn {
  width: 100%;
}

@media (max-width: 640px) {
  #panel-communications.panel.active {
    min-height: 0;
    overflow: hidden;
    touch-action: pan-y;
  }

  .dm-layout {
    flex-direction: column;
    min-height: 0;
    flex: 1;
  }

  .dm-directory,
  .dm-folders {
    width: 100%;
    max-height: 38dvh;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .dm-directory.hide-mobile,
  .dm-folders.hide-mobile {
    display: none;
  }

  .dm-chat.hide-mobile {
    display: none;
  }
}

.panels {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  overflow: hidden;
  padding: 0.5rem;
  box-sizing: border-box;
}

.panel {
  display: none;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  margin: 0.25rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  background: var(--surface);
  overflow: hidden;
}

.panel.active {
  display: flex;
}

.panel.scroll-panel.active {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

#panel-mapping {
  position: relative;
  flex-direction: column;
  min-height: 0;
}

#panel-mapping.panel.active {
  display: flex;
}

#mappingMapView.mapping-view.active {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}

#mappingMapView #map {
  flex: 1;
  width: 100%;
  min-height: 240px;
  height: auto;
}

#panel-communications {
  background: var(--bg);
}

.scroll-panel {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.home-panel {
  padding: 0;
}

.home-dashboard {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0.65rem 0.75rem calc(1rem + env(safe-area-inset-bottom, 0px));
  gap: 0.75rem;
}

.home-dashboard-welcome {
  max-width: 56rem;
  margin: 0 auto;
}

.home-welcome-hero {
  padding: 0.85rem 1rem 0.9rem;
}

.home-welcome-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.home-welcome-title {
  margin: 0 0 0.45rem;
  font-size: 1.35rem;
  line-height: 1.2;
}

.home-welcome-lead {
  margin: 0 0 0.5rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}

.home-welcome-note {
  margin: 0;
  font-size: 0.78rem;
}

.home-search-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.search-picture-card,
.search-picture-duty,
.search-picture-waiting {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-picture-card + .search-picture-card,
.search-picture-duty,
.search-picture-waiting {
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.search-picture-kicker,
.search-picture-counts,
.search-picture-sightings {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.search-picture-card h3,
.search-picture-duty h3,
.search-picture-waiting h3 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
}

.search-picture-dog,
.search-picture-where,
.search-picture-brief,
.search-picture-owner,
.search-picture-plan,
.search-picture-prompt {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
}

.search-picture-confirm {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-picture-confirm p {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.search-picture-confirm .btn,
.recovery-plan .btn {
  width: 100%;
  min-height: 2.75rem;
}

.recovery-plan {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.recovery-plan .hint {
  margin: 0;
}

.recovery-ring-map {
  height: 220px;
  border-radius: 8px;
  overflow: hidden;
}

.search-picture-report {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  background: #f1f5f9;
  color: #1e293b;
}

.search-picture-report.is-eyes_on {
  background: #ecfdf5;
  color: #065f46;
}

.search-picture-report.is-help {
  background: #fff7ed;
  color: #9a3412;
}

.search-picture-checked {
  margin: 0;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  background: color-mix(in srgb, var(--live) 22%, var(--surface));
  color: var(--text);
}

.search-picture-caution {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.search-picture-card.is-waiting-on-you {
  padding: 0.7rem 0.75rem;
  border: 2px solid var(--warn);
  border-radius: 14px;
}

.search-picture-tasks {
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.search-picture-tasks li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.search-seat {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  font-size: var(--text-label);
}

.search-picture-away {
  margin: 0;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  background: #fff7ed;
  color: #9a3412;
}

.search-picture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.25rem;
}

.search-picture-actions .btn,
.search-picture-actions .search-map-link {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.dispatch-toast-actions a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.search-duty-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 16rem;
  overflow: auto;
}

.search-duty-list li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: var(--touch);
}

.search-waiting-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.search-waiting-list li {
  font-size: 0.9rem;
  line-height: 1.4;
}

.home-guide-layout {
  display: grid;
  grid-template-columns: 1fr min(17rem, 34%);
  gap: 0.65rem;
  align-items: start;
}

.home-guide-card h2 {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
}

.home-guide-card {
  padding: 0.75rem 0.85rem;
}

.home-steps {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.82rem;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.home-steps strong {
  color: var(--text);
}

.home-inline-link {
  font: inherit;
  font-weight: 600;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-inline-link:hover {
  color: var(--text);
}

.home-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.home-guide-tile {
  padding: 0.55rem 0.65rem;
}

.home-guide-tile h3 {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
}

.home-guide-tile p {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.home-guide-tile .btn {
  margin-top: 0.35rem;
}

.home-guide-dispatch-note {
  font-size: 0.65rem;
  font-style: italic;
  margin-bottom: 0.15rem !important;
}

.home-duty-central {
  max-width: 460px;
  margin: 1.25rem auto 0.5rem;
  padding: 0 0.5rem;
}

.home-duty-highlight {
  border: 2px solid color-mix(in srgb, var(--accent) 70%, var(--border));
  box-shadow: var(--shadow);
}

.home-duty-aside {
  position: sticky;
  top: 0.5rem;
  z-index: 1;
}

.home-widget-duty-main .home-duty-body {
  padding: 0.35rem 0.15rem 0.15rem;
}

.drone-hq-panel {
  padding: 0;
}

.drone-hq-dashboard {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem 0.85rem;
  min-height: min(100%, calc(100dvh - 7.5rem));
}

.drone-hq-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  min-height: 220px;
}

.drone-hq-top-row .home-adsb-wrap iframe {
  min-height: 200px;
}

.drone-hq-mid-row {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0.65rem;
  min-height: 280px;
}

.drone-hq-map-inset {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.35rem 0.35rem;
}

.drone-hq-map {
  height: 240px;
  min-height: 200px;
  border-radius: 8px;
  border: 1px solid var(--border);
  z-index: 0;
}

.drone-hq-map-hint {
  margin: 0 0.35rem;
  font-size: 0.65rem;
}

.drone-hq-assist-wrap iframe {
  width: 100%;
  min-height: 240px;
  height: 100%;
  border: 0;
  display: block;
}

.drone-hq-assist-note {
  margin: 0 0.5rem 0.4rem;
  font-size: 0.65rem;
}

.drone-hq-stream-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.65rem;
  padding: 0 0.5rem 0.5rem;
}

.drone-hq-stream-wrap {
  min-height: 200px;
}

.drone-hq-stream-info h3 {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
}

.drone-hq-stream-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.mono-break {
  word-break: break-all;
  font-size: 0.72rem;
}

.home-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 280px;
  align-items: stretch;
}

.home-widget {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.home-widget-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.home-widget-head h2 {
  font-size: 0.88rem;
  margin: 0;
}

.home-widget-link {
  font-size: 0.68rem;
  color: var(--accent);
  text-decoration: none;
}

.home-widget-link:hover {
  text-decoration: underline;
}

.home-widget-body {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
}

.home-adsb-wrap iframe,
.home-fr24-wrap iframe,
.home-fb-wrap iframe,
.home-radar-wrap iframe {
  width: 100%;
  height: 100%;
  min-height: 240px;
  border: 0;
  display: block;
}

.home-weather-stack {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  border: none;
  background: transparent;
}

.home-weather-compact {
  flex: 0 0 auto;
  padding: 0.4rem 0.5rem 0.35rem;
  border-bottom: 1px solid var(--border);
}

.home-air-info {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0.5rem 0.4rem;
  overflow: hidden;
}

.home-air-info-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.home-air-info-head h3 {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
}

.home-air-info-meta {
  font-size: 0.65rem;
  margin: 0 0 0.2rem;
}

.home-notam-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.home-notam-item {
  padding: 0.3rem 0.35rem;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.home-notam-id {
  margin: 0 0 0.1rem;
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--muted);
}

.home-notam-text {
  margin: 0;
  font-size: 0.7rem;
  line-height: 1.35;
}

.home-notam-valid {
  margin: 0.15rem 0 0;
  font-size: 0.62rem;
}

.home-air-info-foot {
  flex: 0 0 auto;
  margin: 0.25rem 0 0;
  font-size: 0.6rem;
  line-height: 1.3;
}

.home-weather-loc-label {
  font-size: 0.72rem;
}

.home-weather-loc-label select {
  font: inherit;
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  max-width: 11rem;
}

.home-weather-body {
  padding: 0.5rem 0.55rem;
  overflow: auto;
}

.home-weather-now {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.25rem;
}

.home-weather-place {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.home-weather-temp {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}

.home-weather-desc {
  font-size: 0.68rem;
  color: var(--muted);
  margin: 0;
}

.home-weather-days {
  list-style: none;
  font-size: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin: 0;
  padding: 0;
}

.home-weather-days li {
  display: flex;
  justify-content: space-between;
  gap: 0.35rem;
}

.home-weather-day-name {
  font-weight: 600;
  flex: 0 0 auto;
}

.home-weather-day-detail {
  text-align: right;
  color: var(--muted);
}

.home-duty-body {
  padding: 0.15rem 0;
}

.home-duty-status {
  font-size: 0.88rem;
  margin: 0.35rem 0 0.5rem;
  font-weight: 600;
}

.home-duty-on {
  color: var(--ok);
}

.home-duty-off {
  color: var(--muted);
}

.home-duty-meta {
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
}

.home-duty-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
}

.home-duty-field[hidden],
#homeBookOnFields[hidden] {
  display: none !important;
}

.home-duty-field select {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  pointer-events: auto;
  position: relative;
  z-index: 2;
  background: var(--surface);
  color: var(--text);
  /* Keep native OS dropdown arrow — appearance:none elsewhere made these look dead */
  appearance: auto;
  -webkit-appearance: menulist;
}

.home-duty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.home-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem 0.85rem;
  padding: 0.15rem 0 0.2rem;
}

.home-status-grid span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-status-card.home-widget {
  overflow: visible;
  flex-shrink: 0;
  min-height: auto;
}

.home-status-grid strong {
  display: block;
  margin-top: 0.12rem;
  font-size: 1.2rem;
  line-height: 1.25;
  color: var(--text);
}

.my-task-actions .btn.is-selected {
  outline: 2px solid var(--accent, #0f766e);
  outline-offset: 1px;
}

.home-book-on-error {
  margin-top: 0.5rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.8rem;
  line-height: 1.35;
}

.map-restricted-hint {
  margin: 0.35rem 0.75rem 0;
  padding: 0.4rem 0.55rem;
  background: #fffbeb;
  border: 1px solid #ca8a04;
  border-radius: 8px;
  font-size: 0.78rem;
}

.home-widget-docs {
  min-height: 120px;
}

.home-docs-hint {
  font-size: 0.65rem;
  margin: 0;
}

.home-docs-ticker {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  overflow: hidden;
  margin-top: 0.35rem;
  padding: 0.55rem 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  min-height: 3.25rem;
}

.home-docs-ticker-inner {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  padding-left: 100%;
  animation: home-docs-ticker 45s linear infinite;
}

.home-docs-ticker:hover .home-docs-ticker-inner {
  animation-play-state: paused;
}

@keyframes home-docs-ticker {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-100%);
  }
}

.home-docs-ticker-item {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 0 0.15rem;
}

.home-docs-ticker-item:hover {
  text-decoration: underline;
}

.home-docs-sep {
  color: var(--muted);
  padding: 0 0.5rem;
  font-size: 0.75rem;
}

.home-ops-bottom {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding-top: 0.25rem;
}

.home-ops-grid {
  display: grid;
  gap: 0.65rem;
  width: 100%;
  max-width: 920px;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
}

.integrations-subhead {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.integrations-form label.span-2 textarea {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}

@media (max-width: 960px) {
  .home-top-row {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .home-adsb-wrap iframe,
  .home-fb-wrap iframe,
  .home-radar-wrap iframe {
    min-height: 320px;
  }
  .drone-hq-top-row,
  .drone-hq-mid-row,
  .drone-hq-stream-grid {
    grid-template-columns: 1fr;
  }
  .drone-hq-map {
    height: 220px;
  }
  .home-guide-layout {
    grid-template-columns: 1fr;
  }
  .home-duty-aside {
    position: static;
  }
  .home-guide-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .home-ops-grid {
    grid-template-columns: 1fr;
  }
}

.home-grid {
  display: grid;
  gap: 0.75rem;
  padding: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.home-card h2 {
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.home-stats dt {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--muted);
}

.home-stats dd {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.compact-list .ops-item {
  padding: 0.45rem 0;
}

.ops-item-compact {
  padding: 0.4rem 0 !important;
}

.sub-tabs {
  display: flex;
  gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sub-tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.sub-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.comm-panel {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.comm-panel.active {
  display: flex;
}

.comm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.channel-select select {
  margin: 0;
  font-size: 0.78rem;
  min-width: 10rem;
}

.channel-select-wide select {
  min-width: min(100%, 18rem);
  max-width: 100%;
}

.mapping-view {
  display: none;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.mapping-view.active {
  display: flex;
}

.mapping-subtabs {
  flex-shrink: 0;
}

#mappingStreamView .stream-wrap {
  flex: 1;
  min-height: 200px;
}

.dispatch-avail-card {
  margin: 0.75rem 0.75rem 0;
}

.availability-select-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.availability-select-block select {
  margin: 0;
  max-width: 100%;
}

.availability-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.availability-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  line-height: 1.1;
  padding: 0.28rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color .1s ease, color .1s ease, background .1s ease;
  -webkit-tap-highlight-color: transparent;
}
.availability-btn:hover {
  border-color: var(--muted);
}
.availability-btn .availability-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08) inset;
}

.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
}

.account-info dd {
  font-weight: 500;
}

.job-editor-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}

.job-editor-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 0.4rem 0.35rem;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
}

.job-editor-tab:hover {
  color: var(--text);
  background: rgba(148, 163, 184, 0.12);
}

.job-editor-tab.active {
  color: var(--accent);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.job-editor-panel {
  display: none;
}

.job-editor-panel.active {
  display: block;
}

.job-map-links {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  margin-top: 0.65rem;
}

.job-map-links legend {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
}

.job-map-link-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0.5rem;
}

.job-map-default {
  display: inline-flex;
  margin-right: 0.65rem;
  font-size: 0.7rem;
}

#w3wKeyStatus.w3w-status-ok {
  color: var(--ok, #15803d);
}

#w3wKeyStatus.w3w-status-warn {
  color: var(--warn, #b45309);
}

.job-dog-upload-row {
  margin: 0.5rem 0;
}

.job-dog-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.job-dog-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
  background: var(--surface);
}

.job-dog-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.job-dog-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 1.4rem;
  padding: 0.1rem 0.25rem;
  font-size: 0.7rem;
  line-height: 1;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  border: none;
  cursor: pointer;
}

.job-dialog {
  width: min(600px, 96vw);
  max-height: 90vh;
  border: none;
  border-radius: 12px;
  padding: 0;
}

.job-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.job-dialog form {
  padding: 1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.job-intake-box {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.job-intake-box h3 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
}

.job-intake-list {
  list-style: none;
  margin: 0.45rem 0;
  padding: 0;
}

.job-intake-item {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-top: 1px solid var(--border);
}

.job-intake-item p {
  margin: 0.1rem 0 0;
}

.job-intake-item .btn {
  flex: 0 0 auto;
}

.job-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.65rem;
}

.job-form-grid .span-2 {
  grid-column: 1 / -1;
}

.job-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.72rem;
}

.job-form-grid input,
.job-form-grid select,
.job-form-grid textarea {
  margin: 0;
  font-size: 0.8rem;
}

.job-assets-field {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  margin: 0;
}

.job-assets-field legend {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.25rem;
}

.job-assets-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-top: 0.35rem;
}

.job-unit-picker {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem;
  align-items: center;
}

.job-unit-picker-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.job-unit-list {
  width: 100%;
  min-height: 8.5rem;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.job-unit-picker-arrows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 1.4rem;
}

.job-unit-arrow {
  min-width: 2.25rem;
  font-size: 1rem;
  line-height: 1;
  padding: 0.35rem 0.5rem;
}

@media (max-width: 560px) {
  .job-unit-picker {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .job-unit-picker-arrows {
    flex-direction: row;
    justify-content: center;
    padding-top: 0;
  }
}

.job-form-grid select[multiple] {
  min-height: 5rem;
}

.map-pick-banner {
  position: absolute;
  z-index: 460;
  top: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: #5b21b6;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(91, 33, 182, 0.35);
  max-width: min(420px, 92vw);
}

.map-pick-banner[hidden] {
  display: none !important;
}

.map-closure-banner {
  background: #b91c1c;
  box-shadow: 0 4px 14px rgba(185, 28, 28, 0.35);
  z-index: 680;
}

.map-diversion-banner {
  position: absolute;
  z-index: 670;
  top: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  max-width: min(420px, 92vw);
  text-align: center;
  pointer-events: none;
}

.map-diversion-banner[hidden] {
  display: none !important;
}

.map-diversion-warn {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fdba74;
  box-shadow: var(--shadow);
}

.map-diversion-ok {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #6ee7b7;
  box-shadow: var(--shadow);
}

.map-diversion-bad {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  box-shadow: var(--shadow);
}

[data-theme="dark"] .map-diversion-warn {
  background: #431407;
  color: #fdba74;
}

[data-theme="dark"] .map-diversion-ok {
  background: color-mix(in srgb, var(--live) 18%, var(--surface));
  color: var(--live);
}

[data-theme="dark"] .map-diversion-bad {
  background: #450a0a;
  color: #fca5a5;
}

.closure-remove-btn {
  margin-top: 0.45rem;
  width: 100%;
}

.map-ctx-snap-hint {
  color: var(--accent);
  font-weight: 600;
}

.marker-job-pick {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #5b21b6;
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.45);
  animation: marker-ping 1.2s ease infinite;
}

.job-pick-map-row {
  margin-top: 0.35rem;
}

.job-pick-map-row .hint {
  margin: 0.35rem 0 0;
}

.map-context-badge {
  position: absolute;
  z-index: 450;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  pointer-events: none;
}

.map-quick-actions {
  position: absolute;
  z-index: 460;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  max-width: min(100%, 20rem);
}

.map-quick-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.map-quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.map-quick-btn.active {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: #fff;
}

.marker-archived-job {
  width: 20px;
  height: 20px;
  background: var(--archived-job-color, #475569);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.marker-archived-job-urgent {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.45), 0 2px 8px rgba(0, 0, 0, 0.35);
}

.marker-archived-job-high {
  box-shadow: 0 0 0 2px rgba(234, 88, 12, 0.4), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.leaflet-tooltip.map-tasking-tooltip-pane {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: min(320px, 90vw);
}

.map-tasking-tooltip {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
  background: var(--surface);
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
}

.map-tasking-tooltip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.4rem 0.55rem;
  color: #fff;
}

.map-tasking-tooltip-priority-low .map-tasking-tooltip-head {
  background: linear-gradient(90deg, #475569, #64748b);
}

.map-tasking-tooltip-priority-normal .map-tasking-tooltip-head {
  background: linear-gradient(90deg, #334155, #475569);
}

.map-tasking-tooltip-priority-high .map-tasking-tooltip-head {
  background: linear-gradient(90deg, #c2410c, #ea580c);
}

.map-tasking-tooltip-priority-urgent .map-tasking-tooltip-head {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

.map-tasking-tooltip-head strong {
  font-size: 0.82rem;
  font-weight: 700;
}

.map-tasking-tooltip-head .job-priority-pill {
  font-size: 0.58rem;
  padding: 0.08rem 0.35rem;
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.map-tasking-tooltip-body {
  padding: 0.45rem 0.55rem 0.5rem;
  color: var(--text);
}

.map-tasking-tooltip-status {
  display: block;
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.map-tasking-tooltip-loc,
.map-tasking-tooltip-desc,
.map-tasking-tooltip-meta {
  margin: 0.2rem 0 0;
  font-size: 0.72rem;
}

.map-tasking-tooltip-desc {
  color: var(--text);
}

.map-tasking-tooltip-body .my-task-status-pill {
  display: inline-block;
  margin-top: 0.35rem;
}

#mappingMapView {
  position: relative;
}

.marker-alert {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f59e0b;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5);
  animation: marker-ping 1.5s ease infinite;
}

.map-draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  margin: 0.4rem 0;
}

.map-draw-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  margin-right: 0.25rem;
}

.map-draw-btn.active {
  background: var(--accent-fill);
  color: #fff;
}

.map-plans-subhead {
  font-size: 0.75rem;
  margin: 0.65rem 0 0.35rem;
  color: var(--muted);
}

.map-plans-list {
  list-style: none;
  max-height: 140px;
  overflow-y: auto;
}

.map-plan-item {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.map-plan-item.active {
  background: rgba(91, 33, 182, 0.06);
}

.map-plan-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.job-log-section {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
}

.job-log-feed {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.job-log-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  border-left-width: 4px;
  background: var(--surface);
}

.job-log-type-note {
  border-left-color: #6366f1;
}
.job-log-type-chat {
  border-left-color: #0ea5e9;
}
.job-log-type-status {
  border-left-color: #22c55e;
}
.job-log-type-location {
  border-left-color: #f59e0b;
}
.job-log-type-image {
  border-left-color: #ec4899;
}
.job-log-type-map {
  border-left-color: #8b5cf6;
}
.job-log-type-system {
  border-left-color: #94a3b8;
}
.job-log-type-edit {
  border-left-color: #64748b;
}

.job-log-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
  color: var(--muted);
}

.job-log-type-badge {
  font-weight: 700;
  color: var(--text);
}

.job-log-who {
  margin-left: auto;
  font-weight: 600;
}

.job-log-message {
  font-size: 0.82rem;
  margin: 0.25rem 0;
  white-space: pre-wrap;
}

.job-log-image {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  margin-top: 0.35rem;
  border: 1px solid var(--border);
}

.job-log-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.35rem 0;
}

.job-log-file-btn {
  cursor: pointer;
  margin: 0;
}

.job-log-status-pill {
  margin-bottom: 0.25rem;
}

.job-log-section h3 {
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.job-log-list {
  list-style: none;
  max-height: 160px;
  overflow-y: auto;
  margin-bottom: 0.5rem;
}

.job-log-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}

.job-log-item time {
  font-weight: 600;
  display: block;
}

.job-log-meta {
  color: var(--muted);
  font-size: 0.68rem;
}

.job-log-add textarea {
  width: 100%;
  margin-bottom: 0.35rem;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  margin-bottom: 0.4rem;
}

.app-nav .nav-ops.tab,
.app-nav .nav-admin.tab {
  font-size: 0.72rem;
}

#map {
  height: var(--map-h);
  width: 100%;
  z-index: 0;
  background: var(--map-canvas);
}

.map-menu-toggle {
  position: absolute;
  top: 2.65rem;
  left: 0.5rem;
  z-index: 500;
  background: var(--glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

#mappingMapView:has(#mapQuickActions[hidden]) .map-menu-toggle {
  top: 0.5rem;
}

#mappingMapView:has(#mapQuickActions[hidden]) .map-tools-menu {
  top: 2.85rem;
}

.map-menu-toggle.active {
  background: var(--accent-fill);
  color: #fff;
  border-color: var(--accent);
}

.map-tools-menu {
  position: absolute;
  top: 5.25rem;
  left: 0.75rem;
  z-index: 600;
  width: min(280px, calc(100vw - 1.5rem));
  max-height: min(72vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--glass);
  color: var(--text);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  pointer-events: auto;
  overflow: hidden;
  margin: 0.25rem;
}

.map-tools-menu[hidden] {
  display: none !important;
}

/* Keep the Log Maps tab (and the rest of the tools menu) clear of the locate / 3D / basemap stack. */
@media (min-width: 801px) {
  #mappingMapView .map-tools-menu {
    left: 3.85rem;
  }
}

.map-tools-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.map-tools-head h3 {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin: 0;
}

.map-tools-close {
  min-width: 1.75rem;
  padding: 0.15rem 0.35rem;
  font-size: 1.1rem;
  line-height: 1;
}

.map-tools-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  padding: 0.35rem 0.45rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.map-tools-nav-btn {
  flex: 1 1 auto;
  min-width: 3.5rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.map-tools-nav-btn.active {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: #fff;
}

.map-tools-body {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0.55rem 0.6rem;
  flex: 1 1 auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
}

.map-tools-panel {
  display: none;
  flex-direction: column;
  gap: 0.4rem;
}

.map-tools-panel.active {
  display: flex;
}

.map-tools-panel input,
.map-tools-panel select,
.map-tools-panel textarea {
  margin: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
}

.map-tools-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 2.6rem;
  font-family: inherit;
}

.area-layer-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.35rem;
  border-top: 1px solid var(--border);
}

.area-vertex-handle {
  background: #fff;
  border: 3px solid #5b21b6;
  border-radius: 50%;
  box-sizing: border-box;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.map-tools-hint {
  font-size: 0.68rem;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.map-tools-toggle {
  margin: 0;
}

.map-tools-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.map-tools-actions .btn {
  flex: 1;
  min-width: 6rem;
}

.map-layer-select {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.map-layer-select span {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.map-layer-select-block select {
  width: 100%;
  margin: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.78rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

.overlay-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.overlay-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}

.overlay-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.overlay-row-head {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.overlay-row-head label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  cursor: pointer;
  margin: 0;
}

.overlay-row-head label input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.overlay-cog {
  min-width: 1.75rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.85rem;
  line-height: 1;
}

.overlay-cog.active {
  background: var(--accent-light);
  color: var(--accent);
}

.overlay-settings {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.4rem 0.35rem 0.45rem;
  margin-left: 0.25rem;
  border-left: 2px solid var(--accent-light);
  background: var(--surface);
  border-radius: 0 6px 6px 0;
}

.overlay-settings[hidden] {
  display: none !important;
}

.overlay-filter-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr 2.25rem;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.68rem;
  color: var(--muted);
}

.overlay-filter-row span:first-child {
  text-transform: capitalize;
}

.overlay-filter-row input[type="range"] {
  width: 100%;
  margin: 0;
  padding: 0;
  height: 1.1rem;
  accent-color: var(--accent);
}

.overlay-filter-row .filter-val,
.overlay-filter-row .opacity-val {
  font-size: 0.65rem;
  color: var(--muted);
  text-align: right;
}

.overlay-reset {
  align-self: flex-start;
  margin-top: 0.15rem;
}

#map .leaflet-bottom.leaflet-right {
  margin-bottom: 0.25rem;
  margin-right: 0.25rem;
}

.pick-active {
  background: var(--accent-fill) !important;
  color: #fff !important;
}

.map-team-panel {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  z-index: 500;
  background: var(--glass);
  color: var(--text);
  backdrop-filter: blur(10px);
  border: 2px solid var(--info-border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.75rem;
  max-height: 38%;
  overflow-y: auto;
  min-width: 160px;
  max-width: min(240px, 55vw);
  pointer-events: auto;
  box-shadow: var(--shadow);
}

.map-team-panel.collapsed {
  max-height: 2.2rem;
  overflow: hidden;
}

.map-team-panel.collapsed .status-legend,
.map-team-panel.collapsed .map-team-list {
  display: none;
}

.map-team-panel .map-team-toggle {
  font-size: 0.7rem;
  padding: 0 0.2rem;
  margin-right: 0.3rem;
  vertical-align: middle;
  cursor: pointer;
}

.map-team-panel h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.map-team-count {
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.62rem;
  padding: 0.1rem 0.35rem;
  border-radius: 999px;
}

.map-team-count.is-unlocated {
  background: #b45309;
}

.map-team-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.map-team-list li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.2rem;
  border-radius: 6px;
}

.map-team-list li:not(.self):hover {
  background: var(--accent-light);
}

.map-team-list .team-member-label {
  flex: 1;
}

.online-popover-list li:not(.self) {
  cursor: pointer;
  padding: 0.25rem 0.15rem;
  border-radius: 4px;
}

.online-popover-list li:not(.self):hover {
  background: var(--accent-light);
}

.map-team-list li.self {
  color: var(--accent);
  font-weight: 500;
}

.map-team-list .muted-line {
  font-size: 0.68rem;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #fff;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--bg);
}

.chat-msg {
  max-width: 92%;
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.chat-msg.mine {
  align-self: flex-end;
  background: var(--accent-light);
  border-color: rgba(76, 29, 149, 0.25);
}

.chat-msg .meta {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.chat-msg .meta strong {
  color: var(--accent);
}

.chat-msg .text {
  font-size: 0.9rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg .marker-link {
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font-weight: 500;
}

.chat-msg.marker-msg {
  border-color: rgba(76, 29, 149, 0.35);
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chat-form input {
  flex: 1;
}

#panel-access,
#panel-stream {
  overflow-y: auto;
  padding: 0.75rem;
  gap: 0.75rem;
  background: var(--bg);
}

.access-panel h2 {
  font-size: 0.9rem;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin-bottom: 0.5rem;
}

.access-internet-card {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-light) 0%, var(--surface) 2.5rem);
}

.access-steps {
  margin: 0.5rem 0 0.75rem 1.1rem;
  padding: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
}

.access-steps li {
  margin-bottom: 0.35rem;
}

.access-public-url-wrap {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
  flex-wrap: wrap;
}

.access-public-url {
  flex: 1;
  min-width: 12rem;
  margin: 0;
  padding: 0.5rem 0.6rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
}

.access-public-status {
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.access-public-status.ok {
  color: var(--ok);
  font-weight: 600;
}

.stream-wrap {
  position: relative;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 50vh;
}

.stream-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

.stream-video.playing {
  display: block;
}

.stream-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.9rem;
  gap: 0.35rem;
}

.stream-placeholder.hidden {
  display: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  box-shadow: 0 6px 16px rgba(0,0,0,0.1);
  margin: 0.4rem;
}

.panel.scroll-panel > .card,
.panel.scroll-panel > .ops-panel.card,
.panel.scroll-panel > .assignment-alert-banner,
.home-widget,
.home-card,
.my-task-card,
.my-task-grid .my-task-col,
.stream-info.card,
.map-tools-panel,
.dispatch-team-roster-card,
.notify-popover,
.ops-item {
  border: 2px solid var(--info-border);
}

.ops-panel.card {
  background: var(--surface);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.info-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.82rem;
  margin-bottom: 0.65rem;
}

.info-grid dt {
  color: var(--muted);
}

.info-grid dd {
  font-family: Consolas, monospace;
  word-break: break-all;
}

.hint {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 0.65rem;
}

.hint a {
  color: var(--accent);
}

input,
textarea,
select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  width: 100%;
}

label span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  min-height: var(--touch);
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface2);
  color: var(--text);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  min-height: var(--touch);
  font-size: var(--text-label);
}

.btn-primary {
  background: var(--accent-fill);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-fill-dim);
}



.dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  background: var(--surface);
  color: var(--text);
  max-width: 360px;
  width: calc(100% - 2rem);
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.2);
}

.dialog::backdrop {
  background: var(--overlay);
}

.dialog h2 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--accent);
}

.dialog label {
  display: block;
  margin-bottom: 0.75rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.team-marker-wrap {
  background: transparent !important;
  border: 0 !important;
  overflow: visible;
}

.marker-self,
.marker-team {
  position: relative;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  background: var(--marker-color, var(--ok));
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.45);
}

.marker-self {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 40%, transparent);
}

.marker-self::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #fff;
}

.marker-team.is-avail-available {
  border-radius: 50%;
}

.marker-team.is-avail-on-scene {
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--marker-color, var(--ok));
}

.marker-team.is-avail-on-scene::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--marker-color, var(--ok));
}

.marker-team.is-avail-responding {
  width: 14px;
  height: 16px;
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 50% 72%, 0 100%);
  box-shadow: none;
  filter: drop-shadow(0 0 1px #fff) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

.marker-team.is-avail-on-call {
  width: 12px;
  height: 12px;
  border-radius: 1px;
  transform: rotate(45deg);
}

.marker-team.is-avail-on-break {
  width: 14px;
  height: 10px;
  border-radius: 2px;
}

.marker-team.is-avail-off-duty {
  border-radius: 50%;
  background: transparent;
  border-color: var(--marker-color, var(--muted));
}

.dock-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0;
}

.dock-field span {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.dock-field select,
.dock-field input[type="color"] {
  margin: 0;
  padding: 0.3rem 0.4rem;
  font-size: 0.78rem;
  height: 2rem;
}

.dock-field input[type="color"] {
  padding: 0.15rem;
  cursor: pointer;
}

.dock-field input[type="file"] {
  font-size: 0.72rem;
  padding: 0.25rem 0;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border: 1px solid transparent;
}

.btn-danger:hover {
  filter: brightness(0.92);
}

.chat-msg-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.35rem;
  margin-bottom: 0.2rem;
}

.chat-msg-head .meta {
  margin: 0;
}

.chat-delete {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.chat-delete:hover {
  background: rgba(190, 24, 93, 0.12);
  color: #be185d;
}

.chat-marker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.marker-link.danger {
  color: #be185d;
}

.poi-shape {
  --poi-color: #5b21b6;
}

.poi-pin {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 14px solid var(--poi-color);
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.3));
}

.poi-circle {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--poi-color);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.poi-square {
  width: 12px;
  height: 12px;
  background: var(--poi-color);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.poi-diamond {
  width: 12px;
  height: 12px;
  background: var(--poi-color);
  border: 2px solid #fff;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.poi-flag {
  width: 3px;
  height: 14px;
  background: #64748b;
  position: relative;
}

.poi-flag::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 11px;
  height: 8px;
  background: var(--poi-color);
  border: 1px solid #fff;
}

.marker-img {
  width: 28px;
  height: 28px;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  display: block;
}

.leaflet-popup-content .popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.leaflet-popup-content .popup-actions button {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  background: var(--accent-fill);
  color: #fff;
}

.leaflet-popup-content .popup-actions button.secondary {
  background: var(--surface2);
  color: var(--text);
}

.leaflet-popup-content .popup-maps-link {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.55rem;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  background: var(--accent-fill, #0f766e);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.leaflet-popup-content .popup-maps-link:hover,
.leaflet-popup-content .popup-maps-link:focus {
  color: #fff;
}

.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

.leaflet-control-layers {
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
  background: var(--glass) !important;
  color: var(--text) !important;
}

.leaflet-control-layers-expanded {
  padding: 0.45rem 0.55rem !important;
  font-size: 0.8rem !important;
}

.leaflet-control-zoom a {
  color: var(--accent) !important;
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

.leaflet-bar {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notify-wrap {
  position: relative;
}

.notify-btn {
  position: relative;
}

.notify-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  margin-left: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
}

.notify-popover {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  width: min(22rem, 92vw);
  max-height: 18rem;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 1500;
  padding: 0.5rem;
}

.notify-popover[hidden],
.online-popover[hidden] {
  display: none !important;
}

.notify-popover:not([hidden]),
.online-popover:not([hidden]) {
  display: block;
  visibility: visible;
}

.notify-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.notify-popover-head h3 {
  font-size: 0.85rem;
}

.notify-list {
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.notify-item {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.notify-item:last-child {
  border-bottom: none;
}

.notify-item.unread {
  background: var(--accent-light);
}

.notify-item strong {
  display: block;
  font-size: 0.8rem;
}

.notify-item time {
  font-size: 0.68rem;
  color: var(--muted);
}

.notify-item p {
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.dispatch-toast-host {
  position: fixed;
  top: 4.5rem;
  right: 0.75rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  pointer-events: none;
  max-width: min(20rem, 92vw);
}

.dispatch-toast {
  pointer-events: auto;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}

.dispatch-toast-urgent {
  border-color: #c2410c;
  background: linear-gradient(180deg, #fff7ed, #fff);
  animation: toast-in 0.25s ease, dispatch-toast-pulse 1.2s ease-in-out infinite;
}

@keyframes dispatch-toast-pulse {
  0%,
  100% {
    box-shadow: 0 4px 20px rgba(15, 23, 42, 0.08);
  }
  50% {
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.35), 0 8px 24px rgba(194, 65, 12, 0.2);
  }
}

.dispatch-toast h4 {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}

.dispatch-toast p {
  font-size: 0.75rem;
  color: var(--muted);
}

.dispatch-toast-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.marker-job.ping .marker-job,
.marker-job-wrap.ping .marker-job {
  animation: job-ping 1.2s ease 3;
}

@keyframes job-ping {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    transform: scale(1.35);
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
  }
}

.w3w-row {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.w3w-row input {
  flex: 1;
  min-width: 0;
}

.admin-user-list .ops-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.credentials-dialog dl {
  margin: 0.75rem 0;
}

#credPassword {
  font-family: ui-monospace, monospace;
  font-weight: 600;
}

.leaflet-routing-container {
  background: var(--glass) !important;
  color: var(--text) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow) !important;
  max-height: 40vh;
  overflow: auto;
  max-width: min(300px, 92vw);
  padding: 0 !important;
  border: 1px solid var(--border) !important;
}

.leaflet-routing-container.is-collapsed {
  max-height: none;
  overflow: visible;
}

.leaflet-routing-container.is-collapsed > :not(.ncr-route-panel-head) {
  display: none !important;
}

.ncr-route-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.4rem 0.45rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 2;
  cursor: default;
  user-select: none;
}

.leaflet-routing-container.is-collapsed .ncr-route-panel-head {
  border-bottom: none;
  cursor: pointer;
}

.ncr-route-panel-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  min-width: 0;
}

.ncr-route-panel-actions {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.ncr-route-collapse,
.ncr-route-close {
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0.15rem 0.35rem !important;
  font-size: 1rem;
  line-height: 1;
  touch-action: manipulation;
}

.leaflet-routing-container .leaflet-routing-table {
  margin: 0;
  width: 100%;
}

.my-tasks-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.my-task-card {
  border-radius: 12px;
  padding: 0.85rem;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border);
}

.my-task-card-needs-accept {
  border-color: #b45309 !important;
  box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.35), var(--shadow);
}

.my-task-card-priority-high {
  border-left: 5px solid #dc2626 !important;
}

.my-task-card-no-location {
  background: linear-gradient(180deg, #fffbeb 0%, var(--surface) 2.5rem);
}

.task-alert-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.task-alert {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
}

.task-alert-accept {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fb923c;
}

.task-alert-urgent {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #f87171;
}

.task-alert-high {
  background: #fef3c7;
  color: #a16207;
  border: 1px solid #fbbf24;
}

.task-alert-new {
  background: #ede9fe;
  color: #5b21b6;
  border: 1px solid #a78bfa;
}

.task-alert-location {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #94a3b8;
}

.task-priority-urgent {
  color: #dc2626;
  font-weight: 800;
}

.task-priority-high {
  color: #b45309;
  font-weight: 700;
}

.my-task-grid .my-task-col {
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  background: #fafafa;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin: 0.35rem 0 0.6rem;
  padding: 0.45rem 0.55rem;
  background: var(--panel-muted);
  border: 1px solid var(--info-border);
  border-radius: 8px;
}

.status-legend-compact {
  margin: 0.25rem 0 0.45rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.62rem;
}

.status-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: var(--text);
}

.status-legend-swatch {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.35);
  flex-shrink: 0;
}

.unit-roster-groups {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 22rem;
  overflow: auto;
}

.unit-roster-group-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  margin: 0 0 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.unit-roster-group-offline .unit-roster-group-title {
  color: var(--muted);
}

.unit-roster-count {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface2);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}

.unit-roster-subgroup {
  margin-bottom: 0.55rem;
}

.unit-roster-subgroup:last-child {
  margin-bottom: 0;
}

.unit-roster-subgroup-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 0.3rem;
}

.unit-roster-empty {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
}

.unit-roster-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.unit-roster-group-online .unit-roster-list {
  margin-left: 0.15rem;
}

.unit-roster-item {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
}

.unit-roster-item.unit-roster-online {
  background: var(--surface);
  border-color: var(--info-border);
}

.unit-roster-group-offline .unit-roster-item {
  opacity: 0.92;
}

.unit-roster-item.unit-roster-selectable {
  cursor: pointer;
}

.unit-roster-item.unit-roster-selectable:hover {
  border-color: var(--accent);
}

.unit-roster-item.unit-roster-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--accent-light);
}

.dispatch-unit-dialog {
  max-width: min(420px, calc(100vw - 1.5rem));
}

.dispatch-unit-section {
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.dispatch-unit-section h3 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.dispatch-unit-dialog .availability-buttons {
  margin: 0.2rem 0 0.4rem;
}
.dispatch-unit-dialog .availability-btn {
  font-size: 0.68rem;
  padding: 0.18rem 0.45rem;
}

.dispatch-unit-section label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
}

.dispatch-unit-coords {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.dispatch-unit-goto-actions,
.dispatch-unit-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.35rem 0;
}

.dispatch-unit-quick {
  border-bottom: none;
  padding-bottom: 0;
}

.dispatch-unit-shift-banner {
  font-size: 0.75rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
}

.dispatch-unit-shift-on {
  background: var(--accent-light);
  color: var(--text);
}

.dispatch-unit-shift-warn {
  background: var(--panel-muted);
  color: var(--muted);
}

.dispatch-unit-log-note {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.dispatch-unit-save-hint {
  margin-bottom: 0.5rem;
}

.dispatch-unit-save-ok {
  color: var(--ok);
}

.dispatch-unit-save-warn {
  color: var(--warn);
}

.shift-history-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.shift-history-item.shift-history-active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.shift-history-row {
  flex: 1;
  min-width: 0;
}

.shift-timeline-list,
.shift-events-list {
  list-style: none;
  max-height: 12rem;
  overflow: auto;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem;
  margin-bottom: 0.75rem;
  background: var(--panel-muted);
}

.shift-timeline-item,
.shift-event-item {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
}

.shift-timeline-item:last-child,
.shift-event-item:last-child {
  border-bottom: none;
}

.shift-timeline-item time,
.shift-event-item time {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
}

.shift-detail-subhead {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0.5rem 0 0.35rem;
}

.shift-detail-dialog {
  max-width: min(480px, calc(100vw - 1.5rem));
}

.unit-roster-dot {
  margin-top: 0.2rem;
}

.unit-roster-label {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.assignment-alert-banner {
  margin: 0.65rem 0.75rem 0;
  border: 2px solid #c2410c !important;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  padding: 0.65rem 0.85rem;
  animation: assignment-banner-in 0.45s ease-out;
}

.assignment-alert-inner strong {
  display: block;
  font-size: 0.95rem;
  color: #9a3412;
  margin-bottom: 0.25rem;
}

.assignment-alert-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

body.assignment-alert-active::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2500;
  animation: assignment-screen-flash 0.9s ease-out 2;
  background: rgba(234, 88, 12, 0.12);
}

.tab-alert-pulse,
.badge-alert-pulse {
  animation: tab-badge-pulse 0.85s ease-in-out infinite;
}

@keyframes assignment-banner-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes assignment-screen-flash {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

@keyframes tab-badge-pulse {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.5);
  }
  50% {
    transform: scale(1.08);
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0);
  }
}

.my-task-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin: -0.85rem -0.85rem 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px 12px 0 0;
  color: #fff;
}

.my-task-head h3,
.my-task-head .ops-meta {
  color: #fff;
}

.my-task-head-priority-low {
  background: linear-gradient(90deg, #475569, #64748b);
}

.my-task-head-priority-normal {
  background: linear-gradient(90deg, #334155, #475569);
}

.my-task-head-priority-high {
  background: linear-gradient(90deg, #c2410c, #ea580c);
}

.my-task-head-priority-urgent {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

.my-task-head .my-task-status-pill {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

.my-task-head .job-priority-pill-inline {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.my-task-head .task-alert-row .task-alert {
  border-color: rgba(255, 255, 255, 0.45);
}

.my-task-dog-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0;
}

.my-task-dog-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

.my-task-head h3 {
  font-size: 1rem;
  font-weight: 600;
}


/* Status pills — assignment and availability (PR D).
   Colour comes from theme tokens. Each state also has a unique mark,
   so colour is never the only cue (greyscale / colour-vision check). */
.status-pill {
  --status-color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.2rem 0.55rem 0.2rem 0.4rem;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--status-color) 32%, var(--border));
  background: color-mix(in srgb, var(--status-color) 8%, var(--surface));
  color: var(--status-color);
  font-size: var(--text-label);
  line-height: 1.35;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
  text-transform: none;
}

.status-pill-mark {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  color: var(--status-color, currentColor);
  display: inline-block;
}

.status-pill-mark::before,
.status-pill-mark::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}

/* filled circle — available */
.status-pill--available { --status-color: var(--ok); }
.status-pill--available .status-pill-mark::before,
.status-pill--task_available .status-pill-mark::before {
  inset: 1px;
  border-radius: 50%;
  background: currentColor;
}

/* check — accepted */
.status-pill--accepted { --status-color: var(--ok); }
.status-pill--task_available { --status-color: var(--ok); }
.status-pill--accepted .status-pill-mark::before {
  left: 1px;
  top: 3px;
  width: 4px;
  height: 2px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

/* diamond — on scene */
.status-pill--on_scene { --status-color: var(--ok); }
.status-pill--on_scene .status-pill-mark::before {
  left: 1px;
  top: 1px;
  width: 6px;
  height: 6px;
  background: currentColor;
  transform: rotate(45deg);
}

/* arrow — en-route / responding */
.status-pill--en_route,
.status-pill--responding { --status-color: var(--info); }
.status-pill--en_route .status-pill-mark::before,
.status-pill--responding .status-pill-mark::before {
  left: 1px;
  top: 3px;
  width: 5px;
  height: 2px;
  background: currentColor;
}
.status-pill--en_route .status-pill-mark::after,
.status-pill--responding .status-pill-mark::after {
  left: 3px;
  top: 1px;
  width: 4px;
  height: 4px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
}

/* hollow circle — pending / waiting / held / unassigned */
.status-pill--pending,
.status-pill--held,
.status-pill--unassigned { --status-color: var(--warn); }
.status-pill--pending .status-pill-mark::before,
.status-pill--held .status-pill-mark::before,
.status-pill--unassigned .status-pill-mark::before {
  inset: 1px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: transparent;
}

/* dashed ring — delayed (same colour as pending, different shape) */
.status-pill--delayed { --status-color: var(--warn); }
.status-pill--delayed .status-pill-mark::before {
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed currentColor;
  background: transparent;
}

/* pause bars — on break */
.status-pill--on_break { --status-color: var(--warn); }
.status-pill--on_break .status-pill-mark::before,
.status-pill--on_break .status-pill-mark::after {
  top: 1px;
  width: 2px;
  height: 6px;
  background: currentColor;
  border-radius: 0.5px;
}
.status-pill--on_break .status-pill-mark::before { left: 1px; }
.status-pill--on_break .status-pill-mark::after { right: 1px; }

/* X — declined (danger; must not look like delayed in greyscale) */
.status-pill--declined { --status-color: var(--danger); }
.status-pill--declined .status-pill-mark::before,
.status-pill--declined .status-pill-mark::after {
  left: 3px;
  top: 1px;
  width: 1.5px;
  height: 6px;
  background: currentColor;
  border-radius: 0.5px;
}
.status-pill--declined .status-pill-mark::before { transform: rotate(45deg); }
.status-pill--declined .status-pill-mark::after { transform: rotate(-45deg); }

/* target — on call */
.status-pill--on_call { --status-color: var(--info); }
.status-pill--on_call .status-pill-mark::before {
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: transparent;
}
.status-pill--on_call .status-pill-mark::after {
  left: 3px;
  top: 3px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: currentColor;
}

/* minus — off duty / booked off */
.status-pill--off_duty,
.status-pill--booked_off { --status-color: var(--muted); }
.status-pill--off_duty .status-pill-mark::before,
.status-pill--booked_off .status-pill-mark::before {
  left: 0;
  top: 3.5px;
  width: 8px;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}

/* bar — archived / past / n/a */
.status-pill--na,
.status-pill--closed { --status-color: var(--muted); }
.status-pill--na .status-pill-mark::before,
.status-pill--closed .status-pill-mark::before {
  left: 1px;
  top: 3px;
  width: 6px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}

.availability-btn.status-pill--available,
.availability-btn.status-pill--accepted,
.availability-btn.status-pill--task_available,
.availability-btn.status-pill--on_scene { --status-color: var(--ok); }
.availability-btn.status-pill--en_route,
.availability-btn.status-pill--responding,
.availability-btn.status-pill--on_call { --status-color: var(--info); }
.availability-btn.status-pill--pending,
.availability-btn.status-pill--delayed,
.availability-btn.status-pill--on_break { --status-color: var(--warn); }
.availability-btn.status-pill--off_duty { --status-color: var(--muted); }

.availability-btn.selected {
  border-color: var(--status-color, var(--accent));
  color: var(--status-color, var(--accent));
  font-weight: 600;
  background: color-mix(in srgb, var(--status-color, var(--accent)) 8%, var(--surface));
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.6rem;
  align-items: center;
}

.status-legend .status-pill {
  margin: 0;
}

.status-pill--mark-only {
  padding: 0;
  border: 0;
  background: transparent;
  min-width: 8px;
  gap: 0;
}

.unit-roster-item .status-pill,
.dispatcher-person {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-height: var(--touch);
}

.dispatcher-person .status-pill,
.search-duty-list .status-pill {
  flex: 0 0 auto;
}

.unit-roster-subgroup-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.my-task-status-pill {
  font-size: var(--text-label);
  font-weight: 600;
  padding: 0.2rem 0.55rem 0.2rem 0.4rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.my-task-map {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  margin: 0.5rem 0;
  border: 1px solid var(--border);
  text-decoration: none;
}

.job-map-thumb {
  height: 10rem;
  width: 100%;
  background: #e2e8f0;
}

.job-map-thumb-map {
  height: 100%;
  width: 100%;
}

.job-map-thumb-map .leaflet-control-container {
  display: none;
}

.ops-item .my-task-map {
  margin: 0.35rem 0 0.5rem;
}

.job-dialog .dialog-head.dialog-head-priority-low,
.job-dialog .dialog-head.dialog-head-priority-normal,
.job-dialog .dialog-head.dialog-head-priority-high,
.job-dialog .dialog-head.dialog-head-priority-urgent {
  margin: -1rem -1rem 0.75rem;
  padding: 0.65rem 1rem;
  border-radius: 12px 12px 0 0;
  color: #fff;
}

.job-dialog .dialog-head.dialog-head-priority-low h2,
.job-dialog .dialog-head.dialog-head-priority-normal h2,
.job-dialog .dialog-head.dialog-head-priority-high h2,
.job-dialog .dialog-head.dialog-head-priority-urgent h2 {
  color: #fff;
}

.dialog-head-priority-low {
  background: linear-gradient(90deg, #475569, #64748b);
}

.dialog-head-priority-normal {
  background: linear-gradient(90deg, #334155, #475569);
}

.dialog-head-priority-high {
  background: linear-gradient(90deg, #c2410c, #ea580c);
}

.dialog-head-priority-urgent {
  background: linear-gradient(90deg, #991b1b, #dc2626);
}

.my-task-loc {
  margin-bottom: 0.5rem;
}

.my-task-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.5rem 0;
}

@media (max-width: 640px) {
  .my-task-grid {
    grid-template-columns: 1fr;
  }
}

.my-task-col h4 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.my-task-chat,
.my-task-log {
  list-style: none;
  max-height: 8.5rem;
  overflow-y: auto;
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem;
  background: var(--bg);
}

.my-task-chat li,
.my-task-log li {
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.my-task-chat li:last-child,
.my-task-log li:last-child {
  border-bottom: none;
}

.my-task-chat time,
.my-task-log time {
  font-size: 0.65rem;
  color: var(--muted);
  display: block;
}

.my-task-chat p,
.my-task-log p {
  margin-top: 0.1rem;
  word-break: break-word;
}

.my-task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.55rem;
  padding-bottom: 0.15rem;
}

.mytaskings-avail-card {
  margin-bottom: 0.75rem;
}

.en-route-line {
  color: var(--accent);
  font-weight: 500;
}

.display-choice {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

.display-choice button {
  min-height: var(--touch);
  padding: 0.4rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-muted);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 650;
  cursor: pointer;
}

.display-choice button.is-selected {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: #fff;
}

.login-display {
  margin-top: 0.85rem;
}

.theme-select-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}

.theme-select-label select {
  max-width: 14rem;
}

.assets-panel .assets-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  margin-bottom: 0.65rem;
  max-width: 16rem;
}

.assets-list .asset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.asset-row-main h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.asset-category-pill,
.asset-status-pill {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  margin-right: 0.35rem;
}

.asset-category-pill {
  background: var(--accent-light);
  color: var(--accent);
}

.asset-status-pill {
  background: var(--surface2);
  color: var(--muted);
}

.asset-status-pill.status-available {
  color: var(--ok);
}

.asset-status-pill.status-deployed {
  color: var(--warn);
}

.asset-status-pill.status-maintenance {
  color: var(--danger);
}

.asset-teams-line {
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.job-equipment-field.readonly .job-assets-checks {
  opacity: 0.85;
  pointer-events: none;
}

[data-theme="dark"] .leaflet-popup-content-wrapper,
[data-theme="dark"] .leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .leaflet-routing-container {
  background: var(--surface);
  color: var(--text);
}

[data-theme="dark"] .leaflet-routing-alt,
[data-theme="dark"] .leaflet-routing-geocoders {
  background: var(--surface2);
  color: var(--text);
}

/* —— Mobile / phone browsers —— */
button,
.btn,
.tab,
select,
.home-inline-link,
.notify-btn,
.online-toggle {
  touch-action: manipulation;
}

@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: calc(0.65rem + env(safe-area-inset-top));
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
  }

  .login-page {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

.mobile-alerts-panel {
  margin-bottom: 1rem;
}

#panel-settings.scroll-panel.active {
  padding: 0.65rem 0.75rem calc(1rem + env(safe-area-inset-bottom, 0px));
  gap: 0.75rem;
}

#panel-settings .access-panel,
#panel-settings .mobile-alerts-panel {
  margin-bottom: 0;
}

.mobile-perm-grid {
  margin: 0.75rem 0;
}

.mobile-perm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.mobile-perm-actions .btn {
  flex: 1 1 auto;
  min-width: min(100%, 10rem);
}

.mobile-checklist {
  list-style: none;
  margin: 0.75rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.mobile-check-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  font-size: 0.8rem;
}

.mobile-check-item::before {
  content: "○";
  display: none;
}

.mobile-check-label {
  font-weight: 600;
}

.mobile-check-detail {
  font-size: 0.72rem;
  color: var(--muted);
}

.mobile-check-ok {
  border-color: rgba(13, 148, 136, 0.35);
  background: rgba(13, 148, 136, 0.08);
}

.mobile-check-ok .mobile-check-label::before {
  content: "✓ ";
  color: var(--ok);
}

.mobile-check-warn {
  border-color: rgba(180, 83, 9, 0.35);
  background: rgba(180, 83, 9, 0.08);
}

.mobile-check-warn .mobile-check-label::before {
  content: "! ";
  color: var(--warn);
}

.mobile-check-bad {
  border-color: rgba(185, 28, 28, 0.3);
}

.mobile-check-bad .mobile-check-label::before {
  content: "✕ ";
  color: var(--danger);
}

.mobile-ios-help {
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--warn);
  background: rgba(180, 83, 9, 0.1);
  color: var(--text);
}

.mobile-popover-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1400;
  background: var(--overlay);
  touch-action: none;
}

.mobile-popover-backdrop[hidden] {
  display: none !important;
}

body.mobile-popover-open {
  overflow: hidden;
}

/* The popover lives inside .topbar. The dimmer is a later sibling at the same
   z-index, so without this the dimmer covers the alerts list. */
body.mobile-popover-open .topbar {
  z-index: 1800;
}

/* Backdrop (z-index 1400) captures outside taps. Do NOT set pointer-events:none on
   .panels — that previously blocked Home book-on <select> menus even after close. */

body.mobile-dialog-open {
  overflow: hidden;
}

body.mobile-dialog-open .panels {
  overflow: hidden;
}

@media (max-width: 640px) {
  :root {
    --map-h: calc(100dvh - 11.5rem);
    --app-chrome-h: 11.5rem;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 0.35rem 0.5rem;
    padding: 0.5rem 0.65rem;
  }

  .topbar-title {
    grid-column: 1 / -1;
    font-size: 0.95rem;
  }

  .topbar-meta {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .topbar-create-job {
    flex: 1 1 auto;
  }

  .topbar-meta .btn-sm {
    padding: 0.45rem 0.55rem;
  }

  .nav-tier-primary {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .nav-tier-primary::-webkit-scrollbar {
    display: none;
  }

  .nav-tier-primary .tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.55rem 0.85rem;
  }

  .nav-tier-secondary {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.25rem;
  }

  .nav-tier-secondary::-webkit-scrollbar {
    display: none;
  }

  .nav-tier-tabs {
    flex-wrap: nowrap;
    overflow: visible;
  }

  .nav-tier-secondary .tab,
  .nav-tier-admin .tab {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
  }

  .nav-tier-label {
    flex: 0 0 auto;
  }

  .app-nav {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .panels {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  #panel-communications.panel.active {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }

  .sub-tabs {
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .sub-tabs::-webkit-scrollbar {
    display: none;
  }

  .sub-tab {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.55rem 0.85rem;
  }

  .comm-panel.active {
    flex: 1;
    min-height: 0;
  }

  .chat-messages,
  .dm-messages {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
  }

  .chat-form,
  .dm-form {
    flex-shrink: 0;
    padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
  }

  .dm-chat {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1;
  }

  .btn,
  .sub-tab,
  .notify-btn,
  .online-toggle {
    min-height: 44px;
    min-width: 44px;
  }

  .mobile-perm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-perm-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .home-inline-link {
    min-height: 44px;
    padding: 0.4rem 0.15rem;
    display: inline-flex;
    align-items: center;
  }

  .btn-sm {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .home-guide-layout {
    grid-template-columns: 1fr;
  }

  .home-duty-aside {
    order: -1;
    position: static;
  }

  .home-duty-field select,
  .home-duty-actions .btn {
    min-height: 44px;
    width: 100%;
  }

  .home-duty-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .home-dashboard {
    padding-left: max(0.65rem, env(safe-area-inset-left));
    padding-right: max(0.65rem, env(safe-area-inset-right));
  }

  .notify-popover,
  .online-popover {
    position: fixed;
    /* 100% on a fixed box is the bottom of the screen, so the menu never showed. */
    top: 4.75rem;
    left: max(0.5rem, env(safe-area-inset-left));
    right: max(0.5rem, env(safe-area-inset-right));
    width: auto;
    bottom: auto;
    max-height: min(22rem, calc(100dvh - 6rem));
    z-index: 1500;
    overflow: hidden;
    flex-direction: column;
  }

  /* Only show when not [hidden] — previous rule forced display:flex always and
     fought the hidden attribute / left popovers in a weird half-open state. */
  .notify-popover:not([hidden]),
  .online-popover:not([hidden]) {
    display: flex !important;
    visibility: visible !important;
  }

  .notify-popover[hidden],
  .online-popover[hidden] {
    display: none !important;
  }

  .notify-list,
  .online-popover-list {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .notify-wrap,
  .online-menu-wrap {
    position: static;
  }

  .app-nav .nav-dropdown {
    position: fixed;
    top: auto; /* JS positions under the button when opened */
    left: max(0.5rem, env(safe-area-inset-left));
    right: max(0.5rem, env(safe-area-inset-right));
    z-index: 1600;
    max-height: min(40vh, 300px);
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    padding: 0.4rem;
  }

  .app-nav .nav-dropdown.open {
    display: block !important;
  }

  .dispatch-toast-host {
    top: auto;
    bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    left: 0.75rem;
    right: 0.75rem;
    max-width: none;
  }

  .dispatch-toast {
    max-width: none;
  }

  dialog.dialog[open],
  dialog.job-dialog[open],
  dialog.dispatch-unit-dialog[open],
  dialog.user-action-dialog[open] {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    padding: 0;
    border: none;
    border-radius: 16px 16px 0 0;
    max-height: min(92dvh, calc(var(--app-vh, 100dvh) - 0.5rem));
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
  }

  dialog.dialog form,
  dialog.job-dialog form,
  dialog.dispatch-unit-dialog form,
  dialog.user-action-dialog form {
    display: block;
    max-height: min(88dvh, calc(var(--app-vh, 100dvh) - 2rem));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  }

  dialog::backdrop {
    background: rgba(15, 23, 42, 0.55);
  }

  .ops-panel.card,
  .card {
    max-width: 100%;
  }

  .panel.scroll-panel.active {
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
  }

  .access-public-url-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .access-public-url-wrap .btn {
    width: 100%;
  }

  #panel-mapping #map {
    touch-action: none;
  }

  .leaflet-routing-container {
    top: 3.25rem !important;
    right: max(0.35rem, env(safe-area-inset-right)) !important;
    max-width: min(260px, 88vw);
    z-index: 550 !important;
  }

  .ncr-route-collapse,
  .ncr-route-close {
    min-width: 44px;
    min-height: 44px;
  }

  #mappingMapView .map-tools-menu {
    position: fixed;
    top: auto !important;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-height: min(72dvh, calc(var(--app-vh, 100dvh) - 5.5rem));
    border-radius: 16px 16px 0 0;
    z-index: 650;
    touch-action: pan-y;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .map-tools-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .map-tools-nav::-webkit-scrollbar {
    display: none;
  }

  .map-tools-nav-btn {
    flex: 0 0 auto;
    min-height: 44px;
    white-space: nowrap;
  }

  .map-tools-body {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
  }

  .map-context-menu {
    max-height: min(80dvh, calc(var(--app-vh, 100dvh) - 4rem));
    overflow: hidden;
  }

  .map-ctx-scroll {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .notify-item {
    min-height: 44px;
    padding: 0.65rem 0.5rem;
  }

  .unit-roster-item {
    min-height: 44px;
    padding: 0.45rem 0.35rem;
  }
}

@media (max-width: 640px) and (display-mode: standalone) {
  html,
  body {
    min-height: 100dvh;
    min-height: -webkit-fill-available;
  }
}

.beta-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.12rem 0.45rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
  border-radius: 4px;
  background: var(--accent-light);
  color: var(--accent-dim);
  border: 1px solid var(--border);
}

.my-task-card-declined {
  opacity: 0.82;
  border-style: dashed;
}

.my-task-status-declined,
.my-task-status-na {
  /* Colours and marks come from .status-pill--* */
}

.task-alert-declined {
  background: rgba(148, 163, 184, 0.2);
  color: var(--muted);
}

.my-task-accept-hint {
  margin-top: 0.5rem;
  font-style: italic;
}

.my-task-full-desc {
  margin: 0.75rem 0;
}

.my-task-full-desc h4,
.my-task-subhead {
  font-size: 0.85rem;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.my-task-dog-img {
  cursor: zoom-in;
}

.my-task-log-thumb {
  display: block;
  max-width: 100%;
  max-height: 160px;
  margin-top: 0.35rem;
  border-radius: 6px;
  cursor: zoom-in;
}

.my-task-detail-dialog {
  max-width: min(640px, 96vw);
  max-height: 90dvh;
}

.my-task-detail-body {
  overflow: auto;
  max-height: calc(90dvh - 8rem);
  padding: 0.5rem 0;
}

.home-on-scene {
  margin: 0.75rem 0 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--ok) 18%, var(--surface));
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
}

.home-duty-actions .btn {
  flex: 1 1 8rem;
  min-height: var(--touch-lg);
  font-size: 1rem;
}

.account-tabs {
  display: flex;
  gap: 0.4rem;
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 0.15rem 0 0.65rem;
  background: var(--bg);
}

.account-tab {
  flex: 1 1 0;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.account-tab.active {
  border-color: var(--accent);
  background: var(--accent-light);
}

.account-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.7rem;
  font-size: 0.85rem;
  font-weight: 650;
}

.account-form input,
.account-form select,
.account-form textarea {
  font: inherit;
  font-weight: 500;
  min-height: 2.75rem;
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.account-form label.account-check {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  min-height: 2.75rem;
}

.account-form label.account-check input {
  width: 1.25rem;
  height: 1.25rem;
  min-height: 1.25rem;
  margin: 0;
  flex: 0 0 auto;
}

.home-status-grid strong.home-duty-on {
  color: var(--ok);
}

.home-status-grid strong.home-duty-off {
  color: var(--muted);
}

.readiness-list,
.record-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 0;
}

.readiness-list li,
.record-list li {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.readiness-list li {
  font-weight: 650;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.account-actions .btn {
  min-height: 2.75rem;
}

.empty-state {
  margin: 0.35rem 0 0;
  padding: 0.95rem 0.85rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
  text-align: center;
  background: transparent;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
  font-weight: 750;
}

.empty-state span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.35;
}

.record-list li.empty-state {
  background: transparent;
  font-weight: 500;
}

.readiness-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.readiness-row span {
  font-weight: 650;
}

.readiness-row strong {
  font-weight: 750;
  text-align: right;
}

.readiness-missing strong {
  color: var(--muted);
  font-weight: 650;
}

.readiness-current strong {
  color: var(--ok);
}

.readiness-expired strong {
  color: var(--danger, #b91c1c);
}

.account-form label.account-check input[type="checkbox"] {
  appearance: none;
  width: 2.75rem;
  height: 1.55rem;
  border-radius: 999px;
  border: 0;
  background: #94a3b8;
  position: relative;
}

.account-form label.account-check input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.account-form label.account-check input[type="checkbox"]:checked {
  background: #0f766e;
}

.account-form label.account-check input[type="checkbox"]:checked::after {
  transform: translateX(1.15rem);
}

.map-bottom-bar {
  position: absolute;
  left: 0.5rem;
  right: 0.5rem;
  bottom: 0.5rem;
  z-index: 690;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  pointer-events: none;
}

.map-bottom-bar > * {
  pointer-events: auto;
}

.map-bottom-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.map-tool-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.75rem 0.25rem 0.45rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  font-weight: 750;
}

.map-tool-switch input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
}

.map-icon-btn,
.map-dock-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  font: inherit;
  font-weight: 750;
}

.map-icon-btn svg,
.map-dock-btn svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-dock-btn svg [fill="currentColor"] {
  fill: currentColor;
  stroke: none;
}

.map-dock-btn.active,
.map-icon-btn.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.map-core-controls {
  position: absolute;
  top: 4.6rem;
  left: 0.55rem;
  z-index: 640;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.map-draw-dock {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.3rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  pointer-events: auto;
}

/* Right-edge strip. Bottom clears the desktop zoom control and its attribution. */
#mappingMapView.map-tools-on .map-draw-dock {
  position: absolute;
  z-index: 720;
  top: 0.45rem;
  right: 0.4rem;
  bottom: 9.25rem;
  width: 4.7rem;
  margin: 0;
  overflow: hidden;
}

#mappingMapView.map-tools-on .map-bottom-bar {
  right: 5.4rem;
}

.map-draw-caption {
  margin: 0;
  padding: 0.1rem 0.05rem 0;
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: none;
  text-align: center;
  color: var(--text);
  overflow-wrap: anywhere;
}

.map-draw-dock.is-drawing .map-draw-caption {
  color: var(--accent);
}

.map-draw-dock-tools {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  gap: 0.28rem;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.map-draw-dock-actions {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  gap: 0.28rem;
}

.map-draw-dock .map-dock-btn {
  width: 100%;
  height: auto;
  flex: 0 0 auto;
  min-height: 2.75rem;
  flex-direction: column;
  gap: 0.02rem;
  padding: 0.15rem 0.1rem;
  border-radius: 12px;
  font-size: 0.62rem;
  font-weight: 750;
  line-height: 1.05;
  touch-action: manipulation;
}

.map-draw-dock .map-dock-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
}

.map-draw-dock .map-draw-btn.active {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: #fff;
  box-shadow: inset 0 0 0 2px #fff;
}

.map-draw-dock-actions .btn {
  flex: 0 0 auto;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.25rem 0.15rem;
  border-radius: 12px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: normal;
  touch-action: manipulation;
}

.map-advanced-btn {
  flex: 0 0 auto;
  min-height: 2.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.map-advanced-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#mappingMapView.map-clean .map-team-panel,
#mappingMapView.map-clean .map-context-badge,
#mappingMapView.map-clean .map-quick-actions,
#mappingMapView.map-clean .status-legend {
  display: none !important;
}

#mappingMapView.map-clean.map-tools-on .map-bottom-bar,
#mappingMapView.map-clean.map-tools-on .map-draw-dock {
  display: flex;
}

#mapMenuToggle,
#mappingMapView.map-tools-on .map-menu-toggle {
  display: none;
}

/* Home, My tasks, and Account: visual polish only. */
#panel-home .home-dashboard {
  gap: 0.95rem;
}

#panel-home .home-dashboard > .card,
#panel-home .home-duty-central > .card {
  margin: 0;
}

#panel-home .home-welcome-hero {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0.15rem 0.1rem 0;
}

#panel-home .home-welcome-title {
  margin: 0 0 0.25rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

#panel-home .home-welcome-lead {
  margin: 0;
  color: var(--muted);
}

#panel-home .home-duty-central {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  margin-top: 0;
}

#panel-home .home-widget,
#panel-mytasks > .ops-panel.card,
#panel-account .account-panel > .ops-panel.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1.05rem 1.1rem 1.1rem;
}

#panel-home .home-duty-highlight {
  border: 2px solid color-mix(in srgb, var(--accent) 70%, var(--border));
}

#panel-home .home-search-picture {
  overflow: visible;
  flex: 0 0 auto;
}

#panel-home .home-status-card,
#panel-home .home-widget-duty,
#panel-home .home-manager-actions {
  overflow: visible;
}

#panel-home .home-widget-duty .home-widget-body,
#panel-home .home-manager-actions .home-widget-body {
  overflow: visible;
  background: transparent;
  border: 0;
  border-radius: 0;
}

#panel-home .home-duty-body {
  padding: 0.1rem 0 0;
}

#panel-home .home-widget-head {
  margin-bottom: 0.7rem;
}

#panel-home .home-widget-head h2,
#panel-mytasks .ops-head h2,
#panel-account .ops-panel > h2,
#panel-account .ops-head h2 {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--text);
}

#panel-mytasks .ops-head,
#panel-account .ops-head {
  margin-bottom: 0.35rem;
}

#panel-home .home-status-grid {
  gap: 0.55rem;
}

#panel-home .home-status-grid > div {
  padding: 0.72rem 0.75rem 0.65rem;
  border-radius: 12px;
  background: var(--panel-muted);
  border: 1px solid var(--border);
}

#panel-home .home-status-grid strong {
  margin-top: 0.2rem;
  font-size: 1.12rem;
  font-weight: 750;
  letter-spacing: -0.015em;
}

#panel-home .home-on-scene {
  margin-top: 0.75rem;
}

#panel-home .home-duty-field {
  gap: 0.35rem;
  margin-bottom: 0.7rem;
  font-size: 0.92rem;
  font-weight: 650;
}

#panel-home .home-duty-field select {
  min-height: var(--touch);
  border-radius: 12px;
  font-size: 1rem;
}

#panel-home .hint,
#panel-mytasks .hint,
#panel-account .hint {
  font-size: 0.92rem;
  line-height: 1.45;
}

#panel-home .btn,
#panel-mytasks .btn,
#panel-account .btn {
  min-height: var(--touch);
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
}

#panel-home #homeBookOnBtn,
#panel-mytasks #taskGateAccept,
#panel-mytasks [data-task-scene="join"],
#panel-mytasks [data-task-report="help"],
#panel-mytasks .task-report-help {
  min-height: var(--touch-lg);
}

/* One-tap quick markers on the on-scene task card */
.task-quick-marker-menu {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line, #d9d3e5);
  border-radius: 14px;
  background: var(--card, #fff);
}
.task-quick-marker-menu .btn {
  width: 100%;
}


#panel-home .btn-ghost,
#panel-mytasks .btn-ghost,
#panel-account .btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--text) 28%, var(--border));
}

#panel-account .account-form > .btn,
#panel-account #btnLogoutAccount {
  width: 100%;
}

#panel-account #btnLogoutAccount {
  margin-top: 0.85rem;
}

#panel-mytasks > .ops-panel.card {
  margin: 0.2rem 0.75rem;
}

#panel-mytasks > .my-past-taskings-card {
  margin-top: 1.2rem;
}

#panel-mytasks .my-tasks-list {
  gap: 0.85rem;
  margin-top: 0.45rem;
}

#panel-mytasks .ops-meta {
  font-size: 0.84rem;
  line-height: 1.4;
}

#panel-mytasks .task-list-block {
  margin-top: 1.05rem;
}

#panel-mytasks .task-list-block .live-log-list {
  margin-top: 0.5rem;
  gap: 0.7rem;
}

#panel-mytasks .task-list-block .intake-subhead {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#panel-mytasks .task-list-block:has(.task-on-scene) .intake-subhead {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok) 45%, var(--border));
  background: color-mix(in srgb, var(--ok) 14%, var(--panel-muted));
}

#panel-mytasks .live-log-card {
  gap: 0.4rem;
  padding: 1rem 1rem 0.95rem;
  border-radius: 14px;
  background: var(--surface);
}

#panel-mytasks .task-on-scene {
  border-color: color-mix(in srgb, var(--ok) 65%, var(--border));
  background: color-mix(in srgb, var(--ok) 12%, var(--surface));
  box-shadow: inset 3px 0 0 var(--ok);
}

#panel-mytasks .live-log-card:has(> .btn-primary) {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  background: color-mix(in srgb, var(--warn) 10%, var(--surface));
}

#panel-mytasks .live-log-card > .btn:not(.btn-ghost),
#panel-archive .my-past-tasks-list .live-log-card > .btn:not(.btn-ghost) {
  width: 100%;
  margin-top: 0.2rem;
  background: var(--accent-fill);
  color: #fff;
  border: 0;
}

#panel-mytasks .empty-state,
#panel-account .empty-state,
#panel-account .record-list li.empty-state,
#panel-account #accountShiftEmpty {
  margin-top: 0.55rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: left;
  background: var(--panel-muted);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.45;
}

#panel-account .account-tabs {
  gap: 0.22rem;
  margin: 0 0.75rem 0.35rem;
  padding: 0.28rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--panel-muted);
}

#panel-account .account-tab {
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}

#panel-account .account-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

#panel-account .account-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#panel-account .account-panel > .ops-panel.card {
  margin: 0 0.75rem;
}

#panel-account .readiness-list,
#panel-account .record-list {
  gap: 0.6rem;
  margin-top: 0.7rem;
}

#panel-account .readiness-list li,
#panel-account .record-list li {
  padding: 0.9rem 0.95rem;
  background: var(--panel-muted);
  line-height: 1.45;
}

#panel-account .record-list li {
  color: var(--muted);
  font-weight: 500;
}

#panel-account .record-list li strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
}

#panel-account #accountOnboarding {
  margin: 0.15rem 0 0;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
  color: var(--text);
  line-height: 1.45;
}

#panel-account .info-grid dt {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

#panel-account .account-info dd,
#panel-account .callsign-pool-hint dd {
  font-family: inherit;
  font-weight: 650;
  word-break: normal;
  overflow-wrap: anywhere;
  color: var(--text);
}

#panel-account .account-form label.account-check {
  margin-bottom: 0.55rem;
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--panel-muted);
}

#panel-account .account-actions {
  margin-top: 0.95rem;
}

#panel-account #accountAdminCard h3 {
  margin: 1rem 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

#panel-account .record-list li span {
  display: block;
  margin-top: 0.15rem;
}

#panel-account .record-list li .btn {
  width: 100%;
  margin-top: 0.7rem;
}

#panel-account .account-actions .btn {
  flex: 1 1 10rem;
}
/* Team location freshness and GPS status */
.marker-self.is-stale,
.marker-team.is-stale {
  background: transparent !important;
  border: 2px solid #94a3b8 !important;
  border-style: solid !important;
  border-radius: 50% !important;
  transform: none !important;
  clip-path: none !important;
  filter: none !important;
  box-shadow: 0 0 0 1px #fff;
}

.marker-self.is-stale::after,
.marker-team.is-stale::after {
  display: none;
}

.team-popup-fresh {
  font-size: 0.78rem;
  color: var(--live);
  font-weight: 600;
}

.team-popup-fresh.is-stale,
.team-gps-stale {
  color: #b45309;
  font-weight: 600;
}

.map-team-panel li.is-gps-stale .team-member-label,
.search-duty-list li.is-gps-stale {
  opacity: 0.8;
}

.search-duty-locate {
  margin-left: auto;
  flex-shrink: 0;
}

.home-screen-lock {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.gps-status,
.home-gps-line {
  margin: 0.35rem 0;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.35;
  background: #f1f5f9;
  color: #334155;
}

.gps-status[data-level="ok"],
.home-gps-line[data-level="ok"] {
  background: color-mix(in srgb, var(--live) 8%, var(--surface));
  color: var(--live);
}

.gps-status[data-level="warn"],
.home-gps-line[data-level="warn"] {
  background: #fffbeb;
  color: #92400e;
}

.gps-status[data-level="bad"],
.home-gps-line[data-level="bad"] {
  background: #fef2f2;
  color: #991b1b;
}

[data-theme="dark"] .gps-status,
[data-theme="dark"] .home-gps-line {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .gps-status[data-level="ok"],
[data-theme="dark"] .home-gps-line[data-level="ok"] {
  background: color-mix(in srgb, var(--live) 18%, var(--surface));
  color: var(--live);
}

[data-theme="dark"] .gps-status[data-level="warn"],
[data-theme="dark"] .home-gps-line[data-level="warn"] {
  background: #422006;
  color: #fde68a;
}

[data-theme="dark"] .gps-status[data-level="bad"],
[data-theme="dark"] .home-gps-line[data-level="bad"] {
  background: #3f1212;
  color: #fecaca;
}

.task-now-distance,
.search-picture-distance {
  margin: 0;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.map-gps-chip {
  position: absolute;
  z-index: 451;
  top: 2.3rem;
  left: 50%;
  transform: translateX(-50%);
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: #b45309;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
  cursor: pointer;
  white-space: nowrap;
}

.map-gps-chip[data-level="bad"] {
  background: #b91c1c;
}

.map-gps-chip[hidden] {
  display: none;
}

.search-map-wrap {
  background: transparent !important;
  border: 0 !important;
  overflow: visible;
}

.marker-search-loss,
.marker-search-sighting,
.marker-search-point,
.marker-search-checked,
.marker-search-camera,
.marker-search-rvp {
  position: relative;
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.85), 0 1px 4px rgba(0, 0, 0, 0.45);
}

.marker-search-loss {
  background: #64748B;
  border-radius: 2px;
}

.marker-search-sighting {
  width: 13px;
  height: 13px;
  background: rgba(217, 119, 6, 0.18);
  border: 2px solid #D97706;
  border-radius: 1px;
  transform: rotate(45deg);
}

.marker-search-sighting.is-confirmed {
  width: 16px;
  height: 16px;
  background: #4A1C6B;
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9), 0 1px 4px rgba(0, 0, 0, 0.5);
}

.marker-search-sighting.is-confirmed::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  left: 50%;
  top: 50%;
  margin: -3px 0 0 -3px;
  background: #fff;
  border-radius: 50%;
}

.marker-search-point {
  width: 12px;
  height: 12px;
  background: #2563eb;
  border-radius: 2px;
}

.marker-search-checked {
  background: #0F766E;
  border-radius: 3px;
}

.marker-search-checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.marker-search-camera {
  width: 22px;
  height: 16px;
  background: var(--marker-camera);
  border-radius: 3px;
}

.marker-search-camera::before {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  left: 50%;
  top: 56%;
  margin: -4px 0 0 -4px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-sizing: border-box;
}

.marker-search-camera::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 4px;
  top: -5px;
  right: 3px;
  background: var(--marker-camera);
  border: 2px solid #fff;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  box-sizing: border-box;
}

.marker-search-rvp {
  width: 18px;
  height: 18px;
  background: var(--marker-rvp);
  border-radius: 2px;
  transform: rotate(45deg);
}

.search-map-wrap .marker-search-camera + .marker-callsign,
.search-map-wrap .marker-search-rvp + .marker-callsign {
  margin-left: 0.15rem;
}

.recovery-ring-layer {
  filter: drop-shadow(0 0 1.5px #fff) drop-shadow(0 0 2px rgba(0, 0, 0, 0.7));
}

.stand-down-banner {
  position: fixed;
  inset: 0;
  z-index: 6500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(127, 29, 29, 0.88);
}

.stand-down-banner[hidden] {
  display: none;
}

.stand-down-card {
  width: min(28rem, 100%);
  background: #fff7ed;
  color: #7c2d12;
  border-radius: 16px;
  padding: 1.15rem 1.1rem 1.05rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.stand-down-kicker {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stand-down-card h2 {
  margin: 0.25rem 0 0.45rem;
  color: #9a3412;
  font-size: 1.45rem;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
}

.stand-down-card p {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.45;
}

.stand-down-card .btn {
  width: 100%;
  min-height: 3.25rem;
  margin-top: 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
}

.stand-down-choices {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.35rem 0 0.75rem;
}

.stand-down-choices label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.85rem;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.task-now-stood-down {
  background: #fff7ed;
  border-color: #c2410c;
  color: #7c2d12;
}

.task-now-stood-down h3,
.task-now-stood-down p,
.task-now-stood-down .task-now-kicker {
  color: #7c2d12;
}

/* Night searches stay dark. The meaning of each colour stays, without a white panel. */
[data-theme="dark"] .task-now-caution {
  background: #3f1212;
  color: #fecaca;
}

[data-theme="dark"] .search-picture-report {
  background: #1e293b;
  color: #e2e8f0;
}

[data-theme="dark"] .search-picture-report.is-eyes_on {
  background: #064e3b;
  color: #a7f3d0;
}

[data-theme="dark"] .search-picture-report.is-help,
[data-theme="dark"] .search-picture-away,

[data-theme="dark"] .task-now .task-report-help {
  background: #431407;
  color: #ffedd5;
  border: 1px solid #fb923c;
}

[data-theme="dark"] .dispatch-toast-urgent {
  background: #431407;
  color: #ffedd5;
  border-color: #fb923c;
}

[data-theme="dark"] .dispatch-toast-urgent p,
[data-theme="dark"] .dispatch-toast-urgent h4 {
  color: #ffedd5;
}

[data-theme="dark"] .stand-down-card,
[data-theme="dark"] .stand-down-card h2,
[data-theme="dark"] .stand-down-card p,
[data-theme="dark"] .task-now-stood-down,
[data-theme="dark"] .task-now-stood-down h3,
[data-theme="dark"] .task-now-stood-down p,
[data-theme="dark"] .task-now-stood-down .task-now-kicker {
  background: #3f1212;
  color: #fecaca;
  border-color: #fb923c;
}

.drone-flight-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.7rem 0 0.45rem;
}

.drone-flight-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.drone-flight-item p {
  margin: 0.15rem 0 0;
}

.world-view {
  position: fixed;
  inset: 0;
  z-index: 6200;
  background: #071018;
  color: var(--text);
}

.world-view[hidden] {
  display: none;
}

.world-canvas {
  position: absolute;
  inset: 0;
}

.world-canvas .cesium-viewer,
.world-canvas .cesium-viewer-cesiumWidgetContainer,
.world-canvas .cesium-widget,
.world-canvas .cesium-widget canvas {
  width: 100%;
  height: 100%;
}

.world-view .cesium-viewer-toolbar {
  top: 0.6rem;
  right: 0.6rem;
}

/* Credits must not capture globe zoom/pan/tilt. Cesium injects widgets.css
   after this file, and on phone the top-placed credit box can stretch over
   the visible globe. Pass gestures through; keep attribution links clickable. */
.world-view .cesium-viewer .cesium-viewer-bottom {
  left: auto;
  right: 0.4rem;
  max-width: min(28rem, 70vw);
  height: auto;
  pointer-events: none;
}
.world-view .cesium-viewer-bottom a,
.world-view .cesium-viewer-bottom button,
.world-view .cesium-credit-expand-link {
  pointer-events: auto;
}

.world-panel {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  bottom: 0.6rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: min(24rem, calc(100vw - 1.2rem));
  padding: 0.9rem;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.world-head,
.world-actions,
.world-row-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.world-head {
  justify-content: space-between;
  align-items: flex-start;
}

.world-head h2 {
  font-size: 1.25rem;
  line-height: 1.15;
  margin: 0;
}

.world-kicker {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}

.world-lead,
.world-credit,
.world-empty,
.world-warn,
.world-notice {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.world-credit {
  margin: 0;
  padding-top: 0.25rem;
  background: var(--surface);
}

.world-notice {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, #D97706 35%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, #D97706 10%, var(--surface));
  color: var(--text);
}

.world-notice[hidden] {
  display: none;
}

.world-notice p {
  margin: 0;
}

.world-notice-detail {
  margin-top: 0.25rem;
}

.world-notice-detail summary {
  cursor: pointer;
  font-weight: 650;
}

.world-notice-detail p {
  margin-top: 0.3rem;
}

.world-preview-banner {
  margin: 0;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  font-size: 0.82rem;
  line-height: 1.4;
}

.world-preview-banner[hidden] {
  display: none;
}

.world-archive-banner,
.archive-map-banner {
  margin: 0.4rem 0 0.7rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  font-size: 0.82rem;
  line-height: 1.4;
}

.world-archive-banner[hidden] {
  display: none;
}

.world-log-map-row .world-check {
  min-height: 44px;
}

.world-log-map-row.is-unavailable {
  opacity: 0.85;
}

.world-log-map-unavailable {
  display: block;
  color: var(--text-secondary, inherit);
}

.world-row-preview {
  border: 1px dashed color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 10px;
  padding: 0.35rem 0.45rem 0.5rem;
}

.world-dialog {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: color-mix(in srgb, #000 45%, transparent);
}

.world-dialog[hidden] {
  display: none;
}

.world-dialog-card {
  width: min(24rem, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.world-dialog-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.world-dialog-copy,
.world-dialog-or {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.world-dialog-or {
  text-align: center;
  font-weight: 650;
}

.world-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
}


.world-import input {
  display: none;
}

.world-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.world-field select,
.world-row-actions select {
  width: 100%;
  min-height: var(--touch);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.world-head,
.world-lead,
.world-actions,
.world-field,
.world-preview-banner,
.world-archive-banner,
.world-notice,
.world-status,
.world-credit {
  flex-shrink: 0;
}

.world-status {
  min-height: 1.2rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.world-status.is-error {
  color: var(--danger);
}

.world-lists {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.world-lists h3 {
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
}

.world-row,
.world-check {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.world-row {
  flex-direction: column;
  margin-bottom: 0.45rem;
}

.world-check {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  align-self: stretch;
  gap: 0.5rem;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
}

.world-check > input[type="checkbox"] {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.world-check > span {
  display: block;
  font-size: inherit;
  color: inherit;
  margin-bottom: 0;
}

.world-check > span:last-child {
  flex: 1 1 auto;
  min-width: 0;
}

.world-check strong,
.world-check small {
  display: block;
}

.world-check small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.world-check strong {
  overflow-wrap: break-word;
}

.world-swatch {
  width: 0.7rem;
  height: 0.7rem;
  flex: 0 0 auto;
  border-radius: 99px;
}

.world-row-actions {
  flex-wrap: wrap;
  padding-left: 1.5rem;
}

.world-row-actions .btn {
  flex: 0 0 auto;
}

.world-layer-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  margin-bottom: 0.65rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.world-layer-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
}

.world-layer-card .world-check {
  width: auto;
  flex: 0 0 auto;
  min-height: 44px;
  min-width: 44px;
}

.world-layer-card .world-check-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.world-layer-card .world-swatch {
  width: 1rem;
  height: 1rem;
}

.world-layer-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.world-layer-name {
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
}

.world-layer-copy small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.world-kind-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.4rem;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface));
  color: var(--text);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.world-layer-style-inline,
.world-layer-style {
  display: grid;
  gap: 0.45rem;
}

.world-layer-style {
  display: none;
}

.world-layer-style summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
}

.world-layer-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.world-palette,
.world-color-input {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 2px solid color-mix(in srgb, var(--border) 70%, #fff);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
}

.world-palette.is-selected,
.world-color-input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.world-color-input {
  padding: 0;
  overflow: hidden;
}

.world-opacity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 3rem;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 650;
}

.world-opacity input[type="range"] {
  width: 100%;
  min-height: 44px;
  margin: 0;
  accent-color: var(--accent);
}

.world-layer-card .world-row-actions {
  padding-left: 0;
}

.world-sheet-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  min-height: 44px;
}

.world-sheet-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.world-sheet-heading h2 {
  font-size: 1.15rem;
  line-height: 1.15;
  margin: 0;
}

.world-sheet-grip {
  display: none;
  flex: 0 0 auto;
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.world-sheet-knob {
  display: block;
  width: 2.4rem;
  height: 0.28rem;
  margin: 0 auto;
  border-radius: 99px;
  background: color-mix(in srgb, var(--muted) 70%, var(--border));
}

.world-panel-hide,
.world-panel-reopen,
.world-sheet-bar .btn,
.world-actions .btn,
.world-actions .world-import {
  min-height: 44px;
}

.world-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.world-panel-reopen {
  position: absolute;
  z-index: 3;
  left: 0.6rem;
  bottom: 0.6rem;
  min-width: 44px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 700;
}

.world-view.is-world-panel-hidden .world-panel {
  display: none;
}

@media (max-width: 800px) {
  .world-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    max-height: none;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-radius: 18px 18px 0 0;
    transition: height 0.2s ease;
  }

  .world-sheet-grip {
    display: block;
  }

  .world-sheet-bar {
    position: relative;
    z-index: 1;
    padding: 0.15rem 0.7rem 0.25rem;
    padding-top: max(0.15rem, env(safe-area-inset-top, 0px));
    touch-action: none;
  }

  .world-kicker {
    display: none;
  }

  .world-view[data-world-sheet="collapsed"] .world-kicker,
  .world-view[data-world-sheet="half"] .world-kicker,
  .world-view[data-world-sheet="full"] .world-kicker {
    display: none;
  }

  .world-view[data-world-sheet="collapsed"] .world-panel {
    height: calc(3.4rem + env(safe-area-inset-bottom, 0px));
    overflow: hidden;
  }

  .world-view[data-world-sheet="collapsed"] .world-panel-body {
    display: none;
  }

  .world-view[data-world-sheet="half"] .world-panel {
    height: min(50dvh, 28rem);
  }

  .world-view[data-world-sheet="full"] .world-panel {
    height: min(92dvh, calc(100% - 2.5rem));
  }

  .world-panel-body {
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    padding: 0 0.85rem 0.9rem;
  }

  .world-panel-body .world-lead,
  .world-panel-body .world-actions,
  .world-panel-body .world-field,
  .world-panel-body .world-preview-banner,
.world-archive-banner,
  .world-panel-body .world-notice,
  .world-panel-body .world-status,
  .world-panel-body .world-credit,
  .world-panel-body .world-lists {
    flex-shrink: 0;
  }

  .world-panel-body .world-lists {
    overflow: visible;
    flex: 0 0 auto;
    min-height: 0;
  }

  .world-credit {
    display: block;
  }

  .world-actions {
    flex-wrap: wrap;
  }

  .world-actions .btn,
  .world-actions .world-import {
    flex: 1 1 calc(50% - 0.45rem);
    min-height: 44px;
    text-align: center;
  }

  .world-panel-reopen {
    left: max(0.7rem, env(safe-area-inset-left, 0px));
    bottom: max(0.7rem, env(safe-area-inset-bottom, 0px));
  }

  .world-view .cesium-viewer .cesium-viewer-bottom {
    top: max(3.2rem, env(safe-area-inset-top, 0px));
    right: auto;
    bottom: auto;
    left: 0.4rem;
    width: auto;
    height: auto;
  }

  .world-layer-card {
    padding: 0.85rem 0.8rem;
    gap: 0.7rem;
  }

  .world-layer-style-inline {
    display: none;
  }

  .world-layer-style {
    display: grid;
  }

  .world-layer-card .world-swatch,
  .world-palette,
  .world-color-input {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .world-opacity {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .world-opacity input[type="range"] {
    min-height: 44px;
  }

  .world-layer-card .world-row-actions .btn {
    min-height: 44px;
  }
}

@media (min-width: 801px) {
  .world-panel-body .world-lead,
  .world-panel-body .world-actions,
  .world-panel-body .world-field,
  .world-panel-body .world-preview-banner,
.world-archive-banner,
  .world-panel-body .world-notice,
  .world-panel-body .world-status,
  .world-panel-body .world-credit {
    flex-shrink: 0;
  }
}


.world-kind-override {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.world-kind-override .btn {
  min-height: 44px;
}

.world-kind-override .btn.is-on {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  font-weight: 700;
}

.ncr-drone-icon {
  background: none;
  border: 0;
}

.ncr-drone-icon svg {
  display: block;
  filter: drop-shadow(0 0 3px rgba(94, 234, 212, 0.85));
}

/* ===== Command dashboard (admin/dispatcher, tablet and desktop only) ===== */

body.command-layout:not(.phone-shell):not(.view-mobile) {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100dvh;
  min-height: 100vh;
}

body.command-layout:not(.phone-shell):not(.view-mobile) > .topbar {
  grid-column: 1 / -1;
  grid-row: 1;
}

body.command-layout:not(.phone-shell):not(.view-mobile) > .command-rail {
  grid-column: 1;
  grid-row: 2;
}

body.command-layout:not(.phone-shell):not(.view-mobile) > main.panels {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

body.command-layout:not(.phone-shell):not(.view-mobile) > .app-nav,
body.command-layout:not(.phone-shell):not(.view-mobile) > .phone-tabbar {
  display: none;
}

.command-rail {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  width: 200px;
  padding: var(--space-4) var(--space-3);
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}

body.command-layout:not(.phone-shell):not(.view-mobile) .command-rail:not([hidden]) {
  display: flex;
}

.command-rail-kicker {
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

.command-rail-sub {
  margin-top: 2px;
  font-size: var(--text-caption);
  color: var(--muted);
}

.command-rail-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.command-rail-btn,
.command-rail-link {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: var(--text-label);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.command-rail-btn:hover,
.command-rail-link:hover {
  background: var(--surface2);
}

.command-rail-btn.is-on {
  background: var(--accent-fill);
  color: #fff;
}

.command-rail-btn:focus-visible,
.command-rail-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.command-rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.command-rail-link {
  color: var(--muted);
  font-weight: 500;
}

#panel-command.command-panel {
  display: none;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 0;
  background: var(--bg);
}

#panel-command.command-panel.active {
  display: flex;
}

.command-case-strip {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4) var(--space-3);
  min-height: 72px;
}

.command-case-kicker {
  font-size: var(--text-caption);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.command-case-name {
  margin: 2px 0 0;
  font-size: var(--text-display);
  line-height: 2.125rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--text);
}

.command-case-meta {
  margin-top: 4px;
  font-size: var(--text-label);
  color: var(--muted);
}

.command-case-flags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: 2px;
}

.command-flag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 600;
}

.command-flag.is-ring {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--ring) 50%, var(--border));
}

.command-flag.is-confirmed {
  color: #fff;
  background: var(--accent-fill);
  border-color: var(--accent-fill);
}

.command-body {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--space-3);
  min-height: 0;
  padding: 0 var(--space-3) var(--space-3);
}

@media (min-width: 1440px) {
  body.command-layout:not(.phone-shell):not(.view-mobile) .command-body {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

@media (max-width: 1279px) {
  body.command-layout:not(.phone-shell):not(.view-mobile) .command-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(42vh, 1fr) auto;
  }

  body.command-layout:not(.phone-shell):not(.view-mobile) .command-inspector {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: 1fr auto;
    gap: var(--space-3);
    overflow: auto;
    max-height: none;
  }

  body.command-layout:not(.phone-shell):not(.view-mobile) .command-method {
    grid-column: 1 / -1;
  }
}

.command-map-slot {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--map-canvas);
  box-shadow: var(--shadow);
}

.command-map-slot #mappingMapView,
.command-map-slot #mappingMapView.mapping-view.active {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.command-map-slot #map,
.command-map-slot #mappingMapView #map {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.command-inspector {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--surface2);
  border: 1px solid var(--border);
}

.command-inspector-title {
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.command-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.command-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
}

button.command-kpi {
  cursor: pointer;
}

button.command-kpi:hover {
  border-color: var(--accent);
}

button.command-kpi:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.command-kpi-label {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--muted);
}

.command-kpi-value {
  font-size: 2rem;
  line-height: 2.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.command-kpi-hint {
  font-size: var(--text-caption);
  color: var(--muted);
}

.command-kpi.is-urgent {
  border-color: var(--danger-fill);
}

.command-kpi.is-urgent .command-kpi-value {
  color: var(--danger);
}

.command-feed {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}

.command-feed li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--space-2);
  font-size: var(--text-label);
  color: var(--text);
}

.command-feed-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.command-empty,
.command-method {
  font-size: var(--text-label);
  color: var(--muted);
  line-height: 1.45;
}

.command-method {
  margin-top: auto;
  padding-top: var(--space-3);
  padding-bottom: var(--space-1);
  border-top: 1px solid var(--border);
  color: var(--accent);
}

/* Search-case status pills, used by the Command switcher. */
.status-pill--ring { --status-color: var(--ring, var(--accent-fill)); }
.status-pill--ring .status-pill-mark::before {
  inset: 0;
  border-radius: 50%;
  border: 1.5px dashed currentColor;
}

.status-pill--confirmed { --status-color: var(--accent-fill); }
.status-pill--confirmed .status-pill-mark::before {
  inset: 0;
  border-radius: 50%;
  background: currentColor;
}
.status-pill--confirmed .status-pill-mark::after {
  inset: 2px;
  border-radius: 50%;
  background: var(--surface);
}

.status-pill--reported { --status-color: var(--warn); }
.status-pill--reported .status-pill-mark::before {
  left: 1px;
  top: 1px;
  width: 6px;
  height: 6px;
  background: currentColor;
  transform: rotate(45deg);
  border-radius: 1px;
}

.status-pill--live { --status-color: var(--live, var(--ok)); }
.status-pill--live .status-pill-mark::before {
  inset: 1px;
  border-radius: 50%;
  background: currentColor;
}

.command-case-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}

.command-switcher {
  position: relative;
  flex: 0 0 auto;
}

.command-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-label);
  font-weight: 600;
  cursor: pointer;
}

.command-switcher-btn:hover {
  border-color: var(--accent);
}

.command-switcher-btn:focus-visible,
.command-switcher-option:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.command-switcher-btn[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--surface2);
}

.command-switcher-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-fill);
  color: #fff;
  font-variant-numeric: tabular-nums;
  font-size: var(--text-caption);
}

.command-switcher-list {
  position: absolute;
  z-index: 80;
  top: calc(100% + 4px);
  right: 0;
  min-width: 280px;
  width: max-content;
  max-width: min(420px, 70vw);
  max-height: min(60vh, 420px);
  overflow: auto;
  margin: 0;
  padding: var(--space-1);
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.command-switcher-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--space-3);
  row-gap: 2px;
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.command-switcher-option .status-pill {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
}

.command-switcher-name {
  grid-column: 1;
  grid-row: 1;
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--text);
}

.command-switcher-open {
  grid-column: 1;
  grid-row: 2;
  font-size: var(--text-caption);
  color: var(--muted);
}

.command-switcher-option:hover {
  background: var(--surface2);
}

.command-switcher-option.is-on {
  background: color-mix(in srgb, var(--accent-fill) 14%, var(--surface));
}

@media (max-width: 1279px) {
  body.command-layout:not(.phone-shell):not(.view-mobile) .command-switcher-list {
    right: 0;
    left: auto;
    max-width: min(420px, calc(100vw - 220px));
  }
}


body.phone-shell .command-rail,
body.view-mobile .command-rail,
body.phone-shell #panel-command,
body.view-mobile #panel-command {
  display: none !important;
}

/* —— Dispatch board and intake queue (blueprint G) —— */
.dispatch-home,
#panel-taskmanager #taskManagerSection {
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  gap: var(--space-3);
}

.dispatch-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dispatch-title,
#taskManagerSectionTitle {
  margin: 0;
  font-size: var(--text-title, 1.25rem);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

.dispatch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.dispatch-toolbar button,
.task-manager-nav.dispatch-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-label);
  font-weight: 600;
  cursor: pointer;
}

.dispatch-toolbar button.is-on,
.task-manager-nav.dispatch-toolbar button.is-on {
  background: var(--accent-fill);
  color: #fff;
  border-color: var(--accent-fill);
}

.dispatch-toolbar button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.dispatch-board {
  display: flex;
  gap: var(--space-2);
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
  padding-bottom: var(--space-2);
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.dispatch-col {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  min-height: 16rem;
  max-height: 100%;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface2);
  scroll-snap-align: start;
}

.dispatch-col-intake {
  flex-basis: 240px;
  border-color: color-mix(in srgb, var(--danger-fill, var(--danger)) 45%, var(--border));
}

.dispatch-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 32px;
  margin-bottom: var(--space-2);
}

.dispatch-col-title {
  margin: 0;
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.dispatch-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  min-height: 1.5rem;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  font-size: var(--text-caption);
  color: var(--muted);
}

.dispatch-col-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.dispatch-card,
.dispatch-intake-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.dispatch-intake-card {
  border-color: color-mix(in srgb, var(--danger-fill, var(--danger)) 50%, var(--border));
}

.dispatch-card-kicker {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--muted);
}

.dispatch-card-title,
.dispatch-intake-card h3 {
  margin: 0;
  font-size: var(--text-label);
  font-weight: 600;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.dispatch-card-who,
.dispatch-intake-card p {
  margin: 0;
  font-size: var(--text-caption);
  color: var(--muted);
}

.dispatch-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
}

.dispatch-held {
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--warn);
}

.dispatch-card-actions,
.intake-action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-1);
}

.dispatch-card-actions .btn,
.intake-action-buttons .btn,
.intake-secondary .btn {
  min-height: var(--touch);
}

.dispatch-col-intake .intake-method {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: var(--text-caption);
  color: var(--accent);
}

/* Intake queue + detail */
.intake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
  min-height: 0;
}

.intake-queue,
.intake-detail {
  min-width: 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface2);
}

.intake-queue-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.intake-queue-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-2) var(--space-3);
  border: 1px solid color-mix(in srgb, var(--danger-fill, var(--danger)) 45%, var(--border));
  border-radius: var(--radius-md);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.intake-queue-item.is-on {
  outline: 2px solid var(--accent-fill);
  outline-offset: 1px;
}

.intake-queue-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.intake-queue-name {
  font-weight: 600;
  color: var(--text);
}

.intake-queue-meta {
  font-size: var(--text-caption);
  color: var(--muted);
}

.intake-detail-head h3 {
  margin: 2px 0 0;
  font-size: var(--text-title, 1.25rem);
  text-transform: none;
  letter-spacing: -0.02em;
  color: var(--text);
}

.intake-spec-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.intake-spec dt {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 0.75rem;
  font-size: var(--text-caption);
  font-weight: 600;
  color: var(--muted);
}

.intake-spec-key {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.8;
}

.intake-spec dd {
  margin: 0;
  font-size: var(--text-body, 1rem);
  color: var(--text);
  overflow-wrap: anywhere;
}

.intake-method {
  margin-top: var(--space-3);
  font-size: var(--text-label);
  color: var(--accent);
  line-height: 1.45;
}

.intake-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

@media (min-width: 840px) {
  .intake-layout {
    grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.4fr);
    align-items: start;
  }
}

@media (min-width: 1024px) {
  .dispatch-col {
    flex-basis: 200px;
  }
  .dispatch-col-intake {
    flex-basis: 230px;
  }
}

body.command-layout:not(.phone-shell):not(.view-mobile) #panel-taskmanager {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  padding: var(--space-3);
  background: var(--bg);
}

body.command-layout:not(.phone-shell):not(.view-mobile) #panel-taskmanager > .ops-panel.card,
body.command-layout:not(.phone-shell):not(.view-mobile) #panel-taskmanager > .dispatch-home {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: var(--space-3);
  box-shadow: none;
  background: var(--bg);
  border: 0;
}

body.command-layout:not(.phone-shell):not(.view-mobile) .dispatch-board {
  flex: 1;
}

body.command-layout:not(.phone-shell):not(.view-mobile) #taskManagerSectionBody {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

body.phone-shell #panel-taskmanager,
body.view-mobile #panel-taskmanager {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

body.phone-shell .dispatch-col,
body.view-mobile .dispatch-col {
  flex-basis: min(260px, 80vw);
}

#taskManagerBack {
  align-self: flex-start;
  min-height: var(--touch);
  width: auto;
  max-width: 100%;
  margin-bottom: var(--space-2);
}


/* Task focus and slimmer Home field card */
.home-on-scene {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: stretch;
}

.home-on-scene .btn {
  min-height: var(--touch);
  width: 100%;
}

.task-details-sheet {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.task-details-sheet[hidden] {
  display: none;
}

.task-details-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: color-mix(in srgb, #000 45%, transparent);
}

.task-details-card {
  position: relative;
  z-index: 1;
  width: min(32rem, 100%);
  max-height: 86dvh;
  overflow: auto;
  padding: 1rem;
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.task-details-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.task-details-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.task-details-card h3 {
  margin: 0.15rem 0 0;
  font-size: 1.1rem;
}

.task-details-body .search-picture-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.task-focus {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.task-focus[hidden] {
  display: none;
}

body.task-focus-open {
  overflow: hidden;
}

.task-focus-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: calc(0.7rem + env(safe-area-inset-top, 0px)) 0.8rem 0.7rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.task-focus-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
}

.task-focus-bar h2 {
  margin: 0.1rem 0 0;
  font-size: 1.15rem;
  line-height: 1.2;
}

.task-focus-bar .btn {
  flex: 0 0 auto;
  min-height: var(--touch);
}

.task-focus-map {
  flex: 1 1 auto;
  min-height: 12rem;
}

.task-focus-hud {
  flex: 0 1 auto;
  overflow: auto;
  padding: 0.7rem 0.8rem calc(0.8rem + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.task-focus-recording {
  margin: 0 0 0.45rem;
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ok, #0F766E) 20%, var(--surface));
  color: var(--text);
  font-weight: 750;
  font-size: 0.9rem;
  width: fit-content;
}

.task-focus-ios,
.task-focus-hint {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.task-focus-hint.is-error {
  color: var(--danger);
}

.task-focus-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  margin: 0 0 0.7rem;
}

.task-focus-stats div {
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.task-focus-stats dt {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.task-focus-stats dd {
  margin: 0.15rem 0 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.task-focus-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.task-focus-actions .btn {
  min-height: var(--touch);
}

.task-focus.is-dropping-pin .task-focus-map {
  cursor: crosshair;
}

.task-focus-sheet {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, #000 45%, transparent);
  padding: 0.75rem;
}

.task-focus-sheet[hidden] {
  display: none;
}

.task-focus-sheet-card {
  width: min(28rem, 100%);
  max-height: 70dvh;
  overflow: auto;
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface);
}

.task-focus-sheet-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.task-focus-sheet-card h3,
.task-focus-sheet-card h4 {
  margin: 0 0 0.4rem;
}

.task-focus-sheet-card .btn,
.task-focus-sheet-card a.btn {
  display: block;
  width: 100%;
  margin: 0 0 0.45rem;
  text-align: center;
}

.task-focus-sheet-card header .btn {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

/* App-wide route recording and in-app Navigate to */
.route-recording-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1rem;
  z-index: 1700;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  width: min(36rem, calc(100vw - 1.2rem));
  padding: 0.65rem 0.8rem;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.route-recording-banner[hidden] {
  display: none;
}

.route-recording-banner-label {
  margin: 0;
  font-weight: 750;
}

.route-recording-banner-meta,
.route-recording-banner-ios {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
  flex: 1 1 12rem;
}

.route-recording-banner .btn {
  margin-left: auto;
  min-height: var(--touch);
}

.route-stop-prompt {
  position: fixed;
  inset: 0;
  z-index: 5600;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, #000 45%, transparent);
  padding: 1rem;
}

.route-stop-prompt[hidden] {
  display: none;
}

.route-stop-prompt-card {
  width: min(28rem, 100%);
  padding: 1rem;
  border-radius: 16px;
  background: var(--surface);
}

.route-stop-prompt-card h3 {
  margin: 0 0 0.4rem;
}

.route-stop-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.task-focus-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, #2563eb 12%, var(--surface));
}

.task-focus-nav[hidden] {
  display: none;
}

.task-focus-nav-arrow {
  flex: 0 0 auto;
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
}

.task-focus-nav-label {
  margin: 0;
  font-weight: 700;
}

.task-focus-nav-meta {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.task-focus-nav .btn {
  margin-left: auto;
}

.map-log-maps-sheet {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 700;
  max-height: min(62vh, 32rem);
  overflow: auto;
  padding: 0.85rem 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px 16px 12px 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
}

.map-log-maps-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.map-log-maps-sheet-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.map-log-map-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.map-log-map-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface2);
}

.map-log-map-tick,
.map-log-map-available,
.log-map-team-toggle {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  font-size: 0.95rem;
  cursor: pointer;
}

.map-log-map-tick input,
.map-log-map-available input,
.log-map-team-toggle input {
  width: 1.25rem;
  height: 1.25rem;
  flex: 0 0 auto;
}

.map-log-map-tick span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.map-log-map-tick small {
  color: var(--muted);
  font-size: 0.8rem;
}

@media (min-width: 801px) {
  .map-log-maps-sheet {
    left: auto;
    width: min(26rem, 42vw);
    right: 0.85rem;
    bottom: 4.5rem;
  }
}


.world-export-card {
  width: min(32rem, 100%);
  max-height: min(90vh, 46rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.world-export-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.world-export-card .world-dialog-actions {
  flex: 0 0 auto;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.world-export-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.55rem 0.7rem 0.7rem;
  margin: 0 0 0.7rem;
}

.world-export-fieldset legend {
  padding: 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 750;
  color: var(--muted);
  text-transform: none;
}

.world-export-choice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 44px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.world-export-choice input {
  width: 1.2rem;
  height: 1.2rem;
  flex: 0 0 auto;
}

.world-export-privacy,
.world-export-overview .hint {
  margin: 0.25rem 0 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.world-export-overview h4 {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.95rem;
}

.world-export-stats {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  margin: 0 0 0.55rem;
}

.world-export-stats > div {
  display: grid;
  grid-template-columns: minmax(7.5rem, 42%) 1fr;
  gap: 0.4rem;
  align-items: baseline;
}

.world-export-stats dt {
  margin: 0;
  color: var(--muted);
  font-weight: 650;
  font-size: 0.82rem;
}

.world-export-stats dd {
  margin: 0;
  font-size: 0.9rem;
}

.world-export-card .world-dialog-actions .btn {
  min-height: 44px;
}

@media (max-width: 800px) {
  [data-world-export-dialog].world-dialog {
    align-items: flex-end;
    padding: 0;
  }

  .world-export-card {
    width: 100%;
    max-height: min(78dvh, calc(var(--app-vh, 100dvh) - 4rem));
    border-radius: 16px 16px 0 0;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  }
}


/* M2 — task area drawing on the Log Map. Keep globe credit pointer-events untouched. */
.log-master-map.log-task-draft-map,
.log-task-draft-map {
  height: min(48dvh, 28rem);
  min-height: 16rem;
  touch-action: none;
}
.log-task-draft-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.log-task-draft-tools .btn {
  min-height: 2.75rem;
  min-width: 2.75rem;
}
.log-task-color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.log-task-color-swatch {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  cursor: pointer;
}
.log-task-color-swatch[aria-pressed="true"] {
  border-color: #fff;
  box-shadow: 0 0 0 2px #4A1C6B;
}
.log-task-radius {
  margin-top: 0.65rem;
}
.log-task-radius label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-weight: 650;
}
.log-task-radius input[type="range"] {
  width: 100%;
  min-height: 2.75rem;
}

.log-form-feed-ok {
  color: #0f766e;
  font-weight: 600;
}
.log-form-feed-hint {
  color: #b45309;
}


/* Shared base-imagery attribution: compact, visible, and not covering the map. */
.leaflet-container .leaflet-control-attribution {
  max-width: min(28rem, 72vw);
  margin: 0;
  padding: 0.15rem 0.4rem;
  font-size: 0.68rem;
  line-height: 1.3;
  background: color-mix(in srgb, var(--surface, #111) 88%, transparent);
  box-shadow: none;
}
.world-field [data-world-imagery] {
  min-height: 44px;
}

.world-credit-float {
  position: absolute;
  right: 0.45rem;
  bottom: 0.45rem;
  z-index: 2;
  max-width: min(22rem, 70vw);
  margin: 0;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.3;
  pointer-events: none;
}
.world-credit-float a {
  pointer-events: auto;
}
@media (max-width: 800px) {
  .world-credit-float {
    bottom: max(4.2rem, calc(env(safe-area-inset-bottom, 0px) + 3.6rem));
    left: 0.45rem;
    right: auto;
    max-width: min(18rem, 62vw);
  }
}


/* Honest offline banner and write-ahead queue (F17) */
.ncr-offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2400;
  margin: 0;
  padding: 0.65rem 1rem 0.75rem;
  background: #3b2c14;
  color: #fff7e6;
  border-bottom: 1px solid #8a6a2f;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}
.ncr-offline-banner.has-queue,
.ncr-offline-banner.is-offline {
  display: block;
}
.ncr-offline-banner p {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  line-height: 1.35;
}
.ncr-offline-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}
.ncr-offline-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  background: color-mix(in srgb, #000 22%, transparent);
}
.ncr-offline-item strong {
  font-size: 0.92rem;
}
.ncr-offline-status {
  font-size: 0.82rem;
  opacity: 0.92;
}
.ncr-offline-item.is-failed .ncr-offline-status,
.ncr-offline-item.is-needs-sign-in .ncr-offline-status {
  color: #ffd0d0;
}
.task-report-queued {
  margin: 0 0 0.6rem;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  background: color-mix(in srgb, #b45309 18%, transparent);
  border: 1px solid color-mix(in srgb, #b45309 45%, transparent);
}

/* Admin session sign-out (F13) */
.admin-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}
.admin-confirm-box {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass, color-mix(in srgb, var(--text) 6%, transparent));
}
.admin-confirm-box p {
  margin: 0 0 0.75rem;
}
#adminSessionActionStatus {
  margin: 0.5rem 0 1rem;
}


/* Incident Commander on a search log */
.log-ic-header {
  margin: 0.35rem 0 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--accent-light, #ede6f4);
  border-left: 4px solid var(--accent, #4a1c6b);
  border-radius: 0 12px 12px 0;
}
.log-ic-header p {
  margin: 0;
  font-size: 1.02rem;
}
.log-ic-header strong,
.log-ic-line strong {
  color: var(--accent, #4a1c6b);
  margin-right: 0.35rem;
}
.log-ic-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 0.75rem;
  align-items: end;
  margin-top: 0.65rem;
}
.log-ic-form .intake-field {
  flex: 1 1 16rem;
  margin: 0;
}
.log-ic-form select {
  min-height: 2.75rem;
  width: 100%;
}
.log-ic-form .btn {
  min-height: 2.75rem;
}

.log-attached-header {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface, #f7f5fb);
  border: 1px solid var(--line, #ddd4ea);
  border-radius: 12px;
}
.log-attached-header > p:first-child {
  margin: 0 0 0.35rem;
}
.log-attached-header strong {
  color: var(--accent, #4a1c6b);
}
.log-attached-list {
  list-style: none;
  margin: 0.4rem 0 0.7rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}
.log-attached-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 0.55rem;
  background: #fff;
  border-radius: 10px;
}
.log-attached-picker {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line, #ddd4ea);
}
.log-attached-picker-list {
  max-height: 18rem;
  overflow: auto;
  margin: 0.5rem 0 0.75rem;
}
.log-attached-picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.log-attached-add-someone {
  margin: 0.55rem 0 0.2rem;
}
.log-attached-picker-list .check-chip {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 0.65rem;
  text-align: left;
}
.log-attached-picker-list .check-chip input {
  margin-top: 0.2rem;
  flex: 0 0 auto;
}
.log-ic-line {
  margin: 0.2rem 0 0.45rem;
}
[data-log-editor-panel="timeline"] {
  padding-top: 0.5rem;
}
[data-log-editor-panel="timeline"] > .intake-subhead {
  scroll-margin-top: 4.5rem;
}

.timeline-entry-ic {
  background: var(--accent-light, #ede6f4);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  border-bottom: none;
  margin-bottom: 0.55rem;
}

.logs-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.logs-home-waiting {
  margin-bottom: 1rem;
}

.log-team-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin: 0.25rem 0 0.15rem;
}

.log-team-tags-field {
  border: 0;
  padding: 0;
  margin: 0 0 0.75rem;
  min-width: 0;
}

.log-team-tags-field legend {
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.log-last-seen-hint {
  margin: 0.2rem 0 0.75rem;
}

.log-map-layer-toggles {
  margin: 0.35rem 0 0.7rem;
}
.log-map-layer-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}
.log-map-layer-chip {
  min-height: 2.4rem;
  padding: 0.35rem 0.7rem;
}


.drone-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.15rem 0 0.9rem;
}

.drone-hub-tab {
  flex: 0 1 auto;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.drone-hub-tab.is-on {
  border-color: var(--accent);
  background: var(--accent-light);
}

.drone-hub-panel-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

#commandRailDroneItem[hidden],
#navDroneOpsItem[hidden],
#phoneMenuDrone[hidden] {
  display: none !important;
}

/* Home, one thing at a time.
   Booked off: the book-on card comes first and the empty status grid is hidden.
   Booked on: the status card leads, with Map, My tasks and Book off beside it.
   A live search always goes to the top; a quiet one sits at the bottom, and
   nothing is shown while the first check is still running. */
#panel-home .home-dashboard > #homeSafetyAlerts { order: 0; }
#panel-home .home-dashboard > .home-search-picture { order: 4; }
#panel-home .home-dashboard > .home-welcome-hero { order: 1; }
#panel-home .home-dashboard > .home-status-card { order: 2; }
#panel-home .home-dashboard > .home-duty-central { order: 3; }

#panel-home .home-dashboard[data-search="live"] > .home-search-picture { order: -1; }
#panel-home .home-dashboard[data-search="loading"] > .home-search-picture { display: none; }

#panel-home .home-dashboard[data-duty="off"] > .home-status-card { display: none; }
#panel-home .home-dashboard[data-duty="on"] > .home-welcome-hero { display: none; }
#panel-home .home-dashboard[data-duty="on"] .home-widget-duty { display: none; }

#panel-home .home-quick-actions { display: none; }
#panel-home .home-dashboard[data-duty="on"] .home-quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.85rem;
}
#panel-home .home-quick-actions .btn {
  width: 100%;
  min-height: var(--touch-lg, 48px);
  justify-content: center;
}

/* ===== Task focus HUD =====
   The map fills the screen. A compact strip at the top shows the task, REC,
   time, distance and GPS quality; four large thumb buttons sit at the bottom.
   Overlays use a dark glass so they read over any basemap, day or night. */
.task-focus.tf {
  display: block;
  background: #0b0b10;
  color: #f5f3f8;
  --tf-glass: rgba(14, 12, 20, 0.82);
  --tf-line: rgba(255, 255, 255, 0.14);
  --tf-safe-top: env(safe-area-inset-top, 0px);
  --tf-safe-bottom: env(safe-area-inset-bottom, 0px);
}
.task-focus.tf[hidden] { display: none; }
.tf-map { position: absolute; inset: 0; z-index: 0; }
.tf .leaflet-control-attribution { font-size: 9px; opacity: 0.7; margin-bottom: calc(6.4rem + var(--tf-safe-bottom)) !important; }

.tf-top {
  position: absolute; z-index: 10; left: 0.6rem; right: 0.6rem;
  top: calc(0.5rem + var(--tf-safe-top));
  padding: 0.55rem 0.6rem 0.5rem 0.75rem;
  background: var(--tf-glass); border: 1px solid var(--tf-line); border-radius: 18px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.tf-top-row { display: flex; align-items: center; gap: 0.55rem; }
.tf-title {
  flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1rem; font-weight: 700; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: inherit;
}
.tf-rec {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.2rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em;
  background: rgba(239, 68, 68, 0.18); color: #fecaca; border: 1px solid rgba(239, 68, 68, 0.45);
}
.tf-rec[hidden] { display: none; }
.tf-rec i { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #ef4444; animation: tf-blink 1.4s infinite; }
@keyframes tf-blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .tf-rec i { animation: none; } }
.tf-close {
  flex: 0 0 auto; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  border: 1px solid var(--tf-line); background: rgba(255, 255, 255, 0.08); color: inherit;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.tf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; margin: 0.45rem 0 0; }
.tf-stats div { margin: 0; }
.tf-stats dt { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: rgba(245, 243, 248, 0.6); }
.tf-stats dd { margin: 0.05rem 0 0; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.tf-stats dd[data-level="ok"] { color: #86efac; }
.tf-stats dd[data-level="warn"] { color: #fcd34d; }
.tf-stats dd[data-level="bad"] { color: #fca5a5; }

.tf-nav {
  position: absolute; z-index: 10; left: 0.6rem; right: 0.6rem;
  top: calc(7.6rem + var(--tf-safe-top));
  display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 0.7rem;
  background: #1d4ed8; color: #fff; border-radius: 18px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}
.tf-nav[hidden] { display: none; }
.tf-nav-arrow { flex: 0 0 auto; width: 3.2rem; height: 3.2rem; display: grid; place-items: center; font-size: 2rem; font-weight: 900; background: rgba(255, 255, 255, 0.16); border-radius: 50%; transition: transform 0.4s ease; }
.tf-nav-text { flex: 1 1 auto; min-width: 0; }
.tf-nav-text p { margin: 0; }
.tf-nav-dist { font-size: 1.5rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tf-nav-label { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tf-nav-meta { font-size: 0.78rem; opacity: 0.85; }
.tf-nav-clear { flex: 0 0 auto; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 700; cursor: pointer; }

.tf-side { position: absolute; z-index: 9; right: 0.7rem; top: 46%; display: flex; flex-direction: column; gap: 0.55rem; }
.tf-round {
  width: 3rem; height: 3rem; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--tf-glass); color: #f5f3f8; border: 1px solid var(--tf-line); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}
.tf-round svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tf-round.is-on { background: #2563eb; border-color: #2563eb; }
.tf-round.is-on svg { fill: currentColor; }

.tf-bottom { position: absolute; z-index: 10; left: 0.6rem; right: 0.6rem; bottom: calc(0.6rem + var(--tf-safe-bottom)); display: flex; flex-direction: column; gap: 0.5rem; }
.tf-toast, .tf-pinbar {
  margin: 0; padding: 0.6rem 0.8rem; border-radius: 14px; font-size: 0.92rem; font-weight: 600;
  background: var(--tf-glass); border: 1px solid var(--tf-line); color: inherit;
}
.tf-toast[hidden], .tf-pinbar[hidden] { display: none; }
.tf-toast.is-error { border-color: rgba(239, 68, 68, 0.6); color: #fecaca; }
.tf-pinbar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; background: #7c2d12; border-color: #ea580c; }
.tf-pill { border: 0; border-radius: 999px; padding: 0.45rem 0.9rem; font-weight: 700; background: rgba(255, 255, 255, 0.2); color: #fff; cursor: pointer; }

.tf-actions { display: grid; grid-template-columns: 1.25fr 1fr 1fr 0.8fr; gap: 0.45rem; }
.tf-act {
  min-height: 4.4rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.25rem;
  border-radius: 18px; border: 1px solid var(--tf-line); background: var(--tf-glass); color: #f5f3f8;
  font-size: 0.9rem; font-weight: 750; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tf-act svg { width: 1.55rem; height: 1.55rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tf-act:active { transform: scale(0.97); }
.tf-act-sighting { background: #ea580c; border-color: #fb923c; color: #fff; }
.tf.is-dropping-pin .tf-map { cursor: crosshair; }

.tf-you { position: relative; width: 28px; height: 28px; }
.tf-you i { position: absolute; inset: 6px; border-radius: 50%; background: #2563eb; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4); }
.tf-you.has-heading::before {
  content: ""; position: absolute; left: 50%; top: -12px; width: 0; height: 0; margin-left: -8px;
  border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 14px solid #2563eb;
  transform-origin: 8px 26px; transform: rotate(var(--tf-heading, 0deg));
}

.tf-sheet { position: absolute; inset: 0; z-index: 20; display: flex; align-items: flex-end; }
.tf-sheet[hidden] { display: none; }
.tf-sheet-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, 0.45); }
.tf-sheet-card {
  position: relative; width: 100%; max-height: 78vh; overflow: auto;
  padding: 0.9rem 0.9rem calc(1rem + var(--tf-safe-bottom));
  background: #16131d; border-top: 1px solid var(--tf-line); border-radius: 22px 22px 0 0;
}
.tf-sheet-card header { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.6rem; }
.tf-sheet-card h3 { margin: 0; font-size: 1.15rem; color: inherit; }
.tf-sheet-lead { margin: 0 0 0.5rem; font-weight: 650; }
.tf-sheet-note { margin: 0.7rem 0 0; font-size: 0.86rem; color: rgba(245, 243, 248, 0.7); }
.tf-sheet-note.is-error { color: #fca5a5; }
.tf-pos strong { color: #f5f3f8; font-variant-numeric: tabular-nums; }
.tf-choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 0.5rem; }
.tf-choice-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tf-choice, .tf-row, .tf-where-btn {
  min-height: 3.3rem; padding: 0.6rem 0.9rem; border-radius: 14px; text-align: left;
  border: 1px solid var(--tf-line); background: rgba(255, 255, 255, 0.06); color: #f5f3f8;
  font-size: 1rem; font-weight: 650; cursor: pointer;
}
.tf-choice.is-on, .tf-choice.is-primary, .tf-where-btn.is-primary { background: #2563eb; border-color: #3b82f6; color: #fff; }
.tf-field { display: flex; flex-direction: column; gap: 0.3rem; margin-top: 0.7rem; font-size: 0.86rem; color: rgba(245, 243, 248, 0.75); }
.tf-field input { min-height: 3rem; padding: 0 0.8rem; border-radius: 12px; border: 1px solid var(--tf-line); background: rgba(255, 255, 255, 0.06); color: #f5f3f8; font-size: 1rem; }
.tf-where { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-top: 0.8rem; }
.tf-where-btn { text-align: center; }
.tf-rows { display: flex; flex-direction: column; gap: 0.5rem; }
.tf-row-exit { color: #fecaca; border-color: rgba(239, 68, 68, 0.45); }
body.task-focus-open .route-recording-banner { display: none !important; }

/* ===== Simple map controls =====
   On the general map only the context chip, Locate, Layers and one Add button
   show. The older bottom bar, tools checkbox, Advanced button, quick buttons
   and the drawing dock stay in the page (the simple controls drive them) but
   are hidden. */
#mappingMapView.ms-on .map-bottom-bar,
#mappingMapView.ms-on .map-core-controls,
#mappingMapView.ms-on .map-menu-toggle,
#mappingMapView.ms-on .map-quick-actions,
#mappingMapView.ms-on .map-draw-dock { display: none !important; }
body.phone-shell #mappingMapView.ms-on .leaflet-control-zoom { display: none; }
#mappingMapView.ms-on .leaflet-bottom .leaflet-control-attribution { font-size: 9px; opacity: 0.75; }

.ms-side { position: absolute; z-index: 600; right: 0.75rem; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 0.6rem; }
.ms-round, .ms-add {
  display: grid; place-items: center; cursor: pointer; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.ms-round { width: 3.1rem; height: 3.1rem; border-radius: 50%; }
.ms-round svg, .ms-add svg, .ms-row svg, .ms-link svg { width: 1.35rem; height: 1.35rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms-add {
  position: absolute; z-index: 600; right: 0.75rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 0.4rem; height: 3.5rem; padding: 0 1.3rem 0 1.05rem; border-radius: 999px;
  background: var(--accent); border-color: var(--accent); color: var(--accent-on, #fff); font-size: 1.05rem; font-weight: 750;
}
.ms-add[hidden], #mappingMapView.ms-drawing .ms-add, #mappingMapView.ms-drawing .ms-side { display: none; }

.ms-drawbar {
  position: absolute; z-index: 650; left: 0.75rem; right: 0.75rem; bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.55rem 0.8rem; padding: 0.7rem 0.8rem;
  background: var(--surface); border: 2px solid var(--accent); border-radius: 18px; box-shadow: 0 8px 26px rgba(0, 0, 0, 0.3);
}
.ms-drawbar-text { flex: 1 1 11rem; }
#mappingMapView.ms-drawing .leaflet-marker-icon,
#mappingMapView.ms-drawing .leaflet-marker-shadow { pointer-events: none; }
.ms-drawbar[hidden] { display: none; }
.ms-drawbar-text { margin: 0; font-weight: 700; font-size: 1rem; color: var(--text); }
.ms-drawbar-btns { display: flex; gap: 0.5rem; justify-content: flex-end; margin-left: auto; }
.ms-pill { min-height: 2.9rem; padding: 0 1.1rem; border-radius: 999px; border: 1px solid var(--border); background: var(--panel-muted, transparent); color: var(--text); font-weight: 700; font-size: 0.98rem; cursor: pointer; }
.ms-pill[hidden] { display: none; }
.ms-pill.is-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-on, #fff); }

.ms-sheet { position: absolute; inset: 0; z-index: 700; display: flex; align-items: flex-end; justify-content: center; }
.ms-sheet[hidden] { display: none; }
.ms-sheet-backdrop { position: absolute; inset: 0; border: 0; background: rgba(0, 0, 0, 0.4); }
.ms-sheet-card {
  position: relative; width: 100%; max-width: 30rem; max-height: 80%; overflow: auto;
  padding: 0.9rem 0.9rem calc(1rem + env(safe-area-inset-bottom, 0px));
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.25);
}
.ms-sheet-card header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.ms-sheet-card h3 { margin: 0; font-size: 1.15rem; }
.ms-x { width: 2.5rem; height: 2.5rem; border-radius: 50%; border: 1px solid var(--border); background: transparent; color: var(--text); font-weight: 700; cursor: pointer; }
.ms-rows { display: flex; flex-direction: column; gap: 0.45rem; }
.ms-rows-compact { margin-top: 0.8rem; }
.ms-row {
  display: flex; align-items: center; gap: 0.8rem; min-height: 3.6rem; padding: 0.55rem 0.8rem; text-align: left; cursor: pointer;
  border-radius: 14px; border: 1px solid var(--border); background: transparent; color: var(--text);
}
.ms-row svg { flex: 0 0 auto; width: 1.55rem; height: 1.55rem; color: var(--accent); }
.ms-row span, .ms-toggle span { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.ms-row strong, .ms-toggle strong { font-size: 1rem; font-weight: 700; }
.ms-row small, .ms-toggle small { font-size: 0.82rem; color: var(--muted); }
.ms-link { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; padding: 0.5rem 0.2rem; border: 0; background: transparent; color: var(--accent); font-weight: 700; font-size: 0.95rem; cursor: pointer; }
.ms-tip { margin: 0.8rem 0 0; font-size: 0.84rem; color: var(--muted); }
.ms-label { margin: 0.6rem 0 0.4rem; font-size: 0.75rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ms-label:first-child { margin-top: 0; }
.ms-chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ms-chip { min-height: 2.6rem; padding: 0 0.95rem; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text); font-weight: 650; cursor: pointer; }
.ms-chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--accent-on, #fff); }
.ms-toggle { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; min-height: 3.3rem; padding: 0.4rem 0.2rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.ms-toggle input { width: 1.4rem; height: 1.4rem; accent-color: var(--accent); flex: 0 0 auto; }
#mappingMapView.ms-far .search-map-wrap .marker-callsign { display: none; }

/* Drone Team Hub: profiles and observation history */
.drone-profile-toolbar { margin: 0.4rem 0 0.7rem; }
.drone-profile-own {
  margin: 0 0 0.8rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 14px;
  background: var(--accent-light);
}
.drone-profile-own h4 { margin: 0 0 0.3rem; font-size: 0.95rem; }
.drone-profile-own p { margin: 0.2rem 0; }
.drone-profile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.45rem; }
.drone-profile-open {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  min-height: 3rem;
  padding: 0.65rem 0.8rem;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.drone-profile-name { font-weight: 750; }
.drone-profile-role { font-size: 0.88rem; }
.drone-pill {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
.drone-pill.is-yes { border-color: var(--ok); color: var(--ok); }
.drone-profile-title { margin-top: 0.7rem; }
.drone-profile-facts { display: grid; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }
.drone-profile-facts div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.2rem 0.8rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.drone-profile-facts dt { font-size: 0.82rem; color: var(--muted); font-weight: 650; }
.drone-profile-facts dd { margin: 0; font-weight: 700; }
.drone-profile-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0.6rem 0; }
.drone-observation { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.6rem; }
.drone-observation p { margin: 0.2rem 0 0; }
.drone-profile-form, .drone-observation-form { margin-top: 0.8rem; max-width: 34rem; }
.drone-profile-form[hidden], #droneProfileContactWrap[hidden] { display: none; }

/* The old bottom toolbar is hidden in simple mode, so the measured
   --map-sheet-bottom would push the tools drawer off the top of the screen.
   Sit the drawer just above the tab bar instead. */
body.phone-shell #mappingMapView.ms-on { --map-sheet-bottom: calc(var(--phone-tab-h, 4rem) + 0.5rem) !important; }
/* Keep the GPS warning clear of the Add button. */
body.phone-shell #mappingMapView.ms-on .map-gps-chip { top: 3.4rem; bottom: auto; left: 0.6rem; right: auto; }
