/* Opmaak van de app: Datablad, licht papier en inkt. Dunne lijnen in plaats van kaarten, serif koppen,
   alles in beeld. Kleuren, letters, rondingen en maten staan in de tokens hieronder. */
:root {
  --bg: #f3efe6; --surface: #f8f5ee; --surface-2: #e9e3d6; --ink: #1d1b17; --muted: #6a6357; --line: #d9d1c1; --line-strong: #b9ae99;
  --accent: #b5361b; --on-accent: #fff8f0; --primary: #1d1b17; --on-primary: #f3efe6; --done: #1d1b17; --on-done: #f3efe6;
  --warn: #b5361b; --sw-none: #d9d1c1; --sw-klein: #7f9e74; --sw-middel: #d39a2c; --sw-groot: #b5361b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Noto Serif", Georgia, "Times New Roman", serif;
  --font-num: var(--font);
  --radius: 4px; --radius-sm: 3px; --radius-btn: 4px;
  --tap: 48px; --check: 56px; --pad: 16px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --tabbar-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--font);
  padding-bottom: calc(var(--tabbar-h) + 88px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 560px; margin: 0 auto; padding: 0 var(--pad); }
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 650; line-height: 1.15; }
p { margin: 0; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.icon { flex: none; }
[hidden] { display: none !important; }

/* ---------- kop ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--s2); padding: var(--s4) 0 var(--s2); margin-bottom: var(--s3); min-height: 72px;
  border-bottom: 2px solid var(--ink);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-sub { margin-top: 2px; color: var(--muted); font-size: 14px; }
.icon-btn {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); flex: none; margin: 0 -8px;
  border-radius: 999px; color: var(--muted); text-decoration: none;
}
.icon-btn:active { background: var(--surface-2); }
.chip {
  display: inline-flex; align-items: center; gap: 2px; min-height: 32px; padding: 0 10px 0 4px; margin-top: 6px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink); text-decoration: none; font-size: 14px;
}
.chip .icon { width: 18px; height: 18px; }

/* ---------- tabbalk ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--bg); border-top: 2px solid var(--ink);
}
.tabbar a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 550;
}
.tabbar a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 3px 0 var(--accent); }
.tabbar a[aria-current="page"] .icon { color: var(--accent); }

/* ---------- knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--tap); padding: 0 var(--s4); border: 1px solid var(--line-strong); border-radius: var(--radius-btn);
  background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600;
}
.btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn.danger { background: var(--warn); color: #fff; border-color: var(--warn); }
.btn:disabled { opacity: .4; }
.btn.wide { width: 100%; }
.btn .icon { width: 20px; height: 20px; }
.stack { display: grid; gap: var(--s2); margin-top: var(--s3); }
.link {
  min-height: var(--tap); padding: 0 var(--s3); border: 0; background: none; color: var(--ink); font-weight: 600;
}
.link.quiet { color: var(--muted); font-weight: 500; }
.link:disabled { opacity: .35; }

/* ---------- onderdelen en inklappen ---------- */
.part { margin: var(--s5) 0 0; }
.part-title {
  font-family: var(--font-head); font-weight: 600; font-size: 18px; margin-bottom: var(--s3); padding-bottom: 4px; border-bottom: 1px solid var(--ink);
}
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details.tap {
  margin-top: var(--s4); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
details.tap > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 52px; font-weight: 600;
}
details.tap + details.tap { margin-top: 0; border-top: 0; }
.chev { color: var(--muted); transition: transform .15s; }
details[open] > summary .chev { transform: rotate(180deg); }

/* ---------- meldingen en lege staat ---------- */
.banner {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: var(--tap); padding: var(--s3) var(--s4);
  margin-bottom: var(--s3); border: 1px solid var(--accent); border-radius: var(--radius); background: none;
  color: var(--ink); text-decoration: none; font-size: 15px; text-align: left;
}
.banner .icon { color: var(--accent); }
.import-card, .no-session, .notice { padding: var(--s3) 0; margin-bottom: var(--s4); border-top: 2px solid var(--ink); }
.import-card h2, .no-session h2 { font-size: 22px; margin-bottom: var(--s2); }
.import-card p, .no-session p { color: var(--muted); }
.import-card .btn { margin-top: var(--s4); min-height: 56px; font-size: 17px; }
.no-session p strong { color: var(--ink); }
.notice .btn { margin-top: var(--s3); }
.empty-note { color: var(--muted); padding: var(--s4) 0; }
.hint { margin-top: var(--s3); color: var(--muted); font-size: 14px; }

/* ---------- lijsten met rijen ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 52px; padding: var(--s2) 0;
  border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; text-decoration: none; color: var(--ink);
}
.row > span:first-child { flex: 1; min-width: 0; }
.row .muted { font-size: 14px; }
.row .icon { color: var(--muted); width: 20px; height: 20px; }
.group-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 650; color: var(--ink); margin: var(--s4) 0 var(--s1);
  padding-bottom: 4px; border-bottom: 1px solid var(--ink);
}
.group-title .count { font-weight: 400; }

/* ---------- Vandaag: kop ---------- */
.day-head { margin-bottom: var(--s4); }
.day-line { color: var(--muted); font-size: 14px; margin-top: var(--s2); }
.day-line strong { color: var(--ink); }
.progress { height: 3px; margin-top: var(--s3); background: var(--line); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.facts { display: flex; justify-content: space-between; gap: var(--s4); margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--muted); }
.facts dd { margin: 0; font-size: 20px; font-weight: 650; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.kpi b { display: block; font-size: 30px; line-height: 1.05; font-weight: 650; }
.kpi span { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---------- Vandaag: oefening, als blok tussen lijnen ---------- */
.exercise { padding: var(--s3) 0 0; margin: 0 0 var(--s4); border-top: 1px solid var(--ink); scroll-margin-top: var(--s4); }
.ex-head { display: flex; align-items: flex-start; gap: var(--s3); }
.ex-title { flex: 1; min-width: 0; }
.ex-head h3 { font-size: 19px; font-weight: 600; }
/* De naam opent het detail; het tikvlak loopt boven en onder de tekst door. */
.ex-head h3 a { display: inline-block; padding: 12px 0; margin: -12px 0; text-decoration: none; }
.setting { margin-top: 2px; font-size: 14px; color: var(--muted); }
.ex-aside { display: flex; align-items: center; gap: var(--s3); flex: none; }
.ex-kpi { text-align: right; line-height: 1.1; }
.ex-kpi b { display: block; font-size: 18px; }
.ex-kpi span { font-size: 12px; color: var(--muted); }
.ex-kpi.is-record b, .ex-kpi.is-record span { color: var(--accent); }
.spark { display: block; overflow: visible; }
.spark path { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--accent); }
.last-time { margin: var(--s2) var(--s1) 0 0; font-size: 14px; color: var(--muted); }
.last-time span { color: var(--ink); font-weight: 550; margin-right: var(--s1); }
.skipped-note { margin: var(--s3) var(--s1); color: var(--muted); }
.exercise.skipped .ex-head h3 { color: var(--muted); text-decoration: line-through; }

.sets { margin-top: var(--s3); }
.set { display: grid; align-items: center; gap: var(--s2); padding: 6px 0; border-top: 1px solid var(--line); }
.set-weight { grid-template-columns: minmax(0, 1fr) 52px var(--check); }
.set-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) var(--check); }
.set-rounds { grid-template-columns: minmax(0, 1fr) auto; }
.set-reps { grid-template-columns: minmax(0, 1fr) var(--check); }
.stepper { display: flex; align-items: center; gap: var(--s1); min-width: 0; }
.step {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); flex: none; padding: 0;
  border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface-2); color: var(--ink);
}
.step:active { background: var(--line); }
.value { position: relative; display: block; flex: 1; min-width: 0; }
.num-input, .value select {
  width: 100%; height: var(--tap); padding: 10px 4px 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); text-align: center; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 650;
}
.value select { appearance: none; padding: 10px 4px 0 22px; text-align: left; font-family: var(--font); font-size: 16px; }
.num-input.long { font-size: 15px; letter-spacing: -0.02em; }
.value .unit, .value .total {
  position: absolute; left: 0; right: 0; top: 3px; text-align: center; font-size: 11px; line-height: 1; color: var(--muted); pointer-events: none;
}
.value .total { color: var(--accent); font-weight: 600; }
.value.band .unit { left: 22px; text-align: left; }
.swatch { position: absolute; left: 8px; top: 50%; width: 10px; height: 10px; margin-top: 2px; border-radius: 50%; background: var(--line); pointer-events: none; }
[data-band="geel"] .swatch { background: #e8c547; } [data-band="rood"] .swatch { background: #c8412e; }
[data-band="groen"] .swatch { background: #4f9a5a; } [data-band="blauw"] .swatch { background: #3a6fc4; }
[data-band="paars"] .swatch { background: #7a4fb0; } [data-band="zwart"] .swatch { background: #222; }
.set.done .num-input, .set.done select { border-color: transparent; background: transparent; }

.check {
  position: relative; display: grid; place-items: center; width: var(--check); height: var(--check); padding: 0;
  border: 2px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface);
  color: var(--muted); font-family: var(--font-num); font-size: 18px; font-weight: 650;
}
.check.wide { width: auto; min-width: 112px; padding: 0 var(--s4); grid-auto-flow: column; gap: var(--s2); font-family: var(--font); font-size: 16px; }
.check .check-mark { display: none; width: 28px; height: 28px; stroke-width: 2.6; }
.check[aria-pressed="true"] { background: var(--done); border-color: var(--done); color: var(--on-done); }
.check[aria-pressed="true"]:not(.wide) .n { display: none; }
.check[aria-pressed="true"] .check-mark { display: block; }
.check.wide[aria-pressed="true"] .check-mark { width: 22px; height: 22px; }

.ex-actions { display: flex; align-items: center; gap: var(--s1); border-top: 1px dotted var(--line-strong); }
.ex-actions .link:first-child { padding-left: 0; }
.ex-actions .quiet { margin-left: auto; }

/* + oefening */
.add-ex { margin: var(--s4) 0; border: 1px dashed var(--ink); }
.add-ex > summary { display: flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 56px; font-weight: 650; }
.add-ex[open] { padding: 0 var(--s4) var(--s3); }
.add-ex[open] > summary { justify-content: flex-start; }
.add-ex .row { flex-direction: column; align-items: flex-start; gap: 0; }

/* afsluiten */
.finish { margin-top: var(--s5); padding: var(--s3) 0; border-top: 2px solid var(--ink); }
.finish .part-title { border: 0; }
.field-label { display: block; margin: var(--s3) 0 var(--s2); font-size: 14px; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.segmented button {
  min-height: var(--tap); border: 1px solid var(--line-strong); border-radius: var(--radius-btn); background: var(--surface); text-transform: capitalize;
}
.segmented button[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); font-weight: 650; }
textarea, input[type="date"] {
  display: block; width: 100%; margin-top: var(--s2); padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--ink); resize: vertical; font-size: 16px;
}
input[type="date"] { min-height: var(--tap); }
.finish .btn { margin-top: var(--s4); min-height: 56px; font-size: 17px; }

/* ---------- rusttimer en recordmelding ---------- */
.rest {
  position: fixed; left: var(--s3); right: var(--s3); bottom: calc(var(--tabbar-h) + var(--s2) + env(safe-area-inset-bottom)); z-index: 11;
  display: flex; align-items: center; gap: var(--s3); height: 60px; padding: 0 6px 0 var(--s4); overflow: hidden;
  max-width: 536px; margin: 0 auto; border-radius: var(--radius); background: var(--ink); color: var(--bg);
}
.rest-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 35%, var(--ink)); transition: width .25s linear; }
.rest.ready .rest-fill { background: color-mix(in srgb, var(--accent) 70%, var(--ink)); }
.rest-text { position: relative; flex: 1; font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 650; font-size: 17px; }
.rest-stop { position: relative; min-height: var(--tap); padding: 0 var(--s4); border: 0; border-radius: var(--radius-btn); background: var(--bg); color: var(--ink); font-weight: 600; }
.record-toast {
  position: fixed; left: var(--s3); right: var(--s3); top: calc(var(--s3) + env(safe-area-inset-top)); z-index: 20; max-width: 536px; margin: 0 auto;
  padding: var(--s4); border-radius: var(--radius); background: var(--accent); color: var(--on-accent); box-shadow: 0 10px 30px rgb(0 0 0 / .25);
}
.toast-title { font-size: 14px; opacity: .8; margin-bottom: var(--s1); }
.toast-line { font-size: 18px; margin-top: 2px; }
.toast-line span { opacity: .75; font-size: 14px; }
.record-toast .btn { margin-top: var(--s3); width: 100%; background: transparent; color: inherit; border-color: currentColor; }

.dialog { width: min(92vw, 420px); padding: var(--s5) var(--s4) var(--s4); border: 0; border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog h2 { font-size: 20px; margin-bottom: var(--s2); }
.dialog p { color: var(--muted); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }

/* ---------- Geschiedenis ---------- */
.summary { margin-bottom: var(--s2); }
.summary .kpis { border-bottom: 1px solid var(--line); padding-bottom: var(--s3); }
.summary .kpi b { font-size: 26px; }
.add-session .inline-form { display: grid; gap: var(--s2); padding-bottom: var(--s4); }
.add-session .field-label { margin-top: 0; }
.sessions { margin-top: var(--s4); }
.sessions .thead, .trow { display: grid; grid-template-columns: 86px 40px minmax(0, 1fr) 28px 66px; gap: 6px; align-items: center; }
.sessions .thead { font-size: 12px; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--ink); }
.trow { min-height: 48px; font-size: 14px; }
.trow .t-date { font-weight: 650; white-space: nowrap; }
.sess { border-bottom: 1px solid var(--line); }
.sess details[open] .trow { color: var(--accent); }
.status-planned .trow { color: var(--muted); }
.status-missed .t-date { text-decoration: line-through; color: var(--muted); }
.sw { display: inline-flex; align-items: center; gap: 6px; }
.sw-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--sw-none); flex: none; }
.sw-dot.sw-klein, .chart .sw-klein { background: var(--sw-klein); fill: var(--sw-klein); }
.sw-dot.sw-middel, .chart .sw-middel { background: var(--sw-middel); fill: var(--sw-middel); }
.sw-dot.sw-groot, .chart .sw-groot { background: var(--sw-groot); fill: var(--sw-groot); }
.chart .sw-none { fill: var(--sw-none); }
.ex-lines { list-style: none; margin: 0; padding: 0; }
.ex-lines a { display: flex; gap: var(--s3); justify-content: space-between; min-height: 40px; align-items: center; text-decoration: none; }
.ex-lines .ex-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-lines .ex-sets { flex: none; color: var(--muted); }
.sess .ex-lines { padding: 0 0 6px; font-size: 13px; }
.sess .ex-lines a { min-height: 32px; }
.note { margin: 0 0 var(--s2); font-size: 14px; color: var(--muted); font-style: italic; }
.who { margin: var(--s1) 0 var(--s1); font-size: 14px; color: var(--muted); }
.sess-actions { display: grid; gap: var(--s2); padding: var(--s3) 0 var(--s4); }
.sess-actions .field-label { margin: 0; }
.duration { display: flex; align-items: center; gap: var(--s2); }
.duration span { flex: 1; color: var(--muted); font-size: 14px; }
.duration b { min-width: 56px; text-align: center; font-size: 17px; }
.row-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--s2); }

/* ---------- Oefeningen ---------- */
.ex-group { margin-bottom: var(--s4); }
.ex-list { list-style: none; margin: 0; padding: 0; }
.ex-row {
  display: flex; align-items: center; gap: 10px; min-height: 56px; padding: var(--s2) 0;
  border-bottom: 1px solid var(--line); text-decoration: none;
}
.ex-row > .icon { color: var(--muted); width: 18px; height: 18px; margin-right: -4px; }
.ex-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ex-row .ex-name { font-weight: 600; }
.ex-note { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-last, .ex-rec { display: flex; flex-direction: column; align-items: flex-end; text-align: right; line-height: 1.15; flex: none; }
.ex-last { min-width: 44px; }
.ex-rec { min-width: 40px; }
.ex-last b, .ex-rec b { font-size: 16px; }
.ex-last small, .ex-rec small { font-size: 12px; color: var(--muted); }
.ex-spark { flex: none; width: 56px; }

/* ---------- Oefening-detail ---------- */
.doll {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: min(52vh, 320px); margin: 0 auto var(--s4);
  border: 1px solid var(--line-strong); overflow: hidden; touch-action: pan-y;
  background: linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 20px 20px, linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 20px 20px, var(--surface);
}
/* Opzij slepen draait de pop; verticaal vegen blijft de pagina scrollen. */
.doll-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; }
.doll-canvas:active { cursor: grabbing; }
.doll-empty {
  position: absolute; inset: auto var(--s4) var(--s4); text-align: center; color: var(--muted); font-size: 13px;
}
.ex-facts { display: grid; gap: var(--s2); margin: 0; }
.ex-facts div { display: flex; gap: var(--s3); align-items: baseline; }
.ex-facts dt { width: 72px; flex: none; color: var(--muted); font-size: 14px; }
.ex-facts dd { margin: 0; font-weight: 600; }
.figures {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3) var(--s2);
  padding: var(--s3) 0; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink);
}
.figures.n1 { grid-template-columns: 1fr; }
.figures.n2, .figures.n4 { grid-template-columns: repeat(2, 1fr); }
.figure b { display: block; font-size: 22px; line-height: 1.1; font-weight: 650; }
.figure b small { font-size: .5em; font-weight: 500; margin-left: 3px; color: var(--muted); }
.figure span { font-size: 13px; color: var(--muted); }
.cues { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.cue { display: grid; grid-template-columns: auto 1fr; gap: var(--s1) var(--s3); align-items: start; }
.cue textarea { grid-column: 2; grid-row: 1 / span 2; margin: 0; min-height: 56px; resize: none; font-size: 16px; line-height: 1.35; }
.cue-check { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; width: 64px; cursor: pointer; }
.cue-check input { position: absolute; opacity: 0; width: 48px; height: 48px; margin: 0; }
.cue-check .box {
  display: grid; place-items: center; width: var(--tap); height: var(--tap); border: 2px solid var(--line-strong); border-radius: var(--radius-btn); color: transparent;
}
.cue-check input:checked + .box { background: var(--done); border-color: var(--done); color: var(--on-done); }
.cue-check input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.cue-check .box .check-mark { display: block; width: 26px; height: 26px; }
.cue-state { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.2; }
.cue.checked .cue-state { color: var(--ink); }
.table-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 0 var(--pad); }
.sets-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sets-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 6px 6px 0; border-bottom: 1px solid var(--line-strong); }
.sets-table td { padding: 8px 6px 8px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sets-table .num { text-align: right; }
.sets-table td small { color: var(--muted); margin-left: 1px; }

/* ---------- Instellingen ---------- */
.version { margin: var(--s6) 0 var(--s4); font-size: 13px; color: var(--muted); text-align: center; }

/* ---------- grafieken (ui/charts.js) ---------- */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--muted); }
.chart .val { fill: var(--ink); font-weight: 600; font-family: var(--font-num); }
.chart .val.big { font-size: 13px; fill: var(--accent); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .track { fill: var(--surface-2); }
.chart .bar { fill: var(--ink); opacity: .7; }
.chart .bar.now { fill: var(--accent); opacity: 1; }
.chart .line { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.chart .dot { fill: var(--bg); stroke: var(--ink); stroke-width: 1.8; }
.chart .block-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.chart .block-label { fill: var(--muted); font-size: 10px; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }

/* ---------- Data ---------- */
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s2); font-size: 13px; color: var(--muted); line-height: 1.4; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend svg line { stroke-width: 2.5; }
.legend .k-primary line { stroke: var(--ink); }
.legend .k-secondary line, .chart .series.k-secondary .line { stroke: var(--muted); stroke-dasharray: 4 3; stroke-width: 2; }
.chart .series.k-secondary .dot { stroke: var(--muted); stroke-width: 2; }
.key-bar { display: inline-block; width: 6px; height: 14px; border-radius: 1.5px; background: var(--ink); opacity: .7; }
.key-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.key-dot.open { background: none; border: 1.5px solid var(--ink); }
.sw-key { flex-wrap: wrap; }
.sw-key .sw-dot { margin-left: 2px; }
.spark path.second { stroke: var(--muted); stroke-dasharray: 3 2; stroke-width: 1.2; }
.records .row > span:first-child { display: flex; flex-direction: column; }
.records .row small { font-size: 13px; }
.records .row b { font-size: 18px; }
.records .row b small { font-size: 12px; color: var(--muted); font-weight: 500; }
.chart .bee { fill: var(--ink); }
.chart .bee.open { fill: none; stroke: var(--ink); stroke-width: 1.2; }
.chart .lane { fill: var(--ink); font-weight: 600; }
.chart .seg-0 { fill: var(--line-strong); }
.chart .seg-1 { fill: var(--muted); }
.chart .m-injury, .chart .m-surgery, .chart .m-today { stroke: var(--ink); }
.chart text.m-injury, .chart text.m-surgery, .chart text.m-today { stroke: none; fill: var(--ink); font-weight: 600; }
.chart text.m-today { fill: var(--accent); }
.chart line.m-today { stroke: var(--accent); stroke-width: 2; }

/* swarm (ui/swarm.js) */
.swarm-wrap { margin: 0 -8px; }
.swarm { display: block; width: 100%; height: auto; user-select: none; -webkit-user-select: none; }
.swarm-ring { fill: none; stroke: var(--line-strong); stroke-dasharray: 3 5; }
.swarm-labels { pointer-events: none; }
.swarm-labels text { fill: var(--ink); font-size: 12px; font-weight: 650; paint-order: stroke; stroke: var(--bg); stroke-width: 4px; stroke-linejoin: round; }
.swarm-labels text.sub { fill: var(--muted); font-size: 11px; font-weight: 500; }
.swarm .node { cursor: grab; touch-action: none; outline: none; }
.swarm .node.dragging { cursor: grabbing; }
.node-hit { fill: transparent; }
.node-body { fill: var(--surface); stroke: var(--ink); stroke-width: 1.5; }
.node.unused .node-body { fill: var(--surface-2); stroke: var(--line-strong); stroke-dasharray: 3 3; }
.node.glowing .node-body { stroke: var(--accent); stroke-width: 2.5; }
.node-glow { fill: var(--accent); opacity: .35; }
.node text { fill: var(--ink); font-size: 11px; font-weight: 600; pointer-events: none; }
.node text.outside { fill: var(--muted); font-size: 11px; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; }
.node:focus-visible .node-body { stroke: var(--accent); stroke-width: 3; }
.swarm-legend { display: block; text-align: center; }
.glow-key { display: inline-flex; align-items: center; gap: 4px; margin-left: var(--s2); }
.glow-key i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); }
.group-head, .group-table .ex-row.group-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px 60px 60px 12px; gap: 8px; align-items: center; }
.group-head { font-size: 12px; color: var(--muted); padding-bottom: 4px; border-bottom: 1px solid var(--ink); }
.group-head span:nth-child(n+3) { text-align: right; }
.group-head::after { content: ""; }
.group-table .ex-row.group-row > .icon { margin: 0; width: 12px; }
.group-row .ex-last b, .group-row .ex-rec b { letter-spacing: -0.01em; }
.group-row .ex-name { line-height: 1.25; }
.chart .seg-label { fill: var(--ink); font-size: 10px; font-weight: 600; pointer-events: none; }
.chart .block-label { fill: var(--muted); font-size: 10px; }

/* ==================== Instellingen (issue #14): back-up, blokken, oefening aanmaken ==================== */
.storage { margin-top: var(--s2); }
.link.inline { display: inline; min-height: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: inherit; text-align: left; }
.storage .link.inline { display: inline-flex; align-items: center; min-height: 44px; }
.row small { display: block; font-size: 14px; }
.tag {
  display: inline-block; margin-left: var(--s2); padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--muted); font-family: var(--font); font-size: 12px; font-weight: 600; vertical-align: 2px; line-height: 1.4;
}
.tag.now { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.block-row.is-current { box-shadow: inset 3px 0 0 var(--accent); padding-left: var(--s3); }
.new-block { margin-top: var(--s4); }
.new-block .field-label { margin-top: 0; }
.inline-pair { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s2); align-items: center; }
.inline-pair input[type="date"] { margin-top: 0; }

/* blok: sets en rust */
.block-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.block-field { display: grid; gap: var(--s1); min-width: 0; font-size: 13px; color: var(--muted); }
.block-field .pair { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 6px; align-items: center; }
.block-field .pair b { color: var(--muted); font-weight: 500; }
.block-field .num-input { padding-top: 0; color: var(--ink); }

/* blok: dagindeling */
.plan { margin-top: var(--s3); border-top: 1px solid var(--line-strong); }
.plan-day { border-bottom: 1px solid var(--line); }
.plan-day > summary { display: flex; align-items: center; gap: var(--s3); min-height: 56px; }
.pd-name { flex: 1; min-width: 0; font-weight: 600; }
.pd-meta { color: var(--muted); font-size: 14px; }
.plan-day.is-own .pd-meta { color: var(--ink); font-weight: 600; }
.pd-body { padding: 0 0 var(--s4); }
.pd-body > .hint:first-child { margin-top: 0; margin-bottom: var(--s2); }
.pd-body > .btn { margin-top: var(--s3); }
.plan-list { list-style: none; margin: 0; padding: 0; }
.plan-item { display: flex; align-items: center; gap: var(--s1); min-height: 52px; border-top: 1px solid var(--line); }
.plan-n { width: 24px; flex: none; color: var(--muted); font-size: 14px; }
.plan-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.plan-name small { color: var(--muted); font-size: 12px; }
.plan-list.is-readonly .plan-item { min-height: 40px; color: var(--muted); }
.plan-btn {
  display: grid; place-items: center; width: 44px; height: 44px; flex: none; padding: 0;
  border: 0; border-radius: var(--radius-btn); background: none; color: var(--ink);
}
.plan-btn .icon { width: 20px; height: 20px; }
.plan-btn:active { background: var(--surface-2); }
.plan-btn:disabled { opacity: .25; }
.plan-btn[data-act="remove"] { color: var(--muted); }
.plan-add { margin: var(--s3) 0 0; }
.plan-add .group-title:first-of-type { margin-top: 0; }
.add-ex .pick-row { flex-direction: row; align-items: center; gap: var(--s3); min-height: 48px; }
.pick-row .icon { color: var(--accent); }
.btn.danger-quiet { border-color: var(--warn); color: var(--warn); background: none; }

/* oefening aanmaken */
.ex-form { padding-bottom: var(--s4); }
.ex-form > .field-label:first-child { margin-top: 0; }
.ex-form .field-label { margin-top: var(--s4); }
.text-input {
  display: block; width: 100%; min-height: var(--tap); padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font-size: 16px;
}
select.text-input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.field-error { margin-top: var(--s1); color: var(--warn); font-size: 14px; }
.field-set { margin: var(--s5) 0 0; padding: 0; border: 0; min-width: 0; }
.ex-form .field-set legend.field-label { float: left; width: 100%; margin: 0 0 var(--s2); padding: 0; }
.field-set legend + * { clear: both; }
.field-set > .text-input + .list-choices, .field-set > .hint.first + .list-choices { margin-top: var(--s2); }
.hint.first { margin-top: 0; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.chip-check span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s3); border: 1px solid var(--line-strong);
  border-radius: var(--radius-btn); background: var(--surface); font-size: 15px;
}
.chip-check input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.chip-check input:disabled + span { opacity: .35; }
.chip-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.check-row { display: flex; align-items: center; gap: var(--s3); min-height: 52px; border-bottom: 1px solid var(--line); cursor: pointer; }
.check-row input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--primary); }
.check-row span { display: flex; flex-direction: column; line-height: 1.3; }
.check-row small { color: var(--muted); font-size: 13px; }
.ex-form > .btn { margin-top: var(--s5); min-height: 56px; font-size: 17px; }
/* ==================== einde Instellingen ==================== */
.therapists .field-label { margin: 0 0 var(--s3); }
.therapists .text-input { margin-top: var(--s1); }
