/* ==========================================================================
   Fitio – designsystem (mobile-first)
   ========================================================================== */

:root {
  /* Farver – lys */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --ink: #101828;
  --ink-2: #475467;
  --ink-3: #98a2b3;
  --line: #e6e8ec;

  --primary: #059669;
  --primary-strong: #047857;
  --primary-soft: #d1fae5;
  --primary-ink: #065f46;

  --kcal: #f97316;
  --kcal-soft: #ffedd5;
  --protein: #6366f1;
  --protein-soft: #e0e7ff;
  --carbs: #f59e0b;
  --carbs-soft: #fef3c7;
  --fat: #ec4899;
  --fat-soft: #fce7f3;

  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --ok: #059669;
  --ok-soft: #d1fae5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);

  --tabbar-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c111a;
    --surface: #151b26;
    --surface-2: #1d2432;
    --ink: #f2f4f7;
    --ink-2: #98a2b3;
    --ink-3: #667085;
    --line: #232b3a;

    --primary: #10b981;
    --primary-strong: #34d399;
    --primary-soft: #06301f;
    --primary-ink: #6ee7b7;

    --kcal-soft: #3b1d05;
    --protein-soft: #1e1b4b;
    --carbs-soft: #3a2703;
    --fat-soft: #3d0f27;
    --danger-soft: #3d0a0a;
    --warn-soft: #3a2703;
    --ok-soft: #06301f;

    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .5);
  }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }

/* Layout */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.view {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  /* Bundluft på alle sider: sidste knap skal altid kunne komme fri af tabbaren
     (og hjemmeindikatoren på iPhone), også når tabbaren er skjult. */
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-b) + 40px);
  outline: none;
}
.view.no-tabbar { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 40px); }

@media (min-width: 900px) {
  .view.wide { max-width: 1080px; }
}

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0 16px;
}
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.topbar .sub { color: var(--ink-2); font-size: 14px; }
.topbar .spacer { flex: 1; }
.back-btn {
  border: 0; background: var(--surface); color: var(--ink);
  width: 38px; height: 38px; border-radius: 50%;
  box-shadow: var(--shadow); cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; font-size: 18px;
}

/* Kort */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card + .card { margin-top: 12px; }
.card h2 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card .card-head h2 { margin-bottom: 0; }

.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3); margin: 20px 0 8px;
}

/* Knapper */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; cursor: pointer;
  font-weight: 700; font-size: 15px;
  padding: 13px 18px;
  background: var(--surface-2); color: var(--ink);
  transition: filter .15s, transform .05s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-strong); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-lg { padding: 16px 22px; font-size: 16px; }

.btn .spinner { width: 16px; height: 16px; border-width: 2px; }

/* Formularer */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
  appearance: none;
}
.input:focus { border-color: var(--primary); }
.input.error { border-color: var(--danger); }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.field .err { font-size: 12px; color: var(--danger); margin-top: 4px; }
.input-row { display: flex; gap: 10px; }
.input-row > * { flex: 1; }
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398a2b3' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  padding-right: 36px;
}

/* Segmented control / chips */
.seg {
  display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px;
}
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 9px;
  padding: 9px 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600;
  cursor: pointer; color: var(--ink-2);
  -webkit-tap-highlight-color: transparent;
}
.chip.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }

/* Valgkort (onboarding) */
.opt-list { display: grid; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  border: 1.5px solid var(--line); background: var(--surface);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.opt.active { border-color: var(--primary); background: var(--primary-soft); }
.opt .opt-emoji { font-size: 24px; }
.opt .opt-title { font-weight: 700; font-size: 15px; }
.opt .opt-desc { font-size: 13px; color: var(--ink-2); }
.opt.active .opt-desc { color: var(--primary-ink); }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 700; border-radius: 999px; padding: 3px 10px;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-muted { background: var(--surface-2); color: var(--ink-2); }
.badge-primary { background: var(--primary-soft); color: var(--primary-ink); }

/* Lister */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; font-size: 15px; }
.list-row .sub { font-size: 13px; color: var(--ink-2); }
.list-row.tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
#replace-picker .list-row.active { background: var(--primary-soft); border-radius: 10px; padding-left: 10px; padding-right: 10px; border-bottom-color: transparent; }

/* Progress ring */
.ring-wrap { display: grid; place-items: center; position: relative; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); }
.ring-bar { fill: none; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.ring-center .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.ring-center .lbl { font-size: 13px; color: var(--ink-2); font-weight: 600; }

/* Makro-bar */
.macro { margin-bottom: 12px; }
.macro:last-child { margin-bottom: 0; }
.macro .macro-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.macro .macro-name { font-weight: 700; }
.macro .macro-val { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.bar.protein > i { background: var(--protein); }
.bar.carbs > i { background: var(--carbs); }
.bar.fat > i { background: var(--fat); }
.bar.kcal > i { background: var(--kcal); }
.bar.over > i { background: var(--danger); }

/* Måltidskort */
.meal-row {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px; margin-bottom: 10px;
}
.meal-row .meal-img {
  width: 56px; height: 56px; border-radius: 12px; object-fit: cover;
  background: var(--surface-2); flex-shrink: 0;
  display: grid; place-items: center; font-size: 26px;
}
.meal-row .grow { flex: 1; min-width: 0; }
.meal-row .meal-actions { display: flex; flex-direction: column; gap: 6px; align-items: stretch; flex-shrink: 0; }
.meal-row .meal-actions .btn { white-space: nowrap; }
.meal-row .slot { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.meal-row .name { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal-row .kcal { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.meal-row.consumed { opacity: .62; }
.meal-row.consumed .name { text-decoration: line-through; }
.meal-row.skipped { opacity: .5; }

/* Ugedag-vælger */
.day-strip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.day-strip::-webkit-scrollbar { display: none; }
.day-pill {
  flex: 1; min-width: 44px; border: 0; cursor: pointer;
  background: var(--surface); border-radius: 12px; padding: 8px 4px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: var(--shadow); -webkit-tap-highlight-color: transparent;
}
.day-pill .dow { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--ink-3); }
.day-pill .dom { font-size: 16px; font-weight: 800; }
.day-pill .dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.day-pill.has-workout .dot { background: var(--kcal); }
.day-pill.active { background: var(--primary); }
.day-pill.active .dow, .day-pill.active .dom { color: #fff; }
.day-pill.today:not(.active) { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Tabbar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex; align-items: stretch; justify-content: space-around;
}
.tabbar[hidden] { display: none; }
.tab {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-3); font-size: 10.5px; font-weight: 700;
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--primary); }
.tab.tab-scan { position: relative; }
.tab-scan .scan-fab {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  margin-top: -26px; box-shadow: var(--shadow-lg);
}
.tab-scan .scan-fab svg { width: 25px; height: 25px; }

/* Bottom sheet */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(10, 14, 20, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .18s ease;
}
.sheet {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(18px + var(--safe-b));
  max-height: 88dvh; overflow-y: auto;
  animation: sheetUp .22s ease;
}
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 4px auto 14px; }
.sheet.sheet-tall { max-height: 92dvh; }

/* Accept af betingelser (flueben) */
.consent { text-align: left; margin: 14px 0 12px; }
.consent label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; font-size: 14px; line-height: 1.4; }
.consent input[type=checkbox] { flex: none; width: 20px; height: 20px; margin-top: 1px; accent-color: var(--primary); cursor: pointer; }
.consent a { font-weight: 700; text-decoration: underline; white-space: nowrap; }

/* Betingelser i modal (hentet fra fitio.dk) */
.legal { text-align: left; font-size: 14px; line-height: 1.55; }
.legal h2 { font-size: 15px; font-weight: 800; margin: 16px 0 6px; }
.legal h2:first-child { margin-top: 0; }
.legal p, .legal ul { margin: 0 0 10px; }
.legal ul { padding-left: 20px; }
.legal li { margin-bottom: 4px; }
.legal a { text-decoration: underline; }
.legal .muted { color: var(--ink-2); }
.trial-pill { display: inline-block; background: var(--ok-soft); color: var(--ok); font-weight: 800; font-size: 13px; padding: 4px 10px; border-radius: 999px; }
.sheet h2 { font-size: 18px; font-weight: 800; margin-bottom: 12px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Toast */
.toast-root {
  position: fixed; left: 0; right: 0; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  background: var(--ink); color: var(--bg);
  border-radius: 12px; padding: 11px 18px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: sheetUp .2s ease;
  max-width: 100%;
}
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--primary); color: #fff; }

/* Spinner / skeleton */
.spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; padding: 48px 0; }
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--line) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Empty state */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-2); }
.empty .emoji { font-size: 44px; margin-bottom: 10px; }
.empty h3 { font-size: 17px; font-weight: 800; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; }

/* Auth-skærme */
.auth-wrap {
  min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  max-width: 420px; margin: 0 auto; padding: 32px 22px;
}
.auth-logo { font-size: 34px; font-weight: 900; letter-spacing: -.03em; text-align: center; margin-bottom: 4px; }
.auth-logo span { color: var(--primary); }
.auth-sub { text-align: center; color: var(--ink-2); margin-bottom: 28px; font-size: 15px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--ink-2); }

/* Onboarding */
.ob-progress { display: flex; gap: 5px; margin-bottom: 20px; }
.ob-progress i { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-2); }
.ob-progress i.done { background: var(--primary); }
.ob-title { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 6px; }
.ob-sub { color: var(--ink-2); font-size: 14.5px; margin-bottom: 22px; }
.ob-actions { display: flex; gap: 10px; margin-top: 26px; }
.ob-actions .btn { flex: 1; }

/* Scanner */
.scan-video-wrap {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #000; aspect-ratio: 3 / 4; max-height: 60dvh;
}
.scan-video-wrap video { width: 100%; height: 100%; object-fit: cover; }
.scan-reticle {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
}
.scan-reticle i {
  width: 72%; height: 34%; border-radius: 14px;
  border: 3px solid rgba(255, 255, 255, .9);
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, .35);
}

/* Workout session */
.set-grid { display: grid; grid-template-columns: 44px 1fr 1fr 54px; gap: 8px; align-items: center; }
.set-grid .head { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; }
.set-grid .setno { font-weight: 800; text-align: center; color: var(--ink-2); }
.set-grid .input { text-align: center; padding: 10px 6px; }
.set-check {
  width: 44px; height: 44px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--surface-2); color: var(--ink-3); font-size: 18px;
  display: grid; place-items: center;
}
.set-check.done { background: var(--primary); color: #fff; }
.rest-timer {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px); z-index: 45;
  background: var(--ink); color: var(--bg);
  border-radius: 999px; padding: 10px 20px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg); font-weight: 800; font-variant-numeric: tabular-nums;
}
.rest-timer button { border: 0; background: transparent; color: inherit; font-weight: 700; cursor: pointer; font-size: 13px; opacity: .8; }

/* Favoritter & egne opskrifter */
.meal-row .fav-star { font-size: 12px; vertical-align: 1px; }
.fav-img {
  width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
  background: var(--surface-2); display: grid; place-items: center; font-size: 22px;
}
.photo-pick {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: var(--surface-2); border: 1.5px dashed var(--line); cursor: pointer; position: relative;
}
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick .photo-ph {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; font-size: 30px; color: var(--ink-3);
}
.photo-pick .photo-ph span { font-size: 13px; font-weight: 600; }
.ing-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin-top: 4px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); max-height: 260px; overflow-y: auto;
}
.ing-results button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; text-align: left; padding: 11px 12px; cursor: pointer;
  font-size: 14px; border-bottom: 1px solid var(--line);
}
.ing-results button:last-child { border-bottom: 0; }
.ing-results button:hover { background: var(--surface-2); }
.ing-row .ing-grams { display: flex; align-items: center; gap: 4px; }
.ing-row .ing-grams .input { width: 78px; padding: 8px 10px; text-align: right; }
.ing-row .ing-grams span { font-size: 13px; color: var(--ink-2); }

/* Statistik-kort */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-grid .card { margin: 0; }
.stat-num { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.stat-lbl { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }

/* Admin-tabel */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }

/* Diverse */
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tnum { font-variant-numeric: tabular-nums; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.flex .grow { flex: 1; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.right { text-align: right; }
.center-text { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

/* ==========================================================================
   Øvelser: animeret illustration, kropskort, detalje-sheet, vælger
   ========================================================================== */

/* To frames (start/slut) der skifter – opleves som en langsom GIF */
.ex-fig {
  position: relative; overflow: hidden; flex: none;
  background: var(--surface-2); border-radius: 12px;
  aspect-ratio: 3 / 2;
}
.ex-fig img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
}
.ex-fig img.alt { opacity: 0; animation: exFrames 2.6s ease-in-out infinite; }
@keyframes exFrames {
  0%, 38%  { opacity: 0; }
  50%, 88% { opacity: 1; }
  100%     { opacity: 0; }
}
.ex-fig-sm { width: 72px; border-radius: 10px; }
.ex-fig-md { width: 120px; }
.ex-fig-lg { width: 100%; max-height: 260px; margin-bottom: 12px; border-radius: 14px; }
.ex-fig-empty { display: grid; place-items: center; font-size: 26px; color: var(--ink-3); }
.ex-fig-empty.ex-fig-lg { font-size: 56px; }
@media (prefers-reduced-motion: reduce) {
  .ex-fig img.alt { animation: none; }
  .ex-fig:hover img.alt, .ex-fig:active img.alt { opacity: 1; }
}

/* Kropskort */
.bodymap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.bodymap .bm-toggle { width: 200px; }
.bodymap .bm-stage { position: relative; width: 150px; }
.bodymap.compact .bm-stage { width: 120px; }
.bodymap .bm-view { display: none; }
.bodymap .bm-view.active { display: block; }
.bodymap svg { width: 100%; height: auto; display: block; }
.bodymap .bm-body { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.bodymap .bm-muscle { fill: var(--ink-3); fill-opacity: .28; stroke: var(--surface); stroke-width: 1.2; transition: fill .15s, fill-opacity .15s; }
.bodymap.interactive .bm-muscle { cursor: pointer; outline: none; }
.bodymap.interactive .bm-muscle:hover, .bodymap.interactive .bm-muscle:focus-visible { fill: var(--primary); fill-opacity: .55; }
.bodymap .bm-muscle.selected { fill: var(--primary); fill-opacity: .95; }
.bodymap .bm-muscle.secondary { fill: var(--primary); fill-opacity: .4; }
.bodymap .bm-caption { min-height: 18px; text-align: center; font-weight: 600; }
.bodymap.compact .bm-toggle { width: 120px; }
.bodymap.compact .bm-toggle button { padding: 5px 0; font-size: 12px; }

/* Detalje-sheet */
.exd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.exd-body { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: start; }
@media (max-width: 380px) { .exd-body { grid-template-columns: 1fr; } }
.steps { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.5; }
.steps li { margin-bottom: 8px; }
.steps li::marker { font-weight: 800; color: var(--primary); }

/* Vælger */
.pk-row .grow .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Øvelsesrække i workout/session med thumbnail og handlinger */
.ex-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ex-row:last-child { border-bottom: 0; }
.ex-row .grow { flex: 1; min-width: 0; cursor: pointer; }
.ex-row .title { font-weight: 700; font-size: 15px; }
.ex-row .sub { font-size: 13px; color: var(--ink-2); }
.ex-actions { display: flex; flex-direction: column; gap: 4px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); font-size: 15px; display: grid; place-items: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.danger { color: var(--danger); }
.ex-thumbs { display: flex; gap: 6px; margin-bottom: 12px; }
.ex-thumbs .ex-fig { width: 56px; border-radius: 8px; }
.ex-thumbs .more { width: 56px; aspect-ratio: 3/2; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink-2); }

/* "Vis øvelsen": billeder er skjult indtil brugeren beder om dem */
.ex-show { padding: 6px 12px; font-size: 12.5px; white-space: nowrap; }
.ex-show.active { background: var(--primary-soft); color: var(--primary-ink); }
.ex-fig-slot { padding: 4px 0 12px; }
.ex-fig-slot .ex-fig-md { width: 100%; max-width: 320px; }
.ex-fig-slot .ex-fig-lg { margin-top: 4px; }
.ex-row-wrap { border-bottom: 1px solid var(--line); }
.ex-row-wrap:last-child { border-bottom: 0; }
.ex-row-wrap .ex-row { border-bottom: 0; }
.pk-row-wrap { border-bottom: 1px solid var(--line); }
.pk-row-wrap:last-child { border-bottom: 0; }
.pk-row-wrap .list-row { border-bottom: 0; }
.pk-row .ex-show { margin-right: -4px; }

/* Notice-bokse (fx "tid til at veje dig") */
.notice { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13.5px; line-height: 1.4; background: var(--surface-2); color: var(--ink); }
.notice-warn { background: var(--warn-soft); color: var(--ink); }
.notice .flex { margin-top: 8px; }

/* Vægtkurve */
.wc-wrap { position: relative; }
.wc { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; }
.wc-grid { stroke: var(--line); stroke-width: 1; }
.wc-tick { fill: var(--ink-3); font-size: 10.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.wc-target { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 4 3; }
.wc-area { fill: var(--primary); fill-opacity: .10; }
.wc-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.wc-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.wc-hover { fill: var(--primary); stroke: var(--surface); stroke-width: 2; pointer-events: none; }
.wc-cross { stroke: var(--ink-3); stroke-width: 1; pointer-events: none; }
.wc-end { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--font); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.wc-hit { cursor: crosshair; }
.wc-tip {
  position: absolute; pointer-events: none; z-index: 2;
  background: var(--ink); color: var(--surface); border-radius: 8px; padding: 6px 9px;
  font-size: 12px; line-height: 1.25; white-space: nowrap; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 1px;
}
.wc-tip b { font-size: 13px; }
.wc-tip span { opacity: .8; }
.seg-sm button { padding: 6px 6px; font-size: 12.5px; }

/* Toggle-switch */
.switch { position: relative; display: inline-block; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--ink-3); transition: background .2s; cursor: pointer;
}
.switch span::before {
  content: ""; position: absolute; width: 22px; height: 22px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; cursor: default; }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Fremskridtsbilleder */
.photo-slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.photo-slot {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; aspect-ratio: 3 / 4; border: 1.5px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); cursor: pointer; overflow: hidden; text-align: center;
}
.photo-slot:hover { border-color: var(--primary); }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot.has-photo { border-style: solid; }
.photo-slot.busy { opacity: .5; pointer-events: none; }
.photo-slot-plus { font-size: 22px; color: var(--ink-3); line-height: 1; }
.photo-slot-lbl {
  position: relative; z-index: 1; font-size: 11px; font-weight: 600; color: var(--ink-2); padding: 0 2px;
}
.photo-slot.has-photo .photo-slot-lbl {
  position: absolute; bottom: 0; left: 0; right: 0; padding: 10px 2px 4px; color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .55));
}
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.photo-fig { margin: 0; }
.photo-fig img { width: 100%; border-radius: var(--radius-sm); display: block; }
.photo-fig figcaption {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; color: var(--ink-2); margin-top: 4px; min-height: 24px;
}

/* Indkøbsliste */
.shop-check { position: relative; display: inline-block; width: 26px; height: 26px; flex-shrink: 0; cursor: pointer; }
.shop-check input { opacity: 0; width: 0; height: 0; position: absolute; }
.shop-check span {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--ink-3); background: var(--surface); transition: all .15s;
}
.shop-check span::after {
  content: ""; position: absolute; left: 8px; top: 4px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); opacity: 0;
}
.shop-check input:checked + span { background: var(--primary); border-color: var(--primary); }
.shop-check input:checked + span::after { opacity: 1; }
.shop-check input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.shop-row.is-checked .shop-name { text-decoration: line-through; color: var(--ink-3); }
.shop-row.is-checked .sub { color: var(--ink-3); }
