:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.35);
  --secondary: #0ea5e9;
  --success: #10b981;
  --accent: #f43f5e;
  --bg: #060c1a;
  --surface: rgba(15, 23, 42, 0.8);
  --card: rgba(22, 33, 55, 0.75);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: #f1f5f9;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --radius: 16px;
}

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

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ── Background ───────────────────────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.15) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* ── Topbar ───────────────────────────────────────── */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(6, 12, 26, 0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 1000;
  gap: 20px;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo-text {
  font-weight: 800;
  font-size: 1.1rem;
}

.topbar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-title span {
  font-size: 18px;
}

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

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #818cf8;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #818cf8;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.4;
    transform: scale(1.5);
  }
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-light);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-back:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.3);
  color: var(--text);
}

/* ── Layout ───────────────────────────────────────── */
.layout {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
}

/* ── Sidebar ──────────────────────────────────────── */
.sidebar {
  width: 340px;
  flex-shrink: 0;
  background: rgba(6, 12, 26, 0.92);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
  transition: width 0.3s ease;
  z-index: 10;
}

.sidebar.collapsed {
  width: 0;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.sidebar-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.map-tabs {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.03);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.map-tab {
  flex: 1;
  padding: 8px 4px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  font-family: inherit;
}

.map-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.map-tab.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border);
}

[data-theme="light"] .map-tabs {
  background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .map-tab.active {
  color: var(--primary);
}

.opp-popup-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 240px;
  padding: 12px;
}

.opp-popup-price {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 2px;
}

.opp-popup-img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  background: #1e293b;
}

.opp-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  margin-right: 4px;
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

#pin-list {
  overflow-y: auto;
  flex: 1;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#pin-list::-webkit-scrollbar,
.cluster-list-popup::-webkit-scrollbar {
  width: 4px;
}

#pin-list::-webkit-scrollbar-track,
.cluster-list-popup::-webkit-scrollbar-track {
  background: transparent;
}

#pin-list::-webkit-scrollbar-thumb,
.cluster-list-popup::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.pin-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pin-item:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.08);
  transform: translateX(3px);
}

.pin-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.pin-info {
  min-width: 0;
  flex: 1;
}

.pin-address {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pin-status {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.pin-status.ok {
  color: var(--success);
}

.pin-status.loading {
  color: #fbbf24;
}

.pin-status.error {
  color: var(--accent);
}

/* ── Sidebar collapse toggle ──────────────────────── */
.sidebar-toggle {
  position: absolute;
  left: 340px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 52px;
  background: rgba(6, 12, 26, 0.92);
  border: 1px solid var(--border);
  border-left: none;
  border-radius: 0 10px 10px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  transition: all 0.3s ease;
  z-index: 11;
}

.sidebar-toggle:hover {
  color: var(--text);
  background: rgba(99, 102, 241, 0.15);
}

.sidebar.collapsed+.sidebar-toggle {
  left: 0;
  border-radius: 0 10px 10px 0;
}

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

/* ── Progress bar ─────────────────────────────────── */
#progress-bar-wrap {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(6, 12, 26, 0.9);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 24px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
  min-width: 260px;
}

.progress-label {
  color: var(--text-light);
  font-weight: 600;
}

.progress-value {
  color: #818cf8;
  font-weight: 800;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  border-radius: 9999px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── Leaflet popup override ───────────────────────── */
.leaflet-popup-content-wrapper {
  background: rgba(15, 23, 42, 0.97) !important;
  border: 1px solid rgba(99, 102, 241, 0.3) !important;
  border-radius: 16px !important;
  backdrop-filter: blur(20px) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6) !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.leaflet-popup-content {
  margin: 0 !important;
  width: auto !important;
}

.leaflet-popup-tip {
  background: rgba(99, 102, 241, 0.4) !important;
}

/* ── Leaflet tooltip override ───────────────────────── */
.leaflet-tooltip {
  background: rgba(15, 23, 42, 0.95) !important;
  border: 1px solid rgba(99, 102, 241, 0.4) !important;
  border-radius: 8px !important;
  color: #fff !important;
  font-family: 'Plus Jakarta Sans', sans-serif !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  padding: 6px 12px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(8px) !important;
}

.leaflet-tooltip-top:before {
  border-top-color: rgba(99, 102, 241, 0.4) !important;
}

.leaflet-popup-close-button {
  color: #94a3b8 !important;
  font-size: 18px !important;
  right: 8px !important;
  top: 8px !important;
}

.popup-inner {
  padding: 18px 20px;
  min-width: 220px;
}

.popup-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.popup-address {
  font-size: 1rem;
  font-weight: 800;
  color: #f1f5f9;
  margin-bottom: 14px;
  line-height: 1.3;
}

.popup-btn {
  display: block;
  text-align: center;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

.popup-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* ── Custom pin marker ────────────────────────────── */
.custom-marker {
  position: relative;
}

/* ── Cluster marker ──────────────────────────────────── */
.cluster-marker {
  position: relative;
  cursor: pointer;
}

.cluster-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  font-family: 'Plus Jakarta Sans', sans-serif;
  min-width: 18px;
  height: 18px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #060c1a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  line-height: 1;
  padding: 0 3px;
}

/* ── Cluster list popup ──────────────────────────────── */
.cluster-list-popup {
  min-width: 240px;
  padding: 8px;
}

.cluster-list-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #818cf8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  padding: 0 4px;
}

.cluster-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.cluster-list-item:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.25);
}

.cluster-list-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.cluster-list-info {
  flex: 1;
  min-width: 0;
}

.cluster-list-addr {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cluster-list-sub {
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 1px;
}

.cluster-list-arrow {
  font-size: 12px;
  color: #818cf8;
  flex-shrink: 0;
}

.opp-list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.opp-list-row:last-child {
  border-bottom: none;
}

.opp-list-row:hover {
  background: rgba(99, 102, 241, 0.1);
}

.opp-row-img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: #1e293b;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.opp-row-info {
  flex: 1;
  min-width: 0;
}

.opp-row-price {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 2px;
}

.opp-row-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: #f1f5f9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.opp-row-addr {
  font-size: 0.68rem;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.opp-row-badge {
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.3);
  flex-shrink: 0;
}

/* ── Empty state ──────────────────────────────────── */
#empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: none;
  pointer-events: none;
  z-index: 500;
}

/* ── Responsive — 768px ────────────────────────────────────── */
@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    gap: 8px;
  }

  .topbar-title {
    display: none;
  }

  .topbar-actions {
    gap: 8px;
  }

  /* Sidebar overlays the map on mobile (starts collapsed via JS) */
  .sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: 300px;
    /* visible when not collapsed */
  }

  /* Toggle sits at left:0 when collapsed, JS moves it to 300px when open */
  .sidebar-toggle {
    left: 0;
    border-left: 1px solid var(--border);
    border-radius: 0 10px 10px 0;
  }

  #progress-bar-wrap {
    left: 12px;
    right: 12px;
    transform: none;
    bottom: 90px;
    min-width: unset;
    width: auto;
    z-index: 1001;
    /* Above mobile tabs */
  }
}

/* ── Responsive — 480px ───────────────────────────────── */
@media (max-width: 480px) {
  .logo-text {
    display: none;
  }

  .logo-icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }

  .topbar .btn-back {
    font-size: 0;
    padding: 8px 10px;
  }

  .topbar .btn-back::before {
    content: '←';
    font-size: 14px;
  }

  .status-pill {
    padding: 5px 10px;
    font-size: 0.72rem;
    gap: 6px;
  }

  #progress-bar-wrap {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 8px;
  }

  .progress-label {
    font-size: 0.76rem;
  }

  .progress-value {
    font-size: 0.76rem;
  }
}

/* ── Theme Toggle Button ────────────────────────────── */
#theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
  transition: all 0.2s;
  flex-shrink: 0;
}

#theme-toggle:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
}

/* ── Light Theme ─────────────────────────────────────── */
[data-theme="light"] {
  --bg: #f0f4fb;
  --surface: rgba(255, 255, 255, 0.95);
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #475569;
}

[data-theme="light"] body {
  background: var(--bg) !important;
  color: var(--text) !important;
}

[data-theme="light"] body::before {
  background: radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.08) 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.06) 0%, transparent 60%) !important;
}

[data-theme="light"] body::after {
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.04) 1px, transparent 1px) !important;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92) !important;
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-right-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.03) !important;
}

[data-theme="light"] .sidebar-header {
  border-bottom-color: rgba(0, 0, 0, 0.08) !important;
}

[data-theme="light"] .search-box {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] .search-box:focus {
  background: #fff !important;
  border-color: rgba(99, 102, 241, 0.5) !important;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1) !important;
}

[data-theme="light"] .pin-item {
  background: #f8fafc !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}

[data-theme="light"] .pin-item:hover {
  background: #f1f5f9 !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

[data-theme="light"] .pin-name {
  color: #1e293b !important;
}

[data-theme="light"] .pin-addr {
  color: #64748b !important;
}

[data-theme="light"] .pin-actions button {
  background: rgba(0, 0, 0, 0.05) !important;
  color: #475569 !important;
}

[data-theme="light"] .pin-actions button:hover {
  background: rgba(0, 0, 0, 0.1) !important;
  color: #0f172a !important;
}

[data-theme="light"] .sidebar-toggle {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
  box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #fff !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
}

[data-theme="light"] .leaflet-popup-tip {
  background: #fff !important;
}

[data-theme="light"] .popup-address {
  color: #0f172a !important;
}

[data-theme="light"] .popup-title {
  color: #4f46e5 !important;
}

[data-theme="light"] #theme-toggle {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.09) !important;
  color: #0f172a !important;
}

[data-theme="light"] #theme-toggle:hover {
  background: rgba(99, 102, 241, 0.08) !important;
}

[data-theme="light"] .btn-back {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #0f172a !important;
}

[data-theme="light"] .btn-back:hover {
  background: #e2e8f0 !important;
}



.logo-imob {
  color: #eee;
}

[data-theme="light"] .logo-imob {
  color: #1e293b !important;
}

[data-theme="light"] .logo-text span:last-child {
  color: #4f46e5 !important;
}

[data-theme="light"] body {
  background: #f0f4fb !important;
}

[data-theme="light"] body::before {
  background: radial-gradient(ellipse 80% 60% at 10% -10%, rgba(99, 102, 241, 0.07) 0%, transparent 60%), radial-gradient(ellipse 60% 50% at 90% 110%, rgba(14, 165, 233, 0.05) 0%, transparent 60%) !important;
}

[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.94) !important;
  border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .topbar-title {
  color: #0f172a !important;
}

[data-theme="light"] .btn-back {
  background: #f1f5f9 !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #475569 !important;
}

[data-theme="light"] .btn-back:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

[data-theme="light"] .status-pill {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  color: #475569 !important;
}

[data-theme="light"] .status-dot {
  background: #10b981 !important;
}

[data-theme="light"] .sidebar {
  background: rgba(255, 255, 255, 0.97) !important;
  border-right-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .sidebar-header {
  background: rgba(255, 255, 255, 0.97) !important;
  border-bottom-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .sidebar-title {
  color: #0f172a !important;
}

[data-theme="light"] .sidebar-count {
  color: #64748b !important;
}

[data-theme="light"] .sidebar-toggle {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
  color: #475569 !important;
}

[data-theme="light"] .pin-item {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] .pin-item:hover {
  background: rgba(240, 244, 251, 0.9) !important;
}

[data-theme="light"] .pin-addr {
  color: #0f172a !important;
}

[data-theme="light"] .pin-meta {
  color: #64748b !important;
}

[data-theme="light"] #pin-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] #progress-bar-wrap {
  background: rgba(255, 255, 255, 0.97) !important;
  border-color: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .progress-track {
  background: rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] .progress-label {
  color: #475569 !important;
}

[data-theme="light"] .progress-value {
  color: #0f172a !important;
}

[data-theme="light"] .leaflet-popup-content-wrapper {
  background: #fff !important;
  color: #0f172a !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12) !important;
}

[data-theme="light"] .leaflet-popup-tip {
  background: #fff !important;
}

[data-theme="light"] .popup-address {
  color: #0f172a !important;
}

[data-theme="light"] .popup-meta {
  color: #475569 !important;
}

[data-theme="light"] .popup-btn {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.2) !important;
  color: #4f46e5 !important;
}

[data-theme="light"] .cluster-list-item {
  border-bottom-color: rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] .cluster-list-item:hover {
  background: rgba(99, 102, 241, 0.05) !important;
}

[data-theme="light"] .cluster-list-addr {
  color: #0f172a !important;
}

[data-theme="light"] .cluster-list-meta {
  color: #64748b !important;
}

[data-theme="light"] #theme-toggle {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] #theme-toggle:hover {
  background: #fff !important;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
  border-color: rgba(99, 102, 241, 0.3) !important;
}

/* ── Carregamento de Tela Cheia ── */
.full-page-loader {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(8px);
}

.full-page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--primary);
  border-left-color: var(--secondary);
  animation: spinner 1.2s linear infinite;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
  position: relative;
}

.loader-spinner::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-right-color: var(--secondary);
  animation: spinner 0.8s linear infinite reverse;
}

.loader-text {
  color: var(--text);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.loader-subtext {
  font-size: 0.85rem;
  color: var(--text-light);
  max-width: 320px;
  text-align: center;
  min-height: 20px;
  opacity: 0;
}

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

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Mobile Floating Tabs ────────────────────────── */
.map-tabs-mobile {
  display: none;
}

@media (max-width: 768px) {
  .sidebar-header .map-tabs {
    display: none;
  }

  .map-tabs-mobile {
    display: flex;
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;

    background: rgba(6, 12, 26, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    padding: 6px;
    border-radius: 999px;
    /* full pill */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    gap: 4px;
    width: 90%;
    max-width: 400px;
    justify-content: center;
  }

  .map-tabs-mobile .map-tab {
    flex: 1;
    text-align: center;
    padding: 10px 8px;
    border-radius: 999px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
  }

  .map-tabs-mobile .map-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
  }

  .map-tabs-mobile .map-tab.active {
    background: var(--card);
    color: var(--primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border);
  }

  [data-theme="light"] .map-tabs-mobile {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0, 0, 0, 0.1);
  }

  [data-theme="light"] .map-tabs-mobile .map-tab.active {
    background: #fff;
    color: var(--primary);
  }
}

/* ── App Tutorial ───────────────────────────────────── */
.tut-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  background: transparent;
}

.topbar.tutorial-mode {
  z-index: 10001 !important;
}

.tut-highlight {
  position: relative !important;
  z-index: 10002 !important;
  background: var(--bg) !important;
  border: 2px solid var(--primary) !important;
  border-radius: 10px !important;
  box-shadow: 0 0 0 9999px rgba(6, 12, 26, 0.85), 0 0 25px var(--primary-glow) !important;
  pointer-events: none !important;
}

.tut-modal {
  background: var(--card);
  border: 1px solid var(--border-active);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-lg);
  padding: 24px 30px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  animation: tut-fade-up 0.5s ease-out;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10003;
}

.tut-progress {
  font-size: 0.8rem;
  background: rgba(99, 102, 241, 0.2);
  color: #818cf8;
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 12px;
  font-weight: 700;
}

.tut-modal h2 {
  font-size: 1.3rem;
  margin-bottom: 10px;
  color: #fff;
}

.tut-modal p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 24px;
}

.tut-btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.tut-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.tut-arrow {
  position: fixed;
  font-size: 2.5rem;
  color: var(--primary);
  z-index: 10003;
  text-shadow: 0 0 15px var(--primary-glow);
  animation: tut-bounce 1.5s infinite;
  pointer-events: none;
  display: none;
}

@keyframes tut-fade-up {
  from {
    opacity: 0;
    transform: translate(-50%, 20px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes tut-bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}