/* Sistema visual "Fim de tarde" — DESIGN.md. Tema único (claro); modo
   escuro está fora de escopo. Tokens primeiro, depois base, layout e
   componentes. Templates usam as classes daqui em vez de estilo inline. */
:root {
  /* Cor */
  --bg: #FFFAF5;
  --surface: #FFFFFF;
  --surface-warm: #FFF3E8;
  --peach: #F6D5B8;
  --peach-soft: #FBE9D9;
  --amber: #E0913A;
  --wine: #7A3B3B;
  --wine-strong: #5F2C2C;
  --text: #3B2A20;
  --text-muted: #6F5C4F; /* 5,9:1 sobre --bg (AA) */
  --line: #F0DDCB;
  --success: #3F6B3A;
  --success-soft: #E6F0E3;
  --danger: #B42318;
  --danger-soft: #FDECEA;

  /* Espaço (escala de 4px) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;

  /* Tipo */
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.625rem;
  --fs-2xl: 2rem;

  /* Forma */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(91, 52, 30, 0.10);
  --shadow-md: 0 6px 20px rgba(91, 52, 30, 0.12);
  --shadow-lg: 0 12px 32px rgba(91, 52, 30, 0.22);
  --focus: 0 0 0 3px var(--bg), 0 0 0 5px var(--wine);

  --tabbar-h: 4rem;
}

@font-face {
  font-family: "Nunito";
  src: url("/static/fonts/Nunito-Variable.ttf") format("truetype-variations"),
       url("/static/fonts/Nunito-Variable.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito", system-ui, sans-serif;
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { color: var(--wine); line-height: 1.2; margin: 0; }
h1 { font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.01em; }
h2 { font-size: var(--fs-lg); font-weight: 800; }
h3 { font-size: var(--fs-md); font-weight: 800; }
p { margin: 0; }
img { max-width: 100%; }

a { color: var(--wine); text-underline-offset: 3px; text-decoration-thickness: 1px; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }

.tabular { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.page {
  max-width: 480px;
  margin: 0 auto;
  padding: var(--s-5) var(--s-4) var(--s-7);
}
.page--nav { padding-bottom: calc(var(--tabbar-h) + 5.5rem); }
.page--list:has(.fab) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10rem); }
.page--wide { max-width: 1040px; }
.page--center {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: var(--s-4);
  padding: var(--s-5) var(--s-4);
}
.stack { display: flex; flex-direction: column; gap: var(--s-4); }
.stack--sm { gap: var(--s-2); }
.row { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }

.page-header { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-5); }
.page-header p { color: var(--text-muted); }
.back-link {
  display: inline-flex; align-items: center; gap: var(--s-1);
  color: var(--text-muted); font-weight: 700; text-decoration: none; font-size: var(--fs-sm);
  padding: var(--s-1) 0;
}
.back-link:hover { color: var(--wine); }

.section-title {
  display: flex; align-items: center; gap: var(--s-2);
  color: var(--text-muted); font-size: var(--fs-sm); font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
  margin: var(--s-6) 0 var(--s-3);
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- Botões ---------- */
.btn, .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px;
  padding: 0.7rem 1.4rem;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  font-weight: 800;
  font-size: var(--fs-md);
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, transform .1s, box-shadow .15s;
  line-height: 1.2;
}
.btn:active:not(:disabled), .btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary, .btn--primary { background: var(--wine); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled), .btn--primary:hover:not(:disabled) { background: var(--wine-strong); }
.btn-primary:disabled, .btn--primary:disabled { background: #9C7272; cursor: not-allowed; box-shadow: none; }
.btn--soft { background: var(--peach-soft); color: var(--wine); }
.btn--soft:hover { background: var(--peach); }
.btn--outline { background: transparent; border-color: var(--wine); color: var(--wine); }
.btn--outline:hover { background: var(--peach-soft); }
.btn--danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--block { width: 100%; }
.btn--sm { min-height: 36px; padding: 0.4rem 0.9rem; font-size: var(--fs-sm); }
.btn-link {
  background: none; border: 0; padding: var(--s-1) 0; cursor: pointer;
  color: var(--wine); font-weight: 800; font-size: var(--fs-sm); text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }
.btn-link--muted { color: var(--text-muted); }
.btn-link--success { color: var(--success); }

/* ---------- Chips e abas ---------- */
.chip {
  display: inline-flex; align-items: center; gap: var(--s-1);
  background: var(--peach-soft); color: var(--text);
  border-radius: var(--r-pill); padding: 0.15rem 0.65rem;
  font-size: var(--fs-xs); font-weight: 700;
}
.chips { display: flex; flex-wrap: wrap; gap: var(--s-1); }

.tabs {
  display: inline-flex; gap: var(--s-1); padding: var(--s-1);
  background: var(--peach-soft); border-radius: var(--r-pill);
}
.tab {
  padding: 0.45rem 1.1rem; border-radius: var(--r-pill);
  font-weight: 800; font-size: var(--fs-sm); text-decoration: none; color: var(--text);
}
.tab[aria-current="page"] { background: var(--surface); color: var(--wine); box-shadow: var(--shadow-sm); }
.tab .count { color: var(--text-muted); font-weight: 700; margin-left: 0.2rem; }

/* ---------- Superfícies ---------- */
.surface { background: var(--surface); border-radius: var(--r-lg); }
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card--flat { box-shadow: var(--shadow-sm); padding: var(--s-4); }
.card--muted { color: var(--text-muted); box-shadow: none; border: 1px dashed var(--line); }

/* ---------- Cartão de imóvel ---------- */
.listing-grid { display: grid; gap: var(--s-5); }

.listing { position: relative; }
.listing__media { position: relative; aspect-ratio: 4 / 3; background: var(--peach-soft); }
.listing__gallery {
  display: flex; height: 100%;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.listing__gallery::-webkit-scrollbar { display: none; }
.listing__gallery:focus-visible { outline: 3px solid var(--wine); outline-offset: -3px; box-shadow: none; }
.listing__gallery img {
  flex: 0 0 100%; width: 100%; height: 100%;
  object-fit: cover; scroll-snap-align: start; display: block;
}
.listing__nophoto {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-2);
  color: var(--text-muted); font-weight: 700; font-size: var(--fs-sm);
  background: repeating-linear-gradient(135deg, var(--peach-soft) 0 14px, var(--surface-warm) 14px 28px);
}
.listing__nophoto svg { width: 40px; height: 40px; color: var(--amber); }
.badge {
  position: absolute;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.3rem 0.7rem; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 800;
  background: rgba(255, 255, 255, 0.94); color: var(--text);
  box-shadow: var(--shadow-sm);
}
.badge--rank { top: var(--s-3); left: var(--s-3); font-size: var(--fs-sm); color: var(--wine); }
.badge--fav { background: var(--wine); color: #fff; }
.badge--photos { bottom: var(--s-3); right: var(--s-3); background: rgba(40, 24, 16, 0.72); color: #fff; }
/* Nome de site/imobiliária pode ser longo: reticências antes de invadir o
   selo de fotos. Só a 1ª letra maiúscula: capitalize viraria "x.Com.Br". */
.badge--source { bottom: var(--s-3); left: var(--s-3); background: rgba(40, 24, 16, 0.72); color: #fff; display: block; max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge--source::first-letter { text-transform: uppercase; }

/* Seleção para comparar, sobre a foto: caixa nativa estilizada como pílula. */
.select-compare {
  position: absolute; top: var(--s-3); right: var(--s-3);
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.75rem 0.3rem 0.45rem; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.94); box-shadow: var(--shadow-sm);
  font-size: var(--fs-xs); font-weight: 800; cursor: pointer; color: var(--text);
}
.select-compare input { width: 18px; height: 18px; margin: 0; accent-color: var(--wine); cursor: pointer; }
.select-compare:has(input:checked) { background: var(--wine); color: #fff; }
.select-compare:has(input:focus-visible) { box-shadow: var(--focus); }

.listing__body { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); }
.listing__price { font-size: var(--fs-xl); font-weight: 900; color: var(--wine); line-height: 1.1; }
.listing__price small { font-size: var(--fs-sm); font-weight: 700; color: var(--text-muted); }
.listing__address { font-weight: 700; line-height: 1.35; }
.facts { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); color: var(--text-muted); font-size: var(--fs-sm); font-weight: 700; }
.facts span { display: inline-flex; align-items: center; gap: 0.3rem; }
.facts svg { width: 16px; height: 16px; color: var(--amber); flex: none; }
.listing__travel:empty { display: none; }
.travel { display: flex; gap: 0.35rem; align-items: center; font-size: var(--fs-sm); color: var(--text-muted); }
.travel svg { flex: none; color: var(--amber); }
.travel strong { color: var(--text); }
.listing__actions {
  display: flex; align-items: center; gap: var(--s-4);
  border-top: 1px solid var(--line); margin-top: var(--s-2); padding-top: var(--s-3);
}
.listing__actions form { margin: 0; }
.listing__actions .push { margin-left: auto; }

.inline-alert { font-size: var(--fs-sm); font-weight: 700; color: var(--danger); display: flex; gap: 0.3rem; align-items: center; }

/* "Estou aqui" e "Discordo": <details> nativo. */
.disclosure summary {
  list-style: none; cursor: pointer; color: var(--wine); font-weight: 800; font-size: var(--fs-sm);
  display: inline-flex; align-items: center; gap: 0.35rem;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::after { content: "›"; transition: transform .15s; display: inline-block; }
.disclosure[open] summary::after { transform: rotate(90deg); }
.disclosure form { margin-top: var(--s-2); }

/* Favorita: moldura em gradiente, sem vazar para fora do cartão. */
.favorite {
  padding: 3px; border-radius: calc(var(--r-lg) + 3px);
  background: linear-gradient(135deg, var(--peach), var(--amber));
  box-shadow: var(--shadow-lg);
}
.favorite__head { padding: var(--s-3) var(--s-4) var(--s-3); color: var(--wine); }
.favorite__head strong { font-weight: 900; display: block; }
.favorite__head q { font-style: italic; font-size: var(--fs-sm); quotes: "“" "”"; }
.favorite .card { box-shadow: none; }

.why { background: var(--surface-warm); padding: var(--s-3) var(--s-4) var(--s-4); font-size: var(--fs-sm); }
.why h3 { font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: var(--s-2); }
.why ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.why li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem; }
.why li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex: none; transform: translateY(-2px); }

.mini-item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); }
.mini-item__thumb { width: 64px; height: 64px; border-radius: var(--r-md); object-fit: cover; flex: none; background: var(--peach-soft); }
.mini-item__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.mini-item__body p:first-child { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item__body .reason { color: var(--danger); font-size: var(--fs-sm); font-weight: 700; }

/* Barra de comparação: aparece quando há seleção. */
.compare-bar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s-3));
  z-index: 20; display: none;
}
body:has(input[name="ids"]:checked) .compare-bar { display: block; }
body:has(input[name="ids"]:checked) .fab { display: none; }
.compare-bar .btn { box-shadow: var(--shadow-lg); }


/* ---------- Formulários ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-4); }
.field { display: flex; flex-direction: column; gap: 0.35rem; font-weight: 700; font-size: var(--fs-sm); min-width: 0; }
.field .hint { font-weight: 600; color: var(--text-muted); font-size: var(--fs-xs); }
.field input:not([type=radio]):not([type=checkbox]), .field select, .field textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border-radius: var(--r-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-md);
  font-weight: 600;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; line-height: 1.45; }
.field :is(input, select, textarea):hover { border-color: var(--peach); }
.field :is(input, select, textarea):focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(122, 59, 59, 0.18); }
.grid-2, .grid-3 { display: grid; gap: var(--s-3); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.form-section {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  border: 0; margin: 0; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-4);
  min-width: 0;
}
.form-section > legend {
  float: left; width: 100%; padding: 0; margin-bottom: 0;
  font-weight: 900; color: var(--wine); font-size: var(--fs-md);
}
.form-section > legend + * { clear: both; }
.form-section > legend .hint { display: block; font-weight: 600; color: var(--text-muted); font-size: var(--fs-xs); }

/* Seletor segmentado (rádios nativos). */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-1); padding: var(--s-1); background: var(--peach-soft); border-radius: var(--r-pill); }
.segmented label { position: relative; text-align: center; padding: 0.55rem 0.75rem; border-radius: var(--r-pill); font-weight: 800; cursor: pointer; font-size: var(--fs-sm); }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented label:has(input:checked) { background: var(--surface); color: var(--wine); box-shadow: var(--shadow-sm); }
.segmented label:has(input:focus-visible) { box-shadow: var(--focus); }

/* Formulário de imóvel: só a seção da modalidade escolhida aparece. Os
   campos da outra ficam no DOM (o servidor decide o que usar). */
.form:has(input[name="modalidade"][value="compra"]:checked) .only-rent,
.form:has(input[name="modalidade"][value="aluguel"]:checked) .only-buy { display: none; }

.choice { display: flex; gap: var(--s-2); align-items: flex-start; font-weight: 600; font-size: var(--fs-md); cursor: pointer; padding: var(--s-2) 0; }
.choice input { accent-color: var(--wine); width: 18px; height: 18px; margin-top: 0.15rem; flex: none; }

.sticky-submit {
  position: sticky; bottom: 0; z-index: 5;
  padding: var(--s-3) 0 calc(var(--s-3) + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(255, 250, 245, 0));
}

/* Tira de fotos (revisão). */
.photo-strip {
  display: flex; gap: var(--s-2); overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-4) var(--s-2); scroll-padding-inline: var(--s-4);
}
.photo-strip img {
  flex: 0 0 auto; height: 180px; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--r-md); scroll-snap-align: start; box-shadow: var(--shadow-sm);
}

/* ---------- Avisos ---------- */
.alert {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-3) var(--s-4); border-radius: var(--r-md);
  background: var(--danger-soft); color: var(--danger); font-weight: 700;
  border: 1px solid rgba(180, 35, 24, 0.25);
}
.alert svg { width: 20px; height: 20px; flex: none; margin-top: 0.1rem; }
.alert p { color: var(--text); font-weight: 600; }

/* ---------- Estado vazio e carregamento ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3);
  padding: var(--s-6) var(--s-4);
}
.empty img { width: 168px; height: 168px; object-fit: contain; }
.empty h1, .empty h2 { max-width: 20ch; }
.empty p { color: var(--text-muted); max-width: 34ch; }
.empty--card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.empty .actions { display: flex; flex-direction: column; gap: var(--s-2); align-items: center; margin-top: var(--s-2); }

.joca-float { animation: joca-float 2.6s ease-in-out infinite; }
@keyframes joca-float { 50% { transform: translateY(-8px) rotate(-2deg); } }

/* Joca lendo: balança a cabeça como quem corre o olho pelas linhas, com
   sombra no chão acompanhando o sobe e desce. Só transform/opacity. */
.joca-stage { position: relative; display: inline-block; }
/* ::before pinta atrás da imagem; 22px ≈ margem transparente sob os pés do PNG. */
.joca-stage::before {
  content: ""; position: absolute; left: 22.5%; bottom: 22px; width: 55%; height: 10px;
  border-radius: 50%; background: rgba(91, 52, 30, 0.18);
  animation: joca-shadow 2.4s ease-in-out infinite;
}
.empty .joca-stage img, .joca-stage img { display: block; width: 180px; height: 180px; }
.joca-read { transform-origin: 50% 90%; animation: joca-read 2.4s ease-in-out infinite; }
@keyframes joca-read {
  0%, 100% { transform: translateY(0) rotate(0); }
  25% { transform: translateY(-6px) rotate(-4deg); }
  50% { transform: translateY(-2px) rotate(0); }
  75% { transform: translateY(-6px) rotate(4deg); }
}
@keyframes joca-shadow { 25%, 75% { transform: scaleX(0.82); opacity: 0.6; } }
/* Joca "pensando" no avatar do chat enquanto a resposta não chega. */
.joca-bob { animation: joca-bob 1.2s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes joca-bob { 50% { transform: translateY(-3px) rotate(-6deg); } }

.load-steps { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); padding: 0; margin: 0; }
.load-steps li {
  padding: 0.2rem 0.7rem; border-radius: var(--r-pill);
  background: var(--peach-soft); color: var(--wine); font-weight: 800; font-size: var(--fs-sm);
  animation: step-pulse 2.4s ease-in-out infinite;
}
.load-steps li:nth-child(2) { animation-delay: .8s; }
.load-steps li:nth-child(3) { animation-delay: 1.6s; }
@keyframes step-pulse { 0%, 45%, 100% { opacity: 0.5; transform: none; } 15% { opacity: 1; transform: translateY(-3px); } }

/* Envio via HTMX (entrar, reenviar link): girador no botão enquanto espera. */
.htmx-request [type="submit"], [type="submit"][aria-busy="true"] { pointer-events: none; opacity: 0.85; }
.htmx-request [type="submit"]::before, [type="submit"][aria-busy="true"]::before {
  content: ""; width: 1em; height: 1em; flex: none; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.dots::after { content: ""; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.progress-track { width: min(240px, 80%); height: 6px; border-radius: var(--r-pill); background: var(--peach-soft); overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 40%; border-radius: inherit; background: linear-gradient(90deg, var(--peach), var(--amber)); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.skeleton {
  display: block; height: 0.9rem; width: 60%; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--peach-soft) 25%, var(--surface-warm) 50%, var(--peach-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

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

/* ---------- Comparação ---------- */
.compare {
  display: grid;
  grid-auto-flow: column;
  grid-template-columns: 7.5rem;
  grid-auto-columns: minmax(12.5rem, 1fr);
  position: relative; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-left: 7.5rem;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-md);
}
.compare__col { display: grid; grid-template-rows: subgrid; grid-row: span var(--rows); scroll-snap-align: start; border-left: 1px solid var(--line); min-width: 0; }
.compare__labels { position: sticky; left: 0; z-index: 2; background: var(--surface-warm); border-left: 0; box-shadow: 4px 0 8px -6px rgba(91, 52, 30, 0.3); }
.compare__cell { padding: var(--s-3); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.compare__cell:last-child { border-bottom: 0; }
.compare__labels .compare__cell { font-weight: 800; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.compare__head { flex-direction: column; align-items: stretch; gap: var(--s-2); padding: var(--s-3); }
.compare__head img, .compare__head .compare__nophoto { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--r-md); display: block; background: var(--peach-soft); }
.compare__nophoto { display: flex !important; align-items: center; justify-content: center; color: var(--text-muted); font-size: var(--fs-sm); font-weight: 700; }
.compare__head p { font-weight: 700; font-size: var(--fs-sm); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.compare__value { font-weight: 800; font-size: var(--fs-md); }
.compare__best { background: var(--success-soft); }
.compare__best .best-mark { color: var(--success); display: inline-flex; align-items: center; gap: 0.2rem; font-size: var(--fs-xs); font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em; }
.compare__best .best-mark svg { width: 14px; height: 14px; }
.compare__cell--stack { flex-direction: column; align-items: flex-start; }
.compare__travel p { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Conversa ---------- */
.chat { flex: 1; display: flex; flex-direction: column; gap: var(--s-3); padding: 0 var(--s-4); }
.bubble {
  max-width: 85%; padding: 0.7rem 1rem; border-radius: 18px; white-space: pre-wrap; line-height: 1.45;
  align-self: flex-start; background: var(--surface); box-shadow: var(--shadow-sm); border-bottom-left-radius: 6px;
}
.bubble--user { align-self: flex-end; background: var(--wine); color: #fff; box-shadow: none; border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
.bubble-row { display: flex; gap: var(--s-2); align-items: flex-end; align-self: flex-start; max-width: 92%; }
.bubble-row .bubble { max-width: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: 50% 20%; background: var(--peach-soft); border: 2px solid var(--peach); flex: none; }
.composer {
  position: sticky; bottom: var(--tabbar-h); z-index: 5;
  display: flex; gap: var(--s-2); padding: var(--s-3) var(--s-4);
  background: linear-gradient(to top, var(--bg) 75%, rgba(255, 250, 245, 0));
}
.composer input { flex: 1; min-width: 0; min-height: 48px; padding: 0.7rem 1.1rem; border-radius: var(--r-pill); border: 1.5px solid var(--line); background: var(--surface); box-shadow: var(--shadow-sm); }
.composer input:focus { outline: none; border-color: var(--wine); box-shadow: 0 0 0 3px rgba(122, 59, 59, 0.18); }
.composer .btn-primary { padding-inline: 1.1rem; }
.typing { display: inline-flex; gap: 4px; padding: 0.2rem 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); animation: typing 1s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 50% { transform: translateY(-4px); opacity: .5; } }

.criterion-card { align-self: stretch; padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: var(--s-2); border: 1px solid var(--line); }
.criterion-card--elim { border-color: var(--danger-soft); }
.pill {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: var(--fs-xs); font-weight: 900; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 0.15rem 0.55rem; border-radius: var(--r-pill);
  background: var(--peach-soft); color: #8A4A12;
}
.pill--elim { background: var(--danger-soft); color: var(--danger); }
.pill--off { background: #EFE9E4; color: var(--text-muted); }
.is-off { color: var(--text-muted); background: var(--surface-warm); }

/* ---------- Mapa ---------- */
.map { width: 100%; height: 60vh; min-height: 320px; background: var(--peach-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-md); overflow: hidden; }
.map-legend { display: flex; gap: var(--s-4); flex-wrap: wrap; font-size: var(--fs-sm); color: var(--text-muted); font-weight: 700; margin: var(--s-3) 0 0; }
.map-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.map-legend i { width: 12px; height: 12px; border-radius: 50%; background: var(--amber); display: inline-block; }
.map-legend i.sq { border-radius: 3px; background: var(--wine); }
.map-legend i.area { background: rgba(224, 145, 58, 0.35); border: 2px solid var(--amber); }
.map-pop { font-family: "Nunito", system-ui, sans-serif; display: flex; flex-direction: column; gap: 0.2rem; min-width: 180px; }
.map-pop__cost { font-size: var(--fs-md); color: var(--wine); }
.map-pop__muted { color: var(--text-muted); font-size: var(--fs-xs); }
.map-pop a { color: var(--wine); font-weight: 800; margin-top: 0.2rem; }
.leaflet-popup-content-wrapper { border-radius: var(--r-md) !important; box-shadow: var(--shadow-md) !important; }

/* ---------- Tabela ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th { text-align: left; color: var(--text-muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; padding: var(--s-2); border-bottom: 2px solid var(--line); }
.table td { padding: var(--s-2); border-bottom: 1px solid var(--line); }
.table td:not(:first-child), .table th:not(:first-child) { text-align: right; }
.table-wrap { overflow-x: auto; }

/* ---------- Navegação ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar ul { list-style: none; margin: 0 auto; padding: 0 var(--s-2); max-width: 480px; display: grid; grid-template-columns: repeat(4, 1fr); height: var(--tabbar-h); }
.tabbar a {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--text-muted); font-size: var(--fs-xs); font-weight: 800;
}
.tabbar svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--wine); }
.tabbar a[aria-current="page"] svg { background: var(--peach-soft); border-radius: var(--r-pill); padding: 2px 14px; width: 52px; box-sizing: border-box; height: 28px; }

.fab {
  position: fixed; right: max(var(--s-4), calc(50% - 240px + var(--s-4)));
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s-4));
  z-index: 25; display: flex; flex-direction: column; align-items: flex-end; gap: var(--s-2);
}
.fab--no-nav { bottom: calc(var(--s-5) + env(safe-area-inset-bottom)); }
.fab__button {
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--wine); color: #fff; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  transition: transform .2s, background-color .15s;
}
.fab__button:hover { background: var(--wine-strong); }
.fab__button svg { width: 26px; height: 26px; transition: transform .2s; }
.fab__button[aria-expanded="true"] svg { transform: rotate(45deg); }
.fab__menu {
  display: none; flex-direction: column; min-width: 240px; padding: var(--s-2);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
}
.fab__menu.is-open { display: flex; animation: pop .15s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.fab__menu a, .fab__menu span { display: flex; gap: var(--s-3); align-items: center; padding: var(--s-3); border-radius: var(--r-md); text-decoration: none; color: var(--text); font-weight: 800; }
.fab__menu a:hover { background: var(--peach-soft); }
.fab__menu span { color: var(--text-muted); font-weight: 600; font-size: var(--fs-sm); }
.fab__menu svg { width: 20px; height: 20px; color: var(--amber); flex: none; }

/* ---------- Login ---------- */
.resend-ready:empty { display: none; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-md); padding: var(--s-5); }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 900; color: var(--wine); font-size: var(--fs-lg); }
.footer-links { font-size: var(--fs-xs); color: var(--text-muted); }
.footer-links a { color: var(--text-muted); }

/* ---------- Telas maiores ---------- */
@media (min-width: 768px) {
  .page--list { max-width: 1040px; padding-inline: var(--s-5); }
  .listing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .listing-grid > .favorite { grid-column: 1 / -1; }
  .favorite .card { display: grid; grid-template-columns: 1.2fr 1fr; }
  .favorite .listing__media { aspect-ratio: auto; min-height: 340px; }
  .favorite .why { grid-column: 1 / -1; }
  .page--list .fab { right: max(var(--s-5), calc(50% - 520px + var(--s-5))); }
  .map { height: 65vh; }
  h1 { font-size: 2.25rem; }
}
@media (min-width: 1100px) {
  .listing-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .favorite .card { grid-template-columns: 1.6fr 1fr; }
}
