:root {
  --bg: #f4efe6;
  --paper: rgba(255, 250, 242, 0.88);
  --paper-strong: #fff8ef;
  --ink: #26211a;
  --muted: #706659;
  --line: rgba(75, 58, 37, 0.14);
  --accent: #126a46;
  --accent-soft: #dff0e8;
  --accent-2: #bb4c1b;
  --shadow: 0 18px 60px rgba(40, 25, 10, 0.12);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font-head: Georgia, "Times New Roman", serif;
  --font-body: "Trebuchet MS", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at top left, rgba(245, 184, 61, 0.22), transparent 26%),
    radial-gradient(circle at top right, rgba(18, 106, 70, 0.16), transparent 23%),
    linear-gradient(180deg, #f6f0e5 0%, #ede4d5 100%);
}

a { color: inherit; }
button, input, select { font: inherit; }
img { max-width: 100%; display: block; }

.page-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 30px 34px;
  margin-bottom: 22px;
  border: 1px solid rgba(85, 63, 36, 0.08);
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255, 248, 239, 0.95), rgba(248, 239, 227, 0.92));
  box-shadow: var(--shadow);
}

.hero h1,
.panel h2,
.panel h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero h1 {
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.02;
  margin-top: 8px;
}

.hero-copy {
  max-width: 820px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
  margin: 12px 0 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 11px;
  color: var(--accent);
  font-weight: 700;
}

.hero-badges,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.hero-badge,
.counter-chip,
.user-chip,
.data-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(83, 69, 43, 0.08);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.panel {
  background: var(--paper);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(76, 57, 31, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 560px;
  padding: 28px;
  margin: 0 auto;
}

.panel-head p {
  color: var(--muted);
  margin-bottom: 0;
}

.auth-form,
.quick-filters,
.filters-grid {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  border-radius: 14px;
  padding: 14px 15px;
  color: var(--ink);
  outline: none;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

input:focus,
select:focus {
  border-color: rgba(18, 106, 70, 0.45);
  box-shadow: 0 0 0 4px rgba(18, 106, 70, 0.1);
}

.primary-button,
.ghost-button {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  padding: 13px 18px;
  font-weight: 800;
  transition: transform .18s ease, opacity .18s ease, background .18s ease;
}

.primary-button:hover,
.ghost-button:hover { transform: translateY(-1px); }
.primary-button:disabled,
.ghost-button:disabled { opacity: 0.5; cursor: default; transform: none; }

.primary-button {
  color: white;
  background: linear-gradient(135deg, #166f4c, #1e8e61);
}

.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(76, 57, 31, 0.1);
}

.error-text {
  margin: 0;
  color: #ab2d2d;
  font-size: 14px;
}

.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.sidebar {
  padding: 22px;
  position: static;
}

.sidebar-top,
.section-head,
.building-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.user-line {
  margin: 14px 0 20px;
}

.search-block {
  display: grid;
  gap: 10px;
}

.search-hint,
.search-status {
  color: var(--muted);
  font-size: 13px;
}

.search-status.is-error {
  color: #ab2d2d;
}

.suggestions {
  display: grid;
  gap: 10px;
  min-height: 100px;
}

.houses-table-wrap {
  overflow: auto;
}

.houses-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1320px;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(76, 57, 31, 0.08);
  border-radius: 16px;
  overflow: hidden;
}

.houses-table th,
.houses-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(76, 57, 31, 0.08);
  vertical-align: top;
  text-align: left;
  font-size: 13px;
  line-height: 1.3;
}

.houses-table th {
  background: rgba(247, 241, 232, 0.92);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.houses-table tbody tr:hover {
  background: rgba(18, 106, 70, 0.04);
}

.houses-table th:nth-child(1) { width: 31%; }
.houses-table th:nth-child(2) { width: 7%; }
.houses-table th:nth-child(3) { width: 7%; }
.houses-table th:nth-child(4) { width: 18%; }
.houses-table th:nth-child(5) { width: 12%; }
.houses-table th:nth-child(6) { width: 17%; }
.houses-table th:nth-child(7) { width: 8%; }

.house-address-cell {
  display: grid;
  gap: 2px;
}

.house-address-line {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.house-address-cell strong {
  font-size: 15px;
  line-height: 1.15;
}

.copy-address-button {
  border: 1px solid rgba(76, 57, 31, 0.12);
  background: rgba(255, 255, 255, 0.8);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.house-address-cell span,
.muted-text {
  color: var(--muted);
}

.premise-list-cell {
  display: grid;
  gap: 6px;
}

.premise-chip {
  display: grid;
  gap: 1px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(76, 57, 31, 0.06);
}

.premise-chip strong {
  font-size: 12px;
}

.premise-chip span {
  color: var(--muted);
  font-size: 12px;
}

.load-more-button {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.suggestion-card {
  display: grid;
  gap: 8px;
  width: 100%;
  text-align: left;
  border-radius: 18px;
  border: 1px solid rgba(76, 57, 31, 0.12);
  background: rgba(255, 255, 255, 0.74);
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.suggestion-card-button {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 16px;
  text-align: left;
  border: none;
  border-bottom: 1px solid rgba(76, 57, 31, 0.08);
  background: transparent;
  cursor: pointer;
}

.suggestion-card:hover,
.suggestion-card.active {
  transform: translateY(-1px);
  border-color: rgba(18, 106, 70, 0.35);
  box-shadow: 0 10px 30px rgba(24, 62, 44, 0.09);
}

.suggestion-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.15;
}

.suggestion-sub,
.meta-line {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-filters {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.advanced-filters {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.advanced-filters summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 12px;
}

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

.sidebar-footer {
  margin-top: 16px;
}

.content {
  display: none;
}

.house-card-body {
  display: grid;
  gap: 18px;
  padding: 18px 18px 20px;
  background: rgba(248, 244, 236, 0.88);
}

.house-card-grid {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.house-card-main {
  display: grid;
  gap: 16px;
}

.house-photo-thumb {
  min-height: 220px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(76, 57, 31, 0.1);
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(238,228,214,.9));
}

.house-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.house-photo-thumb.empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.house-address-list {
  display: grid;
  gap: 8px;
}

.address-line {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(76, 57, 31, 0.08);
}

.address-role {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 800;
}

.house-sections {
  display: grid;
  gap: 16px;
}

.inline-section {
  display: grid;
  gap: 10px;
}

.inline-table-wrap {
  overflow: auto;
}

.empty-state,
.building-panel,
.split-grid > .panel {
  padding: 24px;
}

.empty-state h2 {
  font-size: clamp(36px, 5vw, 62px);
  line-height: 0.96;
  margin: 8px 0 14px;
}

.empty-state p:last-child {
  max-width: 720px;
  font-size: 18px;
  line-height: 1.5;
  color: var(--muted);
}

.detail-stack {
  display: grid;
  gap: 18px;
}

.building-subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.building-main-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 18px;
}

.building-photo {
  min-height: 280px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(76, 57, 31, 0.1);
  background: linear-gradient(180deg, rgba(255,255,255,.7), rgba(238,228,214,.9));
}

.building-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-weight: 700;
}

.photo-caption {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.stats-grid,
.address-grid {
  display: grid;
  gap: 12px;
}

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

.stat-item,
.address-item {
  border-radius: 16px;
  border: 1px solid rgba(76, 57, 31, 0.08);
  background: rgba(255,255,255,.7);
  padding: 14px 16px;
}

.stat-item strong,
.address-item strong {
  display: block;
  margin-bottom: 6px;
}

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

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

.table-wrap {
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

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

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.table a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.data-badge.is-warm {
  background: rgba(187, 76, 27, 0.12);
}

.data-badge.is-cool {
  background: rgba(18, 106, 70, 0.11);
}

.empty-note {
  color: var(--muted);
  line-height: 1.5;
  padding: 12px 0;
}

.hidden { display: none !important; }

@media (max-width: 1200px) {
  .building-main-grid,
  .house-card-grid,
  .house-stat-grid,
  .split-grid,
  .address-grid,
  .stats-grid,
  .filters-grid,
  .quick-filters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .hero {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px;
  }

  .hero,
  .sidebar,
  .empty-state,
  .building-panel,
  .split-grid > .panel {
    padding: 18px;
  }

  .hero h1 {
    font-size: 34px;
  }

  .suggestion-title {
    font-size: 18px;
  }
}
