/* sweatsheet — mobile-first, light/dark via prefers-color-scheme */

:root {
  /* Colours: shared/tokens.css */
  --radius: 22px;
  --radius-sm: 14px;
  --tabbar-h: 68px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.locked { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .3; cursor: default; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- layout ---------- */
.view {
  max-width: 520px;
  margin: 0 auto;
  padding: calc(var(--safe-area-inset-top, env(safe-area-inset-top)) + 12px) 16px calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) + 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.page-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 4px 2px; }
.page-head h1 { font-size: 28px; letter-spacing: -.02em; }
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 4px 0; }

/* ---------- buttons ---------- */
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text);
  transition: background .15s;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn.soft { background: var(--surface-2); }
.icon-btn.accent { background: var(--accent-soft); color: var(--accent); }
.icon-btn.accent:hover { background: var(--accent); color: var(--accent-ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* Touch targets: small controls keep their look but get a hit area of at least 44 × 44 px. */
.icon-btn, .btn.sm, .pill, .chip, .link-btn { position: relative; }
.icon-btn::after, .btn.sm::after, .pill::after, .chip::after, .link-btn::after {
  content: ""; position: absolute; left: 50%; top: 50%; translate: -50% -50%;
  width: max(100%, 44px); height: max(100%, 44px);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px;
  border-radius: 999px;
  background: var(--surface-2);
  font-weight: 600;
  transition: transform .1s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn.block { width: 100%; }
.btn svg { width: 18px; height: 18px; }

.pill {
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.pill.on { background: var(--c, var(--steps)); color: #fff; }
.pill.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 5px 0; margin: -3px 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 14px; font-weight: 500;
  transition: all .15s;
}
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button {
  height: 38px; border-radius: 10px; font-size: 14px; font-weight: 600; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.seg button svg { width: 17px; height: 17px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .08); }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: 12px; }
.input, .field input {
  height: 48px; width: 100%; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface);
  outline: none; transition: border-color .15s;
}
.input:focus, .field input:focus { border-color: var(--accent); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.search .input { padding-left: 42px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .input { flex: 1; }

/* ---------- today: date bar ---------- */
.datebar { display: flex; align-items: center; justify-content: space-between; }
.datebar h1 { font: inherit; } /* the page heading holds the date button and keeps its look */
.date-title { display: flex; flex-direction: column; align-items: center; line-height: 1.15; }
.date-title strong { font-size: 20px; letter-spacing: -.01em; }
.date-title span { font-size: 13px; color: var(--muted); }
.brand { display: inline-flex; align-items: center; gap: 5px; font-weight: 800; letter-spacing: -.02em; font-size: 14px; color: var(--brand-navy); vertical-align: -3px; }
.logo-mark { width: 18px; height: 18px; stroke: none; }

/* ---------- today: summary ---------- */
.summary-top { display: flex; align-items: center; gap: 20px; }
.ring-wrap { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 132px; height: 132px; rotate: -90deg; }
.ring circle { fill: none; stroke-width: 11; }
.ring-track { stroke: var(--surface-2); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .6s cubic-bezier(.2,.8,.2,1); }
.ring.over .ring-fill { stroke: var(--danger); }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label strong { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ring-label span { font-size: 12px; color: var(--muted); margin-top: 4px; }
.summary-stats { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.stat span { display: block; font-size: 13px; color: var(--muted); }
.stat strong { font-size: 20px; font-weight: 650; letter-spacing: -.01em; }
.stat strong small { font-size: 13px; font-weight: 500; color: var(--muted); }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.macro .lbl { font-size: 13px; font-weight: 600; }
.macro .val { font-size: 12px; color: var(--muted); margin-top: 6px; }
/* The macros on Today: the kcal ring's parts, smaller and in the macro's colour. */
.macro-ring { display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.macro-ring .ring-wrap, .macro-ring .ring { width: min(84px, 100%); height: auto; aspect-ratio: 1; }
.macro-ring .ring circle { stroke-width: 13; }
.macro-ring .ring-fill { stroke: var(--c); }
.macro-ring .ring-label strong { font-size: 19px; letter-spacing: -.02em; }
.macro-ring .ring-label strong.long { font-size: 15px; }
.macro-ring .ring-label small { font-size: 12px; font-weight: 600; letter-spacing: 0; }
.macro-ring .ring-label span { font-size: 11px; margin-top: 2px; }
.macro-ring.over .ring-label :is(strong, span) { color: var(--danger); }
.macro-ring .lbl { font-size: 13px; font-weight: 600; margin-top: 8px; }
.macro-ring .val { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; border-radius: inherit; background: var(--c, var(--accent)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.m-protein { --c: var(--protein); }
.m-carbs { --c: var(--carbs); }
.m-fat { --c: var(--fat); }
.m-steps { --c: var(--steps); }
.m-train { --c: var(--train); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 1px; }

/* ---------- today: steps ---------- */
.steps-head { display: flex; align-items: center; gap: 12px; }
.steps-icon { width: 42px; height: 42px; border-radius: 14px; flex: none; display: grid; place-items: center; background: color-mix(in srgb, var(--c, var(--steps)) 14%, transparent); color: var(--c, var(--steps)); }
.steps-main { flex: 1; min-width: 0; }
.steps-main .lbl { display: block; font-size: 13px; color: var(--muted); }
.steps-main strong { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.steps-meta { margin-top: 8px; }

/* ---------- today: meals ---------- */
.meal { padding: 14px 14px 14px 18px; }
.meal header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meal h3 { font-size: 17px; font-weight: 650; }
.entries { list-style: none; margin: 10px -6px 0 -10px; padding: 0; }
.row {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: var(--radius-sm); text-align: left;
  transition: background .15s;
}
.row:hover { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-end { font-weight: 600; white-space: nowrap; }
.row-end small { font-weight: 500; color: var(--muted); font-size: 12px; }

.thumb {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--surface-2); object-fit: cover;
  display: grid; place-items: center; font-weight: 700; color: var(--muted); font-size: 15px;
}
.thumb.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 22px; }
img.thumb { background: #fff; object-fit: contain; }

.list { list-style: none; margin: 0; padding: 6px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty svg { width: 34px; height: 34px; opacity: .6; }

/* ---------- history ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.chart-head h3 { font-size: 16px; }
.chart { position: relative; height: 140px; display: flex; align-items: flex-end; gap: 6px; }
.chart.dense { gap: 2px; }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; cursor: pointer; }
.chart .bw { flex: 1; min-height: 0; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart .b { width: 100%; max-width: 30px; border-radius: 6px 6px 3px 3px; background: var(--c); min-height: 3px; opacity: .9; transition: height .5s cubic-bezier(.2,.8,.2,1); }
.chart .b.zero { background: var(--surface-2); }
.chart .b.over { background: var(--danger); }
.chart .d { font-size: 11px; color: var(--muted); height: 14px; }
.chart .goal { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--muted); opacity: .45; pointer-events: none; }
.chart .goal span { position: absolute; right: 0; top: -17px; font-size: 11px; color: var(--muted); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  height: calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  padding: 0 max(8px, calc((100vw - 520px) / 2)) var(--safe-area-inset-bottom, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  border-top: 1px solid var(--line);
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); padding: 8px 0; transition: color .15s; }
.badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.tab.active { color: var(--text); }
.tab.active svg { stroke-width: 2.4; }
.fab {
  justify-self: center; width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
  transition: transform .15s;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.backdrop { position: absolute; inset: 0; background: rgb(0 0 0 / .35); opacity: 0; transition: opacity .25s; }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 92dvh;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 8px 16px calc(20px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; overscroll-behavior: contain;
  translate: 0 100%; transition: translate .3s cubic-bezier(.2,.8,.2,1);
}
.sheet.tall { height: 92dvh; }
/* The sheet scrolls, its parts keep their size (a row with overflow-x, like .chips, would otherwise shrink to nothing in a full sheet). */
.sheet > * { flex-shrink: 0; }
.sheet-wrap.open .backdrop { opacity: 1; }
.sheet-wrap.open .sheet { translate: 0 0; }
.grabber { width: 38px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head > div { min-width: 0; }
.sheet:focus { outline: none; }
.sheet-head h2 { font-size: 20px; letter-spacing: -.01em; }
.sheet-actions {
  display: flex; gap: 10px; margin: 4px -16px 0; padding: 18px 16px 0; position: sticky; bottom: calc(-20px - var(--safe-area-inset-bottom, env(safe-area-inset-bottom))); padding-bottom: calc(20px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)));
  background: linear-gradient(to bottom, transparent, var(--bg) 18px);
}
.form .sheet-actions { margin-bottom: calc(-20px - var(--safe-area-inset-bottom, env(safe-area-inset-bottom))); }
.link-btn { display: block; margin: 10px auto 0; font-size: 13px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.sheet-actions .btn.primary { flex: 1; }
@media (min-width: 560px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 26px; translate: 0 40px; opacity: 0; transition: translate .25s, opacity .2s; padding-bottom: 20px; }
  .sheet.tall { height: min(780px, 92dvh); }
  .sheet-wrap.open .sheet { opacity: 1; }
  .grabber { display: none; }
}

/* ---------- scanner ---------- */
.scanner {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: #000; flex: none;
}
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame {
  position: absolute; left: 12%; right: 12%; top: 30%; bottom: 30%;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgb(0 0 0 / .35);
}
.scan-frame::before, .scan-frame::after { content: ""; position: absolute; inset: 0; border-radius: inherit; border: 3px solid #fff; }
.scan-frame::after { border: 0; height: 2px; top: 50%; left: 8%; right: 8%; inset-inline: 8%; background: var(--accent); box-shadow: 0 0 12px var(--accent); animation: sweep 1.8s ease-in-out infinite; }
@keyframes sweep { 0%, 100% { translate: 0 -28px; } 50% { translate: 0 28px; } }
.scan-status {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0;
  background: rgb(0 0 0 / .6); color: #fff; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 999px; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
}
.scanner.idle .scan-frame::after { display: none; }
.scan-alt { display: flex; gap: 8px; }
.scan-alt .inline-form { flex: 1; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- portion ---------- */
.product { display: flex; gap: 14px; align-items: center; }
.product h3 { font-size: 18px; line-height: 1.25; }
.amount { display: flex; gap: 10px; align-items: stretch; }
.amount .input { height: 56px; font-size: 24px; font-weight: 700; text-align: center; flex: 1; min-width: 0; }
.amount .seg { flex: none; width: 168px; align-content: center; }
/* The amount is a few digits; the unit picker gets the rest for labels like "thigh without skin · 149 g". */
.amount:has(.unit-pick) [data-role=amt] { flex: 0 0 34%; }
.amount .unit-pick { flex: 1; font-size: 16px; font-weight: 600; text-align: left; padding: 0 10px; text-overflow: ellipsis; }
.amount .unit { display: grid; place-items: center; padding: 0 18px; font-weight: 600; color: var(--muted); background: var(--surface-2); border-radius: var(--radius-sm); }
.nutri { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 8px; }
.nutri div { background: var(--surface); border-radius: var(--radius-sm); padding: 12px 10px; text-align: center; box-shadow: var(--shadow); }
.nutri strong { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.nutri span { font-size: 12px; color: var(--muted); }
.nutri .kcal strong { color: var(--accent); }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) + 14px); z-index: 50;
  translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  transition: all .25s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.show { translate: -50% 0; opacity: 1; }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; margin: 24px auto; }
@keyframes spin { to { rotate: 360deg; } }
.footnote { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0; }
.footnote a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  /* Still show that something is loading: a slow fade instead of a spin. */
  .spinner { border-color: var(--accent); animation: pulse 1.6s ease-in-out infinite !important; }
}

/* ---------- workouts ---------- */
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--train) 16%, transparent); color: var(--train-ink); vertical-align: middle; }
.note { display: block; color: var(--text); opacity: .75; font-style: italic; margin-top: 2px; }
.title-sm { font-size: 17px !important; letter-spacing: -.01em !important; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-sub.wrap { white-space: normal; }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.check-line { display: flex; gap: 10px; align-items: center; font-size: 14px; }
.check-line input { width: 20px; height: 20px; accent-color: var(--accent); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.block-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -6px 10px; }
.block-head strong { font-size: 17px; }
.block-head > div { text-align: center; }
.block-dates { display: block; }
.block-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 20px; }
.block-actions .link-btn { margin: 10px 0 0; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.wd { display: block; width: 100%; min-height: 44px; padding: 0; }
.block-done { margin: -2px 0 12px; padding: 8px 12px; border-radius: var(--radius-sm); background: color-mix(in srgb, var(--train) 14%, transparent); color: var(--text); }
.wd span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.wd i { width: 36px; height: 36px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 14px; font-weight: 600; border: 2px solid transparent; }
.wd.planned i { border-color: color-mix(in srgb, var(--train) 55%, transparent); }
.wd.did i { background: var(--train); color: #fff; }
.wd.did i svg { width: 18px; height: 18px; stroke-width: 3; }
.wd.today span { color: var(--text); }
.wd.today i { box-shadow: inset 0 0 0 2px var(--text); }
.hero .plan + .plan { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.hero .lbl { margin-bottom: 10px; }
.routine { display: flex; align-items: center; gap: 4px; padding-right: 6px; }
.routine .row { flex: 1; min-width: 0; }
.dots { display: flex; gap: 4px; flex-wrap: wrap; }
/* Thin bars, tall tap area: each one tells its day on tap. */
.dots span { flex: 1; min-width: 6px; max-width: 34px; height: 30px; position: relative; cursor: pointer; }
.dots span::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 10px; border-radius: 99px; background: var(--surface-2); }
.dots span.on::before { background: var(--train); }

/* session logger */
.ex { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ex header { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.ex header > div { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.ex h3 { font-size: 17px; }
.ex.ss { margin-top: -10px; border-top-left-radius: 8px; border-top-right-radius: 8px; box-shadow: inset 3px 0 0 var(--train), var(--shadow); }
.sets { display: flex; flex-direction: column; gap: 6px; }
.set { display: grid; grid-template-columns: 30px 1fr 1fr 44px; gap: 8px; align-items: center; }
.set.head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; }
.set .n { text-align: center; font-weight: 700; color: var(--muted); }
.set .input { height: 44px; text-align: center; font-weight: 650; font-size: 17px; padding: 0 6px; background: var(--surface-2); border-color: transparent; }
/* The suggestion (last time / target) must stay readable: lighter weight tells it apart, not low contrast. */
.set .input::placeholder { color: var(--muted); opacity: 1; font-weight: 450; }
.check { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--muted); transition: all .15s; }
.check svg { width: 20px; height: 20px; stroke-width: 2.6; }
.set.done .check { background: var(--accent); color: var(--accent-ink); }
.set.done .input { background: var(--accent-soft); }
.ex-foot { display: flex; gap: 18px; align-items: center; padding: 0 4px; }
.note-in { font-size: 14px; height: 40px !important; }
.rest {
  position: sticky; top: -8px; z-index: 2; overflow: hidden;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  background: var(--text); color: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px 10px 16px;
  box-shadow: 0 6px 16px rgb(0 0 0 / .18);
}
.rest[hidden] { display: none; }
.rest strong { font-size: 18px; margin-left: 4px; }
.rest .pill { background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); }
.rest-actions { display: flex; gap: 6px; }
.rest i { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--accent); transition: width .5s linear; }

/* routine editor */
.ex-row { background: var(--surface); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow); }
.ex-row-top { display: flex; gap: 4px; align-items: center; }
.ex-row-top .input { flex: 1; min-width: 0; }
.ex-row-fields { display: flex; gap: 8px; align-items: center; }
/* Exercise suggestions under a name field (exercisePicker in app/workouts.js). */
.ac-list { display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.ac-list[hidden] { display: none; }
.inline-form + .ac-list { margin-top: -6px; }
.ac-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 15px; cursor: pointer; }
.ac-item b { color: var(--accent); font-weight: 700; }
.ac-item small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }
.ex-row-fields .seg { flex: none; width: 150px; }
.ex-row-fields .input { width: 0; flex: 1; text-align: center; height: 44px; }
.ex-more summary { font-size: 13px; color: var(--muted); cursor: pointer; padding: 2px 0; }
.ex-more[open] { display: flex; flex-direction: column; gap: 10px; }
.ex-more .input { height: 42px; }

/* focus-mode logger */
.progress { height: 4px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: -6px; flex: none; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.ex-list { gap: 10px; }
.ex.compact { padding: 4px; }
.ex.compact.ss { margin-top: -6px; }
.ex-line { width: 100%; display: flex; align-items: center; gap: 12px; padding: 8px 10px; text-align: left; border-radius: var(--radius-sm); }
.ex-dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.ex-dot svg { width: 16px; height: 16px; stroke-width: 3; }
.ex.complete .ex-dot { background: var(--accent); color: var(--accent-ink); }
.ex.complete .row-title { color: var(--muted); }
.ex.current { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.ex.current.ss { box-shadow: inset 3px 0 0 var(--train), 0 0 0 2px var(--accent), var(--shadow); }
.set.next .check { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.set.next .n { color: var(--accent); }
.ex-foot .link-btn { margin: 0; font-size: 14px; font-weight: 600; text-decoration: none; color: var(--text); }
.ex-foot .link-btn.danger { color: var(--danger); margin-left: auto; font-weight: 500; }


/* coach connection */
.coach-box { display: flex; flex-direction: column; gap: 12px; }
.m-coach { --c: var(--accent); }
.coach-actions { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.coach-actions .link-btn { margin: 0; font-size: 13px; }
/* The coach's logo sits on a white plate in both themes, so a dark logo stays visible in dark mode
   (the dashboard previews it the same way). Wide logos get a wider plate, up to a limit. */
.logo-plate { flex: none; display: inline-grid; place-items: center; height: 42px; min-width: 42px; padding: 4px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.logo-plate img { display: block; max-width: 104px; max-height: 34px; object-fit: contain; }
.logo-plate.sm { height: 24px; min-width: 24px; padding: 2px 3px; border-radius: 6px; }
.logo-plate.sm img { max-width: 66px; max-height: 20px; }
.coached-by { display: flex; align-items: center; justify-content: center; gap: 7px; margin: -4px 0 0; font-size: 12px; color: var(--muted); }
.coached-by strong { color: var(--text); font-weight: 600; }
.link-btn.danger { color: var(--danger); }
.error-text { color: var(--danger); }
.code-input { font-size: 22px; font-weight: 700; letter-spacing: .18em; text-align: center; text-transform: uppercase; height: 56px; }
.consent { align-items: flex-start; line-height: 1.4; }
.consent input { margin-top: 2px; flex: none; }

/* program pushed by the coach */
.program-banner { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }

/* goals and comments from the coach */
.coach-set { color: var(--accent) !important; font-weight: 600; }
.field input[readonly] { background: var(--surface-2); color: var(--muted); }
.coach-comments h2, .coach-comments h3 { font-size: 13px; font-weight: 600; color: var(--muted); }
.comment-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.comment-list li + li { padding-top: 12px; border-top: 1px solid var(--line); }
.coach-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.45; margin-top: 4px; }
.comment-list .link-btn { margin: 6px 0 0; }
.tag.new { background: var(--accent-soft); color: var(--accent); }
/* About one exercise: under it in the logger (two lines, a longer one opens), the workout's details
   and the exercise's history (app/coach.js coachTipHtml, exerciseCommentsHtml). */
.coach-tip { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--accent-soft); font-size: 13px; line-height: 1.4; }
p.coach-tip, .coach-tip summary, .ex-comments li { display: flex; align-items: flex-start; gap: 8px; }
.coach-tip summary { list-style: none; cursor: pointer; }
.coach-tip summary::-webkit-details-marker { display: none; }
.coach-tip svg, .ex-comments svg { width: 15px; height: 15px; margin-top: 1px; color: var(--accent); }
.coach-tip-text { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
details.coach-tip:not([open]) .coach-tip-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.coach-tip .chev { display: grid; transition: rotate .15s; }
.coach-tip .chev svg { width: 16px; height: 16px; color: var(--muted); }
.coach-tip[open] .chev { rotate: 180deg; }
.coach-tip strong, .ex-comments strong { font-weight: 650; color: var(--accent); }
.ex-comments { list-style: none; margin: 0; padding: 0 10px 10px; display: flex; flex-direction: column; gap: 8px; flex-basis: 100%; font-size: 13px; line-height: 1.4; }
.ex-comments p { white-space: pre-wrap; overflow-wrap: anywhere; }
.coach-notes { padding: 14px 16px; }
.coach-notes .ex-comments { padding: 0; gap: 10px; }
.coach-notes .table-toggle { margin-top: 2px; }
.coach-notes .table-toggle .ex-comments { padding-bottom: 4px; }

/* backup reminder and the error screen */
.nudge-actions, .fallback-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.fallback { display: flex; flex-direction: column; gap: 10px; }
.fallback h1 { font-size: 22px; }
.fallback-actions { justify-content: flex-start; }

.coach-note { white-space: pre-wrap; font-size: 15px; line-height: 1.5; border-left: 3px solid var(--accent); }
/* A program offer: one card per routine, one line per exercise (target right-aligned). */
.offer-routine { padding: 0; }
.offer-routine summary { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; cursor: pointer; list-style: none; }
.offer-routine summary::-webkit-details-marker { display: none; }
.offer-routine .chev { color: var(--muted); transition: rotate .15s; display: grid; }
.offer-routine .chev svg { width: 20px; height: 20px; }
.offer-routine[open] .chev { rotate: 180deg; }
.offer-ex { list-style: none; margin: 0; padding: 0 16px 10px; font-size: 15px; }
.offer-ex li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.offer-ex li.ss { padding-left: 10px; box-shadow: inset 2px 0 0 var(--train); }
.offer-ex .tgt { color: var(--muted); font-size: 14px; white-space: nowrap; text-align: right; }
/* An exercise's demo video (demoLink in app/util.js), in the logger and the program offer. */
.demo-link { height: 28px; padding: 0 10px 0 8px; gap: 4px; background: var(--accent-soft); color: var(--accent); text-decoration: none; white-space: nowrap; }
.demo-link svg { width: 12px; height: 12px; fill: currentColor; stroke-width: 1.5; }
.ex-actions .demo-link { align-self: center; margin-right: 6px; }
.offer-ex .demo-link { margin-left: 8px; vertical-align: 1px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* rest timer while the logger is closed: just above the tab bar, on every tab */
.restbar {
  position: fixed; top: auto; left: 50%; translate: -50% 0; z-index: 15;
  bottom: calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) + 10px);
  width: min(488px, calc(100vw - 32px));
}
.restbar .pill { min-width: 44px; justify-content: center; }
body.resting .view { padding-bottom: calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) + 92px); }
body.resting #toast { bottom: calc(var(--tabbar-h) + var(--safe-area-inset-bottom, env(safe-area-inset-bottom)) + 78px); }

/* a message that stays (storage full, a new version): top of the screen, above the sheets */
.banner {
  position: fixed; z-index: 40; left: 50%; translate: -50% 0;
  top: calc(var(--safe-area-inset-top, env(safe-area-inset-top)) + 8px);
  width: min(488px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px; padding: 8px 6px 8px 16px;
  background: var(--text); color: var(--bg); border-radius: var(--radius-sm); box-shadow: 0 6px 16px rgb(0 0 0 / .18);
  font-size: 14px; font-weight: 600;
}
.banner[hidden] { display: none; }
.banner span { flex: 1; }
.banner .btn { flex: none; }
.banner .icon-btn { color: var(--bg); flex: none; }
.banner .icon-btn:hover { background: color-mix(in srgb, var(--bg) 18%, transparent); }
.banner :focus-visible { outline-color: var(--bg); }

/* toast with an action (Undo) */
#toast.has-action { display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 18px; pointer-events: auto; }
.toast-action {
  flex: none; min-height: 36px; min-width: 64px; padding: 0 14px; border-radius: 999px; position: relative;
  background: color-mix(in srgb, var(--bg) 20%, transparent); color: var(--bg); font-weight: 700;
}
.toast-action::after { content: ""; position: absolute; inset: -4px; }
.toast-action:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }

/* pinned foods: a filled star, not only a colour change */
.star { color: var(--muted); }
.star[aria-pressed="true"] { color: var(--carbs); }
.star[aria-pressed="true"] svg { fill: currentColor; }
.food-li { display: flex; align-items: center; }
.food-li .row { flex: 1; min-width: 0; }
.product > div { flex: 1; min-width: 0; }

.copy-btn { display: inline-flex; align-items: center; gap: 6px; margin: 8px 0 0; text-decoration: none; font-weight: 600; color: var(--accent); min-height: 32px; }
.copy-btn svg { width: 16px; height: 16px; }
.meal-links { display: flex; flex-wrap: wrap; column-gap: 18px; }

/* saved meals */
.saved-chips { margin-top: 10px; }
.saved-chips .chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.saved-chips .chip svg { width: 15px; height: 15px; color: var(--accent); }
.saved-chips .chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }
.saved-chips .chip small { color: var(--muted); font-size: 12px; }
.section-row { display: flex; align-items: center; justify-content: space-between; }
.section-row .link-btn { display: inline-flex; align-items: center; gap: 4px; margin: 10px 4px 0; min-height: 32px; font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; }
.section-row .link-btn svg { width: 16px; height: 16px; }

/* water */
.m-water { --c: var(--water); }
.water-actions { display: flex; gap: 6px; flex: none; }
.water-actions .pill { min-width: 44px; justify-content: center; }

/* daily check-in (app/checkin.js) */
.m-checkin { --c: #6366f1; }
.ci-sum { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; }
.ci-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ci-edit { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--accent); }
.ci-edit svg { width: 14px; height: 14px; }
.ci-line { display: block; font-size: 15px; font-weight: 650; }
.ci-title { font-size: 15px !important; font-weight: 650; color: var(--text) !important; }
.ci-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; align-items: center; margin-top: 14px; }
.ci-lbl { font-size: 14px; font-weight: 600; }
.ci-grid .seg { padding: 3px; gap: 3px; }
.ci-grid .seg button { height: 34px; position: relative; }
.ci-grid .seg button::after { content: ""; position: absolute; inset: -5px 0; }
.ci-grid .seg button.on { color: var(--c); }
.ci-fine { display: flex; align-items: center; gap: 8px; margin-top: -2px; }
.ci-fine strong { margin-right: auto; font-size: 17px; }
.ci-fine .pill { min-width: 44px; justify-content: center; font-size: 16px; }
.ci-supps { display: flex; flex-wrap: wrap; gap: 6px; }
.ci-supps .chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; }
.ci-supps .chip svg { width: 15px; height: 15px; }
.ci-add.link-btn { margin: 0; text-align: left; color: var(--accent); }
.ci-foot { display: flex; align-items: center; justify-content: flex-end; gap: 16px; margin-top: 16px; }
.ci-foot .link-btn { margin: 0 auto 0 0; }
.supp-chips { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.supp-chips li { display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); font-size: 14px; font-weight: 500; }
.supp-chips li.removable { padding-right: 4px; }
.supp-card > p:last-child { margin: 0; }
.supp-card > p:first-child { margin-bottom: 12px; }
.supp-x { position: relative; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.supp-x::after { content: ""; position: absolute; inset: -8px; }
.supp-x:hover { background: var(--surface-2); color: var(--text); }
.supp-x svg { width: 15px; height: 15px; }

/* body weight */
.m-weight { --c: #8b5cf6; }
.weight-form { display: flex; align-items: center; gap: 12px; }
.weight-form .steps-main label { display: block; font-size: 15px; font-weight: 650; color: var(--text); }
.weight-form .input { width: 84px; flex: none; height: 44px; padding: 0 8px; text-align: center; font-weight: 650; font-size: 17px; }

/* last week */
.week-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.week-stats div:last-child:nth-child(odd) { grid-column: 1 / -1; }
.week-stats dt { font-size: 13px; color: var(--muted); }
.week-stats dd { margin: 2px 0 0; font-size: 18px; font-weight: 650; letter-spacing: -.01em; }
.week-stats dd small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.week-training { grid-template-columns: repeat(3, 1fr); margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.week-training div:last-child:nth-child(odd) { grid-column: auto; }

/* line charts (exercise history, body weight) */
.line-chart { margin: 0; }
.line-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.line-chart polyline { fill: none; stroke-width: 2.2; }
.line-chart .s1 { stroke: var(--c, var(--accent)); }
.line-chart .s2 { stroke: var(--train); stroke-dasharray: 5 4; }
.line-chart circle { stroke: none; }
.line-chart circle.s1 { fill: var(--c, var(--accent)); }
.line-chart circle.s2 { fill: var(--train); }
.line-chart .grid { stroke: var(--line); stroke-width: 1; }
.line-chart text { fill: var(--muted); stroke: none; font-size: 10px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 0; border-top: 2.5px solid var(--c, var(--accent)); }
.legend .s2 i { border-top: 2.5px dashed var(--train); }
.seg.seg-sm { width: 112px; padding: 3px; }
.seg.seg-sm button { height: 30px; font-size: 13px; position: relative; }
.seg.seg-sm button::after { content: ""; position: absolute; inset: -7px 0; }
.table-toggle { margin-top: 10px; }
.table-toggle summary { font-size: 13px; color: var(--muted); cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.table-card { padding: 6px 14px; overflow-x: auto; }
.hist-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.hist-table th, .hist-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.hist-table thead th { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.hist-table tr:last-child > * { border-bottom: 0; }
.hist-table .link-btn { margin: 0; font-size: 14px; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* progression and PRs */
.prog { color: var(--muted); }
.prog.up { color: color-mix(in srgb, var(--protein) 70%, var(--text)); font-weight: 650; }
.tag.pr { background: var(--accent-soft); color: var(--accent); }
.pr-text { color: var(--accent); font-weight: 600; }
.row-end svg { width: 16px; height: 16px; color: var(--muted); vertical-align: middle; margin-left: 4px; }
.pr-list .row-sub + .row-sub { margin-top: 2px; }

/* the review after a workout, and the session-RPE slider (app/logger.js) */
.review-stats { grid-template-columns: repeat(3, 1fr); }
.review-list .row-end { text-align: right; }
.review-list .pr-text { margin-top: 2px; }
.trend { display: inline-block; min-width: 1.1em; text-align: center; font-weight: 700; }
.trend.up { color: color-mix(in srgb, var(--protein) 70%, var(--text)); }
.trend.down { color: var(--danger); }
.trend.same { color: var(--muted); }
.effort-card { display: flex; flex-direction: column; gap: 6px; }
.effort-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.effort-head label { font-weight: 600; }
.effort-val { display: inline-flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.effort-val output { font-weight: 650; }
.effort-val .link-btn { margin: 0; }
.effort-val [hidden] { display: none; }
/* Easy to hard along the track; untouched, the thumb waits hollow in the middle. */
.effort-range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 36px; margin: 4px 0 0; background: none; cursor: pointer; }
.effort-range::-webkit-slider-runnable-track { height: 8px; border-radius: 99px; background: linear-gradient(to right, var(--protein), var(--carbs), var(--fat)); }
.effort-range::-moz-range-track { height: 8px; border-radius: 99px; background: linear-gradient(to right, var(--protein), var(--carbs), var(--fat)); }
.effort-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgb(2 0 112 / .3); }
.effort-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 1px 4px rgb(2 0 112 / .3); }
.effort-range.unset::-webkit-slider-runnable-track { opacity: .35; }
.effort-range.unset::-moz-range-track { opacity: .35; }
.effort-range.unset::-webkit-slider-thumb { background: var(--surface); border: 2px dashed var(--muted); }
.effort-range.unset::-moz-range-thumb { background: var(--surface); border: 2px dashed var(--muted); }
.effort-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 99px; }
/* Numbers under the thumb's 10 stops: 28px thumb, 20px labels. */
.effort-scale { display: flex; justify-content: space-between; padding: 0 4px; font-size: 12px; color: var(--muted); }
.effort-scale span { width: 20px; text-align: center; }

/* rep maxes */
.max-end { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.rep-maxes .row-title { font-variant-numeric: tabular-nums; }

/* % and RPE calculator */
.head-actions { display: flex; gap: 8px; }
.link-btn.inline { display: inline; margin: 0; }
.contents { display: contents; }
.contents[hidden], .calc [data-pane][hidden] { display: none; }
.calc-pick { display: flex; gap: 12px; align-items: flex-end; }
.calc-pick > .field:first-child:not(:last-child) { flex: 1; min-width: 0; }
.calc-pick .seg-sm { height: 48px; }
.calc-pick .seg-sm button { height: auto; }
.calc-result { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 14px; border-top: 1px solid var(--line); text-align: center; }
.calc-result span { font-size: 13px; font-weight: 600; color: var(--muted); }
.calc-result strong { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.calc-result small { font-size: 13px; color: var(--muted); }
.pct-head { font-size: 13px; font-weight: 600; color: var(--muted); }
.pct-grid { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pct-grid li { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.pct-grid span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pct-grid strong { font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Google / Facebook sign-in (shared/auth.js) */
.social-login { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.btn.social {
  height: 48px; gap: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgb(2 0 112 / .06);
  transition: transform .1s, border-color .15s, box-shadow .15s, background .15s;
}
.btn.social svg { width: 20px; height: 20px; flex: none; stroke: none; } /* brand logos: no icon stroke */
.btn.social:disabled { opacity: .6; }
@media (hover: hover) {
  .btn.social:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 3px 12px rgb(2 0 112 / .1); }
}
@media (prefers-color-scheme: dark) {
  .btn.social { background: var(--surface-2); border-color: transparent; box-shadow: none; }
}
.or-line { display: flex; align-items: center; gap: 12px; margin: 2px 0; color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.or-line::before, .or-line::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
[data-role=social]:empty { display: none; }

/* Technique videos (app/videos.js): a camera button per exercise, the clips as chips under it. */
.ex-actions { display: flex; gap: 2px; flex: none; }
.ex-li { display: flex; flex-wrap: wrap; align-items: center; }
.ex-li .row { flex: 1; min-width: 0; }
.ex-li > .icon-btn { margin: 0 4px 0 2px; }
.ex-li .video-chips { flex-basis: 100%; padding: 0 10px 8px; }
.video-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.video-chips:empty { display: none; }
.video-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.video-chip svg { width: 13px; height: 13px; fill: currentColor; }
.video-share [hidden] { display: none; }
.video-preview, .video-player { display: block; width: 100%; max-height: 55vh; border-radius: var(--radius-sm); background: #000; object-fit: contain; }
.video-preview { max-height: 40vh; }
.video-progress { margin-top: -6px; }
.row-icon { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--surface-2); }
.row-icon svg { width: 15px; height: 15px; fill: currentColor; }

/* progress photos (app/photos.js) */
.photo-strip, .pose-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
.pose-img, .pose-slot {
  position: relative; display: block; width: 100%; aspect-ratio: 3 / 4; border-radius: var(--radius-sm);
  background: var(--surface-2); object-fit: cover; overflow: hidden;
}
span.pose-img.none { display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.pose-slot .pose-img { position: absolute; inset: 0; height: 100%; }
.pose-label {
  position: absolute; left: 6px; bottom: 6px; z-index: 1;
  padding: 2px 8px; border-radius: 99px; background: rgb(0 0 0 / .55); color: #fff; font-size: 12px; font-weight: 600;
}
.pose-slot.empty {
  display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 8px;
  background: transparent; border: 1.5px dashed var(--line);
}
.pose-slot.empty .pose-label { position: static; align-self: center; background: none; color: var(--text); padding: 0 0 4px; font-size: 14px; }
.pose-slot.empty .btn { padding: 0 8px; gap: 6px; font-size: 13px; }
.pose-slot.empty .btn svg { width: 16px; height: 16px; }
.file-btn.disabled { opacity: .35; pointer-events: none; }
.pose-status {
  position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: rgb(0 0 0 / .45); color: #fff; font-size: 13px; font-weight: 600;
}
.pose-status .spinner { margin: 0; border-color: rgb(255 255 255 / .35); border-top-color: #fff; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.m-photos .photo-actions { margin-top: 10px; }
.m-photos .chart-head .link-btn { margin: 0; }
.m-photos .photo-strip + p { margin-top: 8px; }
.photo-view img { display: block; width: 100%; max-height: 62dvh; object-fit: contain; border-radius: var(--radius-sm); background: var(--surface-2); }
.compare-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-pick select { appearance: none; padding-right: 10px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare figure { margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.compare img, .photo-none { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: var(--radius-sm); background: var(--surface-2); }
.photo-none { display: grid; place-items: center; padding: 8px; text-align: center; font-size: 13px; color: var(--muted); }
.compare figcaption { font-size: 13px; color: var(--muted); }
.compare figcaption strong { color: var(--text); font-weight: 600; }
.photo-minis { display: flex; gap: 4px; flex: none; }
.photo-mini { display: block; width: 30px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
