:root {
  color-scheme: light;
  --ink: #142033;
  --muted: #4d5b6e;
  --paper: #efe7d8;
  --card: #fffdf8;
  --line: #e4d8c6;
  --accent: #0f6e56;
  --accent-dark: #0b5644;
  --gold: #e7c56a;
  --popular: #7a3e06;
  --popular-bg: #fff1dc;
  --focus: #0b57d0;
  --shadow: 0 16px 40px rgba(20, 32, 51, 0.12);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(231, 197, 106, 0.18), transparent 55%),
    var(--paper);
  line-height: 1.45;
  padding-bottom: calc(2.5rem + env(safe-area-inset-bottom));
}

.skip {
  position: absolute;
  left: 1rem;
  top: 0;
  transform: translateY(-120%);
  background: #fff;
  color: var(--ink);
  padding: 0.75rem 1rem;
  z-index: 5;
}

.skip:focus { transform: none; }

.masthead {
  background:
    radial-gradient(700px 220px at 0% 0%, rgba(231, 197, 106, 0.28), transparent 60%),
    linear-gradient(160deg, #10261f 0%, #17382d 58%, #1f4d3b 100%);
  color: #f6f1e6;
  padding: 1.35rem 0 3.2rem;
}

.site-header,
.search-bar,
.cards,
.territories,
.site-footer {
  width: min(40rem, calc(100% - 2rem));
  margin-inline: auto;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow a { color: inherit; text-decoration: none; }
.eyebrow a:hover { text-decoration: underline; text-underline-offset: 0.2em; }

h1, h2, h3 { line-height: 1.12; }

.masthead h1 {
  margin: 0 0 0.45rem;
  font-size: 2.6rem;
  letter-spacing: -0.04em;
}

.masthead p:last-child {
  margin: 0;
  max-width: 28rem;
  color: #d5e6dc;
}

.search-bar {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-top: -1.7rem;
  padding-bottom: 0.4rem;
}

.search-panel {
  padding: 0.95rem;
  border: 1px solid rgba(255, 253, 248, 0.7);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

label { display: block; font-weight: 800; margin-bottom: 0.35rem; }

input[type="search"],
.copy-fallback input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
}

#search-count { margin: 0.65rem 0 0; color: var(--muted); font-weight: 700; }

.setup-note {
  margin: 0.35rem 0 0;
  color: var(--ink);
  font-weight: 750;
}

.cards, .territories { display: grid; gap: 1.1rem; }

.cards { padding: 0.8rem 0 1rem; }
.territories { padding: 1.2rem 0 2rem; }

.card {
  background: var(--card);
  border: 1px solid rgba(20, 32, 51, 0.06);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.preview-wrap { position: relative; }

.preview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #d7e3de;
}

.preview-fallback {
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-weight: 800;
  color: #f4f1ea;
  background: #1c3a34;
}

.status {
  position: absolute;
  left: 0.8rem;
  bottom: 0.8rem;
  margin: 0;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  font-size: 0.8rem;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(20, 32, 51, 0.16);
}

.status[data-status="not_visited"] { color: #3e4c60; }
.status[data-status="contacted"] { color: #0b57d0; }
.status[data-status="interested"] { color: #7a3e06; }
.status[data-status="sold"] { color: #0f6e56; }

.card-body { padding: 1rem 1rem 1.05rem; }

.card h2 { margin: 0 0 0.25rem; font-size: 1.55rem; letter-spacing: -0.03em; }

.area { margin: 0; color: var(--muted); }

.offer {
  display: inline-block;
  margin: 0.7rem 0 0.9rem;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: #f3faf7;
  color: var(--accent-dark);
  font-size: 0.86rem;
  font-weight: 800;
}

.actions { display: grid; gap: 0.55rem; }

.action-row { display: grid; gap: 0.55rem; }

.button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.8rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover { background: var(--accent-dark); }

.button-purchase {
  min-height: 56px;
  background: linear-gradient(180deg, #178466 0%, #0c5c48 100%);
  box-shadow: 0 10px 20px rgba(15, 110, 86, 0.28);
  font-size: 1.05rem;
}

.button-secondary {
  background: #fff;
  color: var(--ink);
  border-color: #eadfcf;
}

.button:disabled {
  background: #e7e1d6;
  color: #3e4c60;
  box-shadow: none;
  cursor: not-allowed;
}

.copy-status:empty { margin: 0; }
.copy-status:not(:empty) { margin: 0; font-weight: 800; color: var(--accent-dark); }

.copy-fallback { font-weight: 800; }

dialog {
  width: min(40rem, 100%);
  max-height: min(92dvh, 48rem);
  margin: auto auto 0;
  padding: 1.1rem 1rem calc(1.1rem + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  color: var(--ink);
  background:
    radial-gradient(500px 180px at 100% 0%, rgba(231, 197, 106, 0.25), transparent 50%),
    var(--card);
}

dialog::backdrop { background: rgba(16, 38, 31, 0.62); }

.dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-toolbar h2 { margin: 0; font-size: 1.4rem; letter-spacing: -0.03em; }
.dialog-toolbar .button { width: auto; min-width: 5.5rem; }

.plans { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.7rem; }

.plan {
  display: grid;
  gap: 0.35rem;
  padding: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
}

.plan.popular {
  border-color: #0f6e56;
  background: linear-gradient(180deg, #f4fbf8 0%, #fff 70%);
  box-shadow: inset 0 0 0 1px #0f6e56;
}

.plan-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.plan h3 { margin: 0; font-size: 1rem; }
.plan p { margin: 0; }

.today-price {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.today-price span {
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0;
  color: var(--muted);
}

.renews { color: var(--muted); }

.plan-share { display: grid; gap: 0.45rem; margin-top: 0.2rem; }

.badge {
  margin: 0;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: var(--popular-bg);
  color: var(--popular);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.territory {
  display: block;
  padding: 1.2rem 1.15rem 1.15rem;
  border-radius: 24px;
  background: var(--card);
  border: 1px solid rgba(20, 32, 51, 0.06);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}

.territory-count {
  margin: 0 0 0.35rem;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.territory h2 { margin: 0 0 0.3rem; font-size: 2rem; letter-spacing: -0.04em; }
.territory p { margin: 0 0 0.7rem; color: var(--muted); }
.territory ul { margin: 0; padding-left: 1.1rem; }

.site-footer { padding: 0.4rem 0 1rem; color: var(--muted); font-size: 0.92rem; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

@media (min-width: 720px) {
  dialog { margin: auto; border-radius: 24px; }
}

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

@media (forced-colors: active) {
  .button, .card, .plan, .territory, .search-panel { border: 1px solid ButtonText; }
}
