/* Apex Lane: food and training tracker
   Built from the "Stryd workout tracker" dashboard reference: a near-black ground,
   a left sidebar, dark bordered panels, small uppercase data labels, electric blue
   for primary data, rust/ember for the second series, and status chips. */

@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff") format("woff");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  /* from the reference palette */
  --bg: #040404;
  --panel: #0d0d0f;
  --panel-2: #151518;
  --line: #222226;
  --line-2: #303035;
  --text: #f7f7f8;
  --muted: #9aa3ae;
  --faint: #6a727c;
  --blue: #0d53e9;
  --blue-deep: #0b34b1;
  --navy: #15224e;
  --rust: #994a3c;
  /* tints made for dark backgrounds */
  --blue-text: #6b9aff;
  --ember: #e2744f;
  --amber: #e3b65a;
  --good: #3ddc97;
  --good-bg: #0f2a20;
  --warn: #e3b65a;
  /* one set of colours for calories and the three macros, used on every page */
  --c-kcal: #5b9cff; --c-protein: #b78cff; --c-carbs: #3ddc97; --c-fat: #e3b65a;
  --warn-bg: #2b2210;
  --bad: #f0866a;
  --bad-bg: #2d1612;
  /* values that used to be hard-coded, so the light theme can change them */
  --line-3: #404046;
  --hover: #1c1c20;
  --track: #1a1a1d;
  --track-2: #25272e;
  --track-3: #1f1f23;
  --tick: #cfd3dc;
  --glass: rgb(13 13 15 / 0.97);
  --glass-top: rgb(4 4 4 / 0.94);
  --glass-card: rgb(13 13 15 / 0.92);
  --glass-card-2: rgb(13 13 15 / 0.7);
  --blue-line: #213a80;
  --good-line: #1b4a37;
  --warn-line: #4a3a17;
  --bad-line: #5a2a22;
  --news-bg: #0b1626;
  --news-line: #1e3a6e;
  --verify-bg: #1c1708;
  --verify-line: #5b4a1e;
  --on-good: #04130c;
  --shadow: rgb(0 0 0 / 0.5);
  --pill-kcal-bg: #16295c; --pill-kcal: #8fb7ff;
  --pill-p-bg: #2e1f4f; --pill-p: #cdb0ff;
  --pill-c-bg: #123324; --pill-c: #6ee7ae;
  --pill-f-bg: #3a2c0d; --pill-f: #f0c86e;
  /* workout mode */
  --sess-bg: #12151c;
  --sess-card: #1b1f29;
  --sess-line: #2a3347;
  --sess-field: #12151c;
  --sess-tile: #f3f4f6;
  --sess-tile-ink: #1d222c;

  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --pad: clamp(1rem, 2vw, 1.5rem);
  --radius: 0.9rem;
  --sidebar: 15rem;

  --fs-xs: 0.6875rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.125rem;
  --fs-xl: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  --fs-xxl: clamp(2.4rem, 1.4rem + 3.6vw, 4.2rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
html[data-theme="light"] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--fs-md);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
h1 { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
h2 { font-size: var(--fs-md); font-weight: 600; letter-spacing: 0; line-height: 1.2; }
h3 { font-size: var(--fs-md); font-weight: 500; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 2px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 90; padding: 0.6rem 1rem; background: var(--text); color: var(--bg); font-weight: 600; border-radius: 0.5rem; }
.skip-link:focus { top: 1rem; }

.label { color: var(--muted); font-size: var(--fs-xs); font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- App shell: sidebar + body ---------- */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.25rem 0.9rem; background: var(--panel); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.7rem; padding: 0.25rem 0.5rem; text-decoration: none; font-weight: 600; font-size: var(--fs-lg); letter-spacing: -0.01em; }
.brand__mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 0.6rem; background: var(--blue); }
.brand__mark svg { width: 1.1rem; height: 1.1rem; }

.nav { display: grid; gap: 0.2rem; }
.nav__label { padding: 0 0.7rem 0.4rem; }
.nav a {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.7rem; border-radius: 0.6rem;
  color: var(--muted); text-decoration: none; font-weight: 500;
}
.nav a svg { width: 1.1rem; height: 1.1rem; flex: none; }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--panel-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.nav a[aria-current="page"] svg { color: var(--blue-text); }
.nav + .nav { margin-top: -0.25rem; }

.usercard { margin-top: auto; display: flex; align-items: center; gap: 0.7rem; padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--bg); }
.avatar { display: grid; place-items: center; flex: none; width: 2.2rem; height: 2.2rem; border-radius: 50%; background: var(--navy); color: var(--blue-text); font-weight: 600; font-size: var(--fs-sm); }
.usercard__name { font-weight: 500; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercard__sub { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usercard__sub[data-mode="in"]::before { content: ""; display: inline-block; width: 0.4rem; height: 0.4rem; margin-right: 0.35rem; border-radius: 50%; background: var(--good); vertical-align: 0.05rem; }
.usercard > div { min-width: 0; }

.app__body { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
#main { width: 100%; max-width: 78rem; margin: 0 auto; padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2.25rem) 3rem; flex: 1; }
.site-footer { max-width: 78rem; width: 100%; margin: 0 auto; padding: 1.25rem clamp(1rem, 3vw, 2.25rem) 2rem; color: var(--faint); font-size: var(--fs-sm); border-top: 1px solid var(--line); }

@media (max-width: 56em) {
  .app { display: block; }
  .sidebar { position: fixed; z-index: 50; inset: auto 0 0 0; height: auto; flex-direction: row; padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom)); gap: 0; border-right: 0; border-top: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); }
  .sidebar .brand, .sidebar .nav__label, .sidebar .usercard { display: none; }
  .sidebar .nav { display: contents; }
  .sidebar .nav + .nav { margin: 0; }
  .nav a { flex: 1; flex-direction: column; gap: 0.2rem; padding: 0.5rem 0.2rem; font-size: var(--fs-xs); text-align: center; }
  .nav a svg { width: 1.3rem; height: 1.3rem; }
  .topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 1rem; background: var(--glass-top); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
  .topbar .brand { padding: 0; font-size: var(--fs-md); }
  .topbar .brand__mark { width: 1.7rem; height: 1.7rem; }
  .topbar__sync { color: var(--muted); font-size: var(--fs-xs); text-align: right; }
  #main { padding-bottom: 6rem; }
  .site-footer { padding-bottom: 6rem; }
}

/* ---------- Page header ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 1.5rem; }
.page-head p { color: var(--muted); margin-top: 0.35rem; }
.page-head__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ---------- Panels and grids ---------- */

.panel { padding: var(--pad); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.panel__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.panel__head h2 { font-size: var(--fs-sm); font-weight: 500; }
.stack > * + * { margin-top: 1rem; }

.grid { display: grid; gap: 1rem; }
.stats { grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); margin-bottom: 1rem; }
.row-2 { grid-template-columns: 1fr; margin-bottom: 1rem; }
.row-3 { grid-template-columns: 1fr; }
@media (min-width: 64em) {
  .row-2 { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
  .row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 48em) and (max-width: 63.99em) { .row-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Stat cards */

.stat { display: grid; gap: 0.85rem; }
.stat__top { display: flex; align-items: center; gap: 0.6rem; }
.stat__icon { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border: 1px solid var(--line-2); border-radius: 0.55rem; color: var(--muted); }
.stat__icon svg { width: 1rem; height: 1rem; }
.stat__value { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__value small { margin-left: 0.3rem; color: var(--muted); font-size: var(--fs-sm); font-weight: 400; letter-spacing: 0; }

/* Status chips */

.chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.5rem; border: 1px solid var(--line-2); border-radius: 0.4rem; background: var(--panel-2); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.chip--good { border-color: var(--good-line); background: var(--good-bg); color: var(--good); }
.chip--warn { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn); }
.chip--bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad); }
.chip--blue { border-color: var(--blue-line); background: var(--navy); color: var(--blue-text); }

/* ---------- Buttons and fields ---------- */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.6rem 1.1rem;
  border: 1px solid var(--line-2); border-radius: 0.65rem; background: var(--panel-2); color: var(--text);
  font-size: var(--fs-sm); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.button:hover { background: var(--hover); border-color: var(--line-3); }
.button--primary { border-color: var(--blue); background: var(--blue); color: #fff; }
.button--primary:hover { background: #2a68f0; border-color: #2a68f0; }
.button--ghost { background: transparent; }
.button--small { padding: 0.4rem 0.75rem; font-size: var(--fs-xs); }
.button--block { width: 100%; padding: 0.8rem 1.1rem; }
.button[disabled] { opacity: 0.5; cursor: not-allowed; }

.icon-button { display: inline-grid; place-items: center; min-width: 2.1rem; height: 2.1rem; padding: 0 0.5rem; border: 1px solid var(--line-2); border-radius: 0.55rem; background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { color: var(--text); background: var(--panel-2); }
.icon-button[disabled] { opacity: 0.3; cursor: default; background: transparent; color: var(--muted); }

.text-button { padding: 0; border: 0; background: none; color: var(--muted); font-size: var(--fs-sm); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 0.3em; cursor: pointer; }
.text-button:hover { color: var(--text); }
.text-button--danger:hover { color: var(--bad); }
a.text-button { display: inline-block; }

.field { display: grid; gap: 0.35rem; }
.field label, .field legend { color: var(--muted); font-size: var(--fs-sm); }
input, select, textarea { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--line-2); border-radius: 0.6rem; background: var(--bg); color: var(--text); }
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--blue-text); box-shadow: 0 0 0 3px rgb(13 83 233 / 0.25); }
input[type="checkbox"] { width: auto; accent-color: var(--blue); }
input[type="date"] { color-scheme: dark; }
.form-grid { display: grid; gap: 0.9rem; grid-template-columns: repeat(2, 1fr); }
.form-grid .wide { grid-column: 1 / -1; }
@media (min-width: 40em) { .form-grid--4 { grid-template-columns: repeat(4, 1fr); } }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1rem; }
.form-status { color: var(--muted); font-size: var(--fs-sm); }
.form-status.is-error { color: var(--bad); }
.form-status.is-ok { color: var(--good); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Charts ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin-top: 0.75rem; color: var(--muted); font-size: var(--fs-xs); }
.legend span::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.45rem; border-radius: 50%; background: var(--c); }
.chart { width: 100%; height: auto; }
.chart text { fill: var(--faint); font-family: var(--body); font-size: 11px; letter-spacing: 0.08em; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .bar-a { fill: var(--ember); }
.chart .bar-b { fill: var(--blue); }
.chart .bar-today { filter: brightness(1.25); }

.ring { display: block; width: min(11rem, 100%); margin: 0.25rem auto 0; }
.ring__track { stroke: var(--track); }
.ring__value { stroke: var(--blue-text); transition: stroke-dashoffset 0.5s ease; }
.ring__value.is-over { stroke: var(--ember); }
.ring text { fill: var(--text); font-family: var(--body); }
.ring__center { text-align: center; }
.ring-wrap { display: grid; gap: 0.6rem; justify-items: center; text-align: center; }

.meter { margin-top: 0.4rem; height: 0.35rem; border-radius: 99px; background: var(--track); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--c, var(--blue-text)); transition: width 0.4s ease; }
.meter.is-over > span { background: var(--ember); }

.focus-list { display: grid; gap: 0.9rem; }
.focus-row { display: grid; grid-template-columns: 5.5rem 1fr 2.6rem; gap: 0.75rem; align-items: center; }
.focus-row .meter { margin: 0; }
.focus-row .pct { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: var(--fs-sm); }

.macro-rows { display: grid; gap: 0.8rem; margin-top: 1rem; width: 100%; }
.macro-row { display: grid; gap: 0.1rem; text-align: left; }
.macro-row__top { display: flex; justify-content: space-between; font-size: var(--fs-sm); }
.macro-row__top span:first-child { color: var(--muted); }
.macro-row .meter { margin-top: 0.3rem; }

/* ---------- Lists ---------- */

.list { display: grid; }
.list__item { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.list__item:first-child { border-top: 0; padding-top: 0; }
.list__item:last-child { padding-bottom: 0; }
.list__title { font-weight: 500; }
.list__meta { grid-column: 1; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.list__side { grid-column: 2; grid-row: 1 / span 2; text-align: right; }
.empty { color: var(--muted); font-size: var(--fs-sm); }

.plan-item { display: grid; grid-template-columns: auto 1fr auto; gap: 0.2rem 0.8rem; align-items: center; padding: 0.7rem 0; border-top: 1px solid var(--line); cursor: pointer; }
.plan-item:first-child { border-top: 0; padding-top: 0; }
.plan-item input { grid-row: 1 / span 2; width: 1.15rem; height: 1.15rem; border-radius: 50%; appearance: none; border: 1.5px solid var(--line-2); background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.plan-item input:checked { background: var(--blue); border-color: var(--blue); }
.plan-item input:checked::after { content: ""; width: 0.3rem; height: 0.55rem; margin-top: -0.1rem; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.plan-item__name { font-weight: 500; }
.plan-item.is-done .plan-item__name { color: var(--muted); }
.plan-item__meta { grid-column: 2; color: var(--muted); font-size: var(--fs-sm); }
.plan-item .chip { grid-column: 3; grid-row: 1 / span 2; }

/* ---------- Food page ---------- */

.datenav { display: flex; flex-wrap: wrap; align-items: start; gap: 0.5rem; }
.datenav input { width: auto; }

.meal { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.meal + .meal { margin-top: 1rem; }
.meal__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.9rem var(--pad); }
.meal__total { color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.meal__empty { padding: 0 var(--pad) 0.9rem; color: var(--muted); font-size: var(--fs-sm); }
.meal__foot { padding: 0.7rem var(--pad); border-top: 1px solid var(--line); }
.entry { display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 1rem; align-items: center; padding: 0.7rem var(--pad); border-top: 1px solid var(--line); }
.entry__name { font-weight: 500; }
.entry__meta { grid-column: 1; color: var(--muted); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.entry__actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0.9rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips .chip { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: var(--fs-sm); padding: 0.3rem 0.35rem 0.3rem 0.7rem; color: var(--text); }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 0.3rem; }
.chip button:hover { color: var(--bad); }

dialog { width: min(36rem, calc(100% - 2rem)); max-height: calc(100vh - 2rem); overflow: auto; padding: 1.4rem; border: 1px solid var(--line-2); border-radius: 1rem; background: var(--panel); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 0.75); }
dialog h2 { font-size: var(--fs-lg); margin-bottom: 1rem; }

.dbsearch { display: grid; gap: 0.5rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.dbresults { display: grid; max-height: 14rem; overflow: auto; border: 1px solid var(--line); border-radius: 0.6rem; }
.dbresults:empty { display: none; }
.dbresult { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; width: 100%; padding: 0.6rem 0.75rem; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.dbresult:first-child { border-top: 0; }
.dbresult:hover, .dbresult:focus-visible { background: var(--panel-2); }
.dbresult__name { font-weight: 500; font-size: var(--fs-sm); }
.dbresult__meta { grid-column: 1; color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.dbresult .chip { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.dbpicked { padding: 0.7rem 0.8rem; border: 1px solid var(--blue-line); border-radius: 0.6rem; background: var(--navy); font-size: var(--fs-sm); }

/* ---------- Train page ---------- */

.train { display: grid; gap: 1rem; }
@media (min-width: 72em) { .train { grid-template-columns: 21rem minmax(0, 1fr); align-items: start; } .library { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; } }
@media (max-width: 71.99em) { .library { order: 2; } }

.seg { display: flex; padding: 0.2rem; margin-bottom: 1rem; border: 1px solid var(--line-2); border-radius: 0.7rem; background: var(--bg); }
.seg button { flex: 1; padding: 0.45rem; border: 0; border-radius: 0.5rem; background: transparent; color: var(--muted); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.library__target { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.library__target select { flex: 1; width: auto; }

.lib-list { display: grid; gap: 0.5rem; }
.lib-item { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--bg); cursor: grab; }
.lib-item:active { cursor: grabbing; }
.lib-item__name { font-weight: 500; }
.lib-item__note { grid-column: 1; color: var(--muted); font-size: var(--fs-sm); }
.lib-item .button { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
.lib-item ul { grid-column: 1 / -1; margin-top: 0.4rem; color: var(--faint); font-size: var(--fs-sm); }

.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.filters button { padding: 0.25rem 0.65rem; border: 1px solid var(--line-2); border-radius: 99px; background: transparent; color: var(--muted); font-size: var(--fs-xs); cursor: pointer; }
.filters button[aria-pressed="true"] { border-color: var(--blue); background: var(--navy); color: var(--blue-text); }

.week { display: grid; align-items: start; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.day { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-height: 11rem; overflow: hidden; }
.day.is-today { border-color: var(--blue); }
.day.is-over { background: var(--panel-2); border-style: dashed; border-color: var(--blue-text); }
.day__head { display: grid; gap: 0.5rem; padding: 0.8rem; border-bottom: 1px solid var(--line); }
.day__name { display: flex; justify-content: space-between; align-items: center; }
.day__label { padding: 0.4rem 0.6rem; font-size: var(--fs-sm); }
.day__items { display: grid; gap: 0.5rem; align-content: start; padding: 0.6rem; flex: 1; }
.day__empty { padding: 0.8rem; color: var(--muted); font-size: var(--fs-sm); }
.day__foot { display: flex; justify-content: space-between; align-items: center; padding: 0.55rem 0.8rem; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--fs-sm); }

.ex { display: grid; gap: 0.45rem; padding: 0.6rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--bg); }
.ex.is-dragging { opacity: 0.4; }
.ex.drop-before { box-shadow: 0 -2px 0 var(--blue-text); }
.ex__top { display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem; align-items: center; }
.ex__grip { cursor: grab; color: var(--faint); user-select: none; letter-spacing: -0.15em; }
.ex__name { font-weight: 500; font-size: var(--fs-sm); line-height: 1.3; }
.ex__fields { display: grid; grid-template-columns: 3.2rem 1fr 4.6rem; gap: 0.4rem; }
.ex__fields label { display: grid; gap: 0.15rem; color: var(--muted); font-size: var(--fs-xs); }
.ex__fields input { padding: 0.3rem 0.45rem; font-size: var(--fs-sm); border-radius: 0.45rem; }
.ex__tools { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.ex__tools .icon-button { min-width: 1.9rem; height: 1.9rem; font-size: var(--fs-sm); }
.ex__tools select { flex: 1; width: auto; min-width: 6rem; padding: 0.25rem 0.4rem; font-size: var(--fs-xs); border-radius: 0.45rem; }

/* ---------- Account ---------- */

.account { display: grid; gap: 1rem; }
@media (min-width: 56em) { .account { grid-template-columns: 1fr 1fr; align-items: start; } }
.kv { display: grid; gap: 0.75rem; margin-bottom: 1rem; }
.kv div { display: grid; gap: 0.1rem; }
.divider { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

.toast { position: fixed; left: 50%; bottom: 1.25rem; z-index: 80; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; padding: 0.7rem 1.1rem; border: 1px solid var(--line-2); border-radius: 0.7rem; background: var(--panel-2); font-size: var(--fs-sm); transition: opacity 0.2s ease, transform 0.2s ease; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 56em) { .toast { bottom: 5.5rem; } }

/* ---------- Front page ---------- */

.landing { min-height: 100vh; display: flex; flex-direction: column; background:
  radial-gradient(60rem 30rem at 85% -10%, rgb(13 83 233 / 0.28), transparent 60%),
  radial-gradient(40rem 24rem at 0% 20%, rgb(21 34 78 / 0.55), transparent 60%),
  var(--bg); }
.landing__top, .landing__hero, .landing__preview, .landing__foot { width: 100%; max-width: 74rem; margin: 0 auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.landing__top { display: flex; align-items: center; justify-content: space-between; padding-block: 1.25rem; }
.landing__hero { display: grid; gap: clamp(2rem, 5vw, 4rem); align-items: center; padding-block: clamp(2rem, 6vw, 5rem); }
@media (min-width: 60em) { .landing__hero { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); } }
.landing__copy h1 { font-size: var(--fs-xxl); letter-spacing: -0.03em; line-height: 1.02; max-width: 12ch; }
.landing__lede { margin-top: 1.25rem; max-width: 32rem; color: var(--muted); font-size: var(--fs-lg); }
.landing__points { display: grid; gap: 0.9rem; margin-top: 2rem; max-width: 32rem; }
.landing__points li { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 0.9rem; }
.landing__points .stat__icon { grid-row: 1 / span 2; width: 2.2rem; height: 2.2rem; }
.landing__points strong { font-weight: 600; }
.landing__points span { color: var(--muted); font-size: var(--fs-sm); }

.authcard { padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line-2); border-radius: 1.1rem; background: var(--glass-card); box-shadow: 0 1.5rem 4rem var(--shadow); }
.authcard h2 { font-size: var(--fs-lg); margin-bottom: 0.25rem; }
.authcard > p { color: var(--muted); font-size: var(--fs-sm); margin-bottom: 1.25rem; }
.authcard form { display: grid; gap: 0.9rem; }
.authcard__alt { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: var(--fs-sm); }

.landing__preview { padding-bottom: clamp(2rem, 6vw, 5rem); }
.preview { padding: clamp(0.75rem, 2vw, 1.25rem); border: 1px solid var(--line-2); border-radius: 1.2rem; background: var(--glass-card-2); }
.preview__grid { display: grid; gap: 0.75rem; }
@media (min-width: 48em) { .preview__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
.preview .panel { background: var(--panel); }
.preview__cap { margin: 0.9rem 0.25rem 0; color: var(--faint); font-size: var(--fs-xs); }
.landing__foot { padding-block: 1.5rem 2rem; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Food page summary */
.summary { display: grid; gap: 1.25rem; }
.summary__kcal .stat__value { font-size: clamp(2.2rem, 1.4rem + 2.8vw, 3.4rem); }
.summary__macros { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary__macros .macro-row__top { flex-direction: column; gap: 0.1rem; }
.summary__macros .macro-row__top strong { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---- late additions ---- */
.entries { list-style: none; margin: 0; padding: 0; }
.ex-wrap { list-style: none; }
.dbpicked[hidden] { display: none; }
dialog form > .dbsearch + .form-grid { margin-top: 0; }
.authcard h2 + p { margin: 0.35rem 0 1.1rem; }
#summary + .page-head { margin-top: 1.5rem; }

/* ---- weight, progress, plan ---- */
.weightbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 1rem; padding: 1rem var(--pad); border: 1px solid var(--blue-line); border-radius: var(--radius); background: var(--navy); }
.weightbar h2 { font-size: var(--fs-base); }
.weightbar__form { display: flex; flex-wrap: wrap; align-items: end; gap: 0.6rem; }
.weightbar__form .field { max-width: 9rem; }
.weightbar__form .form-status { flex-basis: 100%; }
.weightbar.is-done { padding-block: 0.7rem; border-color: var(--line); background: var(--panel); }
.weightbar__links { display: flex; gap: 1rem; }
.seg--inline { margin: 0; }
.seg--inline button { padding: 0.35rem 0.7rem; }
.chart .trend-line { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .w-dot { fill: var(--muted); }
.chart .goal-line { stroke: var(--good); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.7; }
.plan { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.75rem; margin-top: 0.75rem; }
.plan__cell { display: grid; gap: 0.25rem; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.7rem; background: var(--bg); }
.plan__cell strong { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.plan__cell small { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.label { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }
[hidden] { display: none !important; }

/* ---- fasting and weekly check-in ---- */
.fastbar { display: grid; gap: 0.4rem; justify-items: start; margin-bottom: 1rem; }
.reviewbar { margin-bottom: 1rem; }
.reviewbar h2 { font-size: var(--fs-sm); font-weight: 500; }
.check { display: flex; align-items: flex-start; gap: 0.6rem; color: var(--muted); font-size: var(--fs-sm); cursor: pointer; }
.check input { width: auto; margin-top: 0.2rem; }

/* ---- copy a meal ---- */
.copylist { display: grid; border: 1px solid var(--line); border-radius: 0.6rem; overflow: hidden; }
.copyrow { display: grid; grid-template-columns: auto 1fr; gap: 0.1rem 0.75rem; align-items: center; padding: 0.65rem 0.8rem; border-top: 1px solid var(--line); cursor: pointer; }
.copyrow:first-child { border-top: 0; }
.copyrow input { grid-row: 1 / span 2; width: auto; }
.copyrow:has(input:checked) { background: var(--navy); }
.copyrow.is-empty { cursor: default; opacity: 0.55; }
.copyrow__day { font-weight: 500; font-size: var(--fs-sm); }
.copyrow__meta { grid-column: 2; color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meal__foot { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.verifybar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.4rem 1rem; margin-bottom: 1rem; padding: 0.7rem var(--pad); border: 1px solid var(--verify-line); border-radius: var(--radius); background: var(--verify-bg); color: var(--amber); font-size: var(--fs-sm); }
.verifybar strong { color: var(--text); font-weight: 500; }

/* ---- picked database food ---- */
.dbpicked { display: grid; gap: 0.7rem; padding: 0.9rem; }
.dbpicked__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.3rem 1rem; }
.nutri { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-top: 0.35rem; }
.nutri > div { display: grid; gap: 0.1rem; padding: 0.5rem 0.6rem; border-radius: 0.55rem; background: rgba(4, 4, 4, 0.55); }
.nutri strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.nutri small { color: var(--muted); font-size: var(--fs-xs); font-weight: 400; }
.logas { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0.75rem; }
.preview-total { padding-top: 0.6rem; border-top: 1px solid var(--blue-line); }
.js-manual[hidden] { display: none !important; }
@media (max-width: 30em) { .nutri { grid-template-columns: repeat(2, 1fr); } }

/* ---- clipping fixes ---- */
.chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.stat > div { min-width: 0; }
.seg--inline button { white-space: nowrap; }
.seg--inline { max-width: 100%; overflow-x: auto; }

/* ---- barcode scanner ---- */
.searchrow { display: flex; gap: 0.5rem; }
.searchrow input { flex: 1; min-width: 0; }
.searchrow .button { white-space: nowrap; }
dialog.scanner { width: min(34rem, calc(100vw - 1.5rem)); }
.scanner__reader { min-height: 11rem; overflow: hidden; border-radius: 0.7rem; background: #000; }
.scanner__reader video { width: 100% !important; height: auto !important; }
.scanner__status { margin: 0.75rem 0; color: var(--muted); font-size: var(--fs-sm); }
.scanner__status.is-error { color: var(--bad); }
.scanner__manual { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; }
.scanner__manual input { flex: 1; min-width: 0; }

/* ---- nutrition label scan, and extra nutrients ---- */
dialog.labeldlg { width: min(34rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow-y: auto; }
.labelscan .form-grid { margin-top: 0.75rem; }
.field.is-flagged input { border-color: var(--warn, #e0a030); box-shadow: 0 0 0 1px var(--warn, #e0a030); }
.moremicros { margin-top: 0.75rem; }
.moremicros > summary { cursor: pointer; color: var(--muted, #9aa3b5); font-size: 0.9rem; padding: 0.25rem 0; }
.moremicros[open] > summary { margin-bottom: 0.5rem; }
.nlist { display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; margin: 0; font-size: 0.92rem; }
.nlist dt { color: var(--muted, #9aa3b5); }
.nlist dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.missrow { margin-top: 0.5rem; }

/* ---- full nutrient list ---- */
.nutlist__head { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.nutlist__water { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.nutgroup { border-top: 1px solid var(--line-2, #26262b); }
.nutgroup > summary { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; padding: 0.85rem 0; font-weight: 600; font-size: 1.05rem; list-style: none; }
.nutgroup > summary::-webkit-details-marker { display: none; }
.nutgroup > summary::after { content: "›"; margin-left: auto; color: var(--muted, #9aa3b5); transition: transform 0.15s; }
.nutgroup[open] > summary::after { transform: rotate(90deg); }
.nutgroup__dot { width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--c); }
.nutgroup__rows { display: grid; gap: 0.15rem; padding-bottom: 0.75rem; }
.nrow { display: grid; grid-template-columns: 1fr auto auto; gap: 0.15rem 0.75rem; align-items: baseline; width: 100%; padding: 0.6rem 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.nrow--static { cursor: default; }
.nrow__name { font-weight: 500; }
.nrow__val { color: var(--muted, #9aa3b5); font-variant-numeric: tabular-nums; font-size: 0.92rem; text-align: right; }
.nrow__pct { min-width: 4.2rem; text-align: right; font-size: 0.92rem; font-variant-numeric: tabular-nums; color: var(--muted, #9aa3b5); }
.nrow__bar { grid-column: 1 / -1; position: relative; height: 0.7rem; border-radius: 0.2rem; background: color-mix(in srgb, var(--c) 16%, var(--track-3)); overflow: hidden; }
.nrow__bar.is-none { background: var(--track-3); }
.nrow__fill { position: absolute; inset: 0 auto 0 0; background: var(--c); border-radius: 0.2rem; }
.nrow__fill.is-over { background: var(--warn, #e3b65a); }
.nrow__tick { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--tick); opacity: 0.55; }
.nrow:hover .nrow__name, .nrow:focus-visible .nrow__name { text-decoration: underline; }

/* ---- what's new banner ---- */
.newsbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; padding: 0.7rem var(--pad); border: 1px solid var(--news-line); border-radius: var(--radius); background: var(--news-bg); color: var(--text); font-size: var(--fs-sm); }
.newsbar strong { color: var(--blue-text); font-weight: 600; }
.newsbar a { color: var(--blue-text); text-decoration: underline; white-space: nowrap; }
.newsbar__close { flex: none; width: 2rem; height: 2rem; margin: -0.3rem -0.4rem 0 0; border: 0; border-radius: 0.5rem; background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.newsbar__close:hover { background: var(--panel-2); color: var(--text); }

/* ---------- Add food page ---------- */
.addpage { max-width: 40rem; margin: 0 auto; }
.addhead { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.addhead__title { flex: 1; display: grid; min-width: 0; }
.addhead__meal { width: fit-content; justify-self: start; max-width: 100%; padding: 0.1rem 0; border: 0; background: transparent; color: var(--text); font-family: var(--display, inherit); font-size: var(--fs-lg); font-weight: 600; cursor: pointer; }
.asearch__input { width: 100%; padding: 0.95rem 1.1rem; border-radius: 0.9rem; font-size: 1.05rem; }
.aactions { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr)); gap: 0.5rem; margin: 0.75rem 0; }
.aaction { display: grid; justify-items: center; gap: 0.2rem; padding: 0.7rem 0.3rem; border: 1px solid var(--line-2); border-radius: 0.8rem; background: var(--panel); color: var(--text); font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.aaction:hover:not([disabled]) { background: var(--panel-2); }
.aaction[disabled] { opacity: 0.4; cursor: default; }
.aaction__icon { font-size: 1.35rem; line-height: 1; color: var(--blue-text); }
.atabs { display: flex; gap: 1.25rem; margin: 1rem 0 0.25rem; border-bottom: 1px solid var(--line); }
.atabs button { padding: 0.5rem 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
.atabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--blue); }
.alist { list-style: none; margin: 0; padding: 0; }
.arow { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 0.6rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.arow__main { display: grid; gap: 0.05rem; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.arow__name { font-weight: 600; overflow-wrap: anywhere; }
.arow__brand, .arow__macros { color: var(--muted); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.arow__serv { color: var(--muted); font-size: var(--fs-xs); text-align: right; max-width: 6.5rem; }
.astar { width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: var(--faint); font-size: 1.2rem; cursor: pointer; }
.astar.is-on { color: var(--amber); }
.aadd { width: 2.4rem; height: 2.4rem; border: 1.5px solid var(--line-2); border-radius: 50%; background: transparent; color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.aadd:hover { border-color: var(--blue); color: var(--blue-text); }
.apad { padding: 1rem 0; }
.adetail { display: grid; gap: 0.6rem; }
.arow--plain { grid-template-columns: 1fr auto auto; }
.atabs { overflow-x: auto; gap: 1rem; }
.atabs button { white-space: nowrap; }
.asave { margin: 0.75rem 0; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--panel); }
.asave p { margin: 0 0 0.5rem; }
.apad--tight { padding: 0.75rem 0 0.25rem; }

/* Colour-coded macros: calories blue, protein purple, carbs green, fat amber */
.pills { display: flex; gap: 0.4rem; }
.pill { min-width: 2.6rem; padding: 0.3rem 0.65rem; border-radius: 99px; text-align: center; font-size: var(--fs-sm); font-weight: 600; font-variant-numeric: tabular-nums; }
.pill--kcal { background: var(--pill-kcal-bg); color: var(--pill-kcal); }
.pill--p { background: var(--pill-p-bg); color: var(--pill-p); }
.pill--c { background: var(--pill-c-bg); color: var(--pill-c); }
.pill--f { background: var(--pill-f-bg); color: var(--pill-f); }
.summary .meter { height: 0.7rem; background: var(--track-2); }
.summary__macros .macro-row__top span:first-child { font-weight: 600; }
.addhead__meal { color-scheme: dark; }
.addhead__meal option { background: var(--panel-2); color: var(--text); font-size: var(--fs-base, 1rem); font-weight: 500; }
dialog:focus, dialog:focus-visible { outline: none; }

.trendcard { display: block; width: 100%; margin-bottom: 1rem; text-align: left; color: inherit; cursor: pointer; font: inherit; }
.trendcard:hover { border-color: var(--line-2); background: var(--panel-2); }
.trendcard .panel__head { margin-bottom: 0.5rem; }
.trendcard__top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; margin-bottom: 0.5rem; }
.trendcard__kg { font-size: 2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.trendcard__kg small { font-size: var(--fs-sm); color: var(--muted); font-weight: 500; }
.wlist { max-height: 40vh; overflow: auto; margin-bottom: 1rem; }
.wrow { grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 0.4rem; align-items: center; }
.wrow__kg { display: flex; align-items: center; gap: 0.3rem; }
.wrow__kg input { width: 4.4rem; padding-inline: 0.5rem; }
.wrow__fat input { width: 4.2rem; }
.wrow .text-button { font-size: 0.9rem; padding-inline: 0.2rem; }
.wrow .entry__name { font-size: 0.9rem; line-height: 1.25; }
#wd-fat { width: 5rem; }

.stack { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.trendcard { margin-bottom: 0; padding: 1rem; }
.trendcard__kg { font-size: 1.5rem; }
.trendcard__top { gap: 0.1rem 0.75rem; margin-bottom: 0.25rem; }
.trendcard { cursor: default; }
.trendcard:hover { background: var(--panel); border-color: var(--line); }
.trendcard__body { display: block; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.trendcard__hint { display: block; margin-top: 0.25rem; text-align: right; }
.trendcard .seg { margin-bottom: 0; }
.trendcard .seg button { padding: 0.3rem 0.6rem; }

/* Limits (sodium, saturated fat and so on): warm up as you approach them, red once passed */
.nrow__fill.is-over { background: var(--bad); }
.nrow__fill.is-near { background: var(--warn); }
.nrow__pct.is-bad { color: var(--bad); font-weight: 600; }
.nrow__pct.is-near { color: var(--warn); }
.nrow__flag { margin-left: 0.5rem; padding: 0.1rem 0.45rem; border-radius: 99px; font-size: var(--fs-xs); font-weight: 600; white-space: nowrap; }
.nrow__flag.is-bad { background: var(--bad-bg); color: var(--bad); }
.nrow__flag.is-near { background: var(--warn-bg); color: var(--warn); }
.nwarn { margin-bottom: 1rem; padding: 0.7rem 0.9rem; border: 1px solid var(--bad-line); border-radius: 0.7rem; background: var(--bad-bg); color: var(--bad); font-size: var(--fs-sm); }
.nwarn .muted { color: var(--muted); }

/* Summary: calories on top, then protein / carbs / fat each as name, bar, grams logged / target */
.summary { gap: 1.5rem; }
.summary__macros .macro-row { gap: 0.4rem; }
.summary__macros .macro-row__top { display: contents; }
.summary__macros .macro-row__top span:first-child { order: 1; color: var(--text); font-size: var(--fs-base, 1rem); font-weight: 500; }
.summary__macros .meter { order: 2; margin-top: 0; }
.summary__macros .macro-row__top strong { order: 3; font-size: var(--fs-base, 1rem); font-weight: 600; }
.summary__macros .macro-row__top strong .muted { font-weight: 400; }

.gactivity { padding: 1rem; }
.gbars { display: flex; align-items: flex-end; gap: 0.35rem; height: 3.5rem; margin: 0.5rem 0; }
.gbar { flex: 1; min-height: 4px; border-radius: 0.25rem 0.25rem 0 0; background: var(--line-2); }
.gbar.is-today { background: var(--blue-text); }
.gworkouts { margin-top: 0.5rem; }
.gworkouts .entry { padding-inline: 0; }

/* Privacy and Terms pages */
.legal { width: 100%; max-width: 46rem; margin: 0 auto; padding: clamp(1.5rem, 5vw, 3rem) clamp(1rem, 4vw, 2rem) 3rem; }
.legal h1 { font-size: var(--fs-xl, 2rem); letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.legal h2 { font-size: var(--fs-lg, 1.2rem); margin: 2rem 0 0.5rem; }
.legal p, .legal li { line-height: 1.65; }
.legal p { margin-top: 0.75rem; }
.legal ul { margin: 0.5rem 0 0 1.25rem; list-style: disc; display: grid; gap: 0.5rem; }
.legal a, .landing__foot a { text-decoration: underline; text-underline-offset: 2px; }
.landing__legal { margin-bottom: 0.5rem; }

/* Dashboard: the weekly card keeps its own height instead of stretching to the tall right column */
.row-2 { align-items: start; }


/* ---------- Light theme (the switch in the sidebar, top bar and Settings) ---------- */
html[data-theme="light"] {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #edf0f6;
  --line: #e0e4ec;
  --line-2: #cfd5e1;
  --text: #12151c;
  --muted: #566073;
  --faint: #7a8496;
  --blue: #0d53e9;
  --blue-deep: #0b34b1;
  --navy: #e4ecff;
  --rust: #994a3c;
  --blue-text: #1c4fd6;
  --ember: #d9582f;
  --amber: #9a6a00;
  --good: #0c8a58;
  --good-bg: #dcf5e9;
  --warn: #946500;
  --c-kcal: #2f6fe0; --c-protein: #7c4dd6; --c-carbs: #0f9d63; --c-fat: #c28a12;
  --warn-bg: #fdf0cf;
  --bad: #c0432a;
  --bad-bg: #fde5df;
  --line-3: #b9c1d1;
  --hover: #e6eaf2;
  --track: #e3e7ef;
  --track-2: #dde2ec;
  --track-3: #e6e9f0;
  --tick: #3b4252;
  --glass: rgb(255 255 255 / 0.97);
  --glass-top: rgb(243 245 249 / 0.94);
  --glass-card: rgb(255 255 255 / 0.94);
  --glass-card-2: rgb(255 255 255 / 0.75);
  --blue-line: #b7c9f5;
  --good-line: #a6dcc2;
  --warn-line: #e7cf8d;
  --bad-line: #efb5a9;
  --news-bg: #eaf1ff;
  --news-line: #b7c9f5;
  --verify-bg: #fff6dc;
  --verify-line: #e7cf8d;
  --on-good: #ffffff;
  --shadow: rgb(30 40 70 / 0.16);
  --pill-kcal-bg: #dfe9ff; --pill-kcal: #1d4ed0;
  --pill-p-bg: #ebe2ff; --pill-p: #5b32b5;
  --pill-c-bg: #d7f3e4; --pill-c: #0b7a4a;
  --pill-f-bg: #fbeecb; --pill-f: #86600a;
  --sess-bg: #f3f5f9;
  --sess-card: #ffffff;
  --sess-line: #d7dde9;
  --sess-field: #eef1f7;
  --sess-tile: #eef1f7;
  --sess-tile-ink: #2a3140;
}
html[data-theme="light"] dialog::backdrop { background: rgb(20 28 50 / 0.45); }
html[data-theme="light"] .landing { background:
  radial-gradient(60rem 30rem at 85% -10%, rgb(13 83 233 / 0.12), transparent 60%),
  radial-gradient(40rem 24rem at 0% 20%, rgb(120 150 230 / 0.18), transparent 60%),
  var(--bg); }
html[data-theme="light"] .button--primary:hover { background: #2a68f0; }
html[data-theme="light"] .ring__value { stroke: var(--blue); }

/* the theme switch */
.themebtn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; padding: 0 0.7rem; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel); color: var(--text); font-size: var(--fs-sm); cursor: pointer; }
.themebtn:hover { background: var(--hover); }
.themebtn svg { width: 1.1rem; height: 1.1rem; flex: none; }
.themebtn .themebtn__sun { display: none; }
html[data-theme="light"] .themebtn .themebtn__sun { display: block; }
html[data-theme="light"] .themebtn .themebtn__moon { display: none; }
.themebtn--icon { width: 2.25rem; padding: 0; justify-content: center; }
.themebtn--icon .themebtn__text { display: none; }
.sidebar .themebtn { margin: auto 0 0.6rem; width: 100%; justify-content: flex-start; border-radius: 0.8rem; }
.sidebar .themebtn + .usercard { margin-top: 0; }
@media (max-width: 56em) { .sidebar .themebtn { display: none; } }
.topbar__right { display: flex; align-items: center; gap: 0.6rem; }

/* ---------- Workout mode ---------- */
.resume { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; padding: 0.8rem 1rem; border: 1px solid var(--blue); border-radius: var(--radius); background: var(--navy); }
html.in-session, html.in-session body { overflow: hidden; }
.session { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--sess-bg); }
.session__top { display: flex; align-items: center; gap: 0.9rem; max-width: 40rem; width: 100%; margin: 0 auto; padding: max(1rem, env(safe-area-inset-top)) 1.1rem 0.9rem; }
.session__back { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.session__back svg { width: 1.8rem; height: 1.8rem; }
.session__title { flex: 1; min-width: 0; }
.session__title p { color: var(--muted); font-size: 1.15rem; line-height: 1.25; }
.session__title h1 { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session__finish { display: inline-flex; align-items: center; gap: 0.5rem; flex: none; min-height: 3.2rem; padding: 0 1.2rem; border: 2px solid var(--blue-text); border-radius: 1rem; background: none; color: var(--blue-text); font-size: 1.15rem; font-weight: 600; cursor: pointer; }
.session__finish svg { width: 1.5rem; height: 1.5rem; padding: 0.15rem; border: 2px solid currentColor; border-radius: 50%; }
.session__prog { display: flex; align-items: center; gap: 1rem; max-width: 40rem; width: 100%; margin: 0 auto; padding: 0.6rem 1.1rem 1rem; }
.session__time { display: inline-flex; align-items: center; gap: 0.6rem; min-width: 7.2rem; color: var(--blue-text); font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.session__time svg { width: 1.5rem; height: 1.5rem; }
.session__sep { align-self: stretch; width: 1px; background: var(--sess-line); }
.session__bar { flex: 1; height: 1.2rem; border-radius: 99px; background: var(--sess-card); overflow: hidden; border: 1px solid var(--sess-line); }
.session__bar span { display: block; height: 100%; border-radius: inherit; background: var(--blue); transition: width 0.25s ease; }
.session__count { min-width: 2.6rem; color: var(--muted); font-size: 1.2rem; font-variant-numeric: tabular-nums; text-align: right; }
.session > .session__prog { border-bottom: 0; }
.session__body { flex: 1; overflow-y: auto; border-top: 1px solid var(--sess-line); padding: 1.1rem 1.1rem calc(8rem + env(safe-area-inset-bottom)); }
.session__body > * { max-width: 40rem; margin-inline: auto; }
.session__body > .wex + .wex { margin-top: 1.1rem; }
.wex { padding: 1.1rem; border: 1.5px solid var(--sess-line); border-radius: 1.7rem; background: var(--sess-card); }
.wex__head { display: flex; align-items: center; gap: 1rem; }
.wex__tile { display: grid; place-items: center; flex: none; width: 4.4rem; height: 4.4rem; border-radius: 1.1rem; background: var(--sess-tile); color: var(--sess-tile-ink); }
.wex__tile svg { width: 2.2rem; height: 2.2rem; }
.wex__title { flex: 1; min-width: 0; }
.wex__title h2 { font-size: 1.35rem; font-weight: 500; line-height: 1.2; color: var(--blue-text); }
.wex__title p { margin-top: 0.4rem; color: var(--muted); font-size: 1.05rem; }
.wex__icon { display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.8rem; padding: 0; border: 0; border-radius: 0.8rem; background: none; color: var(--text); cursor: pointer; }
.wex__icon svg { width: 1.6rem; height: 1.6rem; }
.wex__chev svg { transition: transform 0.15s; }
.wex__chev.is-shut svg { transform: rotate(180deg); }
.wex.is-shut { padding-block: 0.9rem; }
.wex__sum { margin: 0.5rem 0 0 5.4rem; color: var(--muted); font-size: var(--fs-sm); }
.wex__notes { margin-top: 1.1rem; padding-left: 0.4rem; }
.wex__notes label { display: flex; align-items: center; gap: 0.9rem; color: var(--text); font-size: 1.05rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.wex__notes label svg { width: 1.5rem; height: 1.5rem; }
.wex__notes input { width: 100%; margin-top: 0.5rem; padding: 0.35rem 0 0.35rem 2.4rem; border: 0; background: none; color: var(--text); font-size: 1.1rem; box-shadow: none; }
.wex__notes input::placeholder { color: var(--faint); }
.wex__notes input:focus { box-shadow: none; }
.wsets { display: grid; gap: 0.9rem; margin-top: 1.3rem; }
.wset { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) 4.6rem 4.6rem 3.2rem; gap: 0.6rem; align-items: center; justify-items: center; }
.wset--head { color: var(--text); font-size: 1rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 0.2rem; }
.wset__n { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 0.7rem; background: var(--sess-field); font-size: 1.15rem; font-weight: 700; }
.wset__prev { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--faint); font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; }
.dot--good { background: var(--good); }
.dot--mid { background: var(--amber); }
.dot--low { background: var(--ember); }
.wset__in { width: 100%; height: 3.4rem; padding: 0; border: 0; border-radius: 0.9rem; background: var(--sess-field); color: var(--text); text-align: center; font-size: 1.6rem; -moz-appearance: textfield; }
.wset__in::-webkit-outer-spin-button, .wset__in::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.wset__in::placeholder { color: var(--faint); opacity: 1; }
.wset__in.is-done { color: var(--good); }
.wset__in:focus { box-shadow: 0 0 0 2px var(--blue-text); }
.wset__tick { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; padding: 0; border: 2.5px solid var(--text); border-radius: 50%; background: none; color: transparent; cursor: pointer; }
.wset__tick svg { width: 1.5rem; height: 1.5rem; }
.wset__tick.is-done { border-color: var(--good); background: var(--good); color: var(--on-good); }
.wset.is-done .wset__n { background: var(--good-bg); color: var(--good); }
.wex__foot { display: flex; gap: 0.9rem; margin-top: 1.3rem; padding-top: 1.3rem; border-top: 1px solid var(--sess-line); }
.wbtn { display: inline-flex; align-items: center; justify-content: center; gap: 0.9rem; flex: 1; min-height: 3.6rem; padding: 0 0.8rem; border: 0; border-radius: 1.1rem; background: var(--sess-field); color: var(--text); font-size: 1.15rem; font-weight: 500; cursor: pointer; }
.wbtn svg { width: 1.5rem; height: 1.5rem; flex: none; }
.wbtn:disabled { opacity: 0.35; cursor: default; }
.session__discard { text-align: center; padding: 1.2rem 0 0.5rem; }
.restbar { position: absolute; left: 0; right: 0; bottom: 0; overflow: hidden; padding: 0 1.1rem calc(0.8rem + env(safe-area-inset-bottom)); background: var(--sess-card); border-top: 1.5px solid var(--blue); }
.restbar[hidden] { display: none; }
.restbar__fill { position: absolute; left: 0; top: 0; height: 100%; background: var(--navy); transition: width 0.5s linear; z-index: 0; }
.restbar__row { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 40rem; margin: 0 auto; padding-top: 0.8rem; }
.restbar__label { color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.08em; }
.restbar__time { font-size: 2.2rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.restbar__btns { display: flex; gap: 0.5rem; }
.restbar__btns button { min-height: 2.9rem; padding: 0 1rem; border: 1px solid var(--sess-line); border-radius: 0.9rem; background: var(--sess-field); color: var(--text); font-weight: 500; cursor: pointer; }
.restbar.is-go { background: var(--good-bg); border-top-color: var(--good); }
.restbar.is-go .restbar__fill { background: transparent; }
.restbar.is-go .restbar__time { color: var(--good); }
.restpick { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chipbtn { min-height: 2.6rem; padding: 0 1rem; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel-2); color: var(--text); cursor: pointer; }
.chipbtn.is-on { border-color: var(--blue-text); color: var(--blue-text); }
.menulist { display: grid; gap: 0.5rem; }
.menuitem { min-height: 3rem; padding: 0 1rem; border: 1px solid var(--line-2); border-radius: 0.8rem; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; }
.menuitem.is-danger { color: var(--bad); }
.wsum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
.wsum strong { display: block; font-size: 1.4rem; }
.wicon { display: contents; }
@media (max-width: 26em) {
  .session__title h1 { font-size: 1.8rem; }
  .session__finish { padding: 0 0.9rem; min-height: 3rem; font-size: 1.05rem; }
  .session__time { min-width: 6.2rem; font-size: 1.05rem; }
  .wset { grid-template-columns: 2.3rem minmax(0, 1fr) 4rem 4rem 2.9rem; gap: 0.4rem; }
  .wset__n { width: 2.3rem; height: 2.3rem; }
  .wset__in { height: 3.1rem; font-size: 1.4rem; }
  .wset__tick { width: 2.9rem; height: 2.9rem; }
  .wset__prev { font-size: 0.95rem; gap: 0.35rem; }
  .wset--head { font-size: 0.85rem; letter-spacing: 0.03em; }
  .wex__tile { width: 3.8rem; height: 3.8rem; }
  .wex__sum { margin-left: 4.8rem; }
}

/* ---------- Workout page: schedule, create, members ---------- */
.wk { max-width: 40rem; margin: 0 auto; }
.wkhead { display: flex; align-items: center; gap: 1rem; margin: 0.25rem 0 1.1rem; }
.wkhead__icon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; color: var(--blue-text); }
.wkhead__icon svg { width: 2rem; height: 2rem; }
.wkhead h1 { font-size: 1.6rem; font-weight: 500; line-height: 1.15; }
.wkhead p { font-size: 1.05rem; }
.wktabs { margin-bottom: 1.25rem; }
.wkhero { display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem; min-height: 11rem; padding: 1.4rem; border-radius: 1.9rem; background: var(--navy); }
.wkhero.is-rest { background: var(--panel-2); }
.wkhero__kicker { color: var(--blue-text); font-size: 1.1rem; }
.wkhero h2 { font-size: 1.7rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; max-width: 16rem; }
.wkhero__text { color: var(--muted); }
.wkhero .button { margin-top: auto; }
.wksec { display: flex; align-items: center; justify-content: space-between; margin: 2rem 0 1rem; }
.wksec h2 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.01em; }
.wkicon { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; padding: 0; border: 0; border-radius: 0.8rem; background: none; color: var(--text); cursor: pointer; }
.wkicon svg { width: 1.5rem; height: 1.5rem; }
.wklist { display: grid; gap: 1.1rem; }
.wkrow { display: grid; grid-template-columns: 3rem minmax(0, 1fr); align-items: start; gap: 0.5rem; }
.wkrow__day { color: var(--text); font-size: 0.95rem; font-weight: 600; letter-spacing: 0.04em; padding-top: 1.7rem; }
.wkrow.is-today .wkrow__day { color: var(--blue-text); }
.wkcard { display: flex; align-items: center; gap: 0.5rem; min-height: 5.6rem; padding: 0.5rem 0.4rem 0.5rem 0.6rem; border: 1.5px solid var(--line-2); border-radius: 1.5rem; background: var(--panel); }
.wkcard__main { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; cursor: pointer; }
.wkcard__tile { display: grid; place-items: center; flex: none; width: 3.6rem; height: 3.6rem; border: 1.5px solid currentColor; border-radius: 1rem; }
.wkcard__tile svg { width: 1.8rem; height: 1.8rem; }
.wkcard__body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.wkcard__status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; }
.wkcard__status svg { width: 1.1rem; height: 1.1rem; }
.wkcard__name { font-size: 1.35rem; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wkcard__meta { color: var(--faint); font-size: var(--fs-sm); }
.wkcard--missed { border-color: color-mix(in srgb, var(--ember) 45%, var(--line-2)); color: var(--ember); }
.wkcard--today { border-color: var(--blue-text); color: var(--blue-text); }
.wkcard--done { border-color: var(--good-line); color: var(--good); }
.wkcard--upcoming { color: var(--muted); }
.wkcard--rest { color: var(--faint); border-style: solid; }
.wkcard--rest .wkcard__body { flex: 1; flex-direction: row; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.wkcard__rest { font-size: 1.35rem; }
.wkadd { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0; border: 0; background: none; color: var(--blue-text); font-size: 1.25rem; font-weight: 500; cursor: pointer; }
.wkadd__plus { display: grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--blue); color: #fff; font-size: 1.3rem; line-height: 1; }
.wkview__top { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1.1rem; }
.wkview__top h1 { font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.wkback { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; flex: none; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.wkback svg { width: 1.7rem; height: 1.7rem; }
.kindgrid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.kindbtn { display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; padding: 1rem; border: 1.5px dashed var(--line-3); border-radius: 1.2rem; background: var(--panel); color: var(--text); text-align: left; cursor: pointer; }
.kindbtn:hover { border-color: var(--blue-text); }
.mlist { display: grid; gap: 0.8rem; }
.mcard { display: grid; gap: 0.55rem; padding: 1rem; border: 1px solid var(--line-2); border-radius: 1.2rem; background: var(--panel); }
.mcard__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.mcard h3 { font-size: 1.1rem; font-weight: 600; }
.mcard__note { color: var(--muted); font-size: var(--fs-sm); }
.mcard__acts { display: flex; flex-wrap: wrap; align-items: start; gap: 0.5rem; }
.mfilters { display: grid; gap: 0.7rem; margin-bottom: 1rem; }
.stdbox { margin-bottom: 0.8rem; border: 1px solid var(--line); border-radius: 1.1rem; background: var(--panel); }
.stdbox > summary { padding: 0.9rem 1rem; cursor: pointer; font-weight: 600; }
.stdbox > .mlist { padding: 0 0.8rem 0.8rem; }
.radios { display: grid; gap: 0.5rem; margin: 0.75rem 0; }

/* dialogs and pickers */
.wdlg { width: min(32rem, calc(100vw - 1.5rem)); }
.wdlg--wide { width: min(38rem, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem); overflow-y: auto; }
.picker { display: grid; gap: 0.6rem; }
.pick-head { margin-top: 0.6rem; font-size: var(--fs-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pick-list { display: grid; gap: 0.4rem; }
.pick { display: grid; grid-template-columns: 1fr auto; gap: 0.1rem 0.75rem; width: 100%; padding: 0.7rem 0.9rem; border: 1px solid var(--line-2); border-radius: 0.8rem; background: var(--panel-2); color: var(--text); text-align: left; cursor: pointer; }
.pick__name { font-weight: 500; }
.pick__note { grid-column: 1; color: var(--muted); font-size: var(--fs-sm); }
.pick__tick { grid-row: 1 / 3; grid-column: 2; align-self: center; width: 1.4rem; text-align: center; color: var(--on-good); }
.pick.is-on { border-color: var(--good); }
.pick.is-on .pick__tick { border-radius: 50%; background: var(--good); }
.pick-search { width: 100%; }
.pick-custom { display: flex; gap: 0.5rem; }
.pick-custom input { flex: 1; min-width: 0; }

/* editors */
.exrows { display: grid; gap: 0.7rem; margin: 0.8rem 0; }
.exrow { padding: 0.7rem; border: 1px solid var(--line); border-radius: 0.9rem; background: var(--panel-2); }
.exrow__top { display: flex; align-items: center; gap: 0.2rem; }
.exrow__name { flex: 1; min-width: 0; font-weight: 500; }
.exrow__fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; margin-top: 0.55rem; }
.exrow__fields label { display: grid; gap: 0.2rem; color: var(--muted); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.05em; }
.exrow__fields input, .exrow__fields select { width: 100%; min-width: 0; }
.dayed .field { margin-bottom: 0.4rem; }
.wk-day { border: 1px solid var(--line); border-radius: 1rem; background: var(--panel); margin-bottom: 0.6rem; }
.wk-day.is-rest .wk-day__name { color: var(--faint); }
.wk-day__head { display: flex; align-items: center; gap: 0.8rem; width: 100%; padding: 0.8rem 0.9rem; border: 0; background: none; color: var(--text); text-align: left; cursor: pointer; }
.wk-day__abbr { width: 2.6rem; font-size: var(--fs-sm); font-weight: 600; letter-spacing: 0.04em; color: var(--blue-text); }
.wk-day__name { flex: 1; min-width: 0; }
.wk-day__meta { color: var(--faint); font-size: var(--fs-sm); }
.wk-day__head svg { width: 1.2rem; height: 1.2rem; }
.wk-day__body { padding: 0 0.9rem 0.9rem; }
.weektabs { display: flex; gap: 0.4rem; overflow-x: auto; padding: 0.6rem 0; scrollbar-width: thin; }
.weektabs button { flex: none; min-height: 2.4rem; padding: 0 0.9rem; border: 1px solid var(--line-2); border-radius: 99px; background: var(--panel-2); color: var(--text); cursor: pointer; }
.weektabs button[aria-selected="true"] { border-color: var(--blue-text); color: var(--blue-text); }
.weektabs button.is-empty { opacity: 0.6; }
.weektabs__add svg { width: 1rem; height: 1rem; }
.proged__tools { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-bottom: 0.5rem; }
.proged__title { margin: 0.8rem 0 0.6rem; font-size: 1.1rem; }
.desc-ex { display: grid; gap: 0.3rem; margin: 0.4rem 0; }
.desc-ex li { display: flex; justify-content: space-between; gap: 1rem; font-size: var(--fs-sm); }
.desc-week, .desc-prog { margin-top: 0.4rem; }
.desc-week details, .desc-prog { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.desc-week summary, .desc-prog > summary { cursor: pointer; }
.desc-rest { padding: 0.4rem 0; color: var(--faint); border-bottom: 1px solid var(--line); }

.invite { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; border: 1px dashed var(--line-3); border-radius: 1rem; background: var(--panel-2); }
.invite__code { display: block; margin-top: 0.15rem; font-size: 1.8rem; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.invite__code.is-off { color: var(--faint); text-decoration: line-through; }
.dayed .button, .picker .button, .proged__tools .button, .mcard__acts .button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; white-space: nowrap; }
.dayed .button svg { width: 1rem; height: 1rem; }

/* dragging days around the schedule */
.wkgrip { display: grid; place-items: center; flex: none; width: 1.7rem; align-self: stretch; margin-right: -0.2rem; padding: 0; border: 0; border-radius: 0.6rem; background: none; color: var(--faint); font-size: 1.1rem; letter-spacing: -0.15em; line-height: 1; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.wkgrip:hover, .wkgrip:focus-visible { color: var(--text); }
.wkgrip span { display: block; transform: rotate(90deg); white-space: nowrap; }
.wklist.is-dragging { user-select: none; -webkit-user-select: none; }
.wkrow.is-lifted { opacity: 0.35; }
.wkrow.is-target .wkcard { border-color: var(--blue-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-text) 30%, transparent); }
.wkghost { position: fixed; z-index: 80; margin: 0; list-style: none; pointer-events: none; opacity: 0.95; transform: scale(1.02); filter: drop-shadow(0 0.8rem 1.2rem var(--shadow)); }
.wkghost .wkcard { background: var(--panel-2); }
html.is-dragging-day, html.is-dragging-day body { cursor: grabbing; overscroll-behavior: contain; }

/* Dashboard: Weekly Nutrition */
.wn { margin-bottom: 1rem; padding: clamp(1.1rem, 3vw, 1.75rem); border-radius: 1.4rem; }
.wn__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.wn__head h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.1rem); font-weight: 700; letter-spacing: -0.02em; }
.wn__log { color: var(--blue-text); font-size: var(--fs-sm); font-weight: 500; text-decoration: none; }
.wn__sub { margin: 0.2rem 0 1.1rem; color: var(--muted); }
.wn__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(7rem, 9.5rem); gap: 1rem 1.25rem; align-items: stretch; }
.wn__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0.25rem; }
.wn__col { display: flex; flex-direction: column; gap: 0.5rem; padding: 0.3rem 0.2rem 0.4rem; border: 2px solid transparent; border-radius: 0.9rem; background: none; color: var(--muted); cursor: pointer; font: inherit; }
.wn__col:disabled { cursor: default; }
.wn__col.is-sel { border-color: var(--text); color: var(--text); }
.wn__col.is-today .wn__day { color: var(--text); font-weight: 700; }
.wn__cell { position: relative; display: flex; align-items: flex-end; justify-content: center; height: clamp(2.8rem, 9vw, 3.6rem); padding: 0.45rem 0 0.4rem; border-radius: 0.5rem; background: var(--track-2); }
.wn__cell.is-future { background: var(--track); }
.wn__bar { position: relative; display: block; width: 0.5rem; min-height: 0.2rem; border-radius: 99px; background: var(--c); transition: height 0.25s ease; }
.wn__cell.is-future .wn__bar, .wn__cell.is-empty .wn__bar { background: var(--faint); opacity: 0.55; }
.wn__bar::before { content: ""; position: absolute; left: -0.1rem; right: -0.1rem; top: -0.18rem; height: 0.2rem; border-radius: 99px; background: var(--text); }
.wn__bar.is-over { background: var(--warn); }
.wn__day { margin-top: 0.15rem; text-align: center; font-size: 1.05rem; }
.wn__vals { display: grid; grid-template-rows: repeat(4, 1fr); padding-top: 0.3rem; padding-bottom: 2.1rem; }
.wn__val { display: flex; flex-direction: column; justify-content: center; line-height: 1.15; border-bottom: 1px solid var(--line); padding-bottom: 0.2rem; }
.wn__val:last-child { border-bottom: 0; }
.wn__big { display: inline-flex; align-items: center; gap: 0.15rem; font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); font-weight: 500; font-variant-numeric: tabular-nums; }
.wn__flame { display: inline-grid; width: 1.35rem; height: 1.35rem; margin-left: 0.2rem; color: var(--ember); }
.wn__unit { font-size: 0.8em; font-weight: 600; }
.wn__of { color: var(--muted); font-size: var(--fs-sm); }
.wn__toggle { grid-column: 1 / -1; display: flex; width: fit-content; margin: 1.1rem auto 0; padding: 0.2rem; border-radius: 99px; background: var(--panel-2); }
.wn__toggle button { min-height: 2.6rem; padding: 0 1.4rem; border: 0; border-radius: 99px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.wn__toggle button[aria-selected="true"] { background: var(--text); color: var(--bg); font-weight: 500; }
.wn > .wn__toggle { margin-top: 1.1rem; }
@media (min-width: 56em) { .wn__grid { gap: 0.5rem; } .wn__col { padding-inline: 0.35rem; } .wn__bar { width: 0.6rem; } }

/* Dashboard tiles */
.dash { display: grid; gap: 1.25rem; max-width: 40rem; margin-inline: auto; }
.dash .wn { margin-bottom: 0; }
.inssec { margin-bottom: 1.5rem; }
.inssec__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.inssec__head h2 { font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2rem); font-weight: 700; letter-spacing: -0.02em; }
.inssec__head a { color: var(--text); font-size: 1.05rem; text-decoration: underline; text-underline-offset: 3px; }
.insgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.ins { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; padding: 1.1rem 1.1rem 0.9rem; border: 0; border-radius: 1.5rem; background: var(--panel); color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.ins:hover { background: var(--panel-2); }
.ins__title { font-size: 1.3rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins__sub { color: var(--muted); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins__art { display: block; flex: 1; min-height: 3.6rem; margin: 0.7rem 0 0.8rem; }
.ins__spark svg { width: 100%; height: 3.6rem; }
.ins__meterwrap { display: flex; align-items: center; }
.ins__meter { display: block; width: 100%; height: 0.65rem; border-radius: 99px; background: var(--track-2); overflow: hidden; }
.ins__meter > span { display: block; height: 100%; border-radius: inherit; }
.ins__habit .habit { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 0.2rem; }
.habit i { display: block; aspect-ratio: 1; border-radius: 0.25rem; background: var(--track-2); }
.ins__foot { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding-top: 0.7rem; border-top: 1px solid var(--line-2); }
.ins__value { min-width: 0; font-size: 1.9rem; line-height: 1.1; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins__value small { color: var(--muted); font-size: 0.95rem; font-weight: 400; }
.ins__chev { display: inline-grid; flex: none; width: 1.4rem; height: 1.4rem; color: var(--muted); }
.ins__chev svg { width: 100%; height: 100%; }
.ins__value { white-space: normal; overflow: visible; text-overflow: clip; font-size: 1.7rem; }
.ins__value small { display: block; margin-top: 0.1rem; font-size: 0.9rem; line-height: 1.2; }
.dash > #review:empty { display: none; }
.dash .reviewbar { margin-bottom: 0; }
.reviewbar__targets { margin-top: 0.8rem; display: grid; gap: 0.5rem; }
.reviewbar__targets .plan__cell { display: grid; gap: 0.1rem; }
.reviewbar__same { opacity: 0.6; }
.nav__short { display: none; }
@media (max-width: 56em) { .nav__full { display: none; } .nav__short { display: inline; } }
/* access + admin */
.nav a.nav__admin { display: none; }
@media (min-width: 56.01em) { .nav a.nav__admin { display: flex; } }
.accessrow { display: grid; gap: 0.4rem; padding: 0.9rem 0; border-top: 1px solid var(--line-2); justify-items: start; }
.accessrow:first-of-type { border-top: 0; padding-top: 0; }
.accessrow__top { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.accessrow .form-actions { width: 100%; margin-top: 0; }
.adminbar { display: grid; gap: 0.8rem; margin-bottom: 0.8rem; }
.adminlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.8rem; }
.adminrow { display: grid; gap: 0.7rem; padding: 1rem; border-radius: 1rem; background: var(--panel-2); }
.adminrow__who { display: grid; gap: 0.15rem; }
.adminrow__feat { display: flex; gap: 0.8rem; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; padding-top: 0.7rem; border-top: 1px solid var(--line-2); }
.adminrow__acts { display: flex; gap: 0.6rem; align-items: center; }
.adminrow__msg { margin: 0.4rem 0 0; font-style: italic; color: var(--muted); }
.adminpage { max-width: 46rem; }
/* two-step sign-in */
.qrbox { display: inline-block; margin: 0.6rem 0; padding: 0.5rem; border-radius: 0.8rem; background: #fff; line-height: 0; }
.qrbox svg { display: block; width: min(15rem, 70vw); height: auto; }
.tfkey { font-size: 1.05rem; letter-spacing: 0.06em; word-break: break-all; }
.recovery { list-style: none; margin: 0.8rem 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.4rem 1rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; }
.recovery li { padding: 0.45rem 0.6rem; border-radius: 0.6rem; background: var(--panel-2); text-align: center; letter-spacing: 0.05em; }

/* Eight items fit the bottom bar on a phone: smaller labels, tighter padding. */
@media (max-width: 56em) {
  .nav a { padding: 0.5rem 0.05rem; font-size: 0.62rem; min-width: 0; }
  .nav a svg { width: 1.2rem; height: 1.2rem; }
}

/* Recipe Book */
.rbpage { display: grid; gap: var(--pad); }
.rbimport textarea { width: 100%; resize: vertical; }
.rbtools { display: grid; grid-template-columns: 1fr auto; gap: 0.75rem; margin-bottom: 0.9rem; }
.rbgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.rbcard { display: grid; gap: 0.3rem; align-content: start; padding: 0.9rem 1rem; text-align: left; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; }
.rbcard:hover { border-color: var(--blue); }
.rbcard__title { font-weight: 600; }
.rbcard__macros { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.rbcard__tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.2rem; }
.rbempty { grid-column: 1 / -1; padding: 1rem 0; }
.rbdetail { display: grid; gap: var(--pad); }
.rbtitle { font-size: var(--fs-lg, 1.4rem); margin-bottom: 0.4rem; }
.rbings, .rbsteps { margin: 0; padding: 0; }
.rbsteps { list-style: decimal; }
.rbings { list-style: none; display: grid; gap: 0.1rem; }
.rbings li { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.rbings li:last-child { border-bottom: 0; }
.rbings--edit li { flex-wrap: wrap; }
.rbings__text { flex: 1 1 12rem; min-width: 0; }
.rbings__g { display: flex; align-items: center; gap: 0.3rem; }
.rbings__g input { width: 5.5rem; }
.rbsteps { padding-left: 1.3rem; display: grid; gap: 0.6rem; }
.rbcook .nutri { margin: 0.75rem 0; }

/* Challenges */
.chpage { display: grid; gap: var(--pad); }
.chsoon { display: grid; justify-items: center; gap: 0.6rem; padding: 2.5rem var(--pad); text-align: center; }
.chsoon p { max-width: 34rem; }
.chicon { display: inline-grid; place-items: center; color: var(--blue-text); }
.chicon svg { width: 1.4rem; height: 1.4rem; }
.chicon--big svg { width: 2.4rem; height: 2.4rem; }
.chbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.chbar__right { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.chcard { display: grid; gap: 0.6rem; padding: var(--pad); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.chcard__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.chcard__chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chprog .meter { height: 0.5rem; }
.chcode { font-size: 1.1rem; letter-spacing: 0.12em; }
.chboard { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.25rem; }
.chboard li { display: grid; grid-template-columns: 3.2rem 1fr auto; gap: 0.5rem; padding: 0.4rem 0.6rem; border-radius: 0.5rem; background: var(--panel-2); }
.chboard li.is-me { box-shadow: inset 0 0 0 1px var(--blue-line); }
.chboard__place { color: var(--muted); font-variant-numeric: tabular-nums; }
.chjoin { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.25rem; }
.chjoin input { width: 11rem; text-transform: uppercase; }
.chcab { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 0.75rem; }
.chcab li { display: grid; justify-items: center; gap: 0.3rem; padding: 1rem 0.6rem; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); text-align: center; }
.chcab li.is-gold .chicon { color: #e6b422; }
.chcab li.is-silver .chicon { color: #a8b0ba; }
.chcab li.is-bronze .chicon { color: #c27a3e; }
@media (max-width: 40em) { .rbtools { grid-template-columns: 1fr; } .nutri { grid-template-columns: repeat(2, 1fr); } }

.rbshotbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.5rem 0; }
.rbshotbar .is-disabled { opacity: 0.5; pointer-events: none; }
.rbshots { list-style: none; margin: 0.5rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.rbshots li { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.rbshots img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line, #ccc); }

.mealdlg { width: min(34rem, calc(100vw - 1.5rem)); }
.mealshot { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.mealshot img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.mealitems { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.5rem; }
.mealitem { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); }
.mealitem__name { display: flex; gap: 0.5rem; align-items: center; flex: 1 1 12rem; min-width: 0; }
.mealitem__amt { display: flex; align-items: center; gap: 0.35rem; }
.mealitem__amt input { width: 5.5rem; }
.mealitem__kcal { min-width: 5rem; text-align: right; }
.mealitem .tag { color: var(--muted); }
.mealtotals { margin: 0.75rem 0; }

/* ---- recipe book: two columns, covers, customiser ---- */
.rbcols { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 62rem) { .rbcols { grid-template-columns: minmax(0, 1fr) 22rem; } .rbside { position: sticky; top: 1rem; } }
.rbmain { display: grid; gap: 1.25rem; min-width: 0; }
.bookcover { --bk-bg: #17181c; --bk-ink: #d4af37; container-type: inline-size; position: relative; flex: none; aspect-ratio: 3 / 4; width: 100%; box-sizing: border-box;
  display: block; padding: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.07), rgba(0,0,0,.18)), var(--bk-bg); color: var(--bk-ink);
  border-radius: 3px 9px 9px 3px; box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 8px 18px rgba(0,0,0,.35), 2px 0 0 rgba(0,0,0,.25) inset; }
.bookcover::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 7%; background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.1) 55%, rgba(0,0,0,.08)); border-radius: 3px 0 0 3px; }
.bookcover__frame { position: absolute; inset: 6% 6% 6% 12%; border: 1px solid color-mix(in srgb, var(--bk-ink) 70%, transparent); border-radius: 2px; pointer-events: none; }
.bookcover__frame::after { content: ""; position: absolute; inset: 3px; border: 1px solid color-mix(in srgb, var(--bk-ink) 30%, transparent); }
.bookcover__body { position: absolute; inset: 14% 10% 16% 17%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.bookcover__title { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: 0.02em; line-height: 1.12; font-size: 10.5cqw; overflow-wrap: anywhere; text-shadow: 0 1px 0 rgba(0,0,0,.35); }
.bookcover.is-mid .bookcover__title { font-size: 8.5cqw; }
.bookcover.is-long .bookcover__title { font-size: 7cqw; }
.bookcover__rule { display: block; width: 30%; height: 1px; margin: 6cqw 0 0; background: var(--bk-ink); opacity: .8; }
.bookcover__owner { position: absolute; left: 17%; right: 10%; bottom: 8.5%; text-align: center; font-size: 4.2cqw; letter-spacing: .12em; text-transform: uppercase; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bookcover--s { width: 8rem; } .bookcover--m { width: 11rem; }
.rbmine__row { display: flex; gap: 1rem; align-items: center; }
.rbmine__info { display: grid; gap: 0.35rem; justify-items: start; min-width: 0; }
.rbmine__info h2 { margin: 0; overflow-wrap: anywhere; }
.rbmine__info p { margin: 0; }
.rbcust { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line, rgba(128,128,128,.25)); display: grid; gap: 1rem; }
.rbcust__grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr) 9.5rem; align-items: start; }
.rbcust__prev .bookcover { width: 100%; }
@media (max-width: 34rem) { .rbcust__grid { grid-template-columns: 1fr; } .rbcust__prev { width: 9rem; order: -1; } }
.swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.swatchrow { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.swatch { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 2px solid transparent; outline: 1px solid rgba(128,128,128,.5); cursor: pointer; padding: 0; }
.swatch.is-on { border-color: var(--bg, #fff); outline: 2px solid var(--accent, #3b82f6); }
.swatchpick { font-size: var(--fs-sm); color: var(--muted); }
.rbcust input[type="color"] { width: 2.4rem; height: 2.1rem; padding: 0; border: 0; background: none; }
.rbshare { display: flex; gap: 0.75rem; align-items: flex-start; cursor: pointer; }
.rbshare input { margin-top: 0.3rem; flex: none; }
.rbshare span { display: grid; gap: 0.15rem; }
.rbbks { display: grid; gap: 0.75rem; margin-top: 0.75rem; }
.rbbk { display: flex; gap: 0.85rem; align-items: center; text-align: left; padding: 0.6rem; border-radius: 0.8rem; border: 1px solid var(--line, rgba(128,128,128,.25)); background: transparent; color: inherit; cursor: pointer; font: inherit; }
.rbbk:hover, .rbbk:focus-visible { border-color: var(--accent, #3b82f6); }
.rbbk .bookcover--s { width: 6.5rem; }
.rbbk__meta { display: grid; gap: 0.15rem; justify-items: start; min-width: 0; }
.rbbk__meta strong { overflow-wrap: anywhere; }

/* ---- recipe book shelf, moving ---- */
.rbshelf__row { display: flex; flex-wrap: wrap; gap: 0.85rem; margin: 0.75rem 0; }
.rbtile { display: grid; gap: 0.45rem; justify-items: center; align-content: start; width: 8.75rem; padding: 0.55rem; border-radius: 0.8rem; border: 2px solid transparent; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.rbtile:hover, .rbtile:focus-visible { border-color: var(--line, rgba(128,128,128,.35)); }
.rbtile.is-on { border-color: var(--accent, #3b82f6); }
.rbtile.is-over { border-color: var(--good, #22c55e); background: var(--good-bg, rgba(34,197,94,.1)); }
body.rb-dragging .rbtile:not(.rbtile--new) { border-style: dashed; border-color: var(--line, rgba(128,128,128,.5)); }
body.rb-dragging .rbtile.is-over { border-style: solid; border-color: var(--good, #22c55e); }
.rbtile__meta { display: grid; gap: 0.2rem; justify-items: center; text-align: center; }
.rbtile--new { border: 2px dashed var(--line, rgba(128,128,128,.4)); align-content: center; min-height: 10.5rem; color: var(--muted); }
.rbtile--new:disabled { opacity: .5; cursor: not-allowed; }
.rbtile__plus { font-size: 2rem; line-height: 1; }
.rbcardwrap { display: grid; gap: 0.25rem; }
.rbcardwrap.is-dragging { opacity: .45; }
.rbcardwrap__foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; padding: 0 0.25rem; }
.movedlg { width: min(30rem, calc(100vw - 1.5rem)); }
.rbmoves { display: grid; gap: 0.6rem; margin: 0.75rem 0; max-height: 60vh; overflow: auto; }
.rbmove { display: flex; gap: 0.85rem; align-items: center; text-align: left; padding: 0.5rem; border-radius: 0.8rem; border: 1px solid var(--line, rgba(128,128,128,.3)); background: transparent; color: inherit; font: inherit; cursor: pointer; }
.rbmove:hover, .rbmove:focus-visible { border-color: var(--accent, #3b82f6); }
.rbmove .bookcover--s { width: 4.75rem; }

/* first-time setup guide: full-screen, one question per page */
dialog.wizard { position: fixed; inset: 0; box-sizing: border-box; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--bg); overflow-y: auto; overflow-x: hidden; }
dialog.wizard[open] { display: flex; flex-direction: column; align-items: center; }
.wizard__progress { width: 100%; box-sizing: border-box; flex: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 0.5rem; max-width: 34rem; margin: 0 auto; padding: 1rem 1rem 0; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.wizard__seg { display: grid; gap: 0.35rem; font-size: 0.68rem; color: var(--faint); font-weight: 600; }
.wizard__seg.is-on { color: var(--text); }
.wizard__track { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; }
.wizard__track i { display: block; height: 100%; width: 0; background: var(--blue); transition: width 0.3s ease; }
.wizard__col { width: 100%; box-sizing: border-box; max-width: 30rem; margin: auto; flex: none; padding: 1.25rem 1rem 2.5rem; display: grid; gap: 1rem; justify-items: stretch; }
.wizard__top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.wizard__back { justify-self: start; background: none; border: 0; color: var(--muted); font: inherit; font-size: var(--fs-sm); cursor: pointer; padding: 0.25rem 0; }
.wizard__back:hover { color: var(--text); }
.wizard__pill { padding: 0.3rem 0.9rem; border-radius: 999px; background: var(--navy); color: var(--blue-text); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.wizard__alert { margin: 0; padding: 0.4rem 0.8rem; background: var(--bad-bg); color: var(--bad); font-size: var(--fs-sm); border-radius: 0.4rem; }
.wizard h2 { text-align: center; font-size: clamp(1.6rem, 6vw, 2.1rem); line-height: 1.15; margin: 0.5rem 0 0; }
.wizard .hl { color: var(--blue-text); }
.wizard__sub { text-align: center; color: var(--muted); margin: 0; }
.wizard__body { display: grid; gap: 0.7rem; margin-top: 0.5rem; }
.wizard__choices { display: grid; gap: 0.7rem; }
.wizard__choice { display: flex; align-items: center; justify-content: center; gap: 0.7rem; padding: 1rem 1.1rem; border: 2px solid transparent; border-radius: 0.8rem; background: var(--panel-2); cursor: pointer; text-align: center; font-weight: 600; }
.wizard__choice:hover { background: var(--hover); }
.wizard__choice:has(input:checked) { border-color: var(--blue); background: var(--navy); }
.wizard__choice:has(input:focus-visible) { outline: 2px solid var(--blue-text); outline-offset: 2px; }
.wizard__choice input { position: absolute; opacity: 0; pointer-events: none; }
.wizard__choice b { font-size: 1.25rem; font-weight: 400; }
.wizard__choice span { display: grid; gap: 0.15rem; }
.wizard__choice small { color: var(--muted); font-size: var(--fs-sm); font-weight: 400; }
.wizard__num { display: grid; gap: 0.35rem; }
.wizard__num > div { display: flex; align-items: center; gap: 0.6rem; }
.wizard__num input { flex: 1; min-width: 0; font-size: 1.6rem; font-weight: 600; text-align: center; padding: 0.7rem; }
.wizard__num span { color: var(--muted); min-width: 2.2rem; }
.wizard__foot { display: grid; gap: 0.6rem; justify-items: center; margin-top: 0.75rem; }
.wizard__cta { width: 100%; padding: 0.95rem 1.2rem; border: 0; border-radius: 999px; background: var(--blue); color: #fff; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.wizard__cta:hover { background: var(--blue-deep); }
.wizard__cta:focus-visible { outline: 2px solid var(--blue-text); outline-offset: 3px; }
.wizard__load { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.7rem; }
.wizard__load li { padding: 0.9rem 1rem; border-radius: 0.8rem; background: var(--panel-2); opacity: 0; animation: wizin 0.4s ease forwards; }
.wizard__load li::before { content: "✓ "; color: var(--good); font-weight: 700; }
@keyframes wizin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wizard__load li { animation: none; opacity: 1; } .wizard__track i { transition: none; } }
html[data-theme="light"] .wizard__choice:has(input:checked) { background: #e8efff; }
html[data-theme="light"] .wizard__pill { background: #e8efff; }
.wizard .plan { grid-template-columns: repeat(2, 1fr); }
.button--danger { background: var(--bad); border-color: var(--bad); color: #1a0d09; }
.button--danger:hover:not(:disabled) { filter: brightness(1.1); }
.button--danger:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Phone pass ----------
   Sizes that must not blow up when a phone's text size is turned up use px or vw;
   the bottom bar keeps a fixed footprint so page content can be padded to clear it. */
@media (max-width: 56em) {
  /* 16px inputs: iOS zooms the page in on focus for anything smaller */
  input, select, textarea { font-size: max(16px, 1rem); }
  input[type="checkbox"], input[type="radio"] { font-size: inherit; }

  .nav a { padding: 0.45rem 0.05rem; font-size: 10px; line-height: 1.2; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; gap: 3px; }
  .nav a svg { width: 22px; height: 22px; }
  .sidebar { padding-inline: 0.25rem; }
  #main { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .site-footer { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  .topbar__sync { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .brand { flex: none; }
  .topbar__right { min-width: 0; }
}
/* very narrow phones: only the open tab keeps its label */
@media (max-width: 22.5em) {
  .nav a:not([aria-current="page"]) { font-size: 0; gap: 0; }
  .nav a:not([aria-current="page"]) svg { width: 24px; height: 24px; }
}

@media (max-width: 40em) {
  /* Weekly Nutrition: bars across the full width, the day's numbers in a 2x2 block below */
  .wn__head { flex-wrap: wrap; gap: 0.2rem 1rem; }
  .wn__head h2 { font-size: clamp(1.3rem, 6vw, 1.8rem); }
  .wn__log { white-space: nowrap; }
  .wn__body { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .wn__vals { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1rem; padding: 0; }
  .wn__val { padding: 0.55rem 0; }
  .wn__val:nth-last-child(-n+2) { border-bottom: 0; }
  .wn__big { font-size: clamp(1.3rem, 6.5vw, 1.8rem); flex-wrap: wrap; }
  .wn__day { font-size: 1rem; line-height: 1; }
  .wn__cell { height: clamp(2.6rem, 8vw, 3.2rem); }
  .wn__toggle { display: grid; grid-template-columns: 1fr 1fr; width: 100%; margin-top: 1rem; }
  .wn__toggle button { padding: 0 0.5rem; min-height: 2.75rem; }
  .insgrid { gap: 0.6rem; }
  .ins { padding: 1rem 0.9rem 0.8rem; border-radius: 1.25rem; }
  .ins__title { font-size: clamp(1.05rem, 4.8vw, 1.3rem); }
  .ins__value { font-size: clamp(1.35rem, 6vw, 1.7rem); overflow-wrap: anywhere; }
}

/* Dashboard: Daily Nutrition (gauge + macro bars) */
.dn__dial { position: relative; container-type: inline-size; width: min(100%, 18rem); margin: 0.25rem auto 0; }
.dn__gauge { display: block; }
.dn__gauge svg { display: block; width: 100%; height: auto; }
.dn__track { stroke: var(--track-2); }
.dn__fill { stroke: var(--c-kcal); transition: stroke-dasharray 0.3s ease; }
.dn__centre { position: absolute; left: 50%; top: 61.2%; width: 62%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.dn__big { font-size: 13cqw; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dn__cap { margin-top: 0.25rem; color: var(--muted); font-size: 0.9rem; }
.dn__sides { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.1rem; }
.dn__side { display: grid; line-height: 1.2; color: var(--muted); }
.dn__side strong { color: var(--text); font-size: clamp(1.2rem, 6vw, 1.6rem); font-weight: 600; font-variant-numeric: tabular-nums; }
.dn__side--r { text-align: right; }
.dn__macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin-top: 1.1rem; }
@media (max-width: 40em) { .dn__dial { width: min(100%, 15.5rem); } .dn__macros { gap: 0.5rem; margin-top: 0.9rem; } .dn__mlabel { font-size: 0.9rem; } }
.dn__macro { display: grid; gap: 0.45rem; text-align: center; min-width: 0; }
.dn__mlabel { color: var(--muted); }
.dn__bar { display: block; height: 0.5rem; border-radius: 99px; background: var(--track-2); overflow: hidden; }
.dn__bar i { display: block; height: 100%; border-radius: inherit; background: var(--c); transition: width 0.3s ease; }
.dn__mval { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: clamp(0.85rem, 3.8vw, 1rem); }

/* ---------- Companion ---------- */
.petart { display: block; }
.petart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.petart--sm { width: 7rem; height: 7rem; margin-inline: auto; }
.petart--lg { width: min(16rem, 62vw); height: min(16rem, 62vw); }
@keyframes petbob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4%); } }
@keyframes petbreathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.is-happy .petart, .is-proud .petart, .petcard__art.is-happy, .petcard__art.is-proud { animation: petbob 1.6s ease-in-out infinite; }
.is-proud .petart, .petcard__art.is-proud { animation-duration: 1s; }
.is-sleepy .petart, .petcard__art.is-sleepy { animation: petbreathe 3.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .is-happy .petart, .is-proud .petart, .is-sleepy .petart, .petcard__art { animation: none !important; } }
.petcard { display: flex; align-items: center; gap: 1rem; padding: 0.9rem 1rem; color: inherit; text-decoration: none; }
.petcard:hover { background: var(--panel-2); }
.petcard__art { flex: none; display: block; width: 4.6rem; height: 4.6rem; }
.petcard__art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.petcard__text { display: grid; gap: 0.25rem; min-width: 0; flex: 1; }
.petcard__lv { color: var(--blue-text); font-weight: 600; }
.petcard__egg { display: grid; place-items: center; flex: none; width: 3.6rem; height: 3.6rem; border-radius: 50%; border: 2px dashed var(--line-3); color: var(--muted); font-size: 1.6rem; font-weight: 700; }
.petxp { display: block; height: 0.5rem; border-radius: 99px; background: var(--track-2); overflow: hidden; }
.petxp i { display: block; height: 100%; border-radius: inherit; background: var(--c-carbs); transition: width 0.4s ease; }
.petxp--lg { height: 0.75rem; }
.petpage { display: grid; gap: var(--pad); max-width: 46rem; }
.petpicks { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.75rem; }
.petpick { display: grid; justify-items: center; gap: 0.35rem; padding: 0.9rem; border: 2px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); color: var(--text); font: inherit; text-align: center; cursor: pointer; }
.petpick:hover { border-color: var(--blue-text); }
.petpick.is-on { border-color: var(--blue-text); box-shadow: 0 0 0 2px var(--blue-text); }
.petadopt { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem; margin-top: 1rem; }
.petadopt .field { flex: 1 1 12rem; }
.petview { display: grid; justify-items: center; gap: 1rem; text-align: center; }
.petview__stage { display: grid; place-items: center; padding: 1rem; border-radius: var(--radius); background: var(--panel-2); width: 100%; }
.petview__info { display: grid; gap: 0.6rem; width: 100%; justify-items: center; }
.petview__name { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; }
.petlv { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0.6rem; }
.petview .petxp { width: 100%; }
.petrename { display: flex; gap: 0.5rem; width: min(100%, 20rem); }
.petstats { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.petstat { display: grid; gap: 0.3rem; }
.petstat__top { display: flex; justify-content: space-between; }
.petways { list-style: none; display: grid; gap: 0.4rem; margin: 0; padding: 0; }
.petways strong { display: inline-block; min-width: 4.4rem; color: var(--c-carbs); }
@media (min-width: 40em) { .petview { grid-template-columns: auto 1fr; text-align: left; align-items: center; } .petview__info { justify-items: start; } .petview__name, .petlv { justify-content: flex-start; } }
.petwild { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.75rem; }
.petmon { display: grid; justify-items: center; gap: 0.35rem; padding: 0.8rem 0.6rem; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--panel-2); text-align: center; min-width: 0; }
.petmon .petxp { width: 100%; }
.petlocked p { margin: 0; }
.petdex { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.2rem, 1fr)); gap: 0.35rem; }
.petdex__cell { display: block; padding: 0.15rem; border-radius: 0.5rem; background: var(--panel-2); }
.petdex__art { width: 100%; aspect-ratio: 1; }
.petdex__cell:not(.is-owned) .petdex__art { filter: brightness(0); opacity: 0.35; }
.petpicks--wiz { grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); }
.petmon__acts { display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; }
.petmon.is-rest .petart { opacity: 0.7; }
.petmon.is-party { border-color: var(--blue-line); }

/* Reference videos */
.vidbtn { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.65rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); color: var(--text); font: inherit; font-size: var(--fs-xs); font-weight: 600; cursor: pointer; min-height: 2rem; }
.vidbtn svg { width: 0.9rem; height: 0.9rem; flex: none; }
.vidbtn:hover { border-color: var(--blue-line); color: var(--blue-text); }
.vidbtn--icon { min-width: 2.25rem; min-height: 2.25rem; padding: 0.3rem; justify-content: center; border-radius: 0.6rem; }
.vidbtn--icon span:empty { display: none; }
.pickrow { display: flex; gap: 0.4rem; align-items: stretch; }
.pickrow .pick { flex: 1; min-width: 0; }
.pickrow .vidbtn--icon { align-self: center; flex: none; }
dialog.vid { width: min(40rem, 94vw); max-width: none; padding: 0.9rem; border: 1px solid var(--line-2); border-radius: 1rem; background: var(--panel); color: var(--text); }
dialog.vid::backdrop { background: rgba(0, 0, 0, 0.7); }
.vid__head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.6rem; }
.vid__frame { position: relative; aspect-ratio: 16 / 9; border-radius: 0.6rem; overflow: hidden; background: #000; }
.vid__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Exercise page */
dialog.exd { position: fixed; inset: 0; width: 100%; max-width: 40rem; height: 100dvh; max-height: 100dvh; margin: 0 auto; padding: 0 1rem calc(2rem + env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: var(--bg); color: var(--text); overflow-y: auto; }
dialog.exd::backdrop { background: rgba(0, 0, 0, 0.6); }
.exd__top { display: grid; grid-template-columns: 2.5rem 1fr 2.5rem; align-items: center; gap: 0.5rem; padding: 0.9rem 0 0.6rem; position: sticky; top: 0; background: var(--bg); z-index: 2; }
.exd__top h1 { margin: 0; font-size: 1.15rem; text-align: center; }
.exd__back { width: 2.5rem; height: 2.5rem; display: grid; place-items: center; border: 0; background: transparent; color: var(--text); cursor: pointer; border-radius: 0.6rem; }
.exd__ico svg { width: 1.25rem; height: 1.25rem; display: block; }
.exd__tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.3rem; padding: 0.3rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel-2); margin-bottom: 1rem; }
.exd__tabs button { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.7rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.exd__tabs button.is-on { background: var(--panel); color: var(--text); }
.exd__video { position: relative; aspect-ratio: 16 / 9; border-radius: 0.9rem; overflow: hidden; background: #000; }
.exd__video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.exd__yt { display: block; margin: 0.6rem 0 0; padding: 0.75rem; text-align: center; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text); font-weight: 600; text-decoration: none; }
.exd__novideo { padding: 1rem; border: 1px dashed var(--line-2); border-radius: 0.9rem; text-align: center; }
.exd__h { margin: 1.5rem 0 0.7rem; font-size: 1.15rem; }
.exd__muscles { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 0.7rem; }
.exd__muscle { display: grid; justify-items: center; gap: 0.35rem; text-align: center; }
.exd__fig { display: grid; place-items: center; width: 100%; aspect-ratio: 1; border-radius: 0.9rem; background: var(--panel-2); border: 1px solid var(--line-2); padding: 0.4rem; }
.mfig { height: 100%; width: auto; }
.mfig__body { fill: var(--line-2); }
.mfig__lit { fill: #e0573b; }
.exd__mname { font-weight: 600; }
.exd__tip { display: grid; grid-template-columns: 1.6rem 1fr; gap: 0.8rem; align-items: start; margin-bottom: 1rem; color: var(--muted); }
.exd__tip p { margin: 0; }
.exd__steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.9rem; }
.exd__steps li { display: grid; grid-template-columns: 2rem 1fr; gap: 0.8rem; }
.exd__steps p { margin: 0; line-height: 1.5; }
.exd__n { color: var(--blue-text); font-weight: 700; font-variant-numeric: tabular-nums; }
.exd__best { display: grid; gap: 0.15rem; margin-bottom: 0.8rem; }
.exd__best strong { font-size: 1.4rem; }
.exd__hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.exd__hist li { display: grid; gap: 0.25rem; }

/* Effort popup */
dialog.effort { position: fixed; width: min(26rem, calc(100vw - 1.5rem)); margin: auto; padding: 1.1rem; border: 1px solid var(--line-2); border-radius: 1.2rem; background: var(--panel); color: var(--text); }
dialog.effort::backdrop { background: rgba(0, 0, 0, 0.65); }
@media (max-width: 40em) { dialog.effort { margin: auto auto 0.75rem; } }
.effort__head { display: flex; justify-content: space-between; gap: 1rem; align-items: start; margin-bottom: 0.9rem; }
.effort__head h2 { margin: 0; font-size: 1.35rem; }
.effort__head p { margin: 0.2rem 0 0; }
.effort__x { width: 2.4rem; height: 2.4rem; border: 0; background: transparent; color: var(--text); font-size: 1.8rem; line-height: 1; cursor: pointer; border-radius: 0.6rem; }
.effort__opt { display: flex; align-items: center; gap: 0.9rem; width: 100%; margin: 0 0 0.65rem; padding: 0.85rem 1rem; border: 2px solid var(--eff-line); border-radius: 1rem; background: var(--eff-bg); color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.effort__opt > span:last-child { display: grid; gap: 0.1rem; }
.effort__opt strong { text-transform: uppercase; letter-spacing: 0.02em; }
.effort__opt span span { color: var(--muted); font-size: var(--fs-sm); }
.effort__dot { flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--eff); box-shadow: 0 0 0 5px var(--eff-line); }
.effort__opt--easy, .wset__tick.is-easy { --eff: #5fb3a5; --eff-line: #3f7f77; --eff-bg: rgba(63, 127, 119, 0.28); }
.effort__opt--ideal, .wset__tick.is-ideal { --eff: #e0c070; --eff-line: #a08c5c; --eff-bg: rgba(160, 140, 92, 0.28); }
.effort__opt--max, .wset__tick.is-max { --eff: #d8806a; --eff-line: #a8685c; --eff-bg: rgba(168, 104, 92, 0.3); }
.wset__tick.is-easy, .wset__tick.is-ideal, .wset__tick.is-max { border-color: var(--eff); background: var(--eff); color: #1b1b1b; }
.effort__note { margin: 0.4rem 0 0; }

/* Overload suggestion (per set) */
.wsets { gap: 1.5rem; }
.wfield { position: relative; display: block; width: 100%; }
.wsug { position: absolute; left: -0.15rem; top: -0.95rem; z-index: 1; display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.1rem 0.4rem 0.1rem 0.25rem; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); font: inherit; font-size: 0.78rem; font-weight: 700; line-height: 1.2; cursor: pointer; font-variant-numeric: tabular-nums; }
.wsug svg { width: 0.8rem; height: 0.95rem; flex: none; }
.wsug--up { color: var(--good); border-color: var(--good); }
.wsug--down { color: #e08a74; border-color: #e08a74; }

.admin__kinds { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.25rem; max-width: 24rem; }
.admin__kinds li { display: flex; justify-content: space-between; gap: 1rem; }

/* ---- workout day editor: same look as the session screen ---- */
.wkview > .panel { padding: 1.1rem; border: 1.5px solid var(--sess-line); border-radius: 1.7rem; background: var(--sess-card); }
.wkview .dayed .field { gap: 0.5rem; margin-bottom: 0.4rem; }
.wkview .dayed .field label { color: var(--muted); font-size: 0.95rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.wkview .dayed .field input { height: 3.4rem; padding: 0 1rem; border: 0; border-radius: 0.9rem; background: var(--sess-field); color: var(--text); font-size: 1.2rem; }
.wkview .dayed .field input:focus, .wkview .exrow__fields input:focus, .wkview .exrow__fields select:focus { box-shadow: 0 0 0 2px var(--blue-text); outline: 0; }
.wkview .exrows { gap: 1rem; margin: 1.1rem 0; }
.wkview .exrow { padding: 1rem; border: 1.5px solid var(--sess-line); border-radius: 1.5rem; background: transparent; }
.wkview .exrow__top { gap: 0.6rem; }
.wkview .exrow__tile { display: grid; place-items: center; flex: none; width: 3.4rem; height: 3.4rem; border-radius: 1rem; background: var(--sess-tile); color: var(--sess-tile-ink); }
.wkview .exrow__tile svg { width: 1.8rem; height: 1.8rem; }
.wkview .exrow__name { font-size: 1.25rem; font-weight: 500; line-height: 1.2; color: var(--blue-text); }
.wkview .exrow__top .icon-button, .wkview .exrow__top .vidbtn--icon { min-width: 2.6rem; width: 2.6rem; height: 2.6rem; padding: 0; border: 0; border-radius: 0.8rem; background: var(--sess-field); color: var(--text); }
.wkview .exrow__top .icon-button[disabled] { opacity: 0.3; }
.wkview .exrow__top .wicon svg, .wkview .exrow__top svg { width: 1.2rem; height: 1.2rem; }
.wkview .exrow__fields { gap: 0.7rem; margin-top: 1rem; }
.wkview .exrow__fields label { gap: 0.4rem; font-size: 0.85rem; letter-spacing: 0.06em; }
.wkview .exrow__fields input, .wkview .exrow__fields select { height: 3.2rem; padding: 0 0.6rem; border: 0; border-radius: 0.9rem; background: var(--sess-field); color: var(--text); font-size: 1.2rem; text-align: center; text-align-last: center; }
.wkview .exrow__fields input::placeholder { color: var(--faint); font-size: 1rem; }
.wkview .dayed > .button { height: 3rem; padding: 0 1.2rem; border: 1.5px solid var(--sess-line); border-radius: 1rem; background: transparent; font-size: 1rem; }
.wkview > .form-actions { margin-top: 1.1rem; gap: 0.7rem; align-items: center; }
.wkview > .form-actions .button { height: 3.2rem; padding: 0 1.4rem; border-radius: 1rem; font-size: 1.05rem; }
@media (max-width: 560px) { .wkview .exrow__fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.wkview .exrows, .wkview .exrow { min-width: 0; box-sizing: border-box; }
@media (max-width: 560px) {
  .wkview > .panel { padding: 0.9rem; }
  .wkview .exrow { padding: 0.8rem; }
  .wkview .exrow__top { gap: 0.35rem; }
  .wkview .exrow__tile { width: 2.8rem; height: 2.8rem; border-radius: 0.8rem; }
  .wkview .exrow__tile svg { width: 1.5rem; height: 1.5rem; }
  .wkview .exrow__name { font-size: 1.1rem; }
  .wkview .exrow__top .icon-button, .wkview .exrow__top .vidbtn--icon { min-width: 2.3rem; width: 2.3rem; height: 2.3rem; }
}

/* ---- shared serving size on the food screen ---- */
.svbox { margin: 0.9rem 0 0.3rem; }
.svbox .logas { margin-top: 0.5rem; }

/* ---- "workout in progress" bar ---- */
.sessbar { position: sticky; top: 0.5rem; z-index: 20; display: flex; align-items: center; gap: 0.7rem; margin: 0 0 1rem; padding: 0.6rem 0.7rem 0.6rem 1rem; border: 1.5px solid var(--blue-text); border-radius: 1.2rem; background: var(--panel); box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); }
.sessbar__dot { flex: none; width: 0.65rem; height: 0.65rem; border-radius: 50%; background: var(--good); animation: sessbar-pulse 1.6s ease-in-out infinite; }
.sessbar__text { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.1rem 1.1rem; font-variant-numeric: tabular-nums; }
.sessbar__top, .sessbar__now { display: inline-flex; align-items: baseline; gap: 0.6rem; min-width: 0; white-space: nowrap; }
.sessbar__name { font-weight: 600; }
.sessbar__time { color: var(--muted); }
.sessbar__ex { overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.sessbar__set { color: var(--blue-text); }
@media (max-width: 560px) { .sessbar__text { flex-direction: column; gap: 0.1rem; } .sessbar__now { font-size: var(--fs-sm); } }
@keyframes sessbar-pulse { 50% { opacity: 0.35; } }
@media (prefers-reduced-motion: reduce) { .sessbar__dot { animation: none; } }
.form-actions--stack { flex-direction: column; align-items: stretch; }
.form-actions--stack .button { justify-content: center; }
@media (max-width: 56em) { .sessbar { top: 4.2rem; } }
.sessbar__rest { padding: 0.1rem 0.6rem; border-radius: 999px; background: color-mix(in srgb, var(--blue-text) 18%, transparent); color: var(--blue-text); font-size: var(--fs-sm); font-weight: 600; }
.sessbar__rest[hidden] { display: none; }
.sessbar__rest.is-go { background: var(--good-bg); color: var(--good); }

/* ---- queue several foods, then add them together ---- */
.aadd.is-on { border-color: var(--blue); background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue-text); font-size: 1.1rem; }
.arow.is-queued { background: color-mix(in srgb, var(--blue) 7%, transparent); }
.qbar { position: sticky; bottom: 1rem; z-index: 30; display: flex; align-items: center; gap: 0.8rem; margin-top: 1rem; padding: 0.6rem 0.8rem; border: 1.5px solid var(--blue-text); border-radius: 1.2rem; background: var(--panel); box-shadow: 0 6px 20px rgb(0 0 0 / 0.3); }
.qbar__add { flex: 1; justify-content: center; }
.qbar__sum { font-size: var(--fs-sm); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 56em) { .qbar { bottom: 4.9rem; } }

/* ---- drag a food onto another meal ---- */
.entry--drag { grid-template-columns: auto 1fr auto; column-gap: 0.6rem; }
.entry--drag .entry__name, .entry--drag .entry__meta { grid-column: 2; }
.entry--drag .entry__actions { grid-column: 3; }
.entrygrip { display: grid; place-items: center; grid-column: 1; grid-row: 1 / span 2; align-self: stretch; width: 1.6rem; padding: 0; border: 0; border-radius: 0.6rem; background: none; color: var(--faint); cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none; }
.entrygrip:hover, .entrygrip:focus-visible { color: var(--text); }
.entrygrip span { display: block; white-space: nowrap; font-size: 1.2rem; line-height: 1; letter-spacing: -0.15em; }
.entry.is-lifted { opacity: 0.35; }
.entryghost { position: fixed; z-index: 80; margin: 0; list-style: none; pointer-events: none; padding: 0.7rem var(--pad); border: 1px solid var(--blue-text); border-radius: 0.9rem; background: var(--panel-2); opacity: 0.97; filter: drop-shadow(0 0.8rem 1.2rem var(--shadow)); }
.entryghost .entry__actions { display: none; }
.meal.is-target { border-color: var(--blue-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-text) 30%, transparent); }
html.is-dragging-food, html.is-dragging-food body { cursor: grabbing; overscroll-behavior: contain; -webkit-user-select: none; user-select: none; }

/* ---- the diary on a phone: swipe a food left for Edit, Copy and Delete ---- */
.entry__main { display: contents; }
@media (max-width: 700px) and (pointer: coarse) {
  .entry--drag { display: block; position: relative; overflow: hidden; padding: 0; }
  .entry--drag .entry__main { position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.6rem; align-items: center; padding: 0.7rem var(--pad); background: var(--panel); touch-action: pan-y; transition: transform 0.2s ease; }
  .entry--drag .entry__name, .entry--drag .entry__meta { grid-column: 2; }
  .entry--drag .entry__actions { position: absolute; z-index: 0; top: 0; right: 0; bottom: 0; display: flex; gap: 0; }
  .entry--drag .entry__actions button { display: grid; place-items: center; width: 4.6rem; height: 100%; padding: 0; border: 0; border-radius: 0; color: #fff; font-size: var(--fs-sm); font-weight: 600; text-decoration: none; }
  .entry--drag .entry__edit { background: var(--blue); }
  .entry--drag .entry__copy { background: color-mix(in srgb, var(--blue-text) 70%, #000); }
  .entry--drag .entry__del { background: var(--ember); }
}
.entryghost .entry__main { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 0.6rem; align-items: center; }
.entryghost .entry__name, .entryghost .entry__meta { grid-column: 2; }

/* Water tracker */
.wcard { margin-block: 1rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.wcup { width: 4.6rem; }
.wcup__svg { display: block; width: 100%; height: auto; }
.wcup__bg { fill: color-mix(in srgb, var(--blue-text, #2b6cb0) 8%, transparent); }
.wcup__glass { fill: none; stroke: var(--blue-text, #2b6cb0); stroke-width: 2.5; stroke-linejoin: round; }
.wcup__lvl { fill: color-mix(in srgb, var(--blue-text, #2b6cb0) 55%, #fff); transition: transform 1.6s cubic-bezier(.3, .7, .2, 1); }
.wcup__wave { animation: wcup-wave 3.2s linear infinite; }
@keyframes wcup-wave { to { transform: translateX(48px); } }
.wcard.is-done .wcup__lvl { fill: color-mix(in srgb, var(--blue-text, #2b6cb0) 70%, #fff); }
.wcard__body { min-width: 0; }
.wcard__top { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; }
.wcard__top h2 { margin: 0; font-size: 1.1rem; }
.wcard__amount { margin: 0.2rem 0 0.4rem; font-size: 1.25rem; }
.wbar { height: 0.5rem; border-radius: 99px; background: color-mix(in srgb, var(--blue-text, #2b6cb0) 14%, transparent); overflow: hidden; }
.wbar span { display: block; height: 100%; background: var(--blue-text, #2b6cb0); border-radius: 99px; transition: width 1.6s cubic-bezier(.3, .7, .2, 1); }
.wcard__nudge { margin: 0.5rem 0; font-weight: 600; }
.wcard__btns { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
@media (prefers-reduced-motion: reduce) { .wcup__wave { animation: none; } .wcup__lvl, .wbar span { transition: none; } }
@media (max-width: 420px) { .wcup { width: 3.6rem; } }

/* Show/hide password eye */
.pwwrap { position: relative; display: block; }
.pwwrap > input { width: 100%; padding-right: 2.9rem; }
.pwwrap__eye { position: absolute; top: 50%; right: 0.35rem; transform: translateY(-50%); display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border: 0; border-radius: 0.5rem; background: transparent; color: var(--muted); cursor: pointer; }
.pwwrap__eye:hover, .pwwrap__eye[aria-pressed="true"] { color: var(--text); }
.pwwrap__eye:focus-visible { outline: 2px solid var(--blue-text); outline-offset: -2px; }
.pwwrap__eye svg { width: 1.3rem; height: 1.3rem; }

/* Feature requests (Settings) and the admin badge */
.ideas__form { display: grid; gap: 0.6rem; }
.ideas__form textarea { width: 100%; min-height: 6rem; resize: vertical; font: inherit; }
.ideas__count { justify-self: end; color: var(--muted); font-size: var(--fs-sm); }
.ideas__list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.ideas__item { padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: 0.6rem; display: grid; gap: 0.3rem; }
.ideas__item p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.ideas__meta { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; color: var(--muted); font-size: var(--fs-sm); }
.ideas__reply { border-left: 3px solid var(--blue-text); padding-left: 0.6rem; color: var(--muted); }
.adminrow__ideas { margin-top: 0.5rem; display: grid; gap: 0.35rem; }
.adminrow__idea { padding: 0.5rem 0.7rem; border-left: 3px solid var(--blue-text); background: color-mix(in srgb, var(--blue-text) 8%, transparent); white-space: pre-wrap; overflow-wrap: anywhere; }
.nav__badge { margin-left: auto; min-width: 1.35rem; padding: 0.05rem 0.4rem; border-radius: 99px; background: var(--ember, #e5533d); color: #fff; font-size: 0.75rem; font-weight: 700; text-align: center; line-height: 1.3; }

/* Import a workout from a photo */
.kindbtn--import { width: 100%; margin-bottom: 0.75rem; border-style: dashed; border-color: var(--blue-text); }
.wscan__shots { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.75rem; }
.wscan__shots .mealshot { width: 7rem; }
.wscan__shots .mealshot img { width: 100%; height: 8rem; object-fit: cover; border-radius: 0.5rem; }
#wscan-text { width: 100%; font: inherit; }

/* Workout wrap-up, History and PRs */
.wrapdlg { width: min(34rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 2rem); overflow: auto; }
.wrap { display: grid; gap: 1rem; }
.wrap__hero { text-align: center; padding: 0.5rem 0; }
.wrap__kicker { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: var(--fs-sm); }
.wrap__big { margin: 0.2rem 0; font-size: clamp(2.6rem, 12vw, 3.8rem); font-weight: 800; line-height: 1.05; color: var(--blue-text); }
.wrap__big small { font-size: 0.4em; font-weight: 600; color: var(--muted); }
.wrap__change { margin: 0.3rem 0 0; font-weight: 700; }
.wrap__change.is-up { color: var(--good); }
.wrap__change.is-down { color: var(--warn); }
.wrap__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; text-align: center; }
.wrap__stat strong { display: block; font-size: 1.35rem; }
.wrap__watch { display: grid; gap: 0.15rem; padding: 0.7rem 0.9rem; border-left: 3px solid var(--blue-text); background: color-mix(in srgb, var(--blue-text) 8%, transparent); }
.wrap__watch[hidden] { display: none; }
.wrap__sec h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.wrap__prs, .wrap__ex { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.wrap__prs li { display: flex; gap: 0.6rem; align-items: flex-start; }
.wrap__prs li > div { display: grid; gap: 0.1rem; min-width: 0; }
.wrap__prs .wicon, .wrap__ex .is-pr .wicon { color: var(--amber); flex: none; }
.wrap__prs svg, .wrap__ex .is-pr svg { width: 1.4rem; height: 1.4rem; }
.wrap__ex li { display: grid; gap: 0.1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.wrap__ex li:last-child { border-bottom: 0; padding-bottom: 0; }
.wrap__ex .is-pr { display: flex; gap: 0.6rem; align-items: flex-start; }
.wrap__ex .is-pr > div { display: grid; }
.histbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.histlist, .prlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.histcard, .prcard { padding: 0.8rem 0.9rem; border: 1px solid var(--line); border-radius: 0.8rem; background: var(--panel); display: grid; gap: 0.25rem; }
.histcard summary { display: grid; gap: 0.2rem; cursor: pointer; list-style: none; }
.histcard summary::-webkit-details-marker { display: none; }
.histcard details[open] summary { margin-bottom: 0.6rem; }
.histcard__top { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; }
.histcard__watch { color: var(--blue-text); }
.histcard--watch { border-style: dashed; }
.prcard__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.6rem; margin-top: 0.3rem; }
.prcard__grid > div { display: grid; gap: 0.1rem; }
.wktabs { overflow-x: auto; }

/* Dashboard breakdown page */
.instats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 1rem; }
.instat { display: grid; gap: 0.1rem; }
.instat strong { font-size: 1.5rem; line-height: 1.15; }
.inempty { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin: 0; }
.inlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.inlist li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.inlist li:last-child { border-bottom: 0; padding-bottom: 0; }
.intable { overflow-x: auto; }
.intable table { width: 100%; border-collapse: collapse; }
.intable th, .intable td { padding: 0.55rem 0.3rem; text-align: right; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.intable th:first-child, .intable td:first-child { text-align: left; }
.intable thead th { color: var(--muted); font-size: var(--fs-sm); font-weight: 600; }
.intable tbody th { font-weight: 600; }
.ingrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.1rem, 1fr)); gap: 0.35rem; }
.ingrid__day { display: grid; place-items: center; height: 2.1rem; border-radius: 0.5rem; background: var(--track); color: var(--muted); font-size: var(--fs-sm); }
.ingrid__day.is-on { background: var(--blue-text); color: var(--bg); font-weight: 700; }
.ingrid__day.is-today { outline: 2px solid var(--text); outline-offset: 1px; }
.inchart { margin-top: 1rem; }
.incheck { display: grid; gap: 0.5rem; }
.incheck__btns { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* Build me a week */
.wbuild h3 { margin: 0 0 0.25rem; }
.wbchips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.6rem 0 1rem; }
.wbchip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; padding: 0.55rem 0.9rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel, transparent); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.wbchip.is-on { border-color: var(--blue-text); background: color-mix(in srgb, var(--blue-text) 16%, transparent); font-weight: 600; }
.wbper { display: grid; gap: 0.5rem; margin: 0.75rem 0; }
.wbper label { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.wbper select { width: 9rem; }
.scanner__controls { display: flex; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.scanner__controls[hidden] { display: none; }
.scanner__zoom { display: flex; align-items: center; gap: 0.5rem; flex: 1; }
.scanner__zoom input { flex: 1; }
.scanner__reader { cursor: pointer; }

/* Recipe editor: add or swap an ingredient */
.rbpick { margin-top: 1rem; }
.rbpick__list { list-style: none; margin: 0.5rem 0; padding: 0; display: grid; gap: 0.35rem; }
.rbpick__item { width: 100%; text-align: left; padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 0.6rem; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.rbpick__item:hover, .rbpick__item:focus-visible { border-color: var(--blue-text); }
.rbings--edit li { flex-wrap: wrap; }

/* Cook it */
.rbstepper { display: flex; gap: 0.5rem; align-items: center; }
.rbstepper input { width: 5.5rem; text-align: center; }
.rbchips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.chip--btn { cursor: pointer; border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; }
.rbcookings { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.rbcookings label { display: flex; gap: 0.6rem; align-items: baseline; cursor: pointer; }
.rbcookings .is-done span { text-decoration: line-through; opacity: 0.55; }

/* Exercise swap and muscle tags */
.wex__swap { border: 1px solid var(--line); background: transparent; color: inherit; font: inherit; font-size: var(--fs-sm); padding: 0.3rem 0.7rem; border-radius: 999px; cursor: pointer; }
.wex__swap:hover, .wex__swap:focus-visible { border-color: var(--blue-text); }
.mtags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.25rem; }
.mtag { font-size: var(--fs-sm); padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--track); color: var(--muted); }
.mtag--match { background: color-mix(in srgb, var(--blue-text) 18%, transparent); color: var(--blue-text); }
.exrow__muscles { display: block; color: var(--muted); font-weight: 400; font-size: var(--fs-sm); }
.swap .label { margin: 1rem 0 0.4rem; }

/* Per-set rows in the workout editor */
.setgrid { margin: 0.6rem 0; display: grid; gap: 0.4rem; }
.setgrid__head, .setgrid__row { display: grid; grid-template-columns: 2.2rem 1fr 1fr; gap: 0.5rem; align-items: center; }
.setgrid__head { font-size: var(--fs-sm); color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.setgrid__n { display: grid; place-items: center; height: 2.2rem; border-radius: 0.6rem; background: var(--track); font-weight: 700; }
.setgrid__in { width: 100%; min-width: 0; text-align: center; }
.setgrid__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 0.2rem; }

/* Exercise page: anatomical muscle diagram */
.anat { background: #f3f4f7; border-radius: 14px; padding: 6px 4px; }
.anat svg { display: block; width: 100%; height: auto; max-height: 62vh; }
.anat .ov { display: none; pointer-events: none; }
.anat .ov.hl-p { display: block; fill: #1f5fe0; fill-opacity: .72; }
.anat .ov.hl-s { display: block; fill: #7dbaf5; fill-opacity: .7; }
.exd__anat { margin: 0 0 10px; }
.exd__credit { margin: 6px 2px 0; line-height: 1.35; }
.exd__mlist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.exd__mrow { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line, rgba(128,128,128,.25)); border-radius: 12px; }
.exd__mdot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; background: #1f5fe0; }
.exd__mrow.is-secondary .exd__mdot { background: #7dbaf5; }
.exd__mrow strong { display: block; }
.exd__sci { display: block; font-size: .85em; opacity: .75; font-style: italic; margin-top: 2px; }

/* Label scan: guided camera */
.labelcam__view { position: relative; border-radius: 0.7rem; overflow: hidden; background: #000; cursor: pointer; }
.labelcam__video { display: block; width: 100%; max-height: 58dvh; object-fit: cover; background: #000; }
.labelcam__guide { position: absolute; inset: 12% 8%; border: 2px dashed rgba(255,255,255,.85); border-radius: 0.6rem; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none; }
.labelcam__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.25); }
.labelcam__bar span { display: block; height: 100%; width: 0; background: #e8a33c; transition: width .25s, background .25s; }
.labelcam__bar.is-good span { background: #35c46a; }
.labelcam__auto { display: inline-flex; align-items: center; gap: .4rem; }
.labelcam__shutter { min-width: 9rem; }
.labelcam__thumbs { display: flex; gap: .6rem; margin: .5rem 0; }
.labelcam__thumbs img { width: 48%; max-height: 11rem; object-fit: cover; border-radius: .6rem; border: 1px solid var(--line, rgba(128,128,128,.35)); }
.labelcam__retake { border: 1px solid #e8a33c; background: rgba(232,163,60,.12); border-radius: .7rem; padding: .6rem .8rem; margin-bottom: .75rem; }
.labelcam__retake p { margin: 0 0 .5rem; }
.cutable { width: 100%; border-collapse: collapse; margin: .5rem 0 .75rem; }
.cutable th, .cutable td { padding: .35rem .5rem; text-align: right; border-bottom: 1px solid var(--line, rgba(128,128,128,.25)); }
.cutable th:first-child { text-align: left; font-weight: 600; }

.wkrow__col { min-width: 0; display: grid; gap: 0.5rem; }
.wkdrop { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0 0.25rem; }
.wkdrop[hidden] { display: none; }
.wkdrop .button--primary { flex: 1 1 10rem; }

/* "AI Enhanced" badge; shortens to "AI" on narrow screens */
.aitag { display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border: 1px solid var(--blue-text); border-radius: 999px; color: var(--blue-text); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.03em; line-height: 1.5; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.aitag__short { display: none; }
.aaction .aitag { margin: 0; }
@media (max-width: 480px) { .aitag__full { display: none; } .aitag__short { display: inline; } }
