/* ═══════════════════════════════════════════════════════════════
   ConnectSydney Project Works Map - Corporate Design System
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Connect Sydney brand - interface chrome */
  --brand-lime:   #8CC63F;
  --brand-green:  #3FB449;
  --brand-teal:   #22B573;
  --brand-deep:   #158A63;

  /* Corporate light surfaces & planes */
  --surface:      #ffffff;
  --surface-card: #fcfcfb;
  --plane:        #f6f6f4;
  --plane-hover:  #ecece8;
  --hairline:     #e2e1db;
  --border:       #e2e1db;
  --border-hi:    #cecdc6;
  --ring:         rgba(11, 11, 11, 0.10);

  /* Crisp corporate ink typography */
  --ink:          #0b0b0b;
  --ink-2:        #444340;
  --ink-muted:    #73716b;
  --text:         #0b0b0b;
  --text-muted:   #444340;
  --text-dim:     #73716b;

  /* Backwards-compatible aliases */
  --bg:           var(--plane);
  --bg-raised:    var(--surface);
  --bg-surface:   var(--plane);
  --bg-glass:     rgba(255, 255, 255, 0.96);
  --bg-card:      var(--surface);

  --cs-green:     var(--brand-green);
  --cs-teal:      var(--brand-teal);
  --cs-mid:       var(--brand-teal);
  --accent:       var(--brand-teal);
  --accent-dim:   rgba(34, 181, 115, 0.12);

  /* Marker palette - accessible and CVD calibrated */
  --red:          #dc2626;
  --red-dim:      rgba(220, 38, 38, 0.12);
  --green:        #15803d;
  --green-dim:    rgba(21, 128, 61, 0.12);
  --blue:         #2563eb;
  --blue-dim:     rgba(37, 99, 235, 0.12);
  --amber:        #d97706;
  --amber-dim:    rgba(217, 119, 6, 0.12);

  --header-h:     48px;
  --status-h:     28px;
  --radius:       6px;
  --radius-sm:    4px;
  --shadow:       0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg:    0 12px 32px rgba(0, 0, 0, 0.14);
  --transition:   0.15s ease;

  --font:         system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; accent-color: var(--brand-teal); }
body {
  font-family: var(--font);
  background: var(--plane);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a, a:visited {
  color: var(--brand-deep);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ── Header ────────────────────────────────────────────────── */
#top-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 16px; gap: 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  z-index: 1000;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  height: 24px; width: auto;
  display: block;
}
.brand-divider {
  width: 1px; height: 20px;
  background: var(--hairline);
}
.brand-sub {
  font-size: 12.5px; font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.01em;
}

#main-nav {
  display: flex; gap: 4px; margin-left: 20px;
}
.nav-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font: 500 12.5px/1 var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.nav-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-btn:hover {
  color: var(--ink);
  background: var(--plane);
}
.nav-btn.active {
  color: var(--brand-deep);
  background: rgba(34, 181, 115, 0.12);
  border-color: rgba(34, 181, 115, 0.35);
  font-weight: 650;
}

.toolbar {
  display: flex; gap: 4px; margin-left: auto;
}
.tool-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: all var(--transition);
}
.tool-btn svg { width: 15px; height: 15px; }
.tool-btn:hover {
  color: var(--ink);
  background: var(--plane);
  border-color: var(--border-hi);
}

#btn-excel-sync {
  width: auto !important;
  min-width: max-content;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  height: 32px;
  border-radius: 6px;
  background: rgba(16, 124, 65, 0.08);
  border: 1px solid rgba(16, 124, 65, 0.28);
  color: #107c41;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
#btn-excel-sync:hover {
  background: rgba(16, 124, 65, 0.16);
  border-color: #107c41;
  color: #0b5a2f;
  transform: translateY(-1px);
}
#btn-excel-sync:active {
  transform: translateY(0);
}
#btn-excel-sync svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Status bar ────────────────────────────────────────────── */
#status-bar {
  position: fixed;
  top: var(--header-h); left: 0; right: 0;
  height: var(--status-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  font-size: 11.5px; color: var(--ink-muted);
  background: var(--plane);
  border-bottom: 1px solid var(--hairline);
  z-index: 999;
}

/* ── Views ──────────────────────────────────────────────────── */
#app-main {
  position: fixed;
  top: calc(var(--header-h) + var(--status-h));
  left: 0; right: 0; bottom: 0;
}
.view {
  display: none;
  position: absolute;
  inset: 0;
}
.view.active {
  display: flex;
  flex-direction: column;
}

/* ── Map ────────────────────────────────────────────────────── */
#map { flex: 1; z-index: 1; }

.map-panel {
  position: absolute;
  z-index: 800;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 11.5px;
  color: var(--ink-2);
}

/* Legend */
#map-legend {
  bottom: 16px; left: 12px;
  padding: 10px 14px;
}
.legend-item { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.legend-item:last-child { margin-bottom: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-red   { background: var(--red); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }
.dot-blue  { background: var(--blue); }
.dot-uf    { background: #d97706; border-radius: 2px; transform: rotate(45deg); }
.dot-core  { background: #d97706; border-radius: 2px; }
.legend-poly {
  display: inline-block;
  width: 12px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid #d97706;
  background: rgba(217, 119, 6, 0.35);
  flex-shrink: 0;
}
.legend-poly.legend-fy27 {
  border-color: #d97706;
  background: rgba(217, 119, 6, 0.35);
}

/* Time slider panel */
#time-panel {
  bottom: 16px; right: 12px;
  width: 280px;
  padding: 10px 14px;
  transition: right 0.25s ease;
}
#view-map.drawer-open #time-panel,
#view-map.drawer-open .fab-field-capture {
  right: 456px;
}
.time-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
}
.time-header label {
  font-size: 11.5px; font-weight: 600; color: var(--ink);
}
.time-reset-btn {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 1px solid var(--hairline); border-radius: 4px;
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all var(--transition);
}
.time-reset-btn:hover {
  color: var(--ink);
  background: var(--plane);
}
.time-slider-wrap {
  position: relative;
}
#time-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--hairline);
  outline: none;
  cursor: pointer;
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand-teal);
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  transition: box-shadow var(--transition);
}
#time-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px rgba(34, 181, 115, 0.2);
}
#time-slider::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--brand-teal);
  border: 2px solid #fff;
  cursor: grab;
}
.time-ticks {
  display: flex; justify-content: space-between;
  margin-top: 5px;
  font-size: 10.5px; color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* Leaflet overrides */
.leaflet-container { background: #e6e5e1; }
.leaflet-control-zoom a {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border-color: var(--hairline) !important;
}
.leaflet-popup-content-wrapper {
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
}
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; line-height: 1.45; }
.leaflet-popup-content strong { color: var(--brand-deep); }
.leaflet-popup-close-button { color: var(--ink-muted) !important; font-size: 16px !important; }

/* ── Table ──────────────────────────────────────────────────── */
#view-table { padding: 12px 16px; gap: 10px; overflow: hidden; background: var(--plane); }
.table-type-toggle {
  display: flex; gap: 3px;
  background: var(--surface);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--hairline);
  width: fit-content;
}
.tbl-toggle-btn {
  background: transparent;
  border: none;
  color: var(--ink-2);
  font: 500 11.5px/1.2 var(--font);
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
}
.tbl-toggle-btn:hover { color: var(--ink); }
.tbl-toggle-btn.active {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff;
  font-weight: 600;
}
.table-controls {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.table-controls input[type="text"],
.table-controls select {
  padding: 6px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 400 12.5px/1.4 var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.table-controls input[type="text"] { width: 240px; }
.table-controls input:focus,
.table-controls select:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
}
#table-count { margin-left: auto; font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

.table-wrapper {
  flex: 1; overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
  background: var(--surface);
}
#sightings-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
#sightings-table thead {
  position: sticky; top: 0; z-index: 2;
  background: var(--plane);
}
#sightings-table th {
  padding: 8px 12px;
  text-align: left;
  font-weight: 650; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink);
  border-bottom: 2px solid var(--brand-teal);
  white-space: nowrap;
  user-select: none;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--brand-deep); }
th.sorted-asc::after  { content: ' ▲'; color: var(--brand-deep); font-size: 9px; }
th.sorted-desc::after { content: ' ▼'; color: var(--brand-deep); font-size: 9px; }

#sightings-table td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--hairline);
  max-width: 180px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
#sightings-table tbody tr {
  transition: background var(--transition);
}
#sightings-table tbody tr:hover {
  background: rgba(34, 181, 115, 0.08);
  cursor: pointer;
}
.badge {
  display: inline-block; padding: 2px 7px;
  border-radius: 4px; font-size: 10.5px; font-weight: 600;
}
.badge-pipeline { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-app      { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-proj-its      { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-proj-pavement { background: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.badge-proj-enviro   { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-proj-other    { background: var(--plane); color: var(--ink-2); border: 1px solid var(--hairline); }

.link-sp, .link-sp:visited {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 4px;
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep) !important;
  border: 1px solid rgba(34, 181, 115, 0.3);
  font-size: 11px; font-weight: 600;
  text-decoration: none !important;
  transition: all var(--transition);
}
.link-sp:hover {
  background: var(--brand-teal);
  color: #fff !important;
  border-color: var(--brand-teal);
  text-decoration: none !important;
}
.link-sp-find, .link-sp-find:visited {
  background: rgba(217, 119, 6, 0.12);
  color: #b45309 !important;
  border: 1px solid rgba(217, 119, 6, 0.3);
  text-decoration: none !important;
}
.link-sp-find:hover {
  background: #d97706;
  color: #fff !important;
  border-color: #d97706;
  text-decoration: none !important;
}

.btn-delete-row {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-delete-row:hover {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
}

/* ── Add sighting form ──────────────────────────────────────── */
#view-add {
  overflow-y: auto;
  padding: 24px 16px;
  justify-content: flex-start;
  align-items: center;
  background: var(--plane);
}
.form-container { width: 100%; max-width: 720px; }
.form-panel {
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.form-panel h2 {
  font-size: 15px; font-weight: 650;
  margin-bottom: 14px;
  color: var(--ink);
}
.type-toggle {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--plane);
  border-radius: 6px;
  padding: 3px;
  border: 1px solid var(--hairline);
}
.toggle-btn {
  flex: 1 1 auto;
  min-width: 110px;
  padding: 7px 12px;
  border: none; border-radius: 4px;
  background: transparent;
  color: var(--ink-2);
  font: 500 12px/1.2 var(--font);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.toggle-btn:hover { color: var(--ink); background: rgba(0,0,0,0.03); }
.toggle-btn.active {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.toggle-btn[data-type="coaltar"].active {
  background: linear-gradient(97deg, #f97316, #ea580c);
}
.toggle-btn[data-type="find"].active {
  background: linear-gradient(97deg, #eab308, #d97706);
}
.btn-manage-types:hover {
  border-color: var(--brand-deep) !important;
  color: var(--brand-deep) !important;
  background: rgba(0,184,156,0.06) !important;
}
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block; margin-bottom: 5px;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.req { color: var(--red); }
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: 400 12.5px/1.4 var(--font);
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
}
.form-group input[type="file"] { font-size: 12px; }
#photo-preview { margin-top: 6px; }
#photo-preview img {
  max-width: 100%; max-height: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
}

.location-fieldset {
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface-card);
  padding: 14px; margin-bottom: 16px;
}
.location-fieldset legend {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 0 6px;
}
.loc-controls {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.loc-or { font-size: 12px; color: var(--ink-muted); }
.mini-map {
  width: 100%; height: 280px;
  min-height: 220px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.coord-display {
  display: flex; gap: 20px; margin-top: 6px;
  font-size: 11.5px; font-family: var(--font-mono);
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 16px;
  border: 1px solid var(--hairline); border-radius: 6px;
  font: 500 12.5px/1 var(--font);
  cursor: pointer;
  transition: all var(--transition);
}
.btn:disabled {
  opacity: 0.45; cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  color: #fff;
}
.btn-secondary {
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.btn-secondary:hover {
  border-color: var(--brand-teal);
  color: var(--brand-deep);
  background: var(--plane);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--border-hi);
  background: var(--plane);
}
.form-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ── Toast ──────────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  padding: 9px 22px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  font-size: 12.5px; color: var(--ink);
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 9999;
}
.toast.visible {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--brand-teal); color: var(--brand-deep); font-weight: 600; }
.toast.error   { border-color: var(--red); color: var(--red); }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .brand-sub { display: none; }
  .brand-divider { display: none; }
  .nav-btn span { display: none; }
  .nav-btn { padding: 6px; }
  #main-nav { margin-left: 6px; }
  .table-controls { flex-wrap: wrap; }
  .table-controls input[type="text"] { width: 100%; }
  .form-row { flex-direction: column; gap: 0; }
  #time-panel { width: 200px; }
}
@media (max-width: 480px) {
  .toolbar { gap: 1px; }
  .tool-btn { width: 28px; height: 28px; }
}

/* Crosshair cursor for marker placement */
.leaflet-container.crosshair-cursor {
  cursor: crosshair !important;
}

/* Marker clusters */
.marker-cluster-small {
  background-color: rgba(0, 184, 156, 0.2) !important;
}
.marker-cluster-small div {
  background-color: var(--cs-teal) !important;
  color: #000 !important;
  font-weight: 600; font-size: 12px;
}
.marker-cluster-medium {
  background-color: rgba(60, 192, 112, 0.25) !important;
}
.marker-cluster-medium div {
  background-color: var(--cs-mid) !important;
  color: #000 !important;
  font-weight: 600; font-size: 12px;
}
.marker-cluster-large {
  background-color: rgba(109, 200, 68, 0.25) !important;
}
.marker-cluster-large div {
  background-color: var(--cs-green) !important;
  color: #000 !important;
  font-weight: 600; font-size: 12px;
}

/* ── Modals & Overlays ────────────────────────────────────────── */
.modal, .modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(11, 11, 11, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; z-index: 10001;
  width: 100%; max-width: 640px;
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  box-sizing: border-box;
  animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--hairline);
  background: var(--plane);
}
.modal-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 650; color: var(--ink);
}
.modal-close-btn {
  background: transparent; border: none;
  color: var(--ink-muted); font-size: 22px; line-height: 1;
  cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.modal-close-btn:hover { color: var(--ink); background: var(--plane-hover); }
.modal-body {
  padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px;
}
.gis-intro {
  font-size: 12px; color: var(--ink-2); line-height: 1.5; margin: 0;
}
.gis-card {
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.gis-card-header {
  display: flex; align-items: center; gap: 8px; font-size: 13px;
}
.gis-badge {
  font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 7px; border-radius: 4px;
}
.gis-badge.arcgis {
  background: rgba(34, 181, 115, 0.12); color: var(--brand-deep); border: 1px solid rgba(34, 181, 115, 0.3);
}
.gis-badge.geojson {
  background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd;
}
.gis-desc {
  font-size: 11.5px; color: var(--ink-muted); margin: 0;
}
.endpoint-box {
  display: flex; gap: 6px; align-items: center; margin-top: 4px;
}
.ep-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--ink);
  font: 400 11px/1.4 var(--font-mono);
  padding: 6px 10px;
  outline: none;
  user-select: all;
}
.btn-copy, .btn-dl {
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  font: 500 11.5px/1.2 var(--font);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.btn-copy:hover, .btn-dl:hover {
  background: var(--brand-teal);
  color: #fff;
  border-color: var(--brand-teal);
}
.gis-instructions {
  font-size: 11.5px; color: var(--ink-2); background: rgba(34, 181, 115, 0.08);
  border-left: 3px solid var(--brand-teal); padding: 6px 10px; border-radius: 0 4px 4px 0; margin-top: 4px;
}

/* ── Clean Project & Area Navigation Bar ─────────────────────── */
.project-nav-bar {
  top: 12px;
  left: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  z-index: 850;
  max-width: calc(100vw - 120px);
}
.pnb-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}
.pnb-select {
  background: var(--plane);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 5px 10px;
  font: 500 12px/1.3 var(--font);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}
.pnb-select:focus {
  border-color: var(--brand-teal);
}
.pnb-core-select {
  border-color: #f59e0b;
  color: #b45309;
}
.pnb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--hairline);
}
.pnb-btn {
  font: 500 11.5px/1.2 var(--font);
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
}
.pnb-btn:hover {
  background: var(--plane);
  color: var(--ink);
  border-color: var(--border-hi);
  text-decoration: none !important;
}
.pnb-btn-sp, .pnb-btn-sp:visited {
  color: var(--ink) !important;
  text-decoration: none !important;
}
.pnb-btn-add {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: rgba(34, 181, 115, 0.35);
}
.pnb-btn-add:hover {
  background: var(--brand-teal);
  color: #fff;
  border-color: var(--brand-teal);
}
.pnb-btn-edit {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--hairline);
}
.pnb-btn-edit:hover {
  background: var(--plane);
  color: var(--ink);
}
.pnb-btn-new {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--hairline);
  margin-left: 4px;
}
.pnb-btn-new:hover {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: rgba(34, 181, 115, 0.35);
}
.pnb-btn-nogo {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  margin-left: 0;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}
.pnb-btn-nogo:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
  box-shadow: 0 3px 12px rgba(185, 28, 28, 0.45);
}
.toggle-btn-nogo {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
  font-weight: 700;
}
.toggle-btn-nogo:hover {
  background: #b91c1c !important;
  border-color: #991b1b !important;
}

/* ── Edit Modal Specifics ───────────────────────────────────── */
#edit-modal .modal-card {
  max-width: 680px;
}
#edit-modal label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 3px;
  display: block;
}
#edit-modal input, #edit-modal select, #edit-modal textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  padding: 6px 10px;
  font: 400 12.5px/1.4 var(--font);
  color: var(--ink);
  outline: none;
}
#edit-modal input:focus, #edit-modal select:focus, #edit-modal textarea:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
}
#edit-modal .form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}
#edit-modal .form-group {
  margin-bottom: 10px;
}

/* ── Project Bounding Area in Modal ─────────────────────────── */
.proj-bounds-section {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
}
.proj-bounds-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 6px;
}
.proj-bounds-title {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink) !important;
  margin-bottom: 0 !important;
}
.proj-bounds-actions {
  display: flex;
  gap: 4px;
}
.btn-micro {
  font: 500 10.5px/1.2 var(--font);
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-micro:hover {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: var(--brand-teal);
}
.bounds-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
}
.bounds-grid .form-group {
  margin-bottom: 0 !important;
}
.bounds-grid input {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  padding: 5px 6px !important;
}

/* ── Sync Status & User Profile in Header ───────────────────── */
.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  font-size: 11px;
  color: var(--ink-2);
  user-select: none;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-teal);
  box-shadow: 0 0 4px var(--brand-teal);
  transition: background-color var(--transition);
}
.sync-status.syncing .sync-dot {
  background: #d97706;
  box-shadow: 0 0 4px #d97706;
  animation: pulse 1s infinite alternate;
}
.sync-status.offline .sync-dot {
  background: #dc2626;
  box-shadow: 0 0 4px #dc2626;
}
@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 3px 8px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
}
.user-name {
  font-weight: 500;
  color: var(--ink);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role-badge {
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border: 1px solid rgba(34, 181, 115, 0.3);
}
.user-role-badge.viewer {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--hairline);
}
.btn-signout {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 11px;
  border-radius: 2px;
  transition: color var(--transition);
}
.btn-signout:hover {
  color: #dc2626;
}

/* ── Auth Modal (LISA GIS for Connect Sydney) ───────────────── */
#auth-modal {
  z-index: 99999 !important;
}
#auth-modal .modal-backdrop {
  background: rgba(15, 23, 42, 0.70);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
#auth-modal .modal-card.auth-card {
  max-width: 420px;
  width: 92%;
  margin: auto;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}
#auth-modal .auth-header {
  text-align: center;
  display: block;
  padding: 28px 24px 18px 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface) !important;
}
.auth-brand-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}
.auth-lisa-logo {
  height: 52px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
}
.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin: 6px 0 4px 0;
  letter-spacing: -0.015em;
  text-align: center;
}
.auth-badge-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(34, 181, 115, 0.10);
  border: 1px solid rgba(34, 181, 115, 0.22);
  color: var(--brand-deep);
  font-size: 0.74rem;
  font-weight: 600;
  margin: 4px auto 6px auto;
  letter-spacing: 0.01em;
}
.auth-subtitle {
  font-size: 0.81rem;
  color: var(--ink-muted);
  margin: 0;
  text-align: center;
}
#auth-modal #auth-form {
  padding: 22px 26px 26px 26px;
  background: var(--surface) !important;
}
#auth-modal input[type="email"],
#auth-modal input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  background: var(--plane);
  border: 1px solid var(--hairline);
  color: var(--ink);
  border-radius: 6px;
  padding: 10px 12px;
  font: 400 13.5px/1.4 var(--font);
  outline: none;
  transition: all var(--transition);
}
#auth-modal input[type="email"]:focus,
#auth-modal input[type="password"]:focus {
  background: #ffffff;
  border-color: var(--brand-teal);
  box-shadow: 0 0 0 3px rgba(34, 181, 115, 0.15);
}
#auth-modal .btn-primary {
  width: 100%;
  padding: 11px;
  font-weight: 650;
  font-size: 13.5px;
  border-radius: 6px;
  background: var(--brand-teal);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(34, 181, 115, 0.3);
  transition: all var(--transition);
}
#auth-modal .btn-primary:hover {
  background: var(--brand-deep);
}

/* ── Corporate Project Navigation & Corridor Styling ─────────── */
.pnb-portfolio-select {
  font-weight: 600;
  border-color: var(--hairline);
  color: var(--ink);
  background: var(--plane);
}
.pnb-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  user-select: none;
}
.pnb-toggle-label:hover {
  background: var(--plane);
  color: var(--ink);
}
.pnb-toggle-label input[type="checkbox"] {
  accent-color: var(--brand-teal);
  cursor: pointer;
}
.pnb-status-badge {
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  background: var(--plane);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.pnb-status-badge.status-approved,
.pnb-status-badge.status-approved-ongoing,
.status-badge.status-approved,
.status-badge.status-approved-ongoing {
  background: #dcfce7;
  color: #15803d;
  border-color: #86efac;
}
.pnb-status-badge.status-in-progress,
.pnb-status-badge.status-stage-1---scoping,
.pnb-status-badge.status-stage-2---draft-submitted,
.status-badge.status-in-progress,
.status-badge.status-stage-1---scoping {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}
.pnb-status-badge.status-on-hold,
.pnb-status-badge.status-stalled,
.status-badge.status-on-hold {
  background: #fef3c7;
  color: #b45309;
  border-color: #fcd34d;
}

/* Portfolio Badges */
.portfolio-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.portfolio-badge.portfolio-pavements,
.portfolio-badge.portfolio-pavement {
  background: #ffedd5;
  color: #c2410c;
  border: 1px solid #fed7aa;
}
.portfolio-badge.portfolio-its {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.portfolio-badge.portfolio-structures---corridors,
.portfolio-badge.portfolio-structures {
  background: var(--plane);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.portfolio-badge.portfolio-maintenance {
  background: #ccfbf1;
  color: #0f766e;
  border: 1px solid #99f6e4;
}
.portfolio-badge.portfolio-special-projects {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}
.portfolio-badge.portfolio-weeds {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

/* Corporate Project Popup */
.corporate-project-popup {
  font-family: var(--font);
  color: var(--ink);
  max-width: 320px;
  min-width: 260px;
  line-height: 1.4;
}
.popup-proj-header {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.popup-proj-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}
.popup-proj-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
}
.popup-proj-code {
  color: var(--brand-deep);
  font-weight: 700;
}
.popup-proj-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.popup-prop-row {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-2);
}
.popup-prop-row strong {
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}
.popup-notes {
  font-size: 11.5px;
  color: var(--ink-2);
  background: var(--plane);
  padding: 7px 9px;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  border-left: 3px solid #fab219;
  margin-top: 4px;
}
.popup-section {
  margin-top: 6px;
  border-top: 1px solid var(--hairline);
  padding-top: 6px;
}
.popup-section-title {
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 4px;
}
.popup-docs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 130px;
  overflow-y: auto;
}
.popup-doc-item {
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 11px;
}
.popup-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}
.popup-doc-type {
  color: var(--ink);
}
.popup-doc-meta {
  color: var(--ink-muted);
  font-size: 10px;
  margin-top: 2px;
}
.popup-sp-link {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff !important;
  border-radius: 5px;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none !important;
  margin-top: 6px;
  transition: all var(--transition);
}
.popup-sp-link:hover {
  filter: brightness(1.06);
  color: #fff !important;
  text-decoration: none !important;
}
.popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  justify-content: flex-end;
}

/* ── FY27 Tactical Pavements Styling ────────────────────────── */
.pnb-fy27-toggle {
  border-color: #fcd34d !important;
  background: #fef3c7 !important;
  color: #b45309 !important;
  font-weight: 600;
}
.pnb-fy27-toggle:hover {
  background: #fde68a !important;
  color: #92400e !important;
}
.pnb-fy27-toggle input[type="checkbox"] {
  accent-color: #d97706 !important;
}

.corporate-fy27-popup {
  max-width: 340px;
}
.corporate-fy27-popup .popup-proj-header {
  border-bottom: 1px solid #fcd34d;
}
.corporate-fy27-popup .popup-proj-code {
  color: #b45309;
  font-weight: 700;
}
.corporate-fy27-popup code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(11, 11, 11, 0.06);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink);
}

/* ── Pavement Intelligence & Scenario Optimizer Toolbar ─────── */
.pnb-intel-group {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 2px;
}
.pnb-btn-tool {
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.pnb-btn-tool:hover {
  background: var(--plane);
  color: var(--ink);
  border-color: var(--border-hi);
}
.pnb-btn-tool.active {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: var(--brand-teal);
}
.pnb-btn-optimizer {
  background: rgba(34, 181, 115, 0.12);
  border: 1px solid rgba(34, 181, 115, 0.35);
  color: var(--brand-deep);
  font-weight: 600;
}
.pnb-btn-optimizer:hover {
  background: var(--brand-teal);
  color: #fff;
}

/* ── Two-Pane Map Layout & Docked Corridor Panel ── */
#view-map.view.active {
  display: flex !important;
  flex-direction: row !important;
  overflow: hidden;
  position: absolute;
  inset: 0;
}

.corridor-panel {
  width: 380px;
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 50;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1), width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}
.corridor-panel.collapsed {
  margin-left: -380px;
  width: 0;
  border-right: none;
  pointer-events: none;
}

.panel-header {
  padding: 11px 16px 10px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(97deg, rgba(140, 198, 63, 0.14), rgba(34, 181, 115, 0.14));
  flex-shrink: 0;
}
.panel-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-brand-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-brandlogo {
  height: 24px;
  width: auto;
  display: block;
}
.panel-app-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.panel-toggle-btn {
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 15px;
  line-height: 1.2;
  cursor: pointer;
  transition: all 0.15s ease;
}
.panel-toggle-btn:hover {
  border-color: var(--brand-teal);
  color: var(--brand-deep);
  background: var(--plane);
}
.panel-sub {
  font-size: 11px;
  color: var(--ink-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  flex-shrink: 0;
}
.panel-tab-btn {
  flex: 1;
  padding: 9px 6px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.panel-tab-btn:hover {
  color: var(--ink);
  background: var(--plane);
}
.panel-tab-btn.active {
  color: var(--brand-deep);
  font-weight: 650;
  border-bottom-color: var(--brand-teal);
  background: transparent;
}
.panel-pill {
  background: var(--brand-teal);
  color: #fff;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.panel-scroll-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  min-height: 0;
  background: var(--surface);
}
.panel-sticky-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  padding: 9px 12px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.panel-search-wrap input[type=search] {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
}
.panel-search-wrap input[type=search]:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
  background: #fff;
}
.panel-filter-row {
  display: flex;
  gap: 6px;
}
.panel-filter-row select {
  flex: 1;
  font-size: 11.5px;
  padding: 5px 7px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.panel-filter-row select:focus {
  border-color: var(--brand-teal);
}
.panel-count-hint {
  font-size: 11px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}
.panel-sec-header {
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 4px;
}

.panel-expand-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 850;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-deep);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-left: 3px solid var(--brand-teal);
  border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.15s ease;
}
.panel-expand-btn:hover {
  background: var(--plane);
  color: var(--brand-deep);
  border-color: var(--brand-teal);
}

.map-container {
  flex: 1;
  min-width: 0;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.map-container #map {
  flex: 1;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.map-quick-toolbar {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 800;
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  padding: 4px;
  box-shadow: var(--shadow);
}

/* Ensure Leaflet base layer list control is positioned below the quick toggle control toolbar */
.leaflet-top.leaflet-right {
  top: 56px !important;
  right: 14px !important;
  z-index: 850 !important;
}
.leaflet-top.leaflet-right .leaflet-control {
  margin-top: 0 !important;
  margin-right: 0 !important;
}
.leaflet-control-layers {
  border: 1px solid var(--hairline) !important;
  border-radius: 6px !important;
  box-shadow: var(--shadow) !important;
  background: var(--surface) !important;
  font-family: var(--font) !important;
  font-size: 11.5px !important;
  color: var(--ink) !important;
}
.leaflet-control-layers-expanded {
  padding: 8px 12px !important;
  line-height: 1.6 !important;
  background: var(--surface) !important;
}
.leaflet-control-layers-base label {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer !important;
  margin-bottom: 3px !important;
}
.quick-pill-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
}
.quick-pill-btn:hover {
  background: var(--plane);
  color: var(--ink);
}
.quick-pill-btn.active {
  background: rgba(34, 181, 115, 0.12);
  border-color: rgba(34, 181, 115, 0.35);
  color: var(--brand-deep);
}

.drawer-admin-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(34, 181, 115, 0.3);
}

.drawer-scen-selector {
  padding: 10px 14px 8px;
  background: var(--plane);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
}

.drawer-segmented-control {
  display: flex;
  border: 1px solid var(--hairline);
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.drawer-seg-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: transparent;
  border: none;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.drawer-seg-btn:first-child {
  border-right: 1px solid var(--hairline);
}
.drawer-seg-btn:hover {
  color: var(--ink);
  background: var(--plane);
}
.drawer-seg-btn.active {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff;
  font-weight: 600;
}

.drawer-metrics-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline);
  flex-shrink: 0;
  gap: 4px;
}

.d-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}
.d-val {
  font-size: 13px;
  font-weight: 750;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.d-val.highlight {
  color: var(--brand-deep);
}
.d-lbl {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  margin-top: 1px;
}

.drawer-route-ctl {
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  flex-shrink: 0;
}

.drawer-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-drawer-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-drawer-action:hover {
  border-color: var(--brand-teal);
  color: var(--brand-deep);
  background: var(--plane);
}
.btn-drawer-action.active {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  color: #fff;
  font-weight: 600;
  border-color: transparent;
}
.btn-export-pkg {
  background: var(--surface);
  border-color: var(--hairline);
  color: var(--brand-deep);
}
.btn-export-pkg:hover {
  background: rgba(34, 181, 115, 0.12);
  border-color: var(--brand-teal);
  color: var(--brand-deep);
}
.btn-export-coring {
  background: var(--surface);
  border-color: var(--hairline);
  color: #b45309;
}
.btn-export-coring:hover {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #b45309;
}
.btn-doc-viewer {
  background: var(--surface);
  border-color: var(--hairline);
  color: #1d4ed8;
}
.btn-doc-viewer:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1d4ed8;
}

/* Assumptions & Sensitivity Tuning Accordion */
.drawer-assumptions {
  border-bottom: 1px solid var(--hairline);
  background: var(--plane);
  flex-shrink: 0;
}
.drawer-assumptions-summary {
  padding: 8px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  user-select: none;
}
.drawer-assumptions-summary::-webkit-details-marker {
  display: none;
}
.drawer-assumptions-summary:hover {
  color: var(--ink);
  background: var(--plane-hover);
}
.drawer-tune-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.drawer-assumptions[open] .drawer-tune-badge {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: var(--brand-teal);
}
.drawer-assumptions-body {
  padding: 8px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--surface);
  border-top: 1px solid var(--hairline);
}
.drawer-tune-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.drawer-tune-row label {
  font-size: 11px;
  color: var(--ink-2);
  flex: 1;
}
.drawer-tune-row input[type=number] {
  width: 90px;
  padding: 4px 6px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--ink);
  text-align: right;
  outline: none;
}
.drawer-tune-row input[type=number]:focus {
  border-color: var(--brand-teal);
}
.drawer-tune-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--hairline);
}
.tune-hint {
  font-size: 10px;
  color: var(--ink-muted);
  font-style: italic;
}

/* Autocomplete & Filter Box */
.drawer-filter-box {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--hairline);
  background: var(--surface);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer-search-wrap input[type=search] {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
}
.drawer-search-wrap input[type=search]:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
  background: #fff;
}

.drawer-filter-row {
  display: flex;
  gap: 6px;
}
.drawer-filter-row select {
  flex: 1;
  font-size: 11.5px;
  padding: 4px 6px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 5px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.drawer-filter-row select:focus {
  border-color: var(--brand-teal);
}

.drawer-count-hint {
  font-size: 11px;
  color: var(--ink-muted);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

/* Project List Rows */
.drawer-proj-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--surface);
}

.drawer-prow {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 8px 9px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid transparent;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
  transition: all 0.12s ease;
}
.drawer-prow:hover, .drawer-prow.hovered {
  background: rgba(34, 181, 115, 0.08);
  border-color: var(--hairline);
}
.drawer-prow.active-project {
  background: rgba(34, 181, 115, 0.14);
  border-color: var(--brand-teal);
}

.drawer-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
  border: 1px solid var(--ring);
}

.drawer-pbody {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.drawer-phead {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  line-height: 1.3;
}
.drawer-pid {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-deep);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.drawer-road {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.sz-chip {
  font-size: 9.5px;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}

.tar-chip {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.tar-chip.high {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
}
.tar-chip.medium {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fcd34d;
}
.tar-chip.low {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}
.tar-chip.cleared {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
  font-weight: 750;
}

.drawer-pmeta {
  font-size: 11px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-pwindow {
  font-size: 10.5px;
  color: var(--brand-deep);
  font-style: normal;
}

.drawer-dataset-bar {
  width: 100%;
  margin-bottom: 8px;
}
.drawer-dataset-select {
  width: 100%;
  box-sizing: border-box;
  font-size: 11.5px;
  font-weight: 650;
  padding: 6px 8px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  outline: none;
}
.drawer-dataset-select:focus {
  border-color: var(--brand-teal);
  outline: 2px solid var(--brand-teal);
  outline-offset: -1px;
}

.drawer-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.drawer-action-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 10px;
  font-size: 11.5px;
  font-weight: 650;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.drawer-action-btn.btn-proj-action {
  background: rgba(34, 181, 115, 0.12);
  color: var(--brand-deep);
  border-color: rgba(34, 181, 115, 0.35);
}
.drawer-action-btn.btn-proj-action:hover {
  background: var(--brand-teal);
  color: #fff;
  border-color: var(--brand-teal);
}
.drawer-action-btn.btn-nogo-action {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  box-shadow: 0 1px 4px rgba(220, 38, 38, 0.25);
}
.drawer-action-btn.btn-nogo-action:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.quick-pill-btn.quick-pill-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}
.quick-pill-btn.quick-pill-danger:hover {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.portfolio-chip {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.02em;
}
.portfolio-chip.pavements { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.portfolio-chip.its { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.portfolio-chip.structures, .portfolio-chip.structures---corridors { background: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.portfolio-chip.special-projects, .portfolio-chip.special { background: #f3e8ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.portfolio-chip.maintenance { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.portfolio-chip.weeds { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.portfolio-chip.general { background: #f1f5f9; color: var(--ink-2); border: 1px solid var(--hairline); }

.status-chip {
  font-size: 9px;
  font-weight: 650;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--plane);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
}
.status-chip.status-approved, .status-chip.status-active { background: #dcfce7; color: #15803d; border-color: #86efac; }
.status-chip.status-in-delivery { background: #e0f2fe; color: #0369a1; border-color: #bae6fd; }
.status-chip.status-stage-1---scoping, .status-chip.status-scoping { background: #fef3c7; color: #b45309; border-color: #fcd34d; }

.extent-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
}
.extent-chip.surveyed { background: #22B573; color: #fff; }
.extent-chip.derived { background: #f1f5f9; color: #64748b; border: 1px solid #cbd5e1; }
.extent-chip.unmapped { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }

.sp-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--brand-deep);
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
}
.sp-link-btn:hover {
  background: var(--brand-deep);
  color: #fff;
  border-color: var(--brand-deep);
}

/* Core Test Status in Popups */
.core-test-status-box {
  padding: 8px 10px;
  border-radius: 5px;
  margin: 8px 0;
  font-size: 11.5px;
  line-height: 1.45;
}
.core-test-status-box.cleared {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #15803d;
}
.core-test-status-box.hazardous {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
}
.core-test-status-box.pending {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #b45309;
}

/* Depth-Limiting Encapsulation Optimization Box */
.encapsulation-advisory {
  background: #eff6ff;
  border: 1px dashed #93c5fd;
  border-radius: 6px;
  padding: 9px 12px;
  margin: 8px 0;
  font-size: 11.5px;
  line-height: 1.45;
}
.encapsulation-advisory.active {
  background: #dcfce7;
  border: 1px solid #86efac;
}
.encaps-title {
  color: #1d4ed8;
  font-weight: 700;
  margin-bottom: 3px;
}
.encapsulation-advisory.active .encaps-title {
  color: #15803d;
}
.encaps-desc {
  color: var(--ink-2);
  font-size: 11px;
  margin-bottom: 6px;
}
.btn-encaps {
  background: var(--surface) !important;
  color: #1d4ed8 !important;
  border: 1px solid #93c5fd !important;
  font-weight: 600;
}
.btn-encaps:hover {
  background: #1d4ed8 !important;
  color: #fff !important;
}

@media (max-width: 820px) {
  #view-map.view.active {
    flex-direction: column !important;
  }
  .corridor-panel {
    width: 100%;
    max-height: 48%;
    border-right: none;
    border-bottom: 1px solid var(--hairline);
  }
  .corridor-panel.collapsed {
    margin-left: 0;
    margin-top: -48%;
    height: 0;
  }
  .map-quick-toolbar {
    top: 8px;
    right: 8px;
  }
  .leaflet-top.leaflet-right {
    top: 52px !important;
    right: 8px !important;
  }
}

/* Document Viewer Modal & Tabs */
.doc-tabs-bar {
  display: flex;
  gap: 6px;
}
.doc-tab-btn {
  padding: 6px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 4px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.doc-tab-btn:hover {
  background: var(--plane-hover);
  color: var(--ink);
}
.doc-tab-btn.active {
  background: linear-gradient(97deg, var(--brand-green), var(--brand-teal));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
#doc-viewer-content h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 2px solid var(--hairline);
  padding-bottom: 6px;
  margin-top: 0;
  margin-bottom: 12px;
}
#doc-viewer-content h2 {
  font-size: 1.1rem;
  font-weight: 650;
  color: var(--brand-deep);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 4px;
  margin-top: 18px;
  margin-bottom: 10px;
}
#doc-viewer-content h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 14px;
  margin-bottom: 8px;
}
#doc-viewer-content pre, #doc-viewer-content code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--plane);
  color: var(--ink);
  border-radius: 4px;
  padding: 2px 5px;
}
#doc-viewer-content pre {
  padding: 10px;
  overflow-x: auto;
  border: 1px solid var(--hairline);
}
#doc-viewer-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12px;
  border: 1px solid var(--hairline);
}
#doc-viewer-content th, #doc-viewer-content td {
  padding: 7px 10px;
  border: 1px solid var(--hairline);
  text-align: left;
}
#doc-viewer-content th {
  background: var(--plane);
  font-weight: 650;
  color: var(--ink);
  border-bottom: 2px solid var(--brand-teal);
}
#doc-viewer-content tr:nth-child(even) {
  background: var(--surface-card);
}
#doc-viewer-content blockquote {
  border-left: 3px solid var(--brand-teal);
  background: var(--plane);
  margin: 10px 0;
  padding: 8px 12px;
  color: var(--ink-2);
  border-radius: 0 4px 4px 0;
}

/* ── Interactive Polygon Drawing Banner & Spatial Management ── */
.draw-poly-banner {
  position: absolute;
  top: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 8px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  pointer-events: auto !important;
}
.draw-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.draw-banner-icon {
  font-size: 15px;
}
.draw-banner-text {
  letter-spacing: -0.01em;
}
.btn-draw-act {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s ease;
}
.btn-draw-done {
  background: var(--cs-teal);
  color: #fff;
}
.btn-draw-done:hover {
  filter: brightness(1.1);
}
.btn-draw-esc {
  background: rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.btn-draw-esc:hover {
  background: rgba(255, 255, 255, 0.28);
}
.btn-micro.btn-highlight {
  background: rgba(34, 181, 115, 0.12);
  border-color: rgba(34, 181, 115, 0.4);
  color: #059669;
  font-weight: 600;
}
.btn-micro.btn-highlight:hover {
  background: rgba(34, 181, 115, 0.2);
  border-color: #059669;
}
.badge-geom-active {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1px solid #bbf7d0 !important;
}
.badge-geom-none {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

/* While drawing polygons, prevent existing vector and marker overlays from intercepting clicks */
.map-drawing-active .leaflet-overlay-pane,
.map-drawing-active .leaflet-marker-pane,
.map-drawing-active .leaflet-popup-pane,
.map-drawing-active .leaflet-interactive,
.map-drawing-active svg,
.map-drawing-active svg * {
  pointer-events: none !important;
}

/* ═══════════════════════════════════════════════════════════════
   Mobile Field Observation Record Interface
   ═══════════════════════════════════════════════════════════════ */

/* Top Navigation Bar Field Button */
.nav-btn-field {
  background: rgba(0, 184, 156, 0.12) !important;
  color: var(--cs-teal) !important;
  border: 1px solid rgba(0, 184, 156, 0.35) !important;
  font-weight: 600 !important;
  border-radius: 6px !important;
  text-decoration: none !important;
  transition: all 0.2s ease !important;
}
.nav-btn-field:hover {
  background: rgba(0, 184, 156, 0.22) !important;
  border-color: var(--cs-teal) !important;
}

/* Floating Action Button (FAB) for Mobile & Field Patrol */
.fab-field-capture {
  position: absolute;
  bottom: 104px;
  right: 12px;
  z-index: 850;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px;
  border-radius: 21px;
  background: linear-gradient(135deg, #00B89C 0%, #009680 100%);
  color: #ffffff;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 184, 156, 0.4), 0 1px 4px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: right 0.25s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.fab-field-capture:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 184, 156, 0.5), 0 2px 6px rgba(0, 0, 0, 0.2);
  filter: brightness(1.06);
}
.fab-field-capture:active {
  transform: translateY(1px) scale(0.97);
}

/* Quick Record Modal Card */
.qr-modal-card {
  max-width: 640px !important;
  width: 95% !important;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.qr-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--hairline);
  background: var(--plane);
}
.qr-header-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qr-header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.015em;
}
.qr-badge-live { display: none; }
.qr-header-sub { display: none; }

/* GNSS Telemetry & Satellite Accuracy Pill */
.qr-gnss-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono, monospace);
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  border: 1px solid var(--hairline);
  transition: all 0.2s ease;
}
.qr-gnss-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
}
.qr-gnss-pill.high {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
}
.qr-gnss-pill.high .qr-gnss-dot {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: pulse-green 2s infinite;
}
.qr-gnss-pill.medium {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}
.qr-gnss-pill.medium .qr-gnss-dot {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}
.qr-gnss-pill.low {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}
.qr-gnss-pill.low .qr-gnss-dot {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  animation: pulse-red 1.2s infinite;
}
@keyframes pulse-green {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
@keyframes pulse-red {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* 1-Touch Feature Templates / Quick Presets */
.qr-presets-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(0, 184, 156, 0.04);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(0, 184, 156, 0.15);
}
.qr-presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.qr-presets-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #00B89C;
}
.qr-presets-sub {
  font-size: 10px;
  color: var(--muted);
}
.qr-presets-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 3px;
  -webkit-overflow-scrolling: touch;
}
.qr-presets-bar::-webkit-scrollbar {
  height: 4px;
}
.qr-presets-bar::-webkit-scrollbar-thumb {
  background: var(--hairline);
  border-radius: 2px;
}
.qr-preset-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.qr-preset-chip:hover {
  border-color: #00B89C;
  background: rgba(0, 184, 156, 0.08);
  transform: translateY(-1px);
}
.qr-preset-chip.active {
  background: #00B89C;
  color: #ffffff;
  border-color: #00B89C;
  box-shadow: 0 2px 8px rgba(0, 184, 156, 0.35);
}
.qr-preset-chip svg {
  flex-shrink: 0;
}

.qr-modal-body {
  padding: 18px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Section styling */
.qr-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qr-section-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}
.qr-step-num { display: none; }
.qr-section-header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* 1. Category Selection — Compact Chip Strip */
.qr-category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
}
.qr-cat-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1.5px solid var(--hairline);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--ink-2);
  font: 500 12.5px/1.2 var(--font);
  -webkit-tap-highlight-color: transparent;
}
.qr-cat-card:hover {
  border-color: var(--cat-color, var(--brand-teal));
  color: var(--ink);
}
.qr-cat-card.active {
  border-color: var(--cat-color, var(--brand-teal));
  background: color-mix(in srgb, var(--cat-color, var(--brand-teal)) 8%, var(--surface));
  color: var(--ink);
  font-weight: 600;
}
.qr-cat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  flex-shrink: 0;
}
.qr-cat-icon svg {
  width: 15px;
  height: 15px;
}
.qr-cat-card.active .qr-cat-icon {
  transform: none;
}
.qr-cat-text {
  display: flex;
  align-items: center;
}
.qr-cat-title {
  font-size: inherit;
  font-weight: inherit;
  line-height: 1.2;
}
.qr-cat-sub { display: none; }
.qr-cat-desc {
  width: 100%;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin: 6px 0 0;
  min-height: 16px;
  line-height: 1.35;
}
.qr-cat-check { display: none; }

/* Pills & Badges */
.qr-cat-pill { display: none; }
.qr-coord-pill {
  font-size: 11px;
  font-family: monospace;
  color: var(--ink-muted);
  background: var(--plane);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--hairline);
}

/* Manage Types Modal — Reusable Classes */
.cfg-tab-btn {
  padding: 6px 14px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: var(--plane);
  color: var(--ink);
  font: 600 11.5px/1.2 var(--font);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cfg-tab-btn.tab-active {
  background: var(--brand-deep);
  color: #fff;
  border-color: var(--brand-deep);
}
.cfg-tab-btn:hover:not(.tab-active) {
  background: var(--surface);
  border-color: var(--brand-deep);
  color: var(--brand-deep);
}
.cfg-section-heading {
  font-size: 12.5px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--ink);
}
.cfg-form-card {
  background: var(--plane);
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--hairline);
}
.cfg-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.cfg-td {
  padding: 8px 10px;
}

/* Form Groups & Inputs */
.qr-form-row {
  display: flex;
  gap: 10px;
}
.qr-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.qr-flex-1 { flex: 1; }
.qr-flex-2 { flex: 2; }
.qr-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
}
.qr-input, .qr-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--ink);
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  outline: none;
  transition: border-color 0.15s ease;
}
.qr-input:focus, .qr-textarea:focus {
  border-color: var(--cs-teal);
  background: var(--surface);
}
.qr-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.45;
}

/* Quick Chips */
.qr-chips-wrapper {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}
.qr-chips-title {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-muted);
}
.qr-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.qr-chip {
  background: var(--plane);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.qr-chip:hover {
  background: rgba(0, 184, 156, 0.08);
  border-color: rgba(0, 184, 156, 0.4);
  color: var(--cs-teal);
}
.qr-chip:active {
  transform: scale(0.96);
}

/* Severity Buttons */
.qr-sev-group {
  display: flex;
  gap: 8px;
}
.qr-sev-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qr-sev-btn:hover {
  background: var(--surface);
}
.qr-sev-btn.active {
  background: var(--surface);
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.qr-sev-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.sev-routine { background: #0284c7; }
.sev-monitor { background: #d97706; }
.sev-urgent { background: #e11d48; }

/* GPS & Location Actions */
.qr-location-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.qr-btn-gps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.1);
  border: 1px solid rgba(2, 132, 199, 0.35);
  color: #0284c7;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qr-btn-gps:hover {
  background: rgba(2, 132, 199, 0.18);
  border-color: #0284c7;
}
.qr-gps-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 9px;
  border-radius: 5px;
}
.qr-gps-badge.acquiring {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.qr-gps-badge.success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border: 1px solid rgba(16, 185, 129, 0.35);
}
.qr-gps-badge.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.qr-gps-badge.error {
  background: rgba(225, 29, 72, 0.12);
  color: #e11d48;
  border: 1px solid rgba(225, 29, 72, 0.35);
}
.qr-snap-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 5px;
  margin-top: 4px;
}
.qr-gps-warning {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.qr-lrs-offset-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  background: rgba(14, 165, 233, 0.1);
  color: #0284c7;
  border: 1px solid rgba(14, 165, 233, 0.25);
  margin-top: 4px;
}
.qr-counter-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--hairline);
  color: var(--ink-muted);
}
.qr-exif-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #059669;
  font-size: 11.5px;
  margin-bottom: 8px;
}
.qr-exif-info {
  display: flex;
  align-items: center;
  gap: 6px;
}
.qr-btn-snap-exif {
  background: #10b981;
  color: #ffffff;
  border: none;
  font-weight: 600;
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
}
.qr-btn-snap-exif:hover {
  background: #059669;
}
.qr-photo-carousel {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 0 4px;
  -webkit-overflow-scrolling: touch;
}
.qr-thumb-card {
  position: relative;
  flex: 0 0 92px;
  height: 92px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--hairline);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  background: var(--plane);
}
.qr-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.qr-thumb-card:hover .qr-thumb-img {
  transform: scale(1.05);
}
.qr-thumb-delete {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
  border: none;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  transition: background 0.15s;
}
.qr-thumb-delete:hover {
  background: #ef4444;
}
.qr-thumb-badge {
  position: absolute;
  bottom: 3px;
  left: 3px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.7);
  color: #ffffff;
}
.qr-map-hint {
  font-size: 10.5px;
  color: var(--ink-muted);
  text-align: center;
  margin-top: -4px;
}

/* Pulse pin for mini map */
.qr-pin-pulse {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 184, 156, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: qrPulse 1.8s infinite;
}
.qr-pin-core {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #00B89C;
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
@keyframes qrPulse {
  0% { transform: scale(0.9); opacity: 0.9; }
  70% { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(0.9); opacity: 0; }
}

/* 4. Photo Capture Card */
.qr-camera-trigger-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--plane);
  border: 2px dashed rgba(0, 184, 156, 0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}
.qr-camera-trigger-card:hover {
  background: rgba(0, 184, 156, 0.05);
  border-color: var(--cs-teal);
}
.qr-cam-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(0, 184, 156, 0.15);
  color: var(--cs-teal);
}
.qr-cam-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.qr-cam-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.qr-cam-sub {
  font-size: 11px;
  color: var(--ink-muted);
}
.qr-photo-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 8px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 8px;
}
.qr-preview-img {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.qr-photo-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.qr-photo-badge {
  font-size: 11px;
  font-family: monospace;
  color: var(--ink-muted);
}
.qr-btn-remove-photo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  padding: 4px 8px;
  font-size: 11px;
  color: #e11d48;
  background: rgba(225, 29, 72, 0.08);
  border: 1px solid rgba(225, 29, 72, 0.25);
  border-radius: 4px;
  cursor: pointer;
}
.qr-btn-remove-photo:hover {
  background: rgba(225, 29, 72, 0.18);
}
.qr-photo-loading {
  font-size: 11.5px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 0;
}

/* Modal Footer Actions */
.qr-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
  background: var(--plane);
}
.qr-btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 22px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.qr-btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.qr-btn-cancel {
  padding: 8px 16px;
  font-size: 12.5px;
  border-radius: 6px;
}

/* Spinner helper */
.qr-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: qrSpin 0.75s linear infinite;
}
@keyframes qrSpin {
  to { transform: rotate(360deg); }
}

/* Lightbox Viewer */
.qr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.qr-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
}
.qr-lightbox-content {
  position: relative;
  z-index: 2;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
#qr-lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.qr-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #ffffff;
  color: #000000;
  border: none;
  font-size: 20px;
  line-height: 1;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Map popup photo thumbnail */
.popup-photo-thumb {
  transition: transform 0.15s ease, filter 0.15s ease;
}
.popup-photo-thumb:hover {
  transform: scale(1.02);
  filter: brightness(1.05);
}

/* Mobile Bottom Sheet Drawer Handle & Reticle Overlay */
.qr-drawer-handle-bar {
  display: none;
}
.qr-map-reticle {
  position: fixed;
  top: 36%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 99995;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.qr-reticle-circle {
  width: 44px;
  height: 44px;
  border: 2px solid #00B89C;
  border-radius: 50%;
  box-shadow: 0 0 16px rgba(0, 184, 156, 0.75);
  position: relative;
  background: rgba(0, 184, 156, 0.08);
}
.qr-reticle-cross {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
}
.qr-reticle-cross::before, .qr-reticle-cross::after {
  content: '';
  position: absolute;
  background: #00B89C;
}
.qr-reticle-cross::before {
  top: 27px;
  left: 0;
  width: 56px;
  height: 2px;
}
.qr-reticle-cross::after {
  top: 0;
  left: 27px;
  width: 2px;
  height: 56px;
}
.qr-reticle-set-btn {
  pointer-events: auto;
  margin-top: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 999px;
  background: #00B89C;
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  border: 2px solid #ffffff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.qr-reticle-set-btn:hover {
  background: #009b83;
}
.qr-reticle-set-btn:active {
  transform: scale(0.96);
}

/* Mobile Responsive Adjustments (< 768px) */
@media (max-width: 768px) {
  .qr-drawer-handle-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px 6px;
    background: var(--plane);
    border-bottom: 1px solid var(--hairline);
    cursor: grab;
    touch-action: pan-y;
  }
  .qr-drawer-handle {
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: var(--muted);
    opacity: 0.55;
    margin-bottom: 6px;
  }
  .qr-drawer-stage-toggles {
    display: flex;
    gap: 5px;
    width: 100%;
    max-width: 340px;
    justify-content: center;
  }
  .qr-stage-btn {
    flex: 1;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 5px;
    background: transparent;
    color: var(--muted);
    border: 1px solid transparent;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s ease;
  }
  .qr-stage-btn.active {
    background: var(--surface);
    color: var(--ink);
    border-color: var(--hairline);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }

  .qr-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
    transition: height 0.26s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Bottom Sheet Stages */
  #modal-quick-record.stage-peek .qr-modal-card {
    height: 175px !important;
    max-height: 175px !important;
  }
  #modal-quick-record.stage-peek .qr-modal-body {
    overflow: hidden;
    padding: 8px 14px;
  }
  #modal-quick-record.stage-peek .qr-modal-body > *:not(.qr-presets-section) {
    display: none;
  }
  #modal-quick-record.stage-peek .qr-modal-footer {
    display: none;
  }
  #modal-quick-record.stage-peek .modal-backdrop {
    background: rgba(0, 0, 0, 0.05) !important;
    pointer-events: none;
  }

  #modal-quick-record.stage-half .qr-modal-card {
    height: 58vh !important;
    max-height: 58vh !important;
  }
  #modal-quick-record.stage-half .modal-backdrop {
    background: rgba(0, 0, 0, 0.25) !important;
  }

  #modal-quick-record.stage-full .qr-modal-card {
    height: 94vh !important;
    max-height: 94vh !important;
  }
  #modal-quick-record.stage-full .modal-backdrop {
    background: rgba(0, 0, 0, 0.5) !important;
  }

  .qr-category-grid {
    gap: 5px;
  }
  .qr-modal-body {
    padding: 14px 16px;
    gap: 14px;
  }
  .fab-field-capture {
    bottom: 104px;
    right: 12px;
    height: 40px;
    padding: 0 14px;
  }
  #btn-excel-sync span {
    display: none;
  }
  #btn-excel-sync {
    padding: 0 7px;
    height: 28px;
  }
  .nav-btn-field span {
    display: none;
  }
}

/* ==========================================================================
   Map Quick Toolbar & Live Geolocation / Tracking Styles
   ========================================================================== */

#btn-map-locate.loading svg {
  animation: spin 1s linear infinite;
  color: #0072ce;
}

#btn-toggle-tracking.active {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #10b981 !important;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.35);
}

#btn-toggle-tracking.active svg {
  stroke: #10b981;
}

/* User Location & Heading Map Marker */
.user-location-marker {
  background: transparent;
  border: none;
}

.patrol-avatar-wrap {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-loc-halo {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 114, 206, 0.25);
  animation: radar-pulse 2s cubic-bezier(0.25, 1, 0.5, 1) infinite;
  pointer-events: none;
}

@keyframes radar-pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

.patrol-avatar-heading {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 22px solid rgba(0, 114, 206, 0.55);
  top: -12px;
  left: 9px;
  transform-origin: 9px 30px;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(0, 114, 206, 0.5));
}

.patrol-avatar-core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0072ce;
  border: 3px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
  position: relative;
}

/* Floating Patrol HUD */
.patrol-hud {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 14px;
  padding: 12px 16px;
  color: #f8fafc;
  box-shadow: 0 16px 36px -6px rgba(0, 0, 0, 0.45);
  min-width: 320px;
  max-width: calc(100vw - 32px);
  animation: hud-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

@keyframes hud-slide-up {
  from { opacity: 0; transform: translate(-50%, 20px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.patrol-hud-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.patrol-hud-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.patrol-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: blink 1.2s infinite ease-in-out;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.patrol-hud-accuracy {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 7px;
  border-radius: 999px;
  font-family: monospace;
}

.patrol-hud-location {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 6px 10px;
  border-radius: 8px;
}

.patrol-hud-loc-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patrol-hud-loc-text strong {
  color: #38bdf8;
}

.patrol-hud-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.patrol-stat-box {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  padding: 6px 8px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.patrol-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  font-family: monospace;
}

.patrol-stat-lbl {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.patrol-hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.patrol-hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  flex: 1;
}

.patrol-hud-btn.primary {
  background: #0072ce;
  color: #ffffff;
  border-color: #0072ce;
  flex: 1.4;
}

.patrol-hud-btn.primary:hover {
  background: #005ea6;
}

.patrol-hud-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
}

.patrol-hud-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.patrol-hud-btn.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.4);
  padding: 6px 10px;
  flex: 0 0 auto;
}

.patrol-hud-btn.danger:hover {
  background: rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   Category Manager Modal Styles
   ========================================================================== */

.qr-btn-manage {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--plane);
  color: var(--ink-2);
  border: 1px solid var(--hairline);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.qr-btn-manage:hover {
  background: var(--surface-2);
  color: var(--brand-deep);
  border-color: var(--brand-deep);
}

.cat-mgr-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cat-mgr-desc {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
  line-height: 1.4;
}

.cat-mgr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.cat-mgr-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--plane);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  transition: all 0.15s ease;
}

.cat-mgr-item:hover {
  border-color: var(--hairline-strong);
  background: var(--surface-2);
}

.cat-mgr-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cat-mgr-icon-badge {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  flex-shrink: 0;
}

.cat-mgr-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cat-mgr-title {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-mgr-sub {
  font-size: 11px;
  color: var(--ink-muted);
}

.cat-mgr-chips-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.cat-mgr-chip {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
}

.cat-mgr-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-mgr-btn {
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink-2);
  transition: all 0.15s ease;
}

.cat-mgr-btn:hover {
  background: var(--plane);
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.cat-mgr-btn.danger {
  color: #ef4444;
}

.cat-mgr-btn.danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* Category Editor Form */
.cat-editor-card {
  background: var(--plane);
  border: 1px solid var(--hairline-strong);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.2s ease;
}

.cat-editor-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hairline);
}

.cat-icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cat-icon-opt {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid var(--hairline);
  background: var(--surface);
  color: var(--ink-2);
  transition: all 0.15s ease;
}

.cat-icon-opt:hover {
  border-color: var(--brand-deep);
  color: var(--brand-deep);
}

.cat-icon-opt.active {
  border-color: var(--brand-deep);
  background: rgba(0, 114, 206, 0.1);
  color: var(--brand-deep);
}

.cat-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.cat-color-opt {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.15s ease;
}

.cat-color-opt:hover {
  transform: scale(1.15);
}

.cat-color-opt.active {
  border-color: #ffffff;
  box-shadow: 0 0 0 2px var(--brand-deep);
}

@media (max-width: 768px) {
  .patrol-hud {
    bottom: 16px;
    min-width: calc(100vw - 24px);
    padding: 10px 12px;
  }
  .patrol-hud-stats {
    gap: 6px;
  }
  .patrol-hud-actions {
    flex-wrap: wrap;
  }
}

