/* =============================================================
   ListaMoradia - tema escuro (padrão) e tema claro opcional
   O tema claro é ativado por <html data-tema="claro"> (js/tema.js).
   ============================================================= */
:root {
  --bg: #0f1218;
  --superficie: #161a22;
  --superficie-2: #1d222c;
  --superficie-3: #252b37;
  --borda: #2a303c;
  --borda-forte: #3a4252;

  --texto: #f0f2f5;
  --texto-suave: #b9c0cc;
  --texto-fraco: #8d95a5;

  --primaria: #8ab4f8;
  --primaria-hover: #a3c4fa;
  --selecao: rgba(138, 180, 248, 0.3);
  --primaria-texto: #0f1218;
  --primaria-fundo: rgba(138, 180, 248, 0.12);
  --verde: #81c995;
  --verde-fundo: rgba(129, 201, 149, 0.12);
  --ambar: #f2c374;
  --ambar-fundo: rgba(242, 195, 116, 0.12);
  --perigo: #f28b82;
  --perigo-fundo: rgba(242, 139, 130, 0.12);
  --perigo-hover: #f6a49d;
  --perigo-texto: #1a0f0f;
  --perigo-borda: rgba(242, 139, 130, 0.3);

  --topo-fundo: rgba(15, 18, 24, 0.88);
  --login-brilho: #1a2232;
  --linha-hover: rgba(255, 255, 255, 0.03);
  --fundo-modal: rgba(5, 7, 10, 0.72);
  --vazio-fundo: rgba(22, 26, 34, 0.5);

  --raio: 12px;
  --raio-grande: 16px;
  --raio-pequeno: 6px;
  --sombra: 0 10px 30px rgba(0, 0, 0, 0.35);
  --sombra-leve: 0 1px 2px rgba(0, 0, 0, 0.25);
  --foco: 0 0 0 3px rgba(138, 180, 248, 0.45);
  --transicao: 160ms ease;

  --fonte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

:root[data-tema="claro"] {
  --bg: #f4f6f9;
  --superficie: #ffffff;
  --superficie-2: #eef1f5;
  --superficie-3: #e3e7ed;
  --borda: #d6dbe2;
  --borda-forte: #b9c1cc;

  --texto: #121721;
  --texto-suave: #3f4856;
  --texto-fraco: #5f6878;

  --primaria: #1f5fcc;
  --primaria-hover: #1a52b0;
  --selecao: rgba(31, 95, 204, 0.2);
  --primaria-texto: #ffffff;
  --primaria-fundo: rgba(31, 95, 204, 0.1);
  --verde: #1d7a3a;
  --verde-fundo: rgba(29, 122, 58, 0.1);
  --ambar: #8a5a00;
  --ambar-fundo: rgba(176, 116, 0, 0.12);
  --perigo: #c42b1c;
  --perigo-fundo: rgba(196, 43, 28, 0.08);
  --perigo-hover: #a92417;
  --perigo-texto: #ffffff;
  --perigo-borda: rgba(196, 43, 28, 0.25);

  --topo-fundo: rgba(255, 255, 255, 0.9);
  --login-brilho: #dfe8f7;
  --linha-hover: rgba(18, 23, 33, 0.03);
  --fundo-modal: rgba(18, 23, 33, 0.45);
  --vazio-fundo: rgba(255, 255, 255, 0.6);
  --sombra-leve: 0 1px 2px rgba(18, 23, 33, 0.08);
  --sombra: 0 10px 30px rgba(18, 23, 33, 0.12);
  --foco: 0 0 0 3px rgba(31, 95, 204, 0.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: 5rem; scrollbar-color: var(--borda-forte) var(--bg); -webkit-text-size-adjust: 100%; }
::selection { background: var(--selecao); }
html.verificando body { visibility: hidden; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--texto);
  font: 16px/1.55 var(--fonte);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.15rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 0.75rem; }

a { color: var(--primaria); text-underline-offset: 0.18em; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.texto-suave { color: var(--texto-suave); }
.texto-pequeno { font-size: 0.86rem; }
.bloco { display: block; }
.destaque { color: var(--ambar); }

.pular {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--primaria); color: var(--primaria-texto); padding: 0.5rem 0.9rem; border-radius: var(--raio-pequeno);
}
.pular:focus { top: 1rem; }

:focus-visible { outline: none; box-shadow: var(--foco); }

/* ---------- Botões ---------- */
.botao {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 40px; padding: 0 1rem;
  border: 1px solid var(--borda-forte); border-radius: var(--raio-pequeno);
  background: var(--superficie-2); color: var(--texto);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background var(--transicao), border-color var(--transicao), opacity var(--transicao), transform 80ms ease;
}
.botao:hover { background: var(--superficie-3); }
.botao:active:not(:disabled), .botao-icone:active, .alternar-visto:active { transform: scale(0.97); }
.botao:disabled { opacity: 0.6; cursor: progress; }
.botao.carregando::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent; animation: girar 700ms linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }
.botao--primario { background: var(--primaria); border-color: var(--primaria); color: var(--primaria-texto); font-weight: 600; box-shadow: var(--sombra-leve); }
.botao--primario:hover { background: var(--primaria-hover); border-color: var(--primaria-hover); }
.botao--fantasma { background: transparent; border-color: var(--borda); }
.botao--fantasma:hover { background: var(--superficie-2); }
.botao--perigo { background: var(--perigo); border-color: var(--perigo); color: var(--perigo-texto); }
.botao--perigo:hover { background: var(--perigo-hover); border-color: var(--perigo-hover); }
.botao--pequeno { min-height: 32px; padding: 0 0.7rem; font-size: 0.85rem; }
.botao--largo { width: 100%; }

.botao-icone {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--raio-pequeno);
  background: transparent; color: var(--texto-suave); cursor: pointer;
  transition: background var(--transicao), color var(--transicao), transform 80ms ease;
}
.botao-icone:hover { background: var(--superficie-3); color: var(--texto); }
.botao-icone--perigo:hover { background: var(--perigo-fundo); color: var(--perigo); }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.campo > span { font-size: 0.86rem; color: var(--texto-suave); font-weight: 500; }

input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; min-height: 40px; padding: 0.5rem 0.75rem;
  border: 1px solid var(--borda); border-radius: var(--raio-pequeno);
  background: var(--superficie); color: var(--texto);
  font: inherit; transition: border-color var(--transicao), box-shadow var(--transicao);
}
textarea { resize: vertical; min-height: 80px; }
input::placeholder, textarea::placeholder { color: var(--texto-fraco); }
input:hover, select:hover, textarea:hover { border-color: var(--borda-forte); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaria); box-shadow: var(--foco); }
input[aria-invalid="true"] { border-color: var(--perigo); }
input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--perigo-borda); }
option { background: var(--superficie); color: var(--texto); }
select { appearance: none; padding-right: 2rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--texto-suave) 50%), linear-gradient(135deg, var(--texto-suave) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px; background-repeat: no-repeat; }

.check { display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; user-select: none; font-size: 0.9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--primaria); cursor: pointer; }

.erro {
  margin: 0; padding: 0.6rem 0.8rem; border-radius: var(--raio-pequeno);
  background: var(--perigo-fundo); color: var(--perigo); font-size: 0.9rem;
  border: 1px solid var(--perigo-borda);
}
#form-erro { white-space: pre-line; }

/* ---------- Importar por JSON (no Novo imóvel) ---------- */
.painel-formulario, .painel-json { display: flex; flex-direction: column; gap: 1rem; }
.painel-formulario[hidden], .painel-json[hidden], .modo-cadastro[hidden] { display: none; }
.painel-json textarea { min-height: 240px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.85rem; line-height: 1.45; tab-size: 2; }
.painel-json p { margin: -0.5rem 0 0; }
.painel-json code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.85em; color: var(--texto); }
.botao-link { padding: 0; border: 0; background: none; color: var(--primaria); font: inherit; font-weight: 500; cursor: pointer; }
.botao-link:hover { text-decoration: underline; }
.json-resultado { padding: 0.65rem 0.85rem; border-radius: var(--raio-pequeno); font-size: 0.88rem; line-height: 1.5; border: 1px solid; border-left-width: 3px; overflow-wrap: anywhere; }
.json-resultado strong { display: flex; align-items: flex-start; gap: 0.45rem; }
.json-resultado strong::before { margin-top: 0.15em; }
.json-resultado strong::before {
  content: ""; flex-shrink: 0; width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: currentColor; -webkit-mask: var(--icone-resultado) center / contain no-repeat; mask: var(--icone-resultado) center / contain no-repeat;
}
.json-resultado--ok { --icone-resultado: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1.2 14.2-4-4 1.4-1.4 2.6 2.6 5.6-5.6 1.4 1.4-7 7Z'/%3E%3C/svg%3E"); }
.json-resultado--erro { --icone-resultado: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20Zm-1 5h2v7h-2V7Zm0 9h2v2h-2v-2Z'/%3E%3C/svg%3E"); }
.json-resultado ul { color: var(--texto-suave); }
.json-resultado ul { margin: 0.35rem 0 0; padding-left: 1.1rem; }
.json-resultado li + li { margin-top: 0.15rem; }
.json-resultado p { margin: 0.3rem 0 0; }
.json-resultado--ok { background: var(--verde-fundo); color: var(--verde); border-color: color-mix(in srgb, var(--verde) 35%, transparent); border-left-color: var(--verde); }
.json-resultado--ok li::marker { color: var(--verde); }
.json-resultado--erro { background: var(--perigo-fundo); color: var(--perigo); border-color: var(--perigo-borda); border-left-color: var(--perigo); }
.json-resultado--erro li::marker { color: var(--perigo); }
/* A borda da área de colar acompanha a validação */
.painel-json:has(.json-resultado--ok:not([hidden])) textarea { border-color: var(--verde); }
.painel-json:has(.json-resultado--erro:not([hidden])) textarea { border-color: var(--perigo); }
.painel-json:has(.json-resultado--erro:not([hidden])) textarea:focus { box-shadow: 0 0 0 3px var(--perigo-borda); }
.painel-json textarea::placeholder { font-family: inherit; }
.botao-link { border-radius: 4px; white-space: nowrap; }
.modo-cadastro { margin-bottom: 0.25rem; }

/* ---------- Login ---------- */
.pagina-login { display: grid; place-items: center; padding: 1.5rem;
  background: radial-gradient(1200px 600px at 50% -10%, var(--login-brilho) 0%, var(--bg) 60%); }
.login { width: 100%; max-width: 380px; animation: surgir 260ms ease-out; }
.login__card {
  display: flex; flex-direction: column; gap: 1.25rem;
  padding: 2rem; border: 1px solid var(--borda); border-radius: var(--raio-grande);
  background: linear-gradient(180deg, var(--superficie-2), var(--superficie) 40%); box-shadow: var(--sombra);
}
.login__card h1 { font-size: 1.3rem; }
.login__card .botao--largo { min-height: 44px; }
.marca { display: flex; align-items: center; gap: 0.75rem; }
.marca p { margin: 0; font-size: 0.88rem; }
.campo__senha { position: relative; }
.campo__senha input { padding-right: 2.75rem; }
.campo__senha input { min-height: 44px; }
.campo__senha .botao-icone { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.campo__senha .botao-icone:active { transform: translateY(-50%) scale(0.97); }
.botao-icone[aria-pressed="true"] { color: var(--primaria); }

/* ---------- Topo ---------- */
.topo { position: sticky; top: 0; z-index: 20; background: var(--topo-fundo);
  -webkit-backdrop-filter: saturate(140%) blur(12px); backdrop-filter: saturate(140%) blur(12px); border-bottom: 1px solid var(--borda); }
.topo__interno { max-width: 1280px; margin: 0 auto; padding: 0.75rem 1.25rem;
  display: flex; align-items: center; gap: 1.25rem; }
.marca--compacta h1 { font-size: 1.05rem; }
.topo__acoes { margin-left: auto; display: flex; align-items: center; gap: 0.5rem; }

.abas { display: flex; gap: 0.25rem; padding: 3px; border-radius: 9px; background: var(--superficie); border: 1px solid var(--borda); }
.aba {
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 34px; padding: 0 0.85rem; border: 0; border-radius: 7px;
  background: transparent; color: var(--texto-suave); font: inherit; font-weight: 500; cursor: pointer;
  transition: background var(--transicao), color var(--transicao);
}
.aba:hover { color: var(--texto); }
.aba[aria-selected="true"] { background: var(--superficie-3); color: var(--texto); box-shadow: var(--sombra-leve); }
.aba[aria-selected="true"] .contador { background: var(--primaria-fundo); color: var(--primaria); }

.contador { min-width: 1.4rem; padding: 0 0.4rem; border-radius: 999px; background: var(--superficie-2);
  color: var(--texto-suave); font-size: 0.75rem; line-height: 1.35rem; text-align: center; font-variant-numeric: tabular-nums;
  transition: background var(--transicao), color var(--transicao); }
.contador--destaque { background: var(--primaria); color: var(--primaria-texto); }

/* ---------- Conteúdo ---------- */
.conteudo { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }

.filtros { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 0.75rem; }
.filtros__linha { display: flex; gap: 0.6rem; align-items: center; }
.campo--busca { flex: 1; position: relative; }
.campo--busca svg { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--texto-fraco); pointer-events: none; }
.campo--busca input[type=search] { padding-left: 2.4rem; }
.campo--compacto { width: 180px; }

.filtros__avancados {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; align-items: end;
  padding: 1rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie);
  animation: abrir-painel 160ms ease-out;
}
@keyframes abrir-painel { from { opacity: 0; transform: translateY(-4px); } }
#botao-filtros[aria-expanded="true"] { background: var(--superficie-2); border-color: var(--borda-forte); }
.filtros__checks { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; grid-column: span 2; min-height: 40px; align-items: center; }

.resumo { min-height: 1.5rem; margin-bottom: 0.5rem; color: var(--texto-suave); font-size: 0.88rem; }

/* ---------- Tabela ---------- */
.tabela-envoltorio { border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); overflow-x: auto; box-shadow: var(--sombra-leve); }
.tabela { width: 100%; border-collapse: collapse; transition: opacity var(--transicao); }
.tabela.carregando { opacity: 0.5; }
.tabela th {
  position: sticky; top: 0; padding: 0.75rem 1rem; text-align: left;
  background: var(--superficie-2); color: var(--texto-suave);
  font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--borda);
}
.tabela td { padding: 1.1rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--borda); }
.tabela tbody tr:last-child td { border-bottom: 0; }
.tabela tbody tr { transition: background var(--transicao); }
.tabela tbody tr:hover, .tabela tbody tr:focus-within { background: var(--linha-hover); }
.tabela tr.visto .col-imovel .imovel__nome { opacity: 0.75; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela th.num { text-align: right; }

.tabela th:first-child, .tabela td:first-child { padding-right: 0.25rem; }
.col-visto { width: 64px; }
.col-imovel { min-width: 270px; width: 28%; }
.col-imovel > * { display: block; }
.col-imovel > * + * { margin-top: 0.3rem; }
.col-imovel .imovel__topo { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; }
/* Área e Quartos: centralizadas, perto do imóvel; Valor à direita, encostado no anúncio */
.tabela th:nth-child(4), .tabela td:nth-child(4),
.tabela th:nth-child(5), .tabela td:nth-child(5) { text-align: center; width: 7%; }
.col-valor .bloco { margin-top: 0.25rem; }
.tabela th:nth-child(7), .tabela td:nth-child(7) { padding-left: 1.75rem; }
.col-links .bloco { margin-top: 0.15rem; }
.imovel__nome { font-weight: 650; font-size: 1rem; }
.imovel__nome--alugar { color: var(--primaria); }
.imovel__nome--comprar { color: var(--verde); }
.col-valor strong { font-size: 0.98rem; }
.col-links { white-space: nowrap; }
.col-links .link { display: flex; align-items: center; gap: 0.35rem; min-height: 28px; text-decoration: none; border-radius: 4px; }
.col-links .link:hover { text-decoration: underline; }
.col-links .link svg { width: 15px; height: 15px; }
.col-acoes { width: 1%; }
.acoes { display: flex; gap: 0.15rem; justify-content: flex-end; }
.motivo { color: var(--ambar); margin-top: 0.3rem; }

/* Observações do imóvel: coluna própria, ao lado de Imóvel */
.col-obs { min-width: 220px; width: 27%; }
.col-obs .observacoes__bloco {
  max-width: 62ch; padding: 0.45rem 0.7rem;
  border-left: 3px solid var(--borda-forte); border-radius: 0 var(--raio-pequeno) var(--raio-pequeno) 0; background: var(--superficie-2);
}
.observacoes { margin: 0; color: var(--texto-suave); line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.observacoes--recolhida { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.observacoes__alternar {
  display: inline-flex; align-items: center; min-height: 26px; margin: 0.1rem 0 -0.2rem -0.15rem; padding: 0 0.15rem; border: 0; border-radius: 4px; background: none;
  color: var(--primaria); font: inherit; font-size: 0.86rem; font-weight: 500; cursor: pointer;
}
.observacoes__alternar:hover { text-decoration: underline; }

.etiqueta { display: inline-block; padding: 0.1rem 0.55rem; border-radius: 999px; line-height: 1.5;
  background: var(--superficie-3); color: var(--texto-suave); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; }
.etiqueta--novo { background: var(--ambar-fundo); color: var(--ambar); }

.alternar-visto {
  display: grid; place-items: center; width: 34px; height: 34px;
  border: 1px solid var(--borda-forte); border-radius: 50%;
  background: transparent; color: var(--texto-fraco); cursor: pointer;
  transition: all var(--transicao);
}
.alternar-visto:hover { border-color: var(--verde); color: var(--verde); }
.alternar-visto.ativo { background: var(--verde-fundo); border-color: var(--verde); color: var(--verde); }

.vazio { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 4rem 1rem; text-align: center; color: var(--texto-suave);
  border: 1px dashed var(--borda-forte); border-radius: var(--raio); background: var(--vazio-fundo); }
.vazio > svg { width: 56px; height: 56px; padding: 14px; border-radius: 50%; background: var(--superficie-2); color: var(--texto-fraco); stroke-width: 1.5; }
.vazio p { margin: 0; }

/* ---------- Modais ---------- */
.modal {
  width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
  padding: 0; border: 1px solid var(--borda); border-radius: var(--raio-grande);
  background: var(--superficie); color: var(--texto); box-shadow: var(--sombra);
}
.modal--pequeno { width: min(440px, calc(100vw - 2rem)); }
.modal::backdrop { background: var(--fundo-modal); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal[open] { animation: surgir 180ms ease-out; }
@keyframes surgir { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal { overflow: hidden; }
html:has(dialog[open]) { overflow: hidden; } /* a página atrás do formulário não rola junto */
.modal__conteudo { display: flex; flex-direction: column; max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); margin: 0; }
.modal__topo { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--borda); }
.modal__corpo { padding: 1.1rem 1.25rem 1.25rem; overflow-y: auto; overscroll-behavior: contain; min-height: 0; display: flex; flex-direction: column; gap: 1rem; }
.modal__rodape { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--borda); background: var(--superficie-2); border-radius: 0 0 var(--raio-grande) var(--raio-grande); }

fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 0.6rem; font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texto-fraco); }
.grade { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grade--2 { grid-template-columns: repeat(2, 1fr); }
.grade--4 { grid-template-columns: repeat(4, 1fr); }
.campo--largo { grid-column: 1 / -1; }

.segmentado { display: flex; padding: 3px; border: 1px solid var(--borda); border-radius: var(--raio-pequeno); background: var(--superficie); min-height: 40px; }
.segmentado label { flex: 1; position: relative; }
.segmentado input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.segmentado span { display: grid; place-items: center; height: 100%; border-radius: 4px; cursor: pointer; color: var(--texto-suave); font-size: 0.9rem; font-weight: 500; transition: all var(--transicao); }
.segmentado input:checked + span { background: var(--superficie-3); color: var(--texto); box-shadow: var(--sombra-leve); }
.segmentado input[value="alugar"]:checked + span { background: var(--primaria-fundo); color: var(--primaria); }
.segmentado input[value="comprar"]:checked + span { background: var(--verde-fundo); color: var(--verde); }
.segmentado input:focus-visible + span { box-shadow: var(--foco); }

/* ---------- Avisos ---------- */
.avisos { position: fixed; bottom: calc(1.25rem + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100vw - 2rem); transform: translateX(-50%); z-index: 50;
  display: flex; flex-direction: column; gap: 0.5rem; align-items: center; pointer-events: none; }
.aviso { padding: 0.65rem 1rem; border-radius: var(--raio-pequeno); background: var(--superficie-3); border: 1px solid var(--borda-forte);
  box-shadow: var(--sombra); font-size: 0.9rem; animation: surgir 180ms ease-out; transition: opacity 250ms, transform 250ms;
  display: flex; align-items: center; gap: 0.6rem; }
.aviso::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--texto-suave); }
.aviso--ok::before { background: var(--verde); }
.aviso--erro::before { background: var(--perigo); }
.aviso--ok { border-left: 3px solid var(--verde); }
.aviso--erro { border-left: 3px solid var(--perigo); }
.aviso.saindo { opacity: 0; transform: translateY(6px); }

/* ---------- Responsivo ---------- */
@media (max-width: 900px) {
  .topo__interno { flex-wrap: wrap; gap: 0.75rem; }
  .abas { order: 3; width: 100%; }
  .aba { flex: 1; justify-content: center; }
  .grade--4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .conteudo { padding: 1rem; }
  #botao-novo span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #botao-novo { width: 44px; min-height: 44px; padding: 0; }
  .topo__interno { padding: 0.6rem 1rem; }
  .filtros__linha { flex-wrap: wrap; }
  .campo--busca { flex-basis: 100%; }
  .campo--compacto { flex: 1; width: auto; }
  .filtros__avancados { grid-template-columns: repeat(2, 1fr); }
  .filtros__checks, #botao-limpar { grid-column: 1 / -1; }
  .grade, .grade--2, .grade--4 { grid-template-columns: repeat(2, 1fr); }
  .grade > .campo:has(.segmentado) { grid-column: 1 / -1; }

  /* Tabela vira cartões */
  .tabela-envoltorio { border: 0; background: transparent; overflow: visible; }
  .tabela thead { display: none; }
  .tabela, .tabela tbody { display: block; }
  .tabela tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.5fr); gap: 0.85rem 1rem; position: relative;
    margin-bottom: 0.75rem; padding: 1rem; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie);
  }
  .tabela td, .tabela td:nth-child(n) { padding: 0; border: 0; width: auto; vertical-align: top; }
  .tabela td.num { text-align: left; }
  .tabela td[data-rotulo]::before { content: attr(data-rotulo); display: block; margin-bottom: 0.15rem; font-size: 0.72rem; color: var(--texto-fraco); text-transform: uppercase; letter-spacing: 0.04em; }
  .tabela .col-imovel, .tabela .col-obs, .tabela .col-links { grid-column: 1 / -1; }
  .tabela .col-obs--vazia { display: none; }
  .tabela .col-imovel { padding-bottom: 0.35rem; }
  .tabela td.col-valor { grid-column: 3 / -1; white-space: normal; }
  .tabela .col-imovel { padding-right: 2.75rem; min-width: 0; }
  .tabela .col-imovel::before, .tabela .col-visto::before, .tabela .col-acoes::before { display: none !important; }
  .tabela .col-visto { position: absolute; top: 0.9rem; right: 0.9rem; width: auto; }
  .tabela .col-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem; white-space: normal; }
  .tabela .col-links::before { width: 100%; }
  .tabela .col-acoes { grid-column: 1 / -1; width: auto; border-top: 1px solid var(--borda); padding-top: 0.5rem; }
  .acoes { justify-content: flex-start; }

  /* Formulário ocupa a tela toda no celular, com uma só rolagem e o rodapé sempre à mão */
  .modal:not(.modal--pequeno) { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .modal:not(.modal--pequeno) .modal__conteudo { height: 100%; max-height: none; }
  .modal:not(.modal--pequeno) .modal__corpo { flex: 1; }
  .modal:not(.modal--pequeno) .modal__rodape { border-radius: 0; padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)); }
  .modal__rodape .botao { flex: 1; min-height: 44px; }
  .painel-json textarea { min-height: 180px; }
}

/* Alvos de toque maiores em telas sensíveis ao toque */
@media (pointer: coarse) {
  .botao-icone { width: 44px; height: 44px; }
  .alternar-visto { width: 40px; height: 40px; }
  .botao--pequeno { min-height: 40px; }
  input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; font-size: 16px; }
  .check { min-height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Sugestões (cidade, bairro, imobiliária) ---------- */
.campo { position: relative; }
.sugestoes {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 5;
  margin: 4px 0 0; padding: 4px; list-style: none;
  border: 1px solid var(--borda-forte); border-radius: var(--raio-pequeno);
  background: var(--superficie); box-shadow: var(--sombra);
  max-height: 220px; overflow-y: auto;
}
.sugestoes li { padding: 0.5rem 0.65rem; border-radius: 4px; cursor: pointer; color: var(--texto-suave); }
.sugestoes li strong { color: var(--texto); font-weight: 600; }
.sugestoes li:hover, .sugestoes li.ativa { background: var(--superficie-3); color: var(--texto); }

/* ---------- Botão de tema ---------- */
.icone-lua { display: none; }
:root[data-tema="claro"] .icone-sol { display: none; }
:root[data-tema="claro"] .icone-lua { display: block; }

