:root {
  color-scheme: light;
  --bg: #eef1ea;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-soft: #f6f8f3;
  --border: rgba(19, 40, 36, 0.12);
  --ink: #16211d;
  --muted: #5d6c67;
  --deep-green: #173a32;
  --deep-green-2: #20473d;
  --sage: #86a592;
  --mint: #ddece2;
  --gold: #e7c96e;
  --rose: #c86b5b;
  --shadow: 0 16px 36px rgba(17, 30, 26, 0.06);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #f5f7f2 0%, var(--bg) 100%);
}

body {
  line-height: 1.5;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1480px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 40px;
}

.hero,
.toolbar-panel,
.cards-panel,
.detail-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
  gap: 20px;
  align-items: end;
  padding: 22px 24px;
  background: linear-gradient(180deg, var(--deep-green) 0%, #21483f 100%);
  color: #f7faf7;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-weight: 700;
  color: inherit;
  opacity: 0.72;
}

.hero h1,
.section-head h2,
.detail-panel h3,
.detail-section h4 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
  letter-spacing: -0.03em;
}

.hero h1 {
  max-width: 12ch;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.hero-text,
.muted,
.detail-address,
.detail-empty p {
  color: var(--muted);
}

.hero .hero-text {
  max-width: 48rem;
  color: rgba(247, 250, 247, 0.82);
}

.hero-stats,
.summary-badges,
.detail-badges,
.tag-cluster,
.amenity-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-stat,
.badge,
.district-pill,
.amenity-pill,
.theme-pill {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 14px;
}

.hero-stat {
  min-width: 148px;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.hero-stat strong {
  display: block;
  font-size: 1.35rem;
  color: #ffffff;
}

.hero-stat span {
  display: block;
  font-size: 0.82rem;
  color: rgba(247, 250, 247, 0.7);
}

.workspace {
  margin-top: 18px;
}

.results-grid,
.detail-section-grid,
.evidence-grid {
  display: grid;
  gap: 16px;
}

.panel-head,
.section-head,
.results-head,
.detail-head,
.pagination {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-head.compact {
  align-items: center;
}

.panel-head h3,
.detail-empty h3 {
  margin: 0;
  font-size: 1.05rem;
}

.workspace {
  display: grid;
  gap: 18px;
}

.toolbar-panel,
.cards-panel,
.detail-panel {
  padding: 22px;
}

.toolbar-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control {
  display: block;
}

.control span {
  display: block;
  margin-bottom: 8px;
  font-size: 0.92rem;
  font-weight: 700;
}

.control input,
.control select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 13px 14px;
  outline: none;
}

.control input:focus,
.control select:focus {
  border-color: rgba(15, 61, 51, 0.38);
  box-shadow: 0 0 0 4px rgba(126, 168, 143, 0.18);
}

.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.control-search {
  grid-column: span 1;
}

.district-strip {
  margin-top: 18px;
}

.district-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.district-pill {
  display: inline-flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.district-pill:hover,
.district-pill.is-active {
  border-color: rgba(15, 61, 51, 0.28);
  background: rgba(221, 236, 226, 0.95);
  transform: translateY(-1px);
}

.district-pill strong {
  color: var(--deep-green);
}

.results {
  display: grid;
  gap: 16px;
}

.results-grid {
  grid-template-columns: minmax(0, 1fr) 420px;
}

.results-head h2 {
  font-size: clamp(1.7rem, 2.2vw, 2.4rem);
}

.cards-panel,
.detail-panel {
  min-height: 720px;
}

.results-list,
.quote-list {
  display: grid;
  gap: 12px;
}

.result-card,
.detail-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface-strong);
}

.result-card h3 {
  margin: 0;
  font-size: 1rem;
}

.result-card p,
.result-card address {
  margin: 0;
  color: var(--muted);
  font-style: normal;
}

.result-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.result-card:hover,
.result-card.is-active {
  transform: translateY(-2px);
  border-color: rgba(15, 61, 51, 0.28);
  box-shadow: 0 20px 38px rgba(17, 37, 33, 0.08);
}

.card-head,
.card-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-meta {
  margin-top: 14px;
}

.card-kpis,
.card-amenities {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.badge,
.amenity-pill,
.theme-pill {
  font-size: 0.82rem;
  padding: 8px 11px;
}

.badge.good,
.amenity-pill.good,
.theme-pill.good {
  background: var(--mint);
  color: var(--deep-green-2);
}

.badge.warn,
.amenity-pill.warn,
.theme-pill.warn {
  background: rgba(230, 196, 106, 0.22);
  color: #755100;
}

.badge.soft,
.amenity-pill.soft,
.theme-pill.soft {
  background: rgba(86, 108, 102, 0.12);
  color: var(--muted);
}

.badge.alert,
.amenity-pill.alert,
.theme-pill.alert {
  background: rgba(200, 105, 90, 0.16);
  color: #8f3020;
}

.ghost-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.ghost-button {
  background: #ffffff;
}

.primary-button {
  background: var(--deep-green);
  color: white;
  border-color: transparent;
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.detail-empty {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
}

.detail-card {
  padding: 20px;
}

.detail-head {
  margin-bottom: 18px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-title {
  font-size: 2rem;
}

.detail-section {
  margin-top: 18px;
}

.detail-section h4 {
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.detail-section h5 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.fact-grid div {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px;
}

.fact-grid dt {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.fact-grid dd {
  margin: 6px 0 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--deep-green);
}

.quote {
  border-left: 3px solid rgba(15, 61, 51, 0.22);
  padding: 0 0 0 12px;
}

.quote p {
  margin: 0;
}

.quote span {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.pagination {
  margin-top: 16px;
}

.loading,
.empty-state {
  padding: 28px;
  border-radius: 20px;
  border: 1px dashed var(--border);
  text-align: center;
  color: var(--muted);
  background: var(--surface-soft);
}

@media (max-width: 1180px) {
  .workspace,
  .results-grid,
  .detail-section-grid,
  .evidence-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .toolbar-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-search {
    grid-column: 1 / -1;
  }

  .cards-panel,
  .detail-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding-top: 14px;
  }

  .hero,
  .toolbar-panel,
  .cards-panel,
  .detail-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .hero h1 {
    max-width: none;
  }

  .hero-stat {
    min-width: calc(50% - 6px);
  }

  .section-head,
  .results-head,
  .detail-head,
  .pagination,
  .card-head,
  .card-meta,
  .toolbar-grid {
    flex-direction: column;
  }

  .toolbar-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .fact-grid {
    grid-template-columns: 1fr;
  }
}
