
:root {
  --leaflet-filter: none;
  --map-glow: rgba(11,119,173,0.18);
}
body.theme-dark {
  --bg: #08131d;
  --panel: rgba(9, 22, 33, 0.92);
  --panel-soft: #0d2131;
  --panel-strong: #12283a;
  --border: rgba(120, 156, 184, 0.22);
  --text: #e8f1f8;
  --muted: #9fb2c4;
  --primary: #58b8ff;
  --primary-dark: #2f8fd5;
  --primary-soft: rgba(88, 184, 255, 0.12);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;
  --shadow-lg: 0 18px 40px rgba(2, 8, 23, 0.46);
  --shadow-md: 0 10px 24px rgba(2, 8, 23, 0.34);
  --leaflet-filter: saturate(.95) brightness(.92) contrast(1.05);
  --map-glow: rgba(88,184,255,0.24);
}

:root {
  --bg: #eaf0f6;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-soft: #f5f8fb;
  --panel-strong: #ffffff;
  --border: #d5e0ea;
  --text: #15212b;
  --muted: #66788a;
  --primary: #19488c;
  --primary-dark: #123567;
  --primary-soft: rgba(25, 72, 140, 0.1);
  --success: #1f7a4f;
  --warning: #b7791f;
  --danger: #b93c3c;
  --info: #0b77ad;
  --shadow-lg: 0 18px 40px rgba(17, 24, 39, 0.12);
  --shadow-md: 0 10px 24px rgba(17, 24, 39, 0.08);
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: Inter, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(11,119,173,0.10), transparent 30%),
    radial-gradient(circle at top right, rgba(25,72,140,0.08), transparent 24%),
    var(--bg);
}
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.boot-fallback-banner {
  position: fixed;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 6000;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(123, 29, 29, 0.96);
  color: #fff7f7;
  border: 1px solid rgba(254, 202, 202, 0.48);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.28);
}

.boot-fallback-banner[hidden] {
  display: none !important;
}

.boot-fallback-banner strong {
  font-size: 14px;
}

.boot-fallback-banner span {
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

#app-shell {
  display: grid;
  grid-template-columns: 390px 1fr;
  height: 100vh;
}

#sidebar {
  position: relative;
  z-index: 1000;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(248,251,253,0.96) 0%, rgba(239,245,250,0.96) 100%);
  backdrop-filter: blur(12px);
}

.sidebar-inner {
  height: 100%;
  overflow-y: auto;
  padding: 18px;
  scrollbar-width: thin;
}

#map-shell { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; }

.map-toolbar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 900;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(213, 224, 234, 0.92);
  border-radius: 18px;
  box-shadow: var(--shadow-md);
}

.map-toolbar-left,
.map-toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.map-toolbar-right { justify-content: flex-end; flex-wrap: wrap; }

.map-title-wrap { display: flex; flex-direction: column; gap: 2px; }
.map-title-wrap strong { font-size: 14px; }
.map-title-wrap span { color: var(--muted); font-size: 12px; }

.map-health-pill,
.status-pill,
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(247,250,252,0.95);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
}

.brand-card,
.toolbar-card,
.panel,
.section-nav {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.brand-card {
  padding: 18px;
  margin-bottom: 14px;
}

.brand-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.brand-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.02;
  letter-spacing: -0.03em;
}
.lede { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 44ch; }
.brand-badge {
  align-self: flex-start;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 122, 79, 0.1);
  color: var(--success);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.command-card { padding: 14px; margin-bottom: 14px; }
.toolbar-grid { display: grid; gap: 8px; }
.top-actions { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.button,
.icon-button {
  border: none;
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover,
.icon-button:hover { background: var(--primary-dark); transform: translateY(-1px); }
.button:disabled,
.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}
.button-secondary { background: #eaf1f8; color: var(--primary); }
.button-secondary:hover { background: #dae7f5; }
.button-ghost { background: transparent; color: var(--primary); border: 1px solid #d6e2f0; }
.button-ghost:hover { background: #eff5fb; }
.icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 12px;
}
.search-wrap input {
  width: 100%;
  padding: 12px 13px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  outline: none;
}
.search-wrap input:focus { border-color: #9db7d7; box-shadow: 0 0 0 4px rgba(25,72,140,.08); }
.status-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.dot { width: 8px; height: 8px; border-radius: 999px; }
.dot-live { background: var(--success); }
.dot-cache { background: var(--primary); }
.dot-empty { background: #94a3b8; }

.quick-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 8px;
  margin-top: 12px;
}
.quick-stat {
  padding: 10px 12px;
  background: linear-gradient(180deg, #ffffff, #f6f9fc);
  border: 1px solid #dfE7ef;
  border-radius: 14px;
}
.quick-stat-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.quick-stat strong { display: block; margin-top: 4px; font-size: 21px; color: var(--primary-dark); }

.section-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  gap: 8px;
  padding: 10px;
  margin-bottom: 14px;
}
.section-chip {
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
  padding: 10px 8px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.section-chip.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(25,72,140,.22);
}

.panel { margin-bottom: 14px; overflow: hidden; }
.panel-header,
.accordion-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px;
  background: transparent;
  border: none;
  text-align: left;
}
.panel-header h2,
.accordion-toggle span:first-child {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}
.panel-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.panel-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.accordion-toggle { cursor: pointer; align-items: center; }
.accordion-toggle::after {
  content: '▾';
  margin-left: auto;
  color: var(--muted);
  font-size: 14px;
}
.accordion:not(.open) .accordion-toggle::after { transform: rotate(-90deg); }
.accordion-body { padding: 0 16px 16px; }
.accordion:not(.open) .accordion-body { display: none; }

.layer-groups { padding: 0 16px 16px; display: grid; gap: 12px; }
.layer-group {
  border: 1px solid #e2eaf2;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f8fbfe);
}
.layer-group-title {
  padding: 11px 14px;
  border-bottom: 1px solid #e8eef5;
  font-weight: 800;
  font-size: 12px;
  color: var(--primary);
  letter-spacing: .05em;
  text-transform: uppercase;
}
.layer-list { display: grid; }
.layer-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 13px 14px;
  border-top: 1px solid #eef2f6;
}
.layer-item:first-child { border-top: none; }
.layer-item-main { min-width: 0; }
.layer-item-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.layer-item-desc { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.layer-item-statuses { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.layer-item-detail { margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.layer-swatch,
.legend-dot { width: 10px; height: 10px; border-radius: 999px; flex-shrink: 0; }
.layer-feature-count { color: var(--muted); font-size: 11px; white-space: nowrap; }

.feed-cards,
.stack-cards { display: grid; gap: 10px; }
.feed-card,
.info-card {
  border: 1px solid #e1e9f0;
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 13px;
}
.feed-card-head,
.info-card-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.feed-card h3,
.info-card h3 { margin: 0; font-size: 14px; }
.card-subtle { margin-top: 4px; color: var(--muted); font-size: 12px; }
.feed-badge,
.task-priority,
.operator-status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.feed-ok { background: rgba(31,122,79,0.1); color: var(--success); }
.feed-live { background: rgba(31,122,79,0.1); color: var(--success); }
.feed-empty { background: rgba(148,163,184,0.14); color: #516172; }
.feed-muted { background: rgba(100,116,139,0.14); color: #516172; }
.feed-alert { background: rgba(185,60,60,0.12); color: var(--danger); }
.feed-warn { background: rgba(183,121,31,0.12); color: var(--warning); }
.feed-info { background: rgba(11,119,173,0.12); color: var(--info); }
.feed-pending { background: rgba(11,119,173,0.12); color: var(--info); }
.priority-high { background: rgba(185,60,60,0.12); color: var(--danger); }
.priority-medium { background: rgba(183,121,31,0.12); color: var(--warning); }
.priority-low { background: rgba(25,72,140,0.12); color: var(--primary); }
.status-available { background: rgba(31,122,79,0.12); color: var(--success); }
.status-standby, .status-monitoring { background: rgba(183,121,31,0.12); color: var(--warning); }
.status-busy, .status-unavailable { background: rgba(185,60,60,0.12); color: var(--danger); }
.feed-card-meta,
.info-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.meta-tile {
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--panel-soft);
  border: 1px solid #e5edf5;
}
.meta-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.meta-value { display: block; font-size: 13px; font-weight: 700; }

.legend-inline { display: flex; gap: 8px; flex-wrap: wrap; }
.popup-title { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.popup-grid { display: grid; gap: 6px; }
.popup-row { display: grid; grid-template-columns: minmax(76px, 88px) minmax(0, 1fr); gap: 8px; font-size: 12px; align-items: start; min-width: 0; }
.popup-row strong { color: var(--muted); }
.popup-row strong,
.popup-row span,
.popup-title,
.popup-subtitle,
.popup-note,
.rf-popup,
.leaflet-popup-content {
  min-width: 0;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: normal;
}
.popup-subtitle { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.popup-note { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.leaflet-popup-content-wrapper,
.leaflet-popup-tip { box-shadow: var(--shadow-md); }
.rf-popup,
.popup-card-default,
.leaflet-popup-content {
  min-width: min(260px, calc(100vw - 96px));
  max-width: min(320px, calc(100vw - 96px));
}
.rf-popup .popup-grid,
.popup-card-default .popup-grid,
.leaflet-popup-content .popup-grid {
  grid-template-columns: 1fr !important;
}

.mini-grid { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; }
.mini-stat { background:#f5f7fb; border:1px solid #d9e2f0; border-radius:14px; padding:10px 12px; }
.mini-stat strong { display:block; font-size:12px; color:#5d6b82; text-transform:uppercase; letter-spacing:.04em; }
.mini-stat span { display:block; margin-top:4px; font-size:18px; font-weight:700; color:#173a6a; }
.compact-stack .info-card { margin-bottom:0; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(25,72,140,.18); }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: #19488c; color:#fff; font-weight:700; }
.subpanel-title { margin: 10px 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.feed-note { margin-top: 10px; padding: 8px 10px; border-radius: 10px; background: var(--panel-soft); color: var(--muted); font-size: 12px; }
.map-glyph { background: rgba(255,255,255,.92); border: 1px solid #cfd9e5; border-radius: 999px; box-shadow: 0 3px 10px rgba(15,23,42,.08); color: #173a6a; font-size: 10px; font-weight: 800; padding: 1px 5px; }
.status-line { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; color: var(--muted); font-size: 12px; }
.status-chip {
  display:inline-flex; align-items:center; gap:6px; padding:5px 9px; border-radius:999px; font-weight:700; font-size:12px; border:1px solid var(--border); background:#fff;
}
.action-row { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:8px; margin-top:10px; }
.action-row.compact-three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.ops-action { width: 100%; min-width: 0; padding: 10px 8px; font-size: 13px; }
.mini-meta { margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.ops-type {
  margin-bottom: 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

[data-section-panel].is-hidden { display: none !important; }
.mobile-only { display: none; }
#sidebar-open { display: none; }
body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
body.sidebar-open #sidebar { transform: translateX(0); }

@media (max-width: 1200px) {
  #app-shell { grid-template-columns: 340px 1fr; }
  .quick-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .section-nav { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 980px) {
  #app-shell { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(420px, 92vw);
    height: 100vh;
    transform: translateX(0);
    transition: transform .22s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-collapsed #sidebar { transform: translateX(-100%); }
  #sidebar-open,
  .mobile-only { display: inline-grid; }
  .brand-row { align-items: flex-start; }
  .map-toolbar {
    left: 10px;
    right: 10px;
    top: 10px;
    align-items: flex-start;
    flex-direction: column;
  }
  .map-toolbar-right { width: 100%; justify-content: space-between; }
}

@media (max-width: 640px) {
  .top-actions,
  .quick-stats,
  .section-nav,
  .feed-card-meta,
  .info-card-meta,
  .mini-grid,
  .toolbar-grid,
  .action-row,
  .action-row.compact-three {
    grid-template-columns: 1fr;
  }
  .map-toolbar-right { flex-direction: column; align-items: stretch; }
  .legend-inline { display:none; }
}

/* Fourth pass: dispatch console / workflow UX */
.ops-workspace-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ops-workspace-header {
  align-items: flex-start;
  gap: 12px;
}

.ops-workspace-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ops-summary-card {
  background: linear-gradient(180deg, rgba(25, 72, 140, 0.08), rgba(255,255,255,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-md);
}

.ops-summary-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.ops-summary-card strong {
  font-size: 28px;
  line-height: 1;
}

.ops-tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.ops-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.ops-grid-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 14px;
}

.ops-primary-column,
.ops-secondary-column {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ops-list-panel,
.ops-focus-card {
  background: rgba(255,255,255,0.74);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.ops-list-head,
.ops-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ops-list-head h3,
.ops-focus-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.ops-list-head p,
.ops-focus-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.ops-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.ops-item-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--panel-strong);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.ops-item-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25,72,140,0.12);
}

.ops-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ops-item-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 4px;
}

.ops-item-subtitle,
.ops-item-meta,
.ops-focus-meta,
.ops-focus-note,
.ops-recommendation-item {
  color: var(--muted);
  font-size: 13px;
}

.ops-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.ops-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ops-badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.ops-badge.priority-critical,
.ops-badge.alert-critical { background: rgba(185,60,60,0.14); color: var(--danger); }
.ops-badge.priority-high,
.ops-badge.alert-high { background: rgba(183,121,31,0.14); color: var(--warning); }
.ops-badge.priority-medium,
.ops-badge.alert-medium { background: rgba(11,119,173,0.12); color: var(--info); }
.ops-badge.priority-low,
.ops-badge.alert-low { background: rgba(102,120,138,0.12); color: var(--muted); }
.ops-badge.status-open,
.ops-badge.status-active,
.ops-badge.status-available { background: rgba(31,122,79,0.12); color: var(--success); }
.ops-badge.status-monitoring,
.ops-badge.status-pending,
.ops-badge.status-assigned { background: rgba(11,119,173,0.12); color: var(--info); }
.ops-badge.status-unavailable,
.ops-badge.status-closed,
.ops-badge.status-overdue { background: rgba(185,60,60,0.12); color: var(--danger); }

.ops-item-actions,
.ops-focus-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-focus-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 180px;
}

.ops-focus-body.empty-state {
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--muted);
  background: var(--panel-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}

.ops-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 10px;
}

.ops-focus-stat {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}

.ops-focus-stat strong {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.ops-focus-stat span {
  font-size: 15px;
  font-weight: 700;
}

.ops-recommendations {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ops-recommendation-item {
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
}

.panel.is-hidden,
.ops-list-panel.is-hidden { display: none !important; }

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

@media (max-width: 720px) {
  .ops-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ops-workspace-actions { width: 100%; }
  .ops-workspace-actions .button { flex: 1 1 140px; }
  .ops-focus-grid { grid-template-columns: 1fr; }
}


/* Fifth pass: dispatch console cleanup / responsive redesign */
#app-shell {
  grid-template-columns: minmax(360px, 460px) 1fr;
}

.ops-workspace-panel {
  gap: 12px;
}

.ops-workspace-header {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.ops-workspace-header .panel-description {
  max-width: 54ch;
  line-height: 1.45;
}

.ops-workspace-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.ops-workspace-actions .button {
  width: 100%;
  min-height: 44px;
}

.ops-summary-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ops-summary-card {
  padding: 10px 12px;
  box-shadow: none;
  background: linear-gradient(180deg, #fbfdff, #f3f7fb);
}

.ops-summary-label {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.ops-summary-card strong {
  font-size: 24px;
}

.ops-tab-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 4px;
}

.ops-tab {
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.ops-tab.active {
  box-shadow: 0 2px 8px rgba(15,23,42,.08);
}

.ops-grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.ops-secondary-column {
  order: -1;
  gap: 12px;
}

.ops-primary-column {
  gap: 12px;
}

.ops-list-panel,
.ops-focus-card {
  background: #fff;
  padding: 12px;
}

.ops-focus-card:first-child {
  position: sticky;
  top: 8px;
  z-index: 2;
}

.ops-focus-head,
.ops-list-head {
  margin-bottom: 10px;
}

.ops-list-head h3,
.ops-focus-head h3 {
  font-size: 17px;
}

.ops-list-head p,
.ops-focus-head p {
  font-size: 12px;
  line-height: 1.4;
}

.ops-list {
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.ops-item-card {
  gap: 8px;
  padding: 10px;
}

.ops-item-top {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ops-item-title {
  font-size: 15px;
  line-height: 1.25;
}

.ops-item-subtitle,
.ops-item-meta,
.ops-focus-meta,
.ops-focus-note,
.ops-recommendation-item {
  font-size: 12px;
  line-height: 1.45;
}

.ops-item-meta {
  display: grid;
  gap: 4px;
}

.ops-badges {
  justify-content: flex-start;
}

.ops-item-actions,
.ops-focus-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ops-item-actions .button,
.ops-focus-actions .button {
  width: 100%;
}

.ops-focus-body {
  min-height: 0;
}

.ops-focus-body.empty-state {
  min-height: 120px;
  padding: 14px;
}

.ops-focus-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ops-focus-stat {
  padding: 9px 10px;
}

.ops-focus-stat strong {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.ops-focus-stat span {
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}

.ops-recommendations {
  gap: 8px;
}

.ops-recommendation-item {
  padding: 9px 10px;
}

.empty-state {
  color: var(--muted);
  border: 1px dashed var(--border);
  background: var(--panel-soft);
  border-radius: 14px;
  padding: 14px;
  text-align: center;
}

@media (max-width: 1200px) {
  #app-shell {
    grid-template-columns: minmax(320px, 420px) 1fr;
  }
}

@media (max-width: 980px) {
  .ops-workspace-panel {
    gap: 10px;
  }

  .ops-focus-card:first-child {
    position: static;
  }
}

@media (max-width: 720px) {
  .ops-workspace-actions {
    grid-template-columns: 1fr;
  }

  .ops-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-list {
    max-height: none;
  }

  .ops-item-actions,
  .ops-focus-actions,
  .ops-focus-grid {
    grid-template-columns: 1fr;
  }

  .ops-tab-bar {
    position: sticky;
    top: 0;
    z-index: 3;
  }
}

@media (max-width: 480px) {
  .ops-summary-strip {
    grid-template-columns: 1fr;
  }

  .ops-tab {
    font-size: 12px;
    padding: 9px 6px;
  }
}


/* Sixth pass: dispatch console polish and create-flow fixes */
#app-shell {
  grid-template-columns: minmax(380px, 500px) 1fr;
}

.sidebar-inner {
  padding: 16px;
}

.ops-workspace-panel {
  padding: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,249,252,0.98));
}

.ops-workspace-header {
  gap: 12px;
}

.ops-workspace-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.ops-workspace-actions .button {
  min-height: 52px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.2;
}

.ops-summary-strip {
  margin-top: 2px;
}

.ops-summary-card {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 16px;
}

.ops-summary-card.attention {
  border-color: rgba(185,60,60,0.22);
  background: linear-gradient(180deg, rgba(255,245,245,0.98), rgba(255,250,250,0.98));
}

.ops-tab-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(245,248,251,0.96);
  backdrop-filter: blur(8px);
}

.ops-tab {
  min-height: 44px;
  font-size: 14px;
}

.ops-primary-column,
.ops-secondary-column {
  gap: 10px;
}

.ops-list-panel,
.ops-focus-card {
  border-radius: 18px;
  background: rgba(255,255,255,0.98);
}

.ops-list {
  max-height: 360px;
}

.ops-item-card {
  border-radius: 16px;
  padding: 12px;
}

.ops-item-title {
  font-size: 15px;
}

.ops-item-subtitle {
  font-size: 12px;
}

.ops-item-meta {
  gap: 6px;
}

.ops-item-meta span,
.ops-focus-meta,
.ops-recommendation-item {
  line-height: 1.5;
}

.ops-item-actions {
  grid-template-columns: 1fr;
}

.ops-item-actions .button {
  min-height: 40px;
}

.ops-focus-head {
  align-items: flex-start;
}

.ops-focus-body {
  min-height: 140px;
}

.ops-focus-grid {
  grid-template-columns: 1fr;
}

.ops-focus-stat {
  border-radius: 14px;
}

.ops-recommendations {
  max-height: 220px;
  overflow: auto;
}

.empty-state {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 1100px) {
  #app-shell {
    grid-template-columns: minmax(340px, 440px) 1fr;
  }
}

@media (max-width: 980px) {
  #app-shell {
    grid-template-columns: 1fr;
  }

  .ops-workspace-actions {
    grid-template-columns: 1fr;
  }

  .ops-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-tab-bar {
    top: -1px;
  }

  .ops-list {
    max-height: none;
  }
}

@media (max-width: 560px) {
  .brand-card,
  .command-card,
  .section-nav,
  .panel {
    border-radius: 16px;
  }

  .ops-summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .ops-summary-card strong {
    font-size: 22px;
  }

  .ops-workspace-actions .button {
    font-size: 14px;
  }
}


/* v4.2 dispatch console polish */
.ops-workspace-panel { overflow: hidden; }
.ops-workspace-actions .button { min-height: 48px; }
.ops-summary-card { min-height: 88px; justify-content: center; }
.ops-tab { min-height: 44px; }
.ops-focus-body.empty-state { min-height: 160px; display:flex; align-items:center; justify-content:center; text-align:center; }
.ops-item-actions .button, .ops-focus-actions .button { width: 100%; }
@media (max-width: 640px) {
  .ops-workspace-panel { padding: 16px; }
  .ops-workspace-header { gap: 12px; }
  .ops-workspace-actions { grid-template-columns: 1fr; display:grid; }
  .ops-summary-strip { grid-template-columns: 1fr 1fr; }
  .ops-tab-bar { grid-template-columns: 1fr 1fr 1fr; display:grid; }
}

/* Phase 10 stability + auth + forms */
.ops-auth-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f7faff);
}

.ops-auth-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.ops-auth-status {
  margin-top: 2px;
  font-size: 14px;
  color: var(--text);
}

.ops-auth-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-composer-card {
  border: 1px solid rgba(11,119,173,.14);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f6fbff);
  padding: 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.ops-composer-card.is-hidden { display: none; }

.ops-composer-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.ops-composer-head h3 {
  margin: 0;
  font-size: 18px;
}

.ops-composer-head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.ops-composer-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ops-form-grid {
  display: grid;
  gap: 10px;
}

.ops-form-grid.two-up { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ops-form-grid.three-up { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-field span {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.form-field textarea {
  resize: vertical;
}

.ops-form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ops-form-actions .button {
  min-height: 44px;
}

.ops-focus-actions {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

@media (max-width: 720px) {
  .ops-auth-panel,
  .ops-composer-head {
    flex-direction: column;
    align-items: stretch;
  }

  .ops-auth-actions,
  .ops-form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .ops-form-grid.two-up,
  .ops-form-grid.three-up {
    grid-template-columns: 1fr;
  }
}


/* v4.4 dispatch console polish */
.ops-layout { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(300px,.9fr); gap: 14px; align-items: start; }
.ops-primary-column, .ops-secondary-column { min-width: 0; display: grid; gap: 14px; }
.ops-auth-panel { display:flex; justify-content:space-between; gap:12px; align-items:center; padding:12px 14px; margin-bottom:12px; background:linear-gradient(180deg,#fff,#f7fafd); border:1px solid var(--border); border-radius:16px; }
.ops-auth-title { font-weight:800; font-size:14px; }
.ops-auth-status { color:var(--muted); font-size:12px; }
.ops-auth-actions { display:flex; gap:8px; flex-wrap:wrap; }
.ops-composer-card { margin-bottom:12px; padding:14px; background:linear-gradient(180deg,#fff,#f7fafd); border:1px solid var(--border); border-radius:18px; box-shadow: var(--shadow-md); }
.ops-composer-card.is-hidden { display:none; }
.ops-composer-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:10px; }
.ops-composer-head h3 { margin:0 0 4px; font-size:20px; }
.ops-composer-head p { margin:0; color:var(--muted); font-size:13px; }
.ops-composer-form { display:grid; gap:10px; }
.ops-form-grid { display:grid; gap:10px; }
.ops-form-grid.two-up { grid-template-columns: repeat(2,minmax(0,1fr)); }
.ops-form-grid.three-up { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-field { display:grid; gap:6px; }
.form-field span { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); font-weight:700; }
.form-field input, .form-field select, .form-field textarea { width:100%; padding:11px 12px; border-radius:12px; border:1px solid var(--border); background:#fff; }
.form-field.compact input, .form-field.compact select { padding:9px 10px; }
.ops-form-actions { display:flex; gap:8px; flex-wrap:wrap; }
.ops-summary-grid { display:grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap:10px; margin:12px 0 14px; }
.ops-summary-card { padding:12px; border:1px solid var(--border); border-radius:16px; background:linear-gradient(180deg,#fff,#f7fafd); }
.ops-summary-card.attention { box-shadow: inset 0 0 0 1px rgba(185,60,60,.18); }
.ops-summary-card span { display:block; font-size:11px; color:var(--muted); text-transform:uppercase; font-weight:700; letter-spacing:.04em; }
.ops-summary-card strong { display:block; margin-top:6px; font-size:34px; color:var(--primary-dark); line-height:1; }
.ops-tabs { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:8px; padding:4px; border:1px solid var(--border); border-radius:18px; background:#eef3f8; }
.ops-tab { border:none; background:transparent; padding:12px 10px; border-radius:14px; font-weight:800; color:var(--text); }
.ops-tab.active { background:var(--primary); color:white; box-shadow: 0 8px 18px rgba(25,72,140,.24); }
.ops-list-panel { padding:14px; border:1px solid var(--border); border-radius:18px; background:linear-gradient(180deg,#fff,#f7fafd); }
.ops-list-panel.is-hidden { display:none; }
.ops-list-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:10px; }
.ops-list-head h3 { margin:0 0 4px; font-size:15px; }
.ops-list-head p { margin:0; color:var(--muted); font-size:13px; }
.ops-list { display:grid; gap:10px; }
.ops-item-card { border:1px solid var(--border); border-radius:16px; padding:12px; background:#fff; box-shadow: 0 4px 12px rgba(17,24,39,.04); }
.ops-item-card.is-selected { border-color: rgba(25,72,140,.36); box-shadow: inset 0 0 0 1px rgba(25,72,140,.18), 0 10px 20px rgba(17,24,39,.06); }
.ops-item-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.ops-item-title { font-size:16px; font-weight:800; line-height:1.2; }
.ops-item-subtitle, .ops-focus-meta { color:var(--muted); font-size:12px; margin-top:4px; }
.ops-badges { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.ops-badge { display:inline-flex; align-items:center; padding:6px 9px; border-radius:999px; font-size:11px; font-weight:800; text-transform:uppercase; }
.ops-badge.priority-low { background:#eef3f8; color:#546374; }
.ops-badge.priority-medium { background:rgba(11,119,173,.12); color:var(--info); }
.ops-badge.priority-high { background:rgba(183,121,31,.14); color:var(--warning); }
.ops-badge.priority-critical { background:rgba(185,60,60,.14); color:var(--danger); }
.ops-badge.status-open, .ops-badge.status-active, .ops-badge.status-assigned { background:rgba(25,72,140,.12); color:var(--primary); }
.ops-badge.status-monitoring, .ops-badge.status-blocked { background:rgba(183,121,31,.14); color:var(--warning); }
.ops-badge.status-available, .ops-badge.status-resolved { background:rgba(31,122,79,.14); color:var(--success); }
.ops-badge.status-unavailable, .ops-badge.status-closed, .ops-badge.status-archived { background:rgba(185,60,60,.12); color:var(--danger); }
.ops-item-meta { display:grid; gap:6px; margin-top:10px; color:var(--muted); font-size:12px; }
.ops-item-actions, .ops-focus-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.button.danger, .ops-focus-action.danger { color:var(--danger); border-color: rgba(185,60,60,.25); }
.ops-focus-card { padding:14px; border:1px solid var(--border); border-radius:18px; background:linear-gradient(180deg,#fff,#f7fafd); }
.ops-focus-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; margin-bottom:10px; }
.ops-focus-head h3 { margin:0 0 4px; font-size:15px; }
.ops-focus-head p { margin:0; color:var(--muted); font-size:13px; }
.ops-focus-body.empty-state { display:grid; place-items:center; min-height:120px; color:var(--muted); border:1px dashed var(--border); border-radius:16px; padding:18px; text-align:center; }
.ops-focus-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap:10px; margin-top:12px; }
.ops-focus-stat { border:1px solid var(--border); border-radius:14px; padding:10px 12px; background:#fff; }
.ops-focus-stat strong { display:block; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); margin-bottom:4px; }
.ops-focus-stat span { display:block; min-width:0; word-break:break-word; line-height:1.45; }
.ops-inline-controls { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:10px; margin-top:12px; }
.ops-inline-controls .form-field, .ops-item-meta span { min-width:0; word-break:break-word; }
.ops-recommendations { display:grid; gap:8px; }
.ops-recommendation-item { border:1px solid var(--border); border-radius:14px; padding:10px 12px; background:#fff; font-size:13px; }
.panel-description { margin:4px 0 0; color:var(--muted); font-size:13px; }
@media (max-width: 1024px) {
  #app-shell { grid-template-columns: 1fr; }
  #sidebar { position:absolute; inset:0 auto 0 0; width:min(420px, 92vw); transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open #sidebar { transform: translateX(0); }
  .map-toolbar { left:12px; right:12px; }
  .ops-layout { grid-template-columns: 1fr; }
  .ops-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 720px) {
  .quick-stats, .section-nav, .top-actions, .ops-form-grid.two-up, .ops-form-grid.three-up, .ops-inline-controls, .ops-focus-grid { grid-template-columns: 1fr !important; }
  .ops-auth-panel, .ops-item-top, .ops-list-head, .ops-focus-head, .brand-row, .map-toolbar { flex-direction: column; align-items: stretch; }
  .ops-item-actions, .ops-focus-actions, .ops-auth-actions, .status-strip { display:grid; grid-template-columns: 1fr 1fr; }
  .button, .icon-button, .ops-tab, .section-chip { min-height: 44px; }
}

/* v4.5 real forms modal + auth input */
.ops-auth-panel {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}
.ops-token-form { display:grid; gap:10px; }
.ops-auth-copy { min-width:0; }
.ops-auth-status { line-height:1.4; }
.ops-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 20px;
}
.ops-modal.is-hidden { display:none; }
.ops-modal-backdrop {
  position:absolute;
  inset:0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.ops-modal-dialog {
  position: relative;
  width: min(720px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 22px;
}
#ops-composer-card {
  margin-bottom: 0;
  padding: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}
body.modal-open { overflow: hidden; }
.ops-form-actions { justify-content: flex-end; }
.ops-form-actions .button:first-child { min-width: 180px; }
@media (max-width: 720px) {
  .ops-auth-panel { grid-template-columns: 1fr; }
  .ops-token-form { grid-template-columns: 1fr; }
  .ops-auth-actions { grid-template-columns: 1fr 1fr; }
  .ops-modal { padding: 10px; align-items: end; }
  .ops-modal-dialog { width: 100%; max-height: calc(100vh - 12px); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  #ops-composer-card { border-bottom-left-radius: 0; border-bottom-right-radius: 0; padding: 16px; }
  .ops-form-actions { grid-template-columns: 1fr; }
}


.ops-toast-host{position:fixed;right:16px;bottom:16px;z-index:5000;display:flex;flex-direction:column;gap:8px;pointer-events:none}
.ops-toast{background:rgba(12,18,28,.96);color:#fff;border:1px solid rgba(255,255,255,.14);padding:10px 12px;border-radius:12px;box-shadow:0 10px 24px rgba(0,0,0,.25);font-weight:700;max-width:320px;opacity:1;transform:translateY(0);transition:opacity .25s ease,transform .25s ease}
.ops-toast.success{border-color:rgba(44,158,95,.35)}
.ops-toast.error{border-color:rgba(207,63,63,.35)}
.ops-toast.info{border-color:rgba(45,120,200,.35)}
.ops-toast.leaving{opacity:0;transform:translateY(6px)}
.button,.icon-button,.ops-tab{cursor:pointer}


/* v5.2 FL511 visual polish */
.map-glyph {
  letter-spacing: 0.02em;
}
.leaflet-tooltip.map-glyph {
  min-width: 22px;
  text-align: center;
}
.popup-card-camera .popup-title,
.popup-card-board .popup-title {
  display: flex;
  align-items: center;
  gap: 8px;
}
.popup-card-camera .popup-title::before {
  content: "CAM";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15,118,110,.14);
  color: #0f766e;
  font-size: 11px;
  font-weight: 800;
}
.popup-card-board .popup-title::before {
  content: "DMS";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  border-radius: 999px;
  background: rgba(139,94,52,.14);
  color: #8b5e34;
  font-size: 11px;
  font-weight: 800;
}
.popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.popup-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: #19488c;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.popup-action:hover {
  background: #163f79;
}
.popup-action-secondary {
  background: #eef4fb;
  color: #173a6a;
  border: 1px solid #cfd9e5;
}
.popup-action-secondary:hover {
  background: #dde9f7;
}


.popup-card-power .popup-title { color: #fecaca; }


.gator-ops-card {
  border: 1px solid rgba(25, 72, 140, 0.18);
  background: linear-gradient(180deg, rgba(11,119,173,0.06), rgba(0,0,0,0));
}

.wrap-actions {
  flex-wrap: wrap;
}

.layer-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup-card-power .popup-title::after {
  content: ' STATEWIDE';
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}




body.modal-open {
  overflow: hidden;
}

.camera-preview-modal.hidden {
  display: none;
}

.camera-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
}

.camera-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
}

.camera-preview-dialog {
  position: absolute;
  inset: 4vh 4vw;
  display: flex;
  flex-direction: column;
  background: #f8fbff;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.camera-preview-header,
.camera-preview-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  background: #ffffff;
  border-bottom: 1px solid #dbe5ef;
}

.camera-preview-footer {
  border-bottom: none;
  border-top: 1px solid #dbe5ef;
}

.camera-preview-eyebrow {
  color: #0f766e;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.camera-preview-header h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

.camera-preview-meta,
.camera-preview-note {
  color: var(--muted);
  font-size: 14px;
}

.camera-preview-close {
  border: none;
  background: var(--primary);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.camera-preview-body {
  flex: 1;
  min-height: 0;
  background: #eef4fa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.camera-preview-body img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px;
  background: #dfe8f2;
}

.camera-preview-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

@media (max-width: 900px) {
  .camera-preview-dialog {
    inset: 2vh 2vw;
  }

  .camera-preview-header,
  .camera-preview-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .camera-preview-actions {
    justify-content: stretch;
  }

  .camera-preview-actions .button {
    flex: 1;
    text-align: center;
  }
}


/* v5.4.7 map resize stabilization */
html, body {
  width: 100%;
  overflow: hidden;
}

body {
  overscroll-behavior: none;
}

#app-shell {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  align-items: stretch;
}

#sidebar {
  min-height: 0;
  overflow: hidden;
}

.sidebar-inner {
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.leaflet-container {
  width: 100%;
  height: 100%;
  background: #dbe5f0;
}

@supports (height: 100svh) {
  #app-shell {
    height: 100svh;
    min-height: 100svh;
  }
}

@media (max-width: 1024px) {
  html, body {
    position: static;
    inset: auto;
    width: 100%;
    min-height: 100%;
  }

  body.sidebar-open,
  body.modal-open {
    overflow: hidden;
  }
}


.ops-location-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 6px 0 2px;
}

.button-small {
  padding: 8px 10px;
  font-size: 12px;
}

.ops-location-hint {
  font-size: 12px;
  color: #64748b;
}

#map-shell.map-pick-active {
  cursor: crosshair;
}

.map-pick-banner {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 1200;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(100% - 24px);
  padding: 10px 12px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14);
}

.map-pick-banner strong {
  color: #19488c;
}

.map-pick-banner span {
  color: #334155;
  font-size: 13px;
}

.operator-status-board {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}

.operator-status-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
}

.operator-status-stat {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 0.8rem;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.operator-status-stat strong {
  font-size: 1.1rem;
  color: var(--brand);
}

.operator-status-stat span {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.operator-status-stat.attention {
  border-color: rgba(180, 70, 50, 0.22);
  background: #fff7f5;
}

.operator-status-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.status-filter-chip {
  border: 1px solid var(--border);
  background: white;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.status-filter-chip.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

@media (max-width: 900px) {
  .operator-status-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .incident-log-entry-head {
    flex-direction: column;
  }
}


.rf-marker {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #1d4ed8;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 12px;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 16px rgba(2, 6, 23, 0.25);
}
.rf-marker.is-stale {
  background: #94a3b8;
}
.rf-div-icon {
  background: transparent;
  border: 0;
}
.rf-popup {
  font-size: 13px;
  line-height: 1.45;
  max-width: min(320px, calc(100vw - 64px));
}

.system-diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.system-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.system-row:last-child { border-bottom: 0; }
.system-actions { margin-bottom: 12px; }


.ops-timeline-block {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.ops-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.7);
  margin-bottom: 0.75rem;
}

.incident-log-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -0.2rem 0 0.75rem;
}

.incident-log-list {
  display: grid;
  gap: 0.65rem;
}

.incident-log-entry {
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  background: rgba(255,255,255,0.04);
  display: grid;
  gap: 0.45rem;
}

.incident-log-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.incident-log-entry-head strong {
  display: block;
  margin-bottom: 0.18rem;
}

.incident-log-entry-head span,
.incident-log-entry-body,
.incident-log-entry-meta {
  color: rgba(255,255,255,0.78);
  font-size: 13px;
  line-height: 1.45;
  word-break: break-word;
}

.incident-log-entry-meta {
  color: rgba(255,255,255,0.62);
}

.incident-log-badges,
.incident-log-entry-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ops-timeline {
  display: grid;
  gap: 0.55rem;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 0.75rem;
  align-items: start;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}

.timeline-time {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.64);
}

.timeline-body {
  display: grid;
  gap: 0.2rem;
}

.timeline-body strong {
  font-size: 0.92rem;
}

.timeline-body span {
  color: rgba(255,255,255,0.72);
  font-size: 0.84rem;
}

.empty-state.small {
  padding: 0.8rem;
  font-size: 0.9rem;
}


/* v6.8.2 operator status + dispatch system */
.dispatch-recommendations{display:grid;gap:10px;margin-top:10px;}
.dispatch-candidate{display:flex;justify-content:space-between;gap:12px;align-items:center;padding:10px 12px;border:1px solid rgba(148,163,184,.25);border-radius:14px;background:rgba(15,23,42,.35);}
.dispatch-candidate-main{display:flex;flex-direction:column;gap:4px;}
.dispatch-candidate-main span{font-size:12px;color:#cbd5e1;}
.dispatch-candidate-actions{display:flex;gap:8px;flex-wrap:wrap;}
.dispatch-candidate.eligible{border-color:rgba(34,197,94,.35);}
.dispatch-candidate.limited{border-color:rgba(245,158,11,.35);}
@media (max-width: 760px){.dispatch-candidate{flex-direction:column;align-items:flex-start;}}


.command-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 84px;
  z-index: 890;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(213, 224, 234, 0.92);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
}
.command-bar-left, .command-bar-right { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.command-chip { display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px; background:rgba(247,250,252,0.95); border:1px solid var(--border); color:var(--muted); font-size:12px; }
.command-chip-label { color: var(--muted); }
.command-drawer {
  position:absolute; z-index:880; border:1px solid rgba(213,224,234,0.92); background:rgba(255,255,255,0.94);
  backdrop-filter: blur(12px); box-shadow: var(--shadow-lg); border-radius:20px; overflow:hidden; transition: transform .22s ease, opacity .22s ease;
}
.command-drawer-head { display:flex; justify-content:space-between; gap:10px; padding:14px 16px; border-bottom:1px solid var(--border); background:rgba(245,248,251,0.92); }
.command-drawer-head h3 { margin:0 0 4px; font-size:18px; }
.command-drawer-head p { margin:0; color:var(--muted); font-size:12px; }
.command-drawer-stats { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap:10px; padding:14px 16px 8px; }
.command-stat { padding:10px 12px; border:1px solid var(--border); border-radius:14px; background:var(--panel-soft); display:flex; flex-direction:column; gap:6px; }
.command-stat span { color: var(--muted); font-size:12px; }
.command-stat strong { font-size:20px; }
.operator-drawer { left:16px; bottom:16px; width:min(420px,calc(100vw - 32px)); max-height:calc(100vh - 210px); display:flex; flex-direction:column; }
.diagnostics-drawer { right:16px; top:142px; width:min(430px,calc(100vw - 32px)); max-height:calc(100vh - 160px); display:flex; flex-direction:column; }
.command-drawer:not(.is-open).operator-drawer { transform: translateY(calc(100% + 16px)); opacity:0; pointer-events:none; }
.command-drawer:not(.is-open).diagnostics-drawer { transform: translateX(calc(100% + 16px)); opacity:0; pointer-events:none; }
.command-list { padding:8px 16px 16px; overflow:auto; display:flex; flex-direction:column; gap:10px; }
.command-operator-card { padding:12px 14px; border:1px solid var(--border); border-radius:16px; background:var(--panel-soft); display:flex; flex-direction:column; gap:10px; }
.command-operator-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.command-operator-meta { color:var(--muted); font-size:12px; line-height:1.4; }
.command-operator-actions { display:flex; gap:8px; flex-wrap:wrap; }
.command-diagnostics-grid { padding:8px 16px 12px; overflow:auto; display:grid; grid-template-columns:1fr; gap:10px; }
.command-diagnostics-card { padding:12px 14px; border:1px solid var(--border); border-radius:16px; background:var(--panel-soft); }
.command-diagnostics-card h4 { margin:0 0 8px; font-size:14px; }
.command-diagnostics-card-head { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; margin-bottom:8px; }
.command-diagnostics-card-head h4 { margin:0; }
.command-diagnostics-badge-list { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; }
.command-diagnostics-note { margin-top:4px; color:var(--muted); font-size:12px; line-height:1.4; }
.command-diagnostics-row { display:flex; justify-content:space-between; gap:10px; padding:4px 0; font-size:13px; }
.command-diagnostics-row span:first-child { color:var(--muted); }
.command-raw { margin:0 16px 16px; padding:12px; border-radius:14px; border:1px solid var(--border); background:#0f172a; color:#dbeafe; font-size:11px; line-height:1.45; overflow:auto; min-height:120px; }
.command-status-live { color: var(--success); }
.command-status-aging { color: var(--warning); }
.command-status-stale, .command-status-error { color: var(--danger); }
@media (max-width: 1200px) {
  .diagnostics-drawer { width:min(380px,calc(100vw - 32px)); }
}
@media (max-width: 1024px) {
  .command-bar { top: 126px; flex-direction:column; align-items:stretch; }
  .operator-drawer { width:calc(100vw - 24px); left:12px; right:12px; bottom:12px; max-height:42vh; }
  .diagnostics-drawer { top:auto; bottom:12px; right:12px; width:calc(100vw - 24px); max-height:52vh; }
}
@media (max-width: 640px) {
  .command-bar { left:12px; right:12px; }
  .command-bar-left, .command-bar-right { width:100%; }
  .command-chip { flex:1 1 auto; justify-content:center; }
  .command-drawer-stats { grid-template-columns:1fr; }
}


/* v6.9.0 multi-source fusion */
.rf-marker.source-aprs{background:#2563eb;}
.rf-marker.source-meshtastic{background:#0f766e;}
.rf-marker.source-dmr{background:#9333ea;}
.rf-marker.source-gps-share{background:#15803d;}
.rf-marker.source-manual{background:#6b7280;}
.rf-marker .rf-count{position:absolute;right:-6px;bottom:-6px;min-width:15px;height:15px;padding:0 4px;border-radius:999px;background:#111827;color:#fff;font-size:10px;line-height:15px;font-weight:800;box-shadow:0 1px 2px rgba(0,0,0,.35);}
.command-source-summary{display:flex;flex-wrap:wrap;gap:8px;padding:4px 16px 6px;}
.command-source-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 10px;border-radius:999px;border:1px solid var(--border);background:var(--panel-soft);font-size:12px;font-weight:700;}
.command-source-pill strong{font-size:12px;}
.command-source-pill.source-aprs{border-color:rgba(37,99,235,.25);}
.command-source-pill.source-meshtastic{border-color:rgba(15,118,110,.25);}
.command-source-pill.source-dmr{border-color:rgba(147,51,234,.25);}
.command-source-pill.source-gps-share{border-color:rgba(21,128,61,.28);}
.command-source-pill.source-manual{border-color:rgba(107,114,128,.25);}
.command-source-filters{display:flex;flex-wrap:wrap;gap:8px;padding:2px 16px 10px;}
.command-source-filter{appearance:none;border:1px solid var(--border);background:#fff;border-radius:999px;padding:7px 11px;font-size:12px;font-weight:700;cursor:pointer;}
.command-source-filter.active{background:#0f172a;color:#fff;border-color:#0f172a;}
.command-source-badges{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px;}
.command-source-badge{display:inline-flex;align-items:center;padding:3px 8px;border-radius:999px;font-size:11px;font-weight:700;border:1px solid transparent;}
.command-source-badge.source-aprs{background:rgba(37,99,235,.08);color:#1d4ed8;border-color:rgba(37,99,235,.15);}
.command-source-badge.source-meshtastic{background:rgba(15,118,110,.08);color:#0f766e;border-color:rgba(15,118,110,.15);}
.command-source-badge.source-dmr{background:rgba(147,51,234,.08);color:#7e22ce;border-color:rgba(147,51,234,.15);}
.command-source-badge.source-gps-share{background:rgba(21,128,61,.10);color:#166534;border-color:rgba(21,128,61,.18);}
.command-source-badge.source-manual{background:rgba(107,114,128,.08);color:#4b5563;border-color:rgba(107,114,128,.15);}
.command-operator-meta small{display:block;margin-top:4px;color:#64748b;}


.command-map-hint { position:absolute; left:16px; right:16px; top:126px; z-index:430; background:rgba(15,23,42,0.92); color:#e2e8f0; border:1px solid rgba(59,130,246,0.28); border-radius:12px; padding:10px 14px; box-shadow:0 20px 40px rgba(15,23,42,0.18); font-size:13px; }
.command-action-button { box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25) inset; }
.command-drawer.task-drawer { position:absolute; left:16px; top:214px; width:min(420px, calc(100% - 32px)); max-height:calc(100% - 232px); overflow:auto; z-index:420; background:rgba(15,23,42,0.96); border:1px solid rgba(148,163,184,0.18); border-radius:18px; box-shadow:0 24px 50px rgba(2,8,23,0.42); }
.command-drawer:not(.is-open).task-drawer { transform: translateX(calc(-100% - 16px)); opacity:0; pointer-events:none; }
.command-task-actions { display:flex; gap:10px; padding:0 16px 12px; }
.command-task-sections { display:grid; grid-template-columns:1fr; gap:12px; padding:0 16px 16px; }
.command-section-head { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-bottom:8px; color:var(--text); }
.command-section-head h4 { margin:0; font-size:14px; }
.command-list.compact { display:grid; gap:10px; }
.command-task-card { border:1px solid rgba(148,163,184,0.16); border-radius:14px; background:rgba(15,23,42,0.72); padding:12px; }
.command-task-card.is-incident-active { box-shadow:0 0 0 1px rgba(239,108,0,0.22) inset; }
.command-task-card.is-task-open { box-shadow:0 0 0 1px rgba(234,179,8,0.22) inset; }
.command-task-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.command-task-meta { margin-top:4px; font-size:12px; color:var(--muted); }
.command-task-body { margin-top:8px; color:var(--muted); font-size:13px; }
.command-task-actions-inline { display:flex; flex-wrap:wrap; gap:8px; margin-top:10px; }
@media (max-width: 1100px) {
  .command-map-hint { top: 170px; }
  .command-drawer.task-drawer { top: 265px; width:calc(100% - 24px); left:12px; right:12px; }
}
@media (max-width: 720px) {
  .command-map-hint { position:static; margin:12px; }
  .command-drawer.task-drawer { top:auto; bottom:12px; max-height:44%; }
}


body.theme-dark html, body.theme-dark { background: linear-gradient(180deg, #08131d 0%, #0a1723 100%); }
body.theme-dark #sidebar { background: linear-gradient(180deg, rgba(8,19,29,0.96) 0%, rgba(10,24,37,0.96) 100%); }
body.theme-dark .map-toolbar,
body.theme-dark .map-health-pill,
body.theme-dark .status-pill,
body.theme-dark .legend-chip { background: rgba(8,19,29,0.84); }
body.theme-dark .button.button-ghost { background: rgba(255,255,255,0.03); color: var(--text); border-color: var(--border); }
body.theme-dark #map .leaflet-tile-pane { filter: var(--leaflet-filter); }
body.theme-dark .leaflet-control-zoom a { background: #0d2131; color: var(--text); border-color: var(--border); }
body.theme-dark .rf-popup, body.theme-dark .leaflet-popup-content-wrapper { background: #0d2131; color: var(--text); }
body.theme-dark .leaflet-popup-tip { background: #0d2131; }
#command-theme-toggle { min-width: 118px; }
.command-alert-chip { display:inline-flex; align-items:center; gap:8px; padding:8px 10px; border-radius:999px; border:1px solid var(--border); background:rgba(255,255,255,0.72); font-size:12px; }
.command-alert-chip.is-degraded { color: var(--danger); border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.08); }
.command-alert-chip.is-nominal { color: var(--success); }
.rf-marker.stale-aging { opacity: .78; }
.rf-marker.stale-stale, .rf-marker.stale-very_stale { opacity: .52; transform: scale(.92); filter: grayscale(.12); }
.rf-marker.is-focused { box-shadow: 0 0 0 4px var(--map-glow), 0 0 22px var(--map-glow); }
.incident-focus-label { color: var(--text); font-weight: 700; background: var(--panel-strong); border:1px solid var(--border); border-radius:999px; padding:4px 10px; box-shadow: var(--shadow-md); }
.incident-radius-ring { pointer-events:none; }


/* v6.9.3 dispatch + assignment system */
.command-drawer.dispatch-drawer { position:absolute; right:16px; top:214px; width:min(410px, calc(100% - 32px)); max-height:calc(100% - 232px); overflow:auto; z-index:425; background:rgba(15,23,42,0.96); border:1px solid rgba(148,163,184,0.18); border-radius:18px; box-shadow:0 24px 50px rgba(2,8,23,0.42); }
.command-drawer:not(.is-open).dispatch-drawer { transform: translateX(calc(100% + 16px)); opacity:0; pointer-events:none; }
.command-dispatch-toolbar { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; padding:0 16px 12px; align-items:end; }
.command-dispatch-toolbar .form-field span { color: var(--muted-2, #94a3b8); }
.command-dispatch-section { padding:0 16px 16px; }
.dispatch-candidate-card { border:1px solid rgba(148,163,184,0.14); border-radius:16px; padding:12px; background:rgba(8,15,28,0.38); display:grid; gap:10px; }
.dispatch-candidate-card.is-eligible { box-shadow: inset 0 0 0 1px rgba(52,211,153,0.12); }
.dispatch-candidate-card.is-limited { box-shadow: inset 0 0 0 1px rgba(245,158,11,0.12); }
.dispatch-candidate-top { display:flex; justify-content:space-between; gap:10px; align-items:flex-start; }
.is-assignment-card { box-shadow: inset 0 0 0 1px rgba(59,130,246,0.12); }
.command-operator-actions .button { flex:1 1 auto; }
body.theme-day .command-drawer.dispatch-drawer,
body[data-theme="day"] .command-drawer.dispatch-drawer { background:rgba(255,255,255,0.97); border-color:rgba(15,23,42,0.08); }
body.theme-day .dispatch-candidate-card,
body[data-theme="day"] .dispatch-candidate-card { background:#f8fbff; border-color:rgba(25,72,140,0.12); }
@media (max-width: 1200px) {
  .command-drawer.dispatch-drawer { top:265px; width:calc(100% - 24px); right:12px; left:12px; max-height:40%; }
}
@media (max-width: 720px) {
  .command-dispatch-toolbar { grid-template-columns:1fr; }
  .command-drawer.dispatch-drawer { top:auto; bottom:12px; max-height:46%; }
}


/* v6.9.4 mockup-matched production polish */
body[data-theme="day"] {
  background: linear-gradient(180deg, #edf3f8 0%, #e6edf5 100%);
}
body[data-theme="dark"] {
  background: linear-gradient(180deg, #06111b 0%, #0b1623 100%);
}
body[data-theme="dark"] #sidebar { background: linear-gradient(180deg, rgba(7,18,28,0.94) 0%, rgba(10,22,35,0.94) 100%); }
body[data-theme="day"] #sidebar { background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(244,248,252,0.96) 100%); }

#app-shell { grid-template-columns: 0 1fr; }
body.sidebar-open #app-shell { grid-template-columns: minmax(340px, 390px) 1fr; }
#sidebar {
  width: minmax(340px,390px);
  transform: translateX(-100%);
  transition: transform .25s ease, box-shadow .25s ease;
  box-shadow: none;
  visibility: hidden;
  pointer-events: none;
}
body.sidebar-open #sidebar {
  transform: translateX(0);
  box-shadow: 0 24px 48px rgba(2,8,23,.28);
  visibility: visible;
  pointer-events: auto;
}
#sidebar-open { background: rgba(15,23,42,.92); color: #fff; border: 1px solid rgba(255,255,255,.08); }
body[data-theme="day"] #sidebar-open { background: rgba(255,255,255,.92); color: var(--primary-dark); border: 1px solid rgba(15,23,42,.08); }
.mobile-only { display: inline-grid; }

.map-toolbar {
  top: 14px;
  left: 14px;
  right: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(10,25,41,0.92), rgba(8,20,34,0.9));
  border: 1px solid rgba(103,137,168,0.22);
  box-shadow: 0 16px 36px rgba(2,8,23,.28);
}
body[data-theme="day"] .map-toolbar {
  background: linear-gradient(180deg, rgba(19,43,73,0.97), rgba(13,33,58,0.95));
  border-color: rgba(255,255,255,0.16);
}
.map-title-wrap strong, .map-title-wrap span, .map-health-pill, .legend-chip { color: #e6eef7; }
.map-health-pill, .legend-chip {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}

.command-bar {
  left: 14px;
  right: 14px;
  top: 86px;
  border-radius: 22px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(10,25,41,0.92), rgba(8,20,34,0.88));
  border: 1px solid rgba(103,137,168,0.22);
  box-shadow: 0 18px 36px rgba(2,8,23,.24);
}
body[data-theme="day"] .command-bar {
  background: linear-gradient(180deg, rgba(19,43,73,0.97), rgba(13,33,58,0.95));
  border-color: rgba(255,255,255,0.16);
}
.command-bar .button { border-radius: 12px; }
.command-bar .button,
.command-bar .command-chip,
.command-bar .button.button-secondary,
.command-bar .button.button-ghost {
  background: rgba(255,255,255,0.08);
  color: #f4f8fb;
  border: 1px solid rgba(255,255,255,0.1);
}
.command-bar .button:hover,
.command-bar .button.button-secondary:hover,
.command-bar .button.button-ghost:hover { background: rgba(255,255,255,0.14); }
.command-bar .button.command-action-button { background: rgba(245,158,11,.16); border-color: rgba(245,158,11,.26); }
.command-chip { min-height: 42px; }
.command-chip-label { color: rgba(230,238,247,.76); }
.command-chip strong { color: #fff; }
#command-theme-toggle { min-width: 138px; }

.command-map-hint {
  top: 154px;
  left: 14px;
  right: 14px;
  background: rgba(8,20,34,.86);
  border-color: rgba(96,165,250,.22);
  color: #dbe7f4;
}
body[data-theme="day"] .command-map-hint {
  background: rgba(255,255,255,.92);
  color: var(--primary-dark);
  border-color: rgba(25,72,140,.12);
}

.command-drawer {
  border-radius: 22px;
  backdrop-filter: blur(14px);
}
.operator-drawer {
  left: 14px;
  top: 194px;
  width: min(470px, calc(100% - 28px));
  background: linear-gradient(180deg, rgba(11,26,42,0.92), rgba(9,20,34,0.94));
  border: 1px solid rgba(96,165,250,.16);
  box-shadow: 0 24px 48px rgba(2,8,23,.34);
}
.diagnostics-drawer,
.dispatch-drawer,
.task-drawer {
  background: linear-gradient(180deg, rgba(11,26,42,0.92), rgba(9,20,34,0.94));
  border: 1px solid rgba(96,165,250,.16);
  box-shadow: 0 24px 48px rgba(2,8,23,.34);
}
body[data-theme="day"] .operator-drawer,
body[data-theme="day"] .diagnostics-drawer,
body[data-theme="day"] .dispatch-drawer,
body[data-theme="day"] .task-drawer {
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,250,253,0.97));
  border: 1px solid rgba(15,23,42,.08);
}
.command-drawer-head h3 { font-size: 18px; }
.command-drawer-head p { max-width: 38ch; }
.command-stat,
.command-source-pill,
.command-source-filter,
.command-task-card,
.dispatch-candidate-card,
.command-operator-card,
.command-diagnostics-block {
  border-radius: 16px;
}
.command-source-filter.active {
  background: linear-gradient(180deg, rgba(59,130,246,.2), rgba(37,99,235,.22));
  color: #fff;
  border-color: rgba(96,165,250,.3);
}
body[data-theme="day"] .command-source-filter.active {
  color: var(--primary-dark);
  background: rgba(25,72,140,.09);
  border-color: rgba(25,72,140,.18);
}

.leaflet-control-zoom a {
  width: 36px;
  height: 36px;
  line-height: 36px;
  border-radius: 10px !important;
  margin-bottom: 8px;
  box-shadow: 0 6px 18px rgba(2,8,23,.16);
}
.rf-popup .leaflet-popup-content-wrapper,
.leaflet-popup-content-wrapper { border-radius: 16px; }

@media (max-width: 1100px) {
  #app-shell, body.sidebar-open #app-shell { grid-template-columns: 1fr; }
  #sidebar { position: absolute; top: 0; left: 0; bottom: 0; width: min(390px, 92vw); }
  .command-bar { top: 132px; }
  .command-map-hint { top: 212px; }
  .operator-drawer { top: 252px; width: calc(100% - 28px); }
}
@media (max-width: 720px) {
  .map-toolbar { padding: 12px; }
  .command-bar { top: 148px; }
  .command-map-hint { top: 248px; }
  .operator-drawer, .dispatch-drawer, .task-drawer, .diagnostics-drawer {
    left: 12px; right: 12px; width: auto; max-height: 42%;
  }
}


/* v6.9.5 stabilization + contrast fixes */
body[data-theme="day"] {
  --text: #122033;
  --muted: #475569;
  --panel: rgba(255,255,255,0.98);
  --panel-soft: #f4f7fb;
  --border: rgba(15,23,42,0.12);
}
body[data-theme="day"] .map-title-wrap strong,
body[data-theme="day"] .map-title-wrap span,
body[data-theme="day"] .map-health-pill,
body[data-theme="day"] .legend-chip,
body[data-theme="day"] .command-bar .button,
body[data-theme="day"] .command-bar .command-chip,
body[data-theme="day"] .command-bar .button.button-secondary,
body[data-theme="day"] .command-bar .button.button-ghost,
body[data-theme="day"] .command-chip strong,
body[data-theme="day"] .command-chip-label {
  color: #f8fbff;
}
body[data-theme="day"] .command-drawer,
body[data-theme="day"] .panel,
body[data-theme="day"] .toolbar-card,
body[data-theme="day"] .info-card,
body[data-theme="day"] .ops-list-panel,
body[data-theme="day"] .ops-focus-card,
body[data-theme="day"] .command-operator-card,
body[data-theme="day"] .command-task-card,
body[data-theme="day"] .dispatch-candidate-card,
body[data-theme="day"] .command-diagnostics-card,
body[data-theme="day"] .command-stat {
  color: #122033;
  background: rgba(255,255,255,0.98);
  border-color: rgba(15,23,42,0.10);
}
body[data-theme="day"] .card-subtle,
body[data-theme="day"] .feed-note,
body[data-theme="day"] .panel-description,
body[data-theme="day"] .command-drawer-head p,
body[data-theme="day"] .command-task-meta,
body[data-theme="day"] .command-task-body,
body[data-theme="day"] .command-operator-meta,
body[data-theme="day"] .incident-log-entry-head span,
body[data-theme="day"] .incident-log-entry-body,
body[data-theme="day"] .incident-log-entry-meta {
  color: #4a6075;
}
body[data-theme="day"] .incident-log-entry {
  background: #f8fbff;
  border-color: rgba(15,23,42,0.08);
}
body[data-theme="day"] .ops-section-title {
  color: #4a6075;
}
body[data-theme="day"] .command-raw {
  background: #f4f7fb;
  color: #122033;
  border-color: rgba(15,23,42,0.10);
}
.command-inline-console {
  margin: 14px 0 16px;
}
.compact-head { margin-bottom: 10px; }
.tracked-inline-list {
  max-height: 260px;
  overflow: auto;
}
.command-bar .button.is-active,
.command-bar .button.command-action-button.is-active {
  background: rgba(59,130,246,0.26);
  border-color: rgba(96,165,250,0.42);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.12) inset;
}
.map-pick-banner {
  z-index: 1600;
}
#sidebar {
  width: 390px;
  max-width: min(390px, 92vw);
}
body[data-theme="day"] #sidebar-open,
body[data-theme="day"] .icon-button {
  color: #123567;
}
body[data-theme="day"] .leaflet-control-zoom a {
  background: rgba(255,255,255,0.98);
  color: #123567;
  border: 1px solid rgba(15,23,42,0.10);
}


/* v6.9.6 stabilization overrides */
body.theme-dark {
  --leaflet-filter: saturate(1) brightness(1.08) contrast(1.02);
  --panel: rgba(12, 24, 36, 0.94);
  --panel-soft: #102436;
  --panel-strong: #132a3e;
  --border: rgba(148, 163, 184, 0.28);
  --muted: #b7c6d6;
}
body[data-theme="day"] .map-toolbar,
body[data-theme="day"] .command-bar,
body[data-theme="day"] .command-map-hint {
  background: rgba(244,248,252,0.94);
  border-color: rgba(15,23,42,0.12);
}
body.theme-dark .map-toolbar,
body.theme-dark .command-bar,
body.theme-dark .command-map-hint {
  background: rgba(6,16,26,0.88);
  border-color: rgba(148,163,184,0.18);
}
.map-health-pill,
.command-alert-chip,
.legend-chip {
  font-weight: 700;
  letter-spacing: .01em;
}
#map-health {
  color: #d7fce5;
  background: rgba(19,78,53,0.48);
  border: 1px solid rgba(74,222,128,0.32);
}
body[data-theme="day"] #map-health {
  color: #0f5132;
  background: rgba(220,252,231,0.96);
  border-color: rgba(34,197,94,0.22);
}
.command-alert-chip.is-nominal {
  color: #eaf6ff;
  background: rgba(255,255,255,0.16);
  border-color: rgba(255,255,255,0.22);
}
body[data-theme="day"] .command-alert-chip.is-nominal {
  color: #0f172a;
  background: rgba(255,255,255,0.92);
  border-color: rgba(15,23,42,0.14);
}
.icon-button {
  color: #f8fbff;
  background: rgba(37,99,235,0.18);
  border-color: rgba(96,165,250,0.28);
}
.icon-button:hover { background: rgba(37,99,235,0.28); }
body[data-theme="day"] .icon-button {
  color: #123567;
  background: rgba(255,255,255,0.98);
  border-color: rgba(25,72,140,0.18);
}
.command-drawer-head {
  background: linear-gradient(180deg, rgba(248,251,255,0.98), rgba(241,246,251,0.96));
}
body.theme-dark .command-drawer-head {
  background: linear-gradient(180deg, rgba(16,36,54,0.98), rgba(12,28,44,0.96));
}
body.theme-dark .command-drawer,
body.theme-dark .toolbar-card,
body.theme-dark .panel,
body.theme-dark .ops-workspace-panel {
  background: rgba(8, 21, 33, 0.94);
}
.command-diagnostics-grid { padding: 12px 16px 8px; gap: 12px; }
.command-diagnostics-card { padding: 14px 16px; }
.command-diagnostics-row { align-items: flex-start; }
.command-raw {
  margin: 8px 16px 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(2,6,23,0.66);
  color: #dbeafe;
  max-height: 34vh;
  overflow: auto;
  line-height: 1.45;
}
body[data-theme="day"] .command-raw {
  background: #f8fafc;
  color: #0f172a;
}
#command-dispatch-incident-select {
  min-width: 200px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
}
.command-dispatch-toolbar { grid-template-columns: minmax(220px,1fr) auto; }
.command-dispatch-toolbar .form-field { min-width: 0; }
.command-source-filter,
.command-source-pill,
.command-chip,
.map-health-pill,
.legend-chip,
.button.button-secondary,
.button.button-ghost {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.command-drawer:not(.is-open) {
  visibility: hidden;
}
.command-drawer.is-open {
  visibility: visible;
}
#command-operator-drawer,
#command-dispatch-drawer,
#command-task-drawer,
#command-diagnostics-drawer {
  backdrop-filter: blur(12px);
}
body.theme-dark .command-stat,
body.theme-dark .command-diagnostics-card,
body.theme-dark .dispatch-candidate-card,
body.theme-dark .command-operator-card {
  background: rgba(13,30,46,0.96);
}
body[data-theme="day"] .command-stat,
body[data-theme="day"] .command-diagnostics-card,
body[data-theme="day"] .dispatch-candidate-card,
body[data-theme="day"] .command-operator-card {
  background: rgba(255,255,255,0.98);
}


/* v6.9.9 visibility + search + layers drawer overrides */
:root {
  --night-map-filter: brightness(1.42) contrast(0.9) saturate(0.86);
}
body.theme-dark {
  --leaflet-filter: var(--night-map-filter);
}
body.theme-dark .leaflet-container {
  background: #182635;
}
body.theme-dark .map-toolbar,
body.theme-dark .command-bar,
body.theme-dark .command-map-hint {
  background: linear-gradient(180deg, rgba(10,24,38,0.94), rgba(10,24,38,0.9)) !important;
  color: #eef6ff;
}
body[data-theme="day"] .map-toolbar,
body[data-theme="day"] .command-bar,
body[data-theme="day"] .command-map-hint {
  background: linear-gradient(180deg, rgba(18,52,87,0.96), rgba(18,52,87,0.92)) !important;
  color: #f7fbff;
}
body[data-theme="day"] .map-title-wrap strong,
body[data-theme="day"] .map-title-wrap span,
body[data-theme="day"] .map-health-pill,
body[data-theme="day"] .legend-chip,
body[data-theme="day"] .command-bar .button,
body[data-theme="day"] .command-bar .command-chip,
body[data-theme="day"] .command-bar .button.button-secondary,
body[data-theme="day"] .command-bar .button.button-ghost,
body[data-theme="day"] .command-chip strong,
body[data-theme="day"] .command-chip-label,
body.theme-dark .map-title-wrap strong,
body.theme-dark .map-title-wrap span,
body.theme-dark .map-health-pill,
body.theme-dark .legend-chip,
body.theme-dark .command-bar .button,
body.theme-dark .command-bar .command-chip,
body.theme-dark .command-bar .button.button-secondary,
body.theme-dark .command-bar .button.button-ghost,
body.theme-dark .command-chip strong,
body.theme-dark .command-chip-label {
  color: #f7fbff !important;
}
body[data-theme="day"] .command-alert-chip.is-nominal {
  color: #143b66 !important;
  background: rgba(255,255,255,0.96) !important;
  border-color: rgba(20,59,102,0.18) !important;
}
body.theme-dark .command-alert-chip.is-nominal {
  color: #dff7e8 !important;
  background: rgba(20,83,45,0.44) !important;
  border-color: rgba(74,222,128,0.22) !important;
}
.icon-button,
body[data-theme="day"] .icon-button,
body.theme-dark .icon-button {
  color: #ffffff !important;
  background: #19488c !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
}
body[data-theme="day"] .command-drawer,
body[data-theme="day"] .command-stat,
body[data-theme="day"] .command-diagnostics-card,
body[data-theme="day"] .dispatch-candidate-card,
body[data-theme="day"] .command-operator-card,
body[data-theme="day"] .command-search-item,
body[data-theme="day"] .command-layer-item {
  color: #122033;
  background: rgba(255,255,255,0.99) !important;
  border-color: rgba(15,23,42,0.12) !important;
}
body.theme-dark .command-drawer,
body.theme-dark .command-stat,
body.theme-dark .command-diagnostics-card,
body.theme-dark .dispatch-candidate-card,
body.theme-dark .command-operator-card,
body.theme-dark .command-search-item,
body.theme-dark .command-layer-item {
  background: rgba(12,25,38,0.96) !important;
  color: #e8f0fa;
  border-color: rgba(148,163,184,0.22) !important;
}
body.theme-dark .command-raw {
  background: rgba(5,12,20,0.82) !important;
  color: #dbeafe !important;
}
body[data-theme="day"] .command-raw {
  background: #f8fafc !important;
  color: #0f172a !important;
}
.layers-drawer { position:absolute; right:16px; top:214px; width:min(420px, calc(100% - 32px)); max-height:calc(100% - 232px); overflow:auto; z-index:426; }
.command-drawer:not(.is-open).layers-drawer { transform: translateX(calc(100% + 16px)); opacity:0; pointer-events:none; visibility:hidden; }
.command-search-console { padding: 14px 16px 10px; display:grid; gap:10px; }
.command-search-item { width:100%; text-align:left; display:flex; justify-content:space-between; gap:12px; padding:12px 14px; border:1px solid var(--border); border-radius:14px; background:transparent; }
.command-search-item strong, .command-layer-main strong { display:block; font-size:14px; }
.command-search-item span, .command-layer-main span { display:block; margin-top:4px; color: var(--muted); font-size:12px; }
.command-search-item em { font-style:normal; font-size:12px; color: var(--muted); align-self:center; }
.command-layer-item { display:flex; gap:12px; justify-content:space-between; align-items:center; padding:12px 14px; border:1px solid var(--border); border-radius:14px; }
.command-layer-main { min-width: 0; }
.command-layer-statuses { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.command-layer-detail { margin-top:6px; color:var(--muted); font-size:11px; line-height:1.4; }
.command-layer-actions { display:flex; gap:8px; flex-wrap:wrap; }
body[data-theme="day"] .command-search-item span, body[data-theme="day"] .command-layer-main span { color:#4a6075; }
@media (max-width: 1200px) { .layers-drawer { top:265px; width:calc(100% - 24px); right:12px; left:12px; max-height:40%; } }
@media (max-width: 720px) { .layers-drawer { top:auto; bottom:12px; max-height:46%; } }


/* v7.0.1 command visibility + layer browser */
:root { --night-map-filter: grayscale(0.78) brightness(0.56) contrast(1.18) saturate(0.42); }
body.theme-dark #map .leaflet-tile-pane { filter: none !important; }
body.theme-dark #map[data-basemap-provider="osm-dark-fallback"] .leaflet-tile-pane { filter: var(--night-map-filter) !important; }
body.theme-dark .leaflet-container { background: #18212b !important; }
body[data-theme="day"] #map .leaflet-tile-pane { filter: none !important; }
body[data-theme="day"] .leaflet-container { background: #dbe5ee !important; }
body[data-theme="day"] #map-health { color:#0f5132 !important; background:#dff8e8 !important; border-color:#7ad89d !important; font-weight:800; }
body[data-theme="day"] .command-alert-chip.is-nominal { color:#173b64 !important; background:#ffffff !important; border-color:rgba(23,59,100,.22) !important; font-weight:800; }
body[data-theme="day"] .command-bar .button, body[data-theme="day"] .command-chip, body[data-theme="day"] .map-toolbar, body[data-theme="day"] .command-map-hint { color:#f8fbff !important; }
body[data-theme="day"] .command-drawer-head h3, body[data-theme="day"] .command-section-head h4, body[data-theme="day"] .command-stat strong, body[data-theme="day"] .command-search-item strong { color:#10253d !important; }
.command-inline-tools { padding: 0 16px 10px; }
.command-auth-row { display:grid; grid-template-columns: minmax(0,1fr) auto auto; gap:8px; padding: 0 16px 12px; }
.command-auth-input { min-height:44px; padding:10px 12px; border-radius:12px; border:1px solid var(--border); background:var(--panel-soft); color:var(--text); }
.command-layer-group { border:1px solid var(--border); border-radius:14px; margin-bottom:10px; overflow:hidden; background:rgba(255,255,255,0.02); }
.command-layer-group summary { cursor:pointer; list-style:none; display:flex; justify-content:space-between; align-items:center; padding:12px 14px; font-weight:700; }
.command-layer-group summary::-webkit-details-marker { display:none; }
.command-layer-group summary span { color:var(--muted); font-weight:600; }
.command-layer-group-body { padding:0 10px 10px; display:grid; gap:8px; }
.command-record-item { align-items:flex-start; }
.command-record-row { display:grid; grid-template-columns: 110px minmax(0,1fr); gap:8px; margin-top:6px; font-size:12px; }
.command-record-row strong { color:inherit; opacity:.85; }
.frequency-item .command-layer-main span { margin-top:2px; }
.command-section-head.compact-head h4, .command-section-head.compact-head span { line-height:1.2; }
.command-inline-console.auth-inline-console { margin-top: 0; padding-top: 10px; }
body.theme-dark .command-layer-group { background: rgba(255,255,255,0.02); }
body[data-theme="day"] .command-layer-group { background: rgba(18,52,87,0.03); }
body[data-theme="day"] .command-search-item em, body[data-theme="day"] .command-record-row span, body[data-theme="day"] .command-layer-main span { color:#51677b !important; }


.frequency-item .command-layer-main { gap: 4px; }
.frequency-item .command-layer-main strong { font-size: 14px; }
.frequency-item .command-layer-main span { display:block; color: var(--muted); line-height: 1.35; }
.rf-marker { position: relative; background: #0f4fa8 !important; color:#ffffff !important; border: 3px solid #ffffff !important; box-shadow: 0 0 0 2px rgba(15,79,168,.28), 0 8px 18px rgba(2,6,23,.32) !important; }
.rf-marker.source-aprs { background:#0f4fa8 !important; }
.rf-marker.source-meshtastic { background:#0f766e !important; }
.rf-marker.source-dmr { background:#7c3aed !important; }
.rf-marker.source-gps-share { background:#15803d !important; }
.rf-marker.source-manual { background:#4b5563 !important; }
.rf-count { background:#f8fafc !important; color:#0f172a !important; border:1px solid rgba(15,23,42,.18) !important; }
.legend-dot { width: 12px !important; height: 12px !important; border: 2px solid rgba(255,255,255,.92); box-shadow: 0 0 0 1px rgba(15,23,42,.28); }
body.theme-dark .legend-dot { border-color: rgba(255,255,255,.95); box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
body.theme-dark .legend-chip, body.theme-dark .command-chip, body.theme-dark .command-alert-chip { backdrop-filter: blur(6px); }

.brand-row > *,
.panel-header > *,
.ops-list-head > *,
.ops-focus-head > *,
.command-drawer-head > *,
.command-section-head > * {
  min-width: 0;
}

.button,
.section-chip,
.ops-tab,
.command-chip,
.status-pill,
.panel-meta {
  white-space: normal;
  line-height: 1.3;
}

.panel-description,
.lede,
.ops-list-head p,
.ops-focus-head p,
.ops-focus-body,
.command-drawer-head p,
.command-task-body,
.command-layer-main,
.command-layer-detail,
.command-search-item,
.command-record-row,
.command-raw,
.feed-note {
  overflow-wrap: anywhere;
  word-break: break-word;
}



/* v7.1.1 UI/UX polish + mobile optimization */
:root {
  --panel-shadow-strong: 0 10px 28px rgba(15, 23, 42, 0.22);
  --tap-size: 42px;
}

.command-bar,
.top-toolbar,
.toolbar,
.command-toolbar {
  backdrop-filter: blur(10px);
  box-shadow: var(--panel-shadow-strong);
}

.drawer,
.panel,
.sidebar-panel,
.console-panel,
.card {
  border-radius: 14px;
}

button,
.btn,
.toolbar button,
.command-bar button,
input,
select,
textarea {
  min-height: var(--tap-size);
}

button,
.button,
.icon-button,
a.button,
.ops-tab,
.section-chip,
.command-source-filter {
  touch-action: manipulation;
}

.panel .close,
.drawer .close,
button.close,
.panel-close,
.drawer-close {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.operator-card,
.dispatch-card,
.task-card,
.incident-card {
  padding: 12px 14px;
  border-radius: 12px;
}

.operator-card .meta,
.dispatch-card .meta,
.task-card .meta,
.incident-card .meta {
  line-height: 1.45;
}

.operator-card .status-chip,
.operator-card .assignment-chip,
.dispatch-card .status-chip,
.task-card .status-chip,
.incident-card .status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.map-popup .popup-grid,
.leaflet-popup-content .popup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

body.mobile-compact .left-drawer,
body.mobile-compact .right-drawer,
body.mobile-compact .sidebar,
body.mobile-compact .drawer {
  width: min(100vw - 18px, 420px) !important;
  max-width: min(100vw - 18px, 420px) !important;
}

body.mobile-compact .command-bar,
body.mobile-compact .top-toolbar,
body.mobile-compact .toolbar,
body.mobile-compact .command-toolbar {
  left: 8px !important;
  right: 8px !important;
  width: auto !important;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-compact .command-bar button,
body.mobile-compact .top-toolbar button,
body.mobile-compact .toolbar button,
body.mobile-compact .command-toolbar button {
  width: 100%;
}

body.mobile-compact .leaflet-control-container .leaflet-top.leaflet-right {
  top: 72px;
}

body.mobile-compact .operator-console,
body.mobile-compact .dispatch-console,
body.mobile-compact .task-console,
body.mobile-compact .incident-console,
body.mobile-compact .diagnostics-console {
  max-height: 46vh;
  overflow: auto;
}

body.mobile-compact .map-popup .popup-grid,
body.mobile-compact .leaflet-popup-content .popup-grid {
  grid-template-columns: 1fr;
}

body.mobile-compact .drawer-footer,
body.mobile-compact .panel-footer {
  position: sticky;
  bottom: 0;
  background: inherit;
  padding-top: 8px;
}

body.mobile-compact .floating-action-bar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1200;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-compact .floating-action-bar button {
  min-height: 46px;
  border-radius: 12px;
  box-shadow: var(--panel-shadow-strong);
  font-size: 12px;
}

:root {
  --app-height: 100vh;
  --app-width: 100vw;
}

@supports (height: 100dvh) {
  :root {
    --app-height: 100dvh;
  }
}

#app-shell {
  height: var(--app-height) !important;
  min-height: var(--app-height) !important;
}

@supports (-webkit-touch-callout: none) {
  html,
  body {
    position: static !important;
    inset: auto !important;
    width: 100%;
    min-height: 100%;
  }

  body.ios-webkit {
    min-height: var(--app-height);
  }

  body.ios-webkit #app-shell {
    height: var(--app-height) !important;
    min-height: var(--app-height) !important;
  }

  body.ios-webkit #sidebar {
    height: var(--app-height) !important;
    max-height: var(--app-height) !important;
  }

  body.ios-webkit .sidebar-inner {
    padding-top: max(18px, calc(env(safe-area-inset-top) + 8px));
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  body.ios-webkit .map-toolbar,
  body.ios-webkit .command-bar,
  body.ios-webkit .command-map-hint,
  body.ios-webkit .floating-action-bar {
    left: max(10px, calc(env(safe-area-inset-left) + 10px));
    right: max(10px, calc(env(safe-area-inset-right) + 10px));
  }

  body.ios-webkit .map-toolbar {
    top: max(10px, calc(env(safe-area-inset-top) + 6px));
  }

  body.ios-webkit .floating-action-bar {
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  body.ios-webkit .boot-fallback-banner {
    top: max(10px, calc(env(safe-area-inset-top) + 10px));
    left: max(10px, calc(env(safe-area-inset-left) + 10px));
    right: max(10px, calc(env(safe-area-inset-right) + 10px));
  }

  body.ios-webkit #sidebar,
  body.ios-webkit .map-toolbar,
  body.ios-webkit .command-bar,
  body.ios-webkit .command-map-hint,
  body.ios-webkit .command-drawer,
  body.ios-webkit .ops-modal-backdrop {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  body.ios-webkit #sidebar,
  body.ios-webkit .map-toolbar,
  body.ios-webkit .command-bar,
  body.ios-webkit .command-drawer,
  body.ios-webkit .floating-action-bar button {
    box-shadow: 0 10px 24px rgba(2, 8, 23, 0.18) !important;
  }

  body.ios-webkit #map-shell,
  body.ios-webkit #map {
    transform: translateZ(0);
  }
}

@media (max-width: 1180px) {
  .left-drawer,
  .right-drawer,
  .sidebar,
  .drawer {
    width: min(44vw, 460px);
  }
}

@media (max-width: 820px) {
  body {
    font-size: 15px;
  }

  .left-drawer,
  .right-drawer,
  .sidebar,
  .drawer {
    width: min(100vw - 18px, 420px);
    max-width: min(100vw - 18px, 420px);
  }

  .command-bar,
  .top-toolbar,
  .toolbar,
  .command-toolbar {
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .command-bar button,
  .top-toolbar button,
  .toolbar button,
  .command-toolbar button {
    width: 100%;
  }

  .leaflet-control-container .leaflet-top.leaflet-right {
    top: 72px;
  }

  .map-popup .popup-grid,
  .leaflet-popup-content .popup-grid {
    grid-template-columns: 1fr;
  }
}

/* v7.1.4 mobile command mode */
body.mobile-command-mode .command-bar {
  display: none !important;
}

body.mobile-command-mode .map-toolbar {
  top: 10px;
  left: 10px;
  right: 10px;
  padding: 10px 12px;
  flex-direction: row !important;
  align-items: center !important;
}

body.mobile-command-mode .map-toolbar-right,
body.mobile-command-mode #map-health,
body.mobile-command-mode #map-legend,
body.mobile-command-mode .map-title-wrap span {
  display: none !important;
}

body.mobile-command-mode .map-toolbar-left {
  width: 100%;
  gap: 10px;
}

body.mobile-command-mode .map-title-wrap strong {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.mobile-command-mode .command-map-hint {
  display: none;
}

body.mobile-command-mode.mobile-map-pick-active .command-map-hint {
  position: fixed;
  top: 132px;
  left: 10px;
  right: 10px;
  z-index: 1172;
  display: block;
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
}

body.mobile-command-mode #mobile-command-strip {
  position: fixed;
  top: 68px;
  left: 10px;
  right: 10px;
  z-index: 1171;
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(7, 18, 28, 0.88);
  color: #f8fbff;
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 18px 40px rgba(2, 8, 23, 0.24);
}

body[data-theme="day"].mobile-command-mode #mobile-command-strip {
  background: rgba(244, 248, 252, 0.95);
  color: #10253d;
  border-color: rgba(15, 23, 42, 0.12);
}

body.mobile-command-mode .mobile-command-strip-copy {
  display: grid;
  gap: 4px;
}

body.mobile-command-mode .mobile-command-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.76;
}

body.mobile-command-mode .mobile-command-detail {
  font-size: 12px;
  opacity: 0.84;
}

body.mobile-command-mode .mobile-command-strip-actions {
  display: flex;
  justify-content: flex-end;
}

body.mobile-command-mode .mobile-command-strip-actions #command-theme-toggle {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: none;
}

body.mobile-command-mode .mobile-command-strip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.mobile-command-mode .mobile-command-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

body[data-theme="day"].mobile-command-mode .mobile-command-stat-pill {
  background: rgba(15, 23, 42, 0.06);
}

body.mobile-command-mode .floating-action-bar {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1182;
  display: grid;
  gap: 8px;
}

body.mobile-command-mode .mobile-command-quick-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-command-mode .mobile-command-nav-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-command-mode .floating-action-bar button {
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(7, 18, 28, 0.92);
  color: #f8fbff;
  box-shadow: 0 16px 32px rgba(2, 8, 23, 0.24);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

body.mobile-command-mode .mobile-command-quick-row button {
  background: linear-gradient(180deg, rgba(31, 90, 163, 0.95), rgba(18, 52, 87, 0.95));
}

body.mobile-command-mode .mobile-command-quick-row button.is-priority {
  box-shadow: 0 18px 36px rgba(2, 8, 23, 0.34);
  transform: translateY(-1px);
}

body.mobile-command-mode .mobile-command-quick-row button.tone-primary {
  background: linear-gradient(180deg, rgba(44, 112, 194, 0.98), rgba(21, 67, 121, 0.98));
}

body.mobile-command-mode .mobile-command-quick-row button.tone-urgent {
  background: linear-gradient(180deg, rgba(191, 66, 45, 0.98), rgba(123, 29, 29, 0.98));
  border-color: rgba(251, 146, 60, 0.4);
}

body.mobile-command-mode .floating-action-bar button.is-active {
  background: #f8fafc;
  color: #10253d;
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-1px);
}

body.mobile-command-mode .floating-action-bar {
  grid-template-columns: 1fr !important;
}

body.mobile-command-mode .mobile-command-quick-row,
body.mobile-command-mode .mobile-command-nav-row {
  width: 100%;
}

body[data-theme="day"].mobile-command-mode .floating-action-bar button {
  background: rgba(255, 255, 255, 0.96);
  color: #123567;
  border-color: rgba(15, 23, 42, 0.1);
}

body[data-theme="day"].mobile-command-mode .mobile-command-quick-row button {
  background: linear-gradient(180deg, rgba(19, 67, 120, 0.96), rgba(15, 49, 90, 0.96));
  color: #f8fbff;
}

body[data-theme="day"].mobile-command-mode .mobile-command-quick-row button.tone-primary {
  background: linear-gradient(180deg, rgba(28, 87, 149, 0.98), rgba(14, 54, 102, 0.98));
}

body[data-theme="day"].mobile-command-mode .mobile-command-quick-row button.tone-urgent {
  background: linear-gradient(180deg, rgba(186, 76, 47, 0.98), rgba(133, 33, 28, 0.98));
  color: #fff7f2;
}

body[data-theme="day"].mobile-command-mode .mobile-command-nav-row button.is-active {
  background: #123567;
  color: #fff;
}

body.mobile-command-mode #mobile-command-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1165;
  border: 0;
  background: rgba(2, 8, 23, 0.36);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

body.mobile-command-mode.mobile-command-sheet-open #mobile-command-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.mobile-command-mode #command-operator-drawer,
body.mobile-command-mode #command-dispatch-drawer,
body.mobile-command-mode #command-task-drawer,
body.mobile-command-mode #command-layers-drawer,
body.mobile-command-mode #command-diagnostics-drawer {
  position: fixed !important;
  top: auto !important;
  left: 10px !important;
  right: 10px !important;
  bottom: 126px !important;
  width: auto !important;
  max-height: min(58vh, 520px) !important;
  z-index: 1175 !important;
  overflow: auto !important;
  border-radius: 24px !important;
  backdrop-filter: none !important;
}

body.mobile-command-mode #command-operator-drawer:not(.is-open),
body.mobile-command-mode #command-dispatch-drawer:not(.is-open),
body.mobile-command-mode #command-task-drawer:not(.is-open),
body.mobile-command-mode #command-layers-drawer:not(.is-open),
body.mobile-command-mode #command-diagnostics-drawer:not(.is-open) {
  transform: translateY(calc(100% + 24px)) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

body.mobile-command-mode #command-operator-drawer.is-open,
body.mobile-command-mode #command-dispatch-drawer.is-open,
body.mobile-command-mode #command-task-drawer.is-open,
body.mobile-command-mode #command-layers-drawer.is-open,
body.mobile-command-mode #command-diagnostics-drawer.is-open {
  transform: translateY(0) !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  visibility: visible !important;
}

body.mobile-command-mode .command-drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px;
}

body.mobile-command-mode .command-drawer-stats {
  padding-top: 12px;
}

body.mobile-command-mode .command-task-actions,
body.mobile-command-mode .command-task-actions-inline,
body.mobile-command-mode .command-operator-actions,
body.mobile-command-mode .command-auth-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

body.mobile-command-mode .leaflet-control-container .leaflet-top.leaflet-right {
  top: 154px;
}

body.ios-webkit.mobile-command-mode #mobile-command-strip,
body.ios-webkit.mobile-command-mode .floating-action-bar {
  left: max(10px, calc(env(safe-area-inset-left) + 10px));
  right: max(10px, calc(env(safe-area-inset-right) + 10px));
}

body.ios-webkit.mobile-command-mode #mobile-command-strip {
  top: max(68px, calc(env(safe-area-inset-top) + 56px));
}

body.ios-webkit.mobile-command-mode #command-operator-drawer,
body.ios-webkit.mobile-command-mode #command-dispatch-drawer,
body.ios-webkit.mobile-command-mode #command-task-drawer,
body.ios-webkit.mobile-command-mode #command-layers-drawer,
body.ios-webkit.mobile-command-mode #command-diagnostics-drawer {
  left: max(10px, calc(env(safe-area-inset-left) + 10px)) !important;
  right: max(10px, calc(env(safe-area-inset-right) + 10px)) !important;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 116px) !important;
}


/* v7.1.5 night map + command surface health pass */
:root {
  --night-map-filter: grayscale(0.88) invert(0.92) hue-rotate(180deg) brightness(0.84) contrast(0.92) saturate(0.58);
}

#map-shell {
  --command-bar-top: 86px;
  --command-hint-top: 154px;
  --command-drawer-top: 194px;
  --command-drawer-max-height: calc(100% - 208px);
}

body.theme-dark #map[data-basemap-provider="carto-dark"] .leaflet-tile-pane {
  filter: none !important;
}

body.theme-dark #map[data-basemap-provider="osm-dark-fallback"] .leaflet-tile-pane {
  filter: var(--night-map-filter) !important;
}

.command-bar {
  align-items: flex-start;
  top: var(--command-bar-top);
}

.command-bar-left,
.command-bar-right {
  min-width: 0;
  row-gap: 8px;
}

.command-bar-left {
  flex: 1 1 520px;
}

.command-bar-right {
  flex: 999 1 640px;
  justify-content: flex-end;
}

.command-bar .button,
.command-bar .command-chip {
  min-height: 38px;
}

.command-drawer-stats:empty {
  display: none;
}

.command-drawer-head p,
.command-diagnostics-note,
.command-layer-detail {
  line-height: 1.4;
}

.command-diagnostics-row strong,
.system-row strong {
  min-width: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.command-search-item,
.command-layer-item,
.dispatch-candidate-card,
.command-task-card,
.command-operator-card {
  min-width: 0;
}

@media (min-width: 821px) {
  #map-shell > .command-map-hint {
    top: var(--command-hint-top);
  }

  #map-shell > .operator-drawer,
  #map-shell > .diagnostics-drawer,
  #map-shell > .dispatch-drawer,
  #map-shell > .task-drawer,
  #map-shell > .layers-drawer {
    top: var(--command-drawer-top);
    max-height: var(--command-drawer-max-height);
  }
}

.gps-chip.is-live {
  color: #dcfce7 !important;
  background: rgba(22, 101, 52, 0.52) !important;
  border-color: rgba(74, 222, 128, 0.34) !important;
}

.gps-chip.is-waiting,
.gps-chip.is-idle {
  color: #fef3c7 !important;
  background: rgba(120, 53, 15, 0.42) !important;
  border-color: rgba(251, 191, 36, 0.28) !important;
}

.gps-chip.is-error {
  color: #fee2e2 !important;
  background: rgba(127, 29, 29, 0.5) !important;
  border-color: rgba(248, 113, 113, 0.32) !important;
}

.gps-chip.is-off {
  color: #e2e8f0 !important;
  background: rgba(51, 65, 85, 0.42) !important;
}

#command-share-gps.is-sharing {
  color: #dcfce7;
  background: #166534;
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.22) inset, 0 8px 18px rgba(22, 101, 52, 0.22);
}

#command-share-gps.is-sharing:hover {
  background: #14532d;
}

.gps-div-icon {
  background: transparent;
  border: 0;
}

.gps-marker {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(14, 165, 233, 0.18);
  border: 2px solid rgba(14, 165, 233, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92), 0 8px 18px rgba(2, 8, 23, 0.28);
}

.gps-marker span {
  width: 10px;
  height: 10px;
  display: block;
  border-radius: 999px;
  background: #0ea5e9;
}

.gps-marker::before,
.gps-marker::after {
  content: '';
  position: absolute;
  background: rgba(14, 165, 233, 0.82);
}

.gps-marker::before {
  width: 2px;
  height: 34px;
  top: -5px;
}

.gps-marker::after {
  width: 34px;
  height: 2px;
  left: -5px;
}

.gps-marker.is-stale {
  border-color: rgba(148, 163, 184, 0.82);
  background: rgba(71, 85, 105, 0.2);
}

.gps-marker.is-stale span,
.gps-marker.is-stale::before,
.gps-marker.is-stale::after {
  background: #94a3b8;
}

/* Phone/tablet: hide the command card while the sidebar is open so it does not cover the sidebar header. */
body.mobile-command-mode.sidebar-open #mobile-command-strip {
  display: none;
}
