:root {
  --bg:       #0f172a;
  --bg-card:  #1e293b;
  --bg-input: #334155;
  --text:     #e2e8f0;
  --muted:    #94a3b8;
  --border:   #334155;
  --accent:   #3b82f6;
  --green:    #22c55e;
  --yellow:   #f59e0b;
  --red:      #ef4444;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

/* ── Nav ─────────────────────────────────────── */
.topnav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 52px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand { font-weight: 700; font-size: .95rem; color: var(--accent); }
.nav-links { display: flex; gap: .25rem; }
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  padding: .35rem .75rem;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-links a:hover { color: var(--text); background: var(--bg-input); }
.nav-links a.active { color: var(--accent); background: rgba(59,130,246,.12); }

/* ── Layout ──────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 1.5rem; }

/* ── Cards ───────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
}
.card-title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: .6rem;
}
.chart-card { cursor: pointer; transition: border-color .15s; }
.chart-card:hover { border-color: var(--accent); }

/* ── Widgets grid ────────────────────────────── */
.widgets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.widget-value { font-size: 2rem; font-weight: 700; line-height: 1.1; }
.widget-sub   { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
.hrv-arrow    { font-size: 1.3rem; }

/* ── Mini-chart grid ─────────────────────────── */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.chart-wrap  { position: relative; height: 150px; }
.chart-full  { position: relative; height: 280px; margin-top: .5rem; }

/* ── Page header ─────────────────────────────── */
.page-header { margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; }
.page-header p  { color: var(--muted); font-size: .82rem; margin-top: .2rem; }

/* ── Period selector ─────────────────────────── */
.period-selector { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.period-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: .3rem .75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: .82rem;
  text-decoration: none;
  transition: all .15s;
}
.period-btn:hover { color: var(--text); border-color: var(--accent); }
.period-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Legend row ──────────────────────────────── */
.legend-row {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--muted);
  margin-bottom: .5rem;
}
.leg-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: .25rem;
}

/* ── Table ───────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  padding: .55rem .75rem;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td { padding: .55rem .75rem; border-bottom: 1px solid rgba(255,255,255,.04); font-size: .83rem; }
tr:hover td { background: rgba(255,255,255,.025); }

/* ── Filters ─────────────────────────────────── */
.filters { display: flex; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; align-items: center; }
.filter-label { color: var(--muted); font-size: .8rem; }
select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: .3rem .6rem;
  border-radius: 6px;
  font-size: .83rem;
  cursor: pointer;
}

/* ── Pagination ──────────────────────────────── */
.pagination { display: flex; gap: .4rem; justify-content: center; margin-top: 1.25rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .35rem .7rem; border-radius: 6px; font-size: .83rem; text-decoration: none;
}
.pagination a { background: var(--bg-input); color: var(--muted); border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--accent); color: var(--text); }
.pagination .current { background: var(--accent); color: #fff; }

/* ── Badges ──────────────────────────────────── */
.badge {
  display: inline-block; padding: .15rem .5rem;
  border-radius: 999px; font-size: .7rem; font-weight: 600; white-space: nowrap;
}
.badge-Basis        { background: rgba(59,130,246,.2);  color: #93c5fd; }
.badge-Drempel      { background: rgba(249,115,22,.2);  color: #fdba74; }
.badge-Pyramidaal   { background: rgba(234,179,8,.2);   color: #fde047; }
.badge-Gepolariseerd{ background: rgba(168,85,247,.2);  color: #d8b4fe; }
.badge-Hoge         { background: rgba(239,68,68,.2);   color: #fca5a5; }
.badge-Uniek        { background: rgba(107,114,128,.2); color: #d1d5db; }

/* ── Colour utilities ────────────────────────── */
.green   { color: var(--green);  }
.yellow  { color: var(--yellow); }
.red     { color: var(--red);    }
.blue    { color: var(--accent); }
.muted   { color: var(--muted);  }
.neutral { color: var(--text);   }

.link-subtle { color: var(--muted); font-size: .8rem; text-decoration: none; }
.link-subtle:hover { color: var(--accent); }

#sync-btn.disabled { opacity: .5; pointer-events: none; }

.sort-link { color: inherit; text-decoration: none; white-space: nowrap; }
.sort-link:hover { color: var(--text); }
.sort-arrow { color: var(--accent); margin-left: .25rem; }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: .75rem 1.5rem;
}
.detail-grid > div { line-height: 1.5; }
tr.work-row > td { background: rgba(59,130,246,0.07); }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  table th:nth-child(8), table td:nth-child(8),
  table th:nth-child(10), table td:nth-child(10) { display: none; }
}

@media (max-width: 640px) {
  .widgets { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .topnav { padding: 0 1rem; }
  .container { padding: 1rem; }
}
