:root {
  --bg: #111521;
  --surface: #171c2b;
  --surface-2: #1f2536;
  --border: #2b3348;
  --text: #f2f4f8;
  --text-dim: #97a0b5;
  --accent: #e3a71e;
  --accent-2: #da9800;
  --accent-dim: #6e5310;
  --good: #4ade80;
  --bad: #f87171;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface-2: #eceef1;
    --border: #dfe2e7;
    --text: #14171c;
    --text-dim: #5b6270;
    --accent: #da9800;
    --accent-2: #b37d00;
    --accent-dim: #f5e3b8;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  overscroll-behavior-y: none;
}

/* Safari/iOS erft het lettertype niet door naar formulierelementen (toont dan Times) */
button, input, select, textarea { font-family: inherit; }
/* geen spinner-pijltjes in getalvelden (desktop/WebKit); invoer gaat via toetsenbord */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.phone-frame-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

@media (min-width: 700px) {
  .phone-frame-wrap {
    background: radial-gradient(circle at 50% 20%, #1a2030, #060810 70%);
    padding: 40px 0;
  }
  .app {
    width: 390px;
    height: 844px;
    max-height: 92vh;
    border-radius: 44px;
    border: 10px solid #000;
    box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px #222;
    overflow: hidden;
  }
}

.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.view {
  flex: 1;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 20px) 18px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
  display: none;
}

.view.active { display: block; }

h1.page-title {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 700;
}

.page-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
}

.card-today {
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
}

.today-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  font-weight: 700;
  margin: 0 0 6px;
}

.today-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}

.today-meta {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 16px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  display: block;
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #1d1d1d;
}

.btn-primary:active { opacity: 0.85; }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.exercise-list {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exercise {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
}

.exercise.done {
  opacity: 0.55;
}

.exercise.done .exercise-name {
  text-decoration: line-through;
}

.checkbox {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 8px;
  border: 2px solid var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
}

.exercise.done .checkbox {
  background: var(--accent);
  border-color: var(--accent);
  color: #1d1d1d;
  font-weight: 900;
}

.exercise-info { flex: 1; min-width: 0; }

.exercise-name {
  font-size: 15px;
  font-weight: 600;
}

.exercise-sets {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 700;
  margin: 24px 0 10px;
}

.section-title:first-child { margin-top: 0; }

.metric-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.metric-row:last-child { border-bottom: none; }

.metric-name {
  font-size: 14px;
  color: var(--text-dim);
}

.metric-value {
  font-size: 16px;
  font-weight: 700;
  text-align: right;
}

.metric-delta {
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.metric-delta.up { color: var(--good); }
.metric-delta.down { color: var(--bad); }

.pr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 10px 14px;
}

.pr-name { font-size: 14px; font-weight: 600; }
.pr-value { font-size: 14px; font-weight: 700; color: var(--accent); }
.pr-date { font-size: 11px; color: var(--text-dim); }

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #1d1d1d;
  font-weight: 900;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-name { font-size: 17px; font-weight: 700; }
.profile-sub { font-size: 13px; color: var(--text-dim); }

.diag-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.diag-row:last-child { border-bottom: none; }

.diag-label { color: var(--text-dim); }

.diag-value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
}

.dot.ok { background: var(--good); }
.dot.bad { background: var(--bad); }
.dot.warn { background: #fbbf24; }

.install-note {
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 14px;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 14px;
  line-height: 1.5;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(17, 21, 33, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  display: flex;
}

@media (prefers-color-scheme: light) {
  .tabbar { background: rgba(255, 255, 255, 0.88); }
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.tab .tab-icon {
  font-size: 20px;
  line-height: 1;
}

.tab.active { color: var(--accent); }

.toast {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ---------- oefeningen-bibliotheek ---------- */
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 12px;
  outline: none;
  -webkit-appearance: none;
}

.search-input:focus { border-color: var(--accent); }
.search-input::placeholder { color: var(--text-dim); }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }

.chip {
  flex-shrink: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1d1d1d;
}

.lib-row { cursor: pointer; }

.lib-arrow {
  color: var(--text-dim);
  font-size: 20px;
  font-weight: 700;
}

.lang-badge {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  margin-left: 8px;
  vertical-align: 1px;
  letter-spacing: 0.04em;
}

.lib-status {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  margin: 18px 0;
}

#lib-more { margin-top: 12px; }

.lib-back {
  margin-bottom: 14px;
  width: auto;
  padding: 10px 16px;
  font-size: 14px;
}

.lib-desc {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 10px;
}

.lib-muscles {
  font-size: 13px;
  color: var(--text-dim);
  margin: 14px 0 0;
}

.lib-license {
  font-size: 11px;
  color: var(--text-dim);
  margin: 12px 0 0;
  opacity: 0.8;
}

.attribution {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin: 20px 0 0;
}

/* [hidden] moet winnen van display:flex/grid op dezelfde elementen */
[hidden] { display: none !important; }

/* ---------- client login ---------- */
.login-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  background:
    radial-gradient(500px 300px at 70% -5%, rgba(227,167,30,0.10), transparent 60%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.login-inner { width: 100%; max-width: 330px; }
.login-inner .search-input { margin-bottom: 10px; }
.login-inner .btn-primary { margin-top: 4px; }

.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

.schema-progress { font-size: 12px; color: var(--text-dim); margin: 0 0 12px; }

.login-logo {
  display: block;
  width: 96px;
  height: 96px;
  margin: 0 auto 18px;
  border-radius: 22px;
}

.login-install { margin-top: 18px; }
.install-hint { font-size: 12px; color: var(--text-dim); text-align: center; line-height: 1.5; margin: 0; }

.profile-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  width: 170px;
  text-align: right;
  color-scheme: dark;
}
.profile-actions { display: flex; gap: 10px; margin-top: 16px; }
.profile-actions .btn { flex: 1; padding: 12px 14px; font-size: 14px; }

/* ---------- voortgangsfoto's ---------- */
.photo-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.photo-slot {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 2px dashed var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 28px;
  cursor: pointer;
  overflow: hidden;
  background: var(--surface-2);
}

.photo-slot.filled { border-style: solid; }

.photo-slot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-slot-label {
  position: absolute;
  bottom: 6px;
  left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  pointer-events: none;
}

.photo-redo {
  position: absolute;
  top: 6px; right: 6px;
  width: 28px; height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(17,21,33,0.75);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.photo-history-card { padding: 12px 14px; }
.photo-date { font-size: 12px; font-weight: 700; color: var(--text-dim); margin: 0 0 8px; }
.photo-row { display: flex; gap: 8px; }
.photo-row img {
  width: 72px; height: 96px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.photo-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(8,10,16,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}

.photo-overlay img { max-width: 100%; max-height: 100%; border-radius: 12px; }

.measure-form { display: flex; gap: 12px; margin-bottom: 14px; }
.measure-field { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); }
.measure-field .profile-input { width: 100%; text-align: left; }

#photos-toggle { margin-bottom: 16px; }

/* ---------- oefening-uitleg overlay + plaatjes ---------- */
.lib-thumb {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 10px;
  background: #fff;
  flex-shrink: 0;
}

.detail-image {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  margin-bottom: 14px;
}

.info-btn {
  width: 26px; height: 26px; min-width: 26px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: pointer;
}
/* rechtsboven bij de oefeningnaam, niet verticaal gecentreerd naast de sets */
.exercise > .info-btn { align-self: flex-start; }

.exercise-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  background: rgba(8,10,16,0.88);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.exercise-overlay-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  padding: 22px 18px calc(env(safe-area-inset-bottom) + 22px);
  width: 100%;
  max-height: calc(100% - 28px);
  overflow-y: auto;
}

.overlay-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
}

/* ---------- krachtlog per oefening ---------- */
.log-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.log-last {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  max-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  text-align: right;
}

.log-btn {
  border: none;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  padding: 7px 12px;
  cursor: pointer;
}

.log-reps { flex: 0.8 1 0; max-width: 95px; }

.schema-lastdone { font-size: 12px; color: var(--text-dim); margin: -6px 0 12px; }
.finish-btn { margin-top: 16px; }

.yt-btn { margin-top: 14px; text-align: center; text-decoration: none; }

.log-btn { flex-shrink: 0; }

.request-banner { border-left: 3px solid var(--accent); }
.request-text { font-size: 14px; font-weight: 600; margin: 0 0 12px; }

/* ---------- weekafronding ---------- */
.schema-completed { opacity: 0.75; border-color: var(--accent-dim); }
.done-this-week { color: var(--good); font-weight: 700; }
.schema-completed .checkbox:disabled,
.schema-completed .log-input:disabled,
.schema-completed .log-btn:disabled { opacity: 0.45; cursor: default; }

.set-line { align-items: center; }
.set-label {
  width: 44px;
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
}
.field-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
}
.field-wrap .log-input { width: 100%; max-width: none; padding-right: 34px; text-align: left; }
.field-unit {
  position: absolute;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  pointer-events: none;
}
.set-save { align-self: flex-start; padding: 8px 16px; }

/* ---------- workout-beloning ---------- */
.reward-overlay {
  position: absolute;
  inset: 0;
  z-index: 60;
  background: rgba(8,10,16,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.reward-card {
  background: linear-gradient(160deg, var(--surface), var(--surface-2));
  border: 1px solid var(--accent-dim);
  border-top: 3px solid var(--accent);
  border-radius: 24px;
  padding: 34px 26px;
  text-align: center;
  width: 100%;
  max-width: 320px;
  animation: reward-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

@keyframes reward-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.reward-emoji {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 14px;
  animation: reward-bounce 1s ease infinite alternate;
}

@keyframes reward-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.reward-title { font-size: 22px; font-weight: 700; margin: 0 0 10px; }

.reward-volume {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}

.reward-sub { font-size: 13px; color: var(--text-dim); margin: 0 0 20px; }

/* ---------- voeding ---------- */
.nutrition-summary { border-top: 3px solid var(--accent); }
.meal-title { font-size: 15px; font-weight: 700; color: var(--accent); margin: 0 0 6px; }
.meal-item-name { font-size: 14px; flex: 1; padding-right: 10px; }
.meal-item-info { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.meal-item-info strong { font-size: 14px; }
.meal-item-macros { font-size: 11px; color: var(--text-dim); }

/* ---------- weekdag-strip (Vytal-stijl) ---------- */
.week-strip {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 8px;
  margin-bottom: 18px;
}
.day-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  border-radius: 12px;
  padding: 8px 2px 6px;
  cursor: pointer;
  color: var(--text-dim);
}
.day-cell.selected { background: var(--surface-2); }
.day-lbl { font-size: 11px; font-weight: 600; text-transform: lowercase; }
.day-num { font-size: 17px; font-weight: 700; color: var(--text); }
.day-cell.today .day-num { color: var(--accent); }
.day-cell.selected .day-lbl,
.day-cell.selected .day-num { color: var(--accent); }
.day-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day-dot.on { background: var(--accent); }

/* ---------- oefening-voltooid knop ---------- */
.done-btn {
  align-self: flex-start;
  border: 1px solid var(--accent-dim);
  background: var(--surface);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}
.done-btn.is-done {
  background: var(--accent);
  color: #1d1d1d;
  border-color: var(--accent);
}
.done-btn:disabled { opacity: 0.5; cursor: default; }

.avatar-upload { cursor: pointer; position: relative; overflow: hidden; }
.avatar-upload img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.field-label { display: block; font-size: 12px; color: var(--text-dim); margin: 4px 0 4px 2px; }

/* ==========================================================
   VOEDING — dagboek (js/nutrition.js)
   ========================================================== */
:root { --carbs: #f472b6; --protein: #60a5fa; --fat: #fb923c; --water: #38bdf8; }

.nut-weeknav-head { display: flex; align-items: center; justify-content: space-between; margin: -6px 0 8px; }
.nut-weeknav-lbl { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.nut-arrow {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 20px; line-height: 1; cursor: pointer;
}
.nut-arrow:disabled { opacity: 0.3; cursor: default; }
.nut-strip .day-cell:disabled { opacity: 0.35; cursor: default; }
.day-dot.on.good { background: var(--good); }

.nut-summary { border-top: 3px solid var(--accent); }
.nut-left { font-size: 17px; margin: 0 0 12px; }
.nut-left strong { font-size: 26px; color: var(--accent); }
.nut-left strong.over { color: var(--bad); }
.nut-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.nut-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s; }
.nut-bar-fill.over { background: var(--bad); }
.nut-bar-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); margin: 6px 0 14px; }

.nut-rings { display: flex; justify-content: space-between; gap: 8px; }
.nut-ring { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; }
.nut-ring svg { width: 84px; height: 84px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 7; }
.ring-fg { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset .4s; }
.nut-ring.carbs .ring-fg { stroke: var(--carbs); }
.nut-ring.protein .ring-fg { stroke: var(--protein); }
.nut-ring.fat .ring-fg { stroke: var(--fat); }
.nut-ring.over .ring-fg { stroke: var(--bad); }
.nut-ring-mid {
  position: absolute; top: 0; height: 84px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.nut-ring-mid strong { font-size: 16px; }
.nut-ring-mid span { font-size: 11px; color: var(--text-dim); }
.nut-ring.carbs .nut-ring-mid span, .nut-ring.carbs .nut-ring-left { color: var(--carbs); }
.nut-ring.protein .nut-ring-mid span, .nut-ring.protein .nut-ring-left { color: var(--protein); }
.nut-ring.fat .nut-ring-mid span, .nut-ring.fat .nut-ring-left { color: var(--fat); }
.nut-ring-left { font-size: 12px; font-weight: 600; margin-top: 4px; }
.nut-ring.over .nut-ring-left { color: var(--bad); }

.nut-water-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.nut-water-title { font-weight: 700; }
.nut-water-amount { font-size: 13px; color: var(--text-dim); font-weight: 600; }
.nut-glasses { display: flex; flex-wrap: wrap; gap: 6px; }
.nut-glass {
  width: 26px; height: 34px; border: 2px solid var(--water); border-top-width: 1px;
  border-radius: 3px 3px 8px 8px; background: transparent; cursor: pointer; padding: 0; opacity: .55;
}
.nut-glass.full { background: var(--water); opacity: 1; }
.nut-glass-plus {
  width: 34px; height: 34px; border-radius: 50%; border: 1px dashed var(--water);
  background: none; color: var(--water); font-size: 18px; cursor: pointer;
}
.nut-water-done { margin: 10px 0 0; font-size: 13px; color: var(--good); font-weight: 600; }

.nut-meal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.nut-meal-head .meal-title { margin: 0; }
.nut-meal-kcal { font-size: 12px; color: var(--text-dim); }
.nut-add {
  flex-shrink: 0; border: 1px solid var(--accent-dim); background: var(--surface); color: var(--accent);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.nut-plan-list, .nut-extra-list { display: flex; flex-direction: column; gap: 6px; }
.nut-plan-item, .nut-entry, .food-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; color: var(--text); cursor: pointer; font: inherit;
}
.nut-plan-item.done { border-color: var(--accent-dim); }
.nut-plan-item.done .nut-item-name { color: var(--text-dim); }
.nut-check {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800;
}
.nut-plan-item.done .nut-check { background: var(--accent); border-color: var(--accent); color: #1d1d1d; }
.nut-item-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nut-item-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.nut-item-sub { font-size: 12px; color: var(--text-dim); }
.nut-item-edit { font-size: 16px; color: var(--text-dim); padding: 4px 6px; }
.nut-entry-kcal { font-size: 13px; flex-shrink: 0; }
.nut-all {
  margin-top: 8px; background: none; border: none; color: var(--accent); font-weight: 700;
  font-size: 13px; cursor: pointer; padding: 4px 0;
}
.nut-extra-lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 700; margin: 12px 0 2px; }
.nut-empty { font-size: 13px; color: var(--text-dim); margin: 4px 0; }

.nut-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.nut-actions .btn { padding: 12px 10px; font-size: 14px; }

.nut-score-meta { margin-bottom: 10px; }
.nut-score-bars { position: relative; display: flex; justify-content: space-between; align-items: flex-end; height: 80px; }
.nut-score-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nut-score-col span { font-size: 11px; color: var(--text-dim); height: 14px; }
.nut-score-bar { width: 16px; border-radius: 5px; background: var(--surface-2); }
.nut-score-bar.logged { background: var(--accent-dim); }
.nut-score-bar.good { background: var(--good); }
.nut-score-goal { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--accent); opacity: .7; }

.nut-tip { position: relative; border: 1px dashed var(--border); background: transparent; }
.nut-tip-close {
  position: absolute; top: 12px; right: 12px; border: none; background: none;
  color: var(--text-dim); font-size: 14px; cursor: pointer;
}
.nut-tip-title { font-weight: 700; margin: 0 0 4px; }
.nut-tip-body { font-size: 14px; color: var(--text-dim); margin: 0; line-height: 1.45; }

/* sheet */
.food-sheet { z-index: 60; }
.food-sheet .exercise-overlay-card { min-height: 60%; }
.sheet-title { font-size: 18px; font-weight: 700; margin: 0 40px 12px 0; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.chip {
  flex-shrink: 0; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #1d1d1d; }
.seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 14px; }
.seg-btn {
  flex: 1; border: none; background: none; color: var(--text-dim); padding: 9px 4px;
  border-radius: 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.seg-btn.active { background: var(--surface); color: var(--text); }
.search-bar { display: flex; gap: 8px; }
.search-bar .search-input { flex: 1; min-width: 0; }
.scan-btn {
  flex-shrink: 0; width: 50px; height: 48px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--accent); font-size: 22px; cursor: pointer;
}
.food-results { display: flex; flex-direction: column; gap: 6px; }
.food-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 3px 7px; border-radius: 999px; background: var(--surface); color: var(--text-dim); flex-shrink: 0; }
.food-badge.favorite { color: var(--accent); }
.food-badge.own { color: var(--protein); }
.food-del { font-size: 15px; padding: 4px; }
.nut-hint { font-size: 13px; color: var(--text-dim); margin: 0 0 12px; line-height: 1.45; }
.nut-hint.warn { color: var(--accent); }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; padding: 4px 0 10px; cursor: pointer; }
.portion-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.portion-name { font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.fav-btn { border: none; background: none; font-size: 24px; color: var(--text-dim); cursor: pointer; line-height: 1; }
.fav-btn.on { color: var(--accent); }
.portion-input { margin-top: 14px; }
.portion-input .search-input { font-size: 20px; font-weight: 700; padding-right: 60px; margin-bottom: 10px; }
.portion-result {
  display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 14px;
}
.portion-result strong { font-size: 20px; color: var(--accent); }
.portion-result span { font-size: 13px; color: var(--text-dim); }
.nut-del { margin-top: 10px; color: var(--bad); }
.scan-frame { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 4 / 3; margin-bottom: 10px; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line {
  position: absolute; left: 12%; right: 12%; top: 50%; height: 2px; background: var(--bad);
  box-shadow: 0 0 10px var(--bad); animation: scanline 1.6s ease-in-out infinite alternate;
}
@keyframes scanline { from { transform: translateY(-40px); } to { transform: translateY(40px); } }
.grocery-list { display: flex; flex-direction: column; }
.grocery-row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); cursor: pointer; }
.grocery-row input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; }
.grocery-name { flex: 1; font-size: 14px; }
.grocery-amt { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.grocery-row.checked .grocery-name, .grocery-row.checked .grocery-amt { text-decoration: line-through; opacity: .5; }

/* ==========================================================
   TRAINING — sets afvinken, voorstel, rusttimer, RPE (js/workout.js)
   ========================================================== */
.workout-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.workout-timer { font-size: 14px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-last.sug-up { color: var(--good); border-color: rgba(74,222,128,.35); }
.log-last.sug-down { color: var(--bad); border-color: rgba(248,113,113,.35); }
.log-prev { font-size: 11px; color: var(--text-dim); }
.log-input.suggested { color: var(--text-dim); font-style: italic; }
.set-check {
  flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--surface); color: var(--text-dim); font-size: 16px; font-weight: 800; cursor: pointer;
}
.set-check.on { background: var(--good); border-color: var(--good); color: #0b1a10; }
.set-line.set-done .log-input { opacity: .7; }
.set-line.set-done .set-label { color: var(--good); }
.set-partial { font-size: 12px; padding: 2px 0; align-self: flex-start; }

.rpe-overlay, .summary-overlay {
  position: absolute; inset: 0; z-index: 70; background: rgba(8,10,16,.85);
  display: flex; align-items: flex-end; justify-content: center;
}
.rpe-card {
  width: 100%; background: var(--surface); border-radius: 22px 22px 0 0; border: 1px solid var(--border);
  padding: 20px 16px calc(env(safe-area-inset-bottom) + 16px);
}
.rpe-title { font-size: 18px; font-weight: 700; margin: 0; }
.rpe-sub { font-size: 13px; color: var(--text-dim); margin: 2px 0 12px; }
.rpe-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 10px 12px;
  color: var(--text); cursor: pointer;
}
.rpe-num {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-weight: 800; color: #10131c;
}
.rpe-1 .rpe-num, .hist-rpe.rpe-1 { background: #93c5fd; }
.rpe-2 .rpe-num, .hist-rpe.rpe-2 { background: #86efac; }
.rpe-3 .rpe-num, .hist-rpe.rpe-3 { background: #fde047; }
.rpe-4 .rpe-num, .hist-rpe.rpe-4 { background: #fdba74; }
.rpe-5 .rpe-num, .hist-rpe.rpe-5 { background: #fca5a5; }
.rpe-txt { display: flex; flex-direction: column; gap: 2px; }
.rpe-txt strong { font-size: 14px; }
.rpe-txt span { font-size: 12px; color: var(--text-dim); }
.rpe-skip { background: none; border: none; color: var(--text-dim); width: 100%; padding: 8px; cursor: pointer; font-weight: 600; }

.rest-bar {
  position: absolute; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + 10px); z-index: 60;
  background: var(--surface-2); border: 1px solid var(--accent-dim); border-radius: 16px;
  padding: 10px 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); overflow: hidden;
}
.rest-left { display: flex; align-items: baseline; gap: 8px; }
.rest-lbl { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); font-weight: 700; }
.rest-time { font-size: 24px; color: var(--accent); font-variant-numeric: tabular-nums; }
.rest-bar.done .rest-time { color: var(--good); }
.rest-next { order: 3; width: 100%; font-size: 12px; color: var(--text-dim); }
.rest-btns { margin-left: auto; display: flex; gap: 6px; }
.rest-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.rest-btn.skip { color: var(--accent); }
.rest-fill { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .25s linear; }

.summary-overlay { align-items: center; padding: 20px; }
.summary-card { max-height: 100%; overflow-y: auto; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.summary-cell { background: var(--surface-2); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; text-align: center; }
.summary-cell strong { font-size: 17px; }
.summary-cell span { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .05em; }
.summary-pr-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin: 6px 0 4px; }
.summary-pr { font-size: 13px; margin: 2px 0; text-align: left; }

.ex-history { margin-top: 18px; }
.hist-stats { grid-template-columns: 1fr 1fr 1fr; }
.hist-spark-wrap { margin: 4px 0 10px; }
.hist-spark { width: 100%; height: 60px; }
.hist-spark polyline { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.hist-spark circle { fill: var(--accent); }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.hist-date { color: var(--text-dim); width: 42px; flex-shrink: 0; }
.hist-sets { flex: 1; min-width: 0; }
.hist-rpe { font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 999px; color: #10131c; }
.log-last { white-space: normal; overflow: visible; text-overflow: clip; }

/* ==========================================================
   HUISSTIJL · CHAT · RECEPTEN
   ========================================================== */
.brand-tagline { color: var(--text-dim); margin: -6px 0 10px; font-size: 14px; }
.brand-welcome { border-left: 3px solid var(--accent); font-size: 14px; line-height: 1.5; }
.brand-welcome h2, .brand-welcome h3 { margin: 0 0 6px; font-size: 17px; }
.brand-welcome p { margin: 0 0 8px; }
.brand-welcome p:last-child { margin-bottom: 0; }
.tab-icon { position: relative; }
.tab-badge {
  position: absolute; top: -4px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: var(--bad); color: #fff; font-size: 10px; font-weight: 800; line-height: 17px; text-align: center;
}

.view-chat.active { display: flex; flex-direction: column; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px 10px; min-height: 0; }
.chat-empty { margin: auto 0; text-align: center; }
.chat-day { align-self: center; font-size: 11px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 10px; margin: 8px 0 2px; text-transform: lowercase; }
.chat-msg { max-width: 82%; padding: 8px 12px 6px; border-radius: 16px; display: flex; flex-direction: column; gap: 2px; }
.chat-msg.mine { align-self: flex-end; background: var(--accent); color: #1d1d1d; border-bottom-right-radius: 4px; }
.chat-msg.theirs { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-name { font-size: 11px; font-weight: 700; color: var(--accent); }
.chat-body { font-size: 15px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.chat-time { font-size: 10px; opacity: .65; align-self: flex-end; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; padding-top: 8px; border-top: 1px solid var(--border); }
.chat-input { flex: 1; margin: 0; resize: none; max-height: 140px; line-height: 1.35; }
.chat-send { width: 48px; height: 48px; padding: 0; flex-shrink: 0; border-radius: 50%; font-size: 18px; }

.recipe-list { display: flex; flex-direction: column; gap: 8px; }
.recipe-card {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; cursor: pointer; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 8px;
}
.recipe-thumb {
  width: 64px; height: 64px; flex-shrink: 0; border-radius: 10px; background: var(--surface) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
}
.recipe-tags { font-size: 11px; color: var(--accent); }
.recipe-hero { width: 100%; max-height: 220px; object-fit: cover; border-radius: 14px; margin-bottom: 10px; }
.recipe-stepper { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.recipe-stepper strong { min-width: 30px; text-align: center; font-size: 18px; }
.recipe-ings { margin-bottom: 6px; }
.recipe-ing { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.recipe-steps { padding-left: 20px; margin: 4px 0 14px; font-size: 14px; line-height: 1.5; }
.recipe-steps li { margin-bottom: 6px; }
.nut-actions { flex-wrap: wrap; }
.nut-actions .btn { flex: 1 1 30%; }
.chat-msg.mine .chat-name { color: #1d1d1d; opacity: .65; }
