:root {
  --forest: #237849;
  --forest-deep: #153926;
  --forest-soft: #eaf5ef;
  --moss: #89b68a;
  --paper: #f8fbf9;
  --cream: #edf3ef;
  --ink: #1a231d;
  --ink-soft: #64746c;
  --line: #d7e2da;
  --panel: #ffffff;
  --shadow: 0 18px 40px rgba(16, 36, 26, 0.08);
}

* {
  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(137, 182, 138, 0.22), transparent 24%),
    linear-gradient(180deg, #eef5f0 0%, #e6eee9 100%);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 20px auto 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 28px 32px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 26px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(244, 249, 246, 0.9)),
    linear-gradient(120deg, rgba(35, 120, 73, 0.12), transparent 45%);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--forest);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.topbar h1,
.panel-head h2,
.mini-card h3 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

.topbar h1 {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.04;
  max-width: 760px;
}

.lede,
.subtle {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  color: var(--ink-soft);
  line-height: 1.6;
}

.lede {
  max-width: 760px;
  margin-top: 12px;
  font-size: 16px;
}

.topbar-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: 12px;
  min-width: min(100%, 360px);
}

.stat-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(35, 120, 73, 0.12), rgba(35, 120, 73, 0.04));
  border: 1px solid rgba(35, 120, 73, 0.16);
  font-family: "Segoe UI", sans-serif;
}

.stat-card strong {
  display: block;
  font-size: 30px;
  color: var(--forest-deep);
}

.stat-card span {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.tabbar {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}

.tablink {
  border: 1px solid rgba(21, 57, 38, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-weight: 600;
  transition: 0.18s ease;
}

.tablink.active,
.tablink:hover {
  background: var(--forest);
  color: white;
  border-color: var(--forest);
}

.tabpanel {
  display: none;
}

.tabpanel.active {
  display: block;
}

.workspace,
.panel-surface {
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

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

.filters-panel,
.results-panel,
.panel-surface {
  padding: 24px;
}

.filters-panel {
  background: linear-gradient(180deg, rgba(234, 245, 239, 0.98), rgba(244, 249, 246, 0.98));
  border-right: 1px solid var(--line);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.field {
  display: block;
  margin-bottom: 14px;
}

.field span {
  display: block;
  margin-bottom: 6px;
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  color: var(--ink);
  font-family: "Segoe UI", sans-serif;
}

.field select[multiple] {
  min-height: 120px;
}

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

.ghost-btn,
.primary-btn {
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-weight: 700;
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(21, 57, 38, 0.14);
  color: var(--ink-soft);
}

.primary-btn {
  background: var(--forest);
  border: 1px solid var(--forest);
  color: white;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  background: var(--forest-soft);
  color: var(--forest-deep);
  padding: 8px 12px;
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 249, 0.96));
  padding: 18px 18px 16px;
}

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

.result-type {
  font-family: "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--forest);
}

.result-title {
  margin: 6px 0 8px;
  font-size: 24px;
  line-height: 1.16;
}

.result-summary {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--ink-soft);
}

.result-meta,
.result-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f0f5f2;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  font-family: "Segoe UI", sans-serif;
  font-size: 12px;
}

.result-score {
  min-width: 66px;
  text-align: right;
  font-family: "Segoe UI", sans-serif;
  color: var(--ink-soft);
  font-size: 12px;
}

.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.mini-btn {
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.mini-btn.active {
  background: var(--forest-soft);
  color: var(--forest-deep);
  border-color: rgba(35, 120, 73, 0.28);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

#map-canvas {
  min-height: 620px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.map-sidebar,
.analytics-grid {
  display: grid;
  gap: 16px;
}

.compact-list {
  margin-top: 12px;
}

.compact-item {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-family: "Segoe UI", sans-serif;
}

.compact-item:first-child {
  border-top: none;
  padding-top: 0;
}

.compact-item strong {
  display: block;
  color: var(--ink);
  margin-bottom: 4px;
}

.mini-card {
  padding: 18px;
  border-radius: 20px;
  background: rgba(248, 251, 249, 0.9);
  border: 1px solid var(--line);
}

.mini-card h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

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

.analytics-wide {
  grid-column: 1 / -1;
}

.stack-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px;
  gap: 10px;
  align-items: center;
  font-family: "Segoe UI", sans-serif;
}

.stack-row .bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--forest), var(--moss));
}

.stack-row .label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stack-row .value {
  text-align: right;
  color: var(--ink-soft);
  font-size: 13px;
}

.year-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-height: 220px;
  padding: 8px 4px 42px;
  overflow-x: auto;
  overflow-y: visible;
}

.year-bar {
  flex: 1 1 auto;
  min-width: 18px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, var(--forest), #87b48c);
  position: relative;
}

.year-bar span {
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%) rotate(-35deg);
  transform-origin: top left;
  font-family: "Segoe UI", sans-serif;
  font-size: 11px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  color: var(--ink-soft);
  font-family: "Segoe UI", sans-serif;
  background: rgba(248, 251, 249, 0.7);
}

.shortlist-drawer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(72vh, 720px);
  overflow: auto;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(21, 57, 38, 0.12);
  box-shadow: 0 24px 48px rgba(16, 36, 26, 0.16);
  z-index: 40;
}

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

.shortlist-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.shortlist-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: "Segoe UI", sans-serif;
}

.shortlist-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}

.record-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(19, 35, 26, 0.46);
  z-index: 80;
}

.record-modal.open {
  display: flex;
}

.record-dialog {
  width: min(1080px, 100%);
  max-height: 88vh;
  overflow: auto;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 249, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.52);
  box-shadow: 0 26px 60px rgba(16, 36, 26, 0.22);
  padding: 24px;
}

.detail-summary {
  margin: 16px 0 18px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(234, 245, 239, 0.7);
  font-family: "Segoe UI", sans-serif;
  line-height: 1.7;
  color: var(--ink-soft);
}

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

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

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.detail-section p {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  line-height: 1.65;
  color: var(--ink-soft);
}

@media (max-width: 1100px) {
  .workspace,
  .map-layout,
  .analytics-grid,
  .topbar {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }

  .filters-panel {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100%, calc(100% - 20px));
  }

  .topbar,
  .filters-panel,
  .results-panel,
  .panel-surface {
    padding: 18px;
  }

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

  .tabbar {
    flex-wrap: wrap;
  }

  .shortlist-drawer {
    left: 10px;
    right: 10px;
    width: auto;
    bottom: 10px;
  }
}
