/* ==============================================================================
   Territorios Web - Hoja de Estilos UI (IDÉNTICO AL APP NATIVO)
   Tema Light + Púrpura Oficial #4A3B91 + Cards Blancas Flotantes
   ============================================================================== */

:root {
  --primary-purple: #4A3B91;
  --primary-light: #EDE9FE;
  --primary-hover: #3E2F80;
  --bg-app: #F8FAFC;
  --surface-card: rgba(255, 255, 255, 0.95);
  --border-light: rgba(226, 232, 240, 0.9);
  --text-dark: #1E293B;
  --text-muted: #64748B;
  --text-dim: #94A3B8;
  --accent-green: #059669;
  --whatsapp-green: #16A34A;
  --shadow-subtle: 0 2px 6px rgba(0, 0, 0, 0.12);
  --shadow-elevated: 0 4px 16px rgba(0, 0, 0, 0.16);
  --radius-full: 9999px;
  --radius-card: 14px;
  --radius-pill: 20px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --z-map: 1;
  --z-floating: 995;
  --z-drawer: 990;
  --z-modal: 1300;
  --z-toast: 1400;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-dark);
  user-select: none;
}

/* ------------------------------------------------------------------------------
   MAPA PRINCIPAL A PANTALLA COMPLETA
   ------------------------------------------------------------------------------ */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-map);
  background-color: #F8FAFC;
}

.leaflet-control-attribution {
  font-size: 10px !important;
  background: rgba(255, 255, 255, 0.8) !important;
  color: #64748B !important;
  border-radius: 4px 0 0 0;
  padding: 2px 6px !important;
}

/* Suavizado fluido de tiles e zoom do Leaflet */
.leaflet-fade-anim .leaflet-tile {
  will-change: opacity;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.leaflet-zoom-anim .leaflet-zoom-animated {
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

/* ------------------------------------------------------------------------------
   PARTE SUPERIOR: PAINEL FLUTUANTE EXATAMENTE COMO O APP
   Busca de Casas/Territórios em cima + Seletor de Território embaixo
   SEM FUNDO BRANCO EM VOLTA (apenas as duas barras flutuam sobre o mapa)
   ------------------------------------------------------------------------------ */
.floating-top-panel {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  max-width: 540px;
  margin: 0 auto;
  z-index: var(--z-floating);
  display: flex;
  flex-direction: column;
  gap: 7px;
  pointer-events: none;
}

/* 1. Barra de Busca Superior */
.search-box {
  pointer-events: auto;
  display: flex;
  align-items: center;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 14px;
  padding: 8px 14px;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s ease;
}

.search-box:focus-within {
  border-color: var(--primary-purple);
  box-shadow: 0 0 0 2px rgba(74, 59, 145, 0.2), var(--shadow-subtle);
}

.search-box-icon {
  color: #64748B;
  display: flex;
  align-items: center;
  margin-right: 8px;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-dark);
  font-size: 13.5px;
  font-weight: 500;
}

.search-input::placeholder {
  color: #94A3B8;
}

.clear-search-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  padding: 4px;
  display: none;
  align-items: center;
  justify-content: center;
}
.clear-search-btn:hover {
  color: var(--text-dark);
}

/* 2. Barra Seletora de Território */
.territory-selector-row {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.territory-selector-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: 7px 14px;
  cursor: pointer;
  box-shadow: var(--shadow-subtle);
  transition: all 0.2s ease;
  min-height: 44px;
}

.territory-selector-btn:hover {
  background-color: #FFFFFF;
}

.territory-btn-left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
}

.city-badge {
  display: flex;
  align-items: center;
  background-color: rgba(237, 233, 254, 0.95);
  padding: 3px 8px;
  border-radius: 6px;
  flex-shrink: 0;
}

.city-badge svg {
  color: var(--primary-purple);
  margin-right: 4px;
}

.city-badge-text {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--primary-purple);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.territory-btn-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-dark);
  letter-spacing: 0.3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chevron-box {
  width: 26px;
  height: 26px;
  border-radius: 13px;
  background-color: rgba(241, 245, 249, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-purple);
  flex-shrink: 0;
}



/* ------------------------------------------------------------------------------
   BOTÕES FLUTUANTES À DIREITA (GPS E CAMADA DO MAPA)
   Exatamente nas posições da imagem do app (top right abaixo da barra de busca)
   ------------------------------------------------------------------------------ */
.map-controls-stack {
  position: absolute;
  right: 14px;
  top: 118px;
  z-index: var(--z-floating);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.92);
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(203, 213, 225, 0.85);
  box-shadow: var(--shadow-subtle);
  display: flex;
  cursor: pointer;
  color: var(--primary-purple);
  transition: all 0.2s ease;
}

.map-control-btn:hover {
  background-color: #FFFFFF;
  border-color: var(--primary-purple);
}

/* ------------------------------------------------------------------------------
   GAVETA RETRÁTIL INFERIOR DE CASAS DO TERRITÓRIO
   Exatamente igual ao bottomDrawerContainer do MapScreen.tsx
   ------------------------------------------------------------------------------ */
.bottom-drawer-container {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  max-width: 580px;
  margin: 0 auto;
  background-color: rgba(255, 255, 255, 0.95);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
  padding: 8px 14px 12px 14px;
  max-height: 82%;
  box-shadow: var(--shadow-elevated);
  border: 1px solid var(--border-light);
  z-index: var(--z-drawer);
  display: flex;
  flex-direction: column;
  transition: max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1), transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), padding 0.35s ease, box-shadow 0.35s ease;
}

.bottom-drawer-container.collapsed {
  max-height: 98px;
  padding-bottom: 8px;
}

.bottom-drawer-container.collapsed .drawer-houses-scroll,
.bottom-drawer-container.collapsed .drawer-bottom-buttons-row,
.bottom-drawer-container.collapsed .create-route-primary-btn,
.bottom-drawer-container.collapsed .drawer-toolbar-row {
  display: none !important;
}

.drawer-handle-bar-touch {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  margin-bottom: 4px;
  cursor: pointer;
}

.drawer-handle-pill {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background-color: #CBD5E1;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(241, 245, 249, 0.85);
  margin-bottom: 8px;
}

.drawer-header-left {
  display: flex;
  align-items: center;
  flex: 1;
  margin-right: 8px;
}

.drawer-territory-badge {
  background-color: rgba(237, 233, 254, 0.9);
  padding: 4px 9px;
  border-radius: 6px;
  color: var(--primary-purple);
  font-weight: 800;
  font-size: 13px;
}

.drawer-territory-badge.route-badge {
  background-color: var(--primary-purple);
  color: #FFFFFF;
}

.drawer-header-titles {
  flex: 1;
  margin-left: 8px;
}

.drawer-title-text {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
}

.drawer-subtitle-text {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.drawer-close-btn {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background-color: #F1F5F9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  cursor: pointer;
}

/* Toolbar Modo Rota: Inverter e Auto-Otimizar */
.drawer-toolbar-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(241, 245, 249, 0.85);
  margin-bottom: 6px;
}

.drawer-tool-btn {
  display: flex;
  align-items: center;
  background-color: rgba(241, 245, 249, 0.9);
  padding: 4px 8px;
  border-radius: 6px;
  border: none;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--primary-purple);
  cursor: pointer;
  gap: 4px;
}

.drawer-drag-hint {
  font-size: 10px;
  color: #94A3B8;
  margin-left: auto;
  font-style: italic;
}

/* Lista de Casas no Drawer */
.drawer-houses-scroll {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 6px;
}

.drawer-house-row-normal {
  display: flex;
  align-items: center;
  padding: 7px 8px;
  background-color: rgba(248, 250, 252, 0.85);
  border-radius: 8px;
  border: 1px solid rgba(226, 232, 240, 0.85);
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-house-row-normal:hover, .drawer-house-row-normal.active {
  background-color: rgba(237, 233, 254, 0.92);
  border-color: var(--primary-purple);
}

.normal-house-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background-color: rgba(237, 233, 254, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-purple);
  margin-right: 8px;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.house-text-content-area {
  flex: 1;
  min-width: 0;
}

.house-row-street {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.house-row-subtext {
  font-size: 10.5px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.gps-row-btn {
  color: var(--primary-purple);
  display: flex;
  align-items: center;
  padding: 4px;
}

/* Botão Principal Criar Rota */
.create-route-primary-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-purple);
  border: none;
  border-radius: 10px;
  padding: 12px;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 6px;
  box-shadow: 0 3px 6px rgba(74, 59, 145, 0.28);
  gap: 8px;
}

.drawer-bottom-buttons-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.drawer-action-btn-half {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  padding: 12px;
  border: none;
  color: #FFFFFF;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  gap: 6px;
}

.drawer-maps-btn {
  background-color: var(--primary-purple);
}

.drawer-whatsapp-btn {
  background-color: var(--whatsapp-green);
}

/* ------------------------------------------------------------------------------
   MODAL DE SELEÇÃO DE TERRITÓRIOS (PASTAS DE CIDADES E BLOCOS)
   ------------------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: none !important;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay.show {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

.modal-card-bottom {
  width: 100%;
  max-width: 580px;
  max-height: 88vh;
  background: rgba(255, 255, 255, 0.98);
  border-top-left-radius: 22px;
  border-top-right-radius: 22px;
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.modal-overlay.show .modal-card-bottom {
  transform: translateY(0);
}

.modal-handle-pill {
  width: 38px;
  height: 4px;
  border-radius: 2px;
  background-color: #CBD5E1;
  margin: 10px auto 4px auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 12px 16px;
  border-bottom: 1px solid #F1F5F9;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-dark);
}

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

.modal-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background-color: #F1F5F9;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748B;
  cursor: pointer;
}

.modal-search-box {
  display: flex;
  align-items: center;
  background-color: rgba(248, 250, 252, 0.85);
  margin: 10px 16px 8px 16px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
}

.modal-search-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  color: var(--text-dark);
}

.territory-list-scroll {
  padding: 0 16px 24px 16px;
  overflow-y: auto;
  flex: 1;
}

/* Card "TODOS LOS TERRITORIOS" */
.all-territories-card {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background-color: rgba(248, 250, 252, 0.85);
  border: 1.5px solid var(--border-light);
  margin: 8px 0 10px 0;
  cursor: pointer;
}

.all-territories-card.selected {
  background-color: #F5F3FF;
  border-color: var(--primary-purple);
}

.all-territories-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background-color: #EDE9FE;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-purple);
  margin-right: 12px;
}

.all-territories-card.selected .all-territories-icon-box {
  background-color: var(--primary-purple);
  color: #FFFFFF;
}

.all-territories-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-dark);
}
.all-territories-card.selected .all-territories-title {
  color: var(--primary-purple);
}

.all-territories-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Seção de Cidade (Pasta Expansiva) */
.city-section {
  margin-bottom: 8px;
}

.city-section-header-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(248, 250, 252, 0.9);
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  cursor: pointer;
  margin-bottom: 8px;
}

.city-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.city-folder-icon-box {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background-color: #F1F5F9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-purple);
}

.city-section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.city-count-badge {
  background-color: rgba(255, 255, 255, 0.9);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid rgba(226, 232, 240, 0.8);
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-purple);
  margin-right: 8px;
}

.city-chevron-box {
  color: var(--primary-purple);
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}

.city-section.open .city-chevron-box {
  transform: rotate(180deg);
}

/* Grid de Territórios dentro da Cidade */
.territory-grid {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 2px 8px 2px;
  animation: fadeInAccordion 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fadeInAccordion {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.city-section.open .territory-grid {
  display: flex;
}

.territory-item-sigla {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1.5px solid var(--border-light);
  border-radius: 10px;
  height: 44px;
  padding: 0 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: all 0.15s ease;
  width: 23%; /* 4 por linha padrão */
}

.territory-item-sigla.span-2 {
  width: 48.5%; /* 2 blocos de largura para nomes longos */
}

.territory-item-sigla:hover {
  border-color: var(--primary-purple);
}

.territory-item-sigla.selected {
  background-color: var(--primary-purple);
  border-color: var(--primary-purple);
  box-shadow: 0 2px 6px rgba(74, 59, 145, 0.35);
}

.territory-sigla-text {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: 0.3px;
  text-align: center;
}

.territory-item-sigla.selected .territory-sigla-text {
  color: #FFFFFF;
}

/* ------------------------------------------------------------------------------
   MODAL DE DETALHES DE CASA (FICHA IDÊNTICA AO APP NATIVO - IMAGEM 2)
   ------------------------------------------------------------------------------ */
.modal-overlay.floating-bottom-sheet {
  align-items: flex-end;
  padding: 0 16px 20px 16px;
  background: transparent !important; /* Totalmente transparente */
  backdrop-filter: none !important; /* SEM BLUR */
  -webkit-backdrop-filter: none !important;
  pointer-events: none;
}

.modal-overlay.floating-bottom-sheet.show {
  pointer-events: none !important;
}

.modal-overlay.floating-bottom-sheet.show .house-detail-sheet-card {
  pointer-events: auto !important;
}

.drawer-house-row-normal.dragging {
  opacity: 0.45;
  background-color: #EDE9FE !important;
  border: 1.5px dashed var(--primary-purple);
}

.drawer-house-row-normal.drag-over {
  border-top: 2px solid var(--primary-purple);
}

.drag-handle-touch {
  color: #64748B;
  font-size: 18px;
  cursor: grab;
  padding: 6px 8px;
  user-select: none;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drag-handle-touch:active {
  cursor: grabbing;
}

.house-detail-sheet-card {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  background-color: #FFFFFF;
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(226, 232, 240, 0.95);
  display: flex;
  flex-direction: column;
  animation: slideUpHouseCard 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

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

.house-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.city-badge-row {
  display: flex;
  align-items: center;
  margin-bottom: 3px;
}

.house-sheet-city-badge {
  font-size: 10px;
  font-weight: 800;
  color: #64748B;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.house-sheet-title {
  font-size: 17px;
  font-weight: 900;
  color: var(--primary-purple);
  letter-spacing: -0.2px;
}

.modal-close-btn-rounded {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: #EDE9FE;
  color: var(--primary-purple);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  transition: all 0.15s ease;
}

.modal-close-btn-rounded:hover {
  background-color: #DDD6FE;
}

/* Card Branco com Borda Suave para as Informações de Endereço */
.address-section-card {
  background-color: #FFFFFF;
  border-radius: 12px;
  border: 1px solid #E2E8F0;
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.address-field-row {
  display: flex;
  flex-direction: column;
}

.field-label {
  font-size: 9px;
  font-weight: 800;
  color: #64748B;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.street-value-text {
  font-size: 14.5px;
  font-weight: 800;
  color: var(--text-dark);
}

.two-column-row {
  display: flex;
  align-items: center;
}

.vertical-divider-line {
  width: 1px;
  height: 26px;
  background-color: #E2E8F0;
  margin: 0 14px;
}

.number-value-text {
  font-size: 14px;
  font-weight: 800;
  color: var(--primary-purple);
}

.neighborhood-value-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dark);
}

.territory-value-text {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-dark);
}

.divider-line {
  height: 1px;
  background-color: #F1F5F9;
  margin: 2px 0;
}

.obs-highlight-text {
  font-size: 13.5px;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.4;
}

/* Botão "Ver todas las casas de SJ01" */
.btn-view-all-houses {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #EDE9FE;
  border: 1px solid #DDD6FE;
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--primary-purple);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  margin-bottom: 10px;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-view-all-houses:hover {
  background-color: #DDD6FE;
}

/* Linha de Ações: WhatsApp (Verde) e Google Maps (Roxo) */
.house-detail-buttons-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-house-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 14px;
  border-radius: 10px;
  border: none;
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
  cursor: pointer;
  gap: 6px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.btn-house-action:active {
  transform: scale(0.98);
}

.btn-action-whatsapp {
  background-color: #10B981; /* Verde exato da imagem 2 */
}

.btn-action-whatsapp:hover {
  background-color: #059669;
}

.btn-action-maps {
  background-color: #4A3B91; /* Roxo exato da imagem 2 */
}

.btn-action-maps:hover {
  background-color: #3E2F80;
}



/* ------------------------------------------------------------------------------
   PINES DEL MAPA (LEAFLET CUSTOM PINS - IDÉNTICOS A OSMMapViewer.tsx)
   ------------------------------------------------------------------------------ */
.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #FFFFFF;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease, box-shadow 0.28s ease;
  cursor: pointer;
  opacity: 0.95;
  will-change: transform, opacity;
  box-sizing: border-box;
}

.pin-label {
  color: #FFFFFF;
  font-family: var(--font-sans);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  user-select: none;
  text-align: center;
}

.custom-pin.dimmed {
  opacity: 0.38;
  transform: scale(0.85);
}

.custom-pin:hover {
  transform: scale(1.25);
  opacity: 1 !important;
  z-index: 900 !important;
}

.custom-pin.selected,
.custom-pin.dimmed.selected {
  transform: scale(1.45) !important;
  border: 2.5px solid #FFFFFF !important;
  box-shadow: 0 0 0 3.5px #4A3B91, 0 4px 12px rgba(74, 59, 145, 0.7) !important;
  z-index: 99999 !important;
  opacity: 1 !important;
}

/* Localização do Usuário (GPS) */
.user-pin-container {
  position: relative;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-pin-pulse {
  position: absolute;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.35);
  animation: user-pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.user-pin-core {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2563EB;
  border: 3px solid #FFFFFF;
  box-shadow: 0 0 10px rgba(37, 99, 235, 0.7), 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

@keyframes user-pulse-ring {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Toasts */
#toast-container {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-pill {
  background: rgba(30, 41, 59, 0.92);
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: toastFadeIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes toastFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ------------------------------------------------------------------------------
   RESPONSIVIDADE: VERSÃO DESKTOP / COMPUTADOR (ESTILO GOOGLE MAPS NA ESQUERDA)
   No mobile/celular nada muda (mantém 100% o estilo original do app).
   ------------------------------------------------------------------------------ */
@media (min-width: 768px) {
  /* Painel superior de busca e seletor: posicionado na esquerda */
  .floating-top-panel {
    top: 16px;
    left: 16px;
    right: auto;
    width: 400px;
    max-width: 400px;
    margin: 0;
    z-index: 2600;
  }

  /* Modal de seleção de territórios: painel lateral na esquerda, logo abaixo da barra superior */
  #territory-modal-overlay.modal-overlay {
    display: none !important;
    align-items: flex-start;
    justify-content: flex-start;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none;
    z-index: 2500;
  }

  #territory-modal-overlay.modal-overlay.show {
    display: flex !important;
    pointer-events: auto;
  }

  #territory-modal-overlay .modal-card-bottom {
    position: absolute;
    top: 118px;
    left: 16px;
    bottom: auto;
    width: 400px;
    max-width: 400px;
    max-height: calc(100vh - 134px);
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
    transform: translateX(-110%);
    transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 2500;
    pointer-events: none;
    overflow-y: auto;
  }

  #territory-modal-overlay.modal-overlay.show .modal-card-bottom {
    transform: translateX(0);
    pointer-events: auto;
  }

  #territory-modal-overlay .modal-handle-pill {
    display: none !important;
  }

  /* Gaveta de casas do território: altura dinâmica, sem void em branco, abaixo da barra superior */
  .bottom-drawer-container {
    position: absolute;
    top: 118px;
    left: 16px;
    bottom: auto;
    right: auto;
    width: 400px;
    max-width: 400px;
    max-height: calc(100vh - 134px);
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 2400;
    margin: 0;
    padding: 14px 16px;
    overflow-y: auto;
    transition: max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease;
  }

  /* Quando colapsada no desktop */
  .bottom-drawer-container.collapsed {
    max-height: 80px;
    height: auto;
    bottom: auto;
  }

  .drawer-handle-bar-touch,
  .bottom-drawer-container .drawer-handle-bar {
    display: none !important;
  }

  /* Ficha de detalhes da casa: painel lateral na esquerda, invisível quando fechada */
  #house-modal-overlay.modal-overlay.floating-bottom-sheet {
    display: none !important;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0;
    top: 118px;
    left: 16px;
    bottom: auto;
    right: auto;
    width: 400px;
    height: auto;
    max-height: calc(100vh - 134px);
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    pointer-events: none !important;
    z-index: 2500;
  }

  #house-modal-overlay.modal-overlay.show {
    display: flex !important;
    pointer-events: auto !important;
  }

  .house-detail-sheet-card {
    width: 400px;
    max-width: 400px;
    max-height: calc(100vh - 134px);
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.08);
    margin: 0;
    pointer-events: none;
    animation: slideInLeftHouseCard 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }

  @keyframes slideInLeftHouseCard {
    from {
      transform: translateX(-35px);
      opacity: 0;
    }
    to {
      transform: translateX(0);
      opacity: 1;
    }
  }

  #house-modal-overlay.modal-overlay.show .house-detail-sheet-card {
    pointer-events: auto !important;
  }

  .house-detail-sheet-card .sheet-handle-pill {
    display: none !important;
  }

  /* Ajuste dos controles de mapa (GPS e Camada) no desktop */
  .map-controls-stack {
    top: 24px;
    right: 24px;
  }
}
