:root {
  --paper: #faf9f6;
  --paper-alt: #f1efe8;
  --paper-muted: #e8e6dd;
  --ink: #23282b;
  --ink-soft: #6f736b;
  --line: #ddd9cd;
  --accent: #c2531d;
  --accent-dark: #9c3f12;
  --accent-soft: rgba(194, 83, 29, 0.12);
  --second: #2b6e63;
  --second-soft: rgba(43, 110, 99, 0.12);
  --ochre: #a9713a;
  --ochre-bg: #f2e6d5;
  --brick: #b3261e;
  --brick-bg: #f7dfdc;
  --surface: #ffffff;
  --on-accent: #ffffff;
  --backdrop: rgba(35, 40, 43, 0.35);
  --shadow: 0 10px 30px rgba(35, 40, 43, 0.12);
  --grid: #ebe8df;
  --font-serif: "Source Serif 4", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #151819;
  --paper-alt: #1d2122;
  --paper-muted: #272c2d;
  --ink: #e6e4de;
  --ink-soft: #9a9e96;
  --line: #333839;
  --accent: #f08a4b;
  --accent-dark: #f6a676;
  --accent-soft: rgba(240, 138, 75, 0.16);
  --second: #4fa894;
  --second-soft: rgba(79, 168, 148, 0.16);
  --ochre: #dba56b;
  --ochre-bg: #3a2f22;
  --brick: #e5675c;
  --brick-bg: #3d2220;
  --surface: #1e2223;
  --on-accent: #1d130c;
  --backdrop: rgba(0, 0, 0, 0.6);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  --grid: #2a2f30;
  color-scheme: dark;
}

/* Grijs: rustiger dan licht, minder zwart dan donker. */
:root[data-theme="gray"] {
  --paper: #383b3e;
  --paper-alt: #414548;
  --paper-muted: #4d5155;
  --ink: #efede8;
  --ink-soft: #bcbfb9;
  --line: #585d62;
  --accent: #f39a63;
  --accent-dark: #f7b48b;
  --accent-soft: rgba(243, 154, 99, 0.18);
  --second: #72c4b0;
  --second-soft: rgba(114, 196, 176, 0.18);
  --ochre: #e4b37e;
  --ochre-bg: #4b4135;
  --brick: #f2877c;
  --brick-bg: #523633;
  --surface: #44484c;
  --on-accent: #1d130c;
  --backdrop: rgba(0, 0, 0, 0.5);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --grid: #4f5458;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

svg { stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; margin: 0; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }

a { color: var(--accent); }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--accent); }
.neg { color: var(--ink); }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

/* --- Pagina en navigatie --- */

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 18px 10px 0;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand img { display: block; border-radius: 8px; }
.brand-name { font-family: var(--font-serif); font-size: 19px; font-weight: 600; white-space: nowrap; }

.tab-list { display: flex; gap: 22px; }

.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 0 12px;
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab svg { width: 17px; height: 17px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  margin-bottom: 8px;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover, .icon-btn.active { color: var(--accent); border-color: var(--accent); }
.settings-toggle { margin-left: auto; }
/* De knop toont de volgende stand: licht -> grijs -> donker -> licht. */
#themeToggle svg { display: none; }
:root:not([data-theme="gray"]):not([data-theme="dark"]) #themeToggle .icon-gray,
:root[data-theme="gray"] #themeToggle .icon-moon,
:root[data-theme="dark"] #themeToggle .icon-sun { display: block; }

@media (max-width: 720px) {
  .page { padding: 16px 16px calc(92px + env(safe-area-inset-bottom, 0px)); }
  .tabs { margin-bottom: 18px; }
  .tab-list {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 20;
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 4px 4px env(safe-area-inset-bottom, 0px);
  }
  .tab {
    flex: 1;
    flex-direction: column;
    gap: 2px;
    padding: 8px 0 8px;
    font-size: 11px;
    border-bottom: none;
    margin: 0;
  }
  .tab svg { width: 21px; height: 21px; }
}

/* --- Bouwstenen --- */

.view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.view-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.card + .card, .card + .grid, .grid + .card, .grid + .grid { margin-top: 16px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { font-size: 16px; }

.grid { display: grid; gap: 16px; }
.grid > .card { margin-top: 0; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .grid.three { grid-template-columns: 1fr 1fr 1fr; gap: 8px; } }

.stat { padding: 14px 16px; }
.stat .label { font-size: 13px; color: var(--ink-soft); }
.stat .value { font-family: var(--font-serif); font-size: 22px; font-weight: 600; margin-top: 2px; }
@media (max-width: 720px) {
  .stat { padding: 10px 12px; }
  .stat .value { font-size: 17px; }
  .stat .label { font-size: 12px; }
}

.hero .label { color: var(--ink-soft); font-size: 14px; }
.hero .value {
  font-family: var(--font-serif);
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 600;
  line-height: 1.1;
  margin: 4px 0 6px;
  letter-spacing: -0.01em;
}
.delta { font-size: 14px; color: var(--ink-soft); }
.delta strong { color: var(--ink); font-weight: 600; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  min-height: 40px;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: var(--on-accent); }
:root[data-theme="dark"] .btn.primary:hover, :root[data-theme="gray"] .btn.primary:hover { background: #e0763a; border-color: #e0763a; }
.btn.danger { color: var(--brick); }
.btn.danger:hover { border-color: var(--brick); }
.btn.link { border: none; background: none; color: var(--ink-soft); padding: 6px; min-height: 0; }
.btn.link:hover { color: var(--accent); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: default; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-soft); }
form > * + label, label + label, label + .row, .row + label, .row + .row, .field + .field { margin-top: 12px; }

input, select, textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  font: inherit;
  font-size: 16px; /* voorkomt inzoomen op iPhone */
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  min-height: 42px;
}
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[type="file"] { padding: 8px; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row > label { margin-top: 0; }
@media (max-width: 480px) { .row.stack { grid-template-columns: 1fr; } }

.segmented { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 5px; }
.segmented label {
  flex: 1;
  margin: 0;
  text-align: center;
  padding: 9px 6px;
  cursor: pointer;
  color: var(--ink);
  font-size: 14px;
  background: var(--surface);
}
.segmented label + label { border-left: 1px solid var(--line); margin: 0; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; width: 1px; min-height: 0; }
.segmented label:has(input:checked) { background: var(--accent); color: var(--on-accent); }

.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.form-error { color: var(--brick); font-size: 14px; margin: 12px 0 0; }
.hint { color: var(--ink-soft); font-size: 14px; margin: 0 0 14px; }

/* --- Inlogscherm --- */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand img { border-radius: 10px; }
.auth-brand h1 { font-size: 26px; }
.auth-step .btn.primary { margin-top: 18px; }
.auth-step .btn.link { display: block; margin: 10px auto 0; }
.code-input { font-size: 24px; letter-spacing: 0.3em; text-align: center; font-variant-numeric: tabular-nums; }
.steps { padding-left: 20px; margin: 0 0 12px; font-size: 14px; }
.steps li + li { margin-top: 6px; }
.qr { display: block; margin: 6px auto 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.secret { font-size: 13px; margin-bottom: 12px; color: var(--ink-soft); }
.secret summary { cursor: pointer; }
.secret code { display: block; font-size: 15px; padding: 8px; background: var(--paper-alt); border-radius: 8px; word-break: break-all; color: var(--ink); }

/* --- Lijsten --- */

.list { list-style: none; margin: 0; padding: 0; }
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.list-row:first-child { border-top: none; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 13px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .amount { font-weight: 500; text-align: right; }
.list-row.clickable { cursor: pointer; }
.list-row.clickable:hover .title { color: var(--accent); }

.group-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 18px 0 2px;
}
.group-title:first-child { margin-top: 0; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--paper-alt);
  color: var(--ink-soft);
  white-space: nowrap;
}
.badge.warn { background: var(--ochre-bg); color: var(--ochre); }
.badge.bad { background: var(--brick-bg); color: var(--brick); }

.kind-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; background: var(--ink-soft); }

.empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 28px 12px;
}
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.onboarding { list-style: none; padding: 0; margin: 14px 0 0; counter-reset: step; }
.onboarding li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); text-align: left; }
.onboarding li:first-child { border-top: none; }
.onboarding .n {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px;
}
.onboarding li.done .n { background: var(--accent); color: var(--on-accent); }
.onboarding .main { flex: 1; color: var(--ink); }

/* --- Grafieken --- */

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--ink-soft); stroke: none; font-size: 11px; font-family: var(--font-sans); }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .zero-line { stroke: var(--line); stroke-width: 1; }
.chart .line { stroke: var(--accent); stroke-width: 2; }
.chart .area { fill: var(--accent); opacity: 0.1; stroke: none; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .hit { fill: transparent; stroke: none; cursor: crosshair; }

.legend { display: flex; gap: 14px; font-size: 13px; color: var(--ink-soft); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.chart-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
}
.chart-tip strong { display: block; font-weight: 600; }

/* --- Modal en melding --- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow: auto;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 0;
  position: sticky;
  top: 0;
  background: var(--surface);
}
.modal-head .icon-btn { margin: 0; }
.modal-body { padding: 14px 20px 20px; }
@media (max-width: 720px) {
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 70;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  font-size: 14px;
  max-width: calc(100vw - 32px);
}
@media (max-width: 720px) { .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } }

.table-wrap { overflow-x: auto; }

.settings-section + .settings-section { margin-top: 16px; }
.temp-pass { font-family: ui-monospace, monospace; font-size: 20px; padding: 10px; background: var(--paper-alt); border-radius: 8px; text-align: center; color: var(--ink); user-select: all; }

/* --- Uitleg bij begrippen --- */

.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  min-height: 0;
  padding: 0;
  margin: 0 0 0 4px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font: 600 11px/1 var(--font-sans);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
}
.info::after { content: ""; position: absolute; inset: -10px; } /* groter raakvlak op de telefoon */
.info:hover, .info[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }

.explain {
  position: absolute;
  z-index: 80;
  width: min(300px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.explain strong { display: block; font-family: var(--font-serif); font-size: 15px; margin-bottom: 3px; }

.glossary dt { font-weight: 600; margin-top: 12px; }
.glossary dt:first-child { margin-top: 0; }
.glossary dd { margin: 2px 0 0; color: var(--ink-soft); font-size: 14px; }
.small-link { font-size: 13px; padding: 0 0 0 4px; color: var(--accent); text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 4px 0 14px; color: var(--ink); font-weight: 400; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; flex-shrink: 0; accent-color: var(--accent); }

/* --- Dashboard --- */

.dash-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.dash-col { display: grid; gap: 16px; }
.dash-col > .card { margin-top: 0; }
@media (max-width: 860px) { .dash-grid { grid-template-columns: 1fr; } }
.big-num { font-weight: 600; font-size: 17px; }
.badge.good { background: var(--accent-soft); color: var(--accent); }
.todo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ink-soft); flex-shrink: 0; }
.todo-dot.warn { background: var(--ochre); }
.todo-dot.bad { background: var(--brick); }
.chev { color: var(--ink-soft); font-size: 20px; line-height: 1; }
.list-row.clickable:hover .main { color: var(--accent); }
.all-good { margin: 0; color: var(--accent); font-weight: 500; }

@media (max-width: 720px) {
  .tab span { font-size: 10.5px; }
}

.head-actions { display: flex; align-items: center; gap: 12px; }

.view-title { margin-bottom: 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 26px 2px 10px; }
.section-head h3 { font-size: 18px; }
.section-sub { margin: -4px 2px 10px; }

/* ===================== Mijn sport ===================== */

.kind-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 600; }
.spacer { flex: 1; }
.chart .dot-soft { fill: var(--ink-soft); opacity: 0.45; stroke: none; }
.chart .dot-small { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.tip-soft { font-weight: 400; opacity: 0.75; }
.list-row .sub.wrap { white-space: normal; }
.back { display: inline-block; margin-bottom: 10px; text-decoration: none; font-size: 14px; }
.notes { background: var(--paper-alt); border-radius: 10px; padding: 10px 12px; margin: -6px 0 16px; }
details.more { margin-top: 12px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; }

/* Voortgangsbalken (doelen, weekdoel) */
.bar { height: 8px; border-radius: 4px; background: var(--paper-muted); margin-top: 7px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.bar.done > span { background: var(--second); }
.goal-row { padding: 10px 0; border-top: 1px solid var(--line); }
.goal-row:first-child { border-top: none; padding-top: 0; }
.goal-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.goal-row .name { font-weight: 500; }
.goal-row .sub { margin-top: 4px; }
.badge.good { background: var(--second-soft); color: var(--second); }

/* Overzicht */
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.value-unit { font-family: var(--font-sans); font-size: 16px; font-weight: 500; color: var(--ink-soft); }
.hero .bar { height: 10px; margin-top: 14px; }
.hero-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 16px; }
.week-dots { display: flex; gap: 6px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wd i { width: 26px; height: 26px; border-radius: 50%; background: var(--paper-muted); display: block; }
.wd.on i { background: var(--accent); }
.wd.today i { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink-soft); }
.wd small { font-size: 11px; color: var(--ink-soft); }
@media (max-width: 420px) { .wd i { width: 22px; height: 22px; } .week-dots { gap: 4px; } }
.kind-dot.strength { background: var(--accent); }
.kind-dot.cardio { background: var(--second); }
.medal { color: var(--ochre); font-size: 17px; width: 18px; text-align: center; }
.running-banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px;
  border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent); color: var(--ink); text-decoration: none;
}
.running-banner span:nth-child(2) { flex: 1; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; flex-shrink: 0; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* Training starten */
.start-main {
  display: grid; gap: 4px; width: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--accent-soft); border: 1px solid transparent; border-radius: 12px; padding: 16px;
}
.start-main strong { font-family: var(--font-serif); font-size: 22px; }
.start-main .btn { justify-self: start; margin-top: 8px; min-width: 120px; }
.start-main:hover { border-color: var(--accent); }
.start-more { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.start-card .hint { margin-bottom: 0; }

/* Een training */
.ex-card { padding: 16px; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ex-tools { display: flex; align-items: center; gap: 6px; }
.ex-tools .icon-btn { margin: 0; }
.link-title { all: unset; cursor: pointer; font-family: var(--font-serif); font-weight: 600; }
.link-title:hover { color: var(--accent); }
.link-title:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.chip {
  font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper-alt); color: var(--ink-soft); cursor: pointer; min-height: 32px; white-space: nowrap;
}
.chip:hover { color: var(--accent); border-color: var(--accent); }
.prev { margin: 10px 0 0; }
.hint-box { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--second-soft); color: var(--ink); }
.set-list { list-style: none; padding: 0; margin: 12px 0 0; }
.set-list li { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.set-n {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px;
}
.set-list .set-n { background: var(--accent); color: var(--on-accent); }
.set-val { all: unset; cursor: pointer; font-variant-numeric: tabular-nums; font-weight: 500; padding: 4px 6px; border-radius: 6px; }
.set-val:hover, .set-val:focus-visible { background: var(--paper-alt); }
.set-form { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.set-field { position: relative; flex: 1; margin: 0; min-width: 0; }
.set-field input {
  margin: 0; padding-right: 44px; text-align: right; font-size: 20px; font-weight: 600; min-height: 50px;
  font-variant-numeric: tabular-nums;
}
.set-field input.suggested { color: var(--ink-soft); font-weight: 500; }
.set-field .unit { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--ink-soft); pointer-events: none; }
.times { color: var(--ink-soft); }
.set-ok { width: 54px; min-height: 50px; padding: 0; flex-shrink: 0; }
.set-ok svg { width: 24px; height: 24px; stroke-width: 2.6; }
.set-ok.quiet { background: var(--surface); color: var(--accent); }
.add-ex { margin-top: 16px; border-style: dashed; }
.workout-end { display: grid; gap: 6px; margin-top: 24px; }
.workout-end .btn.link { justify-self: center; }
.btn.link.danger { color: var(--brick); }

/* Oefening kiezen */
.picker-search { margin: 0 0 8px; position: sticky; top: 0; z-index: 1; }
.picker-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left;
  font: inherit; color: var(--ink); background: none; border: none; border-top: 1px solid var(--line); padding: 12px 2px; cursor: pointer;
}
.picker-item:hover { color: var(--accent); }
.picker-group .group-title { margin-top: 14px; }

/* Rusttimer: vast onderin, boven de tabbalk */
.rest-timer {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 30; width: min(520px, calc(100vw - 24px)); background: var(--ink); color: var(--paper);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.rest-bar { height: 4px; background: rgba(255, 255, 255, 0.15); }
:root[data-theme="dark"] .rest-bar, :root[data-theme="gray"] .rest-bar { background: rgba(0, 0, 0, 0.2); }
.rest-bar span { display: block; height: 100%; background: var(--accent); transition: width 0.25s linear; }
.rest-body { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.rest-label { flex: 1; font-size: 13px; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest-time { font-family: var(--font-serif); font-size: 26px; font-weight: 600; min-width: 64px; text-align: right; }
.rest-body .btn { background: transparent; color: var(--paper); border-color: rgba(255, 255, 255, 0.3); min-height: 36px; }
:root[data-theme="dark"] .rest-body .btn, :root[data-theme="gray"] .rest-body .btn { border-color: rgba(0, 0, 0, 0.25); }
.rest-timer.over { background: var(--accent); color: var(--on-accent); }
.rest-timer.over .btn { color: var(--on-accent); }
@media (max-width: 720px) {
  .rest-timer { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .rest-label { display: none; }
  .rest-timer.over .rest-label { display: block; }
}

/* Voortgang */
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form label { flex: 1 1 140px; margin: 0; }
.inline-form .btn { flex: 0 0 auto; }

/* Schema's */
.plan-day { padding: 12px 0; border-top: 1px solid var(--line); }
.plan-day:first-of-type { border-top: none; padding-top: 0; }
.plan-day-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.plan-day-head .link-title { font-size: 16px; }
.plan-ex { all: unset; cursor: pointer; flex: 1; min-width: 0; }
.plan-ex:hover .title { color: var(--accent); }
.plan-ex:focus-visible { outline: 2px solid var(--accent); border-radius: 4px; }
.icon-btn.small-icon { width: 30px; height: 30px; margin: 0; }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.add-plan-ex { margin-top: 6px; }
.plan-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 4px; }
.center-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.card.empty p { max-width: 520px; margin-left: auto; margin-right: auto; }

.finish .grid.three { gap: 8px; }

/* Met de rusttimer in beeld extra ruimte onderaan, zodat hij geen knoppen bedekt. */
body.resting .page { padding-bottom: 110px; }
@media (max-width: 720px) { body.resting .page { padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); } }
.chart-slot { width: 100%; }
.en-name { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-soft); }
.ex-search { margin: 0 0 6px; }
.chart-slot .chart { width: 100%; height: auto; }
body.resting .toast { bottom: 100px; }
@media (max-width: 720px) { body.resting .toast { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); } }
