:root {
  --bg: #f4efe6;
  --paper: #fffaf3;
  --paper-strong: #fffdf9;
  --ink: #182028;
  --muted: #665d53;
  --line: #dccbb2;
  --accent: #b25519;
  --accent-2: #005f73;
  --ok: #2d6a4f;
  --warn: #d97706;
  --bad: #9f1239;
  --shadow: 0 18px 50px rgba(43, 31, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(178, 85, 25, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(0, 95, 115, 0.12), transparent 28%),
    linear-gradient(180deg, #eadfce 0%, var(--bg) 30%, #f7f2eb 100%);
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.shell {
  max-width: 1380px;
  margin: 0 auto;
  padding: 28px 18px 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: stretch;
}

.hero-panel,
.panel,
.lot-card,
.detail-card {
  background: rgba(255, 250, 243, 0.9);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(220, 203, 178, 0.9);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero-panel {
  padding: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.78rem;
}

.headline {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 5.8rem);
  line-height: 0.92;
}

.subline {
  max-width: 54rem;
  margin: 14px 0 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--muted);
}

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

.metric {
  padding: 18px;
  border-radius: 18px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.metric-label {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-value {
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto auto;
  gap: 12px;
  margin: 18px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.sortbox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
}

.sortbox select {
  border: 0;
  background: transparent;
  outline: none;
  font: inherit;
  color: var(--ink);
}

.favorite-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.84);
  color: var(--accent);
  border-radius: 999px;
  min-width: 42px;
  min-height: 42px;
  cursor: pointer;
}

.favorite-button.is-active {
  background: rgba(178, 85, 25, 0.14);
  border-color: rgba(178, 85, 25, 0.35);
}

.search {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}

.search input {
  width: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 1rem;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

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

.button.secondary {
  background: var(--accent-2);
}

.button.ghost {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.filters-block {
  margin-bottom: 18px;
}

.filters-title {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
}

.chip.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.chip.is-soft-active {
  background: rgba(0, 95, 115, 0.12);
  color: var(--accent-2);
  border-color: rgba(0, 95, 115, 0.3);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 0.55fr);
  gap: 18px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 14px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.mini {
  color: var(--muted);
  font-size: 0.92rem;
}

.map-stage {
  position: relative;
  min-height: 280px;
  border-radius: 20px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(178, 85, 25, 0.08), transparent 40%),
    linear-gradient(180deg, #f8f1e7 0%, #fefcf8 100%);
  border: 1px solid var(--line);
}

.map-stage.is-leaflet {
  min-height: 420px;
  background: #dbe7ea;
}

.map-canvas {
  width: 100%;
  min-height: 420px;
}

.map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(24, 32, 40, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(24, 32, 40, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 100%);
}

.map-stage::after {
  content: "Dresden Overview";
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.map-stage.is-leaflet::after {
  content: "";
}

.map-point,
.map-origin {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
}

.map-point {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.16);
}

.map-point.open { background: var(--ok); }
.map-point.nodata { background: var(--warn); }
.map-point.closed { background: var(--bad); }
.map-point.selected {
  width: 20px;
  height: 20px;
  box-shadow: 0 0 0 6px rgba(0, 95, 115, 0.18);
}

.map-origin {
  width: 18px;
  height: 18px;
  background: var(--accent-2);
  border: 3px solid #fff;
  box-shadow: 0 0 0 8px rgba(0, 95, 115, 0.14);
}

.leaflet-container {
  font-family: Georgia, "Times New Roman", serif;
}

.leaflet-popup-content-wrapper {
  border-radius: 16px;
}

.map-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18);
}

.map-pin.open {
  background: var(--ok);
}

.map-pin.nodata {
  background: var(--warn);
}

.map-pin.closed {
  background: var(--bad);
}

.map-pin.selected {
  width: 24px;
  height: 24px;
  border-width: 4px;
  box-shadow: 0 0 0 8px rgba(0, 95, 115, 0.16);
}

.map-origin-pin {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-2);
  border: 4px solid #fff;
  box-shadow: 0 0 0 10px rgba(0, 95, 115, 0.14);
}

.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--muted);
}

.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 999px;
}

.legend .open::before { background: var(--ok); }
.legend .nodata::before { background: var(--warn); }
.legend .closed::before { background: var(--bad); }

.list {
  display: grid;
  gap: 12px;
}

.lot-card {
  padding: 16px;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease;
}

.lot-card:hover {
  transform: translateY(-1px);
}

.lot-card.is-selected {
  border-color: var(--accent-2);
  box-shadow: 0 10px 30px rgba(0, 95, 115, 0.15);
}

.lot-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.lot-title {
  margin: 0;
  font-size: 1.22rem;
}

.lot-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lot-region {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge.open {
  color: var(--ok);
  background: rgba(45, 106, 79, 0.12);
}

.badge.nodata {
  color: var(--warn);
  background: rgba(217, 119, 6, 0.12);
}

.badge.closed {
  color: var(--bad);
  background: rgba(159, 18, 57, 0.12);
}

.lot-meta {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 0.95rem;
}

.lot-meta strong {
  display: block;
  font-size: 1.1rem;
}

.detail-card {
  padding: 20px;
  position: sticky;
  top: 18px;
}

.detail-card h2 {
  margin: 0;
  font-size: 1.8rem;
}

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

.detail-address {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
}

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

.detail-stat {
  padding: 16px;
  border-radius: 18px;
  background: var(--paper-strong);
  border: 1px solid var(--line);
}

.detail-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
}

.chart {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(0, 95, 115, 0.05), rgba(255, 255, 255, 0.8));
}

.chart-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.chart-chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  cursor: pointer;
}

.chart-chip.is-active {
  background: var(--accent-2);
  color: #fff;
  border-color: var(--accent-2);
}

.chart svg {
  display: block;
  width: 100%;
  height: 180px;
}

.chart text {
  font-size: 12px;
  fill: var(--muted);
}

.chart polyline {
  fill: none;
  stroke: var(--accent-2);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .area {
  fill: rgba(0, 95, 115, 0.1);
}

.chart .bar {
  fill: rgba(178, 85, 25, 0.28);
}

.empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--muted);
}

.footnote {
  margin-top: 18px;
  font-size: 0.92rem;
  color: var(--muted);
}

.livebar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.94rem;
}

.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.55);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0.5);
  }
  70% {
    box-shadow: 0 0 0 12px rgba(45, 106, 79, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(45, 106, 79, 0);
  }
}

@media (max-width: 1100px) {
  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .detail-card {
    position: static;
  }
}

@media (max-width: 680px) {
  .hero-stats,
  .detail-grid {
    grid-template-columns: 1fr;
  }

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

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

  .shell {
    padding-inline: 12px;
  }
}
