:root {
  color-scheme: light;
  --ink: #0d1e30;
  --muted: #66758b;
  --line: #d9e3f2;
  --paper: #f5f6f7;
  --white: #ffffff;
  --mint: #3195ff;
  --mint-dark: #0c61d5;
  --amber: #8161ce;
  --danger: #9a4059;
  --shadow: 0 16px 44px rgba(13, 30, 48, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button, input, select { font: inherit; }

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(18px, 4vw, 64px);
  color: white;
  background: linear-gradient(110deg, #0d1e30 0%, #122c47 100%);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: white; background: linear-gradient(135deg, #0c61d5, #24a6ff); box-shadow: 0 7px 18px rgba(49, 149, 255, .25); font-size: 17px; }
.updated { color: #d9e3f2; font-size: .875rem; text-align: right; }

main { width: min(1240px, calc(100% - 36px)); margin: 0 auto; padding: 44px 0 70px; }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 390px); gap: 46px; align-items: end; }
.eyebrow { margin: 0 0 10px; color: var(--mint-dark); font-size: .82rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
h1 { max-width: 820px; margin: 0; font-size: clamp(2.2rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.055em; }
.lead { max-width: 760px; margin: 20px 0 0; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.25rem); }
.criteria { display: flex; flex-wrap: wrap; gap: 9px; align-content: flex-end; }
.criteria span { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; border: 1px solid #abc9e9; border-radius: 999px; background: #eef6ff; color: #0c61d5; font-size: .88rem; font-weight: 800; }
.criteria .excluded { border-color: #d8cff4; color: #66556b; background: #f6f3ff; }

.summary { display: grid; grid-template-columns: repeat(4, 1fr); margin: 38px 0 22px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: var(--white); box-shadow: var(--shadow); }
.summary div { display: flex; flex-direction: column; gap: 2px; padding: 20px 22px; border-right: 1px solid var(--line); }
.summary div:last-child { border-right: 0; }
.summary strong { color: var(--mint-dark); font-size: 1.8rem; line-height: 1; }
.summary span { color: var(--muted); font-size: .82rem; }

.toolbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--white); }
.toolbar label { display: grid; gap: 6px; }
.toolbar .search-control { grid-column: span 2; }
.toolbar .sort-control { grid-column: span 2; }
.toolbar [hidden] { display: none; }
.toolbar label span { color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.toolbar input, .toolbar select { width: 100%; min-height: 46px; padding: 10px 12px; color: var(--ink); border: 1px solid #abc9e9; border-radius: 10px; background: white; }
.toolbar input:focus, .toolbar select:focus { outline: 3px solid rgba(49, 149, 255, .22); border-color: var(--mint); }
.favorites-status { min-height: 22px; margin: 8px 2px 0; color: var(--muted); font-size: .82rem; }
.favorites-status.is-error { color: var(--danger); font-weight: 750; }
.notice { margin: 14px 0 34px; padding: 13px 16px; border-left: 4px solid var(--amber); color: #3f3d59; background: #f6f3ff; font-size: .9rem; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 1.6rem; }
.section-heading span { color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--white); box-shadow: 0 8px 26px rgba(13, 30, 48, .07); }
.photo-wrap { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: #d9e3f2; }
.photo { width: 100%; height: 100%; display: block; object-fit: cover; transition: opacity .18s ease; }
.zone-badge, .photo-count { position: absolute; top: 12px; padding: 7px 10px; border-radius: 999px; font-size: .76rem; font-weight: 900; backdrop-filter: blur(10px); }
.zone-badge { left: 12px; color: #0c61d5; background: rgba(238, 246, 255, .95); }
.photo-count { right: 12px; color: white; background: rgba(13, 30, 48, .76); }
.photo-prev, .photo-next { position: absolute; top: 50%; width: 38px; height: 44px; border: 0; border-radius: 10px; color: white; background: rgba(13, 30, 48, .76); transform: translateY(-50%); cursor: pointer; font-size: 1rem; }
.photo-prev { left: 10px; }
.photo-next { right: 10px; }
.photo-prev[hidden], .photo-next[hidden], .photo-count[hidden] { display: none; }
.card-body { padding: 18px; }
.card-topline { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .78rem; }
.neighborhood { color: var(--mint-dark); font-weight: 900; text-transform: uppercase; letter-spacing: .05em; }
.source { max-width: 52%; text-align: right; }
.card h3 { margin: 8px 0 12px; font-size: 1.2rem; line-height: 1.2; }
.price-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 7px 10px; }
.price { font-size: 1.45rem; }
.admin { color: var(--muted); font-size: .82rem; }
.facts { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.fact { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 8px; color: #1e2e50; background: #eef6ff; font-size: .82rem; font-weight: 750; }
.transport { margin: 0 0 10px; color: #0c61d5; font-size: .86rem; font-weight: 800; }
.transport i { width: 18px; margin-right: 5px; color: var(--mint-dark); text-align: center; }
.description { display: -webkit-box; margin: 0 0 16px; overflow: hidden; color: var(--muted); font-size: .9rem; -webkit-line-clamp: 4; -webkit-box-orient: vertical; }
.favorite-group { display: grid; gap: 8px; margin: 0 0 16px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #f8fbff; }
.favorite-label { display: inline-flex; align-items: center; gap: 7px; color: #3f3d59; font-size: .8rem; font-weight: 850; }
.favorite-label i { color: #8161ce; }
.favorite-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.favorite-button { min-height: 34px; padding: 6px 7px; border: 1px solid #abc9e9; border-radius: 8px; color: #1e2e50; background: white; cursor: pointer; font-size: .76rem; font-weight: 850; }
.favorite-button:hover, .favorite-button:focus-visible { border-color: var(--mint); background: #eef6ff; }
.favorite-button.is-active { color: white; border-color: #0c61d5; background: linear-gradient(135deg, #0c61d5, #3195ff); box-shadow: 0 5px 12px rgba(12, 97, 213, .17); }
.favorite-button:disabled { cursor: wait; opacity: .65; }
.actions { display: grid; grid-template-columns: 1.15fr 1fr; gap: 8px; }
.actions a { min-height: 42px; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border-radius: 10px; font-size: .86rem; font-weight: 900; text-decoration: none; text-align: center; }
.primary { color: white; background: linear-gradient(135deg, #0c61d5, #3195ff); box-shadow: 0 7px 16px rgba(12, 97, 213, .18); }
.secondary { color: #1e2e50; border: 1px solid #abc9e9; background: white; }
.primary:hover, .primary:focus-visible { background: linear-gradient(135deg, #0952b6, #1688ff); }
.secondary:hover, .secondary:focus-visible { border-color: var(--mint); background: #eef6ff; }
.whatsapp { grid-column: 1 / -1; color: #2e5f55; border-color: #adc9c2 !important; background: #edf5f3 !important; }
.observed { margin: 12px 0 0; color: #7a898f; font-size: .75rem; }
.empty { padding: 50px 20px; text-align: center; border: 1px dashed #a9babf; border-radius: 18px; background: white; }
.empty h2 { margin: 0 0 6px; }
.empty p { margin: 0; color: var(--muted); }
footer { padding: 30px 18px; color: #d9e3f2; background: var(--ink); text-align: center; font-size: .88rem; }

@media (max-width: 960px) {
  .intro { grid-template-columns: 1fr; gap: 24px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-control { grid-column: 1 / -1; grid-row: 1; }
  .toolbar .sort-control { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { align-items: center; gap: 10px; }
  .brand { min-width: 0; gap: 8px; }
  .brand span:last-child { display: block; font-size: .9rem; line-height: 1.1; }
  .brand-mark { flex: 0 0 36px; }
  .updated { max-width: 96px; font-size: .75rem; line-height: 1.25; }
  main { width: min(100% - 24px, 1240px); padding-top: 20px; }
  .intro { gap: 18px; }
  h1 { font-size: clamp(2.05rem, 10vw, 3rem); line-height: 1.01; }
  .lead { margin-top: 14px; font-size: 1rem; }
  .criteria { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 5px; scrollbar-width: thin; }
  .criteria span { flex: 0 0 auto; }
  .summary { display: none; }
  .toolbar { margin-top: 18px; padding: 13px; }
  .section-heading { margin-bottom: 12px; }
  .cards { grid-template-columns: 1fr; }
  .photo-wrap { aspect-ratio: 16 / 11; }
  .favorite-buttons { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
