/* ========================================================
   ITBI Analytics — Design System & Stylesheet
   Modern Dark Dashboard with Vibrant Accents & Glassmorphism
   ======================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-sidebar: #111827;
  --bg-card: #1e293b;
  --bg-card-hover: #283548;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.3);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.25);
  
  --color-green: #10b981;
  --color-blue: #3b82f6;
  --color-purple: #a855f7;
  --color-orange: #f59e0b;
  --color-pink: #ec4899;
  
  /* Cores oficiais das Zonas */
  --zona-centro: #f59e0b;
  --zona-sul: #10b981;
  --zona-oeste: #3b82f6;
  --zona-leste: #ec4899;
  --zona-norte: #8b5cf6;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.4);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  touch-action: pan-x pan-y pinch-zoom;
  -webkit-overflow-scrolling: touch;
}

/* No desktop grande (>1024px), mantém o dashboard fixo na tela */
@media (min-width: 1025px) {
  body:not(.pricing-body) {
    overflow: hidden;
    height: 100vh;
  }
}

/* Scrollbar customizada */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ========================================================
   Layout Geral
   ======================================================== */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ========================================================
   Sidebar de Filtros
   ======================================================== */
/* ========================================================
   Sidebar de Filtros (Ultra Legível & Alto Contraste)
   ======================================================== */
.sidebar {
  width: 420px;
  min-width: 420px;
  background-color: #0d131f;
  border-right: 1.5px solid #2d3748;
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar.hidden {
  transform: translateX(-100%);
  position: absolute;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1.5px solid #2d3748;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #111827;
}

.logo-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 2rem;
  background: rgba(99, 102, 241, 0.25);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid #6366f1;
}

.logo-box h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.logo-box p {
  font-size: 0.85rem;
  color: #93c5fd;
  font-weight: 500;
}

.btn-toggle-sidebar {
  background: #1e293b;
  border: 1px solid #475569;
  color: #ffffff;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.btn-toggle-sidebar:hover {
  background: #334155;
}

.sidebar-actions-top {
  display: flex;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1.5px solid #2d3748;
  background: #111827;
  flex-shrink: 0;
}

.sidebar-subactions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 20px;
  background: #0b101c;
  border-bottom: 1.5px solid #232d3f;
  flex-shrink: 0;
}

.filters-count-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.expand-collapse-btns {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-text-action {
  background: none;
  border: none;
  color: #818cf8;
  font-size: 0.80rem;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 4px;
  transition: all 0.15s ease;
}

.btn-text-action:hover {
  color: #ffffff;
  background: rgba(99, 102, 241, 0.2);
}

.action-sep {
  color: #475569;
  font-size: 0.75rem;
}

.btn-primary {
  flex: 2;
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  color: #ffffff;
  border: 1px solid #6366f1;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.btn-secondary {
  flex: 1;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #475569;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: #334155;
  color: #ffffff;
}

.filter-groups-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ========================================================
   Cards de Filtros / Acordeão
   ======================================================== */
.filter-card {
  background: #141c2c;
  border: 1.5px solid #2a374d;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  flex-shrink: 0; /* CRUCIAL: impede que o flexbox esmague os menus */
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-card:hover {
  border-color: #3e4f6c;
}

.filter-card.has-filter {
  border-color: #6366f1;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.filter-card.has-filter .filter-card-header {
  background: #1b263e;
}

.filter-card-header {
  padding: 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: #192337;
  min-height: 48px;
  border-bottom: 1.5px solid #25334c;
  transition: background 0.2s ease;
}

.filter-card-header:hover {
  background: #202d46;
}

.filter-card-header.collapsed {
  border-bottom: none;
}

.filter-card-header.no-toggle {
  cursor: default;
}

.filter-title {
  font-size: 0.91rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  line-height: 1.35;
}

.card-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.5);
}

.arrow-icon {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: bold;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
}

.filter-card-header.collapsed .arrow-icon {
  transform: rotate(-90deg);
}

.filter-card-body {
  padding: 14px 16px 16px;
  background: #0f1624;
}

.filter-card-body.collapsed {
  display: none !important;
}

/* Inputs de Texto e Busca */
.input-text {
  width: 100%;
  background: #090d16;
  border: 1.5px solid #3b4556;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.92rem;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
}

.input-text::placeholder {
  color: #64748b;
}

.input-text:focus, .input-text-sm:focus {
  border-color: #6366f1;
  background: #0d131f;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.input-text-sm {
  width: 100%;
  background: #090d16;
  border: 1.5px solid #3b4556;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 500;
  outline: none;
  margin-bottom: 10px;
}

.input-text-sm::placeholder {
  color: #64748b;
}

/* Chips de Filtro */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.chip {
  font-size: 0.82rem;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  background: #1e293b;
  border: 1.5px solid #3b4556;
  color: #f1f5f9;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.chip:hover {
  background: #334155;
  color: #ffffff;
  border-color: #64748b;
}

.chip.active {
  background: #4f46e5;
  border-color: #6366f1;
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

/* Chips com cores específicas das Zonas */
.chip-zona {
  font-size: 0.84rem;
  padding: 7px 13px;
  border-radius: var(--radius-full);
  background: #1e293b;
  border: 1.5px solid #3b4556;
  color: #f8fafc;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.chip-zona[data-all="true"].active {
  background: #4f46e5;
  border-color: #6366f1;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.chip-zona.active.zona-centro {
  background: #f59e0b;
  color: #000000;
  border-color: #d97706;
  font-weight: 800;
}
.chip-zona.active.zona-sul {
  background: #10b981;
  color: #000000;
  border-color: #059669;
  font-weight: 800;
}
.chip-zona.active.zona-oeste {
  background: #3b82f6;
  color: #ffffff;
  border-color: #2563eb;
  font-weight: 800;
}
.chip-zona.active.zona-leste {
  background: #ec4899;
  color: #ffffff;
  border-color: #db2777;
  font-weight: 800;
}
.chip-zona.active.zona-norte {
  background: #8b5cf6;
  color: #ffffff;
  border-color: #7c3aed;
  font-weight: 800;
}

/* Listas de Checkboxes com Scroll */
.checkbox-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.checkbox-item:hover {
  background: #1e293b;
  border-color: #3b4556;
  color: #ffffff;
}

.checkbox-item input {
  accent-color: #6366f1;
  width: 17px;
  height: 17px;
  margin-top: 3px;
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-item .item-text {
  flex: 1;
  white-space: normal;
  word-break: break-word;
  line-height: 1.35;
  color: #f1f5f9;
}

.checkbox-item .item-count {
  flex-shrink: 0;
  margin-left: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  background: #1e293b;
  color: #93c5fd;
  border: 1px solid #3b4556;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

/* Range Inputs (Mín e Máx) */
.range-inputs {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.range-inputs > div {
  flex: 1;
}

.range-label {
  font-size: 0.82rem;
  color: #cbd5e1;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

/* ========================================================
   Main Content Area
   ======================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Top Header */
.top-header {
  padding: 12px 24px;
  background: rgba(17, 24, 39, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-open-sidebar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  display: none;
}

.sidebar.hidden ~ .main-content .btn-open-sidebar {
  display: inline-flex;
}

.active-filters-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge-filter {
  font-size: 0.75rem;
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.badge-financiamento {
  font-size: 0.75rem;
  background: rgba(14, 165, 233, 0.12);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  font-weight: 600;
  display: inline-block;
}

/* Export Dropdown */
.export-dropdown {
  position: relative;
  display: inline-block;
}

.btn-export {
  background: linear-gradient(135deg, #059669, var(--color-green));
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transition: var(--transition);
}

.btn-export:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.4);
}

.export-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 105%;
  background: var(--bg-card);
  min-width: 220px;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  z-index: 1000;
  overflow: hidden;
}

.export-dropdown-content.show {
  display: block;
}

.export-dropdown-content a {
  color: var(--text-main);
  padding: 10px 16px;
  text-decoration: none;
  display: block;
  font-size: 0.82rem;
  transition: background 0.15s;
}

.export-dropdown-content a:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ========================================================
   KPI Grid
   ======================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 16px 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.kpi-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-blue { background: rgba(59, 130, 246, 0.15); color: var(--color-blue); }
.icon-green { background: rgba(16, 185, 129, 0.15); color: var(--color-green); }
.icon-purple { background: rgba(168, 85, 247, 0.15); color: var(--color-purple); }
.icon-orange { background: rgba(245, 158, 11, 0.15); color: var(--color-orange); }

.kpi-info {
  display: flex;
  flex-direction: column;
}

.kpi-label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.kpi-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ========================================================
   Tabs Navigation
   ======================================================== */
.view-tabs {
  display: flex;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  white-space: nowrap;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 12px 18px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
  flex-shrink: 0;
}

.tab-btn.admin-only-tab {
  background: rgba(99, 102, 241, 0.06);
  font-weight: 600;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.tab-btn.admin-only-tab:hover {
  background: rgba(99, 102, 241, 0.14);
  color: #fff;
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: #fff;
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: rgba(99, 102, 241, 0.08);
}

/* ========================================================
   Tab Panels & Map View
   ======================================================== */
.tab-panels {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.tab-panel {
  display: none;
  height: 100%;
  width: 100%;
  overflow-y: auto;
}

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

/* Mapa */
.map-container-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  background: #111827;
}

.map-floating-legend {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.88);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow-card);
}

.legend-title {
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.leg-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-main);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-centro { background: var(--zona-centro); }
.dot-sul { background: var(--zona-sul); }
.dot-oeste { background: var(--zona-oeste); }
.dot-leste { background: var(--zona-leste); }
.dot-norte { background: var(--zona-norte); }

.map-counter-badge {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1000;
  background: rgba(17, 24, 39, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  box-shadow: var(--shadow-card);
}

/* Custom Marker Cluster Colors */
.marker-cluster-small {
  background-color: rgba(99, 102, 241, 0.5) !important;
}
.marker-cluster-small div {
  background-color: rgba(99, 102, 241, 0.9) !important;
  color: #fff !important;
}
.marker-cluster-medium {
  background-color: rgba(16, 185, 129, 0.5) !important;
}
.marker-cluster-medium div {
  background-color: rgba(16, 185, 129, 0.9) !important;
  color: #fff !important;
}
.marker-cluster-large {
  background-color: rgba(245, 158, 11, 0.5) !important;
}
.marker-cluster-large div {
  background-color: rgba(245, 158, 11, 0.9) !important;
  color: #000 !important;
  font-weight: bold !important;
}

/* Popup Leaflet Customizado */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-card) !important;
}
.leaflet-popup-tip {
  background: var(--bg-card) !important;
}
.popup-imovel h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}
.popup-imovel .popup-valor {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--color-green);
  margin-bottom: 8px;
}
.popup-imovel p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 3px 0;
}
.popup-imovel .popup-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  margin-top: 6px;
}

/* ========================================================
   Charts View
   ======================================================== */
.charts-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.chart-card h3 {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 16px;
}

.chart-box {
  position: relative;
  height: 280px;
  width: 100%;
}

/* ========================================================
   Table View
   ======================================================== */
.table-container-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.table-pagination-info {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.select-sm {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  outline: none;
}

.btn-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-sm:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.table-responsive {
  flex: 1;
  overflow: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  min-height: 380px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.8rem;
}

.data-table th {
  background: #172033;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table th:hover {
  color: var(--text-main);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-main);
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.td-valor {
  font-weight: 700;
  color: var(--color-green);
}

.td-complemento {
  color: #93c5fd;
  font-size: 0.78rem;
  font-weight: 500;
  background: rgba(147, 197, 253, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading-td {
  text-align: center;
  padding: 40px !important;
  color: var(--text-dim);
}

.table-pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 0 0;
}

.btn-page {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ========================================================
   Aba Histórico e Upload
   ======================================================== */
.historico-container {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  max-width: 900px;
}

.upload-box-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.upload-box-card h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.upload-box-card p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.drop-zone {
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  padding: 36px 20px;
  text-align: center;
  background: rgba(15, 23, 42, 0.4);
  cursor: pointer;
  transition: var(--transition);
}

.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.drop-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 8px;
}

.upload-status {
  margin-top: 12px;
  font-size: 0.85rem;
}

.history-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.history-table-card h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

/* Danger Zone / Reset Database */
.danger-zone-card {
  background: rgba(239, 68, 68, 0.05);
  border: 1.5px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
}

.danger-zone-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.danger-zone-info h4 {
  font-size: 1.02rem;
  color: #f87171;
  margin-bottom: 4px;
  font-weight: 700;
}

.danger-zone-info p {
  color: #94a3b8;
  font-size: 0.85rem;
  line-height: 1.4;
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #ffffff;
  border: 1px solid #ef4444;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-danger:hover {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ========================================================
   Responsividade
   ======================================================== */
@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================================
   Área de Autenticação / Usuário no Header
   ======================================================== */
.user-auth-area {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-auth-open {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.2));
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.btn-auth-open:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35), rgba(99, 102, 241, 0.35));
  border-color: #60a5fa;
  color: #fff;
  transform: translateY(-1px);
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-main);
}

.user-badge-role {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.role-admin {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.role-usuario {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: #f87171;
}

/* ========================================================
   Seletor de Modo do Mapa (Pinos vs Heatmap)
   ======================================================== */
.map-mode-switcher {
  position: absolute;
  top: 16px;
  left: 60px;
  z-index: 1000;
  display: flex;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px;
  gap: 4px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.btn-map-mode {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.btn-map-mode.active {
  background: var(--color-blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.btn-map-mode:hover:not(.active) {
  color: var(--text-main);
  background: rgba(255,255,255,0.06);
}

/* ========================================================
   Barra de Ordenação Rápida na Tabela
   ======================================================== */
.table-quick-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.table-quick-sort select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.btn-map-focus,
.btn-card-detalhes {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.btn-map-focus:hover,
.btn-card-detalhes:hover {
  background: var(--color-blue);
  color: #fff;
  transform: scale(1.18);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.6);
}

/* ========================================================
   Modal Overlay & Card
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 13, 26, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeInModal 0.25s ease forwards;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 14px;
  margin-bottom: 8px;
}

.modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* ========================================================
   Modal de Autenticação & LGPD
   ======================================================== */
.modal-auth-card {
  max-width: 580px;
  width: 95%;
  background: #111827;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 40px rgba(0,0,0,0.7);
}

.auth-tabs-header {
  display: flex;
  gap: 8px;
}

.auth-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.auth-tab-btn.active {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.auth-form-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px 0 10px;
}

.auth-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.auth-field label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-dim);
}

.lgpd-consent-box {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-top: 4px;
}

.lgpd-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
  cursor: pointer;
}

.lgpd-checkbox-label input {
  margin-top: 2px;
  accent-color: var(--color-blue);
  cursor: pointer;
}

.auth-feedback {
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-top: 4px;
}

.auth-feedback.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.auth-feedback.success {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #86efac;
}

/* ========================================================
   Painel de Leads & Campanhas (Admin)
   ======================================================== */
.campanhas-container-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.campanhas-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.campanhas-title-box h2 {
  font-size: 1.2rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.campanhas-title-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.campanhas-metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.camp-stat-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.camp-stat-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.camp-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-blue);
}

.campanhas-table-wrapper {
  overflow-x: auto;
}

.campanhas-table-wrapper h3 {
  font-size: 0.95rem;
  margin-bottom: 12px;
  color: var(--text-main);
}

/* ========================================================
   Marcador de Destaque / PIN Especial do Imóvel Selecionado
   ======================================================== */
.selected-target-pin-container {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

/* Ondas pulsantes de radar / sonar */
.sonar-wave {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.9);
  animation: sonarWave 1.8s infinite ease-out;
  pointer-events: none;
}

.sonar-wave.delay {
  animation-delay: 0.9s;
}

@keyframes sonarWave {
  0% {
    transform: scale(0.35);
    opacity: 1;
  }
  100% {
    transform: scale(2.6);
    opacity: 0;
  }
}

/* O pino físico com efeito bounce */
.selected-beacon-pin {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: pinBounce 1.5s ease-in-out infinite;
  cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
}

@keyframes pinBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.selected-pin-tag {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.5px;
  border: 1.5px solid #fff;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.6);
  margin-bottom: 2px;
  text-transform: uppercase;
}

.selected-pin-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.7);
}

.selected-pin-icon span {
  transform: rotate(45deg);
  font-size: 17px;
  display: block;
}

/* Linha da tabela com destaque ativo */
tr.tr-focused {
  background: rgba(239, 68, 68, 0.15) !important;
  border-left: 4px solid #ef4444 !important;
}

/* Popup do imóvel selecionado */
.popup-imovel-selected {
  border-top: 3px solid #ef4444 !important;
}

.popup-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(239, 68, 68, 0.22);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

/* ========================================================
   PWA & NAVEGAÇÃO MOBILE (EXPERIÊNCIA DE APP NATIVO)
   ======================================================== */

/* Botão de Instalar App no Header */
.btn-install-pwa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #ffffff;
  padding: 6px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.btn-install-pwa:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.45);
}

/* Backdrop escuro para fechar a sidebar no mobile ao tocar fora (oculto e inativo no Desktop) */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 29, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

@media (max-width: 1024px) {
  .sidebar-backdrop {
    display: block;
  }
  .sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
  }
}

@media (min-width: 1025px) {
  .sidebar-backdrop,
  .sidebar-backdrop.active {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* Barra de Navegação Inferior para Mobile (Bottom Navigation) */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 1000;
  align-items: center;
  justify-content: space-around;
  padding: 0 8px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}

.mobile-nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  min-width: 58px;
}

.mobile-nav-btn .nav-icon {
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.mobile-nav-btn:active .nav-icon {
  transform: scale(0.9);
}

.mobile-nav-btn.active {
  color: #60a5fa;
  background: rgba(59, 130, 246, 0.12);
}

.mobile-nav-btn.active .nav-icon {
  transform: translateY(-2px);
}

.mobile-filter-badge {
  position: absolute;
  top: 4px;
  right: 10px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.5);
}

/* ========================================================
   REGRAS RESPONSIVAS REFINADAS (MOBILE E TABLETS ATÉ 1024px)
   ======================================================== */
@media (max-width: 1024px) {
  /* 1. Liberação total de rolagem da página vertical/horizontal e zoom livre */
  html,
  body:not(.pricing-body) {
    overflow-x: auto !important;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100% !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y pinch-zoom !important;
  }

  .app-layout {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
  }

  .main-content {
    height: auto !important;
    min-height: 100% !important;
    min-height: 100dvh !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
    padding-bottom: 84px !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .tab-panels {
    height: auto !important;
    overflow: visible !important;
    flex: none !important;
  }

  .tab-panel {
    height: auto !important;
    overflow: visible !important;
    display: none;
    -webkit-overflow-scrolling: touch !important;
  }

  .tab-panel.active {
    display: block !important;
  }

  /* 2. Sidebar como gaveta (Drawer) deslizante */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: min(88vw, 380px) !important;
    min-width: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 9999 !important;
    transform: translateX(-100%) !important;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.6) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-backdrop {
    display: block !important;
    z-index: 9998 !important;
  }
  .sidebar-backdrop.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  /* 3. Header e controles visíveis */
  .top-header {
    padding: 10px 14px !important;
    gap: 8px !important;
    flex-wrap: wrap !important;
  }

  .btn-open-sidebar {
    display: inline-flex !important;
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
  }

  /* 4. Abas: rolagem horizontal suave */
  .view-tabs {
    display: flex !important;
    overflow-x: auto !important;
    scrollbar-width: thin !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 0 14px !important;
    gap: 4px !important;
    flex-shrink: 0 !important;
  }

  /* 5. Tabela de Transações: Rolagem horizontal e vertical fluida */
  .table-container-card {
    height: auto !important;
    padding: 12px 14px !important;
    overflow: visible !important;
  }

  .table-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    margin-bottom: 12px !important;
  }

  .table-toolbar .table-quick-sort,
  .table-toolbar .table-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    align-items: center !important;
    width: 100% !important;
  }

  .table-responsive {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-x pan-y pinch-zoom !important;
    width: 100% !important;
    max-width: 100% !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    min-height: 280px !important;
    margin-bottom: 14px !important;
    scrollbar-width: thin !important;
  }

  .data-table {
    width: 100% !important;
    min-width: 980px !important; /* Mantém as colunas legíveis com rolagem horizontal natural */
  }

  .data-table th,
  .data-table td {
    padding: 10px 12px !important;
    font-size: 0.8rem !important;
  }

  /* 6. Cards de KPI no tablet: 2 colunas */
  .kpi-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    overflow: visible !important;
  }

  /* Mapa responsivo */
  #map {
    min-height: calc(100vh - 240px);
  }

  .map-overlay-controls {
    top: 10px;
    left: 10px;
    right: 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .map-overlay-controls .btn-map-control {
    font-size: 0.74rem;
    padding: 6px 10px;
  }

  /* Modais adaptadas ao celular e tablet */
  .auth-modal-card {
    width: 94vw !important;
    max-width: 480px !important;
    max-height: 90vh !important;
    padding: 20px 16px !important;
  }

  .install-text {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* Exibe a barra de navegação inferior estilo App em smartphones */
  .mobile-bottom-nav {
    display: flex !important;
  }

  /* Oculta abas superiores para dar mais espaço de tela em celulares */
  .view-tabs {
    display: none !important;
  }

  .active-filters-summary {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Cards de KPI no celular: carrossel horizontal suave */
  .kpi-grid {
    display: flex !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory !important;
    gap: 10px !important;
    padding: 10px 12px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
  }
  .kpi-grid::-webkit-scrollbar {
    display: none !important;
  }

  .kpi-card {
    flex: 0 0 78vw !important;
    max-width: 290px !important;
    scroll-snap-align: start !important;
    padding: 12px 14px !important;
  }

  .kpi-value {
    font-size: 1.15rem !important;
  }

  .kpi-label {
    font-size: 0.72rem !important;
  }
}

@media (max-width: 480px) {
  .logo-box h2 {
    font-size: 1rem !important;
  }
  .btn-export {
    padding: 6px 9px !important;
    font-size: 0.75rem !important;
  }
  .btn-auth-open {
    padding: 6px 9px !important;
    font-size: 0.75rem !important;
  }
}

/* Botão Planos Pro no Header */
.btn-planos-header {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(168, 85, 247, 0.3));
  border: 1.5px solid #818cf8;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-planos-header:hover {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5);
  color: #ffffff;
}

@media (max-width: 640px) {
  .btn-planos-header .planos-text {
    display: none;
  }
  .btn-planos-header {
    padding: 6px 10px;
  }
}

/* ==============================================================================
   ESTILOS DE BLOQUEIO DE ASSINATURA (BANNER ABAIXO DA TABELA - NÃO COBRE DADOS)
   ============================================================================== */
.paywall-overlay,
.paywall-banner-bottom {
  position: relative !important;
  width: 100% !important;
  margin: 18px 0 !important;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  z-index: 10;
}

.paywall-card {
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 16px;
  padding: 24px 30px;
  max-width: 600px;
  width: 100%;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(245, 158, 11, 0.15);
  animation: paywallPulse 4s ease-in-out infinite alternate;
}

@keyframes paywallPulse {
  0% { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 20px rgba(99, 102, 241, 0.15); }
  100% { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 35px rgba(16, 185, 129, 0.25); }
}

.paywall-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
}

.paywall-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 8px 0;
}

.paywall-desc {
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 16px 0;
}

.paywall-features-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.btn-paywall-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.98rem;
  text-decoration: none;
  box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
  transition: all 0.2s ease;
}

.btn-paywall-cta:hover {
  background: linear-gradient(135deg, #34d399, #10b981);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(16, 185, 129, 0.6);
  color: #ffffff;
}

/* ==============================================================================
   MODAL LAUDO DE AVALIAÇÃO IMOBILIÁRIA (PDF / PRINT)
   ============================================================================== */
.modal-laudo-card {
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0;
}

.laudo-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.laudo-bar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: #f8fafc;
}

.btn-laudo-print {
  background: #3b82f6;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-laudo-print:hover { background: #2563eb; }

.btn-laudo-whatsapp {
  background: #10b981;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.2s ease;
}
.btn-laudo-whatsapp:hover { background: #059669; }

.laudo-printable-document {
  padding: 24px 28px;
  background: #0f172a;
  color: #f8fafc;
  font-family: 'Inter', sans-serif;
}

.laudo-header-doc {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #3b82f6;
  padding-bottom: 14px;
  margin-bottom: 20px;
}

.laudo-header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.laudo-header-logo h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #f8fafc;
}
.laudo-header-logo p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: #94a3b8;
}

.laudo-header-meta {
  text-align: right;
  display: flex;
  flex-direction: column;
}
.laudo-doc-id {
  font-size: 0.85rem;
  font-weight: 700;
  color: #38bdf8;
}
.laudo-doc-date {
  font-size: 0.75rem;
  color: #94a3b8;
}

.laudo-section {
  margin-bottom: 20px;
}

.laudo-section-title {
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #94a3b8;
  border-left: 3.5px solid #3b82f6;
  padding-left: 10px;
  margin: 0 0 12px 0;
}

.laudo-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.laudo-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.laudo-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 10px 14px;
  border-radius: 8px;
}
.laudo-box-lbl {
  font-size: 0.7rem;
  color: #94a3b8;
  text-transform: uppercase;
  display: block;
}
.laudo-box strong {
  font-size: 0.9rem;
  color: #f1f5f9;
}

.laudo-kpi {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 12px;
  border-radius: 8px;
  text-align: center;
}
.laudo-kpi-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  display: block;
}
.laudo-kpi-lbl {
  font-size: 0.72rem;
  color: #94a3b8;
  display: block;
  margin-top: 2px;
}

.laudo-result-highlight {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 78, 59, 0.4));
  border: 1.5px solid #10b981;
  border-radius: 12px;
  padding: 18px 22px;
}

.laudo-result-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.laudo-result-main h2 {
  font-size: 2rem;
  font-weight: 900;
  color: #10b981;
  margin: 2px 0;
  letter-spacing: -0.5px;
}
.laudo-result-sub {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 1px;
  color: #6ee7b7;
}
.laudo-result-note {
  font-size: 0.75rem;
  color: #a7f3d0;
}

.laudo-result-range {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 12px 18px;
  border-radius: 10px;
  text-align: right;
}
.laudo-range-lbl {
  font-size: 0.75rem;
  color: #94a3b8;
  display: block;
}
.laudo-result-range strong {
  font-size: 1.1rem;
  color: #f8fafc;
  font-weight: 800;
}

.laudo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 8px;
}
.laudo-table th {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 10px;
  color: #94a3b8;
  font-weight: 600;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.laudo-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
}

.laudo-footer-notes {
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 14px;
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.5;
}

.laudo-signature-box {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 20px;
}
.laudo-seal {
  border: 1.5px dashed #3b82f6;
  color: #38bdf8;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}
.laudo-sig-line {
  text-align: right;
}
.laudo-sig-line span {
  display: block;
  font-weight: 700;
  color: #f8fafc;
}
.laudo-sig-line small {
  font-size: 0.7rem;
  color: #64748b;
}

/* @media print para impressão limpa em PDF */
@media print {
  body * {
    visibility: hidden;
  }
  .modal-overlay#modalLaudo,
  .modal-overlay#modalLaudo * {
    visibility: visible;
  }
  .modal-overlay#modalLaudo {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: auto;
    background: #ffffff !important;
    display: block !important;
    padding: 0 !important;
  }
  .modal-laudo-card {
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    color: #000000 !important;
  }
  .no-print {
    display: none !important;
  }
  .laudo-printable-document {
    background: #ffffff !important;
    color: #0f172a !important;
    padding: 20px !important;
  }
  .laudo-header-logo h2, .laudo-box strong, .laudo-kpi-val, .laudo-sig-line span {
    color: #0f172a !important;
  }
  .laudo-box, .laudo-kpi {
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
  }
  .laudo-table th {
    background: #f1f5f9 !important;
    color: #334155 !important;
  }
  .laudo-table td {
    color: #0f172a !important;
    border-bottom: 1px solid #e2e8f0 !important;
  }
  .laudo-result-highlight {
    background: #ecfdf5 !important;
    border: 1.5px solid #10b981 !important;
  }
  .laudo-result-main h2 {
    color: #047857 !important;
  }
  .laudo-result-sub {
    color: #065f46 !important;
  }
  .laudo-result-range {
    background: #ffffff !important;
    border: 1px solid #10b981 !important;
  }
  .laudo-result-range strong {
    color: #0f172a !important;
  }
}

/* ==============================================================================
   ESTILOS DO MODAL DE BLOQUEIO APÓS 3 CONSULTAS
   ============================================================================== */
.modal-paywall-limit-card {
  max-width: 520px;
  width: 92%;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 20px;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(245, 158, 11, 0.2);
}

.paywall-limit-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid #f59e0b;
  color: #fbbf24;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.paywall-limit-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px 0;
}

.paywall-limit-desc {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0 0 20px 0;
}

.paywall-limit-benefits {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.benefit-icon {
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px;
  border-radius: 8px;
}

.benefit-item strong {
  display: block;
  font-size: 0.88rem;
  color: #f1f5f9;
}

.benefit-item small {
  display: block;
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 2px;
}

.btn-paywall-gold {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  font-weight: 800;
  padding: 14px;
  font-size: 0.98rem;
  border-radius: 12px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-paywall-gold:hover {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(245, 158, 11, 0.6);
  color: #ffffff;
}



