/* =============================================================
   Ideto Dashboard — Designsysteem
   Editorial minimalism, monochromatische basis, discipline-accenten.
   ============================================================= */

/* ────────────────────────────────────────────────────────────
   1. Design tokens
   ──────────────────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand:            #1A2A44;
  --brand-mid:        #243553;
  --brand-soft:       #2f4470;
  --accent:           #2563eb;
  --accent-hover:     #1d4ed8;
  --accent-soft:      #eff6ff;

  /* Discipline-accenten (één tint per module) */
  --sea:              #2563eb;   /* blauw  — Search Engine Advertising */
  --sea-soft:         #eff6ff;
  --seo:              #15803d;   /* groen  — SEO */
  --seo-soft:         #f0fdf4;
  --lb:               #7c3aed;   /* paars  — Linkbuilding */
  --lb-soft:          #f5f3ff;
  --geo:              #d97706;   /* oranje — Generative Engine Optimization */
  --geo-soft:         #fff7ed;

  /* Merk-accenten (visuele scheiding tussen brands) */
  --brand-vvk:        #15803d;   /* groen — VVK */
  --brand-vvk-soft:   #f0fdf4;
  --brand-tbf:        #b45309;   /* warm amber — TBF */
  --brand-tbf-soft:   #fffbeb;

  /* Neutrale schaal (koel, consistent) */
  --gray-0:           #ffffff;
  --gray-25:          #fafbfc;
  --gray-50:          #f4f5f7;
  --gray-100:         #eceef1;
  --gray-200:         #e1e4e8;
  --gray-300:         #cbd0d6;
  --gray-400:         #9aa1ac;
  --gray-500:         #6b7280;
  --gray-600:         #4b5563;
  --gray-700:         #374151;
  --gray-800:         #1f2937;
  --gray-900:         #111827;

  /* Semantische rollen */
  --bg:               var(--gray-50);
  --surface:          var(--gray-0);
  --surface-alt:      var(--gray-25);
  --border:           var(--gray-200);
  --border-light:     var(--gray-100);
  --border-strong:    var(--gray-300);

  --text-primary:     var(--gray-900);
  --text-secondary:   var(--gray-600);
  --text-muted:       var(--gray-500);
  --text-soft:        var(--gray-400);
  --text-inverse:     #ffffff;
  --text-inv-dim:     rgba(255, 255, 255, .62);
  --text-inv-soft:    rgba(255, 255, 255, .38);

  /* Status-kleuren (één set, overal hetzelfde) */
  --success:          #15803d;
  --success-bg:       #f0fdf4;
  --success-border:   #86efac;
  --warning:          #b45309;
  --warning-bg:       #fffbeb;
  --warning-border:   #fcd34d;
  --danger:           #b91c1c;
  --danger-bg:        #fef2f2;
  --danger-border:    #fca5a5;
  --info:             #1d4ed8;
  --info-bg:          #eff6ff;
  --info-border:      #93c5fd;

  /* Typografie */
  --font-sans:        ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Inter", sans-serif;
  --font-mono:        ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --text-2xs:         10px;
  --text-xs:          11px;
  --text-sm:          12px;
  --text-md:          13px;
  --text-base:        14px;
  --text-lg:          16px;
  --text-xl:          18px;
  --text-2xl:         22px;
  --text-3xl:         28px;
  --text-4xl:         34px;

  --leading-tight:    1.15;
  --leading-snug:     1.35;
  --leading-normal:   1.55;
  --leading-relaxed:  1.7;

  --tracking-tight:   -0.012em;
  --tracking-normal:  0;
  --tracking-wide:    0.04em;
  --tracking-wider:   0.08em;

  /* Spacing */
  --space-1:          4px;
  --space-2:          8px;
  --space-3:          12px;
  --space-4:          16px;
  --space-5:          20px;
  --space-6:          24px;
  --space-8:          32px;
  --space-10:         40px;
  --space-12:         48px;

  /* Radius */
  --radius-xs:        3px;
  --radius-sm:        4px;
  --radius:           6px;
  --radius-md:        8px;
  --radius-lg:        12px;
  --radius-pill:      999px;

  /* Shadow (tinted, low opacity) */
  --shadow-xs:        0 1px 2px rgba(26, 42, 68, .05);
  --shadow-sm:        0 1px 3px rgba(26, 42, 68, .06), 0 1px 2px rgba(26, 42, 68, .04);
  --shadow-md:        0 4px 8px -2px rgba(26, 42, 68, .08), 0 2px 4px -1px rgba(26, 42, 68, .04);
  --shadow-lg:        0 10px 20px -4px rgba(26, 42, 68, .10), 0 4px 8px -2px rgba(26, 42, 68, .04);

  /* Motion */
  --ease:             cubic-bezier(.16, 1, .3, 1);
  --duration-fast:    120ms;
  --duration:         200ms;
  --duration-slow:    320ms;

  /* Layout */
  --sidebar-width:    232px;
  --topbar-height:    52px;
}

/* ────────────────────────────────────────────────────────────
   2. Reset & base
   ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: oldstyle-nums;
}

body, table, input, button, select, textarea {
  font-feature-settings: "ss01" on, "cv11" on;
}

/* Getallen overal uitlijnend */
.num, .kpi__value, .kpi__sub, td.num, .badge--num, table td, table th {
  font-variant-numeric: tabular-nums;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

img, svg { display: block; max-width: 100%; }

/* Skip link */
.skip-link {
  position: absolute; top: -40px; left: 8px;
  background: var(--brand); color: #fff;
  padding: 8px 14px; border-radius: var(--radius-sm);
  font-size: var(--text-md); font-weight: 600;
  z-index: 1000;
}
.skip-link:focus { top: 8px; }

/* ────────────────────────────────────────────────────────────
   3. App shell
   ──────────────────────────────────────────────────────────── */
.app { display: flex; width: 100%; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--brand);
  color: var(--text-inverse);
  display: flex; flex-direction: column;
  height: 100vh;
  position: sticky; top: 0;
  overflow: hidden;
}

.sidebar__head {
  padding: 14px 18px 12px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

/* Brand-switcher */
.brand-switch {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  color: var(--text-inverse);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease);
}
.brand-switch:hover { background: rgba(255,255,255,.10); }
.brand-switch__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand-vvk);
  flex-shrink: 0;
}
.brand-switch[data-brand="tbf"] .brand-switch__dot { background: var(--brand-tbf); }
.brand-switch__body { flex: 1; min-width: 0; text-align: left; }
.brand-switch__label {
  font-size: var(--text-2xs);
  text-transform: uppercase; letter-spacing: var(--tracking-wider);
  color: var(--text-inv-soft);
  font-weight: 600;
  margin-bottom: 1px;
}
.brand-switch__name {
  font-size: var(--text-md); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-switch__caret {
  font-size: 11px; color: var(--text-inv-dim);
  flex-shrink: 0;
}

.brand-menu {
  position: absolute; left: 14px; top: 70px;
  width: calc(var(--sidebar-width) - 28px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
  display: none;
}
.brand-menu.is-open { display: block; }
.brand-menu__item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 9px 10px;
  border: 0; background: transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-md); color: var(--text-primary);
  cursor: pointer; text-align: left;
  transition: background var(--duration-fast) var(--ease);
}
.brand-menu__item:hover { background: var(--gray-50); }
.brand-menu__item.is-active { background: var(--gray-100); font-weight: 600; }
.brand-menu__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gray-300);
  flex-shrink: 0;
}
.brand-menu__item[data-brand="vvk"] .brand-menu__dot { background: var(--brand-vvk); }
.brand-menu__item[data-brand="tbf"] .brand-menu__dot { background: var(--brand-tbf); }
.brand-menu__hint {
  font-size: var(--text-xs); color: var(--text-muted);
  margin-left: auto;
}

/* Sidebar nav */
.sidebar__nav {
  flex: 1; padding: 8px 0 4px;
  overflow-y: auto; scrollbar-width: thin;
}
.sidebar__nav::-webkit-scrollbar { width: 4px; }
.sidebar__nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.08); }

.nav-section {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px 6px;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-inv-soft);
}
.nav-section__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-inv-soft);
}
.nav-section[data-disc="sea"] .nav-section__dot { background: var(--sea); }
.nav-section[data-disc="seo"] .nav-section__dot { background: var(--seo); }
.nav-section[data-disc="lb"]  .nav-section__dot { background: var(--lb); }
.nav-section[data-disc="geo"] .nav-section__dot { background: var(--geo); }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px;
  color: var(--text-inv-dim);
  font-size: var(--text-md);
  border-left: 2px solid transparent;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,.05); color: var(--text-inverse); }
.nav-link.is-active {
  background: rgba(255,255,255,.08);
  color: var(--text-inverse);
  font-weight: 500;
  border-left-color: var(--accent);
}
.nav-link[data-disc="sea"].is-active { border-left-color: var(--sea); }
.nav-link[data-disc="seo"].is-active { border-left-color: var(--seo); }
.nav-link[data-disc="lb"].is-active  { border-left-color: var(--lb); }
.nav-link[data-disc="geo"].is-active { border-left-color: var(--geo); }
.nav-link__icon { flex-shrink: 0; width: 16px; height: 16px; opacity: .8; }
.nav-link.is-active .nav-link__icon { opacity: 1; }
.nav-link__badge {
  margin-left: auto;
  font-size: var(--text-2xs);
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.10);
  color: var(--text-inv-dim);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}
.nav-link__badge--soon { background: rgba(255,255,255,.05); }

/* Sidebar foot */
.sidebar__foot {
  padding: 12px 18px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar__foot a {
  display: flex; align-items: center; gap: 10px;
  font-size: var(--text-md);
  color: var(--text-inv-dim);
  transition: color var(--duration-fast) var(--ease);
}
.sidebar__foot a:hover { color: var(--text-inverse); }
.sidebar__foot svg { width: 15px; height: 15px; opacity: .7; }

/* Mobile sidebar toggle */
.nav-toggle {
  display: none;
  position: fixed; top: 10px; left: 10px;
  width: 36px; height: 36px;
  background: var(--brand); color: #fff;
  border: 0; border-radius: var(--radius-sm);
  font-size: 18px; cursor: pointer;
  z-index: 250;
}

/* ────────────────────────────────────────────────────────────
   4. Main column + topbar
   ──────────────────────────────────────────────────────────── */
.main {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}

.topbar {
  display: flex; align-items: center;
  padding: 0 24px;
  height: var(--topbar-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
  z-index: 50;
  gap: 16px;
}
.topbar__title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.topbar__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-left: 8px;
}
.topbar__spacer { flex: 1; }
.topbar__meta {
  display: flex; align-items: center; gap: 14px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.topbar__refresh {
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar__refresh-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
}
.topbar__refresh.is-stale .topbar__refresh-dot { background: var(--warning); }

/* Periode-selector */
.period {
  display: inline-flex;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.period__btn {
  background: transparent;
  border: 0;
  padding: 4px 10px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease);
}
.period__btn:hover { color: var(--text-primary); }
.period__btn.is-active {
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
}

/* Content */
.content {
  flex: 1;
  padding: 24px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

/* Page header (binnen content) */
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px; flex-wrap: wrap;
}
.page-header__title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}
.page-header__sub {
  font-size: var(--text-md);
  color: var(--text-muted);
  margin-top: 4px;
}
.page-header__actions { display: flex; gap: 8px; align-items: center; }

/* Flash */
.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: var(--text-md);
  margin-bottom: 14px;
  border: 1px solid;
  display: flex; gap: 10px; align-items: center;
}
.flash--ok      { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.flash--error,
.flash--message { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.flash--warn    { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }

.note {
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: var(--leading-snug);
}

/* ────────────────────────────────────────────────────────────
   5. Section + typografie
   ──────────────────────────────────────────────────────────── */
.section { margin-bottom: 28px; }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 10px; gap: 12px;
}
.section__title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
}
.section__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.section__actions { display: flex; gap: 8px; align-items: center; }

/* ────────────────────────────────────────────────────────────
   6. KPI cards
   ──────────────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.kpi-grid--lg { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.kpi-grid--sm { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px 12px;
  display: flex; flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: border-color var(--duration-fast) var(--ease),
              transform var(--duration) var(--ease);
}
.kpi:hover { border-color: var(--border-strong); }

.kpi__label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.kpi__value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
  display: flex; align-items: center; gap: 6px;
}
.kpi__delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kpi__delta--up    { color: var(--success); }
.kpi__delta--down  { color: var(--danger); }
.kpi__delta--flat  { color: var(--text-muted); }

/* Sparkline canvas */
.kpi__spark {
  margin-top: 8px;
  height: 28px;
  width: 100%;
}

/* YoY-vergelijking onder een KPI */
.kpi__yoy {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-light);
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.kpi__yoy-label { color: var(--text-soft); }
.kpi__yoy-delta {
  display: inline-flex; align-items: center; gap: 2px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.kpi__yoy-delta--up   { color: var(--success); }
.kpi__yoy-delta--down { color: var(--danger); }
.kpi__yoy-delta--flat { color: var(--text-muted); }

/* Accent-varianten */
.kpi--sea .kpi__value { color: var(--sea); }
.kpi--seo .kpi__value { color: var(--seo); }
.kpi--lb  .kpi__value { color: var(--lb); }
.kpi--geo .kpi__value { color: var(--geo); }
.kpi--success .kpi__value { color: var(--success); }
.kpi--danger  .kpi__value { color: var(--danger); }

/* ────────────────────────────────────────────────────────────
   7. Tabellen
   ──────────────────────────────────────────────────────────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}
.table th {
  background: var(--surface-alt);
  padding: 9px 14px;
  text-align: left;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table th.center, .table td.center { text-align: center; }
.table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table td:first-child { color: var(--text-primary); font-weight: 500; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--gray-25); }

/* Sorteer-knop in kop */
.table th button.th-sort {
  background: transparent; border: 0;
  font: inherit; color: inherit;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0;
}
.table th button.th-sort:hover { color: var(--text-primary); }
.table th .sort-ind { font-size: 9px; opacity: .5; }
.table th button.th-sort.is-asc .sort-ind,
.table th button.th-sort.is-desc .sort-ind { opacity: 1; color: var(--accent); }

/* Tabel-leeg-row */
.table__empty td {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-style: italic;
}

/* ────────────────────────────────────────────────────────────
   8. Badges
   ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  line-height: 1.4;
  white-space: nowrap;
}
.badge--neutral { background: var(--gray-100); color: var(--text-secondary); }
.badge--info    { background: var(--info-bg);    color: var(--info); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--warn    { background: var(--warning-bg); color: var(--warning); }
.badge--danger  { background: var(--danger-bg);  color: var(--danger); }
.badge--sea     { background: var(--sea-soft);   color: var(--sea); }
.badge--seo     { background: var(--seo-soft);   color: var(--seo); }
.badge--lb      { background: var(--lb-soft);    color: var(--lb); }
.badge--geo     { background: var(--geo-soft);   color: var(--geo); }

/* Status-puntje (kleiner badge zonder achtergrond) */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  vertical-align: middle;
}
.dot--success { background: var(--success); }
.dot--warn    { background: var(--warning); }
.dot--danger  { background: var(--danger); }
.dot--info    { background: var(--info); }

/* Trend-icon */
.trend {
  display: inline-flex; align-items: center; gap: 3px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.trend--up    { color: var(--success); }
.trend--down  { color: var(--danger); }
.trend--flat  { color: var(--text-muted); }
.trend--new   { color: var(--info); }

/* Prioriteit-pill (P1-P4) */
.prio {
  display: inline-flex;
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  color: #fff;
  white-space: nowrap;
}
.prio--1 { background: var(--danger); }
.prio--2 { background: var(--accent); }
.prio--3 { background: var(--warning); }
.prio--4 { background: var(--gray-400); }

/* ────────────────────────────────────────────────────────────
   9. Buttons
   ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease),
              color var(--duration-fast) var(--ease),
              transform var(--duration-fast) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--sm { padding: 4px 10px; font-size: var(--text-sm); }
.btn--xs { padding: 3px 8px; font-size: var(--text-xs); }
.btn--block { width: 100%; }

.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn--dark { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn--dark:hover { background: var(--brand-mid); border-color: var(--brand-mid); }

.btn--ghost {
  background: var(--surface); color: var(--text-secondary);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--gray-50); color: var(--text-primary); border-color: var(--border-strong); }

.btn--text {
  background: transparent; color: var(--accent);
  border-color: transparent; padding-left: 8px; padding-right: 8px;
}
.btn--text:hover { background: var(--accent-soft); }

.btn--danger {
  background: var(--surface); color: var(--danger);
  border-color: var(--danger-border);
}
.btn--danger:hover { background: var(--danger-bg); }

.btn--success { background: var(--success); color: #fff; border-color: var(--success); }
.btn--success:hover { background: #166534; border-color: #166534; }

.btn-group { display: inline-flex; gap: 6px; align-items: center; }

/* ────────────────────────────────────────────────────────────
   10. Forms
   ──────────────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
.field__hint {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
}
.field__input,
.field__select,
.field__textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-size: var(--text-md);
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}
.field__input:focus,
.field__select:focus,
.field__textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.14);
}
.field__textarea { min-height: 120px; resize: vertical; line-height: var(--leading-normal); }

/* ────────────────────────────────────────────────────────────
   11. Tabs / segmented
   ──────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  gap: 0;
}
.tabs__tab {
  background: transparent; border: 0;
  padding: 8px 18px;
  font-size: var(--text-md); font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
  display: inline-flex; align-items: center; gap: 6px;
}
.tabs__tab:hover { color: var(--text-primary); }
.tabs__tab.is-active { color: var(--brand); border-bottom-color: var(--brand); }
.tabs__count {
  font-size: var(--text-2xs);
  background: var(--gray-100);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.tabs__tab.is-active .tabs__count { background: var(--accent-soft); color: var(--accent); }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* ────────────────────────────────────────────────────────────
   12. Cards (algemeen)
   ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
}
.card--pad-sm { padding: 12px 14px; }
.card--accent {
  border-left: 3px solid var(--accent);
}
.card--accent.card--sea { border-left-color: var(--sea); }
.card--accent.card--seo { border-left-color: var(--seo); }
.card--accent.card--lb  { border-left-color: var(--lb); }
.card--accent.card--geo { border-left-color: var(--geo); }
.card--accent.card--danger  { border-left-color: var(--danger); }
.card--accent.card--success { border-left-color: var(--success); }
.card--accent.card--warn    { border-left-color: var(--warning); }

.card__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}
.card__title {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-primary);
}
.card__sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.card__body { font-size: var(--text-md); color: var(--text-secondary); line-height: var(--leading-snug); }

/* ────────────────────────────────────────────────────────────
   13. Skeleton loaders
   ──────────────────────────────────────────────────────────── */
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}
.skeleton {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  animation: sk-pulse 1.4s ease-in-out infinite;
  display: inline-block;
}
.skeleton--block { display: block; height: 1em; }
.skeleton--w-xs { width: 32px; }
.skeleton--w-sm { width: 60px; }
.skeleton--w-md { width: 100px; }
.skeleton--w-lg { width: 160px; }
.skeleton--w-full { width: 100%; }
.skeleton--h-lg { height: 28px; }
.skeleton--h-md { height: 18px; }
.skeleton--h-sm { height: 12px; }

/* Skeleton voor KPI */
.kpi.is-loading .kpi__value,
.kpi.is-loading .kpi__sub { visibility: hidden; }
.kpi.is-loading::before {
  content: ""; position: absolute;
  left: 16px; top: 36px;
  width: 90px; height: 22px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  animation: sk-pulse 1.4s ease-in-out infinite;
}
.kpi.is-loading::after {
  content: ""; position: absolute;
  left: 16px; top: 64px;
  width: 130px; height: 11px;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  animation: sk-pulse 1.4s ease-in-out infinite;
}

/* ────────────────────────────────────────────────────────────
   14. Empty state
   ──────────────────────────────────────────────────────────── */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 36px 24px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty__icon {
  width: 36px; height: 36px;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.empty__title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}
.empty__body {
  font-size: var(--text-md);
  color: var(--text-muted);
  max-width: 380px;
  line-height: var(--leading-snug);
}

/* ────────────────────────────────────────────────────────────
   15. Toast / job-bar
   ──────────────────────────────────────────────────────────── */
.toast-stack {
  position: fixed; bottom: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 800;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px;
  padding: 10px 12px;
  background: var(--gray-900);
  color: #fff;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: var(--text-md);
  pointer-events: auto;
  animation: toast-in var(--duration-slow) var(--ease) both;
}
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.toast__icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: #fff;
}
.toast--success .toast__icon { background: var(--success); }
.toast--danger  .toast__icon { background: var(--danger); }
.toast--warn    .toast__icon { background: var(--warning); }
.toast__body { flex: 1; min-width: 0; }
.toast__title {
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.toast__sub {
  font-size: var(--text-xs);
  color: rgba(255,255,255,.62);
  margin-top: 1px;
}
.toast__close {
  background: transparent; border: 0;
  color: rgba(255,255,255,.45);
  cursor: pointer; padding: 2px 4px;
  font-size: 16px; line-height: 1;
}
.toast__close:hover { color: #fff; }
.toast__link {
  color: #60a5fa;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

/* Job-bar spinner */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ────────────────────────────────────────────────────────────
   16. Chart container
   ──────────────────────────────────────────────────────────── */
.chart {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px 12px;
}
.chart__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.chart__title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text-primary);
}
.chart__canvas-wrap { position: relative; height: 220px; }
.chart__canvas-wrap--sm { height: 140px; }
.chart__canvas-wrap--lg { height: 320px; }

.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } }

/* ────────────────────────────────────────────────────────────
   17. Layout-helpers (gebruikt door templates)
   ──────────────────────────────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
}
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
@media (max-width: 900px) {
  .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2          { grid-template-columns: 1fr; }
}

.row    { display: flex; gap: 10px; align-items: center; }
.row--end{ justify-content: flex-end; }
.row--between { justify-content: space-between; }
.row--wrap{ flex-wrap: wrap; }
.col    { display: flex; flex-direction: column; gap: 10px; }
.gap-2  { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-2   { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.mb-6   { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.mt-2   { margin-top: 8px; }    .mt-3 { margin-top: 12px; }
.flex-1 { flex: 1; min-width: 0; }
.text-muted    { color: var(--text-muted); }
.text-soft     { color: var(--text-soft); }
.text-secondary{ color: var(--text-secondary); }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-md  { font-size: var(--text-md); }
.text-base{ font-size: var(--text-base); }
.font-mono { font-family: var(--font-mono); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ────────────────────────────────────────────────────────────
   18. Stubs-state (Linkbuilding/GEO/TBF placeholder)
   ──────────────────────────────────────────────────────────── */
.stub-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning);
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: var(--text-md);
}
.stub-banner__title { font-weight: 700; }

/* ────────────────────────────────────────────────────────────
   19. Login
   ──────────────────────────────────────────────────────────── */
.auth-shell {
  width: 100%;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 26px 22px;
  box-shadow: var(--shadow-sm);
}
.auth-card__brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 18px;
}
.auth-card__brand-mark {
  width: 32px; height: 32px;
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  letter-spacing: var(--tracking-tight);
}
.auth-card__title {
  font-size: var(--text-xl); font-weight: 700;
  color: var(--text-primary);
  letter-spacing: var(--tracking-tight);
}
.auth-card__sub {
  font-size: var(--text-sm); color: var(--text-muted);
  margin-bottom: 16px;
}

/* ────────────────────────────────────────────────────────────
   20. Responsive (mobile)
   ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .nav-toggle { display: block; }
  .sidebar {
    position: fixed; top: 0; left: -260px;
    height: 100vh;
    transition: left var(--duration) var(--ease);
    z-index: 240;
  }
  .sidebar.is-open { left: 0; box-shadow: var(--shadow-lg); }
  .topbar { padding: 0 16px 0 56px; }
  .content { padding: 16px; }
  .page-header { gap: 8px; }
  .page-header__title { font-size: var(--text-xl); }
  .kpi-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .kpi__value { font-size: var(--text-xl); }
  .brand-menu { width: 230px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print (back-up) */
@media print {
  .sidebar, .topbar, .toast-stack, .nav-toggle { display: none !important; }
  .content { padding: 0; }
}

/* ────────────────────────────────────────────────────────────
   21. Compat-laag: oude klassennamen → nieuwe componenten
   Houdt nog-niet-gemigreerde templates werkbaar tot ze één
   voor één zijn omgezet naar het nieuwe systeem.
   ──────────────────────────────────────────────────────────── */

/* Oude page-section header */
.section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* Oude KPI structuur (.kpi .label / .value / .sub) */
.kpi .label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  margin-bottom: 6px;
}
.kpi .value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .sub {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 6px;
}
.kpi.accent-green .value { color: var(--success); }
.kpi.accent-blue  .value { color: var(--accent); }

/* Oude tabel zonder .table klasse */
.table-wrap table:not(.table) {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-md);
}
.table-wrap table:not(.table) th {
  background: var(--surface-alt);
  padding: 9px 14px;
  text-align: left;
  font-size: var(--text-2xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table-wrap table:not(.table) td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}
.table-wrap table:not(.table) td:first-child { color: var(--text-primary); font-weight: 500; }
.table-wrap table:not(.table) tbody tr:last-child td { border-bottom: 0; }
.table-wrap table:not(.table) tbody tr:hover td { background: var(--gray-25); }

/* Oude btn-* varianten */
.btn-primary { background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 7px 14px; border-radius: var(--radius); font-size: var(--text-md); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
  transition: background var(--duration-fast) var(--ease); white-space: nowrap; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: var(--surface); color: var(--text-secondary); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: var(--radius); font-size: var(--text-md); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
  transition: background var(--duration-fast) var(--ease); white-space: nowrap; }
.btn-ghost:hover { background: var(--gray-50); color: var(--text-primary); border-color: var(--border-strong); }
.btn-green { background: var(--success); color: #fff; border: 1px solid var(--success);
  padding: 7px 14px; border-radius: var(--radius); font-size: var(--text-md); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-green:hover { background: #166534; border-color: #166534; }
.btn-danger { background: var(--surface); color: var(--danger); border: 1px solid var(--danger-border);
  padding: 7px 14px; border-radius: var(--radius); font-size: var(--text-md); font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-danger:hover { background: var(--danger-bg); }

/* Oude form structuur */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: var(--text-sm); font-weight: 600;
  color: var(--text-secondary); margin-bottom: 5px; }
.form-input { width: 100%; padding: 8px 11px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); font: inherit;
  font-size: var(--text-md); color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease); }
.form-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
.form-hint { display: block; font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px; }

/* Oude flash zonder modifier */
.flash:not([class*="flash--"]) { background: var(--danger-bg); color: var(--danger);
  border: 1px solid var(--danger-border); padding: 10px 14px; border-radius: var(--radius);
  font-size: var(--text-md); margin-bottom: 14px; }
.flash.ok { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }

/* Oude .err inline */
.err { color: var(--danger); font-size: var(--text-md); margin-bottom: 12px; }
.err:empty { display: none; }

/* Oude badge varianten */
.badge-concept     { background: var(--info-bg);    color: var(--info);
  display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.badge-gepubliceerd { background: var(--success-bg); color: var(--success);
  display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); }
.badge-archief     { background: var(--gray-100); color: var(--text-muted);
  display: inline-flex; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: var(--text-2xs); font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-wide); }

