/* ========================================
   INOVAR - LOTEAMENTOS STYLESHEET
   ======================================== */

:root {
  --page-bg: #FFFFFF;
  --surface: #F9F9F9;
  --surface-alt: #FFFFFF;
  
  --border-soft: #E6E6E6;
  --border-mid: #CCCCCC;
  --border-dark: #333333;
  
  --text-primary: #0D0D0D;
  --text-secondary: #666666;
  --text-muted: #999999;
  
  --brand-red: #D42B2B;
  --brand-red-dark: #A82020;
  --brand-red-light: #E94545;
  --brand-red-glow: rgba(212, 43, 43, 0.35);
  
  --status-avail: #1E7E34;
  --status-avail-bg: #EBF7ED;
  --status-amber: #E1A032;
  --status-amber-bg: #FFF9EF;

  --radius: 16px;
  --radius-sm: 8px;

  --transition-fast: 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Page Spacing Below Absolute Header */
.loteamentos-hero-section {
  padding-top: 100px;
  padding-bottom: 24px;
  background: var(--page-bg);
  border-bottom: 1px solid var(--border-soft);
}

.loteamentos-header-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.loteamento-meta-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
}

.loteamento-title-box h1 {
  font-family: var(--font-display);
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.loteamento-title-box p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.loteamento-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* --- 1-Line Controls Bar --- */
.loteamento-controls-bar {
  padding: 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
  scrollbar-width: none;
}

.loteamento-controls-bar::-webkit-scrollbar {
  display: none;
}

/* Mesma caixa do cabeçalho e do conteúdo principal: recuo no próprio
   elemento, não na barra, senão a barra de filtro fica desalinhada dos
   demais blocos da página. */
.controls-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  white-space: nowrap;
}

/* Site's existing component styling: .segmented & .seg-btn */
.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--page-bg);
  border: 1px solid var(--border-soft);
  border-radius: 50px;
  padding: 3px;
  gap: 2px;
}

.seg-btn {
  height: 36px;
  padding: 0 16px;
  background: transparent;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.seg-btn:hover {
  color: var(--text-primary);
}

.seg-btn.active {
  background: var(--brand-red);
  color: #FFFFFF;
  box-shadow: 0 2px 8px var(--brand-red-glow);
}

/* Filter Switch Toggle */
.filter-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.switch-track {
  width: 44px;
  height: 24px;
  background: var(--border-mid);
  border-radius: 50px;
  position: relative;
  transition: background var(--transition-fast);
}

.switch-thumb {
  width: 18px;
  height: 18px;
  background: #FFFFFF;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast);
}

.filter-switch.active .switch-track {
  background: var(--brand-red);
}

.filter-switch.active .switch-thumb {
  transform: translateX(20px);
}

.avail-counter {
  font-size: 12px;
  color: var(--brand-red);
  font-weight: 700;
  margin-left: 2px;
}

/* --- Map Viewport & Prancha Grid Surface --- */
.loteamento-main-section {
  position: relative;
  padding: 24px 0;
  background: var(--page-bg);
}

/* Mesma caixa do .loteamentos-header-container (max-width + padding no
   próprio elemento). Antes o recuo vinha da seção-mãe e o conteúdo do mapa
   começava 20px à esquerda do cabeçalho. */
.main-layout-container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

/* A moldura precisa ter PROPORÇÃO, não altura fixa: o motor enquadra a
   planta dentro dela, e a planta é uma faixa de 292x124 (2,35:1). Com
   min-height:58dvh o quadro ficava 358x490 num celular — proporção 0,73
   para um desenho 2,35 — e o desenho encolhia para caber, boiando num
   vazio enorme. O --map-ar é escrito pelo JS: 2,35 na visão geral, 1,7
   quando um conjunto de lotes está em foco. */
.map-prancha-surface {
  position: relative;
  width: 100%;
  aspect-ratio: var(--map-ar, 2.35);
  min-height: 150px;
  max-height: var(--map-maxh, 46dvh);
  /* Planta alta: o JS calcula a largura a partir da altura máxima e da
     proporção, e a moldura fica centrada em vez de esticar. */
  max-width: var(--map-maxw, 100%);
  margin-inline: auto;
  transition: aspect-ratio var(--transition-smooth);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.02), 0 2px 10px -4px rgba(30,25,15,0.16);
  overflow: hidden;
  /* INVARIANTE: pan-y — arrasto vertical rola a PÁGINA. Sem isso o dedo
     fica preso no mapa. A trava de direção fina está no JS. */
  touch-action: pan-y;
  user-select: none;
}

.prancha-grid-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(to right, var(--border-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border-soft) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 1;
}

#svgPlant {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 2;
  cursor: grab;
}
#svgPlant.dragging { cursor: grabbing; }

/* Ruas e sombra dos disponíveis */
.road { fill: #E5E3DD; }
.road-curb { fill: none; stroke: #FFFFFF; stroke-width: 0.8; opacity: 0.75; }
.road-line { stroke: #FFFFFF; stroke-width: 0.7; stroke-dasharray: 4.5 4; fill: none; opacity: 0.85; }
.shadow-poly { fill: rgba(30, 25, 15, 0.07); }
.compass-n {
  font-family: var(--font-body); font-weight: 700; font-size: 9px;
  letter-spacing: 0.1em; fill: #A9A79F; text-anchor: middle;
}

/* Map Bar Below Map */
.map-bar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 12px;
  padding: 0 4px;
}

.status-legend-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.dot-color.disponivel { background: var(--status-avail); }
.dot-color.consultar { background: #FFFFFF; border: 1px solid var(--border-dark); }
.dot-color.reservado { background: var(--status-amber); }
.dot-color.vendido { background: var(--border-mid); }
.dot-color.indisponivel { background: repeating-linear-gradient(45deg, #D8D4CC 0 3px, #ECE9E2 3px 6px); }

.zoom-btn-cluster {
  display: inline-flex;
  gap: 6px;
}

.btn-zoom {
  width: 44px;
  height: 44px;
  background: #FFFFFF;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  transition: all var(--transition-fast);
}

.btn-zoom:hover {
  border-color: var(--brand-red);
  color: var(--brand-red);
}

/* --- Botão de tela cheia (mobile primeiro) ------------------------- */
.btn-ampliar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 0 18px;
  border: 1.5px solid var(--border-mid);
  border-radius: 50px;
  background: var(--page-bg);
  font-family: var(--font-body);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}
.btn-ampliar:hover { border-color: var(--brand-red); color: var(--brand-red); }
.btn-ampliar:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }

/* --- Tela cheia da planta ------------------------------------------
   O palco tem as dimensões TROCADAS (100dvh de largura por 100dvw de
   altura) e é girado 90°: assim a faixa larga da planta usa o lado
   comprido da tela. Como o palco é girado depois de dimensionado, o
   clientWidth/clientHeight que o motor lê já são os de paisagem e o
   enquadramento funciona sem gambiarra.
   Quando o aparelho JÁ está deitado, não gira nada. */
/* Nos dois: só no body a barra de rolagem do html continua ocupando
   largura e o palco passa a medir mais que a área visível.
   O position:fixed é o que realmente segura o Safari do iPhone —
   overflow:hidden sozinho não impede a página de rolar por baixo, e era
   isso que fazia o mapa "pular" durante o arrasto. O JS guarda e devolve
   o scrollY. */
html.fs-aberta { overflow: hidden; }
body.fs-aberta {
  overflow: hidden;
  position: fixed;
  left: 0;
  width: 100%;
}

/* Largura/altura em dvw/dvh, NÃO inset:0. O palco mede 100dvh x 100dvw e,
   se a sobreposição usasse outra base de medida, os dois discordariam e o
   palco ficaria centrado fora da tela — que foi o que aconteceu. Mesma
   unidade nos dois, mesma referência. */
.map-fs {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 1200;
  background: #14130F;
  opacity: 0;
  transition: opacity 0.22s var(--transition-fast);
}
.map-fs.aberta { opacity: 1; }

.map-fs-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100dvh;
  height: 100dvw;
  transform: translate(-50%, -50%) rotate(90deg);
  display: flex;
  flex-direction: column;
  background: var(--page-bg);
}

/* Virada para o outro lado, para quem gira o aparelho no sentido oposto. */
.map-fs-stage.inverso { transform: translate(-50%, -50%) rotate(-90deg); }

/* Girar só ajuda quando a forma da planta briga com a da tela. O JS põe
   .sem-giro quando a planta já está na orientação certa — é o caso do
   Araras II, alto e estreito, numa tela em pé. Sem isto o CSS girava
   sempre, e a lógica de gesto do JS discordava do que estava na tela. */
.map-fs-stage.sem-giro,
.map-fs-stage.sem-giro.inverso {
  width: 100dvw;
  height: 100dvh;
  transform: translate(-50%, -50%);
}
.map-fs-stage.sem-giro .btn-girar-fs { display: none; }

@media (orientation: landscape) {
  /* Aparelho já deitado (rotação do sistema destravada): a faixa larga
     não precisa girar, e o botão de virar não faz sentido. */
  .map-fs-stage,
  .map-fs-stage.inverso {
    width: 100dvw;
    height: 100dvh;
    transform: translate(-50%, -50%);
  }
  .btn-girar-fs { display: none; }

  /* Deitado é o inverso: aí quem precisa girar é a planta alta. */
  .map-fs-stage.gira-deitado {
    width: 100dvh;
    height: 100dvw;
    transform: translate(-50%, -50%) rotate(90deg);
  }
  .map-fs-stage.gira-deitado.inverso { transform: translate(-50%, -50%) rotate(-90deg); }
  .map-fs-stage.gira-deitado .btn-girar-fs { display: inline-flex; }
}

.btn-girar-fs {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: var(--page-bg);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.btn-girar-fs:hover { border-color: var(--brand-red); color: var(--brand-red); }

/* O mapa ocupa o palco inteiro; a moldura perde proporção fixa aqui. */
.map-fs-stage .map-prancha-surface {
  flex: 1;
  aspect-ratio: auto;
  min-height: 0;
  max-height: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  /* Em tela cheia não há página atrás para rolar: o mapa fica com os dois
     eixos do gesto. */
  touch-action: none;
}

/* z-index 5: o #svgPlant tem z-index 2 e o palco cria contexto de
   empilhamento (por causa do transform). Sem isto o mapa pinta por cima
   da interface e o X não recebe toque nenhum. */
.map-fs-ui {
  position: absolute;
  z-index: 5;
  top: 0; left: 0; right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(to bottom, rgba(255,255,255,0.96), rgba(255,255,255,0));
  pointer-events: none;
}

.map-fs-titulo {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-right: 8px;
}

.btn-fechar-fs {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  background: var(--page-bg);
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}
.btn-fechar-fs:hover { border-color: var(--brand-red); color: var(--brand-red); }

.map-fs-dica {
  position: absolute;
  z-index: 5;
  bottom: 10px; left: 0; right: 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-muted);
  pointer-events: none;
}

/* A gaveta é MOVIDA para dentro do palco em tela cheia. Fora dele ela
   ficaria atrás da sobreposição (z-index 900 contra 1200) e não giraria
   junto com o mapa. Os !important vencem a regra de desktop, que fixa
   transform:none para transformar a gaveta em painel lateral. */
.map-fs-stage .detail-drawer {
  position: absolute !important;
  z-index: 6;
  left: 0; right: 0; bottom: 0;
  top: auto;
  width: auto;
  /* Deitado, a tela tem pouca altura: a ficha não pode comer mais que a
     metade dela ou o mapa some atrás. */
  max-height: 52%;
  border: 0;
  border-top: 1px solid var(--border-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.16);
  transform: translateY(102%) !important;
  transition: transform var(--transition-smooth);
}
.map-fs-stage .detail-drawer.open { transform: translateY(0) !important; }
.map-fs-stage .drawer-drag-handle { display: block; }
/* Alvo de toque de 44px: em tela cheia se usa o polegar, e os 36px do
   painel de desktop ficam pequenos demais. */
.map-fs-stage .btn-nav-arrow,
.map-fs-stage .drawer-close-btn { width: 44px; height: 44px; }

/* --- Ficha DEITADA em tela cheia ---------------------------------
   Empilhada na vertical ela pedia 218px num espaço de 194 e obrigava a
   rolar para ver o preço. Deitado sobram 844px de LARGURA e falta
   altura, então medidas e valor vão lado a lado: cabe inteira, sem
   rolagem. O overflow:auto fica só como rede de segurança. */
.map-fs-stage .drawer-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 20px;
  row-gap: 8px;
  padding: 6px 18px 12px;
}
.map-fs-stage .drawer-header { grid-column: 1 / -1; margin-bottom: 0; }
.map-fs-stage .drawer-specs-grid {
  grid-column: 1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.map-fs-stage .drawer-footer {
  grid-column: 2;
  border-top: 0;
  padding-top: 0;
  gap: 16px;
}
.map-fs-stage .btn-house-link { grid-column: 1 / -1; margin-top: 0; }

.map-fs-stage .spec-box { padding: 6px 10px; }
.map-fs-stage .spec-box .label { font-size: 10px; }
.map-fs-stage .spec-box .value { font-size: 14px; margin-top: 1px; }
.map-fs-stage .price-tag .amount { font-size: 20px; }
.map-fs-stage .drawer-title-box h2 { font-size: 19px; }
.map-fs-stage .dw-sold-note, .map-fs-stage .price-tag .label { font-size: 10.5px; }

@media (min-width: 1024px) {
  .btn-ampliar { width: fit-content; margin: 10px 0 0 auto; min-height: 40px; font-size: 13px; }
}

/* --- SVG Lot Elements & Light Theme Status Styling --- */
.lot-group {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

/* As larguras de traço são em unidades do desenho (metros), não px: o
   viewBox escala tudo. Valores de 1,5 deixavam a borda com 1,5m de
   espessura e engoliam o lote no zoom de longe. */
.lot-visual.disponivel { fill: #D8EED0; stroke: #4A8A3E; stroke-width: 0.75; }
.lot-visual.consultar  { fill: #FDFDFC; stroke: #B0ADA5; stroke-width: 0.55; }
.lot-visual.reservado  { fill: url(#hatchPattern); stroke: #C0912F; stroke-width: 0.7; stroke-dasharray: 3 2.2; }
.lot-visual.vendido    { fill: #E6E5E1; stroke: #CFCDC8; stroke-width: 0.5; }
/* Fora do mercado: precisa aparecer no desenho (senão o mapa fica com
   buraco) mas não pode competir com o que está à venda. */
.lot-visual.indisponivel { fill: #EFEDE8; stroke: #D5D1C9; stroke-width: 0.45; }

/* Vermelho institucional é EXCLUSIVO de interação — nunca indica status. */
.lot-group:hover .lot-visual,
.lot-group.hovered .lot-visual,
.lot-group.selected .lot-visual {
  fill: #FFF6F6;
  stroke: var(--brand-red);
  stroke-width: 1.6;
  stroke-dasharray: none;
}
.lot-group.selected .lot-visual {
  filter: drop-shadow(0 1.5px 4px var(--brand-red-glow));
}

.lot-hit-target {
  fill: transparent;
  stroke: transparent;
  vector-effect: non-scaling-stroke;
  pointer-events: all;
}

/* ⚠️ Os tamanhos abaixo estão pareados com as constantes do
   loteamentos.js (NUM_SIZE 13 · AREA_SIZE 10 · AREA_Y 16) e com os
   'extent' de cada rótulo fixo. Mudar aqui sem mudar lá quebra o teste
   de encaixe: rótulo passa a aparecer espremido ou some sem motivo. */
.lot-num {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  fill: var(--text-primary);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.lot-area {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 10px;
  fill: var(--text-muted);
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.lot-visual.disponivel + .lot-label .lot-num { fill: #1F4A1A; }
.lot-visual.disponivel + .lot-label .lot-area { fill: #4C8A42; }
.lot-group.selected .lot-num { fill: var(--brand-red); }
.lot-num, .lot-area { transition: opacity 0.2s ease; }

.road-name {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 9.5px;
  fill: #8E8C85;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.green-label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 7.5px;
  fill: #5F7A55;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.lot-group.dimmed {
  opacity: 0.15;
  pointer-events: none;
}

/* --- Detail Drawer & Side Panel --- */
/* No celular a gaveta só sobe quando há ficha: o texto de
   "escolha um lote" não tem função e é escondido. */
.drawer-vazio { display: none; }

.detail-drawer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 48vh;
  max-height: 48dvh;
  background: var(--surface-alt);
  border-top: 1px solid var(--border-soft);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
  z-index: 900;
  transform: translateY(100%);
  transition: transform var(--transition-smooth);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.detail-drawer.open {
  transform: translateY(0);
}

.drawer-drag-handle {
  width: 36px;
  height: 4px;
  background: var(--border-mid);
  border-radius: 2px;
  margin: 10px auto 2px;
}

.drawer-content {
  padding: 16px 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.lot-nav-arrows {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-nav-arrow {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-nav-arrow:hover {
  border-color: var(--brand-red);
  color: var(--brand-red);
}

.drawer-title-box h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.drawer-close-btn {
  width: 36px;
  height: 36px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
}

.drawer-specs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.spec-box {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.spec-box .label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.spec-box .value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.price-tag .label {
  font-size: 11px;
  color: var(--text-secondary);
}

.price-tag .amount {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.btn-whatsapp-lote {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  background: #25D366;
  color: #FFFFFF;
  border-radius: 50px;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.25);
  transition: transform var(--transition-fast);
}

.btn-whatsapp-lote:hover {
  transform: translateY(-2px);
}

.btn-house-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--brand-red);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.btn-house-link:hover {
  text-decoration: underline;
}

/* Desktop 2-Column Layout (>1024px) */
@media (min-width: 1024px) {
  .main-layout-container {
    display: grid;
    /* NÃO usar porcentagens que somem 100%: o gap é somado por cima delas e
       a grade estoura o container. Com 65%+35%+24px, o painel lateral, a
       tabela e a localização terminavam 24px fora da caixa, desalinhados do
       cabeçalho. Em fr o gap já sai da conta. O minmax(0,...) impede que o
       conteúdo do mapa force a coluna a crescer. */
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 24px;
    align-items: start;
  }

  /* Sticky top: 16px calibrated for absolute header */
  .map-column {
    position: sticky;
    top: 16px;
  }

  .detail-drawer {
    position: relative;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: none;
    border-radius: var(--radius);
    border: 1px solid var(--border-soft);
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  }

  .drawer-drag-handle {
    display: none;
  }

  /* No desktop o painel fica sempre visível ao lado do mapa. Sem lote
     escolhido ele era uma caixa branca vazia do lado do mapa, sem dizer
     o que fazer. O texto abaixo é do próprio CSS: aparece só enquanto
     não há ficha dentro, e some sozinho quando o JS preenche o painel. */
  .detail-drawer {
    min-height: 220px;
  }

  .drawer-vazio {
    display: block;
    margin: 0;
    padding: 28px 24px;
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text-muted);
    text-align: center;
  }

  .table-section {
    grid-column: 1 / -1;
  }
}

/* --- Available Lots Table Section ---
   Sem padding horizontal próprio: .table-section é filha de
   .loteamento-main-section, que já aplica 20px de cada lado. O padding
   duplicado deixava só 308px úteis para a tabela num celular de 390px. */
.table-section {
  padding: 32px 0 8px;
  background: var(--page-bg);
  border-top: 1px solid var(--border-soft);
  margin-top: 24px;
}

.table-container-box {
  max-width: 1240px;
  margin: 0 auto;
}

.table-container-box h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.table-container-box p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.responsive-table {
  width: 100%;
  overflow: hidden;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.lots-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.lots-table th {
  background: var(--surface);
  color: var(--text-secondary);
  padding: 10px 12px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-soft);
}

.lots-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--surface);
  color: var(--text-secondary);
  white-space: nowrap;
}

.lots-table tbody tr:last-child td { border-bottom: 0; }
.lots-table tbody tr { transition: background 0.15s ease; }
.lots-table tbody tr:hover,
.lots-table tbody tr.active { background: var(--surface); }
/* .active é aplicado pelo JS quando o lote é selecionado no mapa: sem esta
   regra, clicar num lote não destacava a linha correspondente. */
.lots-table tbody tr.active td:first-child { box-shadow: inset 3px 0 0 var(--brand-red); }

.btn-select-lot {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 8px;
  margin: -4px -8px;
  border-radius: 8px;
}

.btn-select-lot:hover { color: var(--brand-red); }

/* --- Celular: a tabela vira cartão ---------------------------------
   As quatro colunas pedem 364px de largura natural; sobram 348px num
   celular de 390px e 318px num Android de 360px. Espremer quebra o texto
   e rolar na horizontal corta o preço no meio — foi o que aconteceu.
   Empilhado em cartão, o valor sempre aparece inteiro e não há rolagem
   lateral nenhuma. Acima de 640px volta a ser tabela. */
@media (max-width: 639px) {
  .responsive-table { border: 0; border-radius: 0; overflow: visible; }
  .lots-table { display: block; }
  .lots-table thead {
    position: absolute; width: 1px; height: 1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap;
  }
  .lots-table tbody { display: block; }

  .lots-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 2px 12px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--page-bg);
  }
  .lots-table tbody tr.active {
    border-color: var(--brand-red);
    background: var(--page-bg);
  }
  .lots-table tbody tr.active td:first-child { box-shadow: none; }

  .lots-table tbody td { padding: 0; border: 0; }

  /* Colunas: 1 Lote · 2 Área · 3 Frente×fundo · 4 Valor.
     Lote e Valor dividem a primeira linha do cartão. */
  .lots-table tbody td:nth-child(1) { grid-column: 1; grid-row: 1; }
  .lots-table tbody td:nth-child(4) {
    grid-column: 2; grid-row: 1; justify-self: end;
    font-family: var(--font-display);
    font-size: 17px; font-weight: 700; color: var(--text-primary);
  }
  .lots-table tbody td:nth-child(1) .btn-select-lot { font-size: 17px; margin: 0; padding: 0; min-height: 0; }

  /* Área e medidas viram linhas rótulo/valor */
  .lots-table tbody td:nth-child(2),
  .lots-table tbody td:nth-child(3) {
    grid-column: 1 / -1;
    display: flex; justify-content: space-between; gap: 12px;
    padding-top: 5px;
    font-size: 12.5px;
  }
  .lots-table tbody td:nth-child(2) { margin-top: 6px; }
  .lots-table tbody td[data-label]::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.05em;
  }
}

.btn-select-lot:focus-visible {
  outline: 2px solid var(--brand-red);
}

.table-status-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 600;
}

.table-status-badge.disponivel { background: var(--status-avail-bg); color: var(--status-avail); }
.table-status-badge.consultar { background: #F0F0F0; color: var(--text-primary); }
.table-status-badge.reservado { background: var(--status-amber-bg); color: var(--status-amber); }
.table-status-badge.vendido { background: var(--border-soft); color: var(--text-muted); }
.table-status-badge.indisponivel { background: #F0EEE9; color: var(--text-muted); }

/* Mobile primeiro: empilhado e CENTRADO. Antes era uma linha com
   space-between que, ao quebrar no celular, deixava texto e botão
   encostados à esquerda e desalinhados entre si. */
.availability-note-box {
  margin-top: 20px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* O botão tinha padding inline de 8px e ficava com ~33px de altura, abaixo
   do alvo de toque. Aqui ele vira botão de verdade. */
.availability-note-box .btn-whatsapp-lote {
  min-height: 46px;
  padding: 0 22px;
  width: 100%;
  max-width: 340px;
  justify-content: center;
  text-align: center;
}

/* Tela média para cima sobra largura: volta a ser uma linha, texto à
   esquerda e botão à direita. */
@media (min-width: 640px) {
  .availability-note-box {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    gap: 20px;
  }
  .availability-note-box .btn-whatsapp-lote { width: auto; flex-shrink: 0; }
}

.registral-info-line {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* --- Localização ---------------------------------------------------
   SEM prévia de mapa: a página já tem a planta interativa e um segundo
   desenho de mapa aqui só confundiria. Isto é um endereço com dois
   botões de saída para o Google Maps.
   Escrito na ordem MOBILE PRIMEIRO: o bloco base é o do celular
   (botões empilhados, largura cheia, alvo de toque de 48px) e as telas
   maiores entram por min-width. */
.location-section {
  padding: 32px 0 8px;
  border-top: 1px solid var(--border-soft);
  margin-top: 24px;
}

.location-section h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}

.location-box {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 18px;
}

.location-addr {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.location-pin { flex-shrink: 0; margin-top: 2px; color: var(--brand-red); }

.location-addr strong {
  display: block;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
}

.btn-maps,
.btn-rota {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-maps {
  margin-top: 16px;
  background: var(--brand-red);
  color: #FFFFFF;   /* literal: var(--white) do site vale #0D0D0D (preto) */
  border: 1.5px solid var(--brand-red);
}
.btn-maps:hover { background: var(--brand-red-dark); border-color: var(--brand-red-dark); }

.btn-rota {
  margin-top: 8px;
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid var(--border-mid);
}
.btn-rota:hover { border-color: var(--brand-red); color: var(--brand-red); }

.btn-maps:focus-visible,
.btn-rota:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 2px; }

.location-note {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.55;
}
.location-note a { color: var(--brand-red); font-weight: 600; text-decoration: none; }
.location-note a:hover { text-decoration: underline; }

/* Tela média para cima: os dois botões cabem lado a lado */
@media (min-width: 560px) {
  .location-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
  }
  .btn-maps, .btn-rota { width: auto; margin: 0; padding: 0 22px; }
  .location-note { grid-column: 1 / -1; margin-top: 2px; }
}

@media (min-width: 1024px) {
  .location-section { grid-column: 1 / -1; }
}

/* Movimento reduzido.
   NÃO usar "animation: none" universal: o .header do site nasce com
   opacity 0 e só aparece por animação (headerFadeIn). Matar a animação
   deixaria o cabeçalho invisível para sempre para quem tem essa
   preferência ligada. Encurtar a duração resolve sem esconder nada. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   ÍNDICE DE LOTEAMENTOS (loteamentos.html)
   Escrito para o celular primeiro: uma coluna, cartão inteiro
   clicável, alvo de toque alto. As colunas só aparecem a partir
   de 720px.
   ============================================================ */

.lot-index-intro {
  margin: 0 0 28px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 62ch;
}

.lot-index-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding-bottom: 56px;
}

.lot-index-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.lot-index-card:hover,
.lot-index-card:focus-within {
  border-color: var(--border-mid);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.07);
}

@media (hover: hover) {
  .lot-index-card:hover { transform: translateY(-2px); }
}

.lot-index-card h2 {
  margin: 0;
  font-family: 'Outfit', sans-serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* O link cobre o cartão inteiro: no celular a área de toque é o
   cartão, não só o botão. O botão continua visível como affordance. */
.lot-index-card h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
}

.lot-index-card h2 a {
  color: inherit;
  text-decoration: none;
}

.lot-index-local {
  margin: -6px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.lot-index-figures {
  display: grid;
  /* auto-fit em vez de 3 colunas fixas: num cartão estreito as três
     colunas esmagavam o valor e "300m²" colava no "R$". Assim elas
     quebram para duas linhas em vez de espremer. */
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px 12px;
  padding: 14px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.lot-index-figures div { min-width: 0; }

.lot-index-figures dt {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lot-index-figures dd {
  margin: 3px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.lot-index-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.lot-index-note strong { color: var(--status-avail); font-weight: 600; }

.lot-index-cta {
  /* margin-top:auto encosta o botão no rodapé do cartão. Sem isso ele
     seguia o fim do texto e os três ficavam em alturas diferentes numa
     fileira de cartões da mesma altura. */
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: var(--brand-red);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-fast);
}

.lot-index-cta:hover { background: var(--brand-red-dark); }

@media (min-width: 720px) {
  .lot-index-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .lot-index-card { padding: 24px; }
}

@media (min-width: 1024px) {
  /* O container vira grade de 2 colunas (mapa + painel) acima de 1024px.
     O índice não tem mapa: aqui ele volta a ser um bloco só, com a
     introdução em cima e os cartões ocupando a largura inteira. */
  .main-layout-container.lot-index-layout { display: block; }
  .lot-index-layout .lot-index-intro { margin-bottom: 32px; font-size: 16px; }
}

@media (min-width: 1080px) {
  .lot-index-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   "ATUALIZADO EM"
   Quem olha disponibilidade precisa saber de quando ela é. Discreto
   de propósito: é contexto, não chamada. A data vem do arquivo de
   dados de cada loteamento, não do build.
   ============================================================ */

/* Especificidade: .table-container-box p já define font-size, color e
   margin-bottom, e com um seletor de classe só esta regra perdia — a
   linha saía com o corpo e a cor do texto comum do bloco. */
.table-container-box p.lot-updated {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}

.table-container-box p.lot-updated svg {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.table-container-box p.lot-updated time { font-weight: 600; color: var(--text-secondary); }

.lot-index-updated {
  margin: -4px 0 0;
  font-size: 11.5px;
  color: var(--text-muted);
}

.lot-index-updated time { font-weight: 600; }

@media (min-width: 640px) {
  .table-container-box p.lot-updated { justify-content: flex-start; text-align: left; }
}
