/* Base Styles */
html, body { 
  height: 100%; 
  margin: 0; 
  font-family: system-ui, -apple-system, sans-serif;
  cursor: default; /* Ensure default cursor */
  background: #121426 !important; /* Dark background to match app theme */
}

/* Flash animation for requirement highlighting */
@keyframes flash-red {
  0%, 100% { background-color: transparent; }
  25%, 75% { background-color: #ff6b6b; }
  50% { background-color: transparent; }
}

/* Layout Structure */
#map { 
  height: 100%; 
  background: #1a1a2e;
  cursor: grab;
  margin-left: 300px; /* Space for left sidebar */
  margin-top: 60px; /* Space for top toolbar */
}

#map:active {
  cursor: grabbing;
}

/* Left Sidebar */
.left-sidebar {
  position: fixed;
  top: 60px; /* Below toolbar */
  left: 0;
  width: 300px; /* Slightly wider for better spacing */
  height: calc(100vh - 90px); /* Extended down 30px - account for toolbar and partial status bar */
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95));
  backdrop-filter: blur(10px);
  border-right: 1px solid rgba(255,255,255,0.15);
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  color: #fff;
  overflow-x: hidden;
  overflow-y: hidden; /* Let sections handle their own scrolling */
  z-index: 1000;
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 16px 20px;
  overflow-x: hidden;
  word-wrap: break-word;
  transition: all 0.3s ease;
}

.sidebar-section.layers-section {
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex: 0 0 auto;
  min-height: 240px;
  max-height: 50vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
}

/* Integrated results panel styling */
#resultsPanel {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
  background: transparent !important;
}

/* Draggable Divider */
.sidebar-divider {
  height: 10px;
  background: rgba(255,255,255,0.08);
  cursor: row-resize;
  border-top: 1px solid rgba(255,255,255,0.15);
  border-bottom: 1px solid rgba(255,255,255,0.15);
  position: relative;
  flex: 0 0 10px;
  transition: all 0.2s ease;
}

.sidebar-divider:hover {
  background: rgba(80,227,194,0.2);
  border-color: rgba(80,227,194,0.3);
}

.sidebar-divider::after {
  content: '⋯';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  transition: color 0.2s ease;
}

.sidebar-divider:hover::after {
  color: rgba(80,227,194,0.8);
}

/* Top Toolbar - Full Width */
.toolbar { 
  position: fixed; 
  z-index: 1001; 
  top: 0; 
  left: 0; 
  right: 0; 
  height: 60px;
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95)); 
  backdrop-filter: blur(10px);
  padding: 0 16px; 
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  display: flex;
  align-items: center;
}

.row { 
  display: flex; 
  gap: 12px; 
  flex-wrap: wrap; 
  align-items: center; 
}

.btn { 
  cursor: pointer; 
  border: 1px solid rgba(255,255,255,0.2); 
  background: linear-gradient(135deg, rgba(74,144,226,0.85), rgba(80,227,194,0.85));
  color: white;
  padding: 8px 14px; 
  border-radius: 10px; 
  transition: all 0.3s ease;
  font-weight: 500;
  user-select: none;
}

.btn:hover { 
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(74,144,226,0.4);
  background: linear-gradient(135deg, rgba(74,144,226,1), rgba(80,227,194,1));
}

.btn:active {
  transform: translateY(0);
}

.btn-danger { 
  background: linear-gradient(135deg, rgba(255,82,82,0.85), rgba(255,107,107,0.85)); 
}

.btn-success { 
  background: linear-gradient(135deg, rgba(76,217,100,0.85), rgba(52,199,89,0.85)); 
}

.small { 
  font-size: 12px; 
  color: #b0b0b0; 
}

.panel { 
  background: rgba(255,255,255,0.05); 
  border: 1px solid rgba(255,255,255,0.1); 
  border-radius: 8px; 
  padding: 12px;
  backdrop-filter: blur(5px);
  color: #fff;
  margin-bottom: 12px;
}

/* Toolbar Dropdown Styles */
.toolbar-dropdown {
  position: relative;
  margin: 0 8px;
}

.dropdown-toggle {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.dropdown-toggle:hover {
  background: rgba(255,255,255,0.2);
}

.dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(26,26,46,0.98), rgba(16,16,36,0.98));
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  padding: 16px;
  margin-top: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  display: none;
  z-index: 1002;
  min-width: 250px;
}

.dropdown-content.active {
  display: block;
}

/* Enhanced sidebar input styling */
.left-sidebar input[type="text"], 
.left-sidebar input[type="date"],
.left-sidebar input[type="range"],
.left-sidebar select {
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 6px;
  padding: 6px 10px;
  color: #fff;
  transition: all 0.2s ease;
  margin-top: 4px;
}

.left-sidebar input[type="text"]:focus,
.left-sidebar input[type="date"]:focus,
.left-sidebar select:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(80,227,194,0.5);
  outline: none;
  box-shadow: 0 0 0 2px rgba(80,227,194,0.2);
}

.left-sidebar input[type="checkbox"] {
  margin-right: 8px;
  accent-color: #50e3c2;
}

.left-sidebar label {
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  display: flex;
  align-items: center;
  margin-bottom: 0;
  line-height: 1.1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.left-sidebar label:hover {
  color: rgba(255,255,255,0.9);
}

/* Section headers */
.sidebar-section .small[style*="font-weight:600"] {
  color: rgba(80,227,194,0.9);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px !important;
  margin-bottom: 8px !important;
}

/* Enhanced scrollbar styling */
.sidebar-section::-webkit-scrollbar,
#expiringList::-webkit-scrollbar {
  width: 6px;
}

.sidebar-section::-webkit-scrollbar-track,
#expiringList::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
}

.sidebar-section::-webkit-scrollbar-thumb,
#expiringList::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
  transition: background 0.2s ease;
}

.sidebar-section::-webkit-scrollbar-thumb:hover,
#expiringList::-webkit-scrollbar-thumb:hover {
  background: rgba(80,227,194,0.4);
}

/* Spacing improvements */
.sidebar-section .small {
  margin-bottom: 0;
}

.sidebar-section .small:last-child {
  margin-bottom: 0;
}

/* Progress bar styling */
#deadClipProgress {
  display: none;
  margin-left: 16px;
  margin-top: 8px;
  align-items: center;
  gap: 8px;
}

#deadClipProgress > div {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.1);
}

#deadClipProgressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #50e3c2, #4ae3c4);
  transition: width 0.3s ease;
}

/* Result items styling for better integration */
#resultList, #featureInfo, #expiringList {
  padding: 0;
  margin: 0;
}

#resultList {
  display: block !important;
  visibility: visible !important;
}

#resultList .result-item {
  margin-bottom: 2px;
  padding: 6px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  transition: all 0.2s ease;
  cursor: pointer;
}

#resultList .result-item:hover {
  background: rgba(80,227,194,0.1);
  border-color: rgba(80,227,194,0.3);
}

#resultList .result-item.selected {
  background: rgba(80,227,194,0.25) !important;
  border-color: rgba(80,227,194,0.8) !important;
  border-left: 4px solid rgba(80,227,194,1) !important;
  font-weight: 600 !important;
  color: rgba(255,255,255,1) !important;
  box-shadow: 0 2px 8px rgba(80,227,194,0.3) !important;
  transform: translateX(2px);
}

#featureInfo {
  background: rgba(80,227,194,0.03);
  border-radius: 4px;
  padding: 8px;
  margin-top: 8px;
  border: 1px solid rgba(80,227,194,0.15);
  border-left: 3px solid rgba(80,227,194,0.5);
}

#featureInfo:empty {
  display: none;
}

#expiringList .small {
  margin-bottom: 2px;
  padding: 4px 6px;
  border-radius: 3px;
  background: rgba(255,193,7,0.05);
  border: 1px solid rgba(255,193,7,0.1);
  transition: all 0.2s ease;
}

#expiringList .small:hover {
  background: rgba(255,193,7,0.1);
  border-color: rgba(255,193,7,0.3);
}

/* Diagnostic Messages */
#diag { 
  position: absolute; 
  left: 50%; 
  transform: translateX(-50%); 
  top: 70px; 
  z-index: 1001; 
  background: linear-gradient(135deg, rgba(255,193,7,0.95), rgba(255,152,0,0.95)); 
  color: #663c00; 
  border: 1px solid rgba(255,235,59,0.5); 
  padding: 8px 12px; 
  border-radius: 10px; 
  box-shadow: 0 4px 15px rgba(0,0,0,.2); 
  display: none; 
  max-width: 80%;
  backdrop-filter: blur(10px);
}

/* List Layouts */
.list { 
  display: grid; 
  grid-template-columns: repeat(3, minmax(160px, 1fr)); 
  gap: 4px 10px; 
  max-height: 220px; 
  overflow: auto; 
}

#groupList { 
  display: grid; 
  grid-template-columns: repeat(2, minmax(160px, 1fr)); 
  gap: 4px 10px; 
  max-height: 220px; 
  overflow: auto; 
}

/* Legend */
.legend { 
  position: fixed; 
  right: 16px; 
  bottom: 35px; /* Closer to status bar */
  z-index: 1000; 
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
  padding: 10px 12px; 
  border-radius: 8px 8px 0 0; /* Rounded top, flat bottom to sit on status bar */
  box-shadow: 0 6px 25px rgba(0,0,0,.3); 
  font: 12px/1.4 system-ui; 
}

.legend div { 
  margin: 3px 0; 
}

.legend .swatch { 
  display: inline-block; 
  width: 14px; 
  height: 14px; 
  margin-right: 8px; 
  border-radius: 3px; 
  border: 1px solid rgba(255,255,255,0.3); 
  vertical-align: middle; 
}

/* Results Panel - Now integrated into sidebar flow */

#resultsPanel div.result-item.small {
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#resultsPanel div.result-item.small:hover {
  background: rgba(80,227,194,0.1);
}

#resultsPanel div.result-item.selected {
  background: rgba(80,227,194,0.25) !important;
  border-left: 4px solid rgba(80,227,194,1) !important;
  font-weight: 600 !important;
  box-shadow: 0 2px 8px rgba(80,227,194,0.3) !important;
}

/* Enhanced visibility for result list when feature is selected */
#resultList {
  border: 1px solid rgba(80,227,194,0.2);
  border-radius: 4px;
  background: rgba(0,0,0,0.1);
}

#resultList:not(:empty) {
  box-shadow: 0 2px 12px rgba(80,227,194,0.1);
}

/* Statistics Panel */
#statsPanel {
  display: none;
  position: fixed;
  right: 10px;
  bottom: 150px;
  z-index: 2000;
  width: 200px;
  max-height: 240px;
  overflow-y: auto;
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(80, 227, 194, 0.4);
  border-radius: 10px;
  padding: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  color: #fff;
}

/* Form Controls */
input, select { 
  background: rgba(255,255,255,0.1); 
  border: 1px solid rgba(255,255,255,0.2); 
  color: #fff; 
  border-radius: 6px; 
  padding: 4px 8px; 
}

input:focus, select:focus { 
  outline: none; 
  border-color: rgba(80,227,194,0.8); 
  box-shadow: 0 0 10px rgba(80,227,194,0.3); 
}

/* Range Slider Styles */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  height: 20px;
}

/* Track */
input[type="range"]::-webkit-slider-track {
  background: rgba(255,255,255,0.2);
  height: 6px;
  border-radius: 3px;
  border: none;
}

input[type="range"]::-moz-range-track {
  background: rgba(255,255,255,0.2);
  height: 6px;
  border-radius: 3px;
  border: none;
}

/* Thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #50e3c2;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb {
  height: 18px;
  width: 18px;
  border-radius: 50%;
  background: #50e3c2;
  border: 2px solid rgba(255,255,255,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

/* Hover and focus states */
input[type="range"]::-webkit-slider-thumb:hover {
  background: #40d3b2;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(80,227,194,0.5);
}

input[type="range"]::-moz-range-thumb:hover {
  background: #40d3b2;
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(80,227,194,0.5);
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 15px rgba(80,227,194,0.7);
}

/* Cluster Styles */
.marker-cluster.zero { 
  display: none; 
}

/* MINDEX cluster styling - more specific selectors to override defaults */
.marker-cluster-mindex div,
.marker-cluster-mindex.marker-cluster-small div,
.marker-cluster-mindex.marker-cluster-medium div,
.marker-cluster-mindex.marker-cluster-large div { 
  background: linear-gradient(135deg, rgba(255,215,0,0.85), rgba(255,193,7,0.85)) !important; 
  color: #333 !important; 
  border: 2px solid rgba(255,255,255,.95) !important;
  box-shadow: 0 4px 15px rgba(255,215,0,0.5) !important;
  text-align: center !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 36px !important;
  margin-left: -20px !important;
  margin-top: -20px !important;
}

.marker-cluster-mindex,
.marker-cluster-mindex.marker-cluster-small,
.marker-cluster-mindex.marker-cluster-medium,
.marker-cluster-mindex.marker-cluster-large { 
  background: linear-gradient(135deg, rgba(255,215,0,0.3), rgba(255,193,7,0.3)) !important; 
}

/* Drillhole cluster styling - more specific selectors to override defaults */
.marker-cluster-drill div,
.marker-cluster-drill.marker-cluster-small div,
.marker-cluster-drill.marker-cluster-medium div,
.marker-cluster-drill.marker-cluster-large div { 
  background: linear-gradient(135deg, rgba(64,64,64,0.9), rgba(32,32,32,0.9)) !important; 
  color: #fff !important; 
  border: 2px solid rgba(255,255,255,.95) !important;
  box-shadow: 0 4px 15px rgba(0,0,0,0.6) !important;
  text-align: center !important;
  font-weight: 700 !important;
  border-radius: 50% !important;
  width: 40px !important;
  height: 40px !important;
  line-height: 36px !important;
  margin-left: -20px !important;
  margin-top: -20px !important;
}

.marker-cluster-drill,
.marker-cluster-drill.marker-cluster-small,
.marker-cluster-drill.marker-cluster-medium,
.marker-cluster-drill.marker-cluster-large { 
  background: linear-gradient(135deg, rgba(64,64,64,0.3), rgba(32,32,32,0.3)) !important; 
}

/* Ensure cluster text is properly centered and sized */
.marker-cluster-mindex span,
.marker-cluster-drill span {
  font-size: 12px !important;
  font-weight: 600 !important;
  line-height: 36px !important;
  display: block !important;
  width: 100% !important;
  text-align: center !important;
  margin: 0 !important;
  padding: 0 !important;
}

.marker-cluster.singleton { 
  display: none !important; 
}

/* Drillhole Icons */
.drill-sq { 
  width: 10px; 
  height: 10px; 
  background: linear-gradient(135deg, #000, #333); 
  border: 2px solid #fff; 
  box-sizing: border-box; 
  border-radius: 2px; 
  box-shadow: 0 2px 8px rgba(0,0,0,0.3); 
}

/* Popup Styles */
.leaflet-popup-content-wrapper { 
  max-width: 800px; 
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95));
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #fff;
}

.leaflet-popup-content { 
  width: 780px !important; 
  margin: 12px; 
}

.popup td { 
  border-top: 1px solid rgba(255,255,255,0.1); 
  padding: 4px 8px; 
  color: #eee; 
}

.popup td.key { 
  font-weight: 600; 
  color: #50e3c2; 
  white-space: nowrap; 
  width: 34%; 
}

.popup table { 
  border-collapse: collapse; 
  font-size: 12px; 
  width: 100%; 
  table-layout: fixed; 
}

/* Hover Tooltips */
.hoverTip { 
  background: #fff; 
  border: 1px solid #ddd; 
  border-radius: 6px; 
  box-shadow: 0 2px 8px rgba(0,0,0,.15); 
  padding: 2px 6px; 
  font-size: 12px; 
}

/* Spinner Animation */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(80,227,194,0.2);
  border-left-color: #50e3c2;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 4px;
  vertical-align: middle;
  box-sizing: content-box;
  flex-shrink: 0;
}

/* Tiny buttons for group management */
.btn-tiny {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  cursor: pointer;
  border-radius: 2px;
  font-size: 10px;
  padding: 2px 4px;
  margin: 0 1px;
}

.btn-tiny:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.3);
}

/* Keyboard Help Overlay */
#keyboardHelp {
  display: none;
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: #fff;
  padding: 16px;
  border-radius: 10px;
  z-index: 3000;
  max-width: 300px;
  text-align: left;
  line-height: 1.4;
}

#keyboardHelp.show {
  display: block;
}

/* Basemap Picker */
.toolbar select#basemapPicker {
  background: #121426 !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
}

.toolbar select#basemapPicker option {
  background: #121426 !important;
  color: #fff !important;
}

label.small { 
  color: #e0e0e0; 
}

/* Enhanced Status Bar */
.status-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, rgba(26,26,46,0.95), rgba(16,16,36,0.95));
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,0.1);
  padding: 8px 16px;
  color: #fff;
  font-size: 12px;
  z-index: 1500;
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4CAF50;
  animation: pulse 2s infinite;
}

.status-dot.loading {
  background: #FFC107;
  animation: spin 1s linear infinite;
}

.status-dot.error {
  background: #F44336;
  animation: flash 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

/* Connection Status */
.connection-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #b0b0b0;
}

.connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
}

.connection-dot.offline {
  background: #F44336;
}

/* Progress Bar Component */
.progress-container {
  flex: 1;
  max-width: 200px;
  height: 8px;
  background: rgba(255,255,255,0.2);
  border-radius: 4px;
  overflow: hidden;
  display: none;
  border: 1px solid rgba(255,255,255,0.3);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #50e3c2, #4a90e2);
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(80,227,194,0.5);
}

/* Scrollable Layers Panel */
#layersPanel {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Cursor Fix - Allow natural hover behavior */
.leaflet-container {
  cursor: grab;
}

.leaflet-container:active {
  cursor: grabbing;
}

.leaflet-interactive {
  cursor: pointer !important;
}

.leaflet-marker-icon {
  cursor: pointer !important;
}

.leaflet-clickable {
  cursor: pointer !important;
}

.leaflet-control {
  cursor: default;
}

.leaflet-control-zoom-in,
.leaflet-control-zoom-out {
  cursor: pointer;
}

/* Allow natural cursor inheritance */
#map {
  cursor: grab;
}

/* Ensure polygon outlines are preserved */
.leaflet-overlay-pane svg path {
  pointer-events: auto;
  cursor: pointer;
}

/* Enhanced styling for better visibility */
.tenure-highlight {
  stroke: #00BCD4 !important;
  stroke-width: 3 !important;
  fill-opacity: 0.3 !important;
  stroke-opacity: 1 !important;
}

/* Ensure tenure overlay checkbox always appears enabled and visible */
#chkTenureOverlay {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#chkTenureOverlay:disabled {
  opacity: 1 !important;
  pointer-events: auto !important;
}

label:has(#chkTenureOverlay) {
  opacity: 1 !important;
  color: #fff !important;
}

/* Scale control styling - anchored to RHS of sidebar */
.leaflet-control-scale {
  background: rgba(26,26,46,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  color: #ffffff !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  text-rendering: geometricPrecision !important;
  -webkit-font-smoothing: subpixel-antialiased !important;
  text-shadow: none !important;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25) !important;
  z-index: 1000 !important;
  position: fixed !important;
  bottom: 40px !important; /* Just above 60px status bar with 10px gap */
  left: 345px !important; /* 5px to right of 340px sidebar to avoid overlap */
  transform: none !important;
  margin: 0 !important;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.leaflet-control-scale-line {
  border: 2px solid #4CAF50 !important;
  border-top: none !important;
  color: #ffffff !important;
  background: transparent !important;
  line-height: 1.3 !important;
  padding: 2px 5px 1px 5px !important;
  font-family: system-ui, -apple-system, sans-serif !important;
  font-weight: 500 !important;
  font-size: 10px !important;
  text-rendering: geometricPrecision !important;
  -webkit-font-smoothing: subpixel-antialiased !important;
  text-shadow: none !important;
  letter-spacing: 0.2px !important;
}

/* Measuring tool popup styling */
.measure-popup .leaflet-popup-content {
  background: rgba(26,26,46,0.95) !important;
  color: #e0e0e0 !important;
  font-weight: 500 !important;
  border-radius: 4px !important;
  padding: 6px 10px !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 140px !important;
  width: fit-content !important;
  white-space: nowrap !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
  text-align: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.measure-popup .leaflet-popup-content-wrapper {
  background: rgba(26,26,46,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
  border-radius: 4px !important;
  backdrop-filter: blur(8px) !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 140px !important;
  width: fit-content !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.measure-popup .leaflet-popup-tip {
  background: rgba(26,26,46,0.95) !important;
  border: 1px solid rgba(255,255,255,0.2) !important;
}