/* Donker thema. Alle kleuren staan hier als rol; nergens anders staat een hex. */
:root {
  color-scheme: dark;
  --page: #111110;
  --surface: #1a1a19;
  --raised: #232321;
  --line: #2f2f2c;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --text-3: #8f8e86;
  --link: #86b6ef;
  --focus: #9ec5f4;

  /* Tiers: één tint, van licht (beste) naar donker. */
  --tier-s: #9ec5f4;
  --tier-a: #5598e7;
  --tier-b: #256abf;
  --tier-c: #184f95;

  /* Status: altijd samen met een icoon en een label. */
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-wash: #12351a;
  --warning-wash: #3a2f10;
  --critical-wash: #3d1a1a;

  --radius: 10px;
  --gap: 16px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
code, .mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.92em; }
code { background: var(--raised); padding: 1px 5px; border-radius: 4px; }
small { color: var(--text-3); font-size: 0.87em; }
.muted { color: var(--text-3); }
.strong { font-weight: 650; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.wrap { max-width: 1240px; margin: 0 auto; padding-inline: 16px; }

/* ------------------------------------------------------------ kop en voet */
.site { border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 20; }
.site__inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; flex-wrap: wrap; }
.site__name { color: var(--text); font-weight: 700; letter-spacing: -0.01em; font-size: 17px; }
.site__name span { color: var(--tier-s); margin-left: 3px; }
.site__name:hover { text-decoration: none; }
.site__nav { display: flex; gap: 4px; }
.site__nav a { color: var(--text-2); padding: 6px 12px; border-radius: 8px; font-weight: 550; }
.site__nav a:hover { background: var(--raised); text-decoration: none; }
.site__nav a[aria-current] { background: var(--raised); color: var(--text); }
.foot { color: var(--text-3); font-size: 13px; padding-block: 28px 40px; }

.intro { padding-block: 24px 16px; max-width: 760px; }
.intro h1 { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; margin-bottom: 6px; }
.intro p { color: var(--text-2); }
.crumb { padding-top: 18px; font-size: 14px; }
.meta { color: var(--text-3); font-size: 13px; margin-block: 10px 14px; }

/* --------------------------------------------------------------- knoppen */
.controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.segmented, .ranges { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segmented a, .ranges button {
  font: inherit; font-weight: 600; color: var(--text-2); background: none; border: 0; cursor: pointer;
  padding: 7px 14px; border-radius: 7px; white-space: nowrap;
}
.ranges button { padding: 5px 10px; font-size: 13px; }
.segmented a:hover, .ranges button:hover { background: var(--raised); text-decoration: none; }
.segmented a[aria-current], .ranges button[aria-pressed="true"] { background: var(--tier-b); color: var(--text); }
.sorts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 14px; }
.sorts__label { color: var(--text-3); margin-right: 6px; }
.sorts a { color: var(--text-2); padding: 4px 9px; border-radius: 7px; }
.sorts a:hover { background: var(--raised); text-decoration: none; }
.sorts a[aria-current] { color: var(--text); background: var(--raised); font-weight: 600; }
.htmx-request { opacity: 0.55; transition: opacity 120ms; }

/* ----------------------------------------------------------------- tiers */
.tier { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 0; margin-bottom: 12px;
        background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tier__label { display: grid; place-items: center; font-size: 34px; font-weight: 800; letter-spacing: -0.03em; }
.tier--S, .tier--S .tier__label, .tierbadge.tier--S { --tier: var(--tier-s); --on-tier: #0b0b0b; }
.tier--A, .tierbadge.tier--A { --tier: var(--tier-a); --on-tier: #0b0b0b; }
.tier--B, .tierbadge.tier--B { --tier: var(--tier-b); --on-tier: #ffffff; }
.tier--C, .tierbadge.tier--C { --tier: var(--tier-c); --on-tier: #ffffff; }
.tier__label, .tierbadge { background: var(--tier); color: var(--on-tier); }
.tier__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; padding: 10px; }
.tier__empty { color: var(--text-3); padding: 14px 6px; font-size: 14px; }
.tierbadge { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 12px;
             font-size: 28px; font-weight: 800; flex: none; }
.tierbadge--sm { width: 22px; height: 22px; border-radius: 6px; font-size: 13px; vertical-align: -3px; margin-right: 4px; }

/* ----------------------------------------------------------------- kaart */
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px 13px;
        display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.card--quiet { background: none; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card h3 { font-size: 15.5px; line-height: 1.3; letter-spacing: -0.005em; }
.card h3 a { color: var(--text); }
.score { color: var(--text-2); font-size: 12.5px; font-variant-numeric: tabular-nums; border: 1px solid var(--line);
         border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.specs { display: flex; flex-wrap: wrap; gap: 2px 0; color: var(--text-3); font-size: 13px; }
.specs li:not(:last-child)::after { content: "·"; margin-inline: 6px; }
.specs--lg { font-size: 15px; color: var(--text-2); margin-top: 2px; }
.price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.price__amount { font-size: 24px; font-weight: 750; color: var(--text); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.price__shop { color: var(--text-2); font-size: 13.5px; }
.card__none { color: var(--text-3); font-size: 13.5px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.metrics div { min-width: 0; }
.metrics__main { grid-column: 1 / -1; }
.metrics dt { color: var(--text-3); font-size: 12px; }
.metrics dd { font-variant-numeric: tabular-nums; font-size: 14px; color: var(--text-2); }
.metrics__main dd { font-size: 16px; font-weight: 650; color: var(--text); }
.note { color: var(--text-3); font-size: 13px; }
.warn { color: var(--text-2); font-size: 13px; background: var(--warning-wash); border-radius: 6px; padding: 5px 8px; }
.warn span { color: var(--warning); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; line-height: 1.5; color: var(--text-2);
        background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px 1px 7px; white-space: nowrap; }
.chip__icon { font-size: 10px; color: var(--text-3); }
.chip--good { background: var(--good-wash); border-color: transparent; color: var(--text); }
.chip--good .chip__icon { color: var(--good); }
.chip--bad { background: var(--critical-wash); border-color: transparent; color: var(--text); }
.chip--bad .chip__icon { color: #ef7a7a; }
.chip--deal { background: var(--warning-wash); border-color: transparent; color: var(--text); font-weight: 600; }
.chip--deal .chip__icon { color: var(--warning); font-size: 12px; }

/* ---------------------------------------------------------------- detail */
.detail-head { display: flex; align-items: center; gap: 14px; padding-block: 14px 12px; }
.detail-head h1 { font-size: 26px; letter-spacing: -0.02em; line-height: 1.2; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-block: 12px 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.tile h2 { font-size: 12.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.tile__value { font-size: 28px; font-weight: 750; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.25; margin-top: 2px; }
.tile__value a { color: var(--text); }
.tile__value--none { color: var(--text-3); }
.tile__sub { color: var(--text-2); font-size: 13.5px; }
.tile .chips { margin-top: 8px; }
.tile--lead { grid-column: span 2; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin-bottom: 14px; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.panel h2 { font-size: 16px; letter-spacing: -0.005em; }
.empty { color: var(--text-3); font-size: 14px; padding-block: 6px; }
.sub { font-size: 14px; color: var(--text-2); margin-block: 14px 6px; }

/* --------------------------------------------------------------- grafiek */
.chart { position: relative; }
.chart__legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--text-2); margin-bottom: 6px; min-height: 20px; }
.chart__legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart__legend i, .chart__tip i { display: inline-block; width: 14px; height: 2px; border-radius: 2px; flex: none; }
.chart__legend b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chart__plot { width: 100%; height: 300px; }
.chart__tip { position: absolute; top: 0; left: 0; z-index: 5; pointer-events: none; min-width: 150px;
              background: var(--raised); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
              box-shadow: 0 6px 20px rgb(0 0 0 / 0.45); font-size: 13px; }
.chart__tip h4 { margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.chart__tip div { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.chart__tip b { color: var(--text); font-variant-numeric: tabular-nums; }
.chart__tip span { color: var(--text-2); }
.u-legend { display: none; }
.tableview { margin-top: 10px; font-size: 14px; }
.tableview summary { color: var(--link); cursor: pointer; width: fit-content; }
.tableview .scroll { margin-top: 8px; max-height: 320px; overflow: auto; }

/* --------------------------------------------------------------- tabellen */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tfoot th { color: var(--text); font-size: 15px; border-top: 1px solid var(--line); border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* -------------------------------------------------------------- voorraad */
.stock { display: grid; gap: 8px; }
.stock__row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; align-items: center; gap: 12px; font-size: 13.5px; }
.stock__shop { color: var(--text); font-weight: 600; }
.stock__cells { display: flex; gap: 2px; overflow: hidden; }
.stock__cells i, .keyline i { display: inline-block; width: 6px; height: 18px; border-radius: 2px; flex: none; }
.is-in { background: var(--good); }
.is-out { background: var(--critical); }
.is-none { background: var(--line); }
.stock__sum { color: var(--text-2); white-space: nowrap; }
.keyline { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--text-2); font-size: 12.5px; margin-top: 4px; }
.keyline span { display: inline-flex; align-items: center; gap: 6px; }
.keyline i { height: 10px; }

/* ---------------------------------------------------------------- status */
.banner { display: inline-flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: 8px; color: var(--text); margin-top: 6px; }
.banner--ok { background: var(--good-wash); }
.banner--ok span { color: var(--good); font-weight: 700; }
.banner--bad { background: var(--warning-wash); }
.banner--bad span { color: var(--warning); font-weight: 800; }
.shops { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-block: 8px 14px; }
.shop { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.shop__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.shop h2 { font-size: 17px; }
.shop--off, .shop--none { background: none; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; border-radius: 999px; padding: 2px 10px; background: var(--raised); color: var(--text-2); white-space: nowrap; }
.state--ok { background: var(--good-wash); color: var(--text); }
.state--ok span { color: var(--good); }
.state--warn { background: var(--warning-wash); color: var(--text); }
.state--warn span { color: var(--warning); }
.state--fail, .state--blocked { background: var(--critical-wash); color: var(--text); }
.state--fail span, .state--blocked span { color: #ef7a7a; }
.facts { display: grid; gap: 6px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { text-align: right; font-variant-numeric: tabular-nums; }
.facts--wide { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 6px 28px; }
.shop__note { color: var(--text-2); font-size: 13px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.alerts { display: grid; gap: 4px; font-size: 14px; }

.build__name { font-size: 20px; margin-top: 4px; }
.prose p, .prose ul { color: var(--text-2); margin-top: 8px; max-width: 78ch; }
.prose ul { list-style: disc; padding-left: 20px; }
.prose li { margin-top: 3px; }

/* ---------------------------------------------------------------- mobiel */
@media (max-width: 640px) {
  .tier { grid-template-columns: 1fr; }
  .tier__label { font-size: 22px; padding: 4px 14px; place-items: center start; }
  .tier__cards { grid-template-columns: 1fr; }
  .intro h1, .detail-head h1 { font-size: 22px; }
  .tile--lead { grid-column: auto; }
  .tile__value { font-size: 24px; }
  .chart__plot { height: 240px; }
  .stock__row { grid-template-columns: 1fr; gap: 3px; }
  .controls { align-items: flex-start; flex-direction: column; }
  .site__nav a { padding: 6px 9px; }
  th, td { padding: 7px 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
