:root {
  --bg: #f4f1ea;
  --panel: rgba(255, 252, 247, 0.88);
  --ink: #12212b;
  --muted: #5c6b74;
  --accent: #b14d2d;
  --accent-dark: #7b2b13;
  --line: rgba(18, 33, 43, 0.12);
  --shadow: 0 18px 50px rgba(27, 39, 49, 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(177, 77, 45, 0.12), transparent 24rem),
    linear-gradient(180deg, #f8f4ee 0%, #efeae1 100%);
}

.layout {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

.hero,
.stats,
.workspace {
  margin-bottom: 1.5rem;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: end;
}

.eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent-dark);
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4.6rem);
  line-height: 0.95;
}

.subtitle {
  max-width: 44rem;
  margin: 0.85rem 0 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.status-banner {
  margin: 1rem 0 0;
  padding: 0.8rem 1rem;
  border-radius: 0.9rem;
  background: rgba(177, 77, 45, 0.12);
  border: 1px solid rgba(177, 77, 45, 0.24);
  color: var(--accent-dark);
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: white;
  text-decoration: none;
  cursor: pointer;
}

.button-secondary {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button-full {
  width: 100%;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.stat-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.stat-card {
  padding: 1rem 1.1rem;
}

.stat-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card strong {
  font-size: 1.8rem;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 1rem;
}

.sidebar,
.content {
  display: grid;
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
}

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

.field input,
.field select {
  width: 100%;
  min-height: 2.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.8rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.selection {
  min-height: 12rem;
  line-height: 1.5;
}

.selection.empty {
  color: var(--muted);
}

.map-panel {
  padding: 0;
  overflow: hidden;
}

#map {
  width: 100%;
  height: 34rem;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.75rem;
}

.table-wrap {
  overflow: auto;
}

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

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

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: rgba(177, 77, 45, 0.09);
}

.leaflet-popup-content {
  line-height: 1.45;
}

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

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

@media (max-width: 700px) {
  .layout {
    padding: 1rem;
  }

  .hero {
    flex-direction: column;
    align-items: start;
  }

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

  #map {
    height: 26rem;
  }
}
