:root {
  --bg: #fff; --fg: #111; --muted: #777; --line: #e6e6e6; --soft: #f2f2f2;
  --kcal: #111; --carbs: #f74e45; --protein: #fdb63a; --fat: #9a8fcc;
  --accent: #f74e45; --ok: #1a8a3a; --track: #e2e2e2;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { padding: 12px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 26px 0 12px; }
h2 { font-size: 20px; font-weight: 800; margin: 18px 0 8px; }
a { color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* kop met datum */
.topbar { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; min-height: 52px; }
.topbar .title { line-height: 1.2; padding: 6px 0; }
.topbar .title { text-align: center; font-weight: 800; font-size: 20px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: none; font-size: 26px; cursor: pointer; color: var(--fg); }
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* knoppen */
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.btn { border: 1.5px solid #bbb; background: #fff; border-radius: 8px; padding: 10px 16px;
  font: inherit; font-weight: 700; cursor: pointer; color: var(--fg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--accent); border-color: var(--accent); }
.btn.block { width: 100%; }

/* balken */
.bar { margin: 4px 0 18px; }
.bar .lbl { margin-bottom: 6px; }
.bar .lbl b { font-weight: 800; }
.bar .lbl .ok { color: var(--ok); font-weight: 900; margin-left: 4px; }
.track { position: relative; height: 22px; background: var(--track); border-radius: 11px; }
.fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 11px; min-width: 22px; transition: width .3s; }
.mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: #111; border-radius: 2px; }
.mark.kgoal { background: #111; }
.mark.grey { background: #bbb; }
.zone { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #333; pointer-events: none; }
.ticks { position: relative; height: 20px; font-size: 14px; }
.ticks span { position: absolute; transform: translateX(-50%); top: 2px; }
.ticks .kgoal { color: var(--fg); font-weight: 600; }
.ticks .grey { color: #aaa; }

.goalpill { display: inline-flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.breakdown { font-size: 13px; color: var(--muted); margin: -6px 0 6px; }

/* trainingen */
.act { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 8px; }
.act .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 17px; flex: none; }
.act.done .ic { background: #e5f3e9; }
.act.planned .ic { background: #fff4df; }
.act .body { flex: 1; min-width: 0; }
.act .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act .kc { font-weight: 800; white-space: nowrap; }
.tag { font-size: 12px; padding: 1px 7px; border-radius: 10px; background: var(--soft); color: #555; }

/* maaltijden */
.mealhead { background: var(--soft); margin: 0 -16px; padding: 14px 16px; font-size: 17px; }
.mealhead b { font-weight: 800; }
.mealrow { display: flex; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line);
  cursor: pointer; }
.mealrow .txt { flex: 1; min-width: 0; }
.mealrow .names { font-size: 17px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mealrow .empty { color: var(--muted); }
.macros { display: flex; gap: 12px; flex-wrap: wrap; font-size: 15px; margin-top: 4px; }
.macros i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; }
.donut { flex: none; }

/* lijst producten */
.card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 12px; }
.card .body { flex: 1; min-width: 0; cursor: pointer; }
.card .name { font-size: 17px; overflow: hidden; text-overflow: ellipsis; }
.card .brand { font-size: 13px; color: var(--muted); }
.qty { border: 1.5px solid #bbb; border-radius: 10px; padding: 10px 14px; min-width: 70px; text-align: center;
  font-size: 17px; background: #fff; cursor: pointer; }
.plus { border: 1.5px solid #bbb; border-radius: 10px; width: 46px; height: 46px; background: #fff; font-size: 26px; cursor: pointer; }
.src { font-size: 11px; padding: 1px 6px; border-radius: 6px; background: #eef; color: #447; margin-left: 6px; vertical-align: middle; }
.src.custom { background: #e8f5ec; color: #1a6a32; }

/* formulieren */
input, select { font: inherit; padding: 11px 12px; border: 1.5px solid #ccc; border-radius: 8px; width: 100%; background: #fff; color: var(--fg); }
label { display: block; font-size: 14px; color: #444; margin: 12px 0 5px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 10px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 8px; }
.searchbox { position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 2; }
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { background: #fff; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 92%; overflow: auto; overscroll-behavior: contain; }
.modal h3 { margin: 0 0 6px; font-size: 20px; }
.modal .actions { display: flex; gap: 10px; margin-top: 18px; }
.modal .actions .btn { flex: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { border: 1px solid #ccc; border-radius: 16px; padding: 5px 12px; background: #fff; font: inherit; font-size: 14px; cursor: pointer; }
video.scan { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 4/3; object-fit: cover; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: #222; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 99; font-size: 14px; max-width: 90vw; }

/* tabbar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
  display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 10; }
.tabbar a { flex: 1; text-align: center; text-decoration: none; font-size: 13px; padding: 8px 0 10px; color: #222;
  border-bottom: 3px solid transparent; }
.tabbar svg { display: block; margin: 0 auto 3px; width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--accent); border-bottom-color: var(--accent); }

/* gewicht */
.chart { width: 100%; height: 200px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
td:last-child { text-align: right; }

body.loggedout .tabbar { display: none; }

/* swipe & vergrendelen */
.swipe { position: relative; overflow: hidden; margin: 0 -16px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.swipe .mealrow { position: relative; background: var(--bg); padding: 14px 16px; z-index: 1; }
.swipe-bg { position: absolute; inset: 0; display: none; align-items: center; gap: 10px; padding: 0 24px; color: #fff; font-weight: 700; }
.swipe-bg.left { background: var(--ok); justify-content: flex-start; }
.swipe-bg.right { background: var(--accent); justify-content: flex-end; }
.swipe.show-left .swipe-bg.left, .swipe.show-right .swipe-bg.right { display: flex; }
.swipe-bg { opacity: .75; } .swipe.armed .swipe-bg { opacity: 1; }
.mealrow.locked { padding-left: 0 !important; }
.lockpanel { align-self: stretch; width: 76px; margin: -14px 0; background: var(--ok); color: #fff; display: grid; place-items: center; flex: none; }
.donutwrap { position: relative; flex: none; }
.donutlock { position: absolute; inset: 0; display: grid; place-items: center; color: #111; }
.donutlock svg { width: 26px; height: 26px; }
.mealhead.train { background: #fff4df; }
.lockbanner { background: #e5f3e9; color: #1a6a32; border-radius: 10px; padding: 10px 12px; margin-top: 12px; font-size: 14px; }
.toast.undo { display: flex; gap: 14px; align-items: center; }
.toast.undo button { background: none; border: 0; color: #ffd27a; font: inherit; font-weight: 700; cursor: pointer; padding: 0; }

/* ---------- compactere weergave ---------- */
html, body { font-size: 15px; }
main { padding: 6px 14px calc(76px + env(safe-area-inset-bottom)); }
h1 { font-size: 22px; margin: 16px 0 8px; }
h2 { font-size: 17px; margin: 14px 0 6px; }
.topbar { min-height: 44px; }
.topbar .title { font-size: 17px; }
.iconbtn { width: 38px; height: 38px; font-size: 22px; }
.btnrow { gap: 8px; margin: 4px 0 10px; }
.btn { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.bar { margin: 2px 0 10px; }
.bar .lbl { margin-bottom: 4px; font-size: 14px; }
.track { height: 14px; border-radius: 7px; }
.fill { border-radius: 7px; min-width: 14px; }
.mark { top: -3px; bottom: -3px; width: 2px; margin-left: -1px; }
.zone { font-size: 11px; }
.ticks { height: 16px; font-size: 12px; }
.breakdown { font-size: 12px; }
.goalpill { font-size: 14px; margin-bottom: 4px; }
.act { padding: 8px 10px; gap: 10px; margin-bottom: 6px; cursor: pointer; }
.act .ic { width: 30px; height: 30px; font-size: 15px; }
.act .name { font-size: 15px; }
.act .edit { color: #999; font-size: 18px; }
.mealhead { padding: 8px 14px; font-size: 15px; margin: 0 -14px; }
.swipe { margin: 0 -14px; }
.swipe .mealrow { padding: 8px 14px; gap: 12px; }
.lockpanel { width: 56px; margin: -8px 0; }
.lockpanel svg { width: 24px; height: 24px; }
.donutlock svg { width: 18px; height: 18px; }
.mealrow .names { font-size: 15px; }
.macros { font-size: 13px; gap: 9px; margin-top: 2px; }
.macros i { width: 8px; height: 8px; margin-right: 4px; }
.card { padding: 10px 12px; margin-bottom: 8px; border-radius: 10px; }
.card .name { font-size: 15px; }
.qty { padding: 7px 10px; font-size: 15px; min-width: 60px; }
.plus { width: 38px; height: 38px; font-size: 22px; }
input, select { padding: 9px 10px; }
label { margin: 9px 0 4px; font-size: 13px; }
.tabbar a { font-size: 11px; padding: 6px 0 7px; }
.tabbar svg { width: 22px; height: 22px; margin-bottom: 2px; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; background: #fff4df; color: #9a5b00; border-radius: 9px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }
.infobox { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; margin: 6px 0; }
input:disabled { background: var(--soft); color: #666; }
.mealrow .empty { font-size: 13px; }
.macros.muted { color: var(--muted); }

/* ---------- training ---------- */
.seg { display: flex; border: 1.5px solid #ccc; border-radius: 8px; overflow: hidden; margin-top: 4px; }
.seg a { flex: 1; text-align: center; padding: 7px; font-size: 14px; text-decoration: none; cursor: pointer; }
.seg a.on { background: #111; color: #fff; }
.trainseg { margin: 0 0 10px; }
.week { margin: 12px 0 4px; display: flex; justify-content: space-between; align-items: baseline; }
.week b { font-size: 15px; } .week span { font-size: 12px; color: var(--muted); }
.day { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.day.today { border-color: #111; } .day.past { opacity: .55; cursor: default; }
.dnum { text-align: center; line-height: 1.1; } .dnum small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; }
.dnum b { font-size: 17px; }
.dbody { min-width: 0; } .pitem + .pitem { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.ptop { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.dtitle { font-weight: 700; font-size: 14px; } .dsub { font-size: 12px; color: var(--muted); }
.rest { color: var(--muted); font-size: 13px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 9px; padding: 2px 8px; white-space: nowrap; display: inline-block; }
.b-ok { background: #e5f3e9; color: #1a6a32; } .b-draft { background: #fff4df; color: #9a5b00; }
.b-add { background: var(--soft); color: #444; } .b-done { background: #eef2f7; color: #36506d; }
.wchart { display: block; margin-top: 4px; max-width: 100%; touch-action: pan-y; }
.chipgrid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; align-items: center; }
.sporttoggles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sporttoggles .chip { padding: 10px 6px; font-size: 15px; text-align: center; border-radius: 12px; }
.chip.on { background: #111; color: #fff; border-color: #111; }
.chip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 10px; }
.stats div { background: var(--soft); border-radius: 8px; padding: 6px 4px; text-align: center; font-size: 11px; color: var(--muted); }
.stats b { display: block; font-size: 16px; color: var(--fg); }
.chartwrap { position: relative; }
.wtip, .ftip { display: none; position: absolute; top: 0; width: 150px; background: #fff; border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0,0,0,.12); border-radius: 8px; padding: 6px 8px; font-size: 12px; pointer-events: none; z-index: 3; line-height: 1.4; }
.ftip i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.why { font-size: 13px; color: #444; background: #fafafa; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.steps { margin-top: 6px; }
.step { display: grid; grid-template-columns: 5px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.step .c { align-self: stretch; border-radius: 3px; min-height: 16px; } .step .w { font-weight: 700; white-space: nowrap; }
.rep { background: var(--soft); border-radius: 10px; padding: 2px 10px; margin: 6px 0; }
.rep .rep { background: #fff; }
.rep > .hd { font-size: 12px; font-weight: 700; color: #555; padding: 4px 0 0; }
.charttitle { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px; margin: 14px 0 4px; font-size: 14px; }
.legend { font-size: 11px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin: 0 3px 0 8px; vertical-align: -1px; }
.legend i.ln { height: 2px; vertical-align: 3px; } .legend i.dash { background: repeating-linear-gradient(90deg,#555 0 4px,transparent 4px 7px); }
.fchart { display: block; touch-action: pan-y; }
.zonepill { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; border: 1.5px solid; border-radius: 12px; padding: 2px 10px; }
.zonepill i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
details summary { cursor: pointer; margin-top: 8px; }
.tabbar a { font-size: 10.5px; }

/* beheer */
.ucard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.uhead { display: flex; align-items: center; gap: 6px; }
.uhead .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ustats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 6px 0; }
.ustats div { background: var(--soft); border-radius: 8px; padding: 5px 4px; text-align: center; font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.ustats b { display: block; font-size: 15px; color: var(--fg); }
.b-err { background: #fbe5e3; color: #a3271f; }
.errbox { font-size: 12px; background: #fbe5e3; color: #7a1d17; border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; word-break: break-word; }

/* 12-weken plannen */
.progbanner { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px;
  margin: 8px 0; text-decoration: none; color: inherit; background: #fff; }
.progbanner.new { border-style: dashed; border-color: #bbb; background: var(--soft); }
.progbanner > div { flex: 1; } .progbanner .pi { font-size: 22px; }
.weeknav { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.weeknav .btn { padding: 4px 14px; min-width: 0; }
.phase { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; border-radius: 10px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.ph-basis { background: #4f8fd6; } .ph-opbouw { background: #3aa565; } .ph-piek { background: #ef7b2d; }
.ph-herstel { background: #9aa6b2; } .ph-afbouw { background: #a07ad6; }
.goalgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal { position: relative; text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 10px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.goal .gi { font-size: 22px; } .goal small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.goal .gs { position: absolute; top: 8px; right: 8px; font-size: 10.5px; color: var(--muted); }
.goal.on { border-color: #111; box-shadow: 0 0 0 1.5px #111 inset; }
.pvrow { display: grid; grid-template-columns: 26px 1fr auto; gap: 6px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.pvrow > span:first-child { color: var(--muted); }
.pweek { border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; margin: 8px 0; }
.pweek.cur { border-color: #111; }
.pwhead { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pwhead > div { flex: 1; } .pwhead .phase { margin: 0; min-width: 22px; text-align: center; font-size: 12px; padding: 3px 6px; }
.pweek .pitem { margin: 6px 0; }
.pitem.race { background: #fff6d6; border-radius: 8px; padding: 8px; }
.movegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.movegrid .chip { padding: 5px 4px; font-size: 13px; } .movegrid small { color: inherit; opacity: .7; }
/* beheer: gebruik */
.heat { display: grid; grid-template-columns: 70px 1fr; gap: 3px 6px; align-items: center; font-size: 12px; }
.heat .row { display: grid; grid-template-columns: repeat(30, 1fr); gap: 2px; }
.heat .row i { aspect-ratio: 1; border-radius: 2px; background: #eee; display: block; }
.heat .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loginrow { display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.devs { font-size: 12px; margin: 4px 0; } .devs div { display: flex; justify-content: space-between; padding: 2px 0; }
.dot.on { box-shadow: 0 0 0 3px #2e9b5233; }
.week .phase, .pwhead .phase { color: #fff; font-weight: 700; }
/* swipe → training verwijderen */
.tswipe { position: relative; overflow: hidden; border-radius: 10px; touch-action: pan-y; user-select: none; -webkit-user-select: none; max-height: 400px; }
.tswipe + .tswipe { margin-top: 6px; }
.tswipe > .pitem { position: relative; z-index: 1; background: var(--bg, #fff); margin: 0; }
.tswipe-bg { position: absolute; inset: 0; display: none; align-items: center; padding-left: 14px; background: var(--accent); color: #fff; font-weight: 700; opacity: .7; border-radius: 10px; }
.tswipe.show .tswipe-bg { display: flex; } .tswipe.armed .tswipe-bg { opacity: 1; }
.pweek .tswipe { margin: 6px 0; }

/* ---------- hoeveelheid op de lijn: − 100 + | g ▾ ---------- */
input, select { font-size: max(16px, 1em); }   /* onder 16px zoomt iOS in en verspringt alles */
body.modal-open { overflow: hidden; }
.stepper { display: inline-flex; align-items: stretch; flex: none; height: 40px; border: 1.5px solid #111; border-radius: 10px; background: #fff; overflow: hidden; }
.st-btn { width: 34px; padding: 0; border: 0; background: none; color: #111; font: inherit; font-size: 22px; line-height: 1; cursor: pointer; touch-action: manipulation; }
.st-btn:active { background: var(--soft); }
.stepper .st-val { width: 50px; padding: 0; border: 0; border-radius: 0; background: none; text-align: center; font-size: 16px; }
.stepper .st-val:focus { outline: none; background: #f6f6f6; }
.st-unit { display: flex; align-items: center; justify-content: space-between; gap: 2px; min-width: 70px; padding: 0 6px 0 10px;
  border: 0; border-left: 1.5px solid #111; background: none; color: #111; font: inherit; font-size: 15px; cursor: pointer; }
.st-unit.fixed { justify-content: center; min-width: 38px; padding: 0 8px; }
.stepper.big { display: flex; height: 50px; }
.stepper.big .st-val { flex: 1; font-size: 18px; }
.stepper.big .st-btn { width: 54px; font-size: 26px; }
.stepper.big .st-unit { min-width: 96px; font-size: 16px; }
.card.entry { gap: 10px; }
.card.entry .macros { gap: 6px 9px; }

/* naar links swipen = lijn verwijderen */
.eswipe { position: relative; overflow: hidden; border-radius: 10px; margin-bottom: 8px; max-height: 300px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.eswipe > .card { position: relative; z-index: 1; margin: 0; background: var(--bg, #fff); }
.eswipe-bg { position: absolute; inset: 0; display: none; align-items: center; justify-content: flex-end; gap: 8px; padding-right: 18px;
  background: var(--accent); color: #fff; font-weight: 700; opacity: .7; border-radius: 10px; }
.eswipe.show .eswipe-bg { display: flex; } .eswipe.armed .eswipe-bg { opacity: 1; }
.eswipe.flash > .card { animation: eflash 1.4s ease-out; }
@keyframes eflash { from { background: #fff1d6; } }

/* keuzeblad (gram / stuks) */
.modal.sheet { padding-top: 8px; }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: #ccc; margin: 0 auto 6px; }
.sheet-opt { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 16px 6px; border: 0; border-bottom: 1px solid var(--line);
  background: none; color: var(--fg); font: inherit; font-size: 17px; font-weight: 700; text-align: left; cursor: pointer; }
.sheet-opt:last-child { border-bottom: 0; }
.sheet-opt .muted { font-weight: 400; }
.sheet-opt .check { color: var(--accent); font-size: 22px; }

/* ---------- donkere modus (Profiel > Weergave) ----------
   data-theme="dark" wordt op <html> gezet door het scriptje in index.html (Systeem / Licht / Donker). */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212; --fg: #f0f0f0; --muted: #a3a3a3; --line: #2c2c2c; --soft: #1f1f1f;
  --kcal: #f0f0f0; --ok: #3bb463; --track: #2e2e2e;
  --card: #1a1a1a; --edge: #4a4a4a; --okbg: #15301e; --okfg: #6fd08f; --warnbg: #33270f; --warnfg: #f2c46b;
}
[data-theme="dark"] .btn, [data-theme="dark"] .qty, [data-theme="dark"] .plus, [data-theme="dark"] .chip,
[data-theme="dark"] input, [data-theme="dark"] select { background: var(--soft); border-color: var(--edge); color: var(--fg); }
[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
[data-theme="dark"] .btn.danger { background: transparent; color: var(--accent); border-color: var(--accent); }
[data-theme="dark"] .chip.on, [data-theme="dark"] .seg a.on { background: var(--fg); color: var(--bg); border-color: var(--fg); }
[data-theme="dark"] .seg { border-color: var(--edge); }
[data-theme="dark"] label, [data-theme="dark"] .why, [data-theme="dark"] .rep > .hd, [data-theme="dark"] .b-add { color: var(--muted); }
[data-theme="dark"] .tag, [data-theme="dark"] .src { background: #262626; color: var(--muted); }
[data-theme="dark"] .zone, [data-theme="dark"] .act .edit, [data-theme="dark"] .ticks .grey { color: var(--muted); }
[data-theme="dark"] .mark, [data-theme="dark"] .mark.kgoal { background: var(--fg); }
[data-theme="dark"] .mark.grey { background: #666; }
[data-theme="dark"] .modal, [data-theme="dark"] .tabbar, [data-theme="dark"] .wtip, [data-theme="dark"] .ftip,
[data-theme="dark"] .rep .rep, [data-theme="dark"] .goal, [data-theme="dark"] .progbanner, [data-theme="dark"] .why { background: var(--card); border-color: var(--line); color: var(--fg); }
[data-theme="dark"] .goal.on, [data-theme="dark"] .day.today, [data-theme="dark"] .pweek.cur { border-color: var(--fg); box-shadow: 0 0 0 1.5px var(--fg) inset; }
[data-theme="dark"] .tabbar a { color: var(--muted); }
[data-theme="dark"] .tabbar a.on { color: var(--accent); }
[data-theme="dark"] .toast { background: #f0f0f0; color: #111; }
[data-theme="dark"] .toast.undo button { color: #b4520a; }
[data-theme="dark"] .modal-bg { background: rgba(0,0,0,.6); }
[data-theme="dark"] .act.done .ic, [data-theme="dark"] .lockbanner, [data-theme="dark"] .b-ok, [data-theme="dark"] .src.custom { background: var(--okbg); color: var(--okfg); }
[data-theme="dark"] .act.planned .ic, [data-theme="dark"] .mealhead.train, [data-theme="dark"] .pill, [data-theme="dark"] .b-draft, [data-theme="dark"] .pitem.race { background: var(--warnbg); color: var(--warnfg); }
[data-theme="dark"] .b-done { background: #1d2733; color: #9db7d6; }
[data-theme="dark"] .b-err, [data-theme="dark"] .errbox { background: #3a1714; color: #f3a29b; }
[data-theme="dark"] .heat .row i { background: #262626; }
[data-theme="dark"] .donutlock { color: var(--fg); }
[data-theme="dark"] .stepper { background: var(--soft); border-color: var(--edge); }
[data-theme="dark"] .st-btn, [data-theme="dark"] .st-unit { color: var(--fg); border-color: var(--edge); }
[data-theme="dark"] .stepper .st-val { background: none; border: 0; }
[data-theme="dark"] .stepper .st-val:focus { background: #2a2a2a; }
[data-theme="dark"] .sheet-grip { background: #555; }
[data-theme="dark"] .card, [data-theme="dark"] .act, [data-theme="dark"] .day { background: var(--card); }
@keyframes eflash-dark { from { background: #3a2c12; } }
[data-theme="dark"] .eswipe.flash > .card { animation-name: eflash-dark; }
/* grafieken: vaste SVG-kleuren omzetten */
[data-theme="dark"] svg [stroke="#111"] { stroke: var(--fg); }
[data-theme="dark"] svg [fill="#111"], [data-theme="dark"] svg [fill="#333"] { fill: var(--fg); }
[data-theme="dark"] svg [stroke="#eee"], [data-theme="dark"] svg [stroke="#e8e8e8"] { stroke: #333; }
[data-theme="dark"] svg [stroke="#fff"] { stroke: var(--bg); }
[data-theme="dark"] svg [fill="#fff"], [data-theme="dark"] svg [fill="#f3f3f3"] { fill: #2a2a2a; }
[data-theme="dark"] svg [fill="#999"], [data-theme="dark"] svg [fill="#888"] { fill: #8a8a8a; }
[data-theme="dark"] [style*="background:#111"] { background: var(--fg) !important; }

/* ---------- week op maat ---------- */
.tgoal { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--fg);
  background: var(--soft); border: 1.5px solid transparent; border-radius: 12px; padding: 9px 12px; margin: 0 0 6px; cursor: pointer; }
.tgoal.on { border-color: var(--accent); }
.tgoal .ti { font-size: 22px; } .tgoal .tt { flex: 1; min-width: 0; }
.tgoal .tt b { display: block; font-size: 15px; } .tgoal .tt small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.tgoal .check { color: var(--accent); font-weight: 800; }
.wseg a { cursor: pointer; }
.avlist { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.avrow { display: grid; grid-template-columns: 46px 1fr; gap: 4px 8px; align-items: center; background: var(--soft); border-radius: 12px; padding: 8px 10px; }
.avrow.off { opacity: .75; }
.avday { font: inherit; font-weight: 800; background: none; border: 0; color: var(--fg); text-align: left; padding: 0; cursor: pointer; grid-row: span 2; }
.avday.long { color: var(--accent); } .avday:disabled { color: var(--muted); cursor: default; }
.avslots { display: flex; gap: 4px; } .avslots .chip { flex: 1; padding: 5px 0; font-size: 13px; text-align: center; background: var(--bg); color: var(--fg); }
.avslots .chip.on, .avsport.chip { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.avmeta { display: grid; grid-template-columns: 1fr 46px 104px; gap: 8px; align-items: center; }   /* overal even lange schuifregelaar */
.avrange { flex: 1; min-width: 0; height: 32px; margin: 0; padding: 0; border: 0; background: none; accent-color: var(--accent); touch-action: pan-y; }
.avval { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.pmlist { display: flex; flex-direction: column; gap: 4px; margin-bottom: 4px; }
.pmrow { display: grid; grid-template-columns: 34px 1fr 92px; gap: 8px; align-items: center; background: var(--soft); border-radius: 12px; padding: 4px 10px; }
.pmrow .avval { white-space: nowrap; }
.avsport.chip { font-size: 13px; padding: 5px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .avsport:disabled { opacity: .8; cursor: default; }
.wktarget { margin: 2px 0 8px; } .wktarget > .small:first-child { display: flex; justify-content: space-between; gap: 8px; }
.wkbar { display: flex; height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 5px 0 3px; }
.wkbar i { display: block; background: var(--accent); } .wkbar i.plan { opacity: .35; }
.wkmsg { border-color: var(--accent); }
.wkday .dnum .star { color: var(--accent); font-size: 12px; }
.pitem.missed .dtitle { text-decoration: line-through; color: var(--muted); }

/* aan/uit-schakelaar (Strava-regel) */
label.switch { display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 15px; cursor: pointer; }
label.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; padding: 0; margin: 0; border: 0;
  border-radius: 13px; background: var(--track); position: relative; cursor: pointer; transition: background .15s; }
label.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
label.switch input:checked { background: var(--ok); }
label.switch input:checked::after { transform: translateX(18px); }


/* toetsenbord open: menubalk weg, anders zweeft hij op iOS boven het toetsenbord */
body.kb .tabbar { display: none; }

/* training wegswipen */
.aswipe { border-radius: var(--radius, 12px); margin-bottom: 8px; }
.aswipe > .act { margin: 0; position: relative; z-index: 1; background: var(--card, var(--bg, #fff)); }

/* product zonder macro's (ontbreken in Open Food Facts) */
.macros .nomac { color: var(--warn-fg); font-weight: 600; }
.linkbtn { background: none; border: 0; padding: 4px 0 0; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }

/* "Waarom?" bij profielvelden */
details.uitleg { margin: 6px 0 2px; }
details.uitleg summary { font-size: 13px; font-weight: 600; color: var(--accent); margin-top: 4px; list-style: none; }
details.uitleg summary::-webkit-details-marker { display: none; }
details.uitleg summary::after { content: ' ›'; }
details.uitleg[open] summary::after { content: ' ⌄'; }
details.uitleg p { font-size: 13px; color: var(--muted); margin: 6px 0; line-height: 1.45; }
.subh { font-size: 15px; margin: 16px 0 2px; }

/* link naar instellingen onderaan Profiel */
.setlink { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; padding: 14px; border-radius: 12px;
  background: var(--soft); color: var(--fg); text-decoration: none; font-weight: 600; }
.setlink span { flex: 1; }
.setlink b { color: var(--muted); font-size: 20px; }
.vlist .setlink { margin: 8px 0; }
.vrow { border-top: 1px solid var(--line); padding: 12px 0 4px; margin-top: 10px; }
.vrow .vhead { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.vrow .vhead input { flex: 1; font-weight: 600; }
.vrow .iconbtn:disabled { opacity: .3; }
.vrow .vpages { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.vrow .vpages .chip { padding: 4px 10px; font-size: 13px; }
.topbar.withhelp { grid-template-columns: 88px 1fr 88px; }
.topbar .tright { display: flex; justify-content: flex-end; align-items: center; }
.topbar .tright .iconbtn { display: grid; place-items: center; }
.helpbtn { display: grid; place-items: center; color: var(--muted); }
.ludus-head .helpbtn { margin-left: auto; width: 36px; height: 36px; }

/* stappenplan bij de eerste start */
body.onb .tabbar { display: none; }
.onb { position: relative; padding: 18px 0 40px; min-height: 80vh; }
.onb-close { position: absolute; top: 4px; right: -6px; width: 40px; height: 40px; border: 0; background: none;
  color: var(--muted); font-size: 20px; cursor: pointer; }
.onb-dots { display: flex; gap: 6px; margin: 8px 0 18px; padding-right: 40px; }
.onb-dots i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.onb-dots i.on { background: var(--accent); }
.onb-h { font-size: 28px; font-weight: 800; margin: 0 0 6px; letter-spacing: -.02em; }
.onb-why { color: var(--muted); font-size: 15px; line-height: 1.45; margin: 0 0 10px; }
.onb-hero { text-align: center; padding: 30px 0 10px; }
.onb-hero h1 { font-size: 30px; font-weight: 800; margin: 14px 0 6px; letter-spacing: -.02em; }
.onb-hero p { color: var(--muted); font-size: 16px; margin: 0; line-height: 1.45; }
.onb-check { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 36px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto; }
.onb-list { padding-left: 20px; margin: 22px 0 14px; line-height: 1.5; }
.onb-list li { margin-bottom: 10px; }
.onb-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 26px; }
.onb-nav > div { display: flex; gap: 8px; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.hfit { display: block; margin: 4px 2px 0; font-size: 13px; color: var(--muted); text-decoration: none; }
.hfit:empty { display: none; }
.hfit b { font-weight: 700; }
/* taalkeuze */
.langpick { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.langpick.center { justify-content: center; }
.langpick.small .chip { font-size: 13px; padding: 4px 10px; }
