/* ============================================================
   Fitness page — early-2000s bodybuilding MAGAZINE look
   (FLEX / MuscleMag energy), modernized: black + FLEX-red +
   cover-line yellow, huge skewed Impact headlines, black/red
   banner labels, big bold numerals, halftone texture.
   Loads on top of style.css; scoped to body[data-page="fitness"].
   ============================================================ */

body[data-page="fitness"] {
  --accent: #e30613;        /* FLEX red */
  --accent-2: #ff2a2a;
  --yellow: #ffd200;        /* cover-line / highlight yellow */
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1f1f24;
  --border: #2e2e35;
  background:
    radial-gradient(900px 380px at 50% -6%, rgba(227,6,19,.18), transparent 70%),
    #0c0c0e;
}

/* shared display font */
body[data-page="fitness"] .fit-hero h1,
body[data-page="fitness"] .fit-h2,
body[data-page="fitness"] .num-card .nv,
body[data-page="fitness"] .cover-line,
body[data-page="fitness"] .macros h4,
body[data-page="fitness"] .burst {
  font-family: Impact, "Haettenschweiler", "Franklin Gothic Bold", "Arial Narrow", sans-serif;
}

/* ---------- Hero (cover masthead) ---------- */
.fit-hero { position: relative; overflow: hidden;
  background:
    radial-gradient(1000px 480px at 50% -16%, rgba(227,6,19,.30), transparent 66%),
    linear-gradient(#121214, #0c0c0e);
}
.fit-hero::before {                         /* halftone dots */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .10;
  background-image: radial-gradient(rgba(255,255,255,.85) 1px, transparent 1.6px);
  background-size: 7px 7px;
}
.fit-hero .wrap { position: relative; }
.fit-hero .eyebrow { color: var(--yellow); letter-spacing: .2em; }
.fit-hero h1 {
  text-transform: uppercase; font-weight: 900; line-height: .85; letter-spacing: 1px;
  font-size: clamp(3rem, 10vw, 6.2rem); margin: 0 0 18px; color: #fff;
  transform: skewX(-6deg);
  text-shadow: 4px 4px 0 var(--accent), 7px 7px 0 rgba(0,0,0,.45);
}
.fit-hero p { font-size: 1.12rem; }

/* cover-line callouts (also jump-links to the sections) */
.cover-lines { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.cover-line {
  display: inline-flex; align-items: center; text-decoration: none; color: #fff;
  background: #000; border: 2px solid var(--accent); transform: skewX(-9deg);
  text-transform: uppercase; letter-spacing: .5px; font-size: .92rem; padding: 8px 15px;
}
.cover-line span { display: inline-block; transform: skewX(9deg); }
.cover-line b { color: var(--yellow); font-style: normal; }
.cover-line:hover { background: var(--accent); }

/* corner "sticker" badge */
.burst {
  position: absolute; top: 6px; right: 10px; width: 104px; height: 104px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; text-align: center;
  background: var(--yellow); color: #000; border: 4px solid var(--accent);
  text-transform: uppercase; line-height: .92; font-size: 1rem; letter-spacing: .5px;
  transform: rotate(-13deg); box-shadow: 0 6px 18px rgba(0,0,0,.55);
}

/* ---------- Section banner labels (TRAINING / NUTRITION style) ---------- */
.fit-h2 {
  display: inline-block; background: #000; color: #fff; text-transform: uppercase;
  letter-spacing: 1px; font-size: clamp(1.5rem, 4.4vw, 2.1rem);
  padding: 8px 20px 7px; transform: skewX(-9deg);
  border-bottom: 5px solid var(--accent); box-shadow: 4px 4px 0 rgba(0,0,0,.45); margin: 0;
}
.fit-h2 span { display: inline-block; transform: skewX(9deg); }
.fit-h2 + .lead { margin-top: 16px; }

/* ============================================================
   FIND YOUR NUMBERS — calculator + tracker
   ============================================================ */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: start; margin-top: 18px; }

/* ---- form ---- */
.calc-form {
  background: var(--surface); border: 1px solid var(--border); border-top: 4px solid var(--accent);
  border-radius: 12px; padding: 18px 20px 20px;
}
.calc-form .ctrl { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.calc-form .ctrl-l { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.calc-form label {
  display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 12px 0 6px;
}
.calc-form input[type="number"], .calc-form select {
  width: 100%; padding: 10px 12px; font-size: 1rem; color: #fff; background: #0d0d10;
  border: 1px solid var(--border); border-radius: 8px; font-family: inherit;
}
.calc-form input:focus, .calc-form select:focus { outline: none; border-color: var(--accent); }
.calc-form .field-row { display: flex; flex-wrap: wrap; gap: 12px; }
.calc-form .field { flex: 1 1 90px; }
.calc-form .field label { margin-top: 0; }
.calc-form .dual { display: flex; gap: 8px; }

/* segmented toggles */
.seg { display: inline-flex; background: #0d0d10; border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 3px; }
.seg.goals { display: flex; width: 100%; }
.seg-btn {
  flex: 1; cursor: pointer; border: 0; background: transparent; color: var(--muted);
  font: inherit; font-size: .85rem; padding: 7px 13px; border-radius: 7px; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .03em; transition: background .12s, color .12s;
}
.seg-btn:hover { color: #fff; }
.seg-btn.is-on { background: linear-gradient(#ff2a2a, #e30613); color: #fff; font-weight: 700; }
.calc-go { width: 100%; margin-top: 18px; padding: 12px; font-size: 1rem; }
.calc-err { margin: 10px 0 0; color: #ff8a8a; font-size: .88rem; font-weight: 600; }

/* ---- results ---- */
.calc-out {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 20px 20px; min-height: 100%;
}
.calc-ph { display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; height: 100%; min-height: 260px; color: var(--muted);
  background: repeating-linear-gradient(45deg, #141418 0 14px, #17171c 14px 28px); border-radius: 8px; }
.calc-ph .ico { font-size: 2.4rem; margin-bottom: 8px; }

.num-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.num-card {
  background: #0d0d10; border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 10px; text-align: center;
}
.num-card.hot { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgba(227,6,19,.4); background: #160d0f; }
.num-card .nl { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.num-card .nv { display: block; font-size: 2.1rem; line-height: 1; color: #fff; margin: 4px 0 3px; }
.num-card.hot .nv { color: var(--yellow); }
.num-card .ns { display: block; font-size: .72rem; color: var(--muted); }

/* BMI meter */
.bmi-meter { position: relative; margin: 22px 0 30px; }
.bmi-track { height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #5aa9ff 0 14%, #4ad991 14% 40%, #ffd200 40% 60%, #ff5a5a 60% 100%); }
.bmi-mark { position: absolute; top: -5px; width: 4px; height: 22px; border-radius: 2px;
  background: #fff; box-shadow: 0 0 0 2px #000, 0 2px 6px rgba(0,0,0,.6); transform: translateX(-50%); }
.bmi-scale { position: relative; height: 16px; margin-top: 6px; }
.bmi-scale span { position: absolute; transform: translateX(-50%); font-size: .68rem; color: var(--muted); font-family: var(--mono); }

/* macros */
.macros h4 { margin: 0 0 10px; text-transform: uppercase; letter-spacing: 1px; font-size: 1.1rem; color: #fff; }
.macro { margin-bottom: 10px; }
.macro-top { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.macro-top b { color: #fff; }
.macro-bar { height: 9px; background: #0d0d10; border-radius: 5px; overflow: hidden; }
.macro-bar span { display: block; height: 100%; border-radius: 5px; }
.save-snap { width: 100%; margin-top: 16px; }

.disclaimer { margin: 20px 0 0; font-size: .8rem; color: #6f7480; line-height: 1.5; }

/* ---- progress tracker ---- */
.tracker {
  margin-top: 22px; background: var(--surface); border: 1px solid var(--border);
  border-top: 4px solid var(--yellow); border-radius: 12px; padding: 18px 20px 20px;
}
.tracker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tracker-head h3 { margin: 0; text-transform: uppercase; letter-spacing: 1px; font-size: 1.2rem; color: #fff;
  font-family: Impact, "Arial Narrow", sans-serif; }
.tracker-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-btn.danger { border-color: #4a3030; color: #ff8a8a; }
.plan-btn.danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tracker-empty { color: var(--muted); margin: 16px 0 0; }

.spark { margin: 16px 0; }
.spark-cap { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.spark-delta { font-weight: 700; color: var(--muted); }
.spark-delta.down { color: #4ad991; }
.spark-delta.up { color: #ff8a8a; }
.spark-svg { display: block; width: 100%; height: 120px; background: #0d0d10; border: 1px solid var(--border); border-radius: 8px; }
.spark-area { fill: rgba(255,210,0,.12); stroke: none; }
.spark-line { fill: none; stroke: var(--yellow); stroke-width: 2; vector-effect: non-scaling-stroke; }

.trk-list { margin-top: 10px; }
.trk-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px solid var(--border); }
.trk-row:last-child { border-bottom: 0; }
.trk-date { font-family: var(--mono); font-size: .8rem; color: var(--yellow); min-width: 96px; }
.trk-stat { font-size: .9rem; color: var(--muted); }
.trk-stat b { color: #fff; font-size: 1rem; }
.trk-stat small { font-size: .72rem; }
.trk-del { margin-left: auto; cursor: pointer; background: transparent; border: 1px solid var(--border);
  color: var(--muted); width: 26px; height: 26px; border-radius: 6px; line-height: 1; font-size: .8rem; }
.trk-del:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ============================================================
   WORKOUT HISTORY — past-plan archive
   ============================================================ */
.arch-cat { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 2px; }
.arch-cat:first-child { margin-top: 16px; }
.arch-cat .act {
  font-family: Impact, "Haettenschweiler", "Franklin Gothic Bold", "Arial Narrow", sans-serif;
  text-transform: uppercase; letter-spacing: 1px; font-size: 1.35rem; color: #fff;
  border-bottom: 4px solid var(--accent); padding: 0 6px 3px 2px;
}
.arch-cat .acn { font-family: var(--mono); font-size: .74rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); }

.arch-list { margin-top: 10px; border-top: 1px solid var(--border); }
.arch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 0; border-bottom: 1px solid var(--border); }
.arch-meta { display: flex; flex-direction: column; gap: 3px; }
.arch-date { font-family: var(--mono); font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; color: var(--yellow); }
.arch-title { font-size: 1.12rem; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .4px; }
.arch-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.arch-empty { margin-top: 16px; padding: 30px 24px; text-align: center; color: var(--muted);
  border: 2px dashed var(--border); border-radius: 10px;
  background: repeating-linear-gradient(45deg, #141418 0 14px, #17171c 14px 28px); }

/* ---------- Current Plan: framed PDF viewer ---------- */
.plan-viewer { border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #0e0e11; box-shadow: 0 14px 36px rgba(0,0,0,.5); }
.plan-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; background: linear-gradient(#1b1b20, #141417); border-bottom: 3px solid var(--accent); }
.plan-title { display: flex; align-items: center; gap: 9px; color: #fff;
  font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: 1px; font-size: 1.05rem; }
.plan-title .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(227,6,19,.25); }
.plan-title .plan-date { font-family: var(--mono); font-size: .72rem; letter-spacing: 0;
  text-transform: none; color: var(--muted); margin-left: 4px; }
.plan-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; text-decoration: none;
  font-family: inherit; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: #fff;
  background: #000; border: 1px solid var(--border); border-radius: 7px; padding: 6px 11px; }
.plan-btn:hover { border-color: var(--accent); background: #1a1a1f; }
.plan-btn.primary { background: linear-gradient(#ff2a2a, #e30613); border-color: #e30613; }
.plan-doc { padding: 14px; background: #23232a; }
.plan-doc iframe { display: block; width: 100%; height: 640px; border: 0; border-radius: 6px; background: #fff; }

.plan-empty { border: 2px dashed var(--border); border-radius: 10px; padding: 42px 24px; text-align: center;
  color: var(--muted); background: repeating-linear-gradient(45deg, #141418 0 14px, #17171c 14px 28px); }
.plan-empty .ico { font-size: 2.6rem; margin-bottom: 8px; }
.plan-empty h3 { color: var(--text); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 6px; }
.plan-empty .lead { margin: 0; }

/* fullscreen reading mode */
.plan-modal { position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column; background: rgba(0,0,0,.9); }
.plan-modal.open { display: flex; }
.plan-modal .pm-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px;
  background: #0e0e11; border-bottom: 3px solid var(--accent); }
.plan-modal .pm-bar .t { font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase; letter-spacing: 1px; color: #fff; }
.plan-modal .pm-close { cursor: pointer; border: 0; border-radius: 7px; padding: 7px 14px; font-weight: bold;
  text-transform: uppercase; color: #fff; background: linear-gradient(#ff2a2a, #e30613); }
.plan-modal iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* ---------- Macro Scanner ---------- */
.food-tools { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 16px; }
.food-tools input { background: #0d0d10; border: 1px solid var(--border); border-radius: 7px;
  color: #fff; padding: 8px 11px; font: inherit; font-size: .9rem; width: 170px; }
.food-tools input:focus { outline: none; border-color: var(--accent); }
.fd-or { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
#fd-scanbox { margin-top: 14px; border: 2px dashed var(--border); border-radius: 10px;
  padding: 14px; text-align: center; background: #0d0d10; }
#fd-view { max-width: 420px; margin: 0 auto; }
#fd-view video { width: 100%; border-radius: 8px; }
.fd-scanrow { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 10px; }
.fd-engine { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fd-engine.good { color: #7ee0a6; }
/* decode workspace: must have REAL dimensions (display:none breaks the JS
   decoder's file scanning) but stay invisible — parked off-screen instead */
.fd-offscreen { position: absolute; left: -10000px; top: 0; width: 800px; height: 600px; overflow: hidden; }
.fd-hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.fd-hint a { color: var(--yellow); }
.fd-status { margin: 12px 0 0; font-weight: 600; color: #7ee0a6; }
.fd-status.err { color: #ff8a8a; }
.fd-none { color: var(--muted); font-style: italic; margin: 10px 0 0; }

.fd-card { margin-top: 16px; background: var(--surface); border: 1px solid var(--border);
  border-top: 4px solid var(--yellow); border-radius: 10px; padding: 16px 18px; }
.fd-name { font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase;
  letter-spacing: .5px; font-size: 1.3rem; color: #fff; }
.fd-brand { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.fd-portion { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin: 12px 0 4px; }
.fd-portion select, .fd-portion input { background: #0d0d10; border: 1px solid var(--border);
  border-radius: 7px; color: #fff; padding: 8px 10px; font: inherit; font-size: .9rem; }
.fd-portion input { width: 90px; }
.fd-macros { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }
.fd-m { color: var(--muted); font-size: .9rem; }
.fd-m b { color: var(--yellow); font-size: 1.05rem; }
.fd-man { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fd-man input { background: #0d0d10; border: 1px solid var(--border); border-radius: 7px;
  color: #fff; padding: 8px 10px; font: inherit; font-size: .9rem; width: 105px; }
.fd-man input#fm-name { flex: 1 1 200px; }

.fd-sres { display: flex; justify-content: space-between; gap: 12px; cursor: pointer;
  padding: 10px 12px; margin-top: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; }
.fd-sres:hover { border-color: var(--accent); }
.fd-sres .n { color: #fff; font-weight: 600; }
.fd-sres .n i { color: var(--muted); font-style: normal; font-weight: 400; }
.fd-sres .k { color: var(--yellow); font-size: .85rem; white-space: nowrap; }

.food-log { margin-top: 22px; background: var(--surface); border: 1px solid var(--border);
  border-top: 4px solid var(--accent); border-radius: 12px; padding: 16px 18px 18px; }
.fd-log-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.fd-log-head h3 { margin: 0; font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase;
  letter-spacing: 1px; font-size: 1.2rem; color: #fff; }
.fd-date { font-family: var(--mono); font-size: .78rem; text-transform: uppercase;
  letter-spacing: .08em; color: var(--yellow); }
.fd-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--border); }
.fd-row:last-child { border-bottom: 0; }
.fd-rn { flex: 1 1 200px; color: #fff; font-weight: 600; }
.fd-rn i { color: var(--muted); font-style: normal; font-weight: 400; }
.fd-rn small { color: var(--muted); font-weight: 400; }
.fd-rk { color: var(--muted); font-size: .9rem; } .fd-rk b { color: var(--yellow); }
.fd-rm { color: var(--muted); font-size: .82rem; }
.fd-del { cursor: pointer; background: transparent; border: 1px solid var(--border); color: var(--muted);
  width: 24px; height: 24px; border-radius: 6px; line-height: 1; font-size: .75rem; }
.fd-del:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

@media (max-width: 820px) {
  .calc { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .burst { width: 78px; height: 78px; font-size: .78rem; top: 2px; right: 4px; }
  .plan-doc iframe { height: 460px; }
  .plan-btn .lbl { display: none; }
  .num-card .nv { font-size: 1.6rem; }
  .arch-row { align-items: flex-start; }
  .trk-date { min-width: 0; }
}

/* ============================================================
   LIGHT MODE — fitness page (magazine-on-white variant).
   The toggle button styles live in style.css (global).
   ============================================================ */
html[data-theme="light"] body[data-page="fitness"] {
  --surface: #ffffff; --surface-2: #ecebe6;
  --text: #17171a; --muted: #5c6069; --border: #ddd9d0;
  --bg: #f3f1ec;
  background:
    radial-gradient(900px 380px at 50% -6%, rgba(227,6,19,.10), transparent 70%),
    #f3f1ec;
  color: var(--text);
}
html[data-theme="light"] body[data-page="fitness"] .site-nav { background: rgba(255,255,255,.85); }
html[data-theme="light"] body[data-page="fitness"] .fit-hero {
  background:
    radial-gradient(1000px 480px at 50% -16%, rgba(227,6,19,.16), transparent 66%),
    linear-gradient(#ffffff, #f3f1ec);
}
html[data-theme="light"] body[data-page="fitness"] .fit-hero::before {
  background-image: radial-gradient(rgba(0,0,0,.5) 1px, transparent 1.6px); opacity: .07;
}
html[data-theme="light"] body[data-page="fitness"] .fit-hero h1 { color: #141414; }

/* calculator + tracker */
html[data-theme="light"] body[data-page="fitness"] .calc-form input[type="number"],
html[data-theme="light"] body[data-page="fitness"] .calc-form select { background: #ffffff; color: #17171a; }
html[data-theme="light"] body[data-page="fitness"] .seg { background: #ecebe6; }
html[data-theme="light"] body[data-page="fitness"] .seg-btn:hover { color: #17171a; }
html[data-theme="light"] body[data-page="fitness"] .calc-ph,
html[data-theme="light"] body[data-page="fitness"] .arch-empty,
html[data-theme="light"] body[data-page="fitness"] .plan-empty {
  background: repeating-linear-gradient(45deg, #efeef0 0 14px, #e7e6e9 14px 28px);
}
html[data-theme="light"] body[data-page="fitness"] .num-card { background: #f7f6f8; }
html[data-theme="light"] body[data-page="fitness"] .num-card.hot { background: #fff2f2; }
html[data-theme="light"] body[data-page="fitness"] .num-card .nv,
html[data-theme="light"] body[data-page="fitness"] .macros h4,
html[data-theme="light"] body[data-page="fitness"] .macro-top b,
html[data-theme="light"] body[data-page="fitness"] .tracker-head h3,
html[data-theme="light"] body[data-page="fitness"] .trk-stat b,
html[data-theme="light"] body[data-page="fitness"] .arch-cat .act,
html[data-theme="light"] body[data-page="fitness"] .arch-title,
html[data-theme="light"] body[data-page="fitness"] .plan-title,
html[data-theme="light"] body[data-page="fitness"] .fd-name,
html[data-theme="light"] body[data-page="fitness"] .fd-sres .n,
html[data-theme="light"] body[data-page="fitness"] .fd-rn { color: #17171a; }
html[data-theme="light"] body[data-page="fitness"] .macro-bar,
html[data-theme="light"] body[data-page="fitness"] .spark-svg { background: #e8e7ea; }

/* greens / reds tuned for contrast on white */
html[data-theme="light"] body[data-page="fitness"] .spark-delta.down,
html[data-theme="light"] body[data-page="fitness"] .fd-status,
html[data-theme="light"] body[data-page="fitness"] .fd-engine.good { color: #128a4a; }
html[data-theme="light"] body[data-page="fitness"] .spark-delta.up,
html[data-theme="light"] body[data-page="fitness"] .calc-err,
html[data-theme="light"] body[data-page="fitness"] .fd-status.err { color: #c0392b; }

/* plan viewer toolbar + frame */
html[data-theme="light"] body[data-page="fitness"] .plan-viewer { background: #ffffff; box-shadow: 0 14px 36px rgba(0,0,0,.14); }
html[data-theme="light"] body[data-page="fitness"] .plan-bar { background: linear-gradient(#f4f3f5, #e9e8ea); }
html[data-theme="light"] body[data-page="fitness"] .plan-btn { background: #ffffff; color: #17171a; }
html[data-theme="light"] body[data-page="fitness"] .plan-btn:hover { background: #f0eff1; }
html[data-theme="light"] body[data-page="fitness"] .plan-btn.primary { background: linear-gradient(#ff2a2a, #e30613); border-color: #e30613; color: #fff; }
html[data-theme="light"] body[data-page="fitness"] .plan-btn.danger { color: #c0392b; border-color: #e0b4b4; }
html[data-theme="light"] body[data-page="fitness"] .plan-doc { background: #e9e8ea; }

/* macro scanner inputs */
html[data-theme="light"] body[data-page="fitness"] .food-tools input,
html[data-theme="light"] body[data-page="fitness"] .fd-portion select,
html[data-theme="light"] body[data-page="fitness"] .fd-portion input,
html[data-theme="light"] body[data-page="fitness"] .fd-man input { background: #ffffff; color: #17171a; }
html[data-theme="light"] body[data-page="fitness"] #fd-scanbox { background: #f7f6f8; }

/* phones: Units/Sex/Goal rows wrap and their buttons shrink, so the segmented
   controls can never force the page wider than the screen (this was stretching
   the whole layout viewport to ~444px on a 375px phone). */
@media (max-width: 640px) {
  .calc-form .ctrl { flex-wrap: wrap; }
  .calc-form .seg { display: flex; width: 100%; }
  .calc-form .seg-btn { flex: 1 1 0; min-width: 0; padding: 11px 8px; }
}

/* ---- layout tune-up (2026-07-13): kill the blank slabs ---- */
/* phone plan card (replaces the iframe, which iOS renders as an empty box) */
.plan-phone { display: flex; align-items: center; gap: 14px; padding: 18px 16px;
  background: #141418; border-top: 1px solid #26262b; }
.plan-phone .ico { font-size: 2rem; flex: none; }
.plan-phone p { margin: 0; font-size: .82rem; line-height: 1.5; color: var(--muted); }

/* the empty "your numbers land here" panel: full-height beside the form on
   desktop, but a slim strip when stacked (it was a ~450px void on phones) */
@media (max-width: 820px) {
  .calc-ph { min-height: 120px; padding: 16px; }
  .calc-ph .ico { font-size: 1.7rem; margin-bottom: 4px; }
}

/* tighter vertical rhythm on phones — the 56px paddings doubled up into
   ~110px voids between every section */
@media (max-width: 640px) {
  body[data-page="fitness"] .section { padding: 36px 0; }
  body[data-page="fitness"] .ct-access-wrapper { margin: 1.2rem 0 0.2rem !important; }
}

/* ---- Training Library accordion (2026-07-13): categories collapse to bars ---- */
.arch-group { margin-top: 12px; }
.arch-group:first-child { margin-top: 16px; }
button.arch-cat { display: flex; width: 100%; align-items: baseline; gap: 12px; margin: 0;
  padding: 13px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; text-align: left; transition: border-color .2s; }
button.arch-cat:hover { border-color: var(--accent); }
button.arch-cat .act { border-bottom-width: 3px; font-size: 1.2rem; }
.arch-cat .aca { margin-left: auto; align-self: center; color: var(--muted); font-size: .9rem;
  transition: transform .22s ease; }
.arch-group.open .aca { transform: rotate(90deg); color: var(--accent); }
.arch-list { overflow: hidden; max-height: 0; transition: max-height .28s ease; }
.arch-group.open button.arch-cat { border-color: var(--accent); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.arch-group.open .arch-list { border: 1px solid var(--border); border-top: 0;
  border-radius: 0 0 10px 10px; padding: 4px 16px 10px; }
html[data-theme="light"] body[data-page="fitness"] button.arch-cat { background: #ffffff; border-color: #e2e4e9; }
html[data-theme="light"] body[data-page="fitness"] .arch-group.open button.arch-cat { border-color: var(--accent); }
