:root {
  --page-bg: #f4efe7;
  --card-bg: rgba(255, 251, 245, 0.94);
  --ink: #1c1814;
  --muted: #64584d;
  --accent: #285943;
  --accent-soft: #dceadf;
  --border: rgba(28, 24, 20, 0.12);
  --shadow: 0 18px 38px rgba(57, 45, 34, 0.12);
  --radius: 18px;
}

* {
  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(40, 89, 67, 0.12), transparent 28%),
    linear-gradient(180deg, #efe5d7 0%, var(--page-bg) 100%);
}

a {
  color: var(--accent);
}

.page-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero,
.analytics-panel,
.controls-panel,
.table-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.hero {
  padding: 28px;
  margin-bottom: 18px;
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

.lede {
  max-width: 70ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.section-copy {
  margin: 8px 0 0;
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.6;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  color: var(--muted);
}

.analytics-panel {
  padding: 22px;
  margin-bottom: 18px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.chart-card {
  display: grid;
  grid-template-rows: 82px auto;
  align-items: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background:
    linear-gradient(180deg, rgba(244, 239, 231, 0.7) 0%, rgba(244, 239, 231, 0.96) 100%);
}

.chart-heading {
  display: grid;
  align-content: start;
  text-align: center;
}

.chart-heading p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
}

.chart-frame {
  width: 100%;
  padding: 0;
  background: transparent;
}

.chart-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.chart-grid-line {
  stroke: rgba(28, 24, 20, 0.1);
  stroke-width: 1;
}

.chart-axis-line {
  stroke: rgba(28, 24, 20, 0.2);
  stroke-width: 1.2;
}

.chart-axis-label,
.chart-total-label {
  fill: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
}

.chart-axis-label-x {
  text-anchor: middle;
}

.chart-axis-label-y {
  text-anchor: end;
}

.chart-total-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
}

.chart-bar-segment {
  stroke: rgba(255, 255, 255, 0.92);
  stroke-width: 1;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  align-content: start;
  gap: 8px 12px;
  margin-top: 12px;
  min-height: 40px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(28, 24, 20, 0.08);
}

.chart-empty {
  margin: 0;
  min-height: 232px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.controls-panel {
  padding: 20px;
  margin-bottom: 18px;
}

.search-control,
.page-size-control,
.filter-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  color: var(--muted);
}

.search-control input,
.page-size-control select,
.filter-control select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.checkbox-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  min-height: 48px;
  align-content: flex-start;
}

.checkbox-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 0.88rem;
}

.table-panel {
  padding: 14px;
  overflow-x: auto;
}

#taxonomy-table {
  overflow: hidden;
  border-radius: 14px;
  min-width: 1220px;
}

.tabulator {
  font-size: 0.92rem;
  border: none;
  background: transparent;
}

.tabulator .tabulator-header {
  border-bottom: 1px solid var(--border);
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 16px, 1200px);
    padding-top: 16px;
  }

  .hero,
  .analytics-panel,
  .controls-panel,
  .table-panel {
    border-radius: 14px;
  }

  .analytics-panel {
    padding: 18px;
  }

  .chart-card {
    padding: 16px;
    grid-template-rows: auto auto;
  }

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

  .chart-heading {
    padding-bottom: 2px;
  }
}
