/* Accu of niet? — design system v3, hand-rolled, no framework (PROJECT.md §4.2).
   Composition: ambient hero → input console (data + sticky action rail) →
   results as a report. Every color derives from the validated dataviz tokens;
   flash lives in gradients, light and motion — never in new hues. */

:root {
  color-scheme: light;
  --plane: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;
  --accent-down: #1c5cab;
  --violet: #4a3aa7; /* categorical slot 7 — ambient use only */
  --ok: #006300;
  --bad: #d03b3b;
  --warn-bg: #fdf6e3;
  --warn-edge: #9a6b00;
  --error-bg: #fbeeee;
  --error-edge: #a3271f;
  --s1: #2a78d6; /* import / huidig contract */
  --s2: #eb6834; /* export / alternatief */
  --s3: #1baf7a; /* opwek */
  --range: #9ec5f4; /* sequential blue 200: gevoeligheidsband */
  --shadow-1: 0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 18px rgba(11, 11, 11, 0.05);
  --shadow-2: 0 2px 6px rgba(11, 11, 11, 0.07), 0 14px 40px rgba(11, 11, 11, 0.08);
  --radius: 18px;
  --radius-s: 11px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Dark tokens exist twice on purpose (the dataviz-skill pattern): the media
   query covers the OS setting, the data-theme scope covers the in-page
   toggle, and the toggle must win in both directions. Keep the two blocks
   byte-identical when editing. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --plane: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-down: #5598e7;
    --violet: #9085e9;
    --ok: #0ca30c;
    --bad: #e66767;
    --warn-bg: #2a2410;
    --warn-edge: #fab219;
    --error-bg: #2c1514;
    --error-edge: #e66767;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --range: #184f95;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 18px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.55), 0 14px 40px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-down: #5598e7;
  --violet: #9085e9;
  --ok: #0ca30c;
  --bad: #e66767;
  --warn-bg: #2a2410;
  --warn-edge: #fab219;
  --error-bg: #2c1514;
  --error-edge: #e66767;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --range: #184f95;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.5), 0 4px 18px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, 0.55), 0 14px 40px rgba(0, 0, 0, 0.45);
}

/* Inter (variable, self-hosted, OFL — web/fonts/LICENSE-Inter.txt). */
@font-face {
  font-family: "Inter";
  src: url("fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv05" 1; /* Inter: open 'l' — friendlier Dutch text */
  line-height: 1.6;
  color: var(--ink);
  background: var(--plane);
  /* The hero's ambient pseudo-layers overhang the column on purpose; clip
     (not hidden — clip creates no scroll container, so sticky keeps working). */
  overflow-x: clip;
}

/* One centered column for everything. */
.topbar,
header.hero,
main,
footer {
  max-width: 60rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

/* ---- topbar --------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.65rem;
  background: color-mix(in srgb, var(--plane) 72%, transparent);
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 720;
  letter-spacing: -0.015em;
  font-size: 0.98rem;
  color: var(--ink);
}

.brand::before {
  content: "";
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), var(--s3));
  transform: rotate(45deg);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent);
  flex: none;
}

.header-controls {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
}

.lang-switch {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  flex: none;
}

button.lang {
  padding: 0.32rem 0.85rem;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
  letter-spacing: 0.06em;
  box-shadow: none;
}

button.lang:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--ink);
}

button.lang.active {
  background: var(--accent);
  color: #ffffff;
}

.theme-toggle {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--ink-2);
  padding: 0.32rem 0.72rem;
  font-size: 0.95rem;
  line-height: 1.2;
  flex: none;
}

.theme-toggle:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--ink);
  transform: rotate(-12deg);
}

/* ---- hero ----------------------------------------------------------------- */

header.hero {
  position: relative;
  padding-block: clamp(3rem, 8vw, 5rem) 1.6rem;
  isolation: isolate;
}

/* The ambient signature: one slow-drifting aurora blob + a dotted grid that
   fades out downward. Decorative only; the palette's own hues at whisper
   opacity. Motion dies under prefers-reduced-motion. */
header.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: -8rem;
  left: -6rem;
  width: min(52rem, 90vw);
  height: 26rem;
  background:
    radial-gradient(38% 55% at 28% 38%, color-mix(in srgb, var(--accent) 34%, transparent), transparent 70%),
    radial-gradient(34% 48% at 68% 28%, color-mix(in srgb, var(--s3) 26%, transparent), transparent 70%),
    radial-gradient(30% 46% at 52% 72%, color-mix(in srgb, var(--violet) 22%, transparent), transparent 72%);
  filter: blur(48px);
  opacity: 0.75;
  animation: drift 22s var(--ease) infinite alternate;
  pointer-events: none;
}

header.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 -20vw auto;
  height: 100%;
  background: radial-gradient(circle at 1px 1px, var(--baseline) 1px, transparent 1.4px);
  background-size: 26px 26px;
  opacity: 0.28;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.9), transparent 85%);
  pointer-events: none;
}

@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(4rem, 1.4rem, 0) scale(1.12); }
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
}

.kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

header.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 7vw, 3.6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(
    96deg,
    var(--ink) 0%,
    var(--ink) 38%,
    var(--accent) 68%,
    color-mix(in srgb, var(--s3) 85%, var(--accent)) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 1.1rem 0 0;
  max-width: 40rem;
  color: var(--ink-2);
  font-size: clamp(1.02rem, 2.5vw, 1.16rem);
  line-height: 1.66;
  text-wrap: pretty;
}

.badges {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0;
  margin: 1.4rem 0 0;
}

.badges li {
  font-size: 0.78rem;
  font-weight: 640;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.32rem 0.95rem;
  backdrop-filter: blur(4px);
  box-shadow: var(--shadow-1);
}

.badges li::before {
  content: "\2713\00a0\00a0";
  font-weight: 800;
}

.badges li:nth-child(1)::before { color: var(--s1); }
.badges li:nth-child(2)::before { color: var(--s3); }
.badges li:nth-child(3)::before { color: var(--s2); }

/* ---- layout & sections ----------------------------------------------------- */

main {
  display: grid;
  gap: 1.2rem;
  padding-block: 0.8rem 3rem;
}

main section {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.9rem);
  box-shadow: var(--shadow-1);
}

/* Page-load & reveal choreography: sections rise as they appear — including
   the result sections the app unhides later, which animate at that moment. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

header.hero,
main section {
  animation: rise 0.55s var(--ease) backwards;
}

main section:nth-of-type(2) { animation-delay: 0.06s; }

/* The input console: data entry beside a sticky action rail on wide screens. */
.console {
  display: grid;
  gap: 1.2rem;
}

@media (min-width: 60rem) {
  .console {
    grid-template-columns: 1.55fr 1fr;
    align-items: start;
  }

  .console #contract {
    position: sticky;
    top: 4.3rem;
  }
}

/* The action rail earns the gradient border — one clearly-primary panel. */
.console #contract {
  border: 1px solid transparent;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(
      160deg,
      color-mix(in srgb, var(--accent) 55%, var(--border)),
      color-mix(in srgb, var(--border) 80%, transparent) 40%,
      color-mix(in srgb, var(--s3) 45%, var(--border))
    ) border-box;
  box-shadow: var(--shadow-2);
}

h2 {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 1.24rem;
  font-weight: 720;
  letter-spacing: -0.015em;
  margin: 0 0 0.9rem;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-size: 0.85rem;
  font-weight: 760;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--s3) 65%, var(--accent)));
  box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 40%, transparent);
  flex: none;
}

h3 {
  font-size: 1.05rem;
  font-weight: 690;
  margin: 1.7rem 0 0.4rem;
  letter-spacing: -0.01em;
}

a {
  color: var(--accent);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1.5px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 0.25s var(--ease), color 0.15s ease;
  padding-bottom: 1px;
}

a:hover {
  color: var(--accent-down);
  background-size: 100% 1.5px;
}

p {
  margin: 0.6rem 0;
}

/* ---- form controls --------------------------------------------------------- */

label {
  display: block;
  margin: 0.9rem 0;
  font-weight: 630;
  font-size: 0.92rem;
}

select,
textarea,
input[type="number"] {
  display: block;
  margin-top: 0.4rem;
  width: 100%;
  font: inherit;
  font-weight: normal;
  padding: 0.6rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--baseline) 80%, transparent);
  border-radius: var(--radius-s);
  background: var(--plane);
  color: var(--ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

select {
  appearance: none;
  padding-right: 2.3rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%23898781' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
}

select:hover,
textarea:hover,
input[type="number"]:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--baseline));
  background: var(--surface);
}

select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 20%, transparent);
}

button:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
}

/* Mode toggle as a segmented control; the radios stay for accessibility. */
.mode-toggle {
  display: inline-flex;
  gap: 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.27rem;
  margin: 0 0 1.1rem;
  background: var(--plane);
}

.mode-toggle legend {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

.mode-toggle label.inline {
  margin: 0;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  font-weight: 630;
  font-size: 0.9rem;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.15s ease, box-shadow 0.18s ease;
}

.mode-toggle label.inline:hover {
  color: var(--ink);
}

.mode-toggle label.inline:has(input:checked) {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

.mode-toggle label.inline:has(input:checked) span::before {
  content: "\2713\00a0";
  color: var(--accent);
  font-weight: 800;
}

.mode-toggle input[type="radio"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Narrow screens: the segments stack and the control spans the section. */
@media (max-width: 40rem) {
  .mode-toggle {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: var(--radius-s);
  }

  .mode-toggle label.inline {
    display: flex;
    justify-content: center;
    text-align: center;
    border-radius: 8px;
  }
}

label.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.3rem 1.25rem 0.3rem 0;
  font-weight: normal;
}

label.inline input {
  display: inline;
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0 1.4rem;
}

label.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.7rem 1rem;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 42%, var(--baseline));
  border-radius: var(--radius-s);
  background:
    radial-gradient(
      80% 120% at 50% 0%,
      color-mix(in srgb, var(--accent) 6%, transparent),
      transparent
    ),
    var(--plane);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.18s var(--ease),
    box-shadow 0.18s ease;
}

label.dropzone:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-1);
}

.dropzone-icon {
  font-size: 1.7rem;
  color: var(--accent);
  line-height: 1;
}

label.dropzone input[type="file"] {
  border: none;
  background: transparent;
  width: auto;
  margin: 0.3rem auto 0;
  font-size: 0.85rem;
  color: var(--muted);
}

code {
  background: var(--plane);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.08rem 0.4rem;
  font-size: 0.86em;
}

details {
  margin: 0.85rem 0;
}

details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 580;
  list-style: none;
}

details summary::before {
  content: "\203A\00a0";
  display: inline-block;
  transition: transform 0.15s ease;
  font-weight: 700;
}

details[open] summary::before {
  transform: rotate(90deg) translateX(2px);
}

/* ---- buttons ---------------------------------------------------------------- */

button {
  font: inherit;
  font-weight: 650;
  padding: 0.6rem 1.5rem;
  border: none;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s var(--ease), box-shadow 0.18s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

button:disabled {
  background: var(--grid);
  color: var(--muted);
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.secondary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

#simulate-button {
  width: 100%;
  margin-top: 0.8rem;
  padding: 0.85rem 2.1rem;
  font-size: 1.04rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-down) 60%, var(--accent) 130%);
  background-size: 160% 160%;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 4px 16px color-mix(in srgb, var(--accent) 38%, transparent);
}

#simulate-button:hover:not(:disabled) {
  background-position: 100% 0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 7px 24px color-mix(in srgb, var(--accent) 50%, transparent);
  transform: translateY(-1px);
}

#simulate-button:disabled {
  background: var(--grid);
  box-shadow: none;
  transform: none;
}

/* ---- status & progress ------------------------------------------------------ */

#runtime-status {
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  margin-bottom: 0;
}

#runtime-status::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.45rem;
  border-radius: 50%;
  background: var(--warn-edge);
  animation: pulse 1.6s ease-in-out infinite;
}

#runtime-status.ready {
  color: var(--ok);
}

#runtime-status.ready::before {
  background: var(--ok);
  animation: none;
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

#progress-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

#progress-list li {
  position: relative;
  padding: 0.38rem 0 0.38rem 2.1rem;
  color: var(--muted);
}

#progress-list li::before {
  content: "";
  position: absolute;
  left: 0.25rem;
  top: 0.74rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  border: 2px solid var(--baseline);
  background: var(--surface);
  transition: border-color 0.2s ease, background 0.2s ease;
}

#progress-list li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  top: 1.8rem;
  bottom: -0.4rem;
  width: 2px;
  border-radius: 1px;
  background: var(--grid);
}

#progress-list li.active {
  color: var(--ink);
  font-weight: 630;
}

#progress-list li.active::before {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
  animation: pulse 1.6s ease-in-out infinite;
}

#progress-list li.done {
  color: var(--ink-2);
}

#progress-list li.done::before {
  border-color: var(--ok);
  background: var(--ok);
}

/* ---- facts, stat tiles, tables ---------------------------------------------- */

/* The household fingerprint as a tile grid: each dt/dd pair is one tile. */
dl.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  gap: 0.6rem;
  margin: 0 0 0.4rem;
}

.fact-tile {
  background: var(--plane);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 0.65rem 0.95rem 0.75rem;
}

.fact-tile dt {
  font-weight: 660;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fact-tile dd {
  margin: 0.15rem 0 0;
  font-variant-numeric: tabular-nums;
  font-weight: 660;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 0.7rem;
  margin: 0.5rem 0 1rem;
}

.stat-tile {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  padding: 0.8rem 1rem;
  backdrop-filter: blur(3px);
}

.stat-tile .stat-label {
  font-size: 0.74rem;
  font-weight: 660;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stat-tile .stat-value {
  font-size: clamp(1.5rem, 3.4vw, 1.9rem);
  font-weight: 740;
  letter-spacing: -0.025em;
  margin-top: 0.15rem;
  line-height: 1.15;
}

.stat-tile .stat-value.up {
  color: var(--bad);
}

.stat-tile .stat-value.down {
  color: var(--ok);
}

table {
  border-collapse: collapse;
  width: 100%;
  margin: 0.9rem 0;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

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

thead th,
tr:first-child th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 680;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--baseline);
}

tbody tr:hover td,
tr:hover td {
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}

td.num,
th.num {
  text-align: right;
}

.positive {
  color: var(--ok);
  font-weight: 650;
}

.negative {
  color: var(--bad);
  font-weight: 650;
}

/* Narrow screens: a wide table scrolls inside itself, never the page. */
@media (max-width: 40rem) {
  table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
}

/* ---- callouts ---------------------------------------------------------------- */

.card {
  position: relative;
  border: 1px solid transparent;
  border-radius: var(--radius-s);
  padding: 1.05rem 1.25rem;
  margin: 1rem 0;
  background:
    linear-gradient(
      color-mix(in srgb, var(--accent) 4%, var(--surface)),
      color-mix(in srgb, var(--s3) 3%, var(--surface))
    )
    padding-box,
    linear-gradient(
      150deg,
      color-mix(in srgb, var(--accent) 45%, var(--border)),
      color-mix(in srgb, var(--border) 85%, transparent) 45%,
      color-mix(in srgb, var(--s3) 35%, var(--border))
    )
    border-box;
}

.warning {
  background: var(--warn-bg);
  border: 1px solid color-mix(in srgb, var(--warn-edge) 45%, transparent);
  border-radius: var(--radius-s);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}

.warning::before {
  content: "\26A0\00a0 ";
  color: var(--warn-edge);
}

.error-panel {
  background: var(--error-bg);
  border-color: color-mix(in srgb, var(--error-edge) 50%, transparent);
}

.error-panel pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  background: var(--surface);
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.notes {
  font-size: 0.86rem;
  color: var(--muted);
}

/* ---- charts (specs: dataviz skill — thin marks, hairlines, quiet) ----------- */

.chart-card {
  margin: 1.4rem 0 0.6rem;
  padding: 1.05rem 1.15rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--plane);
}

.chart-card h3 {
  margin: 0 0 0.1rem;
}

.chart-card .chart-sub {
  margin: 0 0 0.55rem;
  font-size: 0.84rem;
  color: var(--muted);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
  margin: 0.3rem 0 0.45rem;
  font-size: 0.84rem;
  color: var(--ink-2);
}

.chart-legend .key {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.chart-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

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

.chart-svg text {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}

#chart-tooltip {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-2);
  padding: 0.5rem 0.7rem;
  font-size: 0.82rem;
  max-width: 19rem;
}

#chart-tooltip .tip-title {
  font-weight: 660;
  margin-bottom: 0.15rem;
}

/* Rows wrap inside the box — a long scenario name must never escape it. */
#chart-tooltip .tip-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

#chart-tooltip .tip-row > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

#chart-tooltip .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
  align-self: center;
}

/* ---- footer ------------------------------------------------------------------ */

footer {
  margin-top: 1rem;
  padding-block: 1.5rem 2.75rem;
  border-top: 1px solid var(--grid);
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.75;
}

/* ---- motion & print ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  html {
    scroll-behavior: auto;
  }
}

@media print {
  .topbar,
  #invoer,
  #contract,
  #voortgang,
  .lang-switch,
  .theme-toggle {
    display: none !important;
  }

  body {
    background: #ffffff;
  }

  header.hero::before,
  header.hero::after {
    display: none;
  }

  main section {
    box-shadow: none;
    border-color: #dddddd;
    break-inside: avoid;
  }
}
