:root {
  /* `light` only, not `light dark` -- there is no dark palette below, and
     declaring dark support without one lets the browser render native
     widgets (scrollbars, checkboxes) in dark styling on top of this
     always-light page, producing exactly the kind of mismatched-contrast
     combo this file is trying to avoid. Revisit once a real dark palette
     exists. */
  color-scheme: light;
  --page: #f4f5f7;
  --surface: #ffffff;
  --border: #e2e4e9;
  --border-strong: #cdd1d9;
  --ink: #14161a;
  --ink-secondary: #52565f;
  /* WCAG AA requires >=4.5:1 for normal text (most --muted uses are well
     under the 14pt/bold-18.66px large-text threshold, e.g. 0.68-0.78rem
     table headers and KPI labels). #868b96 was ~3.4:1 against --surface --
     below AA. #63696f keeps the same cool-gray hue but reaches ~5.1:1
     against --surface and ~5.6:1 against --page, while staying lighter
     (less emphasized) than --ink-secondary's ~7.3:1. */
  --muted: #63696f;
  --accent: #2a63d6;
  --accent-wash: rgba(42, 99, 214, 0.08);
  --accent-wash-strong: rgba(42, 99, 214, 0.14);
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(20, 22, 26, 0.04), 0 2px 6px rgba(20, 22, 26, 0.04);
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Never left to the browser default (16px) -- every other element in the
     app (tables, nav, buttons, form inputs) already sits in this smaller,
     deliberately tuned scale; without this, plain paragraphs and .muted
     notes rendered visibly larger than the section headings above them. */
  font-size: 0.9rem;
  margin: 0;
  padding: 0 1.75rem 3rem;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
  padding: 1.1rem 0;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

nav strong {
  margin-right: 1.25rem;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

nav a {
  text-decoration: none;
  color: var(--ink-secondary);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.12s ease, color 0.12s ease;
}

nav a:hover { background: var(--accent-wash); color: var(--ink); }
nav a.active { color: var(--accent); background: var(--accent-wash); }

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 1.5rem 1.25rem 0;
  display: inline-block;
}

h2 {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: 0 0 0.9rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.87rem;
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.7rem;
  text-align: left;
  white-space: nowrap;
}

thead th {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface);
}

th a { color: inherit; text-decoration: none; }
th a:hover { color: var(--accent); }

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

tbody tr:nth-child(even) td { background: rgba(20, 22, 26, 0.015); }
tbody tr:hover td { background: var(--accent-wash); }

/* Any plain <table> wide enough to overflow its container (many columns, a
   narrow/mobile viewport) scrolls sideways on its own instead of forcing the
   whole page -- including the nav bar -- wider than the viewport. */
.table-scroll { overflow-x: auto; }

/* The per-row "register a purchase" form inside .inventory-table rows --
   sized to match the table's own compact row height instead of the
   full-size global button/input. */
.inline-buy-form { display: flex; gap: 0.25rem; }
.inline-buy-form input {
  width: 70px;
  padding: 0.15rem 0.35rem;
  font-size: 0.7rem;
}
.inline-buy-form button {
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
}

/* Historikk transaction rows: a compact "bank statement" layout -- one
   merged card cell (name + variant/rarity/set/number as muted subtext)
   instead of a column each, a colored type badge, and a de-emphasized
   transaction id inline with the date rather than its own wide column. */
.tx-table td { vertical-align: top; white-space: normal; }
.tx-card-meta { font-size: 0.78em; color: var(--muted); margin-top: 0.1rem; }
.tx-id { font-size: 0.75em; color: var(--muted); margin-left: 0.35rem; }
.tx-price { font-weight: 600; white-space: nowrap; }
.tx-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}
.tx-badge-buy { background: rgba(42, 120, 214, 0.12); color: #1d5bb0; }
.tx-badge-sell { background: rgba(235, 104, 52, 0.14); color: #b8501f; }

/* Registrert-vs-avtalt diff on a purchase group -- flagged when nonzero
   (money still unaccounted for, e.g. normal-print cards not priced yet),
   neutral once the two sums match. */
.tx-diff-open { color: #d03b3b; font-weight: 600; }
.tx-diff-clear { color: var(--muted); }

details.collapsible {
  margin-top: 1.5rem;
}
details.collapsible summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink-secondary);
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}
details.collapsible summary:hover { color: var(--ink); }
details.collapsible[open] summary { margin-bottom: 0.9rem; }

/* Inventory: the whole "big spreadsheet" list, no pagination -- a frozen
   header + independently-scrolling body (both axes) instead. */
.inventory-table-wrap {
  max-height: calc(100vh - 230px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.inventory-table {
  width: max-content;
  min-width: 100%;
  font-size: 0.7rem;
}
.inventory-table th,
.inventory-table td {
  padding: 0.25rem 0.4rem;
}
.inventory-table thead th {
  position: sticky;
  top: 0;
  box-shadow: 0 1px 0 var(--border-strong);
  z-index: 1;
}

/* Free-text columns are the ones driving horizontal scroll (long set/series
   names, comma-joined collection lists, notes) -- let these wrap instead of
   forcing the table wider; short/numeric columns keep nowrap so they stay
   compact. */
.inventory-table td:nth-child(3),  /* Series */
.inventory-table td:nth-child(4),  /* Set */
.inventory-table td:nth-child(5),  /* Collections */
.inventory-table td:nth-child(12), /* Illustrator */
.inventory-table td:nth-child(14), /* Klassifisering */
.inventory-table td:nth-child(15), /* Lokasjon */
.inventory-table td:nth-child(16) /* Notater */ {
  white-space: normal;
  word-break: break-word;
  max-width: 130px;
}

/* Multi-stat cards filling the full width. Each has its own theme color (a
   fixed, validated categorical hue order -- see dataviz palette) and its
   own hero number, so the eye has one clear entry point per card instead
   of a wall of equal-weight rows.
   Hue order: 1 Total/blue, 2 Verdi/orange, 3 Mest verdifulle kort/aqua,
   4 Mest verdifulle collection/yellow, 5 Mest verdifulle serie/magenta.
   Order is fixed -- never reassigned based on which card has the
   "biggest" number, only on its fixed category. */
.kpi-grid {
  display: grid;
  /* 140px keeps all 5 cards on one row at common desktop widths (>=1280px);
     narrower viewports wrap to fewer columns automatically. */
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--kpi-accent, var(--accent));
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow);
}

.kpi-card:nth-child(1) { --kpi-accent: #2a78d6; }
.kpi-card:nth-child(2) { --kpi-accent: #eb6834; }
.kpi-card:nth-child(3) { --kpi-accent: #1baf7a; }
.kpi-card:nth-child(4) { --kpi-accent: #eda100; }
.kpi-card:nth-child(5) { --kpi-accent: #e87ba4; }

.kpi-card h3 {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.kpi-card h3::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--kpi-accent, var(--accent));
  flex-shrink: 0;
}

/* The hero: one number per card gets visual priority -- proportional
   figures (not tabular-nums) per the stat-tile spec for a large
   standalone value. */
.kpi-hero {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.kpi-hero .value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.kpi-hero .label {
  font-size: 0.72rem;
  color: var(--muted);
}
.kpi-highlight-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.75rem;
}
.kpi-highlight-hero > div:first-child {
  min-width: 0;
}
.kpi-highlight-hero .kpi-caption {
  margin-top: 0.35rem;
}
.kpi-card-count {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: baseline;
  gap: 0.25rem;
}
.kpi-card-count .value {
  font-size: 1.4rem;
}
.kpi-card-count .label {
  font-size: 0.72rem;
  color: var(--muted);
}
.kpi-card-count .duplicate-cards {
  position: relative;
  top: -0.45em;
  margin-left: 0.08rem;
  font-size: 0.58em;
  font-style: normal;
  font-weight: 700;
  color: var(--muted);
}

.top-card-ranking {
  display: grid;
  gap: 0.55rem;
}
.top-card-rank-first {
  grid-template-columns: 1.25rem 64px minmax(0, 1fr) auto;
  min-height: 82px;
}
.top-card-runners-up {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
}
.top-card-rank {
  display: grid;
  grid-template-columns: 1.25rem 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.5rem;
  min-height: 48px;
}
.top-card-place {
  color: var(--kpi-accent, var(--accent));
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
}
.top-card-image {
  width: 38px;
  height: 52px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--accent-wash);
}
.top-card-rank-first .top-card-image {
  width: 64px;
  height: 86px;
}
.top-card-details {
  min-width: 0;
}
.top-card-name,
.top-card-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top-card-name {
  font-size: 0.8rem;
  color: var(--ink-secondary);
}
.top-card-meta {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.7rem;
}
.top-card-price {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Supporting numbers ride below a hairline, smaller and quieter than the
   hero -- never competing with it for attention. */
.kpi-support {
  margin-top: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}
.kpi-support .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.76rem;
}
.kpi-support .stat-row.full-row {
  grid-column: 1 / -1;
}
.kpi-support .stat-label {
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-support .stat-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--ink);
}

/* Highlight cards (most/least valuable X) show a name as a caption under
   the hero price instead of a label:value row -- it's an identity, not a
   second number. */
.kpi-caption {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A small (i) icon that reveals an explanatory tooltip on hover/focus --
   for a KPI tile or table heading that needs a one-line "what does this
   mean" note without permanently taking up page space. Keyboard-reachable
   (tabindex + :focus) since hover alone would leave it inaccessible. */
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--border-strong);
  color: var(--surface);
  font-size: 0.66rem;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: help;
  position: relative;
}
.info-icon:hover,
.info-icon:focus {
  background: var(--accent);
  outline: none;
}
.info-icon .info-tooltip {
  display: none;
  position: absolute;
  bottom: 130%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
  padding: 0.55rem 0.7rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  width: max-content;
  max-width: 260px;
  z-index: 20;
  white-space: normal;
  text-align: left;
}
.info-icon:hover .info-tooltip,
.info-icon:focus .info-tooltip {
  display: block;
}
/* Tooltip stays inside the viewport near the page's right edge (KPI row's
   rightmost cards, table headers near the edge of .breakdown-grid). */
.info-icon.align-right .info-tooltip {
  left: auto;
  right: 0;
  transform: none;
}
/* Opens downward instead of upward -- for a heading inside
   .breakdown-grid .card, where overflow-x:auto also clips vertical
   overflow above the card's own top edge (see the `below` macro param). */
.info-icon.below .info-tooltip {
  bottom: auto;
  top: 130%;
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
}

.breakdown-grid .card {
  /* Grid items default to a content-based min-width, so a table wider than
     its track (long collection/series names, "nowrap" cells) would overflow
     sideways into the next column instead of respecting the grid -- let it
     shrink to the track width and scroll its own content horizontally
     instead. */
  min-width: 0;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem 1.35rem;
  box-shadow: var(--shadow);
}

/* Every dashboard row is a pair (Inventory+Topp 10, Serie+Rarity) -- wrap
   each in its own auto-fit pair instead of the top-level grid, so exactly
   two cards split the row 50/50 (auto-fit collapses unused tracks)
   regardless of how many pairs live in the outer .breakdown-grid. */
.breakdown-grid .card-pair {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* Inventory and Serie carry enough columns (two of them currency, plus a
   drilldown) that pairing them with another card needs a smaller, tighter
   table to avoid horizontal scroll. */
.breakdown-grid table {
  font-size: 0.68rem;
}
.breakdown-grid th,
.breakdown-grid td {
  padding: 0.28rem 0.35rem;
}

/* Dashboard metrics link through to the same slice in Inventory (e.g. a
   collection name -> /inventory?collection=...). */
.breakdown-grid a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}
.breakdown-grid a:hover { text-decoration: underline; }

/* Column headers are sort links too, but should keep the plain uppercase
   header look (same as Inventory's) instead of the bold-accent body-link
   style above -- only turn accent-colored on hover. */
.breakdown-grid th a { color: inherit; font-weight: 700; }
.breakdown-grid th a:hover { color: var(--accent); text-decoration: none; }

.child-row td:first-child { padding-left: 1.5rem; color: var(--ink-secondary); font-weight: 400; }
.grandchild-row td:first-child { padding-left: 3rem; color: var(--ink-secondary); font-weight: 400; }
.grandchild-row .muted { font-size: 0.85em; }

/* A bucket's whole name is the drilldown trigger where it has children to
   expand (e.g. a series' sets) -- styled like the accent body-links above,
   since it replaces one (there's nothing left to link to Inventory with). */
.row-toggle-name {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.row-toggle-name:hover { text-decoration: underline; }
.row-toggle-name .arrow { color: var(--muted); font-size: 0.7rem; display: inline-block; }
.row-toggle-name:hover .arrow { color: var(--accent); }

.favorite-star {
  background: none;
  border: none;
  padding: 0;
  margin-right: 0.35rem;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
  vertical-align: middle;
}
.favorite-star:hover, .favorite-star.active { color: #eda100; }

.parent-row td { font-weight: 700; }
.parent-row { background: var(--accent-wash-strong); }
.parent-row td:first-child { border-left: 3px solid var(--accent); padding-left: calc(0.7rem - 3px); }

form.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

form.filters input, form.filters select {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.87rem;
}

form.filters input:focus, form.filters select:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.warnings {
  background: #fff8ea;
  border: 1px solid #f0d999;
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin-top: 1rem;
}
.warnings li { margin: 0.15rem 0; }

.result-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-top: 1rem;
  box-shadow: var(--shadow);
}

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

button, input[type=submit] {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.12s ease;
}
button:hover, input[type=submit]:hover { filter: brightness(0.92); }

.autocomplete { position: relative; }
.autocomplete-results {
  position: absolute;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 220px;
  overflow-y: auto;
  width: 100%;
  margin-top: 0.25rem;
}
.autocomplete-results div { padding: 0.5rem 0.7rem; cursor: pointer; }
.autocomplete-results div:hover { background: var(--accent-wash); }

.autocomplete input,
.merge-form input {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.87rem;
}

.merge-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.merge-form input { flex: 1 1 200px; width: auto; min-width: 0; }

.folder-list { list-style: none; padding: 0; margin: 0.6rem 0 0 0; }
.folder-list > li {
  margin-bottom: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: var(--accent-wash);
  border-radius: var(--radius-sm);
}
.folder-list .folder-name { font-weight: 600; }
.folder-members {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.folder-members li {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.4rem 0.25rem 0.6rem;
}
.folder-members form { display: inline-flex; }
.folder-members button { padding: 0.25rem 0.55rem; font-size: 0.78rem; }

/* Transactions' compact, always-visible economic snapshot -- folded in from
   the former standalone Analyse page, sitting above the collapsible "Vis
   grafer" charts (see details.collapsible) and above Historikk. Delta keeps
   its own viz-delta-gain/loss color -- the one number worth an at-a-glance
   read; the other two values stay plain. */
.tx-kpi-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 0.7rem 1.1rem;
  margin-top: 2rem;
  box-shadow: var(--shadow);
}
.tx-kpi-bar > div { display: flex; align-items: baseline; gap: 0.45rem; }
.tx-kpi-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}
.tx-kpi-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

/* Transactions' collapsible charts (formerly the standalone Analyse page) --
   hand-rolled inline-SVG charts, no JS charting library. Colors are the
   app's own validated categorical palette (see the KPI tiles'
   --kpi-accent cycle): slot 1 blue, slot 2 orange, in fixed order per series
   identity (Kjøp always slot 1, Salg always slot 2). */
.viz-root {
  --viz-series-1: #2a78d6;
  --viz-series-2: #eb6834;
  --viz-grid: #e1e0d9;
  --viz-axis-text: #898781;
}
.viz-chart-wrap {
  position: relative;
  height: 220px;
  margin-top: 0.5rem;
}
.viz-legend {
  display: flex;
  gap: 1.1rem;
  margin-bottom: 0.3rem;
  font-size: 0.8rem;
  color: var(--ink-secondary);
}
.viz-legend-item { display: flex; align-items: center; gap: 0.4rem; }
.viz-legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz-legend-primary { background: var(--viz-series-1); }
.viz-legend-comparison { background: var(--viz-series-2); }
.viz-caveat { margin: 0.3rem 0 0; font-size: 0.78rem; }
.viz-filter { display: flex; gap: 0.4rem; margin: 0.6rem 0; }
.viz-filter-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}
.viz-filter-pill:hover { background: var(--accent-wash); color: var(--ink); }
.viz-filter-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.viz-delta-gain { color: #0ca30c; }
.viz-delta-loss { color: #d03b3b; }

.wiki-diagram {
  overflow-x: auto;
  margin: 0.8rem 0 1.1rem;
  padding: 0.9rem;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.wiki-diagram svg { display: block; margin: 0 auto; min-width: 560px; }
.wiki-diagram text { font-family: inherit; fill: var(--ink); }
.wiki-diagram .wd-muted { fill: var(--ink-secondary); }
.wiki-diagram .wd-node-plain { fill: var(--surface); stroke: var(--border-strong); }
.wiki-diagram .wd-node-accent { fill: var(--accent-wash); stroke: var(--accent); }
.wiki-diagram .wd-node-highlight { fill: #fff8ea; stroke: #d9a83b; }
.wiki-diagram .wd-conn { stroke: var(--border-strong); fill: none; }
.wiki-diagram .wd-conn-accent { stroke: var(--accent); fill: none; }
.wiki-figcaption {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.4rem 0 0;
}
