/* styles.css — DUGR
   Design: DUGR designsystem v0.5 (design-system.md, OKLCH). Grå-blå
   neutraler, Frost (stålblå) för handling, Ember (koppar) enbart för
   progression. Mono bär etiketter och siffror — instrumentkänslan.
   Mörkt är standard; ljust läge (data-ljus, v2.53) styrs av
   Inställningars utseendeväxel — följ enheten, mörkt eller ljust.
   Grundens gamla palett (järn & bärnsten) ligger kvar bakom
   data-theme="grunden" och växlas i Inställningar. */

/* ── Tokens ──────────────────────────────────────────────── */
:root {
  color-scheme: dark; /* UA-delarna (fält, datumväljare, rullister) följer läget */
  --bg: oklch(0.165 0.012 250);            /* dugrSurfaceBase */
  --surface: oklch(0.205 0.014 250);       /* dugrSurfacePrimary */
  --surface-2: oklch(0.135 0.010 250);     /* dugrSurfaceSunken */
  --surface-3: oklch(0.245 0.016 250);     /* dugrSurfaceElevated */
  --line: oklch(1 0 0 / 0.10);             /* dugrStrokeDefault */
  --line-strong: oklch(1 0 0 / 0.18);      /* dugrStrokeStrong */
  --line-subtle: oklch(1 0 0 / 0.06);      /* dugrStrokeSubtle */
  --text: oklch(0.97 0.005 250);           /* dugrContentPrimary */
  --text-dim: oklch(0.78 0.012 250);       /* dugrContentSecondary */
  --muted: oklch(0.58 0.012 250);          /* dugrContentTertiary */
  --accent: oklch(0.72 0.082 230);         /* dugrFrost500 — handling */
  --accent-ink: oklch(0.13 0.020 230);     /* dugrActionPrimaryOn */
  --accent-soft: oklch(0.72 0.082 230 / 0.14);
  --frost-300: oklch(0.78 0.058 230);      /* hover/fokusring */
  --progress: oklch(0.66 0.110 50);        /* dugrEmber500 — progression */
  --progress-soft: oklch(0.66 0.110 50 / 0.16);
  --progress-ink: oklch(0.165 0.012 250);
  --ember-300: oklch(0.74 0.078 50);       /* chips/tier-text */
  --ok: oklch(0.74 0.110 155);             /* dugrSuccess */
  --caution: oklch(0.80 0.130 80);         /* dugrWarning */
  --orange: oklch(0.74 0.140 55);          /* trafikljusets orange */
  --stop: oklch(0.70 0.150 25);            /* dugrError */
  --ok-soft: oklch(0.32 0.060 155 / 0.32);
  --caution-soft: oklch(0.40 0.080 80 / 0.32);
  --orange-soft: oklch(0.36 0.080 55 / 0.32);
  --stop-soft: oklch(0.32 0.080 25 / 0.32);
  /* Skugga endast på elevated-kort och sheets — aldrig som dekor. */
  --shadow-elev: inset 0 1px 0 oklch(1 0 0 / 0.05), 0 6px 16px oklch(0 0 0 / 0.35);

  --radius: 18px;                          /* dugrLg — kort */
  --radius-sm: 12px;                       /* dugrMd — knappar, inputs */
  --radius-xl: 24px;                       /* sheets/modaler */
  --tap: 48px;
  --maxw: 480px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;

  /* Rörelse: standardease för tryck/expand, glide för ringar och vy-byten.
     Inga spring/bounce. */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-glide: cubic-bezier(0.32, 0.72, 0, 1);

  --nav-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* Ljust läge bakom data-ljus (v2.53): app.js är avgöraren — "system"
   läser enhetens läge via matchMedia, "mörkt"/"ljust" tvingar. En enda
   källa per palett; index.html sätter attributet före första målningen. */
:root[data-ljus] {
  color-scheme: light;
  --bg: oklch(0.985 0.003 250);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.955 0.005 250);
  --surface-3: oklch(1 0 0);             /* elevated i ljust = vit + skugga */
  --line: oklch(0 0 0 / 0.10);
  --line-strong: oklch(0 0 0 / 0.18);
  --line-subtle: oklch(0 0 0 / 0.06);
  --text: oklch(0.18 0.012 250);
  --text-dim: oklch(0.36 0.014 250);
  --muted: oklch(0.50 0.014 250);
  --accent: oklch(0.45 0.082 230);       /* dugrActionPrimary light */
  --accent-ink: oklch(0.985 0.003 250);
  --accent-soft: oklch(0.45 0.082 230 / 0.12);
  --frost-300: oklch(0.55 0.082 230);
  --progress: oklch(0.55 0.110 50);      /* dugrProgressFill light */
  --progress-soft: oklch(0.55 0.110 50 / 0.14);
  --progress-ink: oklch(0.985 0.003 250);
  --ember-300: oklch(0.50 0.078 50);
  /* Semantik mörkas i ljust läge för textkontrast */
  --ok: oklch(0.55 0.110 155);
  --ok-soft: oklch(0.92 0.060 155 / 0.40);
  --caution: oklch(0.60 0.130 80);
  --caution-soft: oklch(0.92 0.080 80 / 0.40);
  --orange: oklch(0.57 0.140 55);
  --orange-soft: oklch(0.92 0.080 55 / 0.40);
  --stop: oklch(0.55 0.150 25);
  --stop-soft: oklch(0.92 0.080 25 / 0.40);
  --shadow-elev: 0 6px 18px oklch(0 0 0 / 0.08);
}

/* ── Design: Grunden (järn & bärnsten) ───────────────────────
   Appens ursprungliga palett, kvar som alternativ i Inställningar.
   Ärver form- och typografitokens från :root; bara färgerna (och de
   gamla radierna) skiljer. Progress == accent här — paletten har ingen
   egen Ember. */
:root[data-theme="grunden"] {
  --bg: #14110d;
  --surface: #1d1913;
  --surface-2: #262019;
  --surface-3: #2b241c;
  --line: rgba(242, 237, 227, 0.10);
  --line-strong: rgba(242, 237, 227, 0.18);
  --line-subtle: rgba(242, 237, 227, 0.06);
  --text: #f3eee4;
  --text-dim: #b6ab97;
  --muted: #857a68;
  --accent: #f2b13d;      /* bärnsten/mässing */
  --accent-ink: #1a1408;
  --accent-soft: rgba(242, 177, 61, 0.14);
  --frost-300: #f5c56a;
  --progress: #f2b13d;
  --progress-soft: rgba(242, 177, 61, 0.14);
  --progress-ink: #1a1408;
  --ember-300: #f5c56a;
  --ok: #93c073;
  --caution: #ecb44e;
  --orange: #e08b46;
  --stop: #e26a5c;
  --ok-soft: rgba(147, 192, 115, 0.12);
  --caution-soft: rgba(236, 180, 78, 0.14);
  --orange-soft: rgba(224, 139, 70, 0.14);
  --stop-soft: rgba(226, 106, 92, 0.14);
  --radius: 16px;
  --radius-sm: 11px;
}

:root[data-ljus][data-theme="grunden"] {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #f0ece2;
  --surface-3: #ffffff;
  --line: rgba(28, 22, 12, 0.10);
  --line-strong: rgba(28, 22, 12, 0.18);
  --line-subtle: rgba(28, 22, 12, 0.06);
  --text: #211b12;
  --text-dim: #5f5647;
  --muted: #8a8072;
  --accent: #b57411;
  --accent-ink: #ffffff;
  --accent-soft: rgba(181, 116, 17, 0.12);
  --frost-300: #c98a1f;
  --progress: #b57411;
  --progress-soft: rgba(181, 116, 17, 0.12);
  --progress-ink: #ffffff;
  --ember-300: #8f5c0d;
  --ok: #4f8b39;
  --caution: #a9761a;
  --orange: #ad5b16;
  --stop: #b8402f;
  --ok-soft: rgba(79, 139, 57, 0.12);
  --caution-soft: rgba(169, 118, 26, 0.12);
  --orange-soft: rgba(173, 91, 22, 0.12);
  --stop-soft: rgba(184, 64, 47, 0.10);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
a { color: var(--accent); }

/* Fokus: alltid synligt */
:focus-visible {
  outline: 2px solid var(--frost-300);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── App-skal ────────────────────────────────────────────── */
#app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--nav-h) + var(--safe-b) + 28px);
  min-height: 100vh;
}

/* ── Bottennav (tumzon) ──────────────────────────────────── */
#nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 0 8px var(--safe-b);
  display: flex;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-subtle);
  z-index: 40;
}
#nav .tab {
  flex: 1;
  background: none;
  border: none;
  color: var(--muted);
  font: 600 10px var(--mono);
  letter-spacing: 0.03em; /* normal versalisering sedan v2.51 — lugnare nav */
  min-height: var(--tap);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
}
#nav .tab svg { display: block; }
#nav .tab.active { color: var(--accent); }

/* ── Vilotimer ───────────────────────────────────────────── */
#rest-bar {
  position: fixed; top: 0; left: 0; right: 0;
  height: 0; overflow: hidden;
  background: var(--surface-2);
  z-index: 60;
  display: flex; align-items: center;
  transition: height 0.18s ease;
  padding-top: 0;
}
#rest-bar.show {
  height: calc(34px + var(--safe-t));
  padding-top: var(--safe-t);
}
#rest-fill {
  position: absolute; top: var(--safe-t); left: 0; bottom: 0;
  background: var(--progress-soft);
  border-right: 2px solid var(--progress);
  width: 100%;
  transition: width 0.2s linear;
}
#rest-label {
  position: relative;
  margin: 0 auto;
  font: 600 13px var(--mono);
  color: var(--progress);
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
#rest-bar.done { background: var(--progress); }
#rest-bar.done #rest-label { color: var(--progress-ink); }

@media (prefers-reduced-motion: reduce) {
  #rest-bar, #rest-fill, .btn, .pass-cta, #nav .tab,
  .ready-fill, .why-detail, .ex-progress-fill, .rest-inline-fill { transition: none; }
  .btn:active, .pass-cta:active, #nav .tab:active { transform: none; }
}

/* ── Rubriker ────────────────────────────────────────────── */
/* Typografiroller (v0.5): skärmrubrik 34/700, eyebrow mono 11/500 i
   0.18em, småetiketter mono 10/500 i 0.14em. Allt numeriskt och alla
   etiketter går i mono — det är instrumentkänslan. */
.view-head { margin: 6px 0 18px; }
.view-head h1 { font-size: 34px; letter-spacing: -0.025em; }
.eyebrow {
  font: 500 11px var(--mono); letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 4px;
}
.view-head .sub { color: var(--text-dim); font-size: 14px; margin-top: 3px; }
/* Vyhuvud med knapp till höger (v2.63): kugghjulet i Program. */
.view-head.head-row { display: flex; align-items: center; gap: 12px; }
.head-cog {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}

.badge {
  display: inline-block; font: 600 10px var(--mono);
  padding: 3px 8px; border-radius: 999px; letter-spacing: 0.1em;
  text-transform: uppercase; vertical-align: middle;
}
.badge-deload { background: var(--caution-soft); color: var(--caution); }

/* ── Kort ────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  width: 100%;
}
.muted-card { color: var(--text-dim); font-size: 15px; }

/* Dagens pass — stor tryckyta. Elevated-yta, inga gradienter (v0.5). */
.pass-cta {
  display: flex; align-items: center; gap: 12px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface-3);
  box-shadow: var(--shadow-elev);
  min-height: 84px;
}
.pass-cta:active { transform: scale(0.98); }
.pass-cta-main { flex: 1; }
.pass-cta-label { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.pass-cta-sub { color: var(--text-dim); font-size: 14px; margin-top: 3px; }
.pass-cta-arrow { font-size: 34px; color: var(--accent); line-height: 1; }
.day-info .pass-cta-label { font-size: 19px; }
.day-info .pass-cta-sub { margin-top: 5px; }

/* ── Morgonkoll ──────────────────────────────────────────── */
.morning h2 { font-size: 18px; margin-bottom: 12px; }
.field-row { display: flex; gap: 10px; }
.field-row label { flex: 1; }
label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-dim);
}
.morning input[type="number"], .settings input, .settings textarea, .note-label textarea {
  display: block; width: 100%; margin-top: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  min-height: var(--tap);
  font-size: 17px;
}
.note-label { margin-top: 12px; }
.note-label textarea { min-height: 0; resize: vertical; font-size: 15px; }
/* Fält i flex/grid-rader (v2.56): samma fältstil som ovan men utan
   display/width/margin — utan bakgrund blir de UA-vita och texten
   (color: inherit, ljus i mörkt läge) osynlig. */
.ml-note, .sp-form input, .ml-addgrid input {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  min-height: var(--tap);
}
.rpe-label {
  font: 500 11px var(--mono); letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
  margin: 14px 0 8px;
}

/* Morgonkollens frågerader och taggar */
.q-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 14px 0 8px; }
.q-head .rpe-label { margin: 0; }
.q-hint { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tag-row { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
  min-height: var(--tap); padding: 0 14px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 999px; color: var(--text-dim);
  font-weight: 600; font-size: 14px; cursor: pointer;
}
.tag-chip.sel { border-color: var(--caution); color: var(--caution); background: var(--caution-soft); }
.morning .field-row { margin-top: 14px; }

/* Skala 1–10: ett rutnät så alla tio ryms på en rad */
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.scale-btn {
  min-width: 0; min-height: var(--tap); padding: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--text-dim);
  font: 600 15px var(--mono);
}
.scale-btn.sel {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent);
}

/* ── Knappar ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 18px;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  font-weight: 600; font-size: 16px;
}
/* Tryck: scale 0.98, 140ms — aldrig spring/bounce */
.btn, .pass-cta, #nav .tab { transition: transform 140ms var(--ease); }
.btn:active, #nav .tab:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); width: 100%; margin-top: 14px; }
.btn.primary.big { min-height: 56px; font-size: 18px; }
.btn.ghost { background: var(--surface-3); border-color: var(--line); color: var(--text); }
.btn.link, .link {
  background: none; border: none; color: var(--accent);
  font-weight: 600; font-size: 13px; padding: 0; min-height: auto;
  text-decoration: underline; text-underline-offset: 2px;
}

/* ── Rekommendationskort (programförslag i onboardingen) ── */
.rec { border-left: 4px solid var(--muted); }
.rec-flags { font-size: 13px; font-weight: 700; color: var(--text-dim); }
.rec-text { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 6px; }
.rec-sub { font-size: 14.5px; line-height: 1.5; color: var(--text); margin-bottom: 8px; }
.rec-light-green { border-left-color: var(--ok); background: var(--ok-soft); }
.rec-light-yellow { border-left-color: var(--caution); background: var(--caution-soft); }
.rec-light-orange { border-left-color: var(--orange); background: var(--orange-soft); }
.rec-light-red { border-left-color: var(--stop); background: var(--stop-soft); }
.rec-light-red .rec-text { color: var(--stop); }

/* ── Idag: readiness-panelen ─────────────────────────────── */
.ready { display: flex; align-items: center; gap: 20px; }
.ready-ring { position: relative; width: 96px; height: 96px; flex: none; }
.ready-ring svg { display: block; transform: rotate(-90deg); }
/* Daily briefing 2.0 (v2.51): centrerat huvud, 150px-hero i trafikljus-
   färg, statuspill med detaljer bakom tryck, väntar-läge och planlås. */
.idag-head { text-align: center; }
.idag-datum {
  font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 2px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.idag-hem { background: none; border: none; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.idag-head h1 { font-size: 28px; letter-spacing: -0.02em; }
.hero-ready {
  display: flex; flex-direction: column; align-items: center;
  margin: 4px 0 14px; text-align: center;
}
.hero-ring {
  position: relative; width: 150px; height: 150px; flex: none;
  background: none; border: none; padding: 0; cursor: pointer;
}
.hero-ring svg { display: block; transform: rotate(-90deg); }
.hero-ring .ready-track { stroke-width: 10; }
.hero-ring .ready-track.dashed { stroke-dasharray: 3 8; stroke-linecap: round; }
.hero-ring .ready-fill { stroke-width: 10; stroke: var(--muted); }
.hero-ring.green .ready-fill { stroke: var(--ok); }
.hero-ring.yellow .ready-fill { stroke: var(--caution); }
.hero-ring.orange .ready-fill { stroke: var(--orange); }
.hero-ring.red .ready-fill { stroke: var(--stop); }
.hero-ready .ready-num { font-size: 44px; letter-spacing: -0.03em; }
.hero-ready .ready-num.dim { color: var(--muted); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  margin-top: 14px; padding: 7px 14px; border-radius: 9999px;
  border: none; cursor: pointer;
  background: var(--surface-2); color: var(--text-dim);
  font: 600 14px inherit; font-family: inherit;
}
.status-pill.green { background: var(--ok-soft); color: var(--ok); }
.status-pill.yellow { background: var(--caution-soft); color: var(--caution); }
.status-pill.orange { background: color-mix(in oklab, var(--orange) 18%, transparent); color: var(--orange); }
.status-pill.red { background: color-mix(in oklab, var(--stop) 18%, transparent); color: var(--stop); }
.status-meta { font-size: 12px; color: var(--muted); margin-top: 8px; }
.status-detalj { display: none; max-width: 340px; margin-top: 10px; }
.status-detalj.open { display: block; }
.status-detalj .ready-sub { font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.status-detalj .ready-phase { justify-content: center; margin-top: 6px; }
.vantar-text { font-size: 14px; line-height: 1.5; color: var(--text-dim); max-width: 260px; margin-top: 16px; }
.pill-cta { border-radius: 9999px; min-height: 48px; padding: 0 28px; margin-top: 14px; }
.btn.pill-cta { width: auto; } /* centrerad pill med egen bredd (mock 4b), inte fullbredd */
.plan-lock { opacity: 0.45; }
.plan-lock-note { font-size: 13px; color: var(--muted); text-align: center; margin: -6px 0 12px; }

/* Planen som tidslinje (v2.51): prickar, kopplingslinje, expander. */
.tidslinje { margin: 14px 0 16px; }
.tl-rad { display: flex; gap: 14px; }
.tl-ranna { display: flex; flex-direction: column; align-items: center; flex: none; width: 20px; }
.tl-prick {
  width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--accent); box-sizing: border-box; margin-top: 22px; flex: none;
}
.tl-prick.klar { border: none; background: var(--ok); }
.tl-prick.stilla { border-color: var(--muted); }
.tl-linje { flex: 1; width: 2px; background: var(--line); margin-top: 4px; }
.tl-innehall { flex: 1; min-width: 0; padding: 14px 0 18px; }
.tl-rad + .tl-rad .tl-innehall { border-top: 1px solid var(--line-subtle); }
.tl-klickbar { background: none; border: none; text-align: left; width: 100%; cursor: pointer; color: inherit; font: inherit; }
.tl-rad .tl-klickbar { border-top: none; }
.tl-rad + .tl-rad > .tl-klickbar, .tl-rad + .tl-rad > .tl-innehall { border-top: 1px solid var(--line-subtle); }
.tl-flex { display: flex; align-items: center; gap: 12px; }
.tl-vanster { flex: 1; min-width: 0; }
.tl-toprad { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.tl-titel { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.tl-titel.dim { color: var(--text-dim); }
.tl-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tl-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.tl-starta { min-height: 38px; padding: 0 18px; border-radius: 9999px; flex: none; }
/* .btn.primary:s width 100 % + margin vinner annars i specificitet och
   klämmer radens text till en ordkolumn (v2.55). */
.btn.tl-starta { width: auto; margin-top: 0; }
.tl-expand { display: none; }
.tl-expand.open { display: block; padding-top: 8px; }

/* Kost-minikortet på Idag (v2.51, designens 4a/4b): Ember-ring med
   procent, kcal kvar, tunna makro-barer och en rund logga-knapp. */
.kost-mini { display: flex; align-items: center; gap: 14px; }
.km-ring { position: relative; flex: none; width: 56px; height: 56px; }
.km-ring svg { transform: rotate(-90deg); }
.km-track-ring { fill: none; stroke: var(--surface-2); stroke-width: 5; }
.km-fyll {
  fill: none; stroke: var(--progress); stroke-width: 5;
  stroke-linecap: round; transition: stroke-dashoffset 420ms var(--ease);
}
.km-pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.km-titel { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.km-kvar { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.km-barer { display: flex; gap: 12px; margin-top: 8px; }
.km-bar { flex: 1; min-width: 0; }
.km-track { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.km-fill { height: 100%; border-radius: 2px; background: var(--progress); }
.km-fill.over { background: var(--orange); }
.km-label {
  font-size: 11px; color: var(--muted); margin-top: 4px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.km-plus {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  border: none; cursor: pointer; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  font-size: 22px; font-weight: 500; line-height: 1;
}

.ready-track { fill: none; stroke: var(--surface-2); stroke-width: 6; }
.ready-fill {
  fill: none; stroke: var(--progress); stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset 600ms var(--ease-glide);
}
.ready-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
/* Enda kursiven i systemet — readiness-siffran */
.ready-num {
  font-size: 30px; font-weight: 700; font-style: italic;
  letter-spacing: -0.03em; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.ready-num-label {
  font: 500 10px var(--mono); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); margin-top: 3px;
}
.ready-main { flex: 1; min-width: 0; }
.ready-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ready-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.ready-dot.green { background: var(--ok); }
.ready-dot.yellow { background: var(--caution); }
.ready-dot.orange { background: var(--orange); }
.ready-dot.red { background: var(--stop); }
.ready-title { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.ready-sub { font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.ready-phase {
  display: flex; align-items: baseline; gap: 8px; margin-top: 8px;
  font: 500 10px var(--mono); letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}
.ready-phase .link { margin-left: auto; }

/* ── Idag: beslutsstöd-raden ─────────────────────────────── */
.advice {
  display: flex; gap: 12px; align-items: flex-start;
  background: color-mix(in oklab, var(--surface) 94%, var(--accent));
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 20px;
}
.advice > svg { flex: none; margin-top: 1px; color: var(--accent); }
.advice-body { flex: 1; min-width: 0; }
.advice-text { font-size: 13.5px; line-height: 1.5; color: var(--text-dim); }
.why-btn {
  background: none; border: none; padding: 0; margin-top: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer;
}
.why-detail {
  overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height 240ms var(--ease), opacity 240ms var(--ease);
}
.advice.open .why-detail { max-height: 240px; opacity: 1; }
.why-inner {
  margin-top: 8px; padding-left: 12px;
  border-left: 2px solid var(--accent);
  font-size: 13px; line-height: 1.5; color: var(--text-dim);
}

/* ── Idag: hero-passkortet ───────────────────────────────── */
.pass-hero {
  background: var(--surface-3);
  border-color: var(--line);
  box-shadow: var(--shadow-elev);
}
.eyebrow.ember { color: var(--progress); }
.eyebrow.ok { color: var(--ok); }
.pass-hero .eyebrow { margin-bottom: 6px; }
/* Passkvittot: övningsrader i mono, deltat stillsamt. */
.kv-rader { margin: 12px 0 4px; }
.kv-rad {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 4px 0; border-bottom: 1px solid var(--line);
}
.kv-rad:last-child { border-bottom: none; }
.kv-namn { color: var(--text-dim); font-size: 13.5px; }
.kv-res { font: 500 13px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.kv-delta { color: var(--text-dim); }
.pass-hero-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.pass-hero-meta {
  font: 500 13px var(--mono); color: var(--text-dim);
  font-variant-numeric: tabular-nums; margin-bottom: 16px;
}
.pass-hero .btn.primary { margin-top: 0; min-height: 56px; font-size: 17px; }

/* ── Korthuvud med badge, delta-badges och grafhuvuden ───── */
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card-head .rpe-label { margin: 0; }
.delta-badge {
  flex: none; font: 500 10px var(--mono); letter-spacing: 0.1em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.delta-badge.ok, .delta-badge.up { background: var(--ok-soft); color: var(--ok); }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 10px; }
.chart-caption { font: 500 12px var(--mono); color: var(--muted); }
.chart .chart-val { fill: var(--text); font: 700 13px var(--mono); }
.chart .target-t { fill: var(--caution); }
.info-note { font-size: 13px; line-height: 1.5; color: var(--text-dim); margin-top: 6px; }
.foot-note { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 0; }

/* ── Små staplar ─────────────────────────────────────────── */
.small-stack .line {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.small-stack .line:last-child { border-bottom: none; }
.small-stack .k { color: var(--muted); font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; }
.small-stack .v { color: var(--text); font-size: 15px; text-align: right; }

/* ── Passvy ──────────────────────────────────────────────── */
.pass-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.back {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 50%; width: 40px; height: 40px; flex: none;
  color: var(--text); font-size: 24px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.pass-title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; }

/* Övningsprogress: linjär Ember-bar i stället för prickar */
.ex-progress {
  height: 6px; border-radius: 3px; background: var(--surface-2);
  overflow: hidden; margin-bottom: 20px;
}
.ex-progress-fill {
  height: 100%; width: 0%; border-radius: 3px;
  background: var(--progress);
  transition: width 420ms var(--ease-glide);
}

.ex-card {
  background: var(--surface); border: 1px solid var(--line-subtle);
  border-radius: var(--radius); padding: 20px; margin-bottom: 12px;
}
.ex-count { font: 500 11px var(--mono); color: var(--muted); letter-spacing: 0.18em; text-transform: uppercase; }
.ex-name { font-size: 26px; font-weight: 700; margin: 2px 0 4px; letter-spacing: -0.02em; }
.prescription { font: 500 13px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.presc-adj { color: var(--caution); }
.presc-note { color: var(--muted); font-weight: 600; font-size: 13px; font-family: var(--font); }
.ex-key { color: var(--text-dim); font-size: 14.5px; line-height: 1.5; margin-top: 8px; }

/* Logg-rutnät: Förra bredvid Idag */
.log-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 12px; margin-top: 18px; align-items: start; }
.today { min-width: 0; }
.prev { min-width: 0; }
.col-label { font: 500 10px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.prev {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 12px; border: 1px solid var(--line);
}
.prev-big { font: 700 34px var(--mono); letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.prev-big .unit { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-left: 3px; }
.prev-small { color: var(--text-dim); font-size: 14px; margin-top: 6px; }
.prev-week { color: var(--muted); font-size: 12px; margin-top: 8px; }
.prev-empty { color: var(--muted); font-size: 14px; font-style: italic; }

/* Steppers — scopade: måltidsloggen har egna, små steppknappar */
.stepper { display: flex; align-items: stretch; gap: 8px; margin-bottom: 10px; min-width: 0; }
.stepper .step-btn {
  width: 48px; flex: none; background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  color: var(--text); font-size: 20px; font-weight: 600; line-height: 1;
}
.step-btn:active { background: var(--accent-soft); }
.step-val {
  flex: 1; min-width: 0; position: relative; display: flex; align-items: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 0 10px;
}
.step-val input {
  width: 100%; min-width: 0;
  background: none; border: none; text-align: center;
  font: 700 24px var(--mono); letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  padding: 8px 0; min-height: 46px; -moz-appearance: textfield;
}
.step-val input::-webkit-outer-spin-button,
.step-val input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* Enheten ligger i hörnet, ur textflödet, så siffran får hela cellen */
.step-unit {
  position: absolute; right: 7px; bottom: 5px;
  font: 600 10px var(--mono); color: var(--muted);
  pointer-events: none; letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Hero: den siffra jag ska lyfta — störst på skärmen */
.stepper.hero .step-val input { font-size: 34px; }
.stepper.hero .step-btn { font-size: 24px; min-height: 58px; }
.stepper.hero .step-val { padding: 4px 8px; min-height: 58px; }

/* RPE */
.rpe { margin-top: 6px; }
.rpe-btns { display: flex; gap: 8px; }
.rpe-btn {
  flex: 1; min-height: 54px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  color: var(--text); font: 700 22px var(--mono);
}
.rpe-btn.sel { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Vilotimern i kortet: mm:ss i Ember + bar som fylls med förfluten vila */
.rest-inline {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-top: 16px;
  background: var(--surface-2); border-radius: var(--radius-sm);
}
.rest-lead { font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); margin-right: 2px; }
.rest-inline-time {
  font: 700 30px var(--mono); letter-spacing: -0.02em;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.rest-inline.running .rest-inline-time { color: var(--progress); }
.rest-inline-track { flex: 1; height: 6px; border-radius: 3px; background: var(--surface); overflow: hidden; }
.rest-inline-fill {
  width: 0%; height: 100%; border-radius: 3px;
  background: var(--progress);
  transition: width 0.2s linear;
}

/* Vila-rad (manuell vila + extra set) */
.rest-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.rest-row .btn { flex: 1; }

/* Sticky botten-CTA: "Logga set N" ovanför naven */
.cta-space { height: 76px; }
.cta-dock {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px);
  max-width: var(--maxw); margin: 0 auto;
  padding: 0 16px; z-index: 30;
}
.cta-dock .btn {
  width: 100%; margin-top: 0; min-height: 56px; font-size: 17px;
  box-shadow: 0 6px 16px oklch(0 0 0 / 0.35);
}

.hint {
  margin-top: 14px; padding: 10px 12px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
  color: var(--accent); font-size: 13.5px; font-weight: 600; line-height: 1.4;
}

/* Passnavigering */
.pass-nav { display: flex; gap: 10px; }
.pass-nav .btn { flex: 1; }
.pass-nav .btn.primary { margin-top: 0; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }

.finish .ex-name { margin-bottom: 6px; }

/* ── Historik ────────────────────────────────────────────── */
.select {
  width: 100%; margin-bottom: 12px; padding: 12px;
  min-height: var(--tap); border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--text);
}
.chart { width: 100%; height: auto; display: block; margin-top: 4px; }
.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
.chart .series { fill: none; stroke: var(--progress); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart circle { fill: var(--progress); }
.chart .tick { fill: var(--muted); font: 500 9px var(--mono); }
.chart-cap { color: var(--muted); font: 500 12px var(--mono); margin-top: 4px; text-align: center; font-variant-numeric: tabular-nums; }
.single-point { color: var(--text-dim); font-size: 15px; padding: 8px 0; }

.weeks { margin-top: 4px; }
.week-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.week-row:last-child { border-bottom: none; }
.week-no { width: 66px; flex: none; font: 600 13px var(--mono); }
.week-passes { display: flex; gap: 4px; flex: none; }
.pass-chip {
  width: 26px; height: 26px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font: 700 11px var(--mono);
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line-subtle);
}
.pass-chip.done { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pass-chip.cur {
  background: var(--accent-soft); color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 50%, transparent);
}
.week-stats { margin-left: auto; display: flex; gap: 10px; font: 500 12px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }

.saved-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Program (referens) ──────────────────────────────────── */
.acc {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: 10px; overflow: hidden;
}
.acc > summary {
  list-style: none; cursor: pointer;
  padding: 15px 16px; font-weight: 700; font-size: 16px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--tap);
}
.acc > summary::-webkit-details-marker { display: none; }
.acc > summary::after { content: "＋"; color: var(--accent); font-weight: 400; font-size: 20px; }
.acc[open] > summary::after { content: "－"; }
.acc-body { padding: 0 16px 16px; color: var(--text-dim); font-size: 14.5px; line-height: 1.55; }
.acc-body p { margin: 0 0 10px; }
.acc-body .muted { color: var(--muted); font-size: 13px; }

.block { padding: 10px 0; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: none; }
.block-h { color: var(--text); font-weight: 700; font-size: 15px; }
.block-w { color: var(--accent); font-weight: 700; font-size: 13px; }
.block-p { margin: 4px 0; }
.block-l { color: var(--muted); font-size: 13px; }

.ul { margin: 0; padding-left: 18px; }
.ul li { margin-bottom: 8px; }
.acc-body li strong { color: var(--text); }

/* Tabeller — fast layout så inget spiller ut på 390 px */
.tbl { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.tbl th, .tbl td {
  text-align: left; padding: 8px 6px; vertical-align: top;
  border-bottom: 1px solid var(--line); word-break: break-word;
  overflow-wrap: anywhere; hyphens: auto;
}
.tbl th { color: var(--muted); font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
.tbl td:first-child { color: var(--text); font-weight: 600; }

/* Passreferens */
.pass-ref-h { font-weight: 700; color: var(--text); margin-bottom: 8px; font-size: 15px; }
.ex-ref { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ex-ref:last-child { border-bottom: none; }
.ex-ref-top { display: flex; justify-content: space-between; gap: 10px; }
.ex-ref-n { color: var(--text); font-weight: 600; font-size: 14px; }
.ex-ref-p { color: var(--accent); font-weight: 700; font-size: 13px; flex: none; }
.ex-ref-k { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* Inställningar + IO */
.settings label { margin-bottom: 12px; }
.io-row { display: flex; flex-wrap: wrap; gap: 10px; }
/* Egen rad var: "Exportera JSON" ryms inte på en halv mobilbredd och
   bröt sig itu (samma fallgrop som v2.55). */
.io-row .btn { flex: 1 1 100%; margin-top: 0; }

/* ── Flera program (v2) ──────────────────────────────────── */

.badge-active { background: var(--accent); color: var(--accent-ink); flex: none; }

/* Programbläddraren (#/bibliotek): kort med metadata-chips, expanderat
   kort får Frost-kant och startflödet. Biblioteket är enda ytan för
   programval sedan v2.63. */
.prog-card { cursor: pointer; }
.prog-card.expanded { border-color: color-mix(in oklab, var(--accent) 50%, transparent); cursor: default; }
.prog-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.prog-card-name { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.prog-card-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.prog-card-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.meta-chip {
  font: 500 11.5px var(--mono); color: var(--text-dim);
  background: var(--surface-2); border-radius: 999px; padding: 3px 8px;
  white-space: nowrap;
}
.prog-card-audience { font-size: 13.5px; line-height: 1.45; color: var(--text-dim); margin-top: 8px; }
.prog-card-about { font-size: 13.5px; line-height: 1.5; margin: 10px 0 0; }
.prog-card-start { margin-top: 12px; display: grid; gap: 10px; }
.prog-card-start input[type="date"], .prog-card-start .select {
  width: 100%; padding: 12px; min-height: var(--tap);
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line-strong); color: var(--text); font: inherit;
}

/* Dagsloggens typchips och vanekortet (v2.37) */
.day-typ { margin-top: 10px; }

/* Kostplanens måltidschips (v2.38): hemifrån och uppskattad */
.ex-ref-k .meta-chip { margin: 0 4px 0 2px; vertical-align: 1px; }

/* Startkort på Idag när programmet saknar startdatum */
.start-card h2 { font-size: 20px; margin-bottom: 6px; }
.start-card p { margin: 0 0 12px; font-size: 14px; }
.start-card input[type="date"] {
  width: 100%; padding: 12px; min-height: var(--tap);
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line-strong); color: var(--text); font: inherit;
}
.done-card { border-left: 4px solid var(--ok); background: var(--ok-soft); }

/* Passvyn: set-schema, fasnotering, passklocka */
.scheme { color: var(--text-dim); font-size: 13px; font-weight: 600; margin-top: 4px; }
.week-note { color: var(--caution); font-size: 13px; margin-top: 6px; }
.pass-head-main { flex: 1; min-width: 0; }
.sess-clock {
  flex: none; min-width: 62px; min-height: 40px; padding: 8px 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text-dim);
  font: 600 15px var(--mono); font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.sess-clock.running {
  border-color: color-mix(in oklab, var(--progress) 50%, transparent);
  color: var(--progress);
}
.sess-clock.over { border-color: var(--stop); color: var(--stop); }

/* ── Set-för-set-loggning i passvyn ──────────────────────── */
.prev-line {
  display: flex; align-items: baseline; gap: 8px;
  margin: 12px 0 16px; font-size: 14px;
}
.prev-line .k {
  color: var(--muted); font: 500 10px var(--mono);
  text-transform: uppercase; letter-spacing: 0.14em;
}
.prev-line .v { color: var(--text-dim); font: 500 13px var(--mono); font-variant-numeric: tabular-nums; }
.prev-line .prev-week { color: var(--muted); font-size: 12px; margin-left: auto; }

.set-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.set-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--tap); padding: 10px 14px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--line-subtle);
  border-left: 2px solid transparent; border-radius: var(--radius-sm);
  color: var(--muted); font: inherit; cursor: pointer;
}
.set-row.active {
  border-color: var(--line); border-left-color: var(--accent);
  background: color-mix(in oklab, var(--accent) 8%, transparent);
  color: var(--text);
}
.set-row.done { color: var(--text-dim); }
.set-row-n { font: 600 13px var(--mono); flex: none; min-width: 42px; text-transform: uppercase; }
.set-row-t { flex: 1; font: 500 13px var(--mono); font-variant-numeric: tabular-nums; }
.set-check { color: var(--ok); font-weight: 800; flex: none; width: 16px; }
.set-input-label { margin-top: 4px; }
.set-all-done { color: var(--ok); font-size: 14.5px; font-weight: 600; padding: 6px 0 2px; }

.app-version { text-align: center; color: var(--muted); font: 500 11px var(--mono); margin: 10px 0 4px; }

/* Overrides — ändrad övning, målvikt och redigeraren */
.target-line { font-size: 14px; font-weight: 700; color: var(--progress); margin-top: 4px; }
.ov-note { font-size: 12.5px; color: var(--text-dim); margin-top: 4px; }
.hint-applied { font-size: 12.5px; font-weight: 700; color: var(--ok); }
.ex-edit { margin-top: 14px; }
.ex-edit .field-row { margin-bottom: 10px; }
.ex-edit input[type="number"], .ex-edit input[type="text"] {
  display: block; width: 100%; margin-top: 6px;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); color: var(--text);
  padding: 12px; min-height: var(--tap); font-size: 17px;
}
.ov-hint { font-size: 12.5px; margin: 8px 0 0; }
.ex-edit .btn { margin-top: 12px; }

/* Muskelkartan — anatomisk figur, intensitet mot volymramarna */
.mm-wrap { display: flex; gap: 16px; justify-content: center; margin: 8px 0 4px; }
.mm-wrap svg { width: 44%; max-width: 170px; height: auto; }
.mm-neutral { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.mm { fill: var(--surface-2); stroke: var(--line-strong); stroke-width: 1; }
.mm.lvl-1, .mm.lvl-2, .mm.lvl-3, .mm.lvl-4 { fill: var(--progress); stroke: none; }
.mm.lvl-1 { fill-opacity: 0.22; }
.mm.lvl-2 { fill-opacity: 0.45; }
.mm.lvl-3 { fill-opacity: 0.68; }
.mm.lvl-4 { fill-opacity: 1; }
.mm.lvl-5 { fill: var(--stop); stroke: none; }
.mm-cap { font-size: 11px; fill: var(--muted); text-anchor: middle; font-family: inherit; }
.mm-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mm-chip {
  font: 500 11px var(--mono); color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 10px;
  font-variant-numeric: tabular-nums;
}
.mm-chip.lvl-4 {
  border-color: color-mix(in oklab, var(--progress) 50%, transparent);
  color: var(--ember-300);
}
.mm-chip.lvl-5 { border-color: var(--stop); color: var(--stop); }
.mm-legend { font-size: 12px; margin-top: 8px; }

/* Balansen (obalansskanningen, steg 5b) */
.bal-find { padding: 8px 0; border-bottom: 1px solid var(--line-subtle); }
.bal-find:last-of-type { border-bottom: none; }
.bal-find p { margin: 0 0 4px; font-size: 14.5px; line-height: 1.55; }
.bal-find .muted { font-size: 13px; }
.bal-nums {
  font: 500 12px var(--mono); color: var(--muted);
  font-variant-numeric: tabular-nums; margin: 0 0 8px;
}
.bal-find .btn.primary { width: auto; min-height: 44px; margin-top: 4px; font-size: 14px; }

/* Styrkeprofilen (steg 5c) */
.sp-find { padding: 8px 0; }
.sp-find p { margin: 0 0 4px; }
.sp-tier {
  display: inline-block; min-width: 18px; text-align: center;
  font: 600 10px var(--mono); color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: 3px 6px; margin-right: 4px;
}
.sp-why { margin: 4px 0; font-size: 13.5px; }
.sp-why summary { cursor: pointer; color: var(--accent); font-size: 12px; font-weight: 600; }
/* Bahr-ansvarsraden — alltid sist, alltid lågmäld */
.sp-foot {
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  border-top: 1px solid var(--line-subtle); padding-top: 10px; margin: 12px 0 0;
}
.sp-why ul { margin: 6px 0 0 18px; padding: 0; }
.sp-why li { margin-bottom: 4px; }
.sp-form { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.sp-form input { flex: 1; min-width: 0; }

/* Måltidsloggen (fotologgningen, steg 6a) */
.ml-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.ml-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ml-macro { font: 500 13px var(--mono); font-variant-numeric: tabular-nums; }
.ml-sum { font-weight: 600; padding-top: 6px; border-top: 1px solid var(--line); }
.ml-del { flex-shrink: 0; }
.ml-preview { max-width: 100%; max-height: 220px; border-radius: 10px; display: block; margin: 8px 0; }
.ml-note { width: 100%; margin-bottom: 8px; }
.ml-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.ml-shoot { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
/* Kostens dagshjälte (v2.47): återstående-ringen och makrostaplarna. */
.kost-hero-top { display: flex; gap: 16px; align-items: center; }
.kost-hero-top .mtyp-add { align-self: flex-start; }
.kost-hero-main { flex: 1; min-width: 0; display: grid; gap: 7px; }
.kcal-ring .kcal-fill { fill: none; stroke: var(--progress); stroke-width: 6; stroke-linecap: round; }
.kcal-goal { font: 600 13px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.makro-head { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-dim); margin-bottom: 3px; }
.makro-rad .ml-bar { margin: 0; }
.kost-hero .kcal-sub { margin-top: 10px; }

/* Måltidskorten (v2.47): typgrupperna i loggen. */
.mtyp { border-top: 1px solid var(--line); padding: 8px 0 6px; }
.mtyp:first-of-type { border-top: none; padding-top: 0; }
.mtyp-head { display: flex; align-items: center; gap: 8px; }
.mtyp-head .rpe-label { margin: 0; }
.mtyp-sum { margin-left: auto; font: 500 12px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.mtyp-add {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 16px; line-height: 1;
  flex-shrink: 0; cursor: pointer;
}
.mtyp-freq { margin-top: 6px; }
.mtyp-freq .tag-chip { font-size: 13px; }
.mld-nav { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.mld-datum { font: 600 12px var(--mono); color: var(--text-dim); }
.mld-pil {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 15px; line-height: 1; cursor: pointer;
}
.mld-pil:disabled { opacity: 0.35; cursor: default; }

.ml-typrow { margin-top: 10px; }
.ml-textrow { display: flex; gap: 8px; margin-top: 8px; }
.ml-textrow .ml-note { margin-bottom: 0; }
.ml-textrow .btn { flex-shrink: 0; }
.ml-day-sum { font: 600 12px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.ml-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 0 0 12px; }
.ml-bar-fill { height: 100%; width: 0%; background: var(--progress); border-radius: 3px; }
.ml-dish { font-weight: 600; margin: 4px 0; }
.ml-comp { border-bottom: 1px solid var(--line); padding: 2px 0 6px; }
.ml-comp:last-of-type { border-bottom: none; }
.ml-stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.ml-g { min-width: 48px; text-align: center; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ml-stepper .step-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-size: 16px; line-height: 1;
}
.ml-total { font-weight: 600; margin-top: 8px; }
.ml-addgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }
.ml-addgrid input { min-width: 0; }
.conf-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: baseline;
}
.conf-dot.high { background: var(--progress); }
.conf-dot.medium { background: var(--orange); }
.conf-dot.low { background: var(--stop); }

/* Träningscoachens förslagskort */
.tc-note { font-size: 14.5px; line-height: 1.5; margin: 12px 0; }
.tc-card {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px;
}
.tc-card.applied { border-color: var(--ok); }
.tc-what { font-weight: 700; font-size: 15px; }
.tc-why { font-size: 13.5px; color: var(--text-dim); margin: 4px 0 10px; }
.tc-actions { display: flex; gap: 14px; align-items: center; }
.tc-actions .btn { margin: 0; }
.tc-meta { font-size: 12px; margin-top: 8px; }

/* Veckorapport och Söndagsbrevet */
.muted { color: var(--text-dim); }
.report-card .hint { margin-top: 12px; }
.report-card .rpe-label:not(:first-child) { margin-top: 16px; }
.report-card .eyebrow { margin-bottom: 10px; }
.report-body { font-size: 15px; line-height: 1.55; color: var(--text-dim); margin: 12px 0 0; }

/* ── Dagslogg (zon 2/yoga) och tung arbetsdag ────────────── */
.day-log { display: flex; gap: 8px; margin-top: 12px; }
.day-check { flex: 1; margin: 0; }
.day-check.on { border-color: transparent; color: var(--ok); background: var(--ok-soft); }
.day-min {
  width: 86px; padding: 12px; min-height: var(--tap);
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line-strong); color: var(--text);
  font: 500 17px var(--mono); font-variant-numeric: tabular-nums;
  text-align: center;
}
.yoga-toggle {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--text); font: inherit; font-size: 15px; cursor: pointer;
  text-align: right;
}
.yoga-toggle.on { color: var(--ok); font-weight: 700; }

/* ── Uppdateringsbanner ──────────────────────────────────── */
#upd-bar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--nav-h) + var(--safe-b));
  display: none; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 14px; font-weight: 600; line-height: 1.35;
  z-index: 50;
}
#upd-bar.show { display: flex; }
#upd-bar span { flex: 1; }
#upd-go {
  flex: none; min-height: 36px; padding: 6px 14px;
  border: none; border-radius: 999px;
  background: var(--accent-ink); color: var(--accent);
  font: inherit; font-weight: 700; cursor: pointer;
}

/* ── Kost ────────────────────────────────────────────────── */
.weight-row { display: flex; gap: 10px; align-items: stretch; margin-top: 4px; }
.weight-row input {
  flex: 1; min-width: 0; padding: 10px 12px; min-height: var(--tap);
  border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line-strong); color: var(--text);
  font: 700 34px var(--mono); letter-spacing: -0.02em; text-align: center;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.weight-row input::-webkit-outer-spin-button,
.weight-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.weight-row .btn { margin-top: 0; flex: none; width: auto; min-width: 96px; }
.kcal-big { font: 700 48px var(--mono); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.kcal-big .unit { font-size: 14px; font-weight: 600; color: var(--text-dim); margin-left: 6px; text-transform: uppercase; }
.kcal-sub { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.macro-cell {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 8px; text-align: center;
}
.macro-val { font: 700 22px var(--mono); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.macro-k {
  font: 500 10px var(--mono); color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em; margin-top: 2px;
}
.chart .target-line { stroke: var(--caution); stroke-width: 1.5; stroke-dasharray: 5 4; }

/* Energibalansen: tre statceller, skenbar TDEE i Ember */
.eb-grid { margin: 4px 0 14px; }
.macro-cell.eb-tdee { border-color: color-mix(in oklab, var(--progress) 50%, transparent); }
.eb-tdee .macro-val { color: var(--ember-300); }
.eb-note { font-size: 14px; line-height: 1.55; color: var(--text-dim); margin: 0 0 12px; }
.eb-note strong { color: var(--text); }
.eb-knappar { display: flex; gap: 10px; }
.eb-knappar .btn { flex: none; }

/* ── Program: aktivt kort ────────────────────────────────── */
.prog-active { border-color: color-mix(in oklab, var(--accent) 50%, transparent); }
.prog-active-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.prog-active-name { font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.prog-active-meta { font: 500 12px var(--mono); color: var(--text-dim); font-variant-numeric: tabular-nums; }
.prog-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 14px; }
.prog-progress-fill { height: 100%; width: 0%; background: var(--progress); border-radius: 3px; }
/* Veckans läge (v2.63): kortets svar på "var är jag". */
.prog-active-vecka { font-size: 13.5px; line-height: 1.45; color: var(--text-dim); margin-top: 12px; }
.tier-chip {
  flex: none; font: 500 10px var(--mono); letter-spacing: 0.1em;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid color-mix(in oklab, var(--ember-300) 35%, transparent);
  color: var(--ember-300);
}
.prog-chevron { color: var(--muted); flex: none; }
.prog-chevron.accent { color: var(--accent); font-weight: 600; }
.advice-cta { width: 100%; text-align: left; cursor: pointer; align-items: center; font: inherit; color: inherit; }
.advice-title { display: block; font-size: 14px; font-weight: 600; color: var(--text); }
.advice-sub { display: block; font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
