:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-color: #f8fafc;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --panel-bg-hover: rgba(255, 255, 255, 0.98);
  --panel-border: rgba(226, 232, 240, 0.8);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --primary: #15803d;
  --primary-hover: #166534;
  --primary-light: #dcfce7;
  --primary-focus: rgba(21, 128, 61, 0.25);
  --accent: #b45309;
  --accent-light: #fef3c7;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.12), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --blur: blur(12px);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body, html {
  height: 100%;
  width: 100%;
  font-family: var(--font-sans);
  color: var(--text-main);
  background-color: var(--bg-color);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app-container {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  position: relative;
  overflow: hidden;
}

#map {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  z-index: 1;
}

/* ================= Top Bar ================= */
.top-bar {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.top-bar > * {
  pointer-events: auto;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: var(--text-main);
  transition: var(--transition);
}

.app-brand:hover {
  background: var(--panel-bg-hover);
  box-shadow: var(--shadow-lg);
}

.brand-icon {
  width: 28px;
  height: 28px;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #1b4332;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  margin-top: -2px;
}

.search-box {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-input {
  width: 100%;
  padding: 10px 36px 10px 38px;
  font-size: 14px;
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.search-input:focus {
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus), var(--shadow-md);
}

.search-icon-left {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  display: none;
}

.search-clear:hover {
  color: var(--text-main);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}

.action-btn:hover {
  background: var(--panel-bg-hover);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.action-btn.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.action-btn.btn-primary:hover {
  background: var(--primary-hover);
}

.action-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.stats-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.stats-count {
  color: var(--primary);
  font-weight: 700;
}

/* ================= Filter Sidebar ================= */
.filter-panel {
  position: absolute;
  top: 80px;
  left: 16px;
  bottom: 24px;
  width: 320px;
  max-height: calc(100% - 104px);
  max-height: calc(100dvh - 104px);
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  touch-action: pan-y;
}

.filter-panel.hidden {
  transform: translateX(-340px);
  opacity: 0;
  pointer-events: none;
}

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

.filter-title {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-controls {
  display: flex;
  gap: 8px;
  font-size: 12px;
}

.filter-link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 4px;
}

.filter-link-btn:hover {
  text-decoration: underline;
}

.filter-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-close-btn:hover {
  color: var(--text-main);
  background: rgba(0, 0, 0, 0.08);
}

/* Seasonal Filter Banner */
.seasonal-filter-banner {
  padding: 10px 14px;
  background: rgba(220, 252, 231, 0.5);
  border-bottom: 1px solid rgba(187, 247, 208, 0.8);
  flex-shrink: 0;
}

.seasonal-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.seasonal-checkbox {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.seasonal-toggle-slider {
  position: relative;
  width: 36px;
  height: 20px;
  background-color: #cbd5e1;
  border-radius: 20px;
  transition: 0.25s;
  flex-shrink: 0;
}

.seasonal-toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.25s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.seasonal-checkbox:checked + .seasonal-toggle-slider {
  background-color: var(--primary);
}

.seasonal-checkbox:checked + .seasonal-toggle-slider:before {
  transform: translateX(16px);
}

.seasonal-toggle-text {
  font-size: 12.5px;
  font-weight: 600;
  color: #166534;
}

.filter-body {
  flex: 1 1 0px;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}

.filter-body::-webkit-scrollbar {
  width: 6px;
}

.filter-body::-webkit-scrollbar-track {
  background: transparent;
}

.filter-body::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

.filter-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}

/* Category Accordion */
.category-group {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(226, 232, 240, 0.7);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition);
  flex-shrink: 0;
  touch-action: pan-y;
}

.category-group:hover {
  border-color: #cbd5e1;
}

.category-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  background: transparent;
  transition: var(--transition);
  flex-shrink: 0;
  touch-action: pan-y;
}

.category-header:hover {
  background: rgba(241, 245, 249, 0.6);
}

.category-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

.category-name {
  font-size: 13px;
  font-weight: 600;
  flex: 1;
}

.category-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  background: #f1f5f9;
  color: var(--text-muted);
}

.category-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.category-group.open .category-chevron {
  transform: rotate(180deg);
}

.subcategory-list {
  display: none;
  padding: 6px 12px 10px 12px;
  border-top: 1px solid rgba(226, 232, 240, 0.5);
  background: rgba(255, 255, 255, 0.4);
  flex-direction: column;
  gap: 4px;
  touch-action: pan-y;
}

.category-group.open .subcategory-list {
  display: flex;
}

.sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  transition: var(--transition);
  flex-shrink: 0;
  touch-action: pan-y;
}

.sub-item:hover {
  background: rgba(241, 245, 249, 0.8);
}

.sub-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.sub-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.sub-name {
  flex: 1;
}

.sub-count {
  font-size: 11px;
  color: var(--text-light);
}

/* ================= Sighting Details Drawer ================= */
.sighting-card {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 360px;
  max-width: calc(100vw - 48px);
  background: var(--panel-bg);
  backdrop-filter: var(--blur);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sighting-card.active {
  display: flex;
}

.sighting-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-icon {
  width: 38px;
  height: 38px;
  object-fit: contain;
  padding: 4px;
  background: #ffffff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-sm);
}

.card-title-group {
  flex: 1;
}

.card-species {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.card-category-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 4px;
}

.card-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}

.card-close-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-main);
}

/* Sighting Seasonality Widget */
.card-season-widget {
  background: linear-gradient(135deg, rgba(240, 253, 244, 0.8), rgba(254, 249, 195, 0.5));
  border: 1px solid rgba(187, 247, 208, 0.9);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.season-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.season-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.season-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #166534;
}

.ripeness-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ripeness-badge.badge-ripe {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.ripeness-badge.badge-soon {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.ripeness-badge.badge-offseason {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.season-text {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
}

.month-bar {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  background: rgba(255, 255, 255, 0.85);
  padding: 5px 3px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.7);
}

.month-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 3px 1px;
  border-radius: 3px;
}

.month-letter {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
}

.month-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #e2e8f0;
  transition: all 0.2s ease;
}

.month-cell.in-season .month-dot {
  background: #22c55e;
  transform: scale(1.15);
}

.month-cell.in-season .month-letter {
  color: #166534;
}

.month-cell.peak-season .month-dot {
  background: #eab308;
  box-shadow: 0 0 5px rgba(234, 179, 8, 0.7);
  transform: scale(1.3);
}

.month-cell.peak-season .month-letter {
  color: #854d0e;
}

.month-cell.is-current {
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--primary);
}

.foraging-tip {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11.5px;
  line-height: 1.4;
  color: #334155;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.5);
}

.tip-icon {
  width: 14px;
  height: 14px;
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 1px;
}

.card-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.6);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(226, 232, 240, 0.6);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-meta-icon {
  width: 15px;
  height: 15px;
  color: var(--text-light);
}

.distance-highlight {
  color: var(--primary);
  font-weight: 600;
}

.card-notes {
  font-size: 13px;
  line-height: 1.4;
  color: #334155;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.card-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  background: #ffffff;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.card-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.card-btn.primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.card-btn.primary:hover {
  background: var(--primary-hover);
}

.card-btn.danger {
  color: var(--danger);
}

.card-btn.danger:hover {
  background: #fee2e2;
  border-color: var(--danger);
}

/* ================= Modal ================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #ffffff;
  width: 440px;
  max-width: 90vw;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn 0.25s ease-out;
}

@keyframes modalIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  outline: none;
  transition: var(--transition);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

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

.toast {
  background: #0f172a;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
}

@keyframes toastIn {
  from {
    transform: translateY(12px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Leaflet Customizations */
.leaflet-container {
  font-family: var(--font-sans) !important;
}

.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: var(--radius-md) !important;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background-color: var(--panel-bg) !important;
  color: var(--text-main) !important;
  border-bottom: 1px solid var(--panel-border) !important;
  width: 34px !important;
  height: 34px !important;
  line-height: 34px !important;
}

.leaflet-control-zoom a:hover {
  background-color: #ffffff !important;
}

.marker-cluster-custom {
  background-color: rgba(21, 128, 61, 0.85);
  border: 2px solid #ffffff;
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  border-radius: 50%;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease;
}

.marker-cluster-custom:hover {
  transform: scale(1.1);
}

.cluster-inner {
  line-height: 1;
}

/* ================= Responsive Mobile Optimization ================= */
@media (max-width: 768px) {
  .top-bar {
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }

  .app-brand {
    padding: 0;
    width: 40px;
    height: 40px;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
  }

  .brand-title, 
  .brand-subtitle, 
  .stats-pill {
    display: none !important;
  }

  .brand-icon {
    width: 24px;
    height: 24px;
  }

  .search-box {
    flex: 1;
    min-width: 0;
    max-width: none;
  }

  .search-input {
    height: 40px;
    font-size: 13px;
    padding: 8px 28px 8px 32px;
    border-radius: var(--radius-md);
  }

  .search-icon-left {
    left: 10px;
    width: 14px;
    height: 14px;
  }

  .top-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 0;
    flex-shrink: 0;
  }

  .action-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
  }

  .action-btn .btn-text {
    display: none;
  }

  .action-btn svg {
    width: 17px;
    height: 17px;
  }

  .filter-panel {
    top: 56px;
    left: 8px;
    right: 8px;
    bottom: 12px;
    width: auto;
    max-height: calc(100% - 68px);
    max-height: calc(100dvh - 68px);
    border-radius: var(--radius-lg);
  }

  .filter-panel.hidden {
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
  }

  .sighting-card {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
  }

  .modal-container {
    max-width: 94vw;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-lg);
  }

  .modal-form {
    padding: 16px;
    gap: 12px;
  }

  .leaflet-bottom.leaflet-right {
    margin-bottom: 24px;
    margin-right: 10px;
  }

  .leaflet-control-layers {
    border: none !important;
    border-radius: var(--radius-md) !important;
    box-shadow: var(--shadow-md) !important;
    background: var(--panel-bg) !important;
    backdrop-filter: var(--blur);
  }
}

/* Extra small mobile phones (< 380px) */
@media (max-width: 380px) {
  .top-bar {
    gap: 4px;
  }

  .app-brand,
  .action-btn {
    width: 36px;
    height: 36px;
  }

  .top-actions {
    gap: 4px;
  }

  .search-input {
    height: 36px;
    font-size: 12.5px;
    padding: 6px 24px 6px 30px;
  }
}

/* ================= Scraper & Areas Modal ================= */
.modal-container.modal-wide {
  width: 640px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.modal-subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
}

.areas-section {
  padding: 14px 20px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.areas-section:last-child {
  border-bottom: none;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title-row h4 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.scraper-config-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  user-select: none;
}

.toggle-switch-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  background-color: #cbd5e1;
  border-radius: 22px;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.25s ease;
}

.toggle-switch-label input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch-label input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

.config-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.config-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.interval-input-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
}

.num-input {
  width: 65px;
  text-align: center;
  padding: 5px 8px;
}

.scraper-meta-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.status-pill {
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
}

.status-active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.status-inactive {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.area-header-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.area-form-container {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.area-form-container.hidden {
  display: none !important;
}

.area-form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.area-form-header h5 {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.quick-bounds-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.quick-bounds-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.form-row-coords {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (max-width: 480px) {
  .form-row-coords {
    grid-template-columns: 1fr;
  }
}

.areas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.areas-list::-webkit-scrollbar {
  width: 6px;
}

.areas-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 4px;
}

.area-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: var(--transition);
}

.area-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.area-card-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.area-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.area-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.area-coords-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.area-stats-text {
  font-size: 11px;
  color: #475569;
}

.area-card-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.area-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
}

.area-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.area-btn.btn-delete:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

