:root {
  --bg: #f3eee5;
  --surface: #fffbf5;
  --surface-strong: #fffdf8;
  --ink: #1e1a16;
  --muted: #5a5048;
  --line: #d9ccbc;
  --accent: #b04832;
  --accent-soft: #f2d8cb;
  --success: #3f7a52;
  --warning: #9f6d1f;
  --danger: #9f3737;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Serif 4", "Georgia", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #f7d9ba 0%, transparent 40%),
    radial-gradient(circle at 10% 10%, #f8e9d7 0%, transparent 35%),
    var(--bg);
}

.page {
  width: min(1200px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: grid;
  gap: 1.2rem;
}

.hero {
  background: linear-gradient(135deg, #2f241d, #5b3a2c 60%, #9d5032 100%);
  color: #fff8f2;
  border-radius: 1rem;
  padding: 1.8rem;
  box-shadow: 0 16px 28px rgba(66, 34, 20, 0.22);
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.75rem;
  opacity: 0.9;
}

.hero h1 {
  margin: 0.3rem 0;
  font-size: clamp(1.4rem, 3vw, 2.3rem);
}

.subtitle {
  margin: 0;
  color: #fbe3d3;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.9rem;
  animation: rise 420ms ease-out;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.45rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface-strong);
  padding: 0.95rem;
  box-shadow: 0 10px 16px rgba(98, 76, 56, 0.08);
  animation: rise 520ms ease-out;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.controls-panel {
  position: relative;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  align-items: end;
}

.controls label {
  display: grid;
  gap: 0.35rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  font-size: 0.86rem;
  color: var(--muted);
}

.controls input,
.controls select,
.controls button {
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  background: #fff;
  padding: 0.7rem 0.75rem;
  font: inherit;
  color: var(--ink);
}

.controls button {
  cursor: pointer;
  background: linear-gradient(180deg, #f7ede4, #f1dfcf);
}

.controls button:hover {
  border-color: var(--accent);
}

.toggle {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  padding-top: 1.4rem;
}

.toggle input {
  width: 1rem;
  height: 1rem;
}

.map-view {
  width: 100%;
  height: 360px;
  border-radius: 0.85rem;
  overflow: hidden;
  background: #e9dfd2;
}

.chart {
  min-height: 180px;
}

.chart-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 0.45rem;
  align-items: end;
}

.bar {
  background: linear-gradient(180deg, #c96443, #9e3d24);
  border-radius: 0.55rem 0.55rem 0.3rem 0.3rem;
  position: relative;
  min-height: 10px;
}

.bar-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.35rem;
  text-align: center;
}

.chart-line svg {
  width: 100%;
  height: 260px;
  border: 1px solid #dbc8b3;
  border-radius: 0.7rem;
  background: linear-gradient(180deg, #fffaf4, #f7efe5 65%, #f4e7da);
}

.trend-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
  color: #6b5d4f;
}

.trend-summary span {
  background: #f5e9dc;
  border: 1px solid #e1cfbc;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.trend-summary .trend-delta.up {
  color: #8a3824;
  font-weight: 700;
}

.trend-summary .trend-delta.down {
  color: #3f7a52;
  font-weight: 700;
}

.trend-summary .trend-delta.flat {
  color: #6b5d4f;
  font-weight: 700;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

td.sparkline-cell {
  min-width: 120px;
}

.sparkline {
  display: block;
  width: 100px;
  height: 30px;
}

.watch-button {
  border: 0;
  background: transparent;
  color: #9a7c2e;
  cursor: pointer;
  font-size: 1.05rem;
  padding: 0;
}

.watch-button.active {
  color: #cc8a00;
}

.watch-button:hover {
  transform: scale(1.08);
}

.listing-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.watchlist-hit {
  background: #fff6dc;
}

th button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
}

th button:hover {
  color: var(--accent);
}

.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.change-log {
  display: grid;
  gap: 0.55rem;
}

.change-item {
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  padding: 0.7rem;
  background: #fffaf4;
}

.change-item p {
  margin: 0.15rem 0;
}

.badge {
  display: inline-block;
  font-size: 0.74rem;
  border-radius: 999px;
  padding: 0.15rem 0.5rem;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
}

.badge.new {
  background: #d9f4df;
  color: var(--success);
}

.badge.price_changed,
.badge.attributes_changed {
  background: #f9ecd0;
  color: var(--warning);
}

.badge.removed {
  background: #f7d4d4;
  color: var(--danger);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .map-view {
    height: 280px;
  }

  .hero {
    padding: 1.2rem;
  }
}
