:root {
  --ink: #17211d;
  --muted: #66736d;
  --paper: #f7f5ef;
  --card: #fffefb;
  --line: #d9ded9;
  --green: #1f6b4f;
  --green-dark: #15513b;
  --lime: #d9e9c9;
  --amber: #f3dfae;
  --red: #a4403a;
  --shadow: 0 14px 40px rgba(23, 33, 29, .08);
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--paper); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #65a887; outline-offset: 2px; }
.topbar { min-height: 72px; display: flex; align-items: center; gap: 24px; padding: 12px clamp(18px, 4vw, 56px); border-bottom: 1px solid var(--line); background: rgba(247,245,239,.94); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--green); color: white; font-size: 22px; }
nav { display: flex; gap: 6px; margin-left: auto; }
nav a { text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 650; color: var(--muted); }
nav a:hover { background: white; color: var(--ink); }
.logout-form { margin: 0; }
.shell { width: min(1180px, calc(100% - 36px)); margin: 0 auto; padding: 42px 0 80px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.2rem, 5vw, 4.6rem); line-height: .98; letter-spacing: -.045em; margin-bottom: 16px; }
h2 { letter-spacing: -.025em; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; font-weight: 800; color: var(--green); margin-bottom: 12px; }
.lede { max-width: 640px; color: var(--muted); font-size: 1.08rem; line-height: 1.6; }
.hero, .page-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 32px; }
.hero { background: linear-gradient(130deg, #e4edda 0%, #f6e9c5 100%); padding: clamp(28px, 6vw, 64px); border-radius: 30px; box-shadow: var(--shadow); }
.hero h1 { max-width: 620px; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 17px; border: 0; border-radius: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.primary { background: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
.visit-button, .visit-nav { background: var(--lime); color: var(--green-dark); }
.secondary { background: #e4ede7; color: var(--green-dark); }
.ghost { background: transparent; color: var(--muted); }
.full { width: 100%; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 42px; }
.metrics a { padding: 22px; text-decoration: none; border: 1px solid var(--line); background: var(--card); border-radius: 18px; }
.metrics strong { display: block; font-size: 2rem; }
.metrics span { color: var(--muted); }
.two-column { display: grid; grid-template-columns: 1.2fr .8fr; gap: 32px; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; }
.section-heading a { color: var(--green); font-weight: 700; }
.card-list { display: grid; gap: 12px; }
.card { display: block; text-decoration: none; padding: 20px; border: 1px solid var(--line); background: var(--card); border-radius: 16px; transition: transform .15s ease, box-shadow .15s ease; }
.card:hover, .listing-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card h3 { margin: 10px 0 6px; }
.card p, .muted { color: var(--muted); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; padding: 18px; background: white; border: 1px solid var(--line); border-radius: 18px; margin-bottom: 24px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: .92rem; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid #b9c2bd; border-radius: 10px; padding: 10px 12px; background: white; color: var(--ink); }
textarea { min-height: 92px; resize: vertical; }
.listing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.listing-card { display: flex; min-height: 280px; flex-direction: column; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: var(--card); text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.listing-card h2 { margin: 18px 0 6px; font-size: 1.25rem; }
.card-top, .inline, .actions { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.badge { display: inline-flex; width: fit-content; border-radius: 999px; padding: 5px 9px; font-weight: 800; font-size: .75rem; background: #e7ebe8; }
.status-shortlisted, .status-selected { background: var(--lime); color: var(--green-dark); }
.status-visit_scheduled, .status-application { background: var(--amber); color: #684c13; }
.status-rejected { background: #f4d5d2; color: var(--red); }
.price { font-size: 1.45rem; font-weight: 850; margin: auto 0 14px; }
.price span { color: var(--muted); font-size: .82rem; font-weight: 550; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; border-top: 1px solid var(--line); padding-top: 14px; }
.facts dt, .detail-list dt { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; }
.facts dd, .detail-list dd { margin: 4px 0 0; font-weight: 700; }
.detail-heading h1 { font-size: clamp(2rem, 4vw, 3.6rem); max-width: 820px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.panel { padding: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 20px; }
.wide { grid-column: 1 / -1; }
.detail-list { display: grid; gap: 0; margin: 0 0 24px; }
.detail-list > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-list.columns { grid-template-columns: 1fr 1fr; column-gap: 28px; }
.alert { padding: 16px; border-radius: 14px; margin-bottom: 18px; }
.warning { background: #fff0c8; }
.danger { background: #f6d9d6; color: #6f211d; }
.timeline article { padding: 14px 0; border-bottom: 1px solid var(--line); }
.timeline time { margin-left: 8px; color: var(--muted); font-size: .82rem; }
.timeline p { margin: 8px 0 0; white-space: pre-line; }
.stack { display: grid; gap: 16px; }
.form-shell, .auth-card { max-width: 980px; margin: 0 auto; padding: clamp(24px, 5vw, 52px); background: var(--card); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); }
.form-shell.narrow, .auth-card { max-width: 620px; }
.model-form { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.contact-callout { display: grid; gap: 4px; padding: 16px; background: #e8f0e8; border-radius: 14px; margin-bottom: 22px; }
.messages { position: fixed; right: 18px; top: 84px; z-index: 30; display: grid; gap: 8px; }
.message { max-width: 360px; padding: 13px 16px; border-radius: 12px; background: var(--ink); color: white; box-shadow: var(--shadow); }
.message.error { background: var(--red); }
.empty { padding: 24px; border: 1px dashed #aeb8b2; border-radius: 16px; color: var(--muted); }
.preline { white-space: pre-line; }
.map-heading { align-items: center; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 16px; }
.map-heading h2, .map-heading p { margin-bottom: 4px; }
.map-frame { border: 0; border-radius: 14px; display: block; height: 360px; width: 100%; }
.visit-mode-heading { align-items: start; }
.visit-picker { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.visit-pick-card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; display: grid; gap: 10px; min-height: 180px; padding: 22px; text-decoration: none; }
.visit-pick-card strong { font-family: Georgia, serif; font-size: 1.35rem; line-height: 1.15; }
.visit-pick-card > span:not(.badge) { color: var(--muted); }
.visit-pick-action { align-self: end; color: var(--green) !important; font-weight: 800; margin-top: auto; }
.visit-mobile-header { background: linear-gradient(130deg, #e4edda, #f6e9c5); border-radius: 24px; margin-bottom: 18px; padding: 24px; }
.visit-mobile-header h1 { font-size: clamp(1.8rem, 7vw, 3rem); margin: 12px 0 6px; }
.visit-mobile-header > a { color: var(--green-dark); display: inline-block; font-weight: 800; margin-bottom: 24px; }
.visit-mode-form { display: grid; gap: 18px; padding-bottom: 92px; }
.visit-step { background: var(--card); border: 1px solid var(--line); border-radius: 20px; display: grid; gap: 18px; grid-template-columns: 1fr 1fr; padding: 22px; }
.visit-step-number { align-items: center; background: var(--green); border-radius: 50%; color: white; display: inline-flex; font-size: 1.1rem; font-weight: 900; height: 38px; justify-content: center; width: 38px; }
.visit-step > .visit-step-number + div { grid-column: 2; }
.touch-choice { border: 0; margin: 0; padding: 0; }
.touch-choice legend { font-size: .92rem; font-weight: 800; margin-bottom: 8px; }
.touch-choice ul { display: grid; gap: 8px; grid-template-columns: repeat(3, 1fr); list-style: none; margin: 0; padding: 0; }
.touch-choice label { align-items: center; background: #edf1ee; border: 2px solid transparent; border-radius: 14px; cursor: pointer; display: flex; justify-content: center; min-height: 52px; padding: 8px; }
.touch-choice input { min-height: auto; width: auto; }
.deal-breaker { align-items: center; background: #f8e3df; border: 2px solid #e7b4ac; border-radius: 14px; display: flex; font-size: 1rem; min-height: 58px; padding: 12px 16px; }
.deal-breaker input { min-height: 24px; width: 24px; }
.visit-save-bar { background: var(--paper); background: color-mix(in srgb, var(--paper) 92%, transparent); bottom: 0; left: 0; padding: 12px max(12px, calc((100vw - 1180px) / 2)); position: fixed; right: 0; z-index: 20; }
.visit-save-bar .button { font-size: 1.05rem; min-height: 56px; width: 100%; }
ul.errorlist { margin: 0; padding: 0; list-style: none; color: var(--red); font-weight: 600; }

@media (max-width: 850px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .two-column, .detail-grid { grid-template-columns: 1fr; }
  .wide { grid-column: auto; }
  .listing-grid { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .topbar { gap: 8px; padding: 10px 14px; }
  .brand span:last-child { display: none; }
  nav { gap: 0; }
  nav a { padding: 10px 8px; font-size: .9rem; }
  .logout-form .button { padding: 8px; }
  .shell { width: min(100% - 24px, 1180px); padding-top: 24px; }
  .hero, .page-heading { align-items: stretch; flex-direction: column; }
  .map-heading { align-items: stretch; flex-direction: column; }
  .map-frame { height: 300px; }
  .hero { border-radius: 22px; }
  .metrics, .listing-grid, .filters, .model-form, .detail-list.columns { grid-template-columns: 1fr; }
  .visit-picker, .visit-step { grid-template-columns: 1fr; }
  .visit-step > .visit-step-number + div { grid-column: auto; }
  .touch-choice ul { grid-template-columns: 1fr 1fr 1fr; }
  .span-2 { grid-column: auto; }
  .listing-card { min-height: 250px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
