:root {
  --green-950: #102f22;
  --green-900: #173f2b;
  --green-700: #2f6848;
  --green-100: #e9f1eb;
  --paper: #f7f4ee;
  --white: #fff;
  --ink: #1e2922;
  --muted: #68726b;
  --line: #dfe4df;
  --gold: #86631f;
  --free: #72b56a;
  --booked: #f1c232;
  --action: #2f73c9;
  --sold: #cf4f4f;
  --third-queue: #8b5fbf;
  --road: #c8c8c1;
  --shadow: 0 18px 50px rgba(16, 47, 34, .16);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); overflow: hidden; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, #map:focus-visible { outline: 3px solid #f0b84d; outline-offset: 2px; }

.skip-link { position: fixed; left: 12px; top: -80px; z-index: 9999; padding: 10px 14px; color: var(--white); background: var(--green-950); border-radius: 8px; }
.skip-link:focus { top: 12px; }
.topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(20px, env(safe-area-inset-left)); background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: relative; z-index: 1000; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--green-900); text-decoration: none; }
.brand > span:first-child { font-size: 22px; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 19px; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }
.topbar-actions { display: flex; align-items: center; gap: 16px; }
.sync-state { color: var(--muted); font-size: 12px; }
.app-shell { height: calc(100% - 64px); display: grid; grid-template-columns: minmax(0, 1fr) 380px; }
.map-shell { min-width: 0; position: relative; background: #dfe5dc; }
#map { width: 100%; height: 100%; background: #dfe5dc; }
.panel { min-width: 0; position: relative; z-index: 600; background: var(--paper); border-left: 1px solid var(--line); overflow: hidden; }
.panel-view { height: 100%; display: flex; flex-direction: column; padding: 26px 24px 18px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 5px; color: var(--gold); font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.panel-heading h1 { margin-bottom: 0; font-family: Georgia, serif; color: var(--green-950); font-size: 29px; line-height: 1.1; }
.available-count { min-width: 48px; height: 31px; display: inline-grid; place-items: center; padding: 0 10px; color: var(--green-900); background: var(--green-100); border-radius: 999px; font-size: 13px; font-weight: 750; }
.search-field { display: flex; align-items: center; gap: 9px; min-height: 48px; padding: 0 14px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.search-field:focus-within { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(47,104,72,.12); }
.search-field svg { width: 19px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-field input { width: 100%; min-width: 0; padding: 13px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 15px; }
.filters { display: flex; gap: 7px; padding: 13px 0 4px; overflow-x: auto; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filter { min-height: 38px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; white-space: nowrap; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 650; }
.filter.is-active { color: var(--white); background: var(--green-900); border-color: var(--green-900); }
.dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; flex: 0 0 auto; }
.dot-free { background: var(--free); }.dot-booked { background: var(--booked); }.dot-action { background: var(--action); }.dot-sold { background: var(--sold); }.dot-third { background: var(--third-queue); }
.legend { display: flex; flex-wrap: wrap; gap: 5px 13px; padding: 12px 0 11px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.lot-list { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 8px 3px 50px 0; list-style: none; }
.lot-list li { margin: 0; padding: 0; }
.lot-row { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 4px 14px; align-items: center; padding: 12px 10px; color: inherit; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; }
.lot-row:hover { background: rgba(255,255,255,.75); }
.lot-row-name { display: flex; align-items: center; gap: 8px; font-weight: 750; }
.lot-row-meta { color: var(--muted); font-size: 12px; }
.lot-row-price { grid-row: span 2; font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 750; }
.empty-state { padding: 28px 10px; color: var(--muted); text-align: center; }
.map-toolbar { position: absolute; z-index: 500; right: 14px; top: 14px; display: grid; gap: 8px; }
.icon-button { width: 46px; height: 46px; display: grid; place-items: center; padding: 0; color: var(--green-900); background: rgba(255,255,255,.96); border: 1px solid rgba(23,63,43,.12); border-radius: 12px; box-shadow: 0 7px 20px rgba(0,0,0,.12); cursor: pointer; }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.mobile-panel-button { display: none; }
.map-hint { position: absolute; z-index: 500; left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100% - 40px); padding: 9px 13px; white-space: nowrap; color: #fff; background: rgba(16,47,34,.88); border-radius: 999px; box-shadow: var(--shadow); font-size: 12px; pointer-events: none; }
.tablet-panel-toggle { display: none; }
.panel-handle { display: none; }

.back-button { width: max-content; display: inline-flex; align-items: center; gap: 7px; min-height: 42px; padding: 0 7px; margin: -7px 0 14px; color: var(--green-900); background: transparent; border: 0; cursor: pointer; font-weight: 700; }
.detail-view { overflow-y: auto; overscroll-behavior: contain; }
.lot-detail-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; margin-bottom: 10px; border-radius: 999px; background: #fff; font-size: 12px; font-weight: 750; }
.detail-title { margin-bottom: 5px; color: var(--green-950); font-family: Georgia, serif; font-size: 31px; }
.detail-cadastre { margin-bottom: 20px; color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.detail-stat { padding: 14px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; }
.detail-stat span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.detail-stat strong { display: block; font-size: 16px; font-variant-numeric: tabular-nums; }
.old-price { margin-left: 7px; color: var(--muted); font-size: 12px; font-weight: 500; text-decoration: line-through; }
.action-note { padding: 13px 14px; margin: 0 0 16px; color: #174c7d; background: #eaf4ff; border-radius: 12px; font-size: 13px; line-height: 1.45; }
.future-sale-banner { display: grid; gap: 5px; padding: 15px 16px; margin: 0 0 16px; color: #4d2d73; background: #f0e9f8; border: 1px solid rgba(139,95,191,.25); border-radius: 12px; }
.future-sale-banner strong { font-family: Georgia, serif; font-size: 18px; }
.future-sale-banner span { color: #62477e; font-size: 13px; line-height: 1.45; }
.future-sale-note { padding: 14px; margin: 0; color: #62477e; background: #f5f0fa; border: 1px solid rgba(139,95,191,.22); border-radius: 12px; font-size: 13px; line-height: 1.45; }
.detail-actions { display: grid; gap: 9px; margin-top: auto; }
.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; text-decoration: none; font-weight: 750; }
.button-primary { color: var(--white); background: var(--green-900); }
.button-primary:hover { background: var(--green-950); }
.button-secondary { color: var(--green-900); background: var(--white); border-color: var(--green-900); }
.topbar-cta { min-height: 48px; padding: 0 22px; color: var(--white); background: var(--gold); border-color: var(--gold); box-shadow: 0 6px 14px rgba(134, 99, 31, .22); font-size: 15px; font-weight: 800; }
.topbar-cta:hover { background: #6f5018; border-color: #6f5018; }
.button-quiet { color: var(--green-900); background: transparent; border-color: var(--line); }
.unavailable-note { padding: 14px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; line-height: 1.45; }

.leaflet-container { font-family: inherit; }
.leaflet-control-attribution { font-size: 10px; }
.leaflet-control-zoom { border: 0 !important; box-shadow: 0 7px 20px rgba(0,0,0,.13) !important; }
.leaflet-control-zoom a { color: var(--green-900) !important; border-color: var(--line) !important; }
.lot-polygon { transition: fill-opacity .15s ease, stroke-width .15s ease; }
.lot-label { padding: 0; color: white; background: transparent; border: 0; box-shadow: none; font-family: "Segoe UI", Arial, sans-serif; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .035em; line-height: 1.1; text-shadow: 0 1px 2px rgba(0,0,0,.82); }
.lot-label::before { display: none; }
.labels-hidden .lot-label { display: none; }

.lead-dialog { width: min(460px, calc(100% - 28px)); padding: 0; color: var(--ink); background: var(--paper); border: 0; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.3); }
.lead-dialog::backdrop { background: rgba(10,26,18,.64); backdrop-filter: blur(3px); }
.lead-form, .success-state { padding: 30px; }
.lead-form h2, .success-state h2 { margin-bottom: 8px; color: var(--green-950); font-family: Georgia, serif; font-size: 27px; }
.form-copy { margin-bottom: 22px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.dialog-close { position: absolute; right: 14px; top: 12px; width: 44px; height: 44px; color: var(--muted); background: transparent; border: 0; cursor: pointer; font-size: 28px; }
.lead-form > label:not(.consent) { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 700; }
.lead-form > input { width: 100%; min-height: 49px; padding: 0 13px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 16px; }
.consent { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.consent input { width: 19px; height: 19px; flex: 0 0 auto; }
.consent a, .form-error a { color: var(--green-900); }
.submit-button { width: 100%; }
.form-error { padding: 10px; margin-bottom: 12px; color: #8d2929; background: #fdeeee; border-radius: 9px; font-size: 12px; }
.success-state { text-align: center; }
.success-state p { color: var(--muted); }
.success-icon { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 14px; color: #fff; background: var(--free); border-radius: 50%; font-size: 28px; }
.fatal-error { position: fixed; inset: 64px 0 0; z-index: 2000; display: grid; place-content: center; padding: 30px; text-align: center; background: var(--paper); }
.fatal-error[hidden] { display: none; }
.fatal-error a { color: var(--green-900); }

@media (min-width: 801px) and (max-width: 1180px) {
  .app-shell { grid-template-columns: minmax(0, 1fr) clamp(320px, 37vw, 380px); transition: grid-template-columns .25s ease; }
  .app-shell.is-panel-collapsed { grid-template-columns: minmax(0, 1fr) 58px; }
  .panel { overflow: visible; }
  .panel-view { background: var(--paper); transition: opacity .14s ease, visibility .14s ease; }
  .tablet-panel-toggle { position: absolute; z-index: 5; left: -48px; top: 16px; width: 48px; height: 48px; display: grid; place-items: center; padding: 0; color: var(--green-900); background: rgba(255,255,255,.97); border: 1px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; box-shadow: -6px 7px 18px rgba(16,47,34,.13); cursor: pointer; }
  .tablet-panel-toggle svg { width: 22px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; transition: transform .25s ease; }
  .app-shell.is-panel-collapsed .panel-view { visibility: hidden; opacity: 0; pointer-events: none; }
  .app-shell.is-panel-collapsed .tablet-panel-toggle { left: 5px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 7px 18px rgba(16,47,34,.13); }
  .app-shell.is-panel-collapsed .tablet-panel-toggle svg { transform: rotate(180deg); }
}

@media (max-width: 800px) {
  .topbar { height: 58px; padding-right: max(14px, env(safe-area-inset-right)); padding-left: max(14px, env(safe-area-inset-left)); }
  .brand small, .sync-state, .desktop-only { display: none; }
  .brand strong { font-size: 18px; }
  .app-shell { height: calc(100% - 58px); display: block; position: relative; }
  .map-shell { height: 100%; }
  .panel { position: absolute; z-index: 700; inset: auto 0 0; height: min(56%, 500px); padding-bottom: env(safe-area-inset-bottom); border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -14px 45px rgba(16,47,34,.2); transform: translateY(calc(100% - 74px)); transition: transform .25s ease; }
  .panel.is-open { transform: translateY(0); }
  .panel-view { padding: 8px 16px 10px; }
  .panel-handle { width: 100%; height: 34px; display: grid; place-items: center; padding: 0; border: 0; background: transparent; cursor: pointer; }
  .panel-handle span { width: 42px; height: 4px; background: #c9cfca; border-radius: 99px; }
  .panel-heading { margin-bottom: 10px; }
  .panel-heading h1 { font-size: 23px; }
  .eyebrow { display: none; }
  .filters { padding-top: 9px; }
  .filter { min-height: 44px; }
  .panel-handle { height: 44px; }
  .back-button { min-height: 44px; }
  .legend { display: none; }
  .lot-list { padding-bottom: 25px; }
  .map-toolbar { top: 12px; right: 12px; }
  .mobile-panel-button { display: grid; }
  .map-hint { bottom: 88px; }
  .detail-view { padding-top: 8px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .detail-title { font-size: 27px; }
  .lead-form, .success-state { padding: 27px 20px max(22px, env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .topbar, .map-shell, #list-view, .back-button, .detail-actions, .panel-handle { display: none !important; }
  body { overflow: visible; background: #fff; }
  .app-shell, .panel, .panel-view { display: block; height: auto; overflow: visible; border: 0; }
  #detail-view[hidden] { display: none !important; }
  #detail-view { padding: 30px; }
}
