/* ============================================================
   GeoPatrimonio — Main Stylesheet
   ============================================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --sidebar-width: 280px;
  --sidebar-bg: #1a1f2e;
  --sidebar-bg-light: #232a3d;
  --sidebar-border: #2d3550;
  --sidebar-text: #c8cdd8;
  --sidebar-text-bright: #eef0f4;
  --sidebar-accent: #4f8cff;
  --sidebar-accent-hover: #6ea0ff;
  --table-height: 280px;
  --table-min-height: 200px;
  --header-height: 0px;
  --transition-speed: 0.25s;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.12);
  --shadow-md: 0 4px 12px rgba(0,0,0,.15);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.2);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  font-size: 13px;
  color: #333;
  background: #f0f2f5;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  outline: none;
}

input, select {
  font-family: inherit;
  font-size: inherit;
}

ul { list-style: none; }
a { text-decoration: none; color: inherit; }

/* ---------- Layout ---------- */
body {
  display: flex;
  height: 100vh;
}

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: margin-left var(--transition-speed) ease, width var(--transition-speed) ease;
  position: relative;
  box-shadow: 2px 0 10px rgba(0,0,0,.2);
}

.sidebar.collapsed {
  margin-left: calc(-1 * var(--sidebar-width));
}

/* Sidebar open button — visible only when sidebar is collapsed */
.sidebar-open-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1100;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border: 1px solid var(--sidebar-bg-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 16px;
  cursor: pointer;
  display: none;
  transition: background .15s, opacity .2s;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
.sidebar-open-btn:hover {
  background: var(--sidebar-bg-light);
  color: #fff;
}
.sidebar.collapsed ~ .sidebar-open-btn,
body:has(.sidebar.collapsed) .sidebar-open-btn {
  display: block;
}

/* Layer hint text */
.layer-hint {
  font-size: .65rem;
  color: var(--sidebar-text-muted);
  margin: 2px 0 6px 22px;
  line-height: 1.3;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* Header */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.sidebar-toggle {
  color: var(--sidebar-text);
  font-size: 16px;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}

.sidebar-toggle:hover {
  background: var(--sidebar-bg-light);
  color: #fff;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .3px;
}

.brand-subtitle {
  font-size: 10px;
  color: var(--sidebar-accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Search */
.sidebar-search {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}

.search-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  background: var(--sidebar-bg-light);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.search-tab {
  flex: 1;
  padding: 5px 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--sidebar-text);
  border-radius: 3px;
  transition: all .15s;
  text-align: center;
}

.search-tab.active {
  background: var(--sidebar-accent);
  color: #fff;
}

.search-tab:hover:not(.active) {
  color: #fff;
}

.search-panel {
  display: none;
}

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

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--sidebar-bg-light);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  transition: border-color .15s;
}

.search-input-wrap:focus-within {
  border-color: var(--sidebar-accent);
}

.search-input-wrap i {
  color: #555d72;
  font-size: 12px;
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px 0;
  outline: none;
  font-size: 12px;
}

.search-input-wrap input::placeholder {
  color: #555d72;
}

/* Catasto grid */
.catasto-grid {
  display: grid !important;
  grid-template-columns: 1fr 60px 60px 34px;
  gap: 4px;
  padding: 4px !important;
}

.catasto-grid input {
  padding: 7px 6px;
  font-size: 11px;
  border-radius: 3px;
}

.btn-catasto-search {
  background: var(--sidebar-accent);
  color: #fff;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  transition: background .15s;
}

.btn-catasto-search:hover {
  background: var(--sidebar-accent-hover);
}

.search-results {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 4px;
}

.search-results li {
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
  transition: background .1s;
}

.search-results li:hover {
  background: var(--sidebar-bg-light);
  color: #fff;
}

/* Sections */
.sidebar-sections {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 20px;
}

.sidebar-section {
  border-bottom: 1px solid var(--sidebar-border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
  font-size: 12px;
  font-weight: 600;
  color: var(--sidebar-text-bright);
}

.section-header:hover {
  background: var(--sidebar-bg-light);
}

.section-icon {
  width: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--sidebar-accent);
}

.section-header span {
  flex: 1;
}

.section-arrow {
  font-size: 10px;
  transition: transform var(--transition-speed) ease;
  color: #555d72;
}

.sidebar-section.open .section-arrow {
  transform: rotate(180deg);
}

.section-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-speed) ease;
  padding: 0 14px;
}

.sidebar-section.open .section-body {
  max-height: 600px;
  padding: 4px 14px 12px;
}

/* Layer checkboxes */
.layer-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 11.5px;
  cursor: pointer;
  transition: color .15s;
  line-height: 1.3;
}

.layer-check:hover {
  color: #fff;
}

.layer-check input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  min-width: 14px;
  border: 2px solid #444c64;
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  transition: all .15s;
}

.layer-check input[type="checkbox"]:checked {
  border-color: transparent;
}

.layer-check input[type="checkbox"]:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 8px;
  color: #fff;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Dynamic color from data-color attribute */
.layer-check[data-color] input[type="checkbox"]:checked {
  background: var(--check-color, #4f8cff);
}

/* Opacity control */
.opacity-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--sidebar-border);
}

.opacity-label {
  font-size: 10px;
  color: #555d72;
  white-space: nowrap;
}

.opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: #333a50;
  outline: none;
}

.opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sidebar-accent);
  cursor: pointer;
  border: 2px solid var(--sidebar-bg);
}

.opacity-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sidebar-accent);
  cursor: pointer;
  border: 2px solid var(--sidebar-bg);
}

.opacity-value {
  font-size: 10px;
  color: #555d72;
  min-width: 28px;
  text-align: right;
}

/* Sidebar scrollbar */
.sidebar-sections::-webkit-scrollbar {
  width: 5px;
}

.sidebar-sections::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-sections::-webkit-scrollbar-thumb {
  background: #333a50;
  border-radius: 3px;
}

.sidebar-sections::-webkit-scrollbar-thumb:hover {
  background: #444c64;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}

/* ---------- MAP ---------- */
.map-container {
  flex: 1;
  min-height: 0;
}

.maplibregl-popup {
  z-index: 50;
}

.maplibregl-popup-content {
  font-family: var(--font-family);
  font-size: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-width: 320px;
  line-height: 1.5;
}

.maplibregl-popup-close-button {
  font-size: 18px;
  padding: 4px 8px;
}

/* ---------- MAP CONTROLS ---------- */
.map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
}

.map-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  background: #fff;
  color: #333;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  transition: all .15s;
}

.map-btn:hover {
  background: #f0f2f5;
  box-shadow: var(--shadow-lg);
}

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

.btn-label {
  font-size: 11px;
  font-weight: 600;
}

/* Basemap selector */
.basemap-selector {
  position: relative;
}

.basemap-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 8px 10px;
  background: #fff;
  color: #333;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  transition: all .15s;
}

.basemap-toggle:hover {
  background: #f0f2f5;
}

.basemap-options {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  gap: 6px;
  flex-wrap: wrap;
  width: 200px;
}

.basemap-options.open {
  display: flex;
}

.basemap-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background .15s;
  width: 88px;
}

.basemap-option:hover {
  background: #f0f2f5;
}

.basemap-option.active {
  background: #e0eaff;
}

.basemap-option span {
  font-size: 10px;
  font-weight: 500;
  color: #555;
}

.basemap-thumb {
  width: 80px;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  overflow: hidden;
}

.basemap-option.active .basemap-thumb {
  border-color: var(--sidebar-accent);
}

.osm-thumb {
  background: linear-gradient(135deg, #c5d8a4, #a5c882, #8fbe73);
}

.satellite-thumb {
  background: linear-gradient(135deg, #2a4a2e, #1a3320, #3a5a3e);
}

.dark-thumb {
  background: linear-gradient(135deg, #2d3436, #1e272e, #485460);
}

.hillshade-thumb {
  background: linear-gradient(135deg, #c9b99a, #a89070, #d4c4a8);
}

/* ---------- ZOOM INDICATOR ---------- */
.zoom-indicator {
  position: absolute;
  bottom: calc(var(--table-height) + 16px);
  left: 12px;
  z-index: 20;
  background: rgba(255,255,255,.92);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  box-shadow: var(--shadow-sm);
  color: #555;
  backdrop-filter: blur(4px);
}

.zoom-indicator strong {
  color: #222;
}

/* ---------- COORDINATES ---------- */
.coords-display {
  position: absolute;
  bottom: calc(var(--table-height) + 16px);
  right: 12px;
  z-index: 20;
  background: rgba(255,255,255,.92);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  box-shadow: var(--shadow-sm);
  color: #555;
  backdrop-filter: blur(4px);
  font-variant-numeric: tabular-nums;
}

/* ---------- TABLE PANEL ---------- */
.table-resize-handle {
  height: 6px;
  cursor: ns-resize;
  background: #e0e3e8;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s;
}

.table-resize-handle:hover {
  background: #cdd1d8;
}

.resize-grip {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  background: #aab0bb;
}

.table-panel {
  height: var(--table-height);
  min-height: var(--table-min-height);
  background: #fff;
  display: flex;
  flex-direction: column;
  border-top: 1px solid #dde0e6;
  flex-shrink: 0;
}

.table-panel.collapsed {
  height: 40px !important;
  min-height: 40px !important;
}

.table-panel.collapsed .table-body,
.table-panel.collapsed .table-footer {
  display: none;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f8f9fb;
  border-bottom: 1px solid #e8ebf0;
  flex-shrink: 0;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 12px;
  color: #444;
}

.table-title i {
  color: var(--sidebar-accent);
}

.table-count {
  font-weight: 400;
  color: #888;
  font-size: 11px;
}

.table-actions {
  display: flex;
  gap: 4px;
}

.table-btn {
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: #666;
  font-size: 12px;
  transition: all .15s;
}

.table-btn:hover {
  background: #e8ebf0;
  color: #333;
}

.table-body {
  flex: 1;
  overflow: auto;
}

#data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

#data-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

.table-filter-row th {
  background: #f0f2f5;
  padding: 3px 4px;
  border-bottom: 1px solid #e0e3e8;
}

.table-filter-row input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #dde0e6;
  border-radius: 3px;
  font-size: 10px;
  background: #fff;
  outline: none;
  transition: border-color .15s;
}

.table-filter-row input:focus {
  border-color: var(--sidebar-accent);
}

.table-sort-row th {
  background: #f8f9fb;
  padding: 7px 8px;
  border-bottom: 2px solid #dde0e6;
  font-weight: 600;
  color: #555;
  font-size: 11px;
  text-align: left;
  white-space: nowrap;
}

.table-sort-row th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}

.table-sort-row th.sortable:hover {
  background: #eef0f4;
}

.table-sort-row th.sort-asc i::before { content: '\f0de'; }
.table-sort-row th.sort-desc i::before { content: '\f0dd'; }

.table-sort-row th i {
  margin-left: 4px;
  color: #bbb;
  font-size: 10px;
}

#data-table tbody tr {
  transition: background .1s;
  cursor: pointer;
}

#data-table tbody tr:hover {
  background: #f0f5ff;
}

#data-table tbody tr.selected {
  background: #e0eaff;
}

#data-table tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid #f0f2f5;
  color: #444;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

#data-table tbody td:last-child {
  white-space: nowrap;
}

.row-action-btn {
  padding: 3px 6px;
  border-radius: 3px;
  font-size: 11px;
  color: #666;
  transition: all .1s;
  margin-right: 2px;
}

.row-action-btn:hover {
  background: #e8ebf0;
  color: var(--sidebar-accent);
}

/* Table footer / Pagination */
.table-footer {
  padding: 6px 14px;
  border-top: 1px solid #e8ebf0;
  background: #f8f9fb;
  flex-shrink: 0;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
}

.page-btn {
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: #666;
  font-size: 12px;
  transition: all .15s;
  border: 1px solid #dde0e6;
  background: #fff;
}

.page-btn:hover:not(:disabled) {
  background: #e8ebf0;
  color: #333;
}

.page-btn:disabled {
  opacity: .4;
  cursor: default;
}

.page-info {
  font-size: 11px;
  color: #777;
  padding: 0 8px;
}

.page-size {
  margin-left: 10px;
  padding: 3px 6px;
  border: 1px solid #dde0e6;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #555;
  background: #fff;
  outline: none;
}

/* ---------- DETAIL PANEL ---------- */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 380px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,.15);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-speed) ease;
}

.detail-panel.open {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #e8ebf0;
  flex-shrink: 0;
}

.detail-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.detail-close {
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: #888;
  font-size: 14px;
  transition: all .15s;
}

.detail-close:hover {
  background: #f0f2f5;
  color: #333;
}

.detail-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #999;
  margin-bottom: 8px;
}

.detail-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md);
  background: #f0f2f5;
  margin-bottom: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-field-label {
  font-size: 10px;
  color: #999;
  font-weight: 500;
}

.detail-field-value {
  font-size: 12px;
  color: #333;
  font-weight: 500;
}

.detail-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e8ebf0;
}

.detail-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  transition: opacity .15s;
}

.detail-action-btn:hover {
  opacity: .85;
}

.detail-action-btn.btn-pdf { background: #dc3545; }
.detail-action-btn.btn-gmaps { background: #4285f4; }
.detail-action-btn.btn-gearth { background: #34a853; }
.detail-action-btn.btn-catasto { background: #ff9800; }

/* ---------- 3D OVERLAY ---------- */
.overlay-3d {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #111;
  z-index: 500;
  display: flex;
  flex-direction: column;
  transition: opacity var(--transition-speed) ease;
}

.overlay-3d.hidden {
  display: none;
}

.overlay-3d-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  z-index: 10;
}

.overlay-close {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  color: #ccc;
  font-size: 16px;
  transition: all .15s;
}

.overlay-close:hover {
  background: rgba(255,255,255,.1);
  color: #fff;
}

.container-3d {
  flex: 1;
}

/* ---------- LOADING ---------- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255,255,255,.7);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  backdrop-filter: blur(3px);
}

.loading-overlay.hidden {
  display: none;
}

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

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

.loading-overlay span {
  font-size: 13px;
  color: #666;
  font-weight: 500;
}

/* ---------- POPUP CONTENT ---------- */
.popup-title {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.popup-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 11.5px;
}

.popup-label {
  color: #888;
}

.popup-value {
  font-weight: 500;
  color: #333;
}

.popup-actions {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #eee;
  display: flex;
  gap: 6px;
}

.popup-btn {
  padding: 4px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 500;
  background: var(--sidebar-accent);
  color: #fff;
  transition: opacity .15s;
}

.popup-btn:hover {
  opacity: .85;
}

/* ---------- HIDDEN UTILITY ---------- */
.hidden {
  display: none !important;
}

/* ---------- Mobile sidebar toggle button ---------- */
.sidebar-open-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 90;
  padding: 10px 12px;
  background: var(--sidebar-bg);
  color: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 16px;
  display: none;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 260px;
    --table-height: 220px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 500;
  }

  .sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
  }

  .sidebar-open-btn {
    display: block;
  }

  .sidebar:not(.collapsed) ~ .sidebar-open-btn {
    display: none;
  }

  .detail-panel {
    width: 100%;
  }

  .basemap-options {
    width: 180px;
  }

  .map-controls {
    top: 8px;
    right: 8px;
  }
}

@media (max-width: 480px) {
  :root {
    --table-height: 180px;
  }

  .sidebar-search {
    padding: 8px 10px;
  }
}
