/* ========================================================================
   Makrokoll — Balans
   Warm surfaces, forest-green actions and a quiet, consistent hierarchy.
   Existing component selectors are retained for both app versions.
   ======================================================================== */

/* ----------------------------------------------------------------- Design tokens */
:root {
  color-scheme: light;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --bg: #f6f3eb;
  --surface: #fffefa;
  --surface-2: #edf0e6;
  --surface-3: #e2e8db;
  --hero-surface: #e6eddf;
  --glass: rgba(246, 243, 235, 0.96);
  --glass-strong: rgba(255, 254, 250, 0.98);
  --line: rgba(38, 61, 51, 0.12);
  --line-2: rgba(38, 61, 51, 0.24);
  --text: #263d33;
  --muted: #5d7165;
  --muted-2: #65766d;

  --accent: #356b51;
  --accent-soft: rgba(53, 107, 81, 0.10);
  --accent-dim: rgba(53, 107, 81, 0.18);
  --accent-ink: #ffffff;
  --accent-rgb: 53, 107, 81;
  --macro-p: #356b51;
  --macro-c: #8d683b;
  --macro-f: #627686;
  --carb: var(--macro-c);
  --fat: var(--macro-f);
  --danger: #b4463d;
  --danger-soft: rgba(180, 70, 61, 0.09);
  --success: var(--accent);
  --warning: #876125;

  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", "Cascadia Code", monospace;
  --font-display: Georgia, "Times New Roman", serif;
  --fs-xxs: 11px;
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: 26px;
  --fs-logo: 23px;
  --fs-title: 34px;
  --fs-num: 52px;

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 30px;
  --r-full: 9999px;
  --radius-xs: var(--r-xs);
  --radius-sm: var(--r-sm);
  --s1: 2px;
  --s2: 4px;
  --s3: 8px;
  --s4: 12px;
  --s5: 20px;
  --s6: 24px;
  --s7: 32px;
  --s8: 40px;

  --page-width: 620px;
  --nav-h: 68px;
  --fab-h: 50px;
  --bottom-space: calc(var(--fab-h) + var(--nav-h) + var(--safe-b) + 48px);
  --shadow-sm: 0 2px 8px rgba(30, 48, 36, 0.035);
  --shadow-float: 0 8px 28px rgba(30, 48, 36, 0.12);
  --shadow-sheet: 0 -12px 48px rgba(20, 35, 25, 0.16);
  --backdrop: rgba(20, 30, 23, 0.38);

  --ease: cubic-bezier(0.2, 0, 0.2, 1);
  --spring: var(--ease);
  --sheet-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 0.14s;
  --dur: 0.2s;
  --dur-slow: 0.28s;
}

body:is(.theme-dark, .theme-midnight, .theme-ocean, .theme-rose, .theme-forest, .theme-amoled, .theme-sunset) {
  color-scheme: dark;
  --bg: #141b17;
  --surface: #202b24;
  --surface-2: #29372d;
  --surface-3: #354538;
  --hero-surface: #2b3d2e;
  --glass: rgba(20, 27, 23, 0.96);
  --glass-strong: rgba(32, 43, 36, 0.98);
  --line: rgba(224, 238, 216, 0.12);
  --line-2: rgba(224, 238, 216, 0.24);
  --text: #edf2e9;
  --muted: #b0bdaf;
  --muted-2: #a0afa0;
  --accent: #a8c8a7;
  --accent-soft: rgba(168, 200, 167, 0.10);
  --accent-dim: rgba(168, 200, 167, 0.18);
  --accent-ink: #152519;
  --accent-rgb: 168, 200, 167;
  --macro-p: #a8c8a7;
  --macro-c: #d3b586;
  --macro-f: #a0b9c7;
  --danger: #edaaa1;
  --danger-soft: rgba(237, 170, 161, 0.10);
  --warning: #d3b586;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 8px 28px rgba(0, 0, 0, 0.24);
  --shadow-sheet: 0 -12px 48px rgba(0, 0, 0, 0.32);
  --backdrop: rgba(8, 15, 10, 0.60);
}

/* ----------------------------------------------------------------- Themes */
body.theme-light { color-scheme: light; }

/* Personal themes share Balans components and inherit the dark text tokens. */
body.theme-midnight {
  --bg: #171b29;
  --surface: #232a3a;
  --surface-2: #2d3548;
  --surface-3: #3b455c;
  --hero-surface: #2d3548;
  --glass: rgba(23, 27, 41, 0.96);
  --glass-strong: rgba(35, 42, 58, 0.98);
  --accent: #bdbee4;
  --accent-soft: rgba(189, 190, 228, 0.10);
  --accent-dim: rgba(189, 190, 228, 0.18);
  --accent-ink: #202238;
  --accent-rgb: 189, 190, 228;
}
body.theme-ocean {
  --bg: #172126;
  --surface: #23323a;
  --surface-2: #2e414a;
  --surface-3: #3c525d;
  --hero-surface: #2e414a;
  --glass: rgba(23, 33, 38, 0.96);
  --glass-strong: rgba(35, 50, 58, 0.98);
  --accent: #a0c8d4;
  --accent-soft: rgba(160, 200, 212, 0.10);
  --accent-dim: rgba(160, 200, 212, 0.18);
  --accent-ink: #142c35;
  --accent-rgb: 160, 200, 212;
}
body.theme-rose {
  --bg: #251c23;
  --surface: #362932;
  --surface-2: #463640;
  --surface-3: #58444f;
  --hero-surface: #463640;
  --glass: rgba(37, 28, 35, 0.96);
  --glass-strong: rgba(54, 41, 50, 0.98);
  --accent: #d8b2c4;
  --accent-soft: rgba(216, 178, 196, 0.10);
  --accent-dim: rgba(216, 178, 196, 0.18);
  --accent-ink: #36202b;
  --accent-rgb: 216, 178, 196;
}
body.theme-forest {
  --bg: #142019;
  --surface: #203328;
  --surface-2: #2b4232;
  --surface-3: #3b5340;
  --hero-surface: #2b4232;
  --glass: rgba(20, 32, 25, 0.96);
  --glass-strong: rgba(32, 51, 40, 0.98);
  --accent: #b0caa6;
  --accent-soft: rgba(176, 202, 166, 0.10);
  --accent-dim: rgba(176, 202, 166, 0.18);
  --accent-ink: #182b1b;
  --accent-rgb: 176, 202, 166;
}
body.theme-amoled {
  --bg: #000000;
  --surface: #111713;
  --surface-2: #1c261f;
  --surface-3: #2a362d;
  --hero-surface: #1c261f;
  --glass: rgba(0, 0, 0, 0.98);
  --glass-strong: rgba(17, 23, 19, 0.98);
}
body.theme-sunset {
  --bg: #261e19;
  --surface: #372b24;
  --surface-2: #48382d;
  --surface-3: #594636;
  --hero-surface: #48382d;
  --glass: rgba(38, 30, 25, 0.96);
  --glass-strong: rgba(55, 43, 36, 0.98);
  --accent: #dfbc93;
  --accent-soft: rgba(223, 188, 147, 0.10);
  --accent-dim: rgba(223, 188, 147, 0.18);
  --accent-ink: #342317;
  --accent-rgb: 223, 188, 147;
}

/* Colorblind mode — can combine with any theme */
body.colorblind {
  --accent: #255d9e;
  --accent-soft: rgba(37, 93, 158, 0.10);
  --accent-dim: rgba(37, 93, 158, 0.18);
  --accent-ink: #ffffff;
  --accent-rgb: 37, 93, 158;
  --macro-p: #255d9e;
  --macro-c: #85671b;
  --macro-f: #8a517e;
  --carb: var(--macro-c);
  --fat: var(--macro-f);
}
body.colorblind:not(.theme-light) {
  --accent: #9ec7f6;
  --accent-soft: rgba(158, 199, 246, 0.10);
  --accent-dim: rgba(158, 199, 246, 0.18);
  --accent-ink: #172536;
  --accent-rgb: 158, 199, 246;
  --macro-p: #9ec7f6;
  --macro-c: #e4cd87;
  --macro-f: #d3a7cb;
}

/* ----------------------------------------------------------------- Base */
*, *::before, *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  background-image: none;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

::selection { background: var(--accent); color: var(--accent-ink); }
[hidden] { display: none !important; }

button, input, select, textarea {
  font: inherit;
  letter-spacing: inherit;
}

button {
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 400; }

b, strong { font-variant-numeric: tabular-nums; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

body.lock { overflow: hidden; touch-action: none; }

/* Background image overlay */
body.has-bg {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
}
body.has-bg::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, var(--bg-overlay, 0.82));
  backdrop-filter: blur(var(--bg-blur, 0px));
  -webkit-backdrop-filter: blur(var(--bg-blur, 0px));
}
body.theme-light.has-bg::before { background: rgba(255, 255, 255, var(--bg-overlay, 0.82)); }

/* ----------------------------------------------------------------- Layout */
#app { position: relative; width: 100%; min-height: 100vh; min-height: 100dvh; }

.page {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: calc(var(--s6) + var(--safe-t)) max(var(--s5), var(--safe-l)) var(--bottom-space) max(var(--s5), var(--safe-r));
  animation: pageFade var(--dur) var(--ease);
}

.main { max-width: var(--page-width); margin: 0 auto; }

@keyframes pageFade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ----------------------------------------------------------------- Top bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--s4) + var(--safe-t)) 0 var(--s5);
  gap: var(--s3);
}

.logo {
  font-family: var(--font-sans);
  font-size: var(--fs-logo);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
  cursor: pointer;
}
.logo span { color: var(--accent); }

.streak {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  padding: 6px 12px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
}
.streak::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.offline {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--danger);
  background: var(--danger-soft);
  padding: 4px 10px;
  border-radius: var(--r-full);
  text-transform: none;
  letter-spacing: 0.04em;
}

/* ----------------------------------------------------------------- Date nav */
.datenav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s5);
}
.datenav button {
  color: var(--accent);
  font-size: var(--fs-xl);
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.datenav button:hover { background: var(--surface-2); }
.datenav button:active { transform: scale(0.90); }
.datenav button:disabled { opacity: 0.25; }
.datenav .datelabel {
  flex: 1;
  font-size: var(--fs-lg);
  font-weight: 600;
  text-align: center;
  text-transform: capitalize;
}
.datenav .datemore {
  width: 44px;
  height: 44px;
  font-size: var(--fs-md);
  color: var(--muted);
  font-weight: 600;
  border-radius: var(--r-sm);
  flex-shrink: 0;
}
.datenav .datemore.on { color: var(--accent); background: var(--surface-2); }

.daymenu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: -4px 0 var(--s5);
  padding: var(--s2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.daymenu button {
  width: 100%;
  text-align: left;
  min-height: 42px;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
}
.daymenu button:active { background: var(--surface-2); }

/* ----------------------------------------------------------------- Titles */
.title {
  font-family: var(--font-display);
  font-size: clamp(30px, 5vw, var(--fs-title));
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin-bottom: var(--s6);
  overflow-wrap: anywhere;
}
.title small {
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 500;
}

/* ----------------------------------------------------------------- Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s5);
  margin-bottom: var(--s5);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
/* Card entrance animation only on first page render, not on every innerHTML rebuild */
.page.is-fresh .card { animation: cardEnter var(--dur) var(--ease) backwards; }
.page.is-fresh .card:nth-child(1) { animation-delay: 0s; }
.page.is-fresh .card:nth-child(2) { animation-delay: 0.03s; }
.page.is-fresh .card:nth-child(3) { animation-delay: 0.06s; }
.page.is-fresh .card:nth-child(4) { animation-delay: 0.09s; }
.page.is-fresh .card:nth-child(n+5) { animation-delay: 0.12s; }
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.card.glow { border-left: 1px solid var(--line); }
.card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  color: var(--text);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: var(--s4);
}
.card h3 svg { color: var(--accent); flex-shrink: 0; }
.card h2 {
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ----------------------------------------------------------------- Hero */
.hero {
  text-align: left;
  padding: var(--s6);
  background: var(--hero-surface);
  border: 1px solid transparent;
  border-radius: var(--r-xl);
  margin-bottom: var(--s5);
  box-shadow: none;
}
.hero-k {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
}
.hero-num {
  font-family: var(--font-sans);
  font-size: clamp(40px, 8vw, var(--fs-num));
  font-weight: 500;
  line-height: 1.1;
  margin: var(--s3) 0 var(--s5);
  color: var(--text);
  letter-spacing: -0.05em;
}
.hero-num small {
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--muted);
  margin-left: 4px;
}
.hero-num.over { color: var(--danger); }

/* Progress gauge */
.gauge {
  height: 7px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-bottom: var(--s4);
}
.gauge i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.5s var(--ease);
}
.gauge.over i { background: var(--danger); }
.gauge-empty i { width: 4px !important; }

/* Progress ring */
.progress-ring-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin: 0 auto var(--s4);
}
.progress-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-ring circle.bg {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 10;
}
.progress-ring circle.progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s var(--ease);
}
.progress-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.progress-ring-text b {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text);
}
.progress-ring-text small {
  font-size: var(--fs-xxs);
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.05em;
}

.hero-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--s5);
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--s2);
}
.hero-meta span { display: flex; align-items: baseline; gap: 6px; }
.hero-meta b { color: var(--text); font-weight: 600; font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: var(--fs-md); }

/* ----------------------------------------------------------------- Macros */
.macros {
  text-align: left;
  margin-top: var(--s4);
  padding-top: var(--s4);
  border-top: 1px solid var(--line);
}
.macro {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--line);
}
.macro:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.macro-h {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 5px;
}
.macro-h .muted { font-weight: 400; color: var(--muted); font-size: var(--fs-xs); }
.bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: var(--r-full);
  background: var(--macro-p);
  transition: width 0.5s var(--ease);
}
/* Per-macro colors via dedicated variables — set on the bar's <i> in JS with inline style */
.bar-empty { background: var(--surface-3); }
.bar-empty i { width: 4px !important; }

.hero .macros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s4);
  padding-top: var(--s5);
  margin-top: var(--s5);
}
.hero .macros:has(.macro:only-child) { grid-template-columns: 1fr; }
.hero .macro { margin: 0; padding: 0; border: 0; min-width: 0; }
.hero .macro-h { flex-direction: column; align-items: flex-start; gap: 5px; font-size: var(--fs-xs); font-weight: 500; }
.hero .macro-h .muted { font-size: var(--fs-xs); color: var(--text); font-weight: 500; }
.hero .bar { height: 3px; margin-top: 8px; }
.hero .hero-meta b { font-family: var(--font-sans); font-size: var(--fs-sm); font-weight: 500; }

/* ----------------------------------------------------------------- Mini cards (duo) */
.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.mini {
  padding: var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-height: 124px;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.duo + .mini { margin-bottom: var(--s5); }
.mini-h {
  font-size: var(--fs-xxs);
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.mini-x {
  font-size: var(--fs-sm);
  line-height: 1;
  color: var(--muted);
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-xs);
  transition: color var(--dur-fast), background var(--dur-fast);
}
.mini-x:active { color: var(--accent); background: var(--accent-soft); }
.mini-v {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.mini-v small {
  font-family: var(--font-sans);
  font-size: var(--fs-xxs);
  color: var(--muted);
  font-weight: 500;
  margin-left: 2px;
}
.mini-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.mini-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.4s var(--ease);
}
.mini-acts { display: flex; gap: 6px; margin-top: auto; }
.mini-acts button {
  flex: 1;
  min-height: 40px;
  padding: 8px 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  background: var(--surface-2);
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.mini-acts button:active { background: var(--surface-3); transform: scale(0.94); }
.mini-acts button.primary { background: var(--accent); color: var(--accent-ink); }
.mini-acts button.tiny { flex: 0 0 34px; color: var(--muted); }
.water-card { margin-bottom: var(--s5); min-height: 0; background: var(--surface); }
.water-card .mini-h { color: var(--text); font-size: var(--fs-sm); font-weight: 500; }
.water-card .mini-v { font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 500; }
.water-card .mini-acts button { background: var(--accent-soft); color: var(--accent); border-radius: var(--r-full); }
.water-card .mini-bar { height: 3px; }
.water-card .mini-bar i { opacity: 0.8; }

/* Cardio compact */
.cardio-compact { padding: var(--s3) var(--s4) !important; margin-bottom: var(--s3) !important; }
.cc-main { display: flex; align-items: center; gap: var(--s3); }
.cc-ico { display: flex; color: var(--accent); flex: 0 0 auto; }
.cc-ico svg { width: 18px; height: 18px; }
.cc-txt { flex: 1 1 auto; min-width: 0; font-size: var(--fs-sm); line-height: 1.3; }
.cc-txt b { font-weight: 600; }
.cc-txt em { display: block; font-style: normal; font-size: var(--fs-xxs); color: var(--muted); }
.cc-add {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: var(--r-xs);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
}
.cc-add:active { transform: scale(0.9); }
.cc-list { display: flex; flex-wrap: wrap; gap: 4px; margin-top: var(--s3); }
.cc-list .chip { font-size: var(--fs-xxs); padding: 3px 8px; display: inline-flex; align-items: center; gap: 4px; }
.cc-list .chip svg { width: 10px; height: 10px; }

/* ----------------------------------------------------------------- Day note */
.note-card {
  margin-bottom: var(--s5);
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.note-card h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.note-text {
  width: 100%;
  min-height: 90px;
  padding: var(--s4);
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  resize: vertical;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.note-text:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ----------------------------------------------------------------- Meals */
.meal {
  padding: var(--s5);
  margin-bottom: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: none;
  min-width: 0;
}
.meal-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s1) 0 var(--s4);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s2);
}
.meal-h > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.meal-h b { font-size: var(--fs-md); font-weight: 500; letter-spacing: -0.015em; }
.meal-h small { color: var(--muted); font-size: var(--fs-sm); }
.meal-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ghost-link {
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 6px 8px;
  min-height: 32px;
}
.meal.compact { padding: var(--s3) var(--s5); }
.meal.compact .meal-h { padding: 2px 0; }

.plus {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: var(--r-sm);
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  transition: transform var(--dur) var(--spring), background var(--dur-fast);
}
.plus:hover { background: var(--accent-dim); }
.plus:active { transform: scale(0.88); background: var(--accent); color: var(--accent-ink); }

/* Meal photos */
.meal-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
  margin-top: var(--s4);
}
.meal-photo {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: transform var(--dur-fast);
}
.meal-photo:hover { transform: scale(1.03); }
.meal-photo img { width: 100%; height: 100%; object-fit: cover; }

/* ----------------------------------------------------------------- Entries */
.entry {
  display: flex;
  align-items: center;
  width: 100%;
  gap: var(--s4);
  text-align: left;
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  transition: opacity var(--dur-fast);
}
.entry:active { opacity: 0.6; }
.entry:last-child { border-bottom: 0; }
.e-name { flex: 1; min-width: 0; }
.e-name > span {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.e-name small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xxs);
  margin-top: 2px;
}
.e-k {
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  flex-shrink: 0;
}

/* ----------------------------------------------------------------- Buttons */
.btn {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 12px var(--s5);
  border-radius: var(--r-full);
  font-size: var(--fs-md);
  font-weight: 500;
  text-align: center;
  margin-top: var(--s4);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  font-weight: 500;
}
button:disabled, .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; vertical-align: middle; }
.row-inp > .inp { flex: 1; }
.row-inp > .btn { min-width: 0; }
.two { min-width: 0; }
.two > .btn { min-width: 0; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-2);
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid transparent;
}
.btn.sm {
  min-height: 40px;
  padding: 8px var(--s4);
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
  margin-top: var(--s3);
  width: fit-content;
  max-width: 100%;
}

/* Secondary outlined button — "Vad är du sugen på?" */
.btn-sugen {
  width: 100%;
  margin-bottom: var(--s5);
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--text);
  min-height: var(--fab-h);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  text-align: center;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.btn-sugen:active { background: var(--accent-soft); transform: scale(0.97); }

/* ----------------------------------------------------------------- Inputs */
.row-inp { display: flex; gap: var(--s3); align-items: stretch; }
.row-inp .btn { margin-top: 0; flex-shrink: 0; width: auto; padding: 10px var(--s4); }

.inp {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 12px var(--s4);
  border-radius: var(--r-md);
  background: var(--bg);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: var(--fs-md);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.inp::placeholder { color: var(--muted-2); }
.inp:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.inp.big {
  font-family: var(--font-mono);
  font-size: var(--fs-2xl);
  font-weight: 600;
  text-align: center;
  padding: 14px;
  letter-spacing: -0.01em;
}

.lbl, .field label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: var(--s3) 0 6px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.01em;
}
.field { margin-bottom: var(--s2); min-width: 0; }

select.inp {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* ----------------------------------------------------------------- Grid */
.grid2, .grid3, .grid4 { display: grid; gap: var(--s4); }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.grid2 > *, .grid3 > *, .grid4 > * { min-width: 0; }
.two { display: flex; gap: var(--s3); }
.two .btn { flex: 1; margin-top: var(--s4); }

/* ----------------------------------------------------------------- Chips & Segments */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s3) 0 var(--s3); }
.chip {
  min-height: 40px;
  height: auto;
  padding: 8px 14px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid transparent;
  transition: background var(--dur-fast), transform var(--dur-fast) var(--spring);
}
.chip:active { transform: scale(0.92); }
.chip.on {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 4px;
  gap: 4px;
  margin-bottom: var(--s5);
}
.seg button {
  flex: 1 1 64px;
  min-width: 0;
  min-height: 40px;
  padding: 6px;
  border-radius: var(--r-xs);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast);
}
.seg button.on {
  background: var(--surface);
  color: var(--accent);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* ----------------------------------------------------------------- Bottom nav */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--line);
}
.nav-in {
  max-width: var(--page-width);
  margin: 0 auto;
  height: var(--nav-h);
  display: flex;
  padding: 6px max(var(--s3), var(--safe-l)) 6px max(var(--s3), var(--safe-r));
  gap: 3px;
  justify-content: space-around;
}
.nav button {
  position: relative;
  flex: 1;
  max-width: 112px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 2px;
  color: var(--muted);
  font-size: var(--fs-xxs);
  font-weight: 500;
  border-radius: var(--r-sm);
  transition: color var(--dur-fast);
}
.nav button:active { transform: scale(0.94); transition-duration: 0.1s; }
.nav button svg { width: 20px; height: 20px; margin-bottom: 3px; }
.nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav button.on { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.nav button.on::after {
  content: '';
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}
.nav button:hover:not(.on) { color: var(--text); }

/* ----------------------------------------------------------------- FAB bar */
.fabar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 49;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  display: flex;
  gap: 12px;
  padding: 0 var(--s5);
  max-width: var(--page-width);
  margin: 0 auto;
}
.fab {
  flex: 1;
  min-height: var(--fab-h);
  padding: 12px var(--s5);
  border-radius: var(--r-full);
  font-weight: 500;
  font-size: var(--fs-md);
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow-float);
  transition: transform var(--dur) var(--spring), box-shadow var(--dur-fast);
}
.fab:hover { filter: brightness(1.04); box-shadow: var(--shadow-float); }
.fab:active { transform: scale(0.94); }
.fab-scan {
  width: var(--fab-h);
  height: var(--fab-h);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  transition: transform var(--dur) var(--spring), background var(--dur-fast);
}
.fab-scan:hover { background: var(--surface-3); }
.fab-scan:active { transform: scale(0.9); }
.fab-scan svg { width: 20px; height: 20px; }

/* ----------------------------------------------------------------- Bottom sheet */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  animation: fadeIn var(--dur) ease;
  cursor: pointer;
}
.sheet {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s5) var(--s6) calc(var(--s8) + var(--safe-b));
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  border-top: 1px solid var(--line-2);
  box-shadow: var(--shadow-sheet);
  animation: slideUp var(--dur-slow) var(--sheet-ease);
  cursor: auto;
}
.sheet::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--muted-2);
  margin: 0 auto var(--s5);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.sh-head {
  display: flex;
  align-items: center;
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.sh-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.sh-title small {
  display: block;
  font-size: var(--fs-sm);
  color: var(--muted);
  font-weight: 400;
  margin-top: 2px;
}
.ico {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 0;
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--muted);
  transition: background var(--dur-fast), transform var(--dur-fast) var(--spring);
}
.ico:active { background: var(--surface-3); transform: scale(0.90); }

/* Alternate sheet headers used by existing editors. */
.sheet-head, .sheet-header { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s5); }
.sheet-head h2, .sheet-header h2 { margin: 0; min-width: 0; font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 400; }
.sheet-body { min-width: 0; }
.sheet-head .close, .sheet-header .sheet-close { width: 44px; height: 44px; display: grid; place-items: center; flex-shrink: 0; border-radius: var(--r-full); background: var(--surface-2); color: var(--muted); }
.sh-title { font-weight: 500; }
.sheet .chip { max-width: 100%; overflow-wrap: anywhere; }
.sheet span.chip { display: inline-block; height: auto; white-space: normal !important; }
.sheet .row-inp { flex-wrap: wrap; }
.sheet .row-inp .inp { flex: 1 1 80px; }
.sheet .row-inp .btn { flex: 0 1 auto; }
.workout-badge { display: inline-block; margin-left: 6px; padding: 3px 7px; border-radius: var(--r-xs); background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xxs); font-weight: 500; line-height: 1.4; white-space: normal; vertical-align: middle; }
.workout-badge.primary { background: var(--accent); color: var(--accent-ink); }
.workout-badge.secondary { background: var(--surface-3); color: var(--muted); }

/* ----------------------------------------------------------------- Search */
.searchrow { display: flex; gap: var(--s3); align-items: stretch; margin-top: var(--s4); }
.searchrow .inp { flex: 1; }
.scan {
  width: 46px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--dur) var(--spring), background var(--dur-fast);
}
.scan:active { background: var(--surface-3); transform: scale(0.92); }
.scan svg { width: 20px; height: 20px; }

/* Scanner */
.scanbox {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #000;
  margin-bottom: var(--s4);
}
.scanbox video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ----------------------------------------------------------------- Rows & lists */
.row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--s4);
  text-align: left;
  padding: var(--s3) var(--s2);
  border-bottom: 1px solid var(--line);
  transition: opacity var(--dur-fast);
}
.row:active { opacity: 0.65; }
.row-main { flex: 1; min-width: 0; }
.row-main b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-main small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xxs);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chev { color: var(--muted-2); font-size: var(--fs-lg); flex-shrink: 0; }

.listrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
}
.listrow:last-child { border-bottom: 0; }
.listrow span { font-size: var(--fs-sm); min-width: 0; }
.listrow small { color: var(--muted); font-size: var(--fs-xxs); }
.listrow button {
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 5px 12px;
  min-height: 30px;
  background: var(--accent-soft);
  border-radius: var(--r-full);
  flex-shrink: 0;
  transition: transform var(--dur) var(--spring);
}
.listrow button:active { transform: scale(0.90); }

/* ----------------------------------------------------------------- Summary */
.sum { text-align: center; margin: var(--s4) 0 var(--s3); }
.sum b {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.sum div { font-size: var(--fs-xxs); color: var(--muted); margin-top: 2px; }

/* ----------------------------------------------------------------- Charts */
.chart {
  width: 100%;
  height: auto;
  margin-top: var(--s4);
  overflow: visible;
}
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-sans); }
.chart .bar-b { fill: var(--accent); }
.chart .bar-b.over { fill: var(--danger); }
.chart .goalline { stroke: var(--muted-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .trend {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.chart .dot { fill: var(--accent); }

/* Weight chart */
.weight-chart { overflow: visible; }
.weight-trend {
  stroke: var(--accent);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawLine 1.5s ease-out forwards;
}
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.weight-dot {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2;
  cursor: pointer;
  transition: r var(--dur-fast);
}
.weight-dot:hover { r: 6; }
.area { opacity: 0.15; }

/* ----------------------------------------------------------------- Big stats */
.bigstats { display: grid; gap: var(--s4); margin-bottom: var(--s3); }
.bigstats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bigstats.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bigstats > div {
  text-align: center;
  min-width: 0;
  padding: var(--s4);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.bigstats b {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--accent);
}
.bigstats span { display: block; font-size: var(--fs-xxs); color: var(--muted); margin-top: 2px; }
@media (min-width: 380px) { .bigstats.four { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ----------------------------------------------------------------- Copy card */
.copycard {
  width: 100%;
  min-height: 46px;
  padding: 14px var(--s4);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  color: var(--muted);
  font-weight: 600;
  font-size: var(--fs-md);
  margin-bottom: var(--s4);
  text-align: center;
  transition: color var(--dur-fast), border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--spring);
}
.copycard:active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(0.97);
}

/* ----------------------------------------------------------------- Undo banner */
.undo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s4);
  background: var(--accent-soft);
  border-radius: var(--r-md);
  border-left: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.undo span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo b { font-weight: 600; color: var(--accent); }
.undo button {
  color: var(--accent);
  font-weight: 600;
  font-size: var(--fs-sm);
  padding: 6px 14px;
  min-height: 32px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
  transition: transform var(--dur) var(--spring), background var(--dur-fast);
}
.undo button:hover { background: var(--accent); color: var(--accent-ink); }
.undo button:active { transform: scale(0.92); }

/* ----------------------------------------------------------------- Helpers */
.sec {
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
  margin: var(--s6) var(--s2) var(--s4);
  text-transform: none;
  letter-spacing: 0.01em;
}
.linkbtn {
  width: 100%;
  min-height: 40px;
  padding: var(--s2) 0;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-align: left;
}
.muted { color: var(--muted); font-size: var(--fs-sm); }
.photo { margin: var(--s2) 0 var(--s4); }
.photo img { width: 100%; border-radius: var(--r-sm); margin-bottom: 6px; }
.pad { padding: var(--s4) var(--s2); }
.det summary { cursor: pointer; color: var(--muted); font-size: var(--fs-md); font-weight: 500; padding: var(--s2) 0; }
.empty { text-align: center; color: var(--muted); padding: var(--s8) 0; font-size: var(--fs-md); }

/* Settings groups */
.settings-group {
  margin: 0 0 var(--s3);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}
.settings-group > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: var(--s4) var(--s5);
  color: var(--text);
  font-weight: 600;
  list-style: none;
}
.settings-group > summary::-webkit-details-marker { display: none; }
.settings-group > summary::after {
  content: '+';
  margin-left: auto;
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
}
.settings-group[open] > summary { border-bottom: 1px solid var(--line); }
.settings-group[open] > summary::after { content: '\2212'; }
.settings-group > summary span { flex: 0 0 auto; }
.settings-group > summary small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-group-body { padding: var(--s4); }
.settings-group-body > .card:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------------- Switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--s5); }
.switch b { font-size: var(--fs-md); font-weight: 500; }
.switch small { color: var(--muted); font-size: var(--fs-sm); }
.switch input {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: var(--r-full);
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--dur) var(--ease);
}
.switch input::before {
  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, 0.2);
  transition: transform var(--dur) var(--spring);
}
.switch input:checked { background: var(--accent); }
.switch input:checked::before { transform: translateX(18px); }

/* ----------------------------------------------------------------- Theme picker */
.themes { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; margin-bottom: var(--s5); }
.theme-dot {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 6px solid var(--surface);
  outline: 1px solid var(--line-2);
  background: var(--surface);
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--spring), box-shadow var(--dur-fast);
}
.theme-dot.on { box-shadow: inset 0 0 0 2.5px var(--accent); transform: scale(1.08); }
.theme-dot[style*="--dot:"] { background: var(--dot) !important; }

.accent-row { display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap; }
.accent-row input[type="color"] {
  width: 44px;
  height: 44px;
  border: 2px solid var(--line-2);
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}
.accent-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.accent-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }

/* ----------------------------------------------------------------- Onboarding */
.ob {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: var(--s8) var(--s5) var(--s6);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ob-top { padding: var(--s5) 0 var(--s8); text-align: center; }
.ob-top .logo {
  font-size: clamp(36px, 8vw, 48px);
  letter-spacing: -0.04em;
  margin-bottom: var(--s4);
}
.ob-top p {
  color: var(--muted);
  font-size: var(--fs-lg);
  max-width: 28ch;
  line-height: 1.45;
  margin: 0 auto;
}
.ob-card {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--s6) var(--s8) var(--s6) var(--s6);
  margin-bottom: var(--s4);
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--dur-fast), transform var(--dur) var(--spring);
  cursor: pointer;
}
.ob-card:hover {
  border-color: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.ob-card:active { transform: translateY(0) scale(0.99); }
.ob-card::after {
  content: '\203A';
  position: absolute;
  right: var(--s5);
  top: 50%;
  transform: translateY(-50%);
  font-size: var(--fs-title);
  color: var(--muted-2);
  line-height: 1;
}
.ob-card b {
  display: block;
  font-size: var(--fs-xl);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}
.ob-card span { display: block; font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.fine { color: var(--muted); font-size: var(--fs-xs); margin-top: var(--s6); }
.back { color: var(--accent); font-size: var(--fs-md); font-weight: 500; min-height: 40px; margin-bottom: var(--s3); }

/* Auth and onboarding use their own classes, never a stale data-view. */
.ob.auth-screen { max-width: 480px; padding: max(var(--s8), var(--safe-t)) var(--s5) max(var(--s6), var(--safe-b)); }
.auth-screen .ob-top { padding: var(--s5) 0 var(--s7); }
.auth-screen .ob-top .logo { font-family: var(--font-display); font-weight: 400; }
.auth-screen .ob-top p { font-size: var(--fs-md); margin-top: var(--s4); }
.auth-card { padding: var(--s6); border-radius: var(--r-xl); box-shadow: var(--shadow-sm); }
.auth-card h3 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 400; margin-bottom: var(--s5); }
.auth-card .row-inp { flex-wrap: wrap; }
.auth-card .row-inp .btn { flex: 1 1 120px; }
.auth-card .fine, .auth-screen > .fine { margin-top: var(--s4); line-height: 1.6; }
.auth-card .linkbtn { line-height: 1.5; padding: var(--s4) 0; }

/* Preview */
.prev {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.prev > div { text-align: center; }
.prev b { display: block; font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: var(--fs-lg); font-weight: 600; }
.prev span { display: block; font-size: var(--fs-xxs); color: var(--muted); margin-top: 2px; }

/* ----------------------------------------------------------------- Workout categories */
.workout-cats { display: flex; flex-direction: column; gap: var(--s4); }
.workout-cat {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s5);
  width: 100%;
  padding: var(--s5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-align: left;
  transition: border-color var(--dur-fast), transform var(--dur) var(--spring);
  overflow: hidden;
  cursor: pointer;
}
.workout-cat:hover { border-color: var(--accent-soft); transform: translateY(-2px); }
.workout-cat:active { transform: scale(0.98); }

.cat-icon {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cat-icon svg { width: 28px; height: 28px; fill: var(--text); }
.cat-icon.push svg { fill: var(--danger); }
.cat-icon.pull svg { fill: var(--accent); }
.cat-icon.legs svg { fill: var(--carb); }
.cat-icon.strongman svg { fill: var(--fat); }
.cat-icon.helkropp svg { fill: var(--success); }
.cat-icon.hemma svg { fill: #a78bfa; }

.cat-info { flex: 1; min-width: 0; }
.cat-info b { display: block; font-size: var(--fs-lg); font-weight: 600; margin-bottom: 4px; color: var(--text); }
.cat-info small { display: block; font-size: var(--fs-xs); color: var(--muted); line-height: 1.3; }

.cat-count {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
  padding: 5px 12px;
  background: var(--accent-soft);
  border-radius: var(--r-full);
  flex-shrink: 0;
  border: 1px solid var(--accent-soft);
}

/* Workout programs */
.workout-program {
  padding: var(--s5);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: var(--s4);
}
.workout-program::before {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--accent);
  margin-bottom: var(--s4);
}
.workout-program h4 { font-size: var(--fs-md); font-weight: 600; margin-bottom: var(--s3); }

.exercise {
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.exercise:last-child { border-bottom: 0; }
.exercise input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.exercise-name { flex: 1; min-width: 0; font-size: var(--fs-sm); font-weight: 500; }
.exercise-sets { font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }

/* ----------------------------------------------------------------- Exercise log */
.exercise-log {
  margin-bottom: var(--s6);
  padding: var(--s5);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.exercise-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s4);
}
.exercise-header h4 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.last-session {
  margin-bottom: var(--s4);
  padding: var(--s3);
  background: var(--surface);
  border-radius: var(--r-sm);
  border-left: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.sets-grid { display: flex; flex-direction: column; gap: var(--s3); }
.set-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 24px minmax(0, 1fr) 40px;
  gap: var(--s3);
  align-items: center;
  padding: var(--s3);
  background: var(--surface);
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.set-row:hover { border-color: var(--line); }
.set-row.completed {
  background: var(--accent-soft);
  border: 1px solid var(--accent-dim);
}
.set-row.completed .set-label { color: var(--muted-2); text-decoration: line-through; }
.set-row.completed:has(> .set-value) { grid-template-columns: 38px repeat(2, minmax(0, 1fr)); }
.set-label {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.05em;
}
.set-input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 4px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  color: var(--text);
  font-size: var(--fs-md);
  text-align: center;
  font-weight: 500;
  font-family: var(--font-mono);
}
.set-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.set-input::-webkit-inner-spin-button,
.set-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.set-input[type=number] { -moz-appearance: textfield; }
.set-unit { font-size: var(--fs-xxs); color: var(--muted); font-weight: 500; white-space: nowrap; }
.set-value { font-size: var(--fs-xs); font-weight: 600; color: var(--text); text-align: center; }

/* Rest timer */
.workout-timer {
  position: fixed;
  top: var(--safe-t);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: var(--s3) var(--s5);
  background: var(--glass-strong);
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  display: none;
  align-items: center;
  gap: var(--s4);
  box-shadow: var(--shadow-float);
}
.workout-timer.show { display: flex; }
.timer-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-xxs);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-display {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text);
}
.timer-control { flex-shrink: 0; }

.rest-timer {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s4);
  text-align: center;
}
.rest-time {
  font-family: var(--font-mono);
  font-size: var(--fs-num);
  font-weight: 600;
  color: var(--accent);
  margin-bottom: var(--s3);
}
.rest-controls { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; }

/* ----------------------------------------------------------------- Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s8) var(--s5);
  color: var(--muted);
}
.empty-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--s5);
  font-size: 36px;
}
.empty-title { font-size: var(--fs-xl); font-weight: 600; color: var(--text); margin-bottom: var(--s2); }
.empty-desc { font-size: var(--fs-sm); max-width: 260px; line-height: 1.5; margin-bottom: var(--s5); }

/* ----------------------------------------------------------------- Section heads */
.section-head { display: flex; align-items: center; gap: var(--s4); margin-bottom: var(--s5); }
.section-head h3 { font-size: var(--fs-lg); font-weight: 600; color: var(--text); }
.section-head .badge {
  font-size: var(--fs-xxs);
  font-weight: 600;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-full);
  border: 1px solid var(--accent-soft);
}

/* ----------------------------------------------------------------- History */
.history-day {
  display: flex;
  align-items: center;
  gap: var(--s5);
  padding: var(--s5);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: var(--s3);
  transition: border-color var(--dur-fast);
}
.history-day:hover { border-color: var(--line-2); }
.history-day.date { font-size: var(--fs-sm); font-weight: 600; color: var(--muted); min-width: 70px; text-align: center; }
.history-day b { font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 600; color: var(--text); }
.history-day small { color: var(--muted); font-size: var(--fs-xs); }

/* ----------------------------------------------------------------- Profile */
.profile-avatar-wrap { position: relative; display: inline-block; margin-bottom: var(--s5); }
.profile-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
}
.profile-avatar-none {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}
.profile-edit-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--spring);
}
.profile-edit-badge:active { transform: scale(0.9); }

/* Profile header presentation, shared with the distribution build. */
.profile-header { text-align: center; margin-bottom: var(--s6); }
.profile-photo { width: 104px; height: 104px; margin: 0 auto var(--s4); border-radius: 50%; overflow: hidden; border: 3px solid var(--surface); outline: 1px solid var(--line-2); background: var(--surface-2); }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; }
.profile-placeholder { display: grid; place-items: center; width: 104px; height: 104px; margin: 0 auto var(--s4); border-radius: 50%; background: var(--surface-2); color: var(--accent); }
.profile-placeholder--compact {
  width: 64px;
  height: 64px;
  margin: 0 auto 8px;
}

.profile-placeholder svg { width: 52px; height: 52px; }
.profile-name { font-family: var(--font-display); font-size: 30px; font-weight: 400; margin-bottom: 6px; overflow-wrap: anywhere; }
.profile-bio { margin: var(--s4) auto 0; font-size: var(--fs-sm); color: var(--muted); max-width: 40ch; line-height: 1.6; }
.profile-header .btn.sm { margin: var(--s4) auto 0; }

/* PR cards */
.pr-grid { display: grid; gap: var(--s4); }
.pr-card {
  display: flex;
  align-items: center;
  gap: var(--s5);
  padding: var(--s5);
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background var(--dur-fast);
}
.pr-card:hover { background: var(--surface-3); }
.pr-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.pr-info { flex: 1; min-width: 0; }
.pr-info b { display: block; font-family: var(--font-sans); font-variant-numeric: tabular-nums; font-size: var(--fs-xl); font-weight: 600; color: var(--text); }
.pr-info small { color: var(--muted); font-size: var(--fs-xs); }

/* Icon button */
.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.btn-icon:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn-icon:active { transform: scale(0.92); }
.btn-icon.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

/* ----------------------------------------------------------------- Scanner overlay */
.scanner-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.scanner-frame {
  width: 80%;
  max-width: 280px;
  height: 280px;
  border: 2px solid var(--accent);
  border-radius: var(--r-md);
  position: relative;
}
.scanner-corner {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 3px solid var(--accent);
}
.scanner-corner.tl { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.scanner-corner.tr { top: -3px; right: -3px; border-left: 0; border-bottom: 0; }
.scanner-corner.bl { bottom: -3px; left: -3px; border-right: 0; border-top: 0; }
.scanner-corner.br { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.scanner-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: scanLine 2s ease-in-out infinite;
}
@keyframes scanLine {
  0% { transform: translateY(0); }
  100% { transform: translateY(280px); }
}

/* ----------------------------------------------------------------- Quote card */
.quote-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent-soft);
  border-radius: var(--r-lg);
  padding: var(--s4) var(--s5);
  display: flex;
  gap: var(--s3);
  align-items: center;
  margin-bottom: var(--s5);
}
.quote-icon { font-size: 18px; line-height: 1; flex-shrink: 0; opacity: 0.4; color: var(--muted); }
.quote-text {
  flex: 1;
  font-size: var(--fs-sm);
  font-weight: 400;
  color: var(--muted);
  font-style: italic;
  line-height: 1.4;
}

/* ----------------------------------------------------------------- Performance */
.performance-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s6);
  margin-bottom: var(--s4);
  box-shadow: var(--shadow-sm);
}
.performance-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
  margin-bottom: var(--s5);
}
.performance-head > div {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
}
.performance-head svg { color: var(--accent); }
.coach-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  font-size: var(--fs-xxs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}
.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s5);
}
.mini-stat {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s4) var(--s3);
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 76px;
  justify-content: center;
}
.mini-stat span {
  font-size: var(--fs-xxs);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
}
.mini-stat strong {
  font-family: var(--font-mono);
  font-size: clamp(20px, 3vw, 24px);
  line-height: 1;
  font-weight: 600;
  color: var(--text);
}
.mini-stat small { font-size: var(--fs-xs); color: var(--muted); }
.coach-line { font-size: var(--fs-sm); line-height: 1.5; color: var(--muted); }

/* Week plan */
.week-plan-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s6);
  margin-bottom: var(--s4);
}
.week-plan {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  margin-top: var(--s4);
  min-width: 0;
}
.plan-day {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s4) var(--s3);
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.plan-day::before {
  content: '';
  display: block;
  width: 100%;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--accent);
  margin-bottom: var(--s3);
}
.plan-day span {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
}
.plan-day strong { font-size: var(--fs-xs); font-weight: 600; color: var(--text); }
.plan-day small { display: block; font-size: var(--fs-xxs); line-height: 1.3; color: var(--muted); }
.plan-focus {
  width: 100%;
  min-width: 0;
  margin: var(--s2) 0;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.plan-complete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  margin-top: auto;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  color: var(--muted);
  font-size: var(--fs-xxs);
  font-weight: 600;
}
.plan-complete svg { width: 14px; height: 14px; }
.plan-day.is-done { background: var(--surface-3); }
.plan-day.is-done .plan-complete { border-color: var(--accent); color: var(--accent); }

/* Exercise progress */
.exercise-progress-card h3 { margin-bottom: var(--s2); }
.exercise-progress-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) 0;
  border-top: 1px solid var(--line);
}
.exercise-progress-meta { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.exercise-progress-meta strong {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exercise-progress-meta small, .exercise-progress-change {
  color: var(--muted);
  font-size: var(--fs-xs);
}
.exercise-sparkline { width: 120px; height: 40px; overflow: visible; }
.exercise-sparkline polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.exercise-sparkline circle { fill: var(--accent); }

/* ----------------------------------------------------------------- Suggestions */
.suggestions-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--s6);
  margin-bottom: var(--s4);
}
.suggestion-chips { display: flex; flex-direction: column; gap: var(--s3); }
.suggestion-chip {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s4);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
  text-align: left;
}
.suggestion-chip:hover {
  background: var(--surface-3);
  border-color: var(--accent-soft);
}
.sug-name { font-weight: 600; font-size: var(--fs-md); color: var(--text); }
.sug-reason { font-size: var(--fs-xs); color: var(--muted); }

/* ----------------------------------------------------------------- Toast */
#toast {
  max-width: calc(100vw - 32px);
  text-align: center;
  overflow-wrap: anywhere;
  position: fixed;
  bottom: calc(var(--bottom-space) + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  z-index: 200;
  padding: 10px 20px;
  background: var(--glass-strong);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  border-radius: var(--r-full);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-float);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast), transform var(--dur) var(--spring);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------------- Install banner */
.install-banner {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4) var(--s5);
  margin-bottom: var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.install-banner span { flex: 1; }
.install-banner button {
  color: var(--accent);
  font-weight: 600;
  padding: 8px 14px;
  min-height: 38px;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
}

/* ----------------------------------------------------------------- Splash */
.splash {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn var(--dur) ease-out;
}
.splash-logo {
  font-size: 140px;
  margin-bottom: var(--s8);
  animation: splashZoom 1s var(--spring);
}
@keyframes splashZoom {
  0% { transform: scale(0.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.splash-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 8vw, 48px);
  font-weight: 400;
  letter-spacing: -0.03em;
  margin: 0 0 var(--s4);
  color: var(--text);
}
.splash-subtitle {
  font-size: var(--fs-lg);
  font-weight: 500;
  color: var(--muted);
  margin: 0;
}

/* ----------------------------------------------------------------- Achievement */
.achievement-popup {
  position: fixed;
  top: calc(var(--safe-t) + 70px);
  left: 50%;
  transform: translateX(-50%) translateY(-24px);
  z-index: 9999;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  padding: var(--s5) var(--s6);
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-float);
  max-width: 90%;
  width: 340px;
  display: flex;
  gap: var(--s4);
  align-items: center;
  opacity: 0;
  transition: opacity var(--dur), transform var(--dur) var(--spring);
}
.achievement-popup.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.achievement-icon {
  font-size: 36px;
  line-height: 1;
}
.achievement-content { flex: 1; min-width: 0; }
.achievement-title { font-weight: 600; font-size: var(--fs-md); color: var(--text); margin-bottom: 2px; }
.achievement-desc { font-size: var(--fs-sm); color: var(--muted); }

/* Konfetti i milstolpe-popupen */
.achievement-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: var(--r-md);
}
.achievement-confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  opacity: 0.9;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(220px) rotate(540deg); opacity: 0; }
}

.achievement-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s4);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: var(--s3);
  opacity: 0.45;
  transition: opacity var(--dur);
}
.achievement-row.unlocked {
  opacity: 1;
  background: var(--surface-3);
  border-color: var(--accent-soft);
}
.ach-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.ach-info { flex: 1; min-width: 0; }
.ach-name { font-weight: 600; font-size: var(--fs-md); color: var(--text); margin-bottom: 2px; }
.ach-desc { font-size: var(--fs-sm); color: var(--muted); }
.ach-status { font-size: 20px; flex-shrink: 0; }

/* ----------------------------------------------------------------- Misc utilities */
.loading-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: var(--s5) auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Auth loading screen ---------- */
.al-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  text-align: center;
  padding: var(--s8) var(--s5);
  animation: alFadeIn 0.45s var(--ease) both;
}
@keyframes alFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.al-screen .al-logo {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text);
  animation: alBreathe 2.8s ease-in-out infinite;
}
.al-screen .al-logo span { color: var(--accent); }
@keyframes alBreathe {
  0%, 100% { opacity: 0.88; }
  50%      { opacity: 1; }
}
.al-ring {
  width: 46px;
  height: 46px;
  margin-top: var(--s6);
  animation: spin 1.1s linear infinite;
}
.al-ring circle { fill: none; stroke-width: 3; }
.al-ring .al-track { stroke: var(--line-2); }
.al-ring .al-arc   { stroke: var(--accent); stroke-linecap: round; }
.al-status {
  margin-top: var(--s4);
  font-size: var(--fs-sm);
  color: var(--muted);
}

/* ---------- Kom igång-lista (onboarding) ---------- */
.obc-card { position: relative; }
.obc-head { display: flex; align-items: center; gap: var(--s3); }
.obc-head h3 { margin: 0; font-size: var(--fs-md); font-family: var(--font-display); font-weight: 400; }
.obc-count { margin-left: auto; font-size: var(--fs-sm); color: var(--muted); font-weight: 600; }
.obc-x { margin-left: var(--s2); background: none; border: none; color: var(--muted); cursor: pointer; padding: 2px; line-height: 0; border-radius: var(--r-xs); }
.obc-x:hover { color: var(--text); }
.obc-bar { height: 4px; border-radius: var(--r-full); background: var(--surface-3); margin: var(--s4) 0 var(--s4); overflow: hidden; }
.obc-bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-full); transition: width 0.3s var(--ease); }
.obc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.obc-item { display: flex; align-items: center; gap: var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.obc-item:last-child { border-bottom: none; }
.obc-item.done .obc-label { color: var(--muted); }
.obc-check { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.obc-item.done .obc-check { background: var(--accent); color: var(--accent-ink); }
.obc-dot { width: 8px; height: 8px; border-radius: 50%; border: 2px solid var(--line-2); display: block; }
.obc-label { flex: 1; font-size: var(--fs-sm); color: var(--text); }
.obc-go { background: none; border: 1px solid var(--line-2); color: var(--accent); font-size: var(--fs-xs); font-weight: 600; padding: 4px 12px; border-radius: var(--r-full); cursor: pointer; }
.obc-go:active { background: var(--accent-soft); }

/* ---------- Firande när målet nås ---------- */
.celebrate-card { position: relative; overflow: hidden; text-align: center; border: 1px solid var(--accent-dim); }
.celebrate-body { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s5) 0; position: relative; z-index: 1; }
.celebrate-check { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: flex; align-items: center; justify-content: center; }
.celebrate-card.celebrate-on .celebrate-check { animation: celebratePop 0.5s var(--ease) both; }
@keyframes celebratePop { 0% { transform: scale(0); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
.celebrate-body strong { font-size: var(--fs-lg); color: var(--text); display: block; }
.celebrate-body .muted { font-size: var(--fs-sm); }
.confetti { position: absolute; top: 0; left: 0; right: 0; bottom: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.confetti-piece { position: absolute; top: -10px; width: 7px; height: 7px; border-radius: 1px; opacity: 0; animation: confettiFall linear forwards; }
@keyframes confettiFall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(320px) rotate(540deg); opacity: 0; } }

.shimmer {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-xs);
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--r-xs);
}
.skeleton-text { height: 14px; margin-bottom: var(--s3); }
.skeleton-circle { width: 48px; height: 48px; border-radius: 50%; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: var(--fs-xxs);
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--r-full);
  min-width: 18px;
  text-align: center;
}

.glow {
  box-shadow: 0 0 12px var(--accent-soft);
  border: 1px solid var(--accent-soft);
}

.macro-pie-container { position: relative; margin: var(--s4) auto; }
.macro-pie-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
  pointer-events: none;
}

.streak-fire { display: inline-block; }
.stat-icon { font-size: 28px; }

.interactive { cursor: pointer; transition: all var(--dur-fast); }
.interactive:hover { transform: translateY(-2px); }

.comeback-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: var(--s5) var(--s6);
  margin-bottom: var(--s4);
}

/* ----------------------------------------------------------------- Gym page */
#app[data-view="gym"] .performance-card { padding: var(--s5); background: var(--hero-surface); border-color: transparent; box-shadow: none; }
#app[data-view="gym"] .gym-hero { background: var(--hero-surface); border-color: transparent; }
#app[data-view="gym"] .mini-stat { background: var(--surface); border-color: transparent; }
#app[data-view="gym"] .mini-stat span { text-transform: none; letter-spacing: 0; }
#app[data-view="gym"] .gym-quick-btn { min-height: 76px; background: var(--surface); }
#app[data-view="gym"] .gym-quick-btn.primary { background: var(--accent); color: var(--accent-ink); }
#app[data-view="gym"] .gym-hero-stat { padding: var(--s5) var(--s4); }
#app[data-view="gym"] .gym-hero-stat strong { font-family: var(--font-sans); font-weight: 500; }
#app[data-view="gym"] .performance-head { margin-bottom: var(--s4); }
.exercise-log { padding: var(--s4); margin-bottom: var(--s4); border-radius: var(--r-md); }
.exercise-header { gap: var(--s3); }
.exercise-header h4 { min-width: 0; overflow-wrap: anywhere; }
.last-session { border-left: 0; color: var(--muted); background: var(--surface); }
.set-row { min-width: 0; }
.set-row > * { min-width: 0; }
.workout-cat { gap: var(--s4); }
.cat-icon { width: 48px; height: 48px; border-radius: var(--r-sm); background: var(--accent-soft); border-color: transparent; }
.cat-icon.push svg, .cat-icon.pull svg, .cat-icon.legs svg, .cat-icon.strongman svg, .cat-icon.helkropp svg, .cat-icon.hemma svg { fill: var(--accent); }

/* Cardio row — bredare tryckytor */
.cc-add {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--accent);
  font-size: 22px;
  line-height: 1;
  display: grid;
  place-items: center;
  transition: background var(--dur-fast);
}
.cc-add:active { transform: scale(0.9); background: var(--accent-soft); }

/* Aktiva session-pill (vilotimer) */
#rest-pill {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: 24px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: var(--s3);
  z-index: 100;
  max-width: calc(100vw - 24px);
  box-shadow: var(--shadow-float);
}
.rest-pill-time {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  font-size: var(--fs-lg);
  min-width: 2.5ch;
  text-align: center;
}
.rest-pill-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: var(--fs-sm);
  min-width: 40px;
  min-height: 40px;
  padding: 8px;
  border-radius: var(--r-xs);
  transition: color var(--dur-fast);
}
.rest-pill-close:hover { color: var(--text); }

/* Gym stats hero — liknande kalorikortets layout */
.gym-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  margin-bottom: var(--s5);
}
.gym-hero-stat {
  padding: var(--s5) var(--s4);
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-right: 1px solid var(--line);
}
.gym-hero-stat:last-child { border-right: 0; }
.gym-hero-stat span {
  font-size: var(--fs-xxs);
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 600;
}
.gym-hero-stat strong {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  font-weight: 600;
  color: var(--text);
  line-height: 1.1;
}
.gym-hero-stat small {
  font-size: var(--fs-xxs);
  color: var(--muted);
}

/* Senaste pass — tydligare rader */
.workout-row {
  display: flex;
  align-items: center;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  transition: opacity var(--dur-fast);
}
.workout-row:last-child { border-bottom: 0; }
.workout-row:active { opacity: 0.6; }
.workout-row-info { flex: 1; min-width: 0; }
.workout-row-info b {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workout-row-info small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xxs);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workout-row-vol {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}
.workout-row-chev { color: var(--muted-2); flex-shrink: 0; }

/* Veckoplan — horisontell scroll på mobil */
.week-plan-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  margin: var(--s4) calc(-1 * var(--s5));
  padding: 0 var(--s5);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.week-plan-scroll::-webkit-scrollbar { display: none; }
.week-plan-row {
  display: flex;
  gap: var(--s3);
  padding-bottom: 4px;
  min-width: max-content;
}
.plan-day-v2 {
  flex: 0 0 100px;
  scroll-snap-align: start;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: var(--s4) var(--s3);
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  transition: border-color var(--dur-fast);
}
.plan-day-v2.is-done {
  border-color: var(--accent);
  background: var(--surface-3);
}
.plan-day-v2.is-today {
  border-color: var(--accent-soft);
  background: var(--surface-2);
  box-shadow: 0 0 0 1px var(--accent-soft);
}
.plan-day-v2 .day-label {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
}
.plan-day-v2.is-today .day-label { color: var(--accent); }
.plan-day-v2 .day-focus {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.plan-day-v2 .day-goal {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.plan-day-v2 .day-done {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  margin-top: auto;
  min-height: 26px;
  padding: 3px 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.plan-day-v2.is-done .day-done { color: var(--accent); }
.plan-day-v2 .day-done svg { width: 12px; height: 12px; }

/* Coach-block — rensad utan inline-stilar */
.coach-block {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.coach-label {
  font-size: var(--fs-xxs);
  color: var(--muted);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.08em;
}

/* Snabbstart-knappar */
.gym-quick {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
  margin-bottom: 0;
}
.gym-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
  padding: var(--s4);
  min-height: 72px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text);
  transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--spring);
  text-align: left;
  cursor: pointer;
}
.gym-quick-btn:active { transform: scale(0.96); }
.gym-quick-btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.gym-quick-btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.gym-quick-btn.primary:hover { filter: brightness(1.06); }
.gym-quick-btn svg { color: inherit; opacity: 0.8; }
.gym-quick-btn span { font-size: var(--fs-sm); font-weight: 600; }
.gym-quick-btn small { font-size: var(--fs-xxs); opacity: 0.7; }

/* Exercise-log set-row — tätare */
.set-row-num {
  font-size: var(--fs-xxs);
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.03em;
}

/* Tomläge */
.gym-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--s7) var(--s5);
  gap: var(--s4);
}
.gym-empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.gym-empty-icon svg { width: 28px; height: 28px; }
.gym-empty p {
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 240px;
  line-height: 1.5;
  margin: 0;
}

/* Exercise-progress change badge */
.exercise-progress-change.up { color: var(--accent); }
.exercise-progress-change.down { color: var(--danger); }

@media (max-width: 360px) {
  .gym-hero-stat strong { font-size: var(--fs-lg); }
  .gym-quick { grid-template-columns: 1fr; }
  .plan-day-v2 { flex: 0 0 84px; }
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------------- Print */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .nav, .fabar, .backdrop, .sheet, #toast { display: none !important; }
  .page { max-width: 100%; padding: 0; }
  .card, .meal, .mini {
    border: 1px solid #ccc !important;
    background: #fff !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .hero-num, .mini-v, .e-k { color: #000 !important; }
  a { color: #000; text-decoration: none; }
}

/* ----------------------------------------------------------------- Responsive */
@media (max-width: 360px) {
  .page { padding-left: max(var(--s4), var(--safe-l)); padding-right: max(var(--s4), var(--safe-r)); }
  .sheet { padding-left: max(var(--s4), var(--safe-l)); padding-right: max(var(--s4), var(--safe-r)); }
  .hero { padding: var(--s5); }
  .hero .macros { gap: var(--s3); }
  .hero .macro-h .muted { font-size: var(--fs-xxs); }
  .settings-group > summary { flex-wrap: wrap; gap: 4px var(--s3); }
  .settings-group > summary span { flex: 1 1 auto; min-width: 0; }
  .settings-group > summary small { order: 3; flex-basis: 100%; white-space: normal; }
  .social-home-top { flex-wrap: wrap; }
  .social-home-badge { flex-shrink: 0; }
  .mini { padding: var(--s4); }
  .mini-acts button { font-size: var(--fs-xxs); padding: 5px 2px; }
  .grid4 { gap: 6px; }
  .hero-num { font-size: 44px; }
  .hero-meta { font-size: var(--fs-xs); }
  .workout-cat { padding: var(--s4) var(--s3); }
  .cat-icon { width: 48px; height: 48px; }
  .cat-icon svg { width: 24px; height: 24px; }
  .set-row { grid-template-columns: 28px minmax(0, 1fr) 20px minmax(0, 1fr) 36px; gap: 4px; padding: 6px; }
  .set-label { font-size: 11px; }
  .set-unit { font-size: 11px; }
  .timer-display { font-size: var(--fs-lg); }
  .nav button { font-size: 11px; }
  .nav-in { padding: 6px max(3px, var(--safe-l)) 6px max(3px, var(--safe-r)); }
  .exercise-progress-row { grid-template-columns: minmax(0, 1fr) 90px; gap: var(--s3); }
  .exercise-sparkline { width: 90px; }
  .datenav .datelabel { font-size: var(--fs-md); }
}

@media (hover: hover) {
  .chip:hover, .plus:hover, .row:hover, .ob-card:hover { opacity: 0.92; }
  .nav button:hover { color: var(--text); }
  .nav button.on:hover { color: var(--accent); }
}

/* ----------------------------------------------------------------- Accessibility */
@media (prefers-reduced-transparency: reduce) {
  .nav, .sheet, .streak, .fab-scan, .backdrop, #toast {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .nav, #toast { background: var(--surface); }
  .sheet { background: var(--surface); }
}

@media (prefers-contrast: more) {
  body { --line: currentColor; --line-2: currentColor; --muted: var(--text); --muted-2: var(--text); }
  .btn, .inp, .card, .meal { border-color: var(--text); }
  .hero { border-color: var(--text); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- Portionssnabbval (mängdvy) */
.portrow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: var(--s2) 0 var(--s3);
}
.portbtn {
  min-height: 48px;
  padding: 10px 4px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .12s var(--ease);
}
.portbtn:active { transform: scale(0.96); }
.portbtn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
}
@media (hover: hover) {
  .portbtn:hover { border-color: var(--accent); }
}
@media (prefers-reduced-motion: reduce) {
  .portbtn { transition: none; }
}

/* ========== SOCIALT ========== */
.social-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s3);
}
.social-me {
  display: flex;
  align-items: center;
  gap: 12px;
}
.social-me small { display: block; margin-top: 2px; }
.social-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.social-avatar.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border: 2px solid var(--line-2);
  color: var(--muted);
}

/* Gym status */
.gym-status-card { transition: border-color .2s, box-shadow .2s; }
.gym-status-card.active {
  border-color: var(--accent-dim);
  background: var(--hero-surface);
  box-shadow: none;
}
.gym-status-row {
  display: flex; align-items: center; gap: 12px;
}
.gym-status-row > div { flex: 1; }
.gym-status-row small { display: block; margin-top: 2px; }
.gym-buddies { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }

/* Tabs */
.social-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 4px 0 12px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.social-tabs::-webkit-scrollbar { display: none; }
.social-tab {
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s var(--ease);
}
.social-tab--soon {
  opacity: .55;
  cursor: not-allowed;
}
.soon-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: middle;
}
.social-tab.on {
  background: var(--accent-soft);
  border-color: var(--accent-dim);
  color: var(--accent);
}
.social-tab:active { transform: scale(0.95); }

/* Feed */
.social-share-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: var(--s3);
}
.social-feed { display: flex; flex-direction: column; gap: 12px; }
.feed-item { padding: 14px; }
.feed-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px;
}
.feed-avatar {
  width: 36px; height: 36px;
  border-radius: 50%; object-fit: cover;
  flex-shrink: 0;
}
.feed-avatar.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted);
}
.feed-meta { flex: 1; }
.feed-meta small { display: block; }
.feed-icon { color: var(--accent); opacity: 0.7; }
.feed-text { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.feed-detail { margin-bottom: 8px; }
.feed-reactions { display: flex; gap: 6px; flex-wrap: wrap; }
.reaction-btn {
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 16px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.reaction-btn.on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.reaction-btn:active { transform: scale(0.9); }

/* Empty state */
.social-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
}
.social-empty svg { margin-bottom: 8px; opacity: 0.5; }
.social-empty p { margin: 0 0 4px; font-weight: 600; color: var(--text); }
.social-empty small { font-size: 13px; }

/* Challenges */
.challenge-card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.challenge-head { margin-bottom: 10px; }
.challenge-head b { display: block; font-size: 15px; }
.challenge-head small { font-size: 12px; }
.challenge-board { margin-bottom: 10px; }
.challenge-row { margin-bottom: 4px; }
.challenge-score {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.challenge-actions { display: flex; gap: 8px; }

/* Duels */
.duel-card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.duel-card.done { opacity: 0.7; }
.duel-vs {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.duel-player { text-align: center; flex: 1; }
.duel-player b { display: block; font-size: 14px; }
.duel-player.leading b { color: var(--accent); }
.duel-days { font-size: 12px; color: var(--muted); }
.duel-dots {
  margin-top: 6px;
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent);
}
.duel-bolt { font-size: 24px; }
.duel-status { font-size: 13px; font-weight: 600; text-align: center; }
.duel-status.winning { color: var(--accent); }
.duel-status.losing { color: var(--danger, #ff4d4d); }

/* Groups */
.group-card {
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  padding: 14px;
  margin-bottom: 12px;
  background: var(--surface-2);
}
.group-head { margin-bottom: 10px; }
.group-head b { display: block; font-size: 15px; }
.group-head small { font-size: 12px; }
.group-progress { margin-bottom: 10px; }
.group-progress span { font-size: 12px; color: var(--muted); display: block; margin-top: 4px; }
.group-bar {
  height: 10px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.group-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  transition: width .4s var(--ease);
}
.group-members { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.group-actions { display: flex; gap: 8px; }
.group-actions, .challenge-actions { flex-wrap: wrap; }
.group-actions .btn, .challenge-actions .btn { flex: 1 1 100px; min-width: 0; }
.feed-item { background: var(--surface); padding: var(--s5); }
.feed-meta { min-width: 0; }
.feed-meta b, .friend-info b { overflow-wrap: anywhere; }
.duel-player { min-width: 0; }
.duel-player b { overflow-wrap: anywhere; }
.social-home-top { gap: var(--s3); }
.friend-quick-reactions .reaction-btn { min-width: 40px; padding: 8px; }

/* Friends list in social */
.social-friends-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.social-friends-head h3 { margin: 0; }
.friend-card {
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  margin-bottom: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color .15s;
}
.friend-card:active { border-color: var(--accent); }
.friend-row { display: flex; align-items: center; gap: 10px; }
.friend-avatar {
  width: 40px; height: 40px;
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.friend-avatar.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--muted);
}
.friend-info { flex: 1; min-width: 0; }
.friend-info b { display: block; font-size: 14px; }
.friend-info small { font-size: 12px; }
.friend-quick-reactions { display: flex; gap: 4px; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}
.gym-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* Milestones */
.milestone-card { border-color: var(--accent); }
.milestone-row { margin-bottom: 6px; }

/* Home social card */
.social-home-card { background: var(--surface-2); transition: border-color .15s; }
.social-home-card:active { border-color: var(--accent); }
.social-home-top { display: flex; align-items: center; justify-content: space-between; }
.social-home-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  color: var(--muted);
}
.social-home-gym {
  margin-top: 8px;
  font-size: 13px;
  color: var(--accent);
  display: flex; align-items: center; gap: 6px;
}

@media (max-width: 400px) {
  .social-tabs { gap: 3px; }
  .social-tab { padding: 6px 12px; font-size: 12px; }
  .duel-vs { gap: 6px; }
  .friend-quick-reactions { display: none; }
}

/* ----------------------------------------------------------------- Active workout sheet — Balans
   Scoped to the live session; historical .set-row components stay unchanged. */
.workout-session {
  display: grid;
  gap: 20px;
  min-width: 0;
  width: 100%;
  padding-bottom: 20px;
  color: var(--text);
}
.workout-session > * { min-width: 0; }

.workout-session .session-hero {
  padding: 24px 20px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: 24px;
}
.workout-session .session-eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.5;
}
.workout-session .session-hero h2 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.workout-session .session-hero > p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.workout-session .session-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 24px 0 16px;
}
.workout-session .session-stats > div {
  min-width: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.workout-session .session-stats strong {
  display: block;
  color: var(--text);
  font-size: clamp(22px, 3.5vw, 28px);
  font-weight: 600;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.workout-session .session-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.workout-session .session-hero progress {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  accent-color: var(--accent);
}
.workout-session .session-hero progress::-webkit-progress-bar {
  background: var(--surface);
  border-radius: 999px;
}
.workout-session .session-hero progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}
.workout-session .session-hero progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}
.workout-session .session-hero > .session-save-note {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.workout-session .session-exercise {
  min-width: 0;
  padding: 16px 12px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  scroll-margin-top: 20px;
  transition: border-color 0.16s ease;
}
.workout-session .session-exercise-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}
.workout-session .session-exercise-head > div { min-width: 0; }
.workout-session .session-exercise-number {
  display: grid;
  place-items: center;
  min-height: 32px;
  background: var(--accent-soft);
  border-radius: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.workout-session .session-exercise-head h3 {
  margin: 0;
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.workout-session .session-exercise-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.workout-session .session-exercise-count {
  padding: 5px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.workout-session .session-previous {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  margin: 14px 0 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.workout-session .session-previous > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.workout-session .session-copy {
  min-width: 44px;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 12px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
}

.workout-session .session-set {
  display: grid;
  grid-template-columns: 24px repeat(2, minmax(0, 1fr)) 48px;
  gap: 6px 8px;
  align-items: end;
  min-width: 0;
  margin-top: 8px;
  padding: 10px 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}
.workout-session .session-set > * { min-width: 0; }
.workout-session .session-set-number {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  min-height: 52px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.workout-session .session-field {
  grid-row: 1;
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.workout-session .session-field > span { overflow-wrap: anywhere; }
.workout-session .session-input {
  display: block;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 10px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  caret-color: var(--accent);
  font-family: var(--font-sans, sans-serif);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.16s ease;
}
.workout-session .session-input::placeholder { color: var(--muted); opacity: 1; }
.workout-session .session-input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.workout-session .session-input[aria-invalid="true"] {
  border-color: var(--text);
  border-style: dashed;
}
.workout-session .session-done {
  grid-column: 4;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  min-height: 52px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--muted);
  border-radius: 12px;
  color: var(--muted);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}
.workout-session .session-done svg { width: 22px; height: 22px; }
.workout-session .session-set-previous {
  grid-column: 2 / 4;
  grid-row: 2;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.workout-session .session-set.is-completed {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.workout-session .session-set.is-completed .session-set-number { color: var(--accent); }
.workout-session .session-done[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.workout-session .session-exercise.is-completed { border-color: var(--accent); }
.workout-session .session-exercise.is-completed .session-exercise-count {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.workout-session :is(.session-copy, .session-done, .session-footer .btn):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.workout-session button { touch-action: manipulation; }
.workout-session .session-status {
  margin: 0;
  padding: 12px 14px;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.workout-session .session-status:empty { display: none; }
.workout-session .session-footer {
  position: static;
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.workout-session .session-footer .btn {
  min-width: 44px;
  min-height: 52px;
  margin: 0;
  padding: 14px 16px;
  font-size: 16px;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* The existing fixed timer stays above the sheet; the footer scrolls clear of it. */
body:has(.workout-session) #rest-pill { z-index: 110; }
body:has(.workout-session) #rest-pill .rest-pill-close { min-width: 44px; min-height: 44px; }
body:has(#rest-pill:not([hidden])) .workout-session { padding-bottom: calc(var(--nav-h, 68px) + 80px); }

@media (max-width: 360px) {
  .workout-session .session-hero { padding: 20px 12px 16px; }
  .workout-session .session-stats { gap: 8px; }
  .workout-session .session-stats > div { padding: 10px 8px; }
  .workout-session .session-exercise { padding: 14px 10px 10px; }
  .workout-session .session-exercise-head { gap: 8px; }
  .workout-session .session-set { column-gap: 6px; padding: 10px 6px; }
}
@media (hover: hover) {
  .workout-session .session-copy:not(:disabled):hover { border-color: var(--accent); }
  .workout-session .session-done:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
  .workout-session .session-done[aria-pressed="true"]:not(:disabled):hover { color: var(--accent-ink); }
}
@media (prefers-reduced-motion: reduce) {
  .workout-session, .workout-session *, .workout-session *::before, .workout-session *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .workout-session .session-footer .btn:active { transform: none; }
}
@media (forced-colors: active) {
  .workout-session :is(.session-hero, .session-exercise, .session-set, .session-stats > div, .session-status) {
    background: Canvas;
    border-color: CanvasText;
    color: CanvasText;
  }
  .workout-session :is(.session-input, .session-copy, .session-done, .session-footer .btn, .session-exercise-count) {
    border-color: ButtonText;
  }
  .workout-session .session-set.is-completed,
  .workout-session .session-exercise.is-completed { border-color: Highlight; border-style: double; }
  .workout-session .session-done[aria-pressed="true"],
  .workout-session .session-exercise.is-completed .session-exercise-count {
    forced-color-adjust: none;
    background: Highlight;
    border-color: Highlight;
    color: HighlightText;
  }
  .workout-session :is(.session-input:focus, .session-copy:focus-visible, .session-done:focus-visible, .session-footer .btn:focus-visible) {
    outline-color: Highlight;
  }
  .workout-session .session-hero progress { appearance: auto; -webkit-appearance: auto; }
  .workout-session .session-hero progress::-webkit-progress-bar { background: Canvas; }
  .workout-session .session-hero progress::-webkit-progress-value { background: Highlight; }
  .workout-session .session-hero progress::-moz-progress-bar { background: Highlight; }
}
.page-home {
  padding-bottom: calc(var(--fab-h) + var(--nav-h) + var(--safe-b) + 16px);
}
/* Omgang C: oversta kanten pa iPhone */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--safe-t);
  background: var(--bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  pointer-events: none;
}
.linklike {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.linklike:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
