:root {
  --bg: #0f1115; --card: #181b22; --card2: #1f2330; --ink: #eef0f4; --muted: #8b93a3; --line: #2a2f3b;
  --accent: #ff7a1a; --accent-ink: #1a1005; --ok: #3ddc84; --danger: #ff5c5c; --warm: #ffd166;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; font: 16px/1.4 -apple-system, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg);
  padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
body.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding-bottom: 0; }
main { max-width: 640px; margin: 0 auto; padding: 12px 14px 20px; }
a { color: var(--ink); text-decoration: none; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 20px 0 8px; }
.logo { text-align: center; font-weight: 800; letter-spacing: -.02em; color: var(--accent); }
.muted { color: var(--muted); }
small { font-size: 13px; }
.page { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.page.sticky { position: sticky; top: 0; background: var(--bg); padding: 10px 0; z-index: 3; }
.title-input { background: transparent; border: 0; color: var(--ink); font-size: 20px; font-weight: 700; padding: 0; width: 100%; }
.title-input:focus { outline: none; border-bottom: 1px solid var(--accent); }

.card { background: var(--card); border-radius: 14px; padding: 14px; margin-bottom: 12px; display: block; }
.card.accent { border: 1px solid var(--accent); }
.card.narrow { width: 320px; display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--card); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.row > div { display: flex; flex-direction: column; min-width: 0; }
.row b { font-weight: 600; }
.row small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; }
.flash { background: var(--card2); border-left: 3px solid var(--ok); padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.flash.error { border-color: var(--danger); }
.tag { font-size: 11px; text-transform: uppercase; background: var(--card2); color: var(--muted); padding: 2px 7px; border-radius: 5px; }
.pr { font-size: 11px; font-weight: 700; background: var(--accent); color: var(--accent-ink); padding: 2px 7px; border-radius: 5px; margin-left: 6px; }

input, textarea, select { font: inherit; color: var(--ink); background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; width: 100%; margin-bottom: 8px; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check input { width: auto; margin: 0; }
.btn { font: inherit; font-weight: 600; background: var(--card2); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; cursor: pointer; display: inline-block; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); }
.btn.big { width: 100%; padding: 16px; font-size: 17px; }
.btn.small { padding: 7px 12px; font-size: 14px; border-radius: 9px; }
.icon { background: transparent; border: 0; color: var(--muted); font-size: 16px; padding: 6px 8px; cursor: pointer; }
form.inline { display: inline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { font: inherit; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer; }
.addex { display: flex; gap: 8px; }
.addex input { margin: 0; }
.addex .btn { flex: 0 0 auto; }
.exrow { display: flex; gap: 6px; align-items: center; }
.exrow input[type=number] { width: 70px; flex: 0 0 auto; }

/* oefening tijdens loggen */
.exercise { background: var(--card); border-radius: 14px; padding: 12px 12px 10px; margin-bottom: 12px; }
.exercise > header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 17px; margin-bottom: 4px; }
.exercise > header a { color: var(--accent); }
.prev { display: block; margin-bottom: 6px; }
table.sets { width: 100%; border-collapse: collapse; }
table.sets th { font-size: 11px; text-transform: uppercase; color: var(--muted); font-weight: 500; text-align: center; padding: 4px 0; }
table.sets td { padding: 3px 3px; text-align: center; vertical-align: middle; }
table.sets input { margin: 0; text-align: center; padding: 10px 4px; font-size: 17px; font-weight: 600; width: 100%; }
table.sets .prevcell { font-size: 13px; }
.setno { font: inherit; font-weight: 700; background: var(--card2); border: 1px solid var(--line); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; }
.setno-static { width: 34px; color: var(--muted); font-weight: 700; }
tr.warm .setno { color: var(--warm); border-color: var(--warm); }
.check { font-size: 18px; background: var(--card2); border: 1px solid var(--line); color: var(--muted); border-radius: 8px; width: 40px; height: 40px; cursor: pointer; }
tr.done td { opacity: .75; }
tr.done .check { background: var(--ok); color: #06250f; border-color: var(--ok); }
tr.done input { background: #16261c; border-color: #214a30; }
table.sets.view td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--line); }
table.sets.view td.right { text-align: right; }

/* rusttimer */
.timer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(70px + env(safe-area-inset-bottom)); background: var(--accent); color: var(--accent-ink);
  border-radius: 999px; padding: 8px 10px 8px 18px; display: flex; align-items: center; gap: 8px; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.timer.hidden { display: none; }
.timer span { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 60px; }
.timer button { font: inherit; font-weight: 700; background: rgba(0,0,0,.15); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 6px 10px; }

/* statistiek */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: 12px; padding: 12px; }
.stat b { display: block; font-size: 22px; }
.stat small { color: var(--muted); }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--accent); border-radius: 3px 3px 0 0; opacity: .85; }
.bar small { font-size: 11px; color: var(--muted); margin-top: 3px; }
.chart-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.chart-tabs button { font: inherit; font-size: 13px; background: transparent; border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 5px 10px; }
.chart-tabs button.on { border-color: var(--accent); color: var(--accent); }
svg#chart { width: 100%; height: 160px; display: block; }
svg#chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
svg#chart .area { fill: var(--accent); opacity: .12; }
svg#chart circle { fill: var(--accent); }
.chart-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }

/* tabbar */
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: #13161c; border-top: 1px solid var(--line); display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 4; }
.tabbar a { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); padding: 2px 10px; }
.tabbar a span { font-size: 20px; line-height: 1.1; }
.tabbar a.on { color: var(--accent); }
details summary { cursor: pointer; color: var(--muted); }

.card.plain { background: transparent; }
.card.plain input { background: var(--card); }

/* bibliotheek */
.filterbar .selects { display: flex; gap: 8px; margin-bottom: 8px; }
.filterbar select { flex: 1; width: auto; }
.libitem { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; }
.libitem .libtext { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.libitem .libtext b { font-weight: 600; }
.thumb { flex: 0 0 56px; width: 56px; height: 56px; border-radius: 10px; overflow: hidden; background: #fff; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.row.withthumb { justify-content: flex-start; }
.row.withthumb > div { flex: 1; }
.row.withthumb .thumb { flex-basis: 44px; width: 44px; height: 44px; }
.ok { color: var(--ok); }
.imgs { display: flex; gap: 8px; margin-bottom: 10px; }
.imgs img { flex: 1; min-width: 0; border-radius: 12px; background: #fff; max-height: 220px; object-fit: contain; }
.libhead { margin-bottom: 12px; }
.instr { padding-left: 32px; } .instr li { margin-bottom: 6px; }
.chips.sugg { margin: 10px 0; }
.chip.withimg { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; text-align: left; }
.chip.withimg img { width: 32px; height: 32px; border-radius: 999px; object-fit: cover; background: #fff; }
.exname { display: inline-flex; align-items: center; gap: 10px; }
.exname img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; background: #fff; }
.small-print { font-size: 12px; margin-top: 16px; }
/* set-types */
tr.tW .setno, tr.tW .setno-static { color: var(--warm); border-color: var(--warm); }
tr.tD .setno, tr.tD .setno-static { color: #7aa2ff; border-color: #7aa2ff; }
tr.tF .setno, tr.tF .setno-static { color: var(--danger); border-color: var(--danger); }
