/* Fitness app screens: calendar, log, exercises, workouts, goals, activities, admin lists. */
.goal-list, .goal-comps, .pc-ranges { list-style: none; margin: 0; padding: 0; }
.goal-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--grid-line); }
.goal-row b.unset { color: var(--muted); font-weight: 400; }
.goal-score { margin-top: 14px; } .goal-score b { font-size: 2.2rem; color: var(--accent); } .goal-score span { color: var(--muted); } .goal-score small { display: block; color: var(--muted); font-size: 0.78rem; }
.goal-comps li { display: grid; grid-template-columns: 1fr 1fr auto; gap: 4px 8px; align-items: center; padding: 5px 0; font-size: 0.88rem; }
.goal-comps .bar { height: 8px; border-radius: 4px; background: var(--grid-line); overflow: hidden; } .goal-comps .bar i { display: block; height: 100%; background: var(--ok); }
.goal-comps small { grid-column: 1 / -1; color: var(--muted); font-size: 0.74rem; margin-top: -4px; }
.goal-none { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }
.goal-edit { display: grid; gap: 8px; } .goal-edit input { width: 100%; box-sizing: border-box; }
.profile-card { border: 1px solid var(--grid-line); border-radius: 8px; padding: 10px 12px; }
.pc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .pc-tag { font-size: 0.7rem; color: #201400; background: var(--accent); border-radius: 999px; padding: 2px 8px; }
.pc-desc { margin: 4px 0 6px; font-size: 0.82rem; }
.pc-ranges li { display: flex; justify-content: space-between; font-size: 0.8rem; padding: 2px 0; color: var(--muted); } .pc-ranges b { color: var(--text); font-weight: 600; }
.profile-card button { margin-top: 8px; width: 100%; }
.pf-row { display: grid; grid-template-columns: 1fr 72px 72px; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 0.85rem; }
.pf-row input { width: 100%; box-sizing: border-box; font: inherit; background: #1c2536; border: 1px solid var(--grid-line); color: var(--text); border-radius: 6px; padding: 7px 8px; }
button.cal-stat { border: 0; color: inherit; font: inherit; cursor: pointer; }
button.cal-stat.goal b { color: var(--accent); }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--grid-line); border-radius: 8px; overflow: hidden; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: 8px 14px; font: inherit; font-size: 0.85rem; cursor: pointer; min-height: 36px; }
.seg button[aria-pressed=true] { background: var(--accent); color: #201400; font-weight: 600; }
.cal-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.cal-nav #calTitle { flex: 1; text-align: center; font-weight: 600; }
.cal-nav button { min-width: 44px; padding-left: 10px; padding-right: 10px; } .cal-nav button:disabled { opacity: .35; }
.cal-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.cal-stat { background: var(--panel2); border-radius: 8px; padding: 8px 6px; text-align: center; }
.cal-stat b { display: block; font-size: 1.15rem; color: var(--text); } .cal-stat span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cal-streak { grid-column: 1 / -1; text-align: center; font-size: 0.82rem; color: var(--accent); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) 34px; gap: 4px; }
.cal-dow { text-align: center; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; padding-bottom: 2px; }
.cal-cell { position: relative; aspect-ratio: 1 / 1; min-height: 40px; border-radius: 8px; border: 1px solid transparent; padding: 0; cursor: pointer; color: var(--text);
  background: color-mix(in srgb, var(--accent) calc(var(--heat, 0) * 78%), var(--panel2)); font: inherit; font-size: 0.82rem; display: flex; align-items: flex-start; justify-content: flex-start; }
.cal-cell .dn { padding: 4px 0 0 6px; line-height: 1; }
.cal-cell.out { opacity: .38; }
.cal-cell.today { border-color: var(--text); }
.cal-cell.sel { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-cell.met { box-shadow: inset 0 0 0 2px var(--ok); }
.cal-cell.has .dn { font-weight: 700; }
.cal-cell .kc { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-size: 0.62rem; color: var(--text); opacity: .9; }
.cal-cell .pips { position: absolute; right: 4px; top: 4px; display: flex; gap: 2px; }
.cal-cell .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--text); } .cal-cell .pip.row { background: #5fd0ff; } .cal-cell .pip.custom { background: #ffd24a; }
.cal-wk { display: flex; align-items: center; justify-content: center; font-size: 0.68rem; color: var(--muted); text-align: center; line-height: 1.1; }
.cal-wk b { display: block; color: var(--text); font-size: 0.78rem; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; position: relative; }
.wk-day { background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 4px 0; color: var(--text); cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wk-day.sel { border-color: var(--accent); background: var(--panel2); } .wk-day.today .wd { color: var(--accent); }
.wk-day .wd { font-size: 0.7rem; color: var(--muted); text-transform: uppercase; } .wk-day .wn { font-size: 0.95rem; font-weight: 600; }
.wk-bar { position: relative; width: 100%; height: 130px; display: flex; align-items: flex-end; justify-content: center; }
.wk-bar i { display: block; width: 62%; min-height: 2px; border-radius: 6px 6px 2px 2px; background: var(--accent); }
.wk-bar i.met { background: var(--ok); } .wk-bar i.empty { background: var(--grid-line); }
.wk-target { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); pointer-events: none; }
.wk-target span { position: absolute; right: 0; top: -14px; font-size: 0.62rem; color: var(--muted); }
.wk-day .wk { font-size: 0.72rem; color: var(--muted); min-height: 1.1em; }
.cal-legend { margin: 10px 0 0; font-size: 0.74rem; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.log-day { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.log-day button { min-width: 44px; } .log-day button:disabled { opacity: .35; }
#logDayLabel { font-weight: 600; text-align: center; flex: 1; }
.log-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.log-entry { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--grid-line); border-radius: 8px; }
.log-entry label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; flex-wrap: wrap; }
.log-entry input[type=checkbox] { width: 20px; height: 20px; }
.le-title { font-weight: 600; } .le-detail { color: var(--muted); font-size: 0.8rem; } .le-kcal { color: var(--accent); font-size: 0.85rem; white-space: nowrap; }
.le-del { background: none; border: 0; color: var(--muted); font-size: 1rem; min-width: 36px; min-height: 36px; cursor: pointer; }
.log-empty { color: var(--muted); font-size: 0.9rem; padding: 6px 2px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { border: 1px solid var(--grid-line); background: transparent; color: var(--text); border-radius: 999px; padding: 6px 12px; font-size: 0.85rem; min-height: 36px; cursor: pointer; }
.chip.on { background: var(--accent); color: #111; border-color: var(--accent); }
.mrows { display: grid; gap: 4px; margin: 6px 0; }
.mrow { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border-radius: 8px; background: var(--panel2); }
.mrow .ml { flex: 1; min-width: 0; font-size: 0.9rem; }
.wk-add { display: flex; gap: 8px; align-items: end; margin-top: 6px; }
.wk-item .le-title { flex: 1 1 100%; }
.wk-n { display: flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.wk-n input { width: 64px; min-height: 36px; }
.cv-bars { display: grid; gap: 3px; }
.cv-bar, .cv-metric { display: grid; grid-template-columns: 96px 1fr 62px; align-items: center; gap: 8px; font-size: 0.82rem; }
.cv-metric { grid-template-columns: 96px 1fr 62px; }
.cv-track { height: 10px; border-radius: 5px; background: var(--panel2); overflow: hidden; display: block; }
.cv-track span { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.cv-bar.ok .cv-track span { background: #4cc38a; }
.cv-bar.ok .cv-pct, .cv-metric.ok .cv-pct { color: #4cc38a; }
.cv-metric.bad .cv-pct { color: #ff8a65; }
.cv-pct { text-align: right; white-space: nowrap; }
.wk-mgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.wk-mg { display: flex; flex-direction: column; gap: 2px; font-size: 0.82rem; }
#wkSuggest .chip small { opacity: 0.75; margin-left: 4px; }
.ac-item { list-style: none; padding: 8px 0; border-bottom: 1px solid var(--grid-line); }
.ac-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ac-head .le-title { flex: 1 1 100%; }
.ac-head .le-detail { flex: 1 1 auto; }
.ac-head .btn-secondary { padding: 4px 12px; min-height: 36px; }
.le-metrics { flex: 1 1 100%; font-size: 0.82rem; }
.le-metrics summary { cursor: pointer; color: var(--muted, inherit); }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 14px; margin-top: 6px; font-size: 0.82rem; }
.mt-row { display: flex; justify-content: space-between; gap: 6px; }
.mt-stars { color: var(--accent); letter-spacing: 1px; white-space: nowrap; }
.stars { display: inline-flex; }
.stars button { background: none; border: 0; padding: 0 2px; font-size: 1.5rem; line-height: 1; min-width: 36px; min-height: 40px; color: var(--grid-line); cursor: pointer; }
.stars button.on { color: var(--accent); }
.mrow .mx { background: none; border: 0; color: var(--muted); min-width: 36px; min-height: 40px; cursor: pointer; font-size: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 8px 0; }
.form-grid input, #screen-log select, #screen-exercises input[type=text] { width: 100%; box-sizing: border-box; }
.le-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pick-figures canvas { cursor: pointer; }

/* ---- Mobile app shell: bottom tab bar, big touch targets ------------------- */
body { padding: 12px 12px calc(88px + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
.app input, .app select, .app textarea { font-size: 16px; } /* stops iOS zooming into fields */
.app button, .app select { min-height: 44px; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; background: var(--panel); border-top: 1px solid var(--grid-line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-in { display: flex; width: 100%; max-width: 480px; }
.tabbar button { flex: 1; min-width: 0; background: transparent; color: var(--muted); border-radius: 0; padding: 6px 2px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 0.68rem; }
.tabbar button .ti { font-size: 1.25rem; line-height: 1; }
.tabbar button[aria-current=page] { color: var(--accent); font-weight: 600; }
.req { color: var(--danger); font-size: 0.7rem; font-weight: 600; margin-left: 6px; }
.rec { color: var(--accent); font-size: 0.7rem; margin-left: 6px; }
label.field select { font: inherit; background: #1c2536; border: 1px solid var(--grid-line); color: var(--text); border-radius: 6px; padding: 8px 10px; }

/* ---- Weight ---------------------------------------------------------------- */
.wt-banner { background: color-mix(in srgb, var(--accent) 18%, var(--panel2)); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 12px; font-size: 0.88rem; margin-bottom: 10px; color: var(--text); }
.wt-now { font-size: 0.9rem; color: var(--muted); } .wt-now b { font-size: 1.9rem; color: var(--text); }
.wt-chart { width: 100%; height: 90px; margin-top: 6px; } .wt-chart polyline { fill: none; stroke: var(--accent); stroke-width: 2; } .wt-chart circle { fill: var(--accent); }
.wt-row { display: flex; align-items: center; gap: 8px; } .wt-row span { flex: 1; } .wt-row button { min-height: 36px; padding: 6px 10px; font-size: 0.8rem; }
.tabbar button { position: relative; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); width: 10px; height: 10px; border-radius: 50%; background: var(--danger); border: 2px solid var(--panel); }

/* ---- Top bar with the profile avatar (top right, like most apps) ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; }
.avatar { position: relative; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--accent); color: #201400; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; justify-content: center; }
.avatar .tab-badge { top: -2px; right: -2px; left: auto; }

/* ---- Home ------------------------------------------------------------------ */
button.wt-banner { display: block; width: 100%; text-align: left; margin-bottom: 10px; }
.hm-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hw-score b { font-size: 2.4rem; color: var(--accent); } .hw-score span { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }
.goal-comp .gc-top { display: flex; justify-content: space-between; gap: 8px; }
.goal-comps li.goal-comp { grid-template-columns: 1fr; }
.goal-comp small { color: var(--muted); font-size: 0.74rem; margin-top: 0; }
.goal-comp.behind .bar i { background: var(--danger); } .goal-comp.ontrack .bar i { background: var(--accent); }
.goal-comp.behind small { color: var(--danger); } .goal-comp.done small { color: var(--ok); }
.hw-todo h4 { margin: 12px 0 4px; font-size: 0.95rem; } .hw-todo ul { margin: 0; padding-left: 18px; font-size: 0.88rem; }
.hw-todo li.behind { color: var(--danger); } .hw-todo li.ontrack { color: var(--text); }

/* ---- Safety nets for narrow phones (iOS Safari sizes some controls differently) ---- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.app, .screen, .panel { min-width: 0; }
.panel { overflow-wrap: anywhere; }
.app select, .app input:not([type=checkbox]):not([type=radio]) { max-width: 100%; min-width: 0; }
.form-grid > *, .btn-row > * { min-width: 0; }

/* Calendar: the selected / today frame must sit above the neighbouring cells (they used to paint over its right edge). */
.cal-cell { z-index: 0; }
.cal-cell.today { z-index: 1; }
.cal-cell.sel { z-index: 2; }

/* "Add an exercise" row: the select takes what is left, the button never gets squeezed into a letter column. */
.wk-add { flex-wrap: nowrap; }
.wk-add > label { flex: 1 1 0; min-width: 0; }
.wk-add select { width: 100%; }
.wk-add > button { flex: 0 0 auto; white-space: nowrap; min-width: 72px; }
/* List rows: the text keeps a readable width and the buttons drop below it when there is no room. */
.log-entry .le-text { flex: 1 1 11em; }
.log-entry button { white-space: nowrap; }

#exFormTitle { scroll-margin-top: 64px; }

/* ---- Home: the week at a glance ---- */
.hv-range { margin: 2px 0 8px; font-size: 0.82rem; color: var(--muted); }
.hv-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.hv-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; min-width: 0; border-radius: 12px; border: 1px solid var(--line, rgba(128,128,128,.35)); background: transparent; color: inherit; font: inherit; }
.hv-day span { font-size: 0.72rem; color: var(--muted); }
.hv-day i { font-style: normal; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid rgba(128,128,128,.4); font-size: 0.85rem; box-sizing: border-box; }
.hv-day small { font-size: 0.62rem; color: var(--muted); min-height: 0.9em; }
.hv-day.done i { background: var(--accent); border-color: var(--accent); color: #fff; }
.hv-day.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.hv-day.future { opacity: .45; }
.hv-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.hv-title h3 { margin: 0; } .hv-title b { color: var(--accent); } .hv-title span { color: var(--muted); font-size: 0.8rem; }
.hv-lead { margin: 0 0 8px; } .hv-lead small, .hv-note { color: var(--muted); font-size: 0.8rem; } .hv-note { margin: 0 0 6px; }
.hv-ok { margin: 0 0 4px; }
.hv-pick { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(128,128,128,.25); }
.hv-pick > div { min-width: 0; flex: 1 1 auto; } .hv-pick b { display: block; overflow-wrap: anywhere; }
.hv-pick small { color: var(--muted); font-size: 0.78rem; overflow-wrap: anywhere; }
.hv-pick button { flex: 0 0 auto; }
.hv-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 12px; }
.hv-tile { text-align: center; padding: 10px 2px; border-radius: 12px; border: 1px solid rgba(128,128,128,.35); min-width: 0; }
.hv-tile b { display: block; font-size: 1.15rem; color: var(--accent); overflow-wrap: anywhere; }
.hv-tile span { font-size: 0.72rem; color: var(--muted); } .hv-tile small { display: block; font-size: 0.62rem; color: var(--muted); }
.hv-chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.hv-chip { position: relative; display: flex; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 8px; font-size: 0.8rem; overflow: hidden; border: 1px solid rgba(128,128,128,.3); background: linear-gradient(90deg, rgba(128,128,128,.28) var(--p), transparent var(--p)); }
.hv-chip.full { background: var(--accent); border-color: var(--accent); color: #fff; }
.hv-chip span { min-width: 0; overflow-wrap: anywhere; }
.hv-metric { display: grid; grid-template-columns: minmax(0, 1fr) auto 2.2em 1.2em; gap: 6px; align-items: center; padding: 4px 0; font-size: 0.85rem; }
.hv-metric .hv-stars { letter-spacing: 1px; color: var(--accent); } .hv-metric i { font-style: normal; color: var(--ok, var(--accent)); } .hv-metric b { text-align: right; font-weight: 600; }
.hv-score { width: 100%; margin: 0 0 12px; padding: 10px; border-radius: 12px; border: 1px solid rgba(128,128,128,.35); background: transparent; color: inherit; font: inherit; }
.hv-month > summary { cursor: pointer; font-weight: 600; margin-bottom: 6px; }
.hv-title b { white-space: nowrap; }

/* ---- effort question + pre-workout check + recent load ---- */
.effort-sheet { position: fixed; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 30; max-width: 464px; margin: 0 auto; padding: 10px 12px; border-radius: 14px; background: var(--panel); border: 1px solid var(--accent); box-shadow: 0 6px 24px rgba(0,0,0,.45); }
.effort-sheet[hidden] { display: none; }
.hv-chip.lv-low { background: linear-gradient(90deg, rgba(128,128,128,.28) 33%, transparent 33%); }
.hv-chip.lv-moderate { background: linear-gradient(90deg, rgba(255,176,32,.45) 66%, transparent 66%); }
.hv-chip.lv-high { background: var(--accent); border-color: var(--accent); color: #fff; }
.hv-chip.lv-unknown { border-style: dashed; color: var(--muted); }
.hv-chip.lv-none { color: var(--muted); }
.ck-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; padding: 6px 0; border-top: 1px solid rgba(128,128,128,.25); font-size: 0.88rem; }
.ck-row b { overflow-wrap: anywhere; } .ck-row small { color: var(--muted); display: block; }
.ck-row.omit b, .ck-row.move b { text-decoration: line-through; opacity: .75; }
.ck-row .ck-new { text-align: right; white-space: nowrap; font-weight: 600; }
.ck-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; } .ck-actions > * { flex: 1 1 140px; }
.le-rate { font-size: 0.78rem; padding: 4px 10px; min-height: 30px; }
