:root {
  color-scheme: light;
  --bg: #f4f6f2;
  --surface: #ffffff;
  --surface-2: #f9faf7;
  --ink: #171a18;
  --muted: #65706b;
  --faint: #8a948f;
  --line: #dbe1da;
  --line-strong: #c8d0c7;
  --green: #1f6f55;
  --green-dark: #164d3d;
  --gold: #b57a28;
  --rust: #b6533a;
  --blue: #315f7d;
  --shadow: 0 18px 44px rgba(25, 32, 28, .10);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(90deg, rgba(31, 111, 85, .08), transparent 36%),
    linear-gradient(180deg, #f9faf7 0%, var(--bg) 48%, #eef2ed 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1780px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: #151a17;
  color: #f7f3e8;
  border: 1px solid rgba(255, 255, 255, .10);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand,
.topbar-actions,
.filter-head,
.results-head,
.view-switch,
.card-actions,
.card-meta,
.tag-row,
.detail-actions,
.detail-title-row,
.param-chip,
.contact-line {
  display: flex;
  align-items: center;
}

.brand {
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--gold));
  color: #fff;
  font-weight: 900;
}

.brand p,
.filter-head p,
.results-head p,
.metric-tile span,
.source-box span {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar .brand p {
  color: #b8c8bf;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.topbar-actions {
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.ghost-button,
.text-button,
.view-switch button,
.card-actions button,
.card-actions a,
.detail-actions a,
.close-button,
.save-button {
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--green);
  color: #fff;
}

.ghost-button {
  padding: 0 14px;
  background: rgba(255, 255, 255, .08);
  color: #f7f3e8;
  border-color: rgba(255, 255, 255, .20);
}

.text-button {
  min-height: auto;
  padding: 7px 9px;
  background: transparent;
  color: var(--green-dark);
  border-color: var(--line);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.metric-tile {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.metric-tile strong {
  display: block;
  margin-bottom: 7px;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1;
}

.metric-tile em,
.source-box em {
  display: block;
  color: var(--faint);
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
}

.metric-tile.accent {
  color: #fff;
  background: linear-gradient(135deg, var(--green-dark), #243c37);
  border-color: rgba(255, 255, 255, .14);
}

.metric-tile.accent span,
.metric-tile.accent em {
  color: #c9d8cf;
}

.workspace {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.filters,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow);
}

.filters {
  position: sticky;
  top: 14px;
  padding: 16px;
}

.filter-head,
.results-head {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.filter-head h2,
.results-head h2 {
  font-size: 24px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span,
.toggle-line span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 43px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 111, 85, .14);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  margin: 8px 0 14px;
}

.toggle-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.source-box {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f0e5;
}

.source-box strong {
  display: block;
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.results-panel {
  min-width: 0;
  padding: 16px;
}

.view-switch {
  min-height: 43px;
  padding: 4px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.view-switch button {
  min-height: 33px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.view-switch button.is-active {
  color: #fff;
  background: var(--green);
}

.category-bars {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.category-bar {
  width: 100%;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.category-bar span {
  display: block;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.category-bar strong {
  display: block;
  margin-bottom: 8px;
  font-size: 24px;
}

.category-track {
  height: 6px;
  overflow: hidden;
  border-radius: 8px;
  background: #dfe6df;
}

.category-fill {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

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

.listing-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  min-width: 0;
}

.card-image {
  position: relative;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg, rgba(31, 111, 85, .18), rgba(181, 122, 40, .18)),
    #dfe6df;
}

.card-image img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.image-fallback {
  width: 100%;
  height: 100%;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.save-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 2;
  width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: rgba(255, 255, 255, .92);
  border-color: rgba(20, 20, 20, .10);
}

.save-button.is-saved {
  color: #fff;
  background: var(--gold);
}

.detail-title-row .save-button {
  position: static;
  flex: 0 0 42px;
  margin-top: 0;
}

.card-body {
  padding: 14px;
}

.tag-row {
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--green-dark);
  background: #e7f0eb;
  font-size: 12px;
  font-weight: 900;
}

.tag.rent {
  color: #60430d;
  background: #f5ead5;
}

.tag.reserved {
  color: #7a2f22;
  background: #f5dfd9;
}

.tag.category {
  color: var(--blue);
  background: #e1edf4;
}

.listing-card h3 {
  min-height: 52px;
  margin-bottom: 10px;
  font-size: 18px;
  line-height: 1.23;
}

.price-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.price-line strong {
  font-size: 23px;
  line-height: 1;
}

.price-line span {
  color: var(--faint);
  font-size: 12px;
  font-weight: 800;
}

.location-line,
.broker-line {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.location-line {
  min-height: 38px;
  margin-bottom: 9px;
}

.card-meta {
  gap: 7px;
  flex-wrap: wrap;
  min-height: 31px;
  margin-bottom: 12px;
}

.param-chip {
  min-height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 800;
}

.broker-line {
  min-height: 39px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.card-actions {
  gap: 8px;
  margin-top: 13px;
}

.card-actions button,
.card-actions a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

.card-actions button {
  color: #fff;
  background: var(--green-dark);
}

.card-actions a {
  color: var(--green-dark);
  background: #edf4ef;
  border-color: #c7dacd;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  padding: 12px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f1f5f0;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

td strong {
  display: block;
  max-width: 420px;
}

.table-action {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green-dark);
  background: #edf4ef;
  font-weight: 800;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-2);
}

.empty-state strong {
  color: var(--ink);
  font-size: 20px;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 16, 14, .56);
}

.detail-panel {
  position: relative;
  width: min(1100px, 100%);
  max-height: min(880px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}

.close-button {
  position: sticky;
  top: 12px;
  float: right;
  z-index: 2;
  width: 42px;
  margin: 12px 12px 0 0;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border-color: var(--line);
  font-size: 28px;
  line-height: 1;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, .72fr);
  gap: 18px;
  padding: 18px;
}

.detail-media {
  overflow: hidden;
  min-height: 420px;
  border-radius: 8px;
  background: #dfe6df;
}

.detail-media img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.detail-copy {
  min-width: 0;
  padding-right: 8px;
}

.detail-title-row {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.detail-copy h2 {
  margin-bottom: 12px;
  font-size: clamp(24px, 3vw, 34px);
}

.detail-price {
  display: block;
  margin-bottom: 12px;
  color: var(--green-dark);
  font-size: 32px;
  font-weight: 900;
}

.detail-location {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.detail-description {
  margin: 14px 0;
  color: #2d3430;
  line-height: 1.58;
  white-space: pre-line;
}

.detail-actions {
  gap: 9px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.detail-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 144px;
  padding: 0 14px;
  color: #fff;
  background: var(--green-dark);
}

.detail-actions a.secondary {
  color: var(--green-dark);
  background: #edf4ef;
  border-color: #c7dacd;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.detail-param {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.detail-param span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-param strong {
  overflow-wrap: anywhere;
}

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 18px;
}

.thumb-strip img {
  width: 100%;
  aspect-ratio: 16 / 11;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.contact-line {
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.contact-line a {
  color: var(--green-dark);
  font-weight: 900;
}

.is-hidden,
[hidden] {
  display: none !important;
}

@media (max-width: 1280px) {
  .metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .category-bars {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 940px) {
  .app-shell {
    width: min(100% - 18px, 900px);
    padding-top: 9px;
  }

  .topbar,
  .results-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions,
  .view-switch {
    width: 100%;
  }

  .topbar-actions a,
  .topbar-actions button,
  .view-switch button {
    flex: 1;
  }

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

  .filters {
    position: static;
  }

  .metric-strip,
  .category-bars,
  .listing-grid {
    grid-template-columns: 1fr;
  }

  .detail-hero {
    grid-template-columns: 1fr;
  }

  .detail-media {
    min-height: auto;
    aspect-ratio: 16 / 10;
  }

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

@media (max-width: 520px) {
  .brand-mark {
    width: 42px;
    height: 42px;
  }

  .metric-tile {
    min-height: 92px;
  }

  .split-fields,
  .thumb-strip,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-overlay {
    padding: 8px;
  }

  .detail-panel {
    max-height: calc(100vh - 16px);
  }
}
