:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e5e5e5;
  --accent: #2a6fbf;
  --accent-soft: #e9f0fa;
  --dated: #2a6fbf;
  --undated: #c97a2a;
  --shadow: 0 1px 2px rgba(0,0,0,0.04);
  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

header {
  padding: 28px 36px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
header h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
header .tagline {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
header a { color: var(--accent); text-decoration: none; }
header a:hover { text-decoration: underline; }

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 40px;
  margin-top: 18px;
  align-items: flex-start;
}
.stats-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 24px;
  border-right: 1px solid var(--line);
}
.stats-group:last-child { border-right: none; padding-right: 0; }
.stats-group-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--muted);
}
.stats-group-label a { color: var(--accent); border-bottom: 1px dotted currentColor; text-decoration: none; }
.stats-row {
  display: flex;
  gap: 24px;
  align-items: flex-end;
}
.stat {
  display: flex;
  flex-direction: column;
  min-width: 72px;
}
.stat .value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.stat .label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.stat.stat-stack { min-width: 230px; }
.stat.stat-stack .sub {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 3px;
  letter-spacing: 0;
  text-transform: none;
}

/* Category mini-bars */
.stats-group-cat { min-width: 280px; }
.cat-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}
.cat-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 44px;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.cat-bar-label {
  color: #1a1a1a;
  font-weight: 500;
}
.cat-bar {
  height: 8px;
  background: #e8eaf0;
  border-radius: 2px;
  overflow: hidden;
  min-width: 4px;
}
.cat-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}
.cat-bar-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  text-align: right;
}

main {
  padding: 24px 36px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.card-sub {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}

#overview {
  display: block;
}

.coverage-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 8px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 2px;
  font-size: 12px;
}
.toggle-opt {
  font: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.toggle-opt:hover { color: var(--ink); }
.toggle-opt.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
.toggle-opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.legend-strip {
  display: flex;
  gap: 14px;
  margin: 0;
  padding: 0;
  font-size: 11.5px;
  color: var(--muted);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}
.legend-swatch.dated { background: var(--dated); }
.legend-swatch.undated { background: var(--undated); }

.methodology {
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfbfb;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.55;
}
.methodology summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
  list-style: none;
  outline: none;
  user-select: none;
}
.methodology summary::-webkit-details-marker { display: none; }
.methodology summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  font-size: 10px;
  transition: transform 0.15s ease;
  color: var(--accent);
}
.methodology[open] summary::before { transform: rotate(90deg); }
.methodology[open] summary { margin-bottom: 10px; }
.methodology ul {
  margin: 4px 0 0;
  padding-left: 22px;
}
.methodology li { margin-bottom: 8px; }
.methodology li:last-child { margin-bottom: 0; }
.methodology strong { color: var(--ink); font-weight: 600; }

#browser {
  display: block;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel h2 {
  margin: 0;
  padding: 16px 18px 8px;
  font-size: 14px;
  font-weight: 600;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 18px 12px;
  border-bottom: 1px solid var(--line);
}
.filters input[type="search"],
.filters select {
  font: inherit;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.filters input[type="search"]:focus,
.filters select:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.tree-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 70vh;
  overflow-y: auto;
}
.audit-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
}
.audit-link:hover { color: var(--accent); border-bottom-color: var(--accent); }

.tree-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.tree-list .partition-header {
  padding: 9px 14px 7px;
  color: var(--muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  cursor: default;
  user-select: none;
  margin-top: 4px;
}
.tree-list .category-header {
  padding: 14px 14px 4px;
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  cursor: default;
  user-select: none;
  background: #fafbfc;
}
.tree-list .category-header:first-child {
  border-top: none;
  margin-top: 0;
}
.tree-list .partition-header.has-children { cursor: pointer; }
.tree-list .partition-header.has-children:hover { background: #f6f7f9; }
.tree-list .partition-header .partition-name { flex: 1; }
.tree-list .partition-header .chev {
  display: inline-block;
  width: 12px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.tree-list .partition-header .chev.empty { color: transparent; }
.tree-list .partition-header .sub-count {
  background: #eef2f8;
  color: var(--accent);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0;
}

.tree-list .tree-item {
  padding: 8px 18px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.tree-list .tree-item:hover { background: #f3f3f3; }
.tree-list .tree-item.active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.tree-list .tree-item.child {
  padding-left: 36px;
  background: #fcfcfd;
}
.tree-list .tree-item.child.active { background: var(--accent-soft); }
.tree-list .tree-item.child:hover { background: #f1f3f7; }
.tree-list .tree-name {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-list .tree-item.child .tree-name { font-weight: 400; font-size: 12.5px; }
.tree-list .tree-meta {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.tree-list .badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.tree-list .badge.dated { background: var(--dated); }
.tree-list .badge.undated { background: var(--undated); }

/* Dark-matter / unrepresented lineages */
.tree-list .partition-header.dark-header {
  color: var(--muted);
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}
.tree-list .partition-header.dark-header .partition-name {
  color: var(--muted);
}
.tree-list .dark-cat-header {
  padding: 6px 18px 4px 36px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9aa3b0;
  background: transparent;
  cursor: default;
  font-weight: 600;
}
.tree-list .tree-item.dark {
  cursor: default;
  background: #fbfbfc;
  color: var(--muted);
}
.tree-list .tree-item.dark:hover {
  background: #fbfbfc;
}
.tree-list .tree-item.dark .tree-name {
  font-weight: 400;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: normal;
  overflow: visible;
}
.tree-list .badge.dark {
  background: #d3d8e2;
  outline: 1px dashed #b3bcc8;
  outline-offset: -2px;
  background-clip: padding-box;
}
.tree-list .tree-item.dark .src-link {
  font-size: 10.5px;
  padding: 0 6px 0 0;
  margin-left: 4px;
}
.tree-list .tree-item.dark .src-link .src-type {
  font-size: 8.5px;
  padding: 0 4px;
  line-height: 12px;
}

.detail {
  padding: 20px 24px 28px;
  min-height: 400px;
}
.empty {
  color: var(--muted);
  font-style: italic;
  padding: 60px 20px;
  text-align: center;
}

#detail h2 {
  margin: 0 0 16px;
  padding: 0;
  font-size: 18px;
  font-weight: 600;
}

.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px 24px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.meta .field { display: flex; flex-direction: column; }
.meta .key {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.meta .val {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.meta .val a { color: var(--accent); text-decoration: none; }
.meta .val a:hover { text-decoration: underline; }
.meta .val .range {
  color: var(--muted);
  font-size: 12px;
  font-weight: normal;
}
.meta .val .src {
  color: var(--muted);
  font-size: 11.5px;
  font-style: italic;
}

.meta .val .src-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  padding: 1px 7px 1px 2px;
  background: #f3f6fb;
  border: 1px solid #dde5f0;
  border-radius: 10px;
  color: var(--accent);
  font-size: 11.5px;
  font-style: normal;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.meta .val .src-link:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.meta .val .src-type {
  display: inline-block;
  padding: 0 5px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 14px;
}
.meta .val .src-type.database { background: #6b8db8; }

.dataset-chooser {
  margin: -4px 0 18px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #f6f9ff 0%, #fbfcff 100%);
  border: 1px solid #d6e2f5;
  border-radius: 6px;
}
.chooser-label {
  font-size: 11.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 10px;
}
.chooser-label strong { color: var(--accent); font-weight: 600; }
.chooser-tier { margin-top: 8px; }
.chooser-tier:first-of-type { margin-top: 0; }
.tier-label {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  font-weight: 600;
}
.tier-count {
  display: inline-block;
  background: #eef2f8;
  color: var(--accent);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  margin-left: 4px;
  letter-spacing: 0;
}
.chooser-btn.canonical { min-width: 180px; }
.chooser-btn.subclade {
  min-width: 110px;
  padding: 5px 10px;
}
.chooser-btn.subclade .chooser-name { font-size: 12px; font-weight: 500; }
.chooser-btn.subclade .chooser-meta { font-size: 10.5px; }
.chooser-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chooser-btn {
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 7px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
  min-width: 130px;
}
.chooser-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chooser-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 1px 3px rgba(42,111,191,0.25);
  cursor: default;
}
.chooser-btn.active .chooser-name,
.chooser-btn.active .chooser-meta {
  color: #fff;
}
.chooser-btn.active .chooser-badge.dated { background: #fff; }
.chooser-btn.active .chooser-badge.undated { background: rgba(255,255,255,0.85); }
.chooser-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chooser-meta {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chooser-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.chooser-badge.dated { background: var(--dated); }
.chooser-badge.undated { background: var(--undated); }

.viewer-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.viewer-controls button,
.viewer-controls .btn {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
}
.viewer-controls button:hover,
.viewer-controls .btn:hover {
  background: #f3f3f3;
  border-color: #ccc;
}

.tree-status {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  min-height: 18px;
}
.tree-status.warning { color: var(--undated); }

.r-snippet {
  margin: 0;
  padding: 12px 14px;
  background: #1e1f22;
  color: #e8e8e8;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}
.r-snippet code { font: inherit; color: inherit; background: transparent; }
.card-sub code {
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
}
.btn-copy {
  font: inherit;
  font-size: 12px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 5px;
  cursor: pointer;
  color: var(--ink);
  min-width: 70px;
}
.btn-copy:hover { background: #f3f3f3; border-color: #ccc; }

#tree-container {
  width: 100%;
  min-height: 480px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: auto;
}
#tree-container svg {
  display: block;
  max-width: 100%;
}

/* === Audit panel === */
.audit-panel {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid #c97a2a;
  border-radius: 4px;
  background: #fdf9f3;
  font-size: 12.5px;
}
.audit-panel[hidden] { display: none; }
.audit-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.audit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.audit-badge.audit-stub          { background: #eee; color: #666; }
.audit-badge.audit-in_progress   { background: #fde7c8; color: #8a4d0a; }
.audit-badge.audit-verified      { background: #d6efd9; color: #1f6b29; }
.audit-badge.audit-shipped       { background: #c8e1fd; color: #1a4d8a; }
.audit-badge.audit-deferred      { background: #ececec; color: #555; }

.audit-correction {
  background: #fff5e7;
  border: 1px solid #f0d4a1;
  border-radius: 4px;
  padding: 10px 12px;
  margin-bottom: 10px;
}
.audit-doi-pair {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
}
.doi-broken a { color: #999; text-decoration: line-through; }
.doi-broken .src { color: #c0432a; font-weight: 600; }
.doi-live  a { color: var(--accent); }
.doi-live  .src { color: #1f6b29; font-weight: 600; }
.badge-broken {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 3px;
  background: #c0432a;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.audit-note { margin: 6px 0 0; font-size: 11.5px; color: #6b6b6b; }

.audit-block {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 4px;
  background: #fafafa;
  border-left: 3px solid #ccc;
}
.audit-block h4 {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #555;
}
.audit-caveats-block { background: #fff7e6; border-left-color: #d48a1a; }
.audit-dated-alt { background: #f3f6fb; border-left-color: #6b8cb3; }
.audit-superseded { background: #f6f3fb; border-left-color: #8a6bb3; }
.audit-resolutions { background: #f0f7f1; border-left-color: #2e8b3b; }

.audit-caveat-list { list-style: none; padding: 0; margin: 0; }
.audit-caveat { padding: 6px 0; border-top: 1px dashed #e0c69a; font-size: 12.5px; }
.audit-caveat:first-child { border-top: none; }
.caveat-sev {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 3px;
  background: #ececec;
  color: #555;
  margin-right: 6px;
  text-transform: uppercase;
}
.caveat-sev.sev-high   { background: #fde0d0; color: #a32a0a; }
.caveat-sev.sev-medium { background: #fde7c8; color: #8a4d0a; }
.caveat-sev.sev-low    { background: #fdf1d6; color: #8a6a0a; }
.caveat-summary { font-weight: 600; color: #2c2c2c; }
.caveat-detail { margin-top: 4px; color: #555; font-size: 12px; line-height: 1.5; }

.da-reason { font-size: 12.5px; color: #2c4a73; line-height: 1.55; margin: 0 0 8px; white-space: pre-wrap; }
.da-cands { list-style: none; padding: 0; margin: 0; }
.da-cands li { padding: 6px 0; border-top: 1px dashed #cdd6e3; font-size: 12px; }
.da-cands li:first-child { border-top: none; }
.da-cand-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.da-cand-head .src { color: #6b6b6b; font-size: 11px; }
.da-study { color: #444; margin-top: 3px; font-size: 11.5px; }
.da-note { color: #555; font-style: italic; margin-top: 2px; font-size: 11.5px; }
.da-doi a, .da-doi-inline { color: var(--accent); font-size: 11px; text-decoration: none; }
.da-doi a:hover, .da-doi-inline:hover { text-decoration: underline; }
.audit-res-list { list-style: none; padding: 0; margin: 0; font-size: 12.5px; }
.audit-res-list li { padding: 4px 0; }
.res-fix { color: #1f6b29; }

.audit-caveats summary {
  cursor: pointer;
  padding: 4px 0;
  font-size: 12.5px;
}
.audit-caveats ul {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.audit-caveats .cav {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px dashed #eadcc7;
}
.audit-caveats .cav:first-child { border-top: none; }
.cav-sev {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 0;
  border-radius: 3px;
  text-align: center;
  height: 18px;
  line-height: 14px;
}
.cav-high  .cav-sev { background: #c0432a; color: #fff; }
.cav-medium .cav-sev { background: #c97a2a; color: #fff; }
.cav-low   .cav-sev { background: #b0b0b0; color: #fff; }
.cav-body strong { font-size: 12.5px; }
.cav-detail {
  margin-top: 3px;
  font-size: 11.5px;
  color: #555;
  line-height: 1.5;
}

.audit-methods { margin-top: 10px; }
.audit-methods summary {
  cursor: pointer;
  padding: 4px 0;
  font-size: 12.5px;
}
.audit-methods dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 4px 12px;
  margin: 8px 0 0;
  font-size: 12px;
}
.audit-methods dt {
  color: #6b6b6b;
  font-weight: 500;
}
.audit-methods dd {
  margin: 0;
  color: #1a1a1a;
}

/* === Uncertainty / posterior data card === */
#uncertainty-panel[hidden] { display: none; }
.unc-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}
.unc-file {
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.unc-file:first-child { border-top: none; padding-top: 4px; }
.unc-file-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.unc-link {
  font-weight: 500;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
}
.unc-link:hover { text-decoration: underline; }
.unc-fmt {
  background: #eef2f8;
  color: var(--accent);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.unc-size {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.unc-desc {
  margin-top: 4px;
  color: #1a1a1a;
  font-size: 12px;
  line-height: 1.5;
}
.unc-fname {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}
.unc-fname code { background: #f4f5f7; padding: 1px 5px; border-radius: 3px; }
.unc-note {
  margin: 10px 0 0;
  color: #6b6b6b;
  font-size: 11.5px;
  font-style: italic;
}

/* === Audit log page === */
.audit-page header {
  padding: 28px 36px 18px;
}

.audit-filters {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.filter-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.filter-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  min-width: 70px;
}
.filter-chip {
  background: #fff;
  border: 1px solid var(--line);
  color: #444;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.1s ease, color 0.1s ease, border-color 0.1s ease;
}
.filter-chip:hover { background: #f4f6f9; }
.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.audit-count {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 12px;
  padding: 0 4px;
}
.audit-page .audit-intro {
  max-width: 760px;
  margin: 10px 0 14px;
  color: #1a1a1a;
  font-size: 13px;
  line-height: 1.5;
}
.audit-main {
  padding: 8px 36px 28px;
  max-width: 1080px;
}
.aud-card {
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 18px 22px;
}
.aud-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.aud-card-head h2 { margin: 0; font-size: 18px; }
.aud-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 11.5px;
}
.aud-meta .muted { color: var(--muted); }
.aud-block { margin: 14px 0; }
.aud-block h3 {
  margin: 0 0 8px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}
.aud-doi {
  background: #fff5e7;
  border: 1px solid #f0d4a1;
  border-radius: 4px;
  padding: 10px 12px;
}
.doi-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.doi-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  min-width: 130px;
}
.doi-broken .doi-label { color: #c0432a; }
.doi-broken a { color: #999; text-decoration: line-through; }
.doi-live .doi-label { color: #1f6b29; }
.doi-live a { color: var(--accent); }
.doi-row .muted { color: var(--muted); font-size: 11.5px; }
.aud-note {
  margin: 6px 0 0;
  color: #555;
  font-size: 12px;
  line-height: 1.5;
}
.aud-resolutions {
  margin: 0;
  padding-left: 20px;
}
.aud-resolutions li { margin: 8px 0; font-size: 12.5px; line-height: 1.5; }
.aud-dated-alt { background: #f6f8fb; border-left: 3px solid #6b8cb3; padding: 10px 12px; border-radius: 4px; }
.aud-dated-alt h3 { color: #2c4a73; margin-top: 0; }
.da-reason { font-size: 12.5px; color: #444; line-height: 1.55; white-space: pre-wrap; margin: 4px 0 8px; }
.res-issue { color: #1a1a1a; }
.res-fix { color: #1f6b29; margin-top: 2px; }
.aud-cands {
  list-style: none;
  padding: 0;
  margin: 0;
}
.aud-cands li {
  padding: 8px 0;
  border-top: 1px dashed var(--line);
  font-size: 12.5px;
}
.aud-cands li:first-child { border-top: none; }
.cand-head { display: flex; align-items: center; gap: 8px; }
.cand-priority {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 700;
  text-transform: uppercase;
}
.cand-priority.cand-high { background: #fde7c8; color: #8a4d0a; }
.cand-priority.cand-medium { background: #fdf1d6; color: #8a6a0a; }
.cand-priority.cand-low { background: #eee; color: #666; }
.cand-status {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cand-rationale {
  margin: 4px 0 2px;
  color: #444;
  font-size: 12px;
  line-height: 1.5;
}
.cand-paper { margin: 2px 0; font-size: 11.5px; }
.cand-paper .muted { color: var(--muted); }

.aud-deferred {
  background: #fafafa;
  border-left: 3px solid #b0b0b0;
  padding: 10px 14px;
  border-radius: 0 4px 4px 0;
}
.aud-deferred-reason {
  margin: 4px 0 0;
  color: #444;
  font-size: 12.5px;
  line-height: 1.55;
}

/* Dark-matter detail panel — no tree, just the evidence */
.dm-card { padding-bottom: 14px; }
.dm-section {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.dm-section:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.dm-section h3 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.dm-reason {
  margin: 4px 0 0;
  color: #1a1a1a;
  font-size: 13px;
  line-height: 1.5;
}
.dm-dl {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 4px 14px;
  margin: 6px 0 0;
  font-size: 13px;
}
.dm-dl dt {
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  padding-top: 1px;
}
.dm-dl dd { margin: 0; color: #1a1a1a; }
.ev-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
}
.ev-link:hover { text-decoration: underline; }
.ev-link .src-type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.ev-link .src-type.paper { background: #eef2f8; color: var(--accent); }
.ev-link .src-type.database { background: #e1ebd6; color: #1f6b29; }
.dm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 4px 0 0;
}
.dm-table th, .dm-table td {
  text-align: left;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}
.dm-table thead th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-top: none;
}
.dm-note { color: #555; font-size: 11.5px; line-height: 1.5; }
.dm-bnote {
  margin-top: 6px;
  color: #555;
  font-size: 11.5px;
  line-height: 1.5;
}
.dm-quote {
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--accent);
  color: #1a1a1a;
  font-size: 11.5px;
  font-style: italic;
}
.dm-footer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
}
.dm-footer a { color: var(--accent); }

/* Interval provenance table on the audit page */
.ip-cls {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ip-cls-paper-published-range { background: #d6efd9; color: #1f6b29; }
.ip-cls-partly-heuristic      { background: #fde7c8; color: #8a4d0a; }
.ip-cls-fully-heuristic       { background: #f8d8d8; color: #8a1a1a; }
.ip-cls-derived               { background: #e1e6f0; color: #444; }
.ip-cls-unaudited             { background: #eee; color: #666; }

.ip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin-top: 6px;
}
.ip-table th, .ip-table td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-top: 1px solid var(--line);
}
.ip-table th {
  width: 120px;
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ip-type {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 600;
}
.ip-type-paper_published, .ip-type-paper_published_range { background: #d6efd9; color: #1f6b29; }
.ip-type-database                                        { background: #d6e3ef; color: #1a4d8a; }
.ip-type-derived, .ip-type-derived_from_described        { background: #eaeaea; color: #555; }
.ip-type-projection                                      { background: #fdf1d6; color: #8a6a0a; }
.ip-type-heuristic                                       { background: #f8d8d8; color: #8a1a1a; }
.ip-type-atlas_derived                                   { background: #ddd; color: #666; }
.ip-note {
  margin-top: 4px;
  color: #555;
  font-size: 11.5px;
  line-height: 1.5;
}
.ip-quote {
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--accent);
  color: #1a1a1a;
  font-size: 11.5px;
  font-style: italic;
}

footer {
  padding: 16px 36px 28px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}
footer p { margin: 0; }
