.stats-topnav-controls {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.stats-topnav-year {
  margin-left: auto;
  display: flex;
  align-items: center;
}
:root {
  --page-bg: #eef1ee;
  --page-bg-alt: #f7f6f1;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-soft: rgba(247, 245, 239, 0.92);
  --surface-accent: rgba(229, 236, 231, 0.88);
  --text: #1e312c;
  --text-muted: #5b6f68;
  --text-soft: #778881;
  --line: rgba(30, 49, 44, 0.12);
  --line-strong: rgba(30, 49, 44, 0.2);
  --shadow-lg: 0 24px 60px rgba(20, 37, 33, 0.08);
  --shadow-md: 0 14px 28px rgba(20, 37, 33, 0.07);
  --shadow-sm: 0 8px 18px rgba(20, 37, 33, 0.05);
  --focus: #2f678b;
  --site: #3c7d6a;
  --site-soft: rgba(60, 125, 106, 0.12);
  --manual-source: #4d6f9a;
  --manual-source-soft: rgba(77, 111, 154, 0.12);
  --active: #2f7d61;
  --active-soft: rgba(47, 125, 97, 0.13);
  --changed: #aa7630;
  --changed-soft: rgba(170, 118, 48, 0.14);
  --removed: #8c5656;
  --removed-soft: rgba(140, 86, 86, 0.14);
  --manual: #496892;
  --manual-soft: rgba(73, 104, 146, 0.14);
  --tag-bg: #edf1eb;
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --max-width: 1220px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(214, 226, 216, 0.8), transparent 32%),
    radial-gradient(circle at top right, rgba(237, 228, 212, 0.72), transparent 26%),
    linear-gradient(180deg, var(--page-bg-alt) 0%, var(--page-bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(30, 49, 44, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 49, 44, 0.02) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 78%);
}

a,
button,
input,
select {
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(47, 103, 139, 0.18);
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 1.3rem 0 4rem;
}

.archive-topnav {
  position: sticky;
  top: 0;
  z-index: 220;
  padding: 0.6rem 1rem 0.7rem;
  background: rgba(238, 241, 238, 0.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(30, 49, 44, 0.12);
  box-shadow: 0 1px 16px rgba(20, 37, 33, 0.06);
}

.archive-topnav__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stats-topnav-flex {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stats-topnav-filters {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-left: 0;
}

.stats-checkbox-label {
  display: flex;
  align-items: center;
  font-size: 1rem;
  color: var(--text-muted);
  gap: 0.3rem;
  user-select: none;
  opacity: 1;
}
.stats-checkbox-label.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.topnav-links {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.archive-topnav__status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
  min-width: 0;
  margin-left: auto;
}

.archive-topnav__status .result-summary {
  margin: 0;
  font-size: 0.8rem;
  white-space: nowrap;
}

.archive-topnav__status .active-filters {
  margin-top: 0;
  min-height: 0;
  max-width: min(52vw, 760px);
  justify-content: flex-end;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
}

.archive-topnav--stats .archive-topnav__filters {
  grid-template-columns: minmax(180px, 240px);
  justify-content: end;
}

.archive-topnav--stats .archive-topnav__status {
  max-width: 56vw;
}

.page-top-action-wrap {
  display: flex;
  justify-content: center;
  padding: 1.5rem 0 0.8rem;
}

.page-top-action {
  min-height: 42px;
  padding: 0.6rem 1rem;
}

.topnav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 49, 44, 0.12);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topnav-link:hover {
  background: #ffffff;
}

.topnav-link.is-active {
  border-color: rgba(62, 108, 87, 0.35);
  background: rgba(62, 108, 87, 0.18);
  box-shadow: inset 0 0 0 1px rgba(62, 108, 87, 0.2);
}

.topnav-link--button {
  font: inherit;
  cursor: pointer;
}

.archive-topnav__filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.archive-topnav__input,
.archive-topnav__select {
  min-height: 36px;
  border: 1px solid rgba(30, 49, 44, 0.14);
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
}

.archive-topnav__input {
  grid-column: span 2;
}

.archive-topnav__control {
  min-height: 36px;
  border: 1px solid rgba(30, 49, 44, 0.12);
  border-radius: 10px;
  padding: 0.35rem 0.65rem;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--surface-soft);
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.archive-topnav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
}

.archive-topnav__toggle input {
  margin: 0;
}

.archive-topnav__reset {
  cursor: pointer;
}

.archive-topnav__control:hover,
.archive-topnav__control:focus-visible {
  background: #ece7db;
}

@media (max-width: 980px) {
  .archive-topnav__row {
    flex-wrap: wrap;
  }

  .archive-topnav__status {
    width: 100%;
    justify-content: flex-start;
  }

  .archive-topnav--stats .archive-topnav__filters {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .archive-topnav--stats .archive-topnav__status {
    max-width: 100%;
  }

  .archive-topnav__status .active-filters {
    max-width: 100%;
    justify-content: flex-start;
  }

  .archive-topnav__status .result-summary {
    white-space: normal;
    line-height: 1.3;
  }

  .archive-topnav__input {
    grid-column: span 1;
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 1.6rem;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(244, 240, 232, 0.88)),
    linear-gradient(180deg, rgba(229, 236, 231, 0.3), transparent 60%);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(14px);
}

.eyebrow,
.section-heading__eyebrow,
.timeline-year__label,
.timeline-group__month,
.panel-card__label,
.summary-chip__label,
.info-card__badge {
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0.3rem 0 1rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(2.9rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.hero__intro {
  max-width: 48rem;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.75;
  color: var(--text-muted);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 1.7rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0.85rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

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

.button--primary {
  color: #ffffff;
  background: linear-gradient(135deg, #315f55, #437766);
  box-shadow: var(--shadow-sm);
}

.button--primary:hover,
.button--primary:focus-visible {
  background: linear-gradient(135deg, #284f46, #3a695a);
}

.button--secondary {
  color: var(--text);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(30, 49, 44, 0.14);
}

.button--secondary:hover,
.button--secondary:focus-visible {
  background: #ffffff;
}

.button--ghost {
  color: var(--text);
  background: var(--surface-soft);
  border-color: rgba(30, 49, 44, 0.12);
}

.button--ghost:hover,
.button--ghost:focus-visible {
  background: #ece7db;
}

.hero__statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-top: 1.6rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(30, 49, 44, 0.1);
}

.hero__status-label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.hero__panel {
  display: grid;
  gap: 1rem;
}

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

.hero__panel .summary-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0;
}

.panel-card,
.controls,
.timeline-year,
.document-card,
.info-card,
.summary-chip,
.timeline-nav {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.panel-card {
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-lg);
}

.panel-card--highlight {
  background: linear-gradient(145deg, rgba(248, 245, 238, 0.96), rgba(255, 255, 255, 0.95));
}

.panel-card__label {
  display: block;
  color: var(--text-soft);
}

.panel-card strong {
  display: block;
  margin-top: 0.45rem;
  font-size: 1.12rem;
}

.panel-card p {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.section {
  margin-top: 1.8rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
}

.section-heading h2 {
  margin: 0.2rem 0 0.5rem;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  line-height: 1.05;
}

.section-heading__text {
  max-width: 52rem;
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.controls {
  padding: 1.35rem;
  border-radius: var(--radius-lg);
}

.search-field,
.filter-field {
  display: grid;
  gap: 0.45rem;
}

.search-field--wide {
  margin-bottom: 0.95rem;
}

.search-field label,
.filter-field label {
  font-size: 0.92rem;
  font-weight: 700;
}

.search-field input,
.filter-field select,
.toggle-field {
  min-height: 50px;
  border: 1px solid rgba(30, 49, 44, 0.14);
  border-radius: var(--radius-sm);
  font: inherit;
}

.search-field input,
.filter-field select {
  width: 100%;
  padding: 0.9rem 1rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.95rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.toolbar--split {
  align-items: flex-start;
}

.toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.8rem;
}

.result-summary {
  margin: 0;
  color: var(--text-muted);
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
  min-height: 1.8rem;
}

.active-filter-pill,
.status-pill,
.origin-pill,
.tag,
.link-chip,
.timeline-nav__link,
.info-card__badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

.active-filter-pill {
  background: var(--surface-accent);
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}

.toggle-field input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--site);
}

.toggle-field span {
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem 1rem;
  margin: 0;
  color: var(--text-muted);
}

.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.legend__dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 999px;
}

.legend__dot--site {
  background: var(--site);
}

.legend__dot--manual-source {
  background: var(--manual-source);
}

.legend__dot--active {
  background: var(--active);
}

.legend__dot--changed {
  background: var(--changed);
}

.legend__dot--removed {
  background: var(--removed);
}

.legend__dot--manual {
  background: var(--manual);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.summary-chip {
  padding: 1rem 1.05rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.summary-chip__label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-soft);
}

.summary-chip strong {
  font-size: 1.1rem;
}

.timeline-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  padding: 0.8rem;
  margin-bottom: 1rem;
  border-radius: var(--radius-lg);
}

.timeline-nav__link {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(30, 49, 44, 0.1);
}

.timeline-nav__link:hover,
.timeline-nav__link:focus-visible {
  background: #ffffff;
}

.timeline {
  display: grid;
  gap: 1.25rem;
}

.timeline-year {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
}

.timeline-year__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.timeline-year__header h2 {
  margin: 0.15rem 0 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  font-size: 2.2rem;
}

.timeline-group {
  position: relative;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 1.2rem;
  padding: 0.35rem 0;
}

.timeline-group::before {
  content: "";
  position: absolute;
  left: 185px;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 1px;
  background: linear-gradient(180deg, rgba(30, 49, 44, 0.14), rgba(30, 49, 44, 0.05));
}

.timeline-group__header {
  position: sticky;
  top: 1rem;
  align-self: start;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(245, 241, 232, 0.82), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 0 0 1px rgba(30, 49, 44, 0.06);
}

.timeline-group__month {
  margin: 0 0 0.3rem;
}

.timeline-group__count {
  margin: 0;
  color: var(--text-muted);
}

.timeline-group__details {
  margin: 0.45rem 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.timeline-group__items {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.document-card {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 246, 0.9));
  border: 1px solid rgba(30, 49, 44, 0.08);
  overflow: hidden;
  margin-bottom: 0.8rem;
}

.document-card--collapsible {
  display: grid;
  grid-template-rows: auto 0fr;
  transition: grid-template-rows 200ms ease;
}

.document-card--collapsible.document-card--expanded {
  grid-template-rows: auto 1fr;
}

.document-card__header {
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid rgba(30, 49, 44, 0.06);
  cursor: pointer;
}

.document-card__header:hover {
  background: rgba(247, 245, 239, 0.3);
}

.document-card__header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 0.7rem;
}

.document-card__title {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.4;
  flex: 1;
  min-width: 0;
}

.document-card__header-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-shrink: 0;
}

.document-card__links-preview {
  display: flex;
  gap: 0.6rem;
}

.document-card__links-preview .link-chip {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.document-card__expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--text-soft);
  transition: all 200ms ease;
  flex-shrink: 0;
}

.document-card__expand-btn:hover {
  background: rgba(30, 49, 44, 0.06);
  color: var(--text);
}

.expand-icon {
  display: inline-block;
  transition: transform 200ms ease;
  font-size: 0.9rem;
}

.document-card--expanded .expand-icon {
  transform: rotate(180deg);
}

.document-card__tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.document-card__tags-preview .tag {
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  background: #e8f0e6;
  border: 1px solid #d0e3ca;
  color: #2d6a4f;
  cursor: pointer;
  transition: all 160ms ease;
}

.document-card__tags-preview .tag:hover {
  background: #d0e3ca;
  transform: scale(1.05);
}

.document-card__details {
  padding: 1.15rem 1.3rem;
  display: grid;
  gap: 0.9rem;
  overflow: hidden;
}

.document-card::before {
  content: "";
  position: absolute;
  left: -1.05rem;
  top: 1.7rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 3px solid var(--page-bg);
  background: var(--active);
  box-shadow: 0 0 0 1px rgba(30, 49, 44, 0.12);
}

.document-card[data-status="changed"]::before {
  background: var(--changed);
}

.document-card[data-status="removed_from_source"]::before {
  background: var(--removed);
}

.document-card[data-status="manual"]::before {
  background: var(--manual);
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 42px rgba(20, 37, 33, 0.09);
}

.document-card__topline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.origin-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.origin-pill--sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
}

.origin-pill[data-origin="digelag_site"] {
  color: var(--site);
  background: var(--site-soft);
}

.origin-pill[data-origin="manual_upload"] {
  color: var(--manual-source);
  background: var(--manual-source-soft);
}

.status-pill[data-status="active"] {
  color: var(--active);
  background: var(--active-soft);
}

.status-pill[data-status="changed"] {
  color: var(--changed);
  background: var(--changed-soft);
}

.status-pill[data-status="removed_from_source"] {
  color: var(--removed);
  background: var(--removed-soft);
}

.status-pill[data-status="manual"] {
  color: var(--manual);
  background: var(--manual-soft);
}

.document-card__title {
  margin: 0;
  font-size: 1.22rem;
  line-height: 1.42;
}

.document-card__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin: 0;
}

.document-card__meta div {
  display: grid;
  gap: 0.12rem;
}

.document-card__meta dt {
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.document-card__meta dd {
  margin: 0;
}

.document-card__tags,
.document-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.tag {
  background: var(--tag-bg);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 49, 44, 0.08);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
}

.tag:hover {
  background: rgba(214, 226, 216, 0.7);
  transform: scale(1.05);
}

.tag.tag--active {
  background: var(--site);
  color: white;
  border-color: var(--site);
}

.document-card__notes {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.6;
}

.link-chip {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(30, 49, 44, 0.12);
}

.link-chip:hover,
.link-chip:focus-visible {
  background: #ffffff;
}

.link-chip--muted {
  background: rgba(245, 241, 232, 0.88);
}

.empty-state,
.app-message {
  padding: 1.3rem;
  border-radius: var(--radius-lg);
}

.empty-state {
  border: 1px dashed rgba(30, 49, 44, 0.18);
  background: rgba(255, 255, 255, 0.62);
  color: var(--text-muted);
}

.app-message {
  background: rgba(140, 86, 86, 0.1);
  color: #6d4040;
}

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

.info-card {
  padding: 1.3rem;
  border-radius: var(--radius-lg);
}

.info-card h3 {
  margin: 0.85rem 0 0.55rem;
  font-size: 1.15rem;
}

.info-card p {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.7;
}

.info-card__badge {
  width: fit-content;
}

.info-card__badge--site {
  color: var(--site);
  background: var(--site-soft);
}

.info-card__badge--manual {
  color: var(--manual-source);
  background: var(--manual-source-soft);
}

.info-card__badge--archive {
  color: var(--changed);
  background: var(--changed-soft);
}

@media (max-width: 1040px) {
  .hero,
  .section-heading--split {
    grid-template-columns: 1fr;
  }

  .hero__stats,
  .summary-strip,
  .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .legend {
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .timeline-group {
    grid-template-columns: 1fr;
  }

  .timeline-group::before,
  .document-card::before {
    display: none;
  }

  .timeline-group__header {
    position: static;
  }

  .timeline-group__items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--max-width));
    padding-top: 0.7rem;
  }

  .hero,
  .controls,
  .timeline-year,
  .info-card {
    padding: 1rem;
  }

  .hero__stats,
  .summary-strip,
  .info-grid,
  .filters-grid,
  .document-card__meta {
    grid-template-columns: 1fr;
  }

  .hero__actions,
  .toolbar,
  .toolbar__actions,
  .timeline-year__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .button,
  .toggle-field {
    width: 100%;
  }

  .hero h1 {
    font-size: clamp(2.25rem, 12vw, 3.1rem);
  }
}

.document-card__title {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.4;
}

.document-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(20, 41, 34, 0.1);
}

.document-card__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem 1rem;
  margin: 0;
}

.document-card__meta div {
  display: grid;
  gap: 0.12rem;
}

.document-card__meta dt {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.document-card__meta dd {
  margin: 0;
}

.document-card__tags,
.document-card__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.document-card__links {
  padding-top: 0.15rem;
}

.tag {
  background: var(--tag);
}

.document-card__notes {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.55;
}

.link-chip {
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(25, 49, 40, 0.12);
}

.link-chip:hover,
.link-chip:focus-visible {
  background: #ffffff;
}

.link-chip--muted {
  background: rgba(245, 241, 232, 0.86);
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed rgba(25, 49, 40, 0.18);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.55);
  color: var(--text-muted);
}

.app-message {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: rgba(138, 79, 79, 0.1);
  color: #6f3b3b;
}

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

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

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

  .timeline-group {
    grid-template-columns: 1fr;
  }

  .timeline-group::before,
  .document-card::before {
    display: none;
  }

  .timeline-group__header {
    position: static;
  }

  .timeline-group__items {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(calc(100% - 1rem), var(--max-width));
    padding-top: 0.8rem;
  }

  .hero,
  .controls,
  .timeline-year {
    padding: 1rem;
  }

  .hero__meta,
  .summary-strip,
  .filters-grid,
  .document-card__meta {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .timeline-year__header,
  .toolbar__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: clamp(2rem, 12vw, 2.8rem);
  }

  .toggle-field,
  .reset-button {
    width: 100%;
  }
}

/* ============================================================
   STATISTICS PAGE (statistics.html + stats.js)
   ============================================================ */

.stats-body {
  /* No extra grid offset — topnav is position:sticky */
}

/* ---- Page shell ---- */
.stats-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 0.8rem 0 5rem;
}

/* ---- Hero ---- */
.stats-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 2rem;
  padding: 3rem 2rem 4.5rem;
  margin-bottom: 2.5rem;
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background:
    linear-gradient(145deg, rgba(30, 49, 44, 0.88), rgba(46, 88, 75, 0.92)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Ccircle cx='30' cy='30' r='1.5' fill='rgba(255,255,255,0.06)'/%3E%3C/svg%3E");
  overflow: hidden;
}

.stats-hero__text {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stats-hero .eyebrow {
  color: rgba(180, 210, 195, 0.88);
  margin: 0;
}

.stats-hero h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(2.2rem, 4vw, 3.5rem);
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.stats-hero__intro {
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: rgba(215, 235, 225, 0.88);
  max-width: 38rem;
}

.stats-hero__actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.stats-hero .button--primary {
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
  border: 1.5px solid rgba(255,255,255,0.40);
  color: #ffffff;
  backdrop-filter: blur(8px);
}
.stats-hero .button--primary:hover {
  background: linear-gradient(135deg, rgba(255,255,255,0.32), rgba(255,255,255,0.22));
}
.stats-hero .button--secondary {
  background: rgba(30, 49, 44, 0.35);
  border: 1px solid rgba(255,255,255,0.22);
  color: rgba(215, 235, 225, 0.95);
}
.stats-hero .button--secondary:hover {
  background: rgba(30, 49, 44, 0.5);
}

/* ---- KPI grid ---- */
.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  align-content: start;
}

.stats-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.1rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
}

.stats-kpi--accent {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.stats-kpi__label {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(180, 210, 195, 0.8);
}

.stats-kpi__value {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #ffffff;
}

.stats-kpi__sub {
  font-size: 0.82rem;
  color: rgba(180, 210, 195, 0.7);
}

/* ---- Hero decorative wave ---- */
.stats-hero__wave {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
}
.stats-hero__wave svg {
  width: 100%;
  height: 100%;
}

/* ---- Section layout ---- */
.stats-section {
  margin-bottom: 2rem;
}

.stats-section--2col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.stats-section__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.stats-section__header h2 {
  margin: 0.2rem 0 0.4rem;
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  line-height: 1.1;
}

.stats-section__header .eyebrow {
  margin: 0;
}

.stats-section__desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.stats-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-accent);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

/* ---- Chart cards ---- */
.stats-chart-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  padding: 1.4rem 1.5rem 1.2rem;
}

.stats-chart-card--heatmap {
  position: relative;
}

.stats-chart-card--wide {
  /* full width by default, no column adjustment */
}

.stats-chart-wrap {
  position: relative;
  width: 100%;
}

.activity-doc-panel {
  margin-top: 1rem;
  padding-top: 0.95rem;
  border-top: 1px dashed var(--line);
}

.activity-doc-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.65rem;
}

.activity-doc-panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.activity-doc-panel__close {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}

.activity-doc-panel__close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.activity-doc-panel__list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.activity-doc-panel__list li {
  margin: 0.15rem 0;
}

.activity-doc-panel__actions {
  margin-top: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* ---- Legend ---- */
.stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.stats-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 30px;
  padding: 0.25rem 0.8rem 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(30, 49, 44, 0.1);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.stats-legend__item:hover {
  background: #ffffff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.stats-legend__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Heatmap ---- */
.stats-heatmap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-x: auto;
  padding: 0.25rem 0;
}

.heatmap-row {
  display: flex;
  align-items: stretch;
  gap: 3px;
  min-height: 34px;
}

.heatmap-row--header {
  align-items: center;
  min-height: 26px;
}

.heatmap-month-label {
  width: 38px;
  flex-shrink: 0;
  font-size: 0.79rem;
  font-weight: 700;
  color: var(--text-soft);
  text-align: right;
  padding-right: 6px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  user-select: none;
}

.heatmap-year-label {
  flex: 1;
  min-width: 38px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--text-muted);
  user-select: none;
}

.heatmap-cell {
  flex: 1;
  min-width: 38px;
  border: none;
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 120ms ease, filter 120ms ease;
}

.heatmap-cell:not(:disabled):hover {
  transform: scale(1.08);
  filter: brightness(1.12);
  z-index: 1;
}

.heatmap-cell:disabled {
  cursor: default;
  pointer-events: none;
}

@media (max-width: 680px) {
  .heatmap-row {
    min-height: 42px;
  }

  .heatmap-year-label,
  .heatmap-cell {
    min-width: 42px;
  }
}

.heatmap-hover-box {
  position: absolute;
  z-index: 35;
  width: min(320px, calc(100% - 1rem));
  max-height: 300px;
  overflow: auto;
  padding: 0.78rem 0.82rem 1rem;
  border-radius: 14px;
  background: rgba(35, 56, 52, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 24px rgba(11, 20, 18, 0.32);
  color: rgba(243, 248, 245, 0.96);
  backdrop-filter: blur(8px);
}

.heatmap-hover-box__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
}

.heatmap-hover-box__close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(245, 249, 247, 0.92);
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.heatmap-hover-box__close:hover {
  background: rgba(255, 255, 255, 0.12);
}

.heatmap-hover-box__eyebrow {
  margin: 0;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(211, 226, 220, 0.85);
}

.heatmap-hover-box__title {
  margin: 0.22rem 0 0.55rem;
  font-size: 0.95rem;
  line-height: 1.2;
  color: #ffffff;
}

.heatmap-hover-box__list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
  padding-bottom: 0.5rem;
}

.heatmap-hover-box__list li {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 0.44rem;
  align-items: start;
  font-size: 0.84rem;
  line-height: 1.28;
  color: rgba(234, 244, 240, 0.95);
}

.heatmap-hover-box__link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.heatmap-hover-box__link:hover,
.heatmap-hover-box__link:focus-visible {
  color: #ffffff;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.heatmap-hover-box__list li::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-top: 0.16rem;
  border-radius: 2px;
  background: rgba(111, 185, 163, 0.95);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.heatmap-hover-box__list li.heatmap-hover-box__more {
  color: rgba(212, 227, 221, 0.9);
  font-style: italic;
}

.heatmap-hover-box__list li.heatmap-hover-box__more::before {
  background: rgba(184, 200, 194, 0.7);
}

.heatmap-hover-box__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.65rem;
}

.heatmap-hover-box__button {
  min-height: 30px;
  padding: 0.28rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(111, 185, 163, 0.18);
  color: rgba(247, 250, 249, 0.98);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.heatmap-hover-box__button:hover {
  background: rgba(111, 185, 163, 0.28);
}

/* Heatmap legend keys */
.stats-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.stats-heatmap-legend__label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-soft);
  white-space: nowrap;
}

.heatmap-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 24px;
  border-radius: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0 0.4rem;
}

.heatmap-key--0 { background: rgba(30,49,44,0.05); color: var(--text-soft); }
.heatmap-key--1 { background: rgba(48,120,100,0.24); color: rgba(30,49,44,0.75); }
.heatmap-key--2 { background: rgba(48,120,100,0.50); color: rgba(30,49,44,0.85); }
.heatmap-key--3 { background: rgba(48,120,100,0.72); color: rgba(255,255,255,0.92); }
.heatmap-key--4 { background: rgba(48,120,100,0.92); color: #ffffff; }

/* ---- Footer ---- */
.stats-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.stats-footer__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.stats-footer__note code {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.8em;
}

/* ---- Stats responsive ---- */
@media (max-width: 900px) {
  .stats-hero {
    grid-template-columns: 1fr;
    padding: 2rem 1.3rem 4rem;
  }

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

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

}

@media (max-width: 580px) {
  .stats-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ═══════════════════════════════════════════════════════════════
   DOKUMENTLISTE-SIDE
   ═══════════════════════════════════════════════════════════════ */

.docs-body {
  background: var(--color-bg, #eef1ee);
  min-height: 100vh;
}

.docs-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 6rem 1.5rem 3rem;
}

.docs-header {
  margin-bottom: 1.5rem;
}

.docs-header__title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--color-text, #1a2419);
}

.docs-header__sub {
  font-size: 0.88rem;
  color: var(--color-muted, #6b7f6b);
  margin: 0;
}

/* Table wrapper — horizontal scroll on narrow screens */
.docs-table-wrap {
  overflow-x: auto;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  background: #fff;
}

.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  min-width: 900px;
}

/* Header */
.docs-th {
  background: var(--color-nav-bg, #2e4a2e);
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  text-align: left;
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
  user-select: none;
  border-bottom: 2px solid rgba(255,255,255,0.15);
}

.docs-th--sortable {
  cursor: pointer;
}

.docs-th--sortable:hover {
  background: color-mix(in srgb, var(--color-nav-bg, #2e4a2e) 85%, white);
}

.sort-icon {
  display: inline-block;
  width: 1em;
  text-align: center;
  opacity: 0.8;
}

/* Rows */
.docs-td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #e8ede8;
  vertical-align: middle;
  color: var(--color-text, #1a2419);
}

.docs-table tbody tr:last-child .docs-td {
  border-bottom: none;
}

.docs-table tbody tr:hover .docs-td {
  background: #f3f7f3;
}

.docs-td--date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--color-muted, #6b7f6b);
}

.docs-td--title {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.docs-td--num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.docs-td--type {
  font-family: monospace;
  font-size: 0.75rem;
}

.docs-td--center {
  text-align: center;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15em 0.5em;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0e0e0;
  color: #333;
}

.badge--active   { background: #d4edda; color: #155724; }
.badge--removed  { background: #f8d7da; color: #721c24; }
.badge--archived { background: #cce5ff; color: #004085; }
.badge--no       { background: #f0f0f0; color: #888; }

/* Doc-links */
.doc-link {
  display: inline-block;
  padding: 0.2em 0.55em;
  border-radius: 3px;
  background: var(--color-nav-bg, #2e4a2e);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.doc-link:hover {
  opacity: 0.85;
}

/* Empty/loading state */
.docs-loading {
  text-align: center;
  padding: 2rem;
  color: var(--color-muted, #6b7f6b);
  font-style: italic;
}

/* Footer */
.docs-footer {
  margin-top: 1.5rem;
  display: flex;
  justify-content: flex-end;
}

/* Responsive: tighten up on tablet */
@media (max-width: 900px) {
  .docs-table {
    font-size: 0.78rem;
  }
}

/* ═══════════════════════════════════════════════════════════════
   SITEMAP-SIDE
   ═══════════════════════════════════════════════════════════════ */

.sitemap-body {
  background: var(--color-bg, #eef1ee);
  min-height: 100vh;
}

.sitemap-shell {
  max-width: none;
  margin: 0 auto;
  padding: 0.45rem 0.75rem 0.7rem;
  height: calc(100dvh - var(--sitemap-topnav-height, 118px) - 0.35rem);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  box-sizing: border-box;
}

.sitemap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 28vw);
  gap: 0.65rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.sitemap-graph-wrap {
  position: relative;
  min-height: 0;
  height: 100%;
}

.sitemap-toolbar {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  z-index: 15;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  max-width: calc(100% - 1.2rem);
}

.sitemap-toolbar__button {
  min-height: 34px;
  padding: 0.28rem 0.6rem;
  font-size: 0.74rem;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
  border-color: rgba(31, 53, 72, 0.25);
  box-shadow: 0 2px 8px rgba(30, 61, 84, 0.14);
}

.sitemap-toolbar__zoom {
  min-width: 34px;
  padding: 0.25rem 0.45rem;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.sitemap-graph {
  min-height: 0;
  height: 100%;
  background:
    linear-gradient(90deg, rgba(117, 140, 153, 0.1) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(rgba(117, 140, 153, 0.1) 1px, transparent 1px) 0 0 / 28px 28px,
    #f6f9fc;
  border: 1px solid #cfdbe4;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(30, 61, 84, 0.12);
}

.sitemap-inspector {
  background: linear-gradient(180deg, #fcfefb 0%, #f6faf3 100%);
  border: 1px solid #d6e3d2;
  border-radius: 12px;
  padding: 0.9rem;
  min-height: 0;
  height: 100%;
  overflow: auto;
  box-shadow: 0 6px 18px rgba(30, 49, 44, 0.08);
}

.sitemap-inspector__title {
  margin: 0;
  color: #1f3020;
  font-size: 0.98rem;
}

.sitemap-inspector__hint {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  color: #607460;
  line-height: 1.45;
}

.sitemap-inspector__content {
  display: grid;
  gap: 0.35rem;
  padding-top: 0.1rem;
}

.sitemap-inspector__node {
  margin: 0;
  font-size: 0.9rem;
  color: #223422;
  line-height: 1.3;
}

.sitemap-inspector__line {
  margin: 0;
  font-size: 0.77rem;
  color: #425642;
}

.sitemap-inspector__docs-section {
  margin-top: 0.5rem;
}

.sitemap-inspector__divider {
  margin: 0 0 0.5rem;
  border: 0;
  border-top: 1px solid rgba(30, 49, 44, 0.18);
}

.sitemap-inspector__section-title {
  margin-top: 0.2rem;
}

.sitemap-inspector__section-link {
  color: #1f5a38;
  text-decoration: underline;
}

.sitemap-inspector__section-link:hover {
  color: #143a25;
}

.sitemap-inspector__muted {
  color: #6c7f6c;
}

.sitemap-inspector__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.sitemap-inspector__resource-list {
  margin: 0.15rem 0 0.55rem 1rem;
  padding: 0;
  display: grid;
  gap: 0.22rem;
}

.sitemap-inspector__resource-item a {
  font-size: 0.76rem;
  color: #1f5a38;
  text-decoration: underline;
}

.sitemap-inspector__resource-item a:hover {
  color: #143a25;
}

.sitemap-inspector__link {
  display: inline;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  color: #1f5a38;
  font-size: 0.76rem;
  text-decoration: underline;
}

.sitemap-inspector__link:hover {
  color: #143a25;
}

.sitemap-footer {
  margin-top: 0;
  display: flex;
  justify-content: flex-end;
}

.sitemap-error {
  background: #fff4f4;
  color: #7a1e1e;
  border: 1px solid #e9bcbc;
  border-radius: 8px;
  padding: 0.8rem;
}

@media (max-width: 800px) {
  .sitemap-shell {
    padding: 0.4rem 0.8rem 0.8rem;
    height: auto;
    min-height: calc(100dvh - var(--sitemap-topnav-height, 118px));
    gap: 0.6rem;
  }

  .sitemap-layout {
    grid-template-columns: 1fr;
  }

  .sitemap-toolbar {
    top: 0.5rem;
    right: 0.5rem;
  }

  .sitemap-inspector {
    position: static;
    max-height: none;
  }

  .sitemap-graph {
    min-height: 62vh;
    height: 62vh;
  }
}