/* ═══════════════════════════════════════════════════════════
   FieldView – Farm Field Mapper  |  style.css
   ═══════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --bg-base:        #0f1117;
  --bg-surface:     #181c24;
  --bg-elevated:    #1e2330;
  --bg-hover:       #252b3a;
  --border:         #2a3145;
  --border-light:   #343d54;

  --text-primary:   #e8eaf0;
  --text-secondary: #8b93a8;
  --text-muted:     #545e76;

  --accent-green:   #4caf71;
  --accent-green-d: #3a9059;
  --accent-blue:    #4a8fe8;
  --accent-blue-d:  #3572cc;
  --accent-amber:   #e8a94a;

  --layer-colors: #4caf71, #4a8fe8, #e87b4a, #c44ae8, #e8e44a, #4ae8d8;

  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.6);

  --topbar-h:   52px;
  --sidebar-w:  340px;
  --transition: .18s ease;
}

/* ── Reset / Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Ensure [hidden] always wins over display rules set by component CSS */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg-base);
  color: var(--text-primary);
  overflow: hidden;
}

/* ── Top Bar ───────────────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 26px; height: 26px;
  color: var(--accent-green);
  flex-shrink: 0;
}

.brand-name {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.3px;
  color: var(--text-primary);
}

.brand-tagline {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  background: var(--bg-elevated);
  border-radius: 20px;
  border: 1px solid var(--border);
}

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

/* ── Auth area ─────────────────────────────────────────────── */
#auth-area { display: flex; align-items: center; gap: 8px; margin-left: 4px; }

#user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px 3px 4px;
}
#user-chip:not([hidden]) { display: flex; }
#user-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
#user-name {
  font-size: 13px;
  color: var(--text-primary);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Workspace modal ───────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-backdrop:not([hidden]) { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { margin: 0; font-size: 15px; }

.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}

.workspace-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.workspace-row:last-child { border-bottom: none; }

.workspace-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.workspace-name { font-size: 14px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-date { font-size: 12px; color: var(--text-muted); }

.workspace-actions { display: flex; gap: 6px; flex-shrink: 0; }

.workspace-empty { color: var(--text-muted); font-size: 13px; text-align: center; padding: 16px 0; margin: 0; }

/* ── Layer group headers ────────────────────────────────────── */
.layer-group-header {
  list-style: none;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
}
.layer-group-header:first-child { border-top: none; padding-top: 4px; }

.mb-2 { margin-bottom: 8px; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
  user-select: none;
}
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn:active { transform: scale(.97); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 7px;
}
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }
.btn-ghost svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue-d);
}
.btn-primary:hover { background: var(--accent-blue-d); box-shadow: 0 0 0 3px rgba(74,143,232,.25); }

.btn-accent {
  background: var(--accent-green);
  color: #fff;
  border-color: var(--accent-green-d);
}
.btn-accent:hover { background: var(--accent-green-d); box-shadow: 0 0 0 3px rgba(76,175,113,.25); }

.btn-danger {
  background: transparent;
  color: #e87b7b;
  border-color: transparent;
  padding: 4px 6px;
}
.btn-danger:hover { background: rgba(232,123,123,.12); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon { padding: 6px; }
.btn-icon svg { width: 14px; height: 14px; }

.btn-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
.btn-close:hover { color: var(--text-primary); background: var(--bg-hover); }

/* ── App Layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  padding-top: var(--topbar-h);
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
  transition: transform var(--transition), width var(--transition);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

.sidebar.collapsed {
  width: 0;
  transform: translateX(-100%);
}

/* ── Panels ────────────────────────────────────────────────── */
.panel {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}
.panel-header svg { width: 16px; height: 16px; color: var(--accent-green); flex-shrink: 0; }
.panel-header h2 { font-size: 13px; font-weight: 600; letter-spacing: .2px; flex: 1; }

.panel-body {
  padding: 4px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel-layers .panel-body { padding-bottom: 8px; }

/* ── Layer count badge ─────────────────────────────────────── */
.layer-count {
  background: var(--accent-green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

/* ── Drop Zone ─────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  transition: all var(--transition);
  cursor: pointer;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-green);
  background: rgba(76,175,113,.06);
}
.drop-zone.drag-over { box-shadow: 0 0 0 3px rgba(76,175,113,.2); }

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 16px;
  text-align: center;
}
.drop-zone-inner svg { width: 32px; height: 32px; color: var(--text-muted); margin-bottom: 2px; }
.drop-zone-inner p { font-size: 13px; color: var(--text-secondary); }
.drop-zone-inner span { font-size: 12px; color: var(--text-muted); }

/* ── Uploaded files list ───────────────────────────────────── */
.uploaded-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.uploaded-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: slideIn .15s ease;
}
.uploaded-file-item .file-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.uploaded-file-item .file-name {
  flex: 1;
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.uploaded-file-item .file-count {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── Form inputs ───────────────────────────────────────────── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}
.input-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.input-group input,
.input-group select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 7px 10px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
.input-group input:focus,
.input-group select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(74,143,232,.15);
}
.input-group input::placeholder { color: var(--text-muted); }

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}
.input-group select {
  appearance: none;
  padding-right: 28px;
  cursor: pointer;
}
.input-group select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
  padding: 4px 8px;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.mt-2 { margin-top: 4px; }

/* ── Status messages ───────────────────────────────────────── */
.status-msg {
  font-size: 12px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}
.status-msg.info    { background: rgba(74,143,232,.1);  border-color: rgba(74,143,232,.25); color: #8ab8ef; }
.status-msg.success { background: rgba(76,175,113,.1);  border-color: rgba(76,175,113,.25); color: #7ecf99; }
.status-msg.error   { background: rgba(232,123,123,.1); border-color: rgba(232,123,123,.25); color: #ef8a8a; }
.status-msg.loading { background: rgba(232,169,74,.1);  border-color: rgba(232,169,74,.25); color: #efc97a; }

/* ── Layer description ─────────────────────────────────────── */
.layer-description {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-blue);
  line-height: 1.5;
}

/* ── Layer List ────────────────────────────────────────────── */
.layer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 16px 12px;
}

.layer-list-empty {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px 0;
  font-style: italic;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  animation: slideIn .15s ease;
  transition: background var(--transition);
}
.layer-item:hover { background: var(--bg-hover); }

.layer-item-color {
  width: 12px; height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}

.layer-item-info {
  flex: 1;
  min-width: 0;
}
.layer-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.layer-item-actions { display: flex; gap: 2px; flex-shrink: 0; }

.btn-layer-vis {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  display: flex; align-items: center;
  transition: all var(--transition);
}
.btn-layer-vis:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn-layer-vis svg { width: 14px; height: 14px; }
.btn-layer-vis.hidden-layer { opacity: .4; }

.btn-layer-zoom {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: var(--text-muted);
  display: flex; align-items: center;
  transition: all var(--transition);
}
.btn-layer-zoom:hover { background: var(--bg-hover); color: var(--accent-blue); }
.btn-layer-zoom svg { width: 14px; height: 14px; }

/* ── Map Container ─────────────────────────────────────────── */
.map-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#map {
  width: 100%; height: 100%;
  background: #1a2030;
}

/* ── Basemap Switcher ──────────────────────────────────────── */
.basemap-switcher {
  position: absolute;
  bottom: 28px;
  right: 16px;
  z-index: 500;
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.basemap-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  border-right: 1px solid var(--border);
  transition: all var(--transition);
  font-family: inherit;
}
.basemap-btn:last-child { border-right: none; }
.basemap-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.basemap-btn.active { background: var(--accent-green); color: #fff; }

/* ── Scale Bar ─────────────────────────────────────────────── */
.scale-bar {
  position: absolute;
  bottom: 68px;
  right: 16px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  box-shadow: var(--shadow-md);
  font-size: 12px;
}

.scale-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: .5px;
}

.scale-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: color var(--transition);
}

.scale-value.scale-ok  { color: var(--accent-green); }
.scale-value.scale-far { color: var(--accent-amber); }

/* ── Zoom Hint ─────────────────────────────────────────────── */
.zoom-hint {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(232,169,74,.15);
  border: 1px solid rgba(232,169,74,.4);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-amber);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
}
.zoom-hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* ── Feature Info Panel ────────────────────────────────────── */
.feature-info-panel {
  position: absolute;
  bottom: 28px;
  left: 16px;
  z-index: 500;
  width: 280px;
  max-height: 340px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideIn .15s ease;
}

.feature-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-shrink: 0;
}

.feature-info-body {
  overflow-y: auto;
  padding: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.prop-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.prop-table tr + tr td { border-top: 1px solid var(--border); }
.prop-table td { padding: 5px 6px; vertical-align: top; }
.prop-table td:first-child {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  width: 40%;
  padding-right: 8px;
}
.prop-table td:last-child {
  color: var(--text-primary);
  word-break: break-word;
}

/* ── Label Assignment Section ──────────────────────────────── */
.label-assign-section {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#new-label-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label-assign-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

.label-name-input {
  width: 100%;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 8px;
  outline: none;
}
.label-name-input:focus { border-color: var(--accent-blue); }

.label-color-swatches {
  display: flex;
  gap: 6px;
}

.label-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: border-color var(--transition), transform var(--transition);
}
.label-swatch:hover  { transform: scale(1.15); }
.label-swatch.active { border-color: #fff; }

.btn-full { width: 100%; }

/* Dark select inside label-assign-section */
.label-assign-section select {
  width: 100%;
  appearance: none;
  background: var(--bg-base);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 6px 28px 6px 8px;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color var(--transition);
}
.label-assign-section select:focus { border-color: var(--accent-blue); }
.label-assign-section select option { background: var(--bg-elevated); color: var(--text-primary); }
.label-assign-section .select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 12px;
}

/* ── Label Save / Load row ─────────────────────────────────── */
.label-io-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.label-io-btn {
  flex: 1 1 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 12px;
  padding: 5px 8px;
}
.label-io-btn svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ── Loading Overlay ───────────────────────────────────────── */
.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15,17,23,.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 900;
  backdrop-filter: blur(4px);
  font-size: 14px;
  color: var(--text-secondary);
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  align-items: center;
}

.toast {
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toastIn .2s ease;
  pointer-events: all;
  max-width: 380px;
  text-align: center;
}
.toast-success { background: #1a3a2a; color: #7ecf99; border: 1px solid rgba(76,175,113,.3); }
.toast-error   { background: #3a1a1a; color: #ef8a8a; border: 1px solid rgba(232,123,123,.3); }
.toast-info    { background: #1a2540; color: #8ab8ef; border: 1px solid rgba(74,143,232,.3); }
.toast-warning { background: #3a2a1a; color: #efc97a; border: 1px solid rgba(232,169,74,.3); }

/* ── Report Modal ──────────────────────────────────────────── */
.report-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  z-index: 1500;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.report-backdrop:not([hidden]) { display: flex; }

.report-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 860px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.report-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.report-title svg { width: 17px; height: 17px; color: var(--accent-green); }

.report-body {
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.report-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 32px 0;
}

.report-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.report-group-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  flex-shrink: 0;
}

.report-group-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.report-group-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.report-table thead {
  background: var(--bg-elevated);
}

.report-table th {
  padding: 7px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.report-table td {
  padding: 6px 10px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  word-break: break-word;
  max-width: 240px;
}

.report-table tr:last-child td { border-bottom: none; }
.report-table tbody tr:hover { background: var(--bg-hover); }

.report-header-actions { display: flex; align-items: center; gap: 6px; }

/* ── Print / Export ────────────────────────────────────────── */
@media print {
  body > *:not(#report-backdrop) { display: none !important; }

  .report-backdrop {
    position: static !important;
    background: none !important;
    backdrop-filter: none !important;
    padding: 0 !important;
    display: block !important;
  }

  .report-modal {
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .report-header-actions { display: none !important; }

  .report-body {
    overflow: visible !important;
    padding: 0 !important;
  }

  .report-group { page-break-inside: avoid; }

  .report-table { border: 1px solid #ccc !important; }
  .report-table th { background: #f0f0f0 !important; color: #000 !important; }
  .report-table td { color: #000 !important; border-color: #ccc !important; }
  .report-group-name { color: #000 !important; }
  .report-group-count { color: #555 !important; }
}

/* ── Leaflet overrides ─────────────────────────────────────── */
/* Move zoom control to bottom-right, above the scale bar */
.leaflet-top.leaflet-left {
  top: auto !important;
  left: auto !important;
  bottom: 116px;
  right: 16px;
}
.leaflet-control-zoom {
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden;
  box-shadow: var(--shadow-md) !important;
}
.leaflet-control-zoom a {
  background: var(--bg-elevated) !important;
  color: var(--text-secondary) !important;
  border-bottom: 1px solid var(--border) !important;
  width: 30px !important;
  height: 30px !important;
  line-height: 30px !important;
  font-size: 16px !important;
}
.leaflet-control-zoom a:hover {
  background: var(--bg-hover) !important;
  color: var(--text-primary) !important;
}
.leaflet-bar { border: none !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-elevated) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
}
.leaflet-popup-tip { background: var(--bg-elevated) !important; }
.leaflet-popup-close-button {
  color: var(--text-muted) !important;
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Scrollbar global ──────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
  :root { --sidebar-w: 100vw; }
  .brand-tagline { display: none; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0; bottom: 0;
    z-index: 800;
    transform: translateX(-100%);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .map-container { width: 100vw; }
  .feature-info-panel { left: 8px; right: 8px; width: auto; bottom: 16px; }
  .basemap-switcher { bottom: 16px; right: 8px; }
}
