/* Eén kolom, mobiel eerst; navigatie onderin als app, bovenin op brede schermen. */
:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-2: #e9eeeb;
  --ink: #13211d;
  --muted: #5d6c67;
  --line: #d8e0dc;
  --accent: #0e6b5e;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe9;
  --good: #1f8a4c;
  --warn: #b26a00;
  --bad: #c0392b;
  --info: #3b6ea8;
  --lo: #2f9e6b;
  --mid: #d08a12;
  --hi: #d1483a;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --surface: #17211e;
    --surface-2: #1f2c28;
    --ink: #e8efec;
    --muted: #96a8a2;
    --line: #2a3a35;
    --accent: #3fbfa8;
    --accent-ink: #062a24;
    --accent-soft: #173832;
    --good: #4cc27e;
    --warn: #e2a13a;
    --bad: #ef6b5c;
    --info: #7fb0e6;
    --lo: #4cc27e;
    --mid: #e2a13a;
    --hi: #ef6b5c;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }

.shell { max-width: 720px; margin: 0 auto; padding: 0 16px calc(84px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
header.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: calc(16px + env(safe-area-inset-top, 0px)) 0 2px; }
header.top h1 { font-size: 1.25rem; letter-spacing: -0.01em; }
header.top .sync { font-size: 0.8rem; color: var(--muted); text-align: right; }

nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
nav.tabs button { flex: 1; max-width: 180px; background: none; border: 0; padding: 10px 4px 9px; font-size: 0.78rem; color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav.tabs button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav.tabs button[aria-current="page"] { color: var(--accent); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 1rem; }
.eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.num { font-variant-numeric: tabular-nums; }

/* herstel */
.recovery { display: flex; gap: 16px; align-items: center; }
.ring { position: relative; width: 96px; height: 96px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .track { stroke: var(--surface-2); }
.ring .val { stroke-linecap: round; transition: stroke-dashoffset 0.5s; }
.ring .n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.stat span { font-size: 0.72rem; color: var(--muted); }

/* training */
.workout-head h3 { font-size: 1.35rem; letter-spacing: -0.01em; line-height: 1.2; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.pill.laag::before { background: var(--lo); }
.pill.middel::before { background: var(--mid); }
.pill.hoog::before { background: var(--hi); }
.pill.geen::before { background: var(--line); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.steps li i { width: 22px; height: 22px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-style: normal; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center; margin-top: 1px; }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 0.9rem; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.reasons li { display: grid; grid-template-columns: 10px 1fr; gap: 8px; align-items: baseline; }
.reasons li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--info); transform: translateY(-1px); }
.reasons .good::before { background: var(--good); }
.reasons .warn::before { background: var(--warn); }
.reasons .bad::before { background: var(--bad); }
.banner { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 0.9rem; }
.alts { display: flex; flex-direction: column; gap: 6px; }
.alt { display: flex; justify-content: space-between; gap: 10px; text-align: left; background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.alt:hover { border-color: var(--accent); }
.alt small { display: block; color: var(--muted); }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 0.9rem; }
details[open] > summary { margin-bottom: 10px; }

/* grafiek */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 10px; }
.legend { display: flex; gap: 14px; font-size: 0.78rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* week */
.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.day { border-top: 1px solid var(--line); padding: 10px 0; }
.day:first-of-type { border-top: 0; }
.day summary { list-style: none; display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; color: inherit; font-weight: 400; font-size: 1rem; }
.day summary::-webkit-details-marker { display: none; }
.day .dow { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; }
.day .dow small { display: block; font-weight: 400; color: var(--muted); text-transform: none; }
.day.today .dow { color: var(--accent); }
.day.rest .title { color: var(--muted); }
.day .title b { display: block; font-weight: 600; }
.day .title small { color: var(--muted); }
.day .done { color: var(--good); font-size: 0.8rem; font-weight: 600; }
.day[open] summary { margin-bottom: 4px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 0.9rem; min-width: 38px; }
.seg button[aria-pressed="true"] { background: var(--surface); box-shadow: 0 0 0 1px var(--line); font-weight: 600; color: var(--accent); }

/* formulieren */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .lbl { font-size: 0.85rem; font-weight: 600; }
.field .hint { font-size: 0.8rem; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], select {
  width: 100%; min-width: 0; padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
input:focus-visible, select:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 0.9rem; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.chip.ex[aria-pressed="true"] { background: var(--surface-2); border-color: var(--line); color: var(--muted); text-decoration: line-through; font-weight: 400; }
.btn { border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; }
.btn.ghost { background: none; color: var(--accent); }
.btn.danger { background: none; border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.5; cursor: default; }
.savebar { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom, 0px)); display: flex; justify-content: flex-end; }
.savebar .btn { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
td, th { text-align: left; padding: 7px 0; border-top: 1px solid var(--line); }
td:last-child, th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
tr:first-child td { border-top: 0; }
code, pre { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.82rem; }
pre { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; overflow-x: auto; margin: 0; }
.login { max-width: 360px; margin: 14vh auto 0; padding: 0 16px; }
#toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 99px; font-size: 0.9rem; z-index: 10; max-width: 90vw; }

@media (min-width: 760px) {
  .shell { padding-bottom: 40px; }
  nav.tabs { position: sticky; top: 0; bottom: auto; border-top: 0; border-bottom: 1px solid var(--line); }
  nav.tabs button { flex-direction: row; gap: 8px; font-size: 0.9rem; padding: 12px; }
  .savebar { bottom: 16px; }
  #toast { bottom: 24px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
