:root {
  --bg-body: #f5f5f5;
  --bg-header: #1f2933;
  --bg-sidebar: #ffffff;
  --bg-panel: #ffffff;
  --border-subtle: #e0e0e0;
  --accent: #2563eb;
  --accent-soft: #eff6ff;
  --text-main: #111827;
  --text-muted: #6b7280;
  --danger: #dc2626;
  --warning: #f59e0b;
  --success: #059669;
  --radius: 12px;
  --shadow-soft: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 8px rgba(15, 23, 42, 0.06);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg-body);
  color: var(--text-main);
}

/* Shell */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-header);
  color: #fff;
}

.app-header h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.app-header-sub {
  font-size: 0.8rem;
  opacity: 0.8;
}

.app-header-right {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.app-main {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Sidebar */

.sidebar {
  width: 320px;
  max-width: 100%;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section h2 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

#busca-lote {
  flex: 1;
  padding: 0.35rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.btn-chip {
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: #fff;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
}

.btn-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Lista de lotes */

.lot-list {
  list-style: none;
  margin: 0;
  padding: 0.75rem;
}

.lot-item {
  border-radius: var(--radius);
  border: 1px solid rgba(15, 23, 42, 0.10);
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: background 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.lot-item:hover {
  background: #f9fafb;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.lot-item.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10), var(--shadow-soft);
  background: #f3f7ff;
}

.lot-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.lot-title {
  font-size: 0.95rem;
  font-weight: 600;
}

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

.lot-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Map panel */

.map-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.map-container {
  flex: 1;
  min-height: 250px;
}

/* Painel de detalhes */

.details-panel {
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  bottom: 0;
  z-index: 500;
  border-top: 1px solid var(--border-subtle);
  padding: 0.85rem 1rem 1rem;
  box-shadow: 0 -1px 2px rgba(15, 23, 42, 0.06), 0 -8px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(10px);
}

.details-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
}

.details-header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem 1rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

.details-grid .label {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.details-grid div > div,
.details-grid div > span + div {
  margin-top: 0.1rem;
}

.details-observ {
  margin-top: 0.75rem;
  font-size: 0.8rem;
}

.details-observ .label {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.details-observ p {
  margin: 0;
}

.highlight {
  font-weight: 600;
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  border: 1px solid transparent;
}

.badge-light {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
}

.badge-muted {
  background: #e5e7eb;
  color: #374151;
}

.badge-disponivel {
  background: #ecfdf5;
  color: var(--success);
  border-color: #bbf7d0;
}

.badge-reservado {
  background: #fffbeb;
  color: var(--warning);
  border-color: #fed7aa;
}

.badge-vendido {
  background: #fef2f2;
  color: var(--danger);
  border-color: #fecaca;
}

/* Mensagens */

.muted-msg {
  padding: 0.75rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Responsivo */

@media (max-width: 900px) {
  .app-main {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

html, body {
  height: 100%;
  overflow: hidden; /* <- impede a página de rolar */
}

.app-shell {
  height: 100vh;   /* <- fixa o “app” no viewport */
  min-height: 0;   /* importante pra flex permitir scroll interno */
}

.app-main,
.sidebar,
.map-panel {
  min-height: 0;   /* crucial: permite overflow interno funcionar */
}

.sidebar-list {
  overflow-y: auto; /* já existe, mantém */
}

.quadra-group {
  list-style: none;
  margin: 0 0 10px 0;
  padding: 0;
}

.quadra-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.10);
  background: #fff;
  cursor: pointer;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.quadra-header:hover{
  background: #f9fafb;
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.quadra-title { font-weight: 600; }
.quadra-count {
  font-size: 12px;
  opacity: 0.75;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.10);
}

.quadra-body{
  margin: 8px 0 0 0;
  padding: 0;

  /* animação */
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 240ms ease, opacity 180ms ease;
  will-change: max-height, opacity;
}

.quadra-body.is-open{
  opacity: 1;
}

/* opcional: deixa itens um pouco mais “compactos” dentro do acordeon */
.quadra-body .lot-item { margin-bottom: 10px; }

.leaflet-bar a {
  background: white;
  border: 1px solid #e5e7eb;
  color: #334155;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

.leaflet-bar a:hover {
  background: #f8fafc;
}

.leaflet-bar {
  border-radius: 12px;
  overflow: hidden;
}

/* ===== Sidebar colapsada: manter o toggle SEMPRE visível ===== */

.sidebar.is-collapsed {
  width: 56px !important;
}

/* mantém o topo, só reduz padding */
.sidebar.is-collapsed .sidebar-top,
.sidebar.is-collapsed header,
.sidebar.is-collapsed .header {
  padding-left: 8px !important;
  padding-right: 8px !important;
  justify-content: center !important;
}

/* Esconde tudo que é “conteúdo”, mas NÃO esconde o botão */
.sidebar.is-collapsed .sidebar-title,
.sidebar.is-collapsed .sidebar-subtitle,
.sidebar.is-collapsed .sidebar-content,
.sidebar.is-collapsed nav,
.sidebar.is-collapsed .tabs,
.sidebar.is-collapsed .content,
.sidebar.is-collapsed .panel,
.sidebar.is-collapsed .sidebar-body {
  display: none !important;
}

/* Garanta que o botão toggle apareça */
.sidebar.is-collapsed #sidebar-toggle,
.sidebar.is-collapsed .sidebar-toggle {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}

/* Ícone gira ao colapsar */
#sidebar-toggle-icon.rotate-180 {
  transform: rotate(180deg);
}

/* Botão WhatsApp */
.btn-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    margin-top: 12px;
    padding: 12px 16px;

    background-color: #25D366; /* verde WhatsApp */
    color: #ffffff;

    font-size: 14px;
    font-weight: 600;
    text-decoration: none;

    border-radius: 8px;
    border: none;

    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);

    transition: 
        background-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}

/* Hover */
.btn-whatsapp:hover {
    background-color: #1ebe5d;
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

/* Active (clique) */
.btn-whatsapp:active {
    transform: translateY(0);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

/* Acessibilidade básica */
.btn-whatsapp:focus {
    outline: 3px solid rgba(37, 211, 102, 0.5);
    outline-offset: 2px;
}


