/* ===== Design tokens. Dark is the default; [data-theme="light"] overrides. =====
   Every colour used in the stylesheet comes from here (plus the user's brand accent,
   which /api/brand can override at runtime via --brand-accent). */
:root {
  color-scheme: dark;
  /* brand: overridden at runtime by /api/brand.css (admin › Settings › Branding) */
  --brand-accent: #ffe600; --brand-on: #111111; --brand-text-dark: #ffe600; --brand-text-light: #8f6400;
  --bg: #0d0d0f; --panel: #17171b; --panel2: #1f1f25; --panel-alt: #121216; --popover: #141418; --sunken: #0f0f12; --row-hover: #1b1b20;
  --line: #2c2c34; --line-strong: #4a4a55;
  --text: #f2f2f4; --text-2: #c9c9d2; --muted: #9a9aa6; --muted-2: #6b6b78; --strong: #ffffff;
  --red: var(--brand-accent); --accent: var(--brand-accent); --gold: var(--brand-accent);
  --red2: color-mix(in srgb, var(--brand-text-dark) 80%, #ffffff); --gold-text: var(--brand-text-dark); --accent-text: var(--brand-text-dark);
  --on-accent: var(--brand-on); --on-gold: var(--brand-on); --on-danger: #ffffff; --on-gold-muted: #3a2a00; --on-green: #04210f;
  --danger: #ff3b30; --green: #22c55e; --blue: #3b82f6;
  --ai: #a77bff;
  --phc-menstrual: #e0567a; --phc-follicular: #4fb3e8; --phc-ovulatory: #b48cff; --phc-luteal: #f0a43a; --on-ph: #ffffff;
  --tpl-ph-fg: #ffffff; --tpl-ph-a: #141418; --tpl-ph-b: #101013;
  --warn-bg: #2a1c05; --warn-bg-soft: #1a1505; --warn-line: #6b4a12; --warn-fg: #ffc46b;
  --ok-bg: #0f3a22; --ok-line: #1a5c37; --ok-fg: #6ee7a0;
  --bad-bg: #2b0b09; --bad-bg-2: #3a0e0b; --bad-line: #7a1f1a; --bad-fg: #ff8a80;
  --info-bg: #0f1a2b; --info-line: #24406b; --info-fg: #9cc7ff;
  --neutral-bg: #2a2a33; --neutral-fg: #cccccc;
  --athlete-blue: #5ab0ff; --st-ss: #b48cff;
  --ph-hyp: #5ab0ff; --ph-peaking: #ff5c5c; --ph-deload: #6ad48b;
  --sev-lo: #7ee2a0; --sev-mid: #ffc46b; --sev-hi: #ff6b5e;
  --topbar-1: #000000; --topbar-2: #111111; --wo-grad: #1a0000; --chip-target-bg: #2a0505;
  --toast-bg: #ffffff; --toast-fg: #000000; --media-bg: #000000; --overlay: rgba(0,0,0,.75);
  --shadow: rgba(0,0,0,.55); --backdrop: rgba(0,0,0,.65); --glass: rgba(13,13,15,.92);
  --accent-glow: color-mix(in srgb, var(--brand-accent) 25%, transparent); --accent-glow-strong: color-mix(in srgb, var(--brand-accent) 70%, transparent);
  --metal-1: #cfcfcf; --metal-2: #8d8d8d; --metal-3: #6d6d6d; --plate-edge: rgba(0,0,0,.35); --plate-edge-hi: rgba(255,255,255,.28);
  /* charts */
  --chart-line: var(--brand-accent); --chart-grid: #2c2c34; --chart-text: #9a9aa6;
  --c-sleep: #5ab0ff; --c-stress: #ff6b5e; --c-soreness: #b48cff; --c-motivation: #7ee2a0; --c-bw: var(--brand-accent); --on-c: #111111;
  --logo-dark-display: block; --logo-light-display: none;
  --radius: 12px;
  --font: "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: "Arial Black", "Helvetica Neue", Impact, var(--font);
}
/* Light theme: warm off-white surfaces, near-black text, a DARKER amber for text/fills on white
   (pure #f5a623 on white fails contrast), gold kept only as a fill behind dark text. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3ef; --panel: #ffffff; --panel2: #eeece6; --panel-alt: #f8f7f3; --popover: #ffffff; --sunken: #fbfaf7; --row-hover: #f5f3ec;
  --line: #dcd8cd; --line-strong: #b3ae9f;
  --text: #17171b; --text-2: #3b3b44; --muted: #5d5d69; --muted-2: #8e8e99; --strong: #000000;
  /* accent stays a FILL (brand yellow behind dark text); any accent-coloured TEXT uses the darker, contrast-checked amber */
  --red2: var(--brand-text-light); --gold-text: var(--brand-text-light); --accent-text: var(--brand-text-light); --on-gold-muted: #4a3600; --on-green: #ffffff;
  --danger: #d92d20; --green: #15803d; --blue: #2563eb;
  --ai: #7c4dde;
  --phc-menstrual: #c23a5f; --phc-follicular: #1f7fb8; --phc-ovulatory: #7a52d1; --phc-luteal: #b8740f; --on-ph: #ffffff;
  --tpl-ph-fg: #ffffff; --tpl-ph-a: #141418; --tpl-ph-b: #101013;
  --warn-bg: #fff2d4; --warn-bg-soft: #fff9ea; --warn-line: #e4c27a; --warn-fg: #7f5200;
  --ok-bg: #e2f5e9; --ok-line: #9bd3b0; --ok-fg: #14653a;
  --bad-bg: #fde9e7; --bad-bg-2: #fbd6d2; --bad-line: #eea59d; --bad-fg: #b42318;
  --info-bg: #e8f0fe; --info-line: #a8c3f0; --info-fg: #1d4ed8;
  --neutral-bg: #ecebe6; --neutral-fg: #44444c;
  --athlete-blue: #2f80ed; --st-ss: #9466ff;
  --ph-hyp: #3b8fe0; --ph-peaking: #e5484d; --ph-deload: #2fa65a;
  --sev-lo: #7fd9a2; --sev-mid: #ffc35c; --sev-hi: #e5483b;
  --topbar-1: #ffffff; --topbar-2: #f7f5ef; --wo-grad: #fff1dc; --chip-target-bg: #fff2d4;
  --toast-bg: #17171b; --toast-fg: #ffffff; --media-bg: #000000; --overlay: rgba(0,0,0,.6);
  --shadow: rgba(30,25,10,.16); --backdrop: rgba(20,18,12,.45); --glass: rgba(255,255,255,.92);
  --accent-glow: color-mix(in srgb, var(--brand-text-light) 18%, transparent); --accent-glow-strong: color-mix(in srgb, var(--brand-text-light) 55%, transparent);
  --plate-edge-hi: rgba(0,0,0,.25);
  --chart-line: var(--brand-text-light); --chart-grid: #e2ded3; --chart-text: #5d5d69;
  --c-sleep: #2f80ed; --c-stress: #e5483b; --c-soreness: #8b5cf6; --c-motivation: #16a34a; --c-bw: var(--brand-text-light); --on-c: #ffffff;
  --logo-dark-display: none; --logo-light-display: block;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--accent-text); }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
a { color: var(--red2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--display); text-transform: uppercase; letter-spacing: .02em; margin: 0 0 .5rem; line-height: 1.1; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { text-align: right; }
.container { max-width: 1180px; margin: 0 auto; padding: 1rem; padding-bottom: 4rem; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 1rem; padding: .6rem 1rem;
  background: linear-gradient(180deg, var(--topbar-1) 0%, var(--topbar-2) 100%); border-bottom: 3px solid var(--gold); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); text-decoration: none !important; }
.logo { display: grid; place-items: center; height: 38px; min-width: 34px; }
.logo img, .hero-logo img, .br-header-pv img { height: 36px; width: auto; max-width: 120px; object-fit: contain; }
.logo-dk { display: var(--logo-dark-display); } .logo-lt { display: var(--logo-light-display); }
.brand-text { display: flex; flex-direction: column; line-height: .95; font-family: var(--display); letter-spacing: .08em; }
.brand-text strong { font-size: .95rem; } .brand-text em { font-style: normal; color: var(--red2); font-size: 1.15rem; letter-spacing: .3em; }
.nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .45rem .7rem; border-radius: 8px; font-weight: 700; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.nav a.active, .nav a:hover { color: var(--strong); background: var(--panel2); text-decoration: none; }
.who { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }

/* layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.page-head .sub { color: var(--muted); margin: 0; }
.grid { display: grid; gap: 1rem; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.card.accent { border-top: 3px solid var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .6rem; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: .8rem 1rem; }
.stat b { display: block; font-family: var(--display); font-size: 1.6rem; }
.stat span { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* badges */
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.badge.sample { background: var(--warn-bg); color: var(--gold-text); border-color: var(--warn-line); }
.phase-hypertrophy { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.phase-strength { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.phase-peaking { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.phase-deload { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.phase-other { background: var(--neutral-bg); color: var(--neutral-fg); }
.st-done { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.st-today { background: var(--red); color: var(--on-accent); border-color: var(--red); }
.st-missed { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.st-in_progress { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.div-tag { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: .55rem .9rem; border-radius: 9px; font-weight: 800; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; cursor: pointer; font-family: var(--font); min-height: 40px; }
.btn:hover { border-color: var(--line-strong); text-decoration: none; }
.btn.primary { background: var(--red); border-color: var(--red); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.success { background: var(--green); border-color: var(--green); color: var(--on-green); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--red2); background: transparent; }
.btn.sm { padding: .3rem .55rem; min-height: 32px; font-size: .72rem; }
.btn.icon { padding: .3rem .5rem; min-height: 32px; min-width: 32px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
label { display: block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea { width: 100%; background: var(--sunken); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .6rem; font: inherit; min-height: 40px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--red); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 70px; resize: vertical; }
.form-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.field { margin-bottom: .2rem; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 800; }
tr:hover td { background: var(--row-hover); }

/* client cards on dashboard */
.client-card .name { font-weight: 800; font-size: 1.05rem; }
.lifts { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .6rem 0; }
.lift { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; text-align: center; }
.lift b { display: block; font-family: var(--display); font-size: 1.1rem; }
.lift span { font-size: .65rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.progressbar { height: 8px; background: var(--sunken); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.progressbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }

/* builder */
.week { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; background: var(--panel); overflow: hidden; }
.week-head { display: flex; gap: .6rem; align-items: center; padding: .7rem 1rem; background: var(--panel-alt); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.week-head h2 { margin: 0; }
.week-head select, .week-head input { width: auto; min-height: 34px; padding: .3rem .5rem; }
.week-body { padding: .8rem; display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.day { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem; }
.day-head { display: flex; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.day-head input { font-weight: 800; }
.day-head select { width: 90px; }
.ex { background: var(--panel-alt); border: 1px solid var(--line); border-left: 3px solid var(--red); border-radius: 8px; padding: .5rem; margin-bottom: .5rem; }
.ex-top { display: flex; gap: .3rem; align-items: center; margin-bottom: .4rem; }
.ex-top select { flex: 1; font-weight: 700; }
.ex-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.ex-grid label { font-size: .6rem; margin-bottom: .1rem; }
.ex-grid input, .ex-grid select { min-height: 34px; padding: .3rem .4rem; font-size: .9rem; }
.ex-grid .w2 { grid-column: span 2; }
.ex-grid .w4 { grid-column: 1 / -1; }
.add-ex { display: flex; gap: .35rem; }
.add-ex select { min-height: 36px; }

/* workout */
.wo-head { background: linear-gradient(135deg, var(--wo-grad) 0%, var(--panel) 60%); border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.wo-ex { margin-bottom: 1rem; }
.presc { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 .6rem; }
.chip { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: .25rem .55rem; font-weight: 700; font-size: .85rem; }
.chip.target { border-color: var(--red); color: var(--strong); background: var(--chip-target-bg); }
.sets { width: 100%; }
.sets th, .sets td { padding: .3rem .25rem; border: 0; text-align: center; }
.sets td input { text-align: center; min-height: 44px; font-size: 1.05rem; font-weight: 700; padding: .3rem; }
.sets td.setno { font-family: var(--display); color: var(--muted); width: 2.2rem; }
.sets td.e1 { font-size: .8rem; color: var(--muted); width: 4.2rem; }
.sets tr.logged td.setno { color: var(--green); }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(180deg, transparent, var(--bg) 30%); padding: 1rem 0 .5rem; display: flex; gap: .5rem; }
.sticky-actions .btn { flex: 1; min-height: 50px; font-size: .9rem; }
.done-banner { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-fg); padding: .7rem 1rem; border-radius: 10px; font-weight: 800; margin-bottom: 1rem; }

/* schedule */
.sched-day { display: flex; gap: .7rem; align-items: center; padding: .55rem .2rem; border-bottom: 1px solid var(--line); }
.sched-day:last-child { border-bottom: 0; }
.sched-date { width: 62px; text-align: center; flex-shrink: 0; }
.sched-date b { display: block; font-family: var(--display); font-size: 1.2rem; }
.sched-date span { font-size: .68rem; color: var(--muted); text-transform: uppercase; font-weight: 800; }

/* login */
.login { max-width: 640px; margin: 2rem auto; }
.hero { text-align: center; padding: 2rem 1rem 1rem; }
.hero h1 { font-size: 2.4rem; }
.hero h1 span { color: var(--red2); }
.pick { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; text-align: left; padding: 1rem; margin-bottom: .6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); cursor: pointer; font: inherit; }
.pick:hover { border-color: var(--red); }
.pick strong { font-size: 1.05rem; }

/* chart */
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; gap: 1rem; font-size: .75rem; color: var(--muted); margin-top: .3rem; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 3px; vertical-align: middle; margin-right: .3rem; }

.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--toast-bg); color: var(--toast-fg); padding: .6rem 1rem; border-radius: 10px; font-weight: 800; z-index: 50; box-shadow: 0 6px 30px var(--shadow); max-width: 90vw; }
.toast.err { background: var(--danger); color: var(--on-danger); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
details summary { cursor: pointer; font-weight: 700; }

@media (max-width: 720px) {
  .container { padding: .75rem; }
  h1 { font-size: 1.35rem; }
  .topbar { gap: .5rem; padding: .5rem .75rem; }
  .nav { order: 3; width: 100%; flex: none; overflow-x: auto; flex-wrap: nowrap; }
  .who { margin-left: auto; }
  .week-body { grid-template-columns: 1fr; padding: .5rem; }
  .hide-sm { display: none; }
}

.layout { display: grid; grid-template-columns: 220px 1fr; gap: 1rem; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } .aside { position: static !important; } }
.aside { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem; position: sticky; top: 70px; align-self: start; }
.aside a { display: block; padding: .55rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .75rem; letter-spacing: .05em; }
.aside a.active, .aside a:hover { background: var(--panel2); color: var(--strong); text-decoration: none; }
.aside .aside-name { padding: .4rem .7rem .8rem; font-family: var(--display); font-size: .95rem; border-bottom: 1px solid var(--line); margin-bottom: .4rem; }
.stepper { display: flex; align-items: center; gap: .25rem; justify-content: center; }
.stepper input { width: 4.5rem; text-align: center; font-weight: 800; font-size: 1.1rem; min-height: 44px; }
.energy { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .45rem; max-width: 640px; }
.energy button { min-height: 64px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; display: grid; place-items: center; align-content: center; gap: .1rem; padding: .35rem .2rem; }
.energy button b { font-family: var(--display); font-size: 1.55rem; line-height: 1; }
.energy button span { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.energy button:hover { border-color: var(--line-strong); }
.energy button.on { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.energy button.on span { color: var(--on-gold); }
.prog-grid { display: grid; gap: .5rem; overflow-x: auto; }
.prog-grid table { min-width: 700px; }
.prog-grid td { vertical-align: top; min-width: 140px; }
.cell-ex { font-size: .78rem; padding: .2rem 0; border-bottom: 1px dashed var(--line); }
.cell-ex:last-child { border-bottom: 0; }
.cell-ex .sum { color: var(--gold-text); font-weight: 700; }
.inline-ex { display: grid; gap: .35rem; }
.toast.show { display: block; }
.btn.danger { color: var(--bad-fg); }
.tag-hit { background:var(--ok-bg);color:var(--ok-fg); } .tag-hold { background:var(--warn-bg);color:var(--warn-fg); } .tag-drop { background:var(--bad-bg);color:var(--bad-fg); }
.video-thumb { display:inline-flex; align-items:center; gap:.3rem; }
.filter-bar { display:flex; gap:.5rem; flex-wrap:wrap; margin-bottom:1rem; }
.filter-bar input, .filter-bar select { width:auto; min-width:140px; flex:1; }
.login-roles { display:grid; gap:1rem; }
.role-block h3 { color: var(--gold-text); margin-top: 1rem; }

/* ---------- program builder: docked library + drag & drop ---------- */
.container.wide { max-width: 1680px; }
.bld-layout { display: grid; grid-template-columns: var(--lib-w, 248px) minmax(0, 1fr); gap: .75rem; align-items: start; }
.bld-layout.lib-collapsed { grid-template-columns: 34px minmax(0, 1fr); }
.bld-layout.no-lib { grid-template-columns: minmax(0, 1fr); }
/* library on the right (default): program first, panel docked on the right; the resize edge faces the program */
.bld-layout.lib-right:not(.no-lib) { grid-template-columns: minmax(0, 1fr) var(--lib-w, 248px); }
.bld-layout.lib-right.lib-collapsed:not(.no-lib) { grid-template-columns: minmax(0, 1fr) 34px; }
.bld-layout.lib-right .lib-panel { order: 2; }
.bld-layout.lib-right .lib-resize { right: auto; left: 0; }

.lib-panel { position: sticky; top: calc(var(--topbar-h, 64px) + 12px); max-height: calc(100vh - var(--topbar-h, 64px) - 24px);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent);
  border-radius: var(--radius); overflow: hidden; z-index: 2; }
.lib-head { display: flex; align-items: center; gap: .5rem; padding: .55rem .6rem; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.lib-head h3 { margin: 0; flex: 1; font-size: .95rem; color: var(--gold-text); }
.lib-body { display: flex; flex-direction: column; gap: .45rem; padding: .55rem; min-height: 0; flex: 1; }
.lib-body input[type=search] { min-height: 38px; }
.lib-filters { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.lib-filters select { min-height: 32px; padding: .25rem .4rem; font-size: .8rem; }
.lib-hint { line-height: 1.3; }
.lib-target { color: var(--red2); font-weight: 700; }
.lib-list { overflow-y: auto; min-height: 120px; flex: 1; margin: 0 -.2rem; padding: 0 .2rem; overscroll-behavior: contain; }
.lib-item { display: flex; align-items: center; gap: .4rem; padding: .35rem .4rem; border: 1px solid transparent; border-radius: 8px; cursor: grab;
  user-select: none; -webkit-user-select: none; touch-action: pan-y; -webkit-touch-callout: none; }
.lib-item:hover, .lib-item:focus-visible { background: var(--panel2); border-color: var(--line); outline: none; }
.lib-item:focus-visible { border-color: var(--accent); }
.lib-main { flex: 1; min-width: 0; }
.lib-name { font-weight: 700; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-tags { display: flex; gap: .25rem; flex-wrap: nowrap; overflow: hidden; margin-top: .1rem; }
.tag { font-size: .62rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); background: var(--sunken);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 .4rem; white-space: nowrap; }
.tag.main { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.tag.eq { color: var(--text-2); }
.lib-add { min-width: 30px; min-height: 30px; color: var(--red2); font-size: 1.05rem; }
.lib-add:hover { background: var(--accent); color: var(--on-gold); border-color: var(--accent); }
.lib-more { width: 100%; margin: .4rem 0; }
.grip { color: var(--muted-2); cursor: grab; font-size: 1rem; line-height: 1; padding: .3rem .15rem; touch-action: none; user-select: none; -webkit-user-select: none; }
.lib-item:hover .grip, .ex-grip:hover { color: var(--accent-text); }
.ex-grip { padding: .45rem .3rem; font-size: 1.15rem; }
.lib-rail { display: none; flex-direction: column; align-items: center; gap: .6rem; width: 100%; min-height: 230px; padding: .7rem 0; border: 0; background: transparent;
  color: var(--gold-text); cursor: pointer; font: inherit; }
.lib-rail:hover, .lib-rail:focus-visible { background: var(--warn-bg-soft); color: var(--red2); outline: none; }
.lib-rail-txt { writing-mode: vertical-rl; text-orientation: mixed; font-family: var(--display); letter-spacing: .25em; font-size: .72rem; }
.lib-rail-ico { font-size: .95rem; line-height: 1; }
.lib-min { min-height: 26px; padding: .15rem .45rem; font-size: .68rem; color: var(--red2); border-color: var(--warn-line); white-space: nowrap; }
.lib-min:hover { background: var(--accent); color: var(--on-gold); border-color: var(--accent); }
.lib-resize { position: absolute; top: 0; right: 0; bottom: 0; width: 7px; cursor: col-resize; touch-action: none; z-index: 3; }
.lib-resize:hover, .lib-resize:focus-visible, body.lib-resizing .lib-resize { background: linear-gradient(90deg, transparent 2px, var(--accent) 2px, var(--accent) 4px, transparent 4px); outline: none; }
body.lib-resizing, body.lib-resizing * { cursor: col-resize !important; user-select: none !important; }
.lib-collapsed .lib-body, .lib-collapsed .lib-head, .lib-collapsed .lib-resize { display: none; }
.lib-collapsed .lib-rail { display: flex; }
.day.sel { border-color: var(--warn-line); box-shadow: inset 0 0 0 1px var(--warn-line); }
.day.drop-target { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), 0 0 24px var(--accent-glow); background: var(--warn-bg-soft); }
.day-list { min-height: 44px; }
.day-empty { border: 2px dashed var(--line); border-radius: 8px; padding: .8rem; text-align: center; color: var(--muted); font-size: .8rem; margin-bottom: .5rem; }
.day.drop-target .day-empty { border-color: var(--accent); color: var(--red2); }
.drop-line { position: fixed; height: 4px; margin-top: -2px; background: var(--accent); border-radius: 4px; pointer-events: none; z-index: 60;
  box-shadow: 0 0 10px var(--accent-glow-strong); }
.drop-line::before, .drop-line::after { content: ''; position: absolute; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); }
.drop-line::before { left: -6px; } .drop-line::after { right: -6px; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 70; pointer-events: none; background: var(--panel2); color: var(--strong); border: 1px solid var(--accent);
  border-radius: 8px; padding: .4rem .7rem; font-weight: 800; font-size: .85rem; box-shadow: 0 10px 30px var(--shadow); max-width: 280px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drag-ghost .ghost-copy { display: none; margin-left: .4rem; background: var(--gold); color: var(--on-gold); border-radius: 999px; padding: 0 .4rem; font-size: .7rem; text-transform: uppercase; }
.drag-ghost.copy .ghost-copy { display: inline-block; }
body.dnd-active, body.dnd-active * { cursor: grabbing !important; user-select: none !important; -webkit-user-select: none !important; }
.dnd-src { opacity: .4; outline: 2px dashed var(--accent); outline-offset: 2px; }
.ex.just-added { animation: justAdded 2s ease-out; }
@keyframes justAdded { 0% { box-shadow: 0 0 0 2px var(--gold), 0 0 22px var(--accent-glow-strong); } 100% { box-shadow: none; } }
#copyMode[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
@media (max-width: 760px) {
  .bld-layout, .bld-layout.lib-collapsed, .bld-layout.lib-right:not(.no-lib), .bld-layout.lib-right.lib-collapsed:not(.no-lib) { grid-template-columns: 1fr; }
  .bld-layout.lib-right .lib-panel { order: 0; }
  .lib-side-btn { display: none; }
  .lib-panel { position: sticky; top: var(--topbar-h, 64px); max-height: 46vh; }
  .lib-collapsed .lib-rail { flex-direction: row; justify-content: center; min-height: 0; padding: .4rem; }
  .lib-collapsed .lib-rail-txt { writing-mode: horizontal-tb; }
  .lib-resize { display: none; }
}

/* ---------- library edit drawer / modal / archive ---------- */
.check-inline { display: inline-flex; align-items: center; gap: .4rem; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--text); font-weight: 600; margin: 0; white-space: nowrap; }
.check-inline input { width: auto; min-height: 0; accent-color: var(--accent); }
.filter-bar .check-inline { flex: 0 0 auto; padding: 0 .4rem; }
tr.archived td { opacity: .6; } tr.archived td.row-actions { opacity: 1; }
.badge.arch { background: var(--warn-bg); color: var(--red2); border-color: var(--warn-line); }
.row-actions { white-space: nowrap; text-align: right; } .row-actions .btn + .btn { margin-left: .3rem; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); z-index: 80; background: var(--panel); border-left: 3px solid var(--accent);
  box-shadow: -20px 0 40px var(--shadow); transform: translateX(100%); transition: transform .18s ease-out; }
.drawer.open { transform: none; }
.drawer form { display: flex; flex-direction: column; height: 100%; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: .9rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.drawer-head h2 { margin: 0; color: var(--gold-text); }
.drawer-body { flex: 1; overflow-y: auto; padding: 1rem; }
.drawer-foot { display: flex; gap: .5rem; align-items: center; padding: .8rem 1rem; border-top: 1px solid var(--line); background: var(--panel-alt); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.form-grid .w2 { grid-column: 1 / -1; }
.form-grid textarea { resize: vertical; }
.form-err { color: var(--bad-fg); font-weight: 700; margin: .8rem 0 0; }
.spacer { flex: 1; }
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: var(--backdrop); display: grid; place-items: center; padding: 1rem; }
.modal { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); padding: 1.1rem; width: min(520px, 100%); box-shadow: 0 20px 50px var(--shadow); }
.modal h2 { color: var(--gold-text); }
.modal ul { padding-left: 1.2rem; margin: .4rem 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }
.warn-box { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-fg); border-radius: 8px; padding: .5rem .7rem; font-weight: 700; margin: 0; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.filter-bar .check-inline input { min-width: 0; flex: none; width: auto; }

/* ---------- auth: login / accept / account / invites ---------- */
.login { max-width: 980px; margin: 0 auto; }
.login-form { max-width: 440px; margin: 0 auto 1.2rem; display: grid; gap: .35rem; }
.login-form h2 { color: var(--gold-text); margin-bottom: .3rem; }
.login-form label { margin-top: .45rem; }
.login-form .btn.block { margin-top: .8rem; }
.btn.block { width: 100%; }
.demo-block { border: 1px dashed var(--warn-line); background: linear-gradient(180deg, var(--warn-bg-soft), var(--panel)); margin-top: .5rem; }
.demo-head { display: flex; align-items: center; gap: .6rem; }
.demo-head h3 { margin: 0; color: var(--gold-text); }
.demo-block h4 { font-family: var(--display); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-size: .8rem; margin: .8rem 0 .4rem; }
.demo-block .login-roles { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .4rem 1rem; }
.demo-block code { color: var(--red2); }
.badge.demo { background: var(--warn-bg); color: var(--gold-text); border-color: var(--warn-line); }
.badge.reset { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.who-name { color: var(--text); font-weight: 700; }
.who-name:hover { color: var(--red2); }
.narrow-form { max-width: 460px; display: grid; gap: .35rem; }
.narrow-form label { margin-top: .4rem; }
.narrow-form .btn { margin-top: .7rem; justify-self: start; }
#invPage form.card { display: grid; gap: .35rem; align-content: start; }
#invPage form.card .btn { justify-self: start; margin-top: .6rem; }
.link-box { background: var(--warn-bg-soft); border: 1px solid var(--gold); border-left: 4px solid var(--gold); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1rem; }
.link-box .row { display: flex; gap: .5rem; align-items: center; }
.link-row { margin: .5rem 0 .3rem; }
.link-row input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; color: var(--gold-text); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .5rem; }
.link-box .link-row { flex-wrap: nowrap; } .link-row input { flex: 1; min-width: 0; width: auto; }

/* ---------- builder toolbar, week tabs, density modes ---------- */
.bld-head { align-items: center; margin: .2rem 0 .6rem; }
.bld-head h1 { margin: 0; }
.bld-tools { gap: .4rem; flex-wrap: wrap; align-items: center; }
.bld-tools .tool-sel { width: auto; max-width: 210px; min-height: 32px; padding: .25rem .5rem; font-size: .8rem; }
#libShow[aria-pressed="true"] { border-color: var(--accent); color: var(--red2); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--panel2); color: var(--muted); border: 0; padding: .3rem .6rem; min-height: 32px; font: inherit; font-size: .72rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .05em; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.bld-main { min-width: 0; }
.wk-tabs { display: flex; gap: .3rem; align-items: center; margin-bottom: .5rem; flex-wrap: wrap; }
.wk-tab { position: relative; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: .25rem .7rem; min-height: 30px;
  font-family: var(--display); font-size: .8rem; letter-spacing: .06em; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.wk-tab:hover { color: var(--strong); border-color: var(--warn-line); }
.wk-tab.active { background: var(--accent); color: var(--on-gold); border-color: var(--accent); }
.wk-tab.drag-hover { outline: 2px dashed var(--gold); outline-offset: 2px; color: var(--strong); }
.wk-tab.wk-all { font-family: var(--font); font-weight: 800; font-size: .7rem; text-transform: uppercase; }
.wk-tab .ph { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.ph-hypertrophy { background: var(--ph-hyp) !important; } .ph-strength { background: var(--accent) !important; } .ph-peaking { background: var(--ph-peaking) !important; } .ph-deload { background: var(--ph-deload) !important; }
.wk-hint { margin-left: auto; font-size: .72rem; }
.wk-notes { flex: 1; min-width: 140px; }

/* compact: days side by side, dense two-line exercise rows */
.bld-compact .bld-head h1 { font-size: 1.15rem; line-height: 1.2; }
.bld-compact .bld-head .sub { display: none; }
.bld-compact .week { margin-bottom: .6rem; border-radius: 10px; }
.bld-compact .week-head { padding: .3rem .5rem; gap: .4rem; flex-wrap: nowrap; }
.bld-compact .week-head h2 { font-size: .95rem; color: var(--gold-text); }
.bld-compact .week-head select, .bld-compact .week-head input { min-height: 26px; padding: .1rem .4rem; font-size: .78rem; border-radius: 6px; }
.bld-compact .week-head .btn.sm { min-height: 26px; padding: .1rem .5rem; font-size: .68rem; }
.bld-compact .week-head .badge { font-size: .62rem; }
.bld-compact .week-body { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(176px, 320px); grid-template-columns: none;
  gap: .4rem; padding: .4rem; overflow-x: auto; align-items: start; overscroll-behavior-x: contain; scrollbar-color: var(--line-strong) transparent; }
.bld-compact .day { padding: .3rem; border-radius: 8px; min-width: 0; }
.bld-compact .day-head { gap: .2rem; margin-bottom: .2rem; }
.bld-compact .day-head select, .bld-compact .day-head input { min-height: 24px; padding: .05rem .3rem; font-size: .76rem; border-radius: 6px; }
.bld-compact .day-head .day-dn { width: 46px; flex: none; padding-right: 0; font-weight: 800; color: var(--gold-text); }
.bld-compact .day-head input { flex: 1; min-width: 0; }
.bld-compact .day-head .btn.sm { min-height: 24px; min-width: 24px; padding: 0 .3rem; font-size: .75rem; }
.bld-compact .day-sub { display: flex; gap: .25rem; align-items: center; margin-bottom: .25rem; }
.bld-compact .day-sub .day-warm { min-height: 20px; padding: 0 .25rem; font-size: .66rem; color: var(--muted); border-radius: 5px; flex: 1; min-width: 0; }
.bld-compact .day-count { font-size: .62rem; color: var(--muted); font-weight: 800; white-space: nowrap; text-transform: uppercase; }
.bld-compact .day-list { min-height: 30px; }
.bld-compact .day-empty { padding: .45rem; font-size: .72rem; margin-bottom: .25rem; border-width: 1px; }
.bld-compact .add-ex select { min-height: 24px; padding: 0 .3rem; font-size: .72rem; color: var(--muted); border-style: dashed; border-radius: 6px; }
.bld-compact .add-ex select:focus { color: var(--text); }

.exr { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; column-gap: .15rem;
  padding: .12rem .2rem .12rem 0; margin-bottom: .2rem; border-radius: 6px; border-left-width: 3px; }
.exr .ex-grip { padding: .3rem .2rem; font-size: .9rem; align-self: stretch; display: flex; align-items: center; }
.exr-hit { min-width: 0; cursor: pointer; padding: .05rem .1rem; border-radius: 4px; outline: none; }
.exr-hit:focus-visible { box-shadow: 0 0 0 1px var(--accent); }
.exr:hover { border-color: var(--warn-line); }
.exr-l1 { display: flex; gap: .25rem; align-items: baseline; min-width: 0; }
.exr-lbl { font-size: .62rem; font-weight: 900; color: var(--on-gold); background: var(--gold); border-radius: 3px; padding: 0 .2rem; flex: none; }
.exr-name { font-weight: 700; font-size: .76rem; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exr-note { font-size: .62rem; color: var(--muted); flex: none; }
.exr-sum { font-size: .7rem; line-height: 1.25; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.exr-kg { color: var(--red2); font-weight: 800; }
.exr-car { color: var(--muted); font-size: .65rem; padding: 0 .15rem; cursor: pointer; }
.exr.open { border-color: var(--accent); background: var(--warn-bg-soft); }
.exr.open .exr-car { color: var(--accent-text); }
.exr-edit { grid-column: 1 / -1; padding: .3rem .25rem .15rem .4rem; border-top: 1px dashed var(--line); margin-top: .15rem; }
.exr-edit select, .exr-edit input { min-height: 24px; padding: .05rem .3rem; font-size: .76rem; border-radius: 5px; }
.exr-edit > .ex-pick { margin-bottom: .25rem; font-weight: 700; }
.exr-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem .25rem; }
.exr-grid label { font-size: .56rem; margin: 0; letter-spacing: .04em; }
.exr-grid .exr-full { grid-column: 1 / -1; }
.exr-acts { display: flex; gap: .2rem; align-items: center; margin-top: .3rem; flex-wrap: wrap; }
.exr-acts .btn.icon.sm { min-height: 24px; min-width: 24px; padding: 0 .3rem; font-size: .75rem; }
.exr-acts a { font-size: .7rem; }
.exr-done { margin-left: auto; min-height: 24px; padding: 0 .6rem; background: var(--accent); color: var(--on-gold); border-color: var(--accent); }
.bld-compact .ex.just-added { animation: justAdded 2s ease-out; }
.bld-compact .lib-head { padding: .4rem .5rem; }
.bld-compact .lib-body { padding: .45rem; gap: .35rem; }
.bld-compact .lib-body input[type=search] { min-height: 32px; padding: .3rem .5rem; font-size: .85rem; }
.bld-compact .lib-filters select { min-height: 28px; font-size: .74rem; }
.bld-compact .lib-item { padding: .22rem .3rem; }
.bld-compact .lib-name { font-size: .8rem; }
.bld-compact .lib-add { min-width: 26px; min-height: 26px; }
@media (pointer: coarse) {
  .exr .ex-grip { padding: .4rem .35rem; font-size: 1.05rem; }
  .bld-compact .day-head .btn.sm, .exr-acts .btn.icon.sm { min-height: 30px; min-width: 30px; }
}
@media (max-width: 760px) { .wk-hint { display: none; } .bld-compact .week-head { flex-wrap: wrap; } }

.container.bld-page { padding-bottom: 1rem; }
.bld-compact .lib-panel { max-height: min(calc(100vh - var(--topbar-h, 64px) - 24px), calc(100vh - var(--lib-off, 0px))); }
.btn .ico { display: block; }

/* ---------- set types ---------- */
.st-badge { display: inline-flex; align-items: center; font-size: .58rem; font-weight: 900; letter-spacing: .06em; line-height: 1; padding: .18rem .32rem; border-radius: 4px;
  color: var(--st); background: color-mix(in srgb, var(--st) 16%, transparent); border: 1px solid color-mix(in srgb, var(--st) 55%, transparent); white-space: nowrap; vertical-align: middle; flex: none; }
.exr-st { color: var(--muted); font-size: .64rem; }
.exr-stgrid { margin-bottom: .3rem; padding-bottom: .3rem; border-bottom: 1px dashed var(--line); }
.st-explain { font-size: .78rem; color: var(--text-2); background: var(--warn-bg-soft); border-left: 3px solid var(--gold); padding: .3rem .5rem; border-radius: 4px; margin: .35rem 0; line-height: 1.35; }
.exr-edit .st-explain { font-size: .68rem; padding: .2rem .35rem; }
.st-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: flex-end; margin-top: .4rem; }
.st-row label { font-size: .6rem; margin: 0; flex: 1 1 110px; }
.st-row select, .st-row input { min-height: 32px; padding: .2rem .4rem; font-size: .85rem; }
.ss-block { border: 1px solid color-mix(in srgb, var(--st) 50%, var(--line)); border-left: 4px solid var(--st); border-radius: var(--radius); padding: .6rem .6rem .1rem 1.1rem; margin-bottom: 1rem; position: relative;
  background: linear-gradient(90deg, color-mix(in srgb, var(--st) 8%, transparent), transparent 40%); }
.ss-block::before { content: ''; position: absolute; left: .45rem; top: 3.2rem; bottom: 1.2rem; width: 6px; border: 2px solid var(--st); border-right: 0; border-radius: 6px 0 0 6px; }
.ss-head { font-size: .85rem; margin-bottom: .2rem; }
.ss-block .wo-ex { margin-bottom: .6rem; }
.badge.ss-lbl { background: var(--st-ss); color: var(--on-gold); border-color: var(--st-ss); }
.sets td.tgt { font-size: .8rem; color: var(--text-2); white-space: nowrap; }
.sets tr.part-row td { padding-top: .15rem; padding-bottom: .15rem; background: var(--panel-alt); }
.sets tr.part-row .setno { color: var(--accent-text); }
.sets tr.amrap .setno { color: var(--danger); }
.clu-in { display: flex; gap: .25rem; flex-wrap: wrap; }
.clu-in label { font-size: .55rem; margin: 0; text-align: center; }
.clu-in input { width: 44px; min-height: 34px; padding: .2rem; text-align: center; }
.st-legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: .6rem; }
.st-legend-item { display: flex; gap: .55rem; align-items: flex-start; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.st-legend-item .st-badge { margin-top: .15rem; min-width: 46px; justify-content: center; }
.st-eg { color: var(--red2); margin-top: .15rem; }
.plate-btn { margin-left: .2rem; background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 6px; min-width: 28px; min-height: 28px; cursor: pointer; vertical-align: middle; }
.plate-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.sets td:has(> .plate-btn) { white-space: nowrap; }
.sets td > .stepper, .sets td > .step { display: inline-flex; vertical-align: middle; }

/* stacked weeks: slim foldable headers + sticky jump list */
.wk-jump { position: sticky; top: var(--topbar-h, 64px); z-index: 4; display: flex; gap: .25rem; align-items: center; padding: .25rem .4rem; margin-bottom: .45rem;
  background: var(--glass); backdrop-filter: blur(4px); border: 1px solid var(--line); border-radius: 8px; }
.wk-jump-lbl { font-size: .6rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-right: .2rem; }
.wk-jump-btn { background: transparent; color: var(--muted); border: 1px solid transparent; border-radius: 6px; padding: .1rem .45rem; font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer; display: inline-flex; gap: .25rem; align-items: center; }
.wk-jump-btn:hover { color: var(--text); border-color: var(--line); background: var(--panel2); }
.week { scroll-margin-top: calc(var(--topbar-h, 64px) + 44px); }
.week.just-added { animation: justAdded 1.6s ease-out; }
.wk-fold { min-width: 26px; padding: 0 .3rem; color: var(--gold-text); }
.week.folded .week-head { border-bottom: 0; }
.wk-sum { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.week-head .spacer { flex: 1; }
.bld-compact .week-head .wk-fold { min-height: 24px; }

/* ---------- form checks ---------- */
.fc { margin-top: .5rem; padding-top: .45rem; border-top: 1px dashed var(--line); }
.fc-row { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.fc-lbl { font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fc-row select { width: auto; min-height: 32px; padding: .2rem .4rem; font-size: .8rem; }
.fc-up { cursor: pointer; }
.fc-list { list-style: none; margin: .35rem 0 0; padding: 0; display: grid; gap: .2rem; }
.fc-list li { display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.fc-list.big li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.new-dot { color: var(--on-gold); background: var(--gold); border-radius: 999px; padding: 0 .35rem; font-size: .65rem; text-transform: uppercase; }
.video-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
.video-card video { width: 100%; max-height: 70vh; background: var(--media-bg); border-radius: 8px; }
.vc-list { display: grid; gap: .5rem; max-height: 55vh; overflow: auto; margin-bottom: .6rem; }
.vc { display: flex; gap: .5rem; padding: .45rem .55rem; border-radius: 8px; background: var(--panel2); border-left: 3px solid var(--line); }
.vc.from-coach { border-left-color: var(--accent); }
.vc.from-athlete { border-left-color: var(--athlete-blue); }
.vc-t { flex: none; background: var(--accent); color: var(--on-gold); border: 0; border-radius: 6px; font-weight: 800; font-size: .75rem; padding: .1rem .4rem; height: fit-content; cursor: pointer; }
.vc-form textarea { width: 100%; }
@media (max-width: 860px) { .video-layout { grid-template-columns: 1fr; } }

/* ---------- review inbox ---------- */
.nav-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: .3rem; padding: 0 .3rem; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-size: .68rem; font-weight: 900; vertical-align: 1px; }
.ib-filters { display: flex; gap: .35rem; flex-wrap: wrap; margin: .2rem 0 .8rem; }
.ib-chip { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .65rem; font: inherit; font-size: .8rem; font-weight: 700; cursor: pointer; }
.ib-chip b { color: var(--muted); margin-left: .2rem; }
.ib-chip[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.ib-chip[aria-pressed="true"] b { color: var(--on-gold); }
#ibList { display: grid; gap: .5rem; }
.ib-item { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; transition: opacity .2s, transform .2s; }
.ib-item.lvl-info { border-left-color: var(--blue); } .ib-item.lvl-warn { border-left-color: var(--accent); } .ib-item.lvl-danger { border-left-color: var(--danger); }
.ib-item.gone { opacity: 0; transform: translateX(30px); }
.ib-head { display: grid; grid-template-columns: minmax(180px, 240px) 1fr auto; gap: .75rem; align-items: center; padding: .55rem .75rem; cursor: pointer; }
.ib-head:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; border-radius: 10px; }
.ib-who { display: flex; flex-direction: column; min-width: 0; }
.ib-flags { display: flex; gap: .3rem; flex-wrap: wrap; }
.ib-act { display: flex; gap: .35rem; }
.flag { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .5rem; border-radius: 6px; font-size: .74rem; font-weight: 700; background: var(--panel2); border: 1px solid var(--line); white-space: nowrap; }
.flag.lvl-info { color: var(--info-fg); border-color: var(--info-line); background: var(--info-bg); }
.flag.lvl-warn { color: var(--warn-fg); border-color: var(--warn-line); background: var(--warn-bg); }
.flag.lvl-danger { color: var(--bad-fg); border-color: var(--bad-line); background: var(--bad-bg); }
.flag.ok { color: var(--ok-fg); border-color: var(--ok-line); background: var(--ok-bg); }
.ib-detail { padding: 0 .75rem .7rem; border-top: 1px solid var(--line); }
.ib-note { margin: .5rem 0 .2rem; font-size: .85rem; }
.ib-note.pain { color: var(--bad-fg); }
.ib-tbl { margin-top: .4rem; font-size: .84rem; }
.ib-tbl td { vertical-align: top; }
.ib-tbl tr.has-issue td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.ls { display: inline-block; margin: 0 .25rem .2rem 0; padding: .05rem .35rem; border-radius: 5px; background: var(--panel2); font-variant-numeric: tabular-nums; font-size: .8rem; white-space: nowrap; }
.ls i { font-style: normal; color: var(--muted); margin-left: .15rem; }
.ls.bad { background: var(--bad-bg-2); color: var(--bad-fg); } .ls.off { background: var(--warn-bg); color: var(--warn-fg); }
.ib-fb { color: var(--muted); font-style: italic; margin-top: .15rem; }
.warn-t { color: var(--warn-fg); }
@media (max-width: 760px) { .ib-head { grid-template-columns: 1fr; } }

/* ---------- session notes, set notes, discussion ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sn-td { width: 34px; }
.note-btn { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: .85rem; }
.note-btn:hover { color: var(--text); border-color: var(--muted); }
.note-btn.has { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
tr.note-row td { padding-top: 0; }
tr.note-row input { width: 100%; min-height: 34px; font-size: .85rem; }
.cmt-ex { margin-right: .35rem; }
.sess-notes textarea { width: 100%; }
.cm-card .cm-list { display: grid; gap: .55rem; margin-bottom: .7rem; }
.cm-thread { display: grid; gap: .35rem; }
.cm { padding: .5rem .65rem; border-radius: 9px; background: var(--panel2); border-left: 3px solid var(--line); }
.cm.from-coach { border-left-color: var(--accent); }
.cm.from-athlete { border-left-color: var(--athlete-blue); }
.cm.reply { margin-left: 1.6rem; }
.cm.flash { animation: cmflash 1.4s ease-out; }
@keyframes cmflash { from { box-shadow: 0 0 0 2px var(--gold); } to { box-shadow: 0 0 0 2px transparent; } }
.cm-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .85rem; }
.cm-ctx { font-size: .72rem; font-weight: 800; padding: .05rem .4rem; border-radius: 5px; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); }
.cm-body { margin-top: .2rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm-form, .cm-rform { display: grid; gap: .4rem; }
.cm-rform { margin-left: 1.6rem; }
.cm-form select { width: auto; max-width: 100%; }
.cm-form textarea, .cm-rform textarea { width: 100%; }
.link-btn { background: none; border: 0; color: var(--red2); font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; padding: .1rem .25rem; }
.link-btn.danger { color: var(--bad-fg); }
.link-btn:hover { text-decoration: underline; }
table.sets tr.note-row input { text-align: left; font-weight: 500; font-size: .85rem; padding: .3rem .6rem; }

/* ---------- pain / injury ---------- */
.danger-btn { background: var(--bad-bg); border: 1px solid var(--bad-line); color: var(--bad-fg); }
.danger-btn:hover { background: var(--bad-bg-2); }
.pain-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.pain-item { display: flex; gap: .6rem; align-items: center; padding: .4rem .5rem; border-radius: 8px; background: var(--panel2); }
.pain-item.resolved { opacity: .6; }
.pain-txt { flex: 1; min-width: 0; font-size: .88rem; }
.pain-act { display: flex; gap: .3rem; align-items: center; }
.sev { display: inline-grid; place-items: center; min-width: 30px; height: 30px; border-radius: 8px; font-weight: 900; font-size: .9rem; color: var(--on-gold); flex: none; }
.sev-lo { background: var(--sev-lo); } .sev-mid { background: var(--sev-mid); } .sev-hi { background: var(--sev-hi); color: var(--on-danger); }
.pain-form { margin-top: .6rem; padding-top: .6rem; border-top: 1px dashed var(--line); display: grid; gap: .5rem; }
.pain-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .6rem .9rem; align-items: start; }
.pain-grid label { display: grid; gap: .25rem; }
.pain-sev input[type=range] { width: 100%; accent-color: var(--accent); }
.pain-sev .sev { min-width: 26px; height: 24px; font-size: .8rem; margin-left: .3rem; }
.pain-note { grid-column: 1 / -1; }
.pain-past summary { cursor: pointer; margin: .5rem 0 .3rem; }
.ib-pain { margin-bottom: .8rem; border-color: var(--bad-line); }
.pain-grid input, .pain-grid select, .pain-grid .muted { font-weight: 500; text-transform: none; letter-spacing: normal; }
.pain-grid input:not([type=range]) { font-size: .9rem; }
.pain-sev-h { display: flex; align-items: center; gap: .3rem; }
.pain-grid .seg { width: fit-content; }

/* ---------- weekly check-ins ---------- */
.ok-t { color: var(--ok-fg); }
.ready-pill { align-self: center; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--gold); color: var(--gold-text); font-weight: 800; }
.ready-pill b { font-size: 1.2rem; }
.ci-form { display: grid; gap: 1rem; margin-bottom: 1rem; }
.ci-sliders { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .9rem 1.4rem; }
.ci-sl label { margin: 0; }
.ci-sl input[type=range] { width: 100%; height: 28px; }
.ci-val { display: inline-grid; place-items: center; min-width: 34px; height: 30px; border-radius: 8px; background: var(--c); color: var(--on-c); font-weight: 900; font-size: 1rem; }
.ci-ends { display: flex; justify-content: space-between; }
.ci-row2 { display: grid; grid-template-columns: 200px 1fr; gap: 1rem; }
.ci-row2 textarea, .ci-row2 input { width: 100%; }
.ci-photos { display: grid; gap: .4rem; justify-items: start; }
.ci-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; }
.ci-th { position: relative; margin: 0; width: 92px; height: 120px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--media-bg); }
.ci-th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ci-th button { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--overlay); color: var(--on-danger); cursor: pointer; }
.ci-add { cursor: pointer; text-transform: none; letter-spacing: 0; }
.ci-charts { display: grid; grid-template-columns: 3fr 2fr; gap: 1.2rem; }
.ci-charts h3 { font-size: .8rem; color: var(--muted); margin-bottom: .3rem; }
.chart { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ch-y, .ch-x { fill: var(--chart-text); font-size: 11px; font-family: var(--font); }
.ch-y { text-anchor: end; } .ch-x { text-anchor: middle; }
.ch-legend { display: flex; gap: .8rem; flex-wrap: wrap; font-size: .75rem; color: var(--muted); margin-top: .2rem; }
.ch-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; vertical-align: -1px; }
.ci-day { gap: .4rem; margin: 0; }
.ci-day select { width: auto; min-height: 32px; text-transform: none; letter-spacing: 0; font-weight: 600; }
.ci-latest { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; margin-bottom: .5rem; }
.ci-latest .stat { display: grid; gap: .1rem; padding: .45rem .6rem; border-radius: 8px; background: var(--panel2); }
.ci-latest .stat span { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ci-latest .stat b { font-size: 1.35rem; }
.ready-hint { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; padding: .45rem .7rem; border-radius: 8px; background: var(--warn-bg-soft); border: 1px solid var(--warn-line); font-size: .85rem; }
.ready-hint.same { background: var(--panel2); border-color: var(--line); }
@media (max-width: 760px) { .ci-row2, .ci-charts { grid-template-columns: 1fr; } }
label input:not([type=checkbox]):not([type=radio]), label textarea, label select { font-weight: 500; text-transform: none; letter-spacing: normal; }

/* ---------- plate calculator + warm-up ramp ---------- */
.plate-btn { width: 28px; height: 28px; margin-left: .2rem; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; vertical-align: middle; }
.plate-btn:hover, .plate-btn:focus-visible { color: var(--gold-text); border-color: var(--gold); }
.plate-pop { position: fixed; z-index: 60; width: 300px; padding: .7rem .8rem; border-radius: 12px; background: var(--popover); border: 1px solid var(--gold); box-shadow: 0 12px 40px var(--shadow); display: grid; gap: .55rem; }
.pp-head { display: flex; align-items: center; justify-content: space-between; }
.pp-x { background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; line-height: 1; }
.pp-kg { display: flex; align-items: center; gap: .45rem; margin: 0; }
.pp-kg input { width: 110px; font-size: 1.15rem; font-weight: 800; text-align: center; }
.pp-list { display: flex; gap: .3rem; flex-wrap: wrap; margin-top: .2rem; }
.pp-chip { padding: .15rem .5rem; border-radius: 6px; font-weight: 800; font-size: .85rem; background: var(--panel2); border-left: 5px solid var(--pc); }
.pp-cfg { display: grid; gap: .3rem; }
.pp-cus { display: flex; align-items: center; gap: .4rem; margin: 0; }
.pp-cus input { width: 80px; }
.pv { display: flex; align-items: center; height: 70px; padding: 0 .2rem; }
.pv.sm { height: 28px; padding: 0; }
.pv-bar { width: 46px; height: 8px; background: linear-gradient(var(--metal-1), var(--metal-2)); border-radius: 2px 0 0 2px; }
.pv.sm .pv-bar { width: 12px; height: 4px; }
.pv-p { display: inline-block; margin-left: 2px; border-radius: 2px; box-shadow: inset 0 0 0 1px var(--plate-edge); }
.pv-c { display: inline-block; width: 7px; margin-left: 2px; background: var(--metal-3); border-radius: 2px; }
.pv.sm .pv-c { width: 3px; }
.pv-end { width: 26px; height: 6px; background: linear-gradient(var(--metal-1), var(--metal-2)); border-radius: 0 2px 2px 0; }
.pv.sm .pv-end { width: 8px; height: 3px; }
.ramp { margin: .4rem 0 .5rem; border: 1px solid var(--line); border-radius: 9px; background: var(--panel-alt); }
.ramp > summary { cursor: pointer; padding: .4rem .6rem; list-style: none; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.ramp > summary::-webkit-details-marker { display: none; }
.ramp > summary::before { content: '▸'; color: var(--gold-text); }
.ramp[open] > summary::before { content: '▾'; }
.ramp > p { margin: .2rem .6rem .5rem; }
.ramp-tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.ramp-tbl th { text-align: left; font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: .2rem .5rem; }
.ramp-tbl td { padding: .25rem .5rem; border-top: 1px solid var(--line); }
.ramp-tbl tr.done td { opacity: .45; }
.ramp-tbl tr.done td b { text-decoration: line-through; }
.ramp-tbl input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--gold); }
.ramp-pl { display: flex; align-items: center; gap: .5rem; }
.pv-p { box-shadow: inset 0 0 0 1px var(--plate-edge-hi); }

/* ---------- notification bell ---------- */
.bell-btn { position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; vertical-align: middle; margin-right: .3rem; }
.bell-btn:hover, .bell-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold-text); }
.bell-n { position: absolute; top: -6px; right: -6px; min-width: 19px; height: 19px; padding: 0 .3rem; border-radius: 999px; background: var(--danger); color: var(--on-danger); font-size: .68rem; font-weight: 900; display: grid; place-items: center; border: 2px solid var(--topbar-2); }
.bell-panel { position: fixed; z-index: 70; width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 560px); display: flex; flex-direction: column; background: var(--popover); border: 1px solid var(--gold); border-radius: 12px; box-shadow: 0 16px 50px var(--shadow); }
.bp-head { display: flex; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.bp-list { overflow: auto; }
.bp-item { display: flex; gap: .6rem; padding: .6rem .8rem; color: var(--text); border-bottom: 1px solid var(--line); text-decoration: none !important; }
.bp-item:hover { background: var(--panel2); }
.bp-item.unread { background: var(--warn-bg-soft); }
.bp-item.unread .bp-txt b::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: .35rem; border-radius: 50%; background: var(--gold); vertical-align: 1px; }
.bp-ic { flex: none; width: 26px; text-align: center; font-size: 1rem; }
.bp-txt { display: grid; gap: .1rem; font-size: .86rem; min-width: 0; }
.bp-body { color: var(--muted); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bp-empty { padding: 1rem; }

/* ---------- comp-day mode (mobile-first, big targets) ---------- */
.cd { max-width: 560px; margin: 0 auto; display: grid; gap: .8rem; }
.cd-top { display: flex; align-items: center; gap: .6rem; }
.cd-title { flex: 1; display: grid; min-width: 0; }
.cd-title b { font-family: var(--display); text-transform: uppercase; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cd-clock { font-family: var(--display); font-size: 1.3rem; color: var(--gold-text); font-variant-numeric: tabular-nums; }
.cd-total { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 14px; background: linear-gradient(135deg, var(--warn-bg), var(--panel) 70%); border: 2px solid var(--gold); position: sticky; top: 68px; z-index: 5; }
.cd-total.bombed { border-color: var(--danger); background: linear-gradient(135deg, var(--bad-bg), var(--panel) 70%); }
.cd-total > div:first-child { display: grid; }
.cd-k { font-size: .7rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cd-big { font-family: var(--display); font-size: 2.2rem; line-height: 1; color: var(--text); font-variant-numeric: tabular-nums; }
.cd-big small { font-size: .9rem; color: var(--muted); }
.cd-bests { display: grid; gap: .15rem; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.cd-bests i { font-style: normal; color: var(--muted); font-size: .7rem; margin-right: .35rem; }
.cd-bests .bomb { color: var(--bad-fg); }
.cd-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.cd-tabs button { min-height: 58px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-family: var(--display); text-transform: uppercase; font-size: .95rem; cursor: pointer; display: grid; place-items: center; gap: .1rem; }
.cd-tabs button small { font-family: var(--font); font-size: .72rem; color: var(--muted); text-transform: none; }
.cd-tabs button[aria-selected="true"] { background: var(--gold); border-color: var(--gold); color: var(--on-gold); }
.cd-tabs button[aria-selected="true"] small { color: var(--on-gold-muted); }
.cd-sec { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: .8rem; display: grid; gap: .6rem; }
.cd-sec h2 { margin: 0; display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.cd-att { border: 1px solid var(--line); border-radius: 12px; padding: .7rem; display: grid; gap: .55rem; background: var(--panel-alt); }
.cd-att.is-next { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.cd-att.made { border-color: var(--ok-line); background: var(--ok-bg); }
.cd-att.missed { border-color: var(--bad-line); background: var(--bad-bg); }
.cd-att-h { display: flex; align-items: center; gap: .6rem; }
.cd-w { margin-left: auto; font-family: var(--display); font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.cd-res { font-weight: 900; font-size: .8rem; padding: .2rem .5rem; border-radius: 6px; }
.cd-res.made { background: var(--green); color: var(--on-green); } .cd-res.missed { background: var(--danger); color: var(--on-danger); }
.cd-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; }
.cd-pick button { min-height: 64px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-family: var(--display); font-size: 1.25rem; cursor: pointer; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.cd-pick button small { font-family: var(--font); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.cd-pick button[aria-pressed="true"] { border-color: var(--gold); background: var(--warn-bg); color: var(--gold-text); }
.cd-adj { display: flex; align-items: center; gap: .5rem; }
.cd-adj span { flex: 1; text-align: center; font-size: .82rem; color: var(--muted); }
.cd-adj span b { color: var(--text); }
.cd-adj button { min-width: 64px; min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-weight: 900; cursor: pointer; }
.cd-judge { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cd-judge button { min-height: 68px; border-radius: 14px; border: 0; font: inherit; font-family: var(--display); font-size: 1.15rem; text-transform: uppercase; cursor: pointer; }
.cd-good { background: var(--green); color: var(--on-green); } .cd-bad { background: var(--danger); color: var(--on-danger); }
.cd-good:active, .cd-bad:active { transform: scale(.98); }
.cd-row { display: flex; align-items: center; gap: .5rem; }
.cd-warn { margin: 0; color: var(--warn-fg); }
.cd-tl { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.cd-tl li { display: grid; grid-template-columns: 74px 1fr auto; gap: .6rem; align-items: center; padding: .5rem .6rem; border-radius: 10px; background: var(--panel2); border-left: 4px solid var(--line); }
.cd-tl li.next { border-left-color: var(--gold); background: var(--warn-bg); }
.cd-tl li.done { opacity: .55; }
.cd-tl li.cd-open { border-left-color: var(--green); grid-template-columns: 74px 1fr; }
.cd-t { display: grid; font-variant-numeric: tabular-nums; }
.cd-t b { font-size: 1.05rem; } .cd-t small, .cd-wu small { color: var(--muted); font-size: .72rem; }
.cd-wu { display: grid; }
.cd-wu b { font-size: 1.05rem; }
.cd-done { min-width: 76px; min-height: 52px; border-radius: 12px; border: 1px solid var(--gold); background: transparent; color: var(--gold-text); font: inherit; font-weight: 900; text-transform: uppercase; cursor: pointer; }
.cd-done[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); }
.cd-final { border-color: var(--gold); text-align: center; }
@media (max-width: 600px) { .cd-total { top: 0; } .cd-big { font-size: 1.9rem; } }
/* comp-day is a focused screen: hide the app chrome, keep the total pinned */
body.cd-mode .topbar { display: none; }
body.cd-mode .cd-total { top: 0; }
body.cd-mode .container { padding-top: .6rem; }
.cd-adj small { font-size: .72rem; }

/* ---------- export menu ---------- */
.exp-menu { position: relative; display: inline-block; }
.exp-menu > summary { list-style: none; cursor: pointer; }
.exp-menu > summary::-webkit-details-marker { display: none; }
.exp-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 210px; display: grid; padding: .3rem; border-radius: 10px; background: var(--panel); border: 1px solid var(--gold); box-shadow: 0 10px 30px var(--shadow); }
.exp-pop a { display: grid; padding: .45rem .6rem; border-radius: 7px; color: var(--text); text-decoration: none !important; }
.exp-pop a:hover, .exp-pop a:focus-visible { background: var(--panel2); }
.exp-pop small { color: var(--muted); font-size: .75rem; }

/* ---------- theme toggle ---------- */
.theme-wrap { position: relative; }
.theme-btn { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--gold-text); cursor: pointer; }
.theme-btn:hover, .theme-btn[aria-expanded="true"] { border-color: var(--gold); }
.theme-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 80; min-width: 170px; display: grid; padding: .3rem; border-radius: 10px; background: var(--popover); border: 1px solid var(--line); box-shadow: 0 12px 30px var(--shadow); }
.theme-menu button { display: flex; align-items: center; gap: .55rem; padding: .5rem .6rem; border: 0; border-radius: 7px; background: transparent; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; text-align: left; min-height: 40px; }
.theme-menu button small { margin-left: auto; color: var(--muted); font-weight: 600; }
.theme-menu button:hover, .theme-menu button:focus-visible { background: var(--panel2); outline: none; }
.theme-menu button[aria-checked="true"] { color: var(--gold-text); box-shadow: inset 3px 0 0 var(--gold); }
.theme-menu svg { flex: none; }
/* ---------- login hero logo ---------- */
.hero-logo { display: inline-grid; place-items: center; margin-bottom: .6rem; }
.hero-logo img { height: 96px; max-width: 260px; }
/* ---------- branding page ---------- */
.br-previews { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.br-pv { margin: 0; display: grid; place-items: center; gap: .35rem; padding: .9rem .5rem .5rem; border-radius: 10px; border: 1px solid var(--line); }
.br-pv img { height: 84px; width: auto; max-width: 100%; object-fit: contain; }
.br-pv.sm { padding: .4rem; } .br-pv.sm img { height: 44px; }
.br-pv figcaption { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.br-on-dark { background: #0d0d0f; color: #9a9aa6; } /* fixed preview swatches: always show both backgrounds */
.br-on-light { background: #ffffff; color: #5d5d69; }
.br-header-pv { display: flex; align-items: center; gap: .55rem; margin: .8rem 0 .4rem; padding: .5rem .7rem; border-radius: 10px; background: linear-gradient(180deg, var(--topbar-1), var(--topbar-2)); border-bottom: 3px solid var(--gold); }
.br-fake-nav { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.br-accent input[type="color"] { width: 54px; height: 42px; padding: 2px; cursor: pointer; }
.br-hex { width: 110px !important; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.br-swatches { display: flex; align-items: center; gap: .8rem; margin: .8rem 0 .4rem; flex-wrap: wrap; }
.br-slot { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: .8rem; align-items: center; padding: .8rem 0; border-top: 1px solid var(--line); }
.br-slot:first-of-type { border-top: 0; }
.br-slot-info { display: grid; gap: .15rem; }
.br-local { display: flex; gap: .4rem; }
.br-local[hidden] { display: none; }
.br-slot .br-err { grid-column: 1 / -1; margin: 0; }
@media (max-width: 720px) { .br-slot { grid-template-columns: 1fr; } }
/* ---------- light-theme specifics ---------- */
:root[data-theme="light"] .st-badge, :root[data-theme="light"] [class*="st-tag"] { color: color-mix(in srgb, var(--st) 62%, var(--strong)); }
:root[data-theme="light"] .topbar { box-shadow: 0 1px 8px var(--shadow); }
:root[data-theme="light"] .card, :root[data-theme="light"] .stat { box-shadow: 0 1px 2px var(--shadow); }
:root[data-theme="light"] .day-head, :root[data-theme="light"] .week-head { color: var(--text); }
.br-slots { margin-top: 1rem; }
/* ---------- warm-up routines ---------- */
.wu-grid { align-items: start; }
.wu-item h3 a { color: var(--text); }
.wu-item.is-arch { opacity: .7; }
.wu-meta { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: .4rem; }
.wu-sec + .wu-sec { margin-top: .7rem; }
.wu-sec h4 { margin: 0 0 .3rem; font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gold-text); }
.wu-steps { margin: 0; padding-left: 1.3rem; display: grid; gap: .35rem; }
.wu-steps li { line-height: 1.35; }
.wu-steps li > span { margin-right: .45rem; }
.wu-rx { color: var(--text-2); font-variant-numeric: tabular-nums; }
.wu-note { display: block; font-size: .82rem; }
.ex-free { font-weight: 700; }
.add-ex { display: flex; gap: .35rem; align-items: center; }
.add-ex .ex-pick { flex: 1; min-width: 0; }
.add-ex [data-addfree] { flex: none; white-space: nowrap; }
.bld-warm .week { border: 0; background: transparent; }
.bld-warm .week-body { padding-top: 0; }

/* ---------- direct messages ---------- */
.container.msg-page { max-width: 1280px; padding-bottom: 0; }
.msg-wrap { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; min-height: 380px; }
.msg-wrap.solo { grid-template-columns: minmax(0, 1fr); max-width: 860px; margin: 0 auto; }
.msg-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel2); min-height: 0; min-width: 0; }
.ml-head { display: flex; align-items: center; gap: .5rem; padding: .8rem .9rem .4rem; }
.ml-head h1 { font-size: 1.25rem; margin: 0; }
.ml-search { margin: .3rem .9rem .6rem; width: calc(100% - 1.8rem); box-sizing: border-box; }
.ml-items { overflow-y: auto; flex: 1; min-height: 0; }
.ml-item { display: flex; gap: .65rem; align-items: center; padding: .65rem .9rem; color: var(--text); text-decoration: none; border-left: 3px solid transparent; border-bottom: 1px solid var(--line); }
.ml-item:hover { background: var(--row-hover); }
.ml-item.on { background: var(--row-hover); border-left-color: var(--accent); }
.ml-item.unread .ml-prev { color: var(--strong); font-weight: 700; }
.ml-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: .1rem; }
.ml-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ml-top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-top .small { white-space: nowrap; }
.ml-prev { color: var(--muted); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-n { min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 999px; background: var(--gold); color: var(--on-gold); font-size: .7rem; font-weight: 900; display: grid; place-items: center; }
.av { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); border: 1px solid var(--line-strong); color: var(--strong); font-weight: 800; font-size: .8rem; letter-spacing: .02em; }
.av.lg { width: 40px; height: 40px; }
.msg-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.mt-head { display: flex; align-items: center; gap: .65rem; padding: .65rem .9rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.mt-title { display: flex; flex-direction: column; min-width: 0; }
.mt-title b { font-size: 1rem; }
.mt-back { display: none; }
.mt-scroll { flex: 1; overflow-y: auto; padding: .8rem 1rem 1rem; background: var(--bg); min-height: 0; overscroll-behavior: contain; }
.mt-more { display: block; margin: 0 auto .6rem; }
.mt-empty { margin: auto; text-align: center; padding: 2rem; max-width: 360px; }
.mt-empty-ic { font-size: 2.2rem; }
.mt-loading { padding: 1.5rem; }
.msg-day { text-align: center; margin: .9rem 0 .5rem; }
.msg-day span { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--panel2); padding: .15rem .6rem; border-radius: 999px; border: 1px solid var(--line); }
.msg { display: flex; flex-direction: column; max-width: min(78%, 560px); margin: .18rem 0; }
.msg.me { margin-left: auto; align-items: flex-end; }
.msg.them { align-items: flex-start; }
.msg-author { font-size: .74rem; font-weight: 800; color: var(--muted); margin: .45rem .3rem .15rem; }
.badge.xs { font-size: .58rem; padding: .05rem .35rem; vertical-align: 1px; }
.bubble { padding: .5rem .7rem; border-radius: 16px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); overflow-wrap: anywhere; line-height: 1.4; display: flex; flex-direction: column; gap: .35rem; }
.msg.them .bubble { border-bottom-left-radius: 5px; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); border-color: transparent; border-bottom-right-radius: 5px; }
.msg.me .bubble a:not(.msg-chip) { color: inherit; text-decoration: underline; }
.msg.del .bubble { background: transparent; color: var(--muted); border-style: dashed; }
.msg-time { font-size: .7rem; color: var(--muted); margin: .12rem .35rem 0; }
.msg-time .link-btn { font-size: .7rem; padding: 0; color: var(--muted); }
.msg-time .seen { color: var(--accent-text); font-weight: 700; }
.msg-photo img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; background: var(--media-bg); }
.msg-video { display: block; width: 100%; max-width: 360px; max-height: 360px; border-radius: 10px; background: var(--media-bg); }
.msg-voice { display: flex; align-items: center; gap: .4rem; }
.msg-voice audio { height: 36px; max-width: 260px; }
.msg-chip { display: inline-flex; align-items: center; gap: .3rem; align-self: flex-start; font-size: .78rem; font-weight: 700; padding: .25rem .55rem; border-radius: 999px; background: var(--sunken); color: var(--text); border: 1px solid var(--line-strong); text-decoration: none; cursor: pointer; font-family: inherit; }
.msg.me .msg-chip { background: color-mix(in srgb, var(--on-accent) 12%, transparent); color: var(--on-accent); border-color: color-mix(in srgb, var(--on-accent) 30%, transparent); }
.msg-chip.fc { border-color: var(--accent); }
.msg-chip:hover { text-decoration: underline; }
.msg-ann { margin: .7rem auto; max-width: 560px; padding: .65rem .85rem; border-radius: 12px; background: var(--warn-bg-soft); border: 1px solid var(--warn-line); color: var(--text); }
.ann-h { font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--warn-fg); margin-bottom: .2rem; }
.msg-ann .msg-time { margin: .25rem 0 0; }
.mc { border-top: 1px solid var(--line); background: var(--panel); padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
.mc-row { display: flex; align-items: flex-end; gap: .35rem; }
.mc-row textarea { flex: 1; resize: none; min-height: 40px; max-height: 160px; line-height: 1.35; padding: .5rem .7rem; border-radius: 20px; }
.mc-row .btn.icon { min-height: 40px; min-width: 40px; font-size: 1.05rem; }
.mc-row #mcSend { min-height: 40px; border-radius: 20px; }
.mc-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .45rem; }
.mc-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .25rem .55rem; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line-strong); font-size: .8rem; }
.mc-chip audio { height: 30px; max-width: 200px; }
.mc-thumb { height: 34px; width: 34px; object-fit: cover; border-radius: 6px; }
.mc-fc { cursor: pointer; }
.mc-rec { display: flex; align-items: center; gap: .5rem; margin-bottom: .45rem; padding: .35rem .55rem; border-radius: 10px; background: var(--bad-bg); border: 1px solid var(--bad-line); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: recpulse 1s infinite; }
@keyframes recpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .rec-dot { animation: none; } }
.ann-hist { margin-top: .8rem; }
.ann-hist summary { cursor: pointer; font-weight: 700; font-size: .85rem; }
.ann-row { padding: .45rem 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: .15rem; font-size: .88rem; }
.xsmall { font-size: .72rem; }
@media (max-width: 720px) {
  .msg-wrap { grid-template-columns: minmax(0, 1fr); border-radius: 0; border-left: 0; border-right: 0; margin: -.75rem -.75rem 0; }
  .msg-wrap.has-thread .msg-list { display: none; }
  .msg-wrap:not(.has-thread):not(.solo) .msg-thread { display: none; }
  .msg-list { border-right: 0; }
  .mt-back { display: inline-flex; }
  .mt-head { padding: .5rem .6rem; }
  .mt-head .btn.sm.ghost { display: none; }
  .msg { max-width: 86%; }
  .mt-scroll { padding: .6rem .6rem .8rem; }
}

/* ---------- sellable templates ---------- */
.tabs-row { margin: 0 0 1rem; display: inline-flex; }
.tabs-row .seg-btn { text-decoration: none; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.tpl-card { display: grid; grid-template-columns: 112px 1fr; gap: .9rem; align-items: start; }
.tpl-thumb { display: block; aspect-ratio: 210 / 297; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.tpl-thumb img, .tpl-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tpl-cover-ph { width: 100%; height: 100%; display: flex; align-items: flex-end; padding: .5rem; color: var(--tpl-ph-fg); font-family: var(--display); font-size: .72rem; text-transform: uppercase; line-height: 1.1;
  background: radial-gradient(circle at 80% 15%, color-mix(in srgb, var(--brand-accent) 35%, transparent) 0, transparent 50%), repeating-linear-gradient(135deg, var(--tpl-ph-a) 0 9px, var(--tpl-ph-b) 9px 18px); border-bottom: 4px solid var(--brand-accent); }
.tpl-info h3 { margin: 0 0 .2rem; font-size: 1.02rem; } .tpl-info h3 a { color: inherit; text-decoration: none; }
.tpl-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin: .4rem 0; }
.badge.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.tpl-acts { flex-wrap: wrap; gap: .35rem; margin-top: .5rem; }
.modal.modal-wide { max-width: min(880px, 96vw); width: 96vw; }
.tpl-form { display: grid; grid-template-columns: 170px 1fr; gap: 1rem; }
.tpl-cover-col { display: flex; flex-direction: column; gap: .45rem; align-items: stretch; }
.tpl-cover { aspect-ratio: 210 / 297; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.tpl-menu .exp-pop button { padding: .45rem .6rem; border-radius: 7px; display: flex; flex-direction: column; align-items: flex-start; width: 100%; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
label.chk { display: flex; align-items: center; gap: .45rem; font-weight: 600; }
@media (max-width: 720px) { .tpl-form { grid-template-columns: 1fr; } .tpl-cover-col { flex-direction: row; flex-wrap: wrap; align-items: center; } .tpl-cover { width: 96px; } .tpl-card { grid-template-columns: 84px 1fr; } }
.tpl-menu .exp-pop button:hover, .tpl-menu .exp-pop button:focus-visible { background: var(--panel2); }
.modal-backdrop .modal { max-height: calc(100dvh - 2rem); overflow-y: auto; }
label.chk input[type=checkbox] { width: 18px; height: 18px; min-height: 0; flex: none; margin: 0; padding: 0; }

/* ---------- onboarding intake ---------- */
.ob { max-width: 760px; margin: 0 auto; }
.ob-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.ob-top h1 { margin: 0; }
.ob-bar { height: 8px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); overflow: hidden; margin: .7rem 0; }
.ob-bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.ob-bar.sm { height: 6px; margin: .3rem 0 .6rem; }
.ob-steps { display: flex; gap: .35rem; list-style: none; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.ob-steps li a { display: block; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 700; }
.ob-steps li.on a { border-color: var(--accent); color: var(--strong); background: var(--panel2); }
.ob-steps li.done a { color: var(--ok-fg); border-color: var(--ok-line); }
.ob-steps li.skip a { border-style: dashed; }
.ob-card h2 { margin-top: 0; }
.ob-h { margin: 1rem 0 .4rem; font-size: .95rem; }
.ob-max { width: 100%; border-collapse: collapse; } .ob-max th, .ob-max td { padding: .25rem; text-align: left; } .ob-max input { width: 100%; }
.ob-actions { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }
.ob-foot { text-align: center; margin-top: .7rem; }
.ob-cycle { margin-top: 1rem; padding: .7rem .8rem; border-radius: 10px; border: 1px dashed var(--line-strong); background: var(--panel2); }
.ob-banner { display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; margin-bottom: 1rem; border-radius: 10px; background: var(--warn-bg-soft); border: 1px solid var(--warn-line); }
.chip-pick { display: flex; flex-wrap: wrap; gap: .35rem; margin: .3rem 0 .6rem; }
.cp { position: relative; cursor: pointer; }
.cp input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cp span { display: inline-block; padding: .28rem .65rem; border-radius: 999px; border: 1px solid var(--line-strong); font-size: .8rem; font-weight: 600; background: var(--panel2); text-transform: capitalize; }
.cp input:checked + span { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.cp input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.kv-sm { width: 100%; border-collapse: collapse; font-size: .86rem; margin-top: .4rem; }
.kv-sm th { text-align: left; color: var(--muted); font-weight: 700; width: 34%; padding: .25rem .4rem .25rem 0; vertical-align: top; }
.kv-sm td { padding: .25rem 0; }
.chip-sm { display: inline-block; padding: .05rem .45rem; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); font-size: .74rem; font-weight: 700; }
/* ---------- cycle tracking ---------- */
.ph-menstrual { background: var(--phc-menstrual); fill: var(--phc-menstrual); } .ph-follicular { background: var(--phc-follicular); fill: var(--phc-follicular); }
.ph-ovulatory { background: var(--phc-ovulatory); fill: var(--phc-ovulatory); } .ph-luteal { background: var(--phc-luteal); fill: var(--phc-luteal); }
.ph-pill { display: inline-block; padding: .15rem .6rem; border-radius: 999px; color: var(--on-ph); font-weight: 800; font-size: .82rem; }
.cyc-today { font-size: 1.05rem; }
.cyc-log { display: grid; gap: .45rem; margin-top: .8rem; }
.cyc-cal { font-size: .78rem; }
.cyc-dow, .cyc-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cyc-dow span { text-align: center; color: var(--muted); font-weight: 800; }
.cyc-d { position: relative; height: 1.9rem; display: grid; place-items: center; border-radius: 6px; background: var(--sunken); color: var(--text); font-weight: 700; }
.cyc-d[class*="ph-"] { color: var(--on-ph); } .cyc-d.pad { background: transparent; } .cyc-d.future { opacity: .55; }
.cyc-d.today { outline: 2px solid var(--strong); outline-offset: 1px; }
.cyc-d .sess { position: absolute; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--strong); }
.cyc-d[class*="ph-"] .sess { background: var(--on-ph); }
.cyc-legend { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .5rem; color: var(--muted); }
.cyc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .25rem; vertical-align: -1px; }
.cyc-legend i.sessdot { border-radius: 50%; background: var(--strong); }
.cyc-chart { width: 100%; height: auto; }
.cyc-list { list-style: none; padding: 0; margin: 0; } .cyc-list li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.cyc-intro ul { padding-left: 1.1rem; } .cyc-intro li { margin: .25rem 0; }
table.mini { width: 100%; border-collapse: collapse; font-size: .84rem; } table.mini th, table.mini td { padding: .3rem .4rem; border-bottom: 1px solid var(--line); text-align: left; }
.cyc-d.ph-menstrual { background: var(--phc-menstrual); } .cyc-d.ph-follicular { background: var(--phc-follicular); } .cyc-d.ph-ovulatory { background: var(--phc-ovulatory); } .cyc-d.ph-luteal { background: var(--phc-luteal); }

/* ---------- volume & intensity insights ---------- */
.ins-card .card-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.ins-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 860px) { .ins-grid { grid-template-columns: 1fr; } }
.ins-chart { width: 100%; height: auto; }
.ins-rec { padding: .7rem .85rem; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); }
.ins-rec h3 { margin: 0; flex: 1; font-size: .95rem; }
.ins-big { font-size: 1.05rem; margin: .5rem 0 .2rem; }
.ins-why ul { padding-left: 0; list-style: none; margin: .4rem 0; } .ins-why li { margin: .35rem 0; font-size: .86rem; }
.ins-flags { list-style: none; padding: .5rem .7rem; margin: .8rem 0 0; border-radius: 10px; background: var(--warn-bg-soft); border: 1px solid var(--warn-line); font-size: .86rem; } .ins-flags li { margin: .2rem 0; }
.ins-h { margin: 1rem 0 .3rem; }
.ins-buckets h4 { margin: .2rem 0 .4rem; font-size: .85rem; }
.ib-row { display: grid; grid-template-columns: 4.5rem 1fr 6.5rem; gap: .5rem; align-items: center; padding: .2rem .3rem; border-radius: 6px; font-size: .84rem; }
.ib-row.best { background: var(--panel2); outline: 1px solid var(--accent); }
.ib-track { position: relative; height: 12px; background: var(--sunken); border-radius: 6px; }
.ib-bar { position: absolute; top: 0; bottom: 0; border-radius: 6px; } .ib-bar.pos { background: var(--c-motivation); } .ib-bar.neg { background: var(--c-stress); }
.ib-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--line-strong); }
.ib-v { text-align: right; font-variant-numeric: tabular-nums; }
.ins-table { margin-top: .8rem; } .ins-foot { margin-top: .7rem; }
.hs-note p { margin: 0; } .hs-g { margin: 1.1rem 0 .3rem; }
.hs-t td { vertical-align: top; } .hs-in { display: flex; align-items: center; gap: .3rem; } .hs-in input { width: 5rem; }
.hs-t { table-layout: fixed; } .ins-empty { padding: 2rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }

/* ---------- OpenPowerlifting meet history ---------- */
.opl-card .card-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.opl-link input, .opl-search input { flex: 1; min-width: 220px; }
.opl-cands { list-style: none; padding: 0; margin: .5rem 0; } .opl-cands li { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .4rem; background: var(--panel2); }
.opl-none { padding: .5rem .7rem; border-radius: 10px; background: var(--warn-bg-soft); border: 1px solid var(--warn-line); }
.opl-chart { width: 100%; height: auto; max-height: 220px; }
.opl-t td { vertical-align: top; } .opl-t .nowrap { white-space: nowrap; } .opl-att { white-space: nowrap; } .opl-miss { color: var(--c-stress); }
.opl-sugg { margin: .6rem 0 1rem; padding: .7rem .8rem; border-radius: 12px; border: 1px solid var(--accent); background: var(--panel2); }
.opl-sugg h3 { margin: 0 0 .2rem; font-size: .95rem; } .opl-sugg .btn { margin-top: .5rem; }
.opl-attr { margin-top: .6rem; }
.opl-notes { padding-left: 1rem; margin: .3rem 0; } .opl-notes li { margin: .2rem 0; }
.ob-opl { margin-top: .6rem; } .opl-find { margin-top: .35rem; } .opl-find summary { cursor: pointer; color: var(--muted); }
input.flash { outline: 2px solid var(--accent); }
.opl-self { max-width: 1000px; min-width: 0; } .opl-card { min-width: 0; max-width: 100%; } .opl-card .table-wrap { max-width: 100%; }
.opl-sugg input[type=checkbox] { width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; }

/* ---------- AI assistant ---------- */
.btn.xs { padding: .15rem .4rem; min-height: 26px; font-size: .68rem; }
.spin { display: inline-block; width: .9em; height: .9em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: aispin .7s linear infinite; vertical-align: -2px; }
@keyframes aispin { to { transform: rotate(360deg); } }
.badge.ai-sample { background: color-mix(in srgb, var(--ai) 22%, transparent); color: color-mix(in srgb, var(--ai) 70%, var(--text)); border: 1px dashed color-mix(in srgb, var(--ai) 60%, transparent); text-transform: none; letter-spacing: 0; }
.ai-card { border-color: color-mix(in srgb, var(--ai) 35%, var(--line)); }
.ai-card .card-head { gap: .5rem; flex-wrap: wrap; }
.ai-status { margin-bottom: 1rem; border-left: 4px solid var(--line-strong); }
.ai-status.is-on { border-left-color: var(--green); } .ai-status.is-mock { border-left-color: var(--ai); } .ai-status.is-off { border-left-color: var(--muted-2); }
.ai-status .row { gap: .5rem; flex-wrap: wrap; }
.ai-env { background: var(--sunken); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .75rem; font-size: .75rem; overflow-x: auto; white-space: pre; }
.ai-sub { margin: 0 0 1rem; }
.ai-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .35rem 1rem; margin-bottom: .75rem; }
.ai-money { margin-top: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-money .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .ai-money { grid-template-columns: 1fr; } }
.ai-meter { height: 10px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); overflow: hidden; margin: .25rem 0 .4rem; }
.ai-meter span { display: block; height: 100%; background: var(--accent); } .ai-meter span.hot { background: var(--danger); }
.ai-h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1rem 0 .4rem; }
.ai-recent, .ai-based, .ai-raw { margin-top: .6rem; } .ai-based summary, .ai-recent summary, .ai-raw summary { cursor: pointer; font-size: .8rem; color: var(--text-2); }
.ai-based ul { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .8rem; }
.ai-raw pre { max-height: 320px; overflow: auto; font-size: .7rem; background: var(--sunken); padding: .5rem; border-radius: 8px; }
.ai-knows textarea { width: 100%; }
.ai-knows .card-head select { max-width: 55%; }
.ai-result .row { gap: .5rem; flex-wrap: wrap; }
.ai-unmatched ul, .ai-cites ol { margin: .25rem 0 .5rem; padding-left: 1.1rem; font-size: .82rem; }
.ai-unmatched li { display: flex; align-items: center; gap: .5rem; justify-content: space-between; margin: .15rem 0; }
.ai-wait { display: flex; gap: .6rem; align-items: center; }
.ai-wr { display: grid; gap: .6rem; }
.ai-wr-i { border-top: 1px solid var(--line); padding-top: .5rem; } .ai-wr-i:first-child { border-top: 0; padding-top: 0; }
.ai-wr-i .row { gap: .5rem; flex-wrap: wrap; }
.ai-wr-l { list-style: none; padding: 0; margin: .25rem 0 0; } .ai-wr-l li { margin: .1rem 0; } .ai-wr-l .c { color: var(--warn-fg); }
.ai-note { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; padding: .3rem .5rem; border-radius: 8px; background: color-mix(in srgb, var(--ai) 12%, transparent); margin-bottom: .35rem; }
.ai-note-card { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.ai-obs { list-style: none; padding: 0; margin: .25rem 0; } .ai-obs li { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .3rem 0; font-size: .85rem; }
.ai-swap { display: grid; grid-template-columns: auto 1fr; gap: .4rem; margin-bottom: .9rem; padding-bottom: .9rem; border-bottom: 1px solid var(--line); }
.ai-swap #aiSwapOut { grid-column: 1 / -1; } .ai-picks { padding-left: 1.1rem; margin: .35rem 0; } .ai-picks li { margin: .3rem 0; }
.ai-explain { padding: .5rem .75rem; margin: .25rem 0 .75rem; border-radius: 8px; background: color-mix(in srgb, var(--ai) 10%, transparent); }
.ai-explain ul { margin: .25rem 0 0; padding-left: 1.1rem; }
.ai-kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .35rem .75rem; font-size: .82rem; margin: .5rem 0 1rem; }
.ai-kv dt { color: var(--muted); text-transform: capitalize; font-weight: 700; }
.ai-kv dd { margin: 0; overflow-wrap: anywhere; } .ai-kv ul { margin: 0; padding-left: 1rem; }
.ai-toggles { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.ai-toggles .chk { align-items: flex-start; }
.ai-toggles .chk .xsmall { display: block; width: 100%; }
.ai-tg { display: flex; gap: .55rem; align-items: flex-start; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--text); margin: .2rem 0 .5rem; cursor: pointer; }
.ai-tg input { margin-top: .2rem; } .ai-tg span { display: flex; flex-direction: column; } .ai-tg small { font-size: .72rem; font-weight: 400; }
.ai-tg input[type=checkbox] { width: 1.05rem; height: 1.05rem; min-height: 0; flex: 0 0 auto; padding: 0; margin: .15rem 0 0; }
.ai-tg span { flex: 1; min-width: 0; }

/* ---------- tracked lifts ---------- */
.trk-sub { margin: -.25rem 0 .5rem; }
.trk-g + .trk-g { margin-top: .6rem; }
.trk-h { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-text); margin: .4rem 0 .2rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }
.trk-t { width: 100%; } .trk-t td { padding: .3rem .35rem; vertical-align: top; } .trk-t td.num { white-space: nowrap; text-align: right; } .trk-t td.act { white-space: nowrap; text-align: right; width: 1%; }
.trk-t tr.untracked td:first-child b { font-weight: 600; color: var(--text-2); }
.trk-slots { display: grid; gap: .5rem; margin: .6rem 0; max-height: 46vh; overflow: auto; }
.trk-slots fieldset { border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem .5rem; margin: 0; }
.trk-slots legend { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 0 .3rem; }
.trk-chk { display: flex; gap: .5rem; align-items: flex-start; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--text); margin: .3rem 0; cursor: pointer; }
.trk-chk input { width: 1rem; height: 1rem; min-height: 0; flex: 0 0 auto; margin-top: .15rem; padding: 0; }
.trk-chk span { display: flex; flex-direction: column; } .trk-chk small { font-size: .72rem; font-weight: 400; }
.trk-added { list-style: none; padding: 0; margin: .4rem 0 0; } .trk-added li { display: flex; justify-content: space-between; align-items: center; padding: .2rem 0; font-size: .85rem; border-bottom: 1px solid var(--line); }
.trk-hist { margin-bottom: 1.1rem; } .trk-hh { font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; margin: .2rem 0 .5rem; color: var(--accent-text); }
.trk-empty { margin: .5rem 0 0; } .trk-empty .chip { margin: 0 .2rem .2rem 0; }
.tp-t input, .tp-t select { width: 100%; } .tp-t td { vertical-align: top; } .trk-st { display: grid; gap: .2rem; }
.dym { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; font-size: .72rem; padding: .2rem .45rem; margin: .15rem .3rem .3rem; border-radius: 6px; background: var(--warn-bg-soft); border: 1px dashed var(--warn-line); color: var(--warn-fg); }
.dym-list { display: grid; gap: .2rem; margin-top: .5rem; }

/* quick-add library exercise from the builders */
.lib-head #libNew { margin-left: auto; white-space: nowrap; }
.lib-create { display: flex; align-items: center; gap: .4rem; padding: .35rem .4rem; margin-top: .25rem; border: 1px dashed var(--accent); border-radius: 8px; cursor: pointer; user-select: none; -webkit-user-select: none; touch-action: pan-y; }
.lib-create:hover, .lib-create:focus-visible { background: var(--panel2); outline: none; }
.lib-create .lib-main { min-width: 0; flex: 1; }
.lib-create .lib-name { color: var(--accent-text); font-weight: 600; white-space: normal; }
.qa-form .qa-dup { margin-top: .35rem; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--phc-luteal); background: color-mix(in srgb, var(--phc-luteal) 12%, transparent); font-size: .85rem; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.qa-form .qa-dup.exact { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.qa-form .qa-more summary { cursor: pointer; color: var(--muted); font-size: .9rem; margin: .25rem 0; }
.qa-form .check-inline { display: flex; align-items: center; gap: .4rem; font-weight: 500; }
.qa-form .check-inline input { width: auto; }
.dym.none { border-style: dashed; color: var(--muted); }

/* program update tracker */
.pu-panel .pu-head { gap: .5rem; flex-wrap: wrap; align-items: center; }
.pu-panel .pu-head select { width: auto; max-width: 200px; flex: 0 0 auto; min-height: 0; padding: .25rem .5rem; }
.pu-count { background: var(--danger); color: var(--on-danger); border-radius: 999px; padding: 0 .5rem; font-size: .8rem; font-weight: 700; }
.pu-st { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.pu-overdue { background: var(--danger); color: var(--on-danger); }
.pu-runs_out { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: var(--danger); }
.pu-due { background: var(--phc-luteal); color: var(--on-ph); }
.pu-due_soon { background: color-mix(in srgb, var(--phc-luteal) 16%, transparent); color: var(--text); border-color: var(--phc-luteal); }
.pu-up_to_date { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--text); border-color: var(--green); }
.pu-no_program { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.pu-table { width: 100%; }
.pu-table td { vertical-align: middle; }
.pu-table .pu-cad { width: auto; min-height: 0; padding: .2rem .4rem; font-size: .85rem; }
.pu-acts { white-space: nowrap; text-align: right; }
.pu-acts .btn { margin-left: .25rem; }
.pu-prev ul { margin: .35rem 0; padding-left: 1.1rem; font-size: .88rem; }
.pu-prev li { margin: .15rem 0; }
.pu-chg { font-size: .75rem; font-weight: 700; padding: 0 .35rem; border-radius: 6px; border: 1px solid var(--line); }
.pu-chg.success, .pu-chg.progress { color: var(--green); border-color: var(--green); }
.pu-chg.fail, .pu-chg.regress { color: var(--danger); border-color: var(--danger); }
.pu-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }
.pu-facts > div { display: flex; flex-direction: column; gap: .1rem; }
.pu-facts select { width: auto; min-height: 0; padding: .25rem .45rem; }
.pu-hist ul { margin: .35rem 0 0; padding-left: 1.1rem; font-size: .85rem; }
.pu-banner { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; padding: .6rem .8rem; margin-bottom: .6rem; border-radius: 10px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: var(--panel); }
.pu-banner.pu-b-overdue, .pu-banner.pu-b-runs_out { border-left-color: var(--danger); }
.pu-banner.pu-b-due, .pu-banner.pu-b-due_soon { border-left-color: var(--phc-luteal); }
.pu-banner .pu-ban-out { flex-basis: 100%; }
.ib-pu { margin-bottom: 1rem; }

/* Settings › e1RM rounding */
.rnd-opts { border: 0; padding: 0; margin: 0; display: grid; gap: .5rem; }
.rnd-opt { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--text); }
.rnd-opt input { width: auto; min-height: 0; accent-color: var(--accent); }
.rnd-opt .muted { margin-left: auto; }
.rnd-opt:has(input:checked) { border-color: var(--accent); background: var(--panel2); }

/* compact builder rows: quick remove (×) without expanding the row */
.exr-x { background: none; border: 0; color: var(--muted); font-size: .9rem; line-height: 1; padding: .1rem .25rem; border-radius: 4px; cursor: pointer; opacity: .35; }
.exr:hover .exr-x, .exr-x:focus-visible, .exr.open .exr-x { opacity: 1; }
.exr-x:hover, .exr-x:focus-visible { color: var(--danger); background: var(--warn-bg-soft); outline: none; }
@media (hover: none) { .exr-x { opacity: .8; } }
.dlg-msg { white-space: pre-line; display: block; margin: 0 0 .4rem; }
.exr > .dym { grid-column: 1 / -1; }

/* library header: title + count stacked so the four buttons fit at the default 248px; clear of the resize edge */
.bld-layout .lib-head { gap: .3rem; padding: .45rem calc(.45rem + 6px) .45rem .5rem; }
.bld-layout.lib-right .lib-head { padding: .45rem .45rem .45rem calc(.5rem + 6px); }
.lib-title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.lib-title h3 { flex: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-title #libCount { white-space: nowrap; }
.bld-layout .lib-min, .bld-layout .lib-side-btn { min-height: 26px; min-width: 28px; padding: .15rem .4rem; font-size: .85rem; line-height: 1; }

/* ======================================================================================
   Phone layer (athletes + coaches): tab bar, slim top bar, gym-friendly workout logging,
   rest timer, bottom sheets, offline badge, install hint, quick-edit builder.
   ====================================================================================== */
.tabbar, .who-av, .sets .sum-td, .sets .sum-th, .pl-t, .fc-rec { display: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* set tick (all widths) */
.set-tick { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line-strong); background: transparent; color: var(--muted-2); font-size: 1.15rem; font-weight: 900; cursor: pointer; display: inline-grid; place-items: center; transition: background .12s, transform .08s; }
.set-tick:hover { border-color: var(--green); color: var(--green); }
.set-tick:active { transform: scale(.92); }
.set-tick[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--on-green); }
.sets tr.set-main[data-done="1"] td.setno { color: var(--green); }
.sets tr.set-main[data-done="1"] > td { background: color-mix(in srgb, var(--green) 7%, transparent); }
.pl-td { width: 1%; }
.wo-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .45rem; margin: .35rem 0 .15rem; font-family: var(--display); font-size: 1.25rem; color: var(--strong); letter-spacing: .01em; line-height: 1.15; }
.wo-big-sr { color: var(--accent-text); }
.wo-big-sep { color: var(--muted); font-size: .85em; }
.wo-sync { align-self: center; font-size: .75rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.wo-sync:empty { display: none; }
.wo-sync.off { color: var(--warn-fg); } .wo-sync.ok { color: var(--ok-fg); }
.wo-prog { font-size: .78rem; font-weight: 900; padding: .15rem .55rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wo-prog:empty { display: none; }
.wo-prog.all { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }
.wo-prog.all::before { content: '✓ '; }
.wo-ex.ex-done { border-color: var(--ok-line); }
.wo-sprog { align-self: center; display: grid; gap: .25rem; min-width: 84px; font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wo-sprog b { color: var(--strong); font-weight: 900; }
.wo-pbar { display: block; height: 5px; border-radius: 5px; background: var(--sunken); overflow: hidden; }
.wo-pbar i { display: block; height: 100%; width: 0; background: var(--green); transition: width .25s ease; }
.wo-sprog.all b { color: var(--ok-fg); }
.sets th.tick-th { text-align: center; }
.sets td.tick-td { text-align: center; }

/* collapsible warm-up in a session */
.wu-fold > summary { list-style: none; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin: -1rem; padding: 1rem; min-height: 44px; }
.wu-fold > summary::-webkit-details-marker { display: none; }
.wu-fold[open] > summary { margin-bottom: .2rem; }
.wu-fold .wu-chev { margin-left: auto; transition: transform .15s; color: var(--muted); }
.wu-fold[open] .wu-chev { transform: rotate(180deg); }
.wu-fold > summary h2 { margin: 0; }

/* offline / install */
.offline-badge { margin-left: auto; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-fg); border-radius: 999px; padding: .3rem .7rem; font-size: .72rem; font-weight: 800; min-height: 32px; cursor: pointer; white-space: nowrap; }
.a2hs { display: flex; align-items: center; gap: .6rem; padding: .6rem .7rem; margin-bottom: .75rem; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--panel); }
.a2hs > span:first-child { font-size: 1.4rem; }
.a2hs > div { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.25; }
.a2hs-x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; min-width: 44px; min-height: 44px; cursor: pointer; }
.a2hs-steps { padding-left: 1.2rem; line-height: 1.7; }

/* rest timer */
.rest-timer { position: fixed; z-index: 45; left: 50%; transform: translateX(-50%); bottom: 1rem; width: min(560px, calc(100vw - 1.5rem)); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem .6rem; align-items: center;
  padding: .55rem .7rem; border-radius: 14px; background: var(--popover); border: 1px solid var(--accent); box-shadow: 0 10px 34px var(--shadow); }
.rest-timer[hidden] { display: none; }
.rt-lbl { font-size: .68rem; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-time { font-family: var(--display); font-size: 1.9rem; line-height: 1; color: var(--strong); font-variant-numeric: tabular-nums; }
.rt-bar { height: 4px; border-radius: 4px; background: var(--sunken); overflow: hidden; margin-top: .3rem; }
.rt-bar i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.rt-btns { display: flex; gap: .3rem; }
.rt-b { min-width: 44px; min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 800; font-size: .85rem; cursor: pointer; padding: 0 .5rem; }
.rt-skip { color: var(--accent-text); }
.rt-opts { grid-column: 1 / -1; display: flex; gap: 1rem; }
.rt-opts[hidden] { display: none; }
.rt-opts label { display: flex; align-items: center; gap: .4rem; margin: 0; min-height: 44px; text-transform: none; font-size: .9rem; letter-spacing: 0; color: var(--text); }
.rt-opts input { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); }
.rest-timer.done { border-color: var(--green); background: color-mix(in srgb, var(--green) 18%, var(--popover)); }
.rest-timer.done .rt-time { color: var(--green); }
@media (prefers-reduced-motion: no-preference) { .rest-timer.done { animation: rtPulse .8s ease-in-out 3; } }
@keyframes rtPulse { 50% { transform: translateX(-50%) scale(1.03); } }

/* bottom sheet (centred dialog on wide screens) */
.sheet-backdrop { position: fixed; inset: 0; z-index: 92; background: var(--backdrop); display: grid; place-items: center; padding: 1rem; }
.sheet { width: min(520px, 100%); max-height: min(86dvh, 760px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 16px; box-shadow: 0 -10px 40px var(--shadow); overflow: hidden; }
.sheet-grab { display: none; }
.sheet-head { display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem .5rem; }
.sheet-head h2 { margin: 0; font-size: 1.05rem; color: var(--gold-text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-x { background: none; border: 0; color: var(--muted); font-size: 1.6rem; min-width: 44px; min-height: 44px; cursor: pointer; line-height: 1; }
.sheet-body { padding: .2rem .9rem calc(1rem + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-menu { display: grid; gap: .3rem; }
.sm-item { display: flex; align-items: center; gap: .6rem; min-height: 52px; padding: 0 .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 700; font-size: .95rem; text-align: left; cursor: pointer; text-decoration: none !important; }
.sm-item.danger { color: var(--bad-fg); }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem; }
.more-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-height: 76px; padding: .4rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 800; font-size: .78rem; text-align: center; text-decoration: none !important; }
.more-item span { font-size: 1.35rem; }
.more-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-top: .8rem; flex-wrap: wrap; }
.more-row .seg-btn { min-height: 44px; padding: 0 .8rem; }
.more-wide { width: 100%; margin-top: .8rem; min-height: 48px; }

/* ---------------- phones ---------------- */
@media (max-width: 760px) {
  body.signed-in { --tb-h: calc(58px + env(safe-area-inset-bottom)); --rt-h: 0px; }
  body.signed-in.resting { --rt-h: 78px; }
  body.signed-in .container { padding-bottom: calc(var(--tb-h) + var(--rt-h) + 1.5rem); padding-left: max(.75rem, env(safe-area-inset-left)); padding-right: max(.75rem, env(safe-area-inset-right)); }
  body.signed-in .container.msg-page { padding-bottom: 0; }

  /* slim top bar: logo · (offline) · bell · avatar */
  body.signed-in .topbar { flex-wrap: nowrap; gap: .5rem; padding: calc(.35rem + env(safe-area-inset-top)) max(.75rem, env(safe-area-inset-right)) .35rem max(.75rem, env(safe-area-inset-left)); min-height: 52px; }
  body.signed-in .nav, body.signed-in .who-name, body.signed-in .who .badge, body.signed-in #logout, body.signed-in .theme-wrap { display: none !important; }
  body.signed-in .brand img { max-height: 30px; width: auto; }
  body.signed-in .brand-text strong { font-size: .8rem; } body.signed-in .brand-text em { font-size: .95rem; }
  body.signed-in .who { margin-left: auto; gap: .35rem; }
  body.signed-in .offline-badge + .who, body.signed-in .offline-badge { margin-left: 0; }
  body.signed-in .offline-badge { order: 2; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
  body.signed-in .who { order: 3; }
  .bell-btn { width: 44px; height: 44px; }
  .who-av { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 900; font-size: .85rem; text-decoration: none !important; margin: 2px; }

  /* bottom tab bar */
  body.signed-in .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; height: var(--tb-h);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tab { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; color: var(--muted); background: none; border: 0; font: inherit; font-size: .66rem; font-weight: 800; letter-spacing: .02em; text-decoration: none !important; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .tab.on { color: var(--accent-text); }
  .tab.on::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  .tab-n { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: var(--on-danger); font-size: .62rem; font-style: normal; font-weight: 900; display: grid; place-items: center; }
  .tab-n[hidden] { display: none; }
  body.kb-open .tabbar { display: none; }
  body.kb-open { --tb-h: 0px; }

  .toast { bottom: calc(var(--tb-h, 0px) + var(--rt-h, 0px) + .75rem); }
  .rest-timer { bottom: calc(var(--tb-h, 0px) + .4rem); width: calc(100vw - 1rem); }
  .sticky-actions { bottom: calc(var(--tb-h, 0px) + var(--rt-h, 0px)); z-index: 20; margin: 0 -.75rem; padding: .7rem .75rem .6rem; gap: .5rem; }
  .sticky-actions .btn { min-height: 50px; }
  .modal-backdrop { padding: .5rem; }
  .modal { max-width: 100%; }

  /* bottom sheets */
  .sheet-backdrop { place-items: end stretch; padding: 0; }
  .sheet { width: 100%; max-height: 88dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .sheet-grab { display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: .45rem auto 0; }
  @media (prefers-reduced-motion: no-preference) { .sheet { animation: sheetUp .18s ease-out; } }

  /* inputs: 16px stops iOS zooming; 44px targets */
  input, select, textarea { font-size: 16px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn.sm, .btn.xs { min-height: 40px; }
  .btn.icon { min-width: 44px; min-height: 44px; }

  /* ----- workout ----- */
  .wo-head { padding: .8rem; }
  .wo-head h1 { font-size: 1.3rem; }
  .wo-head > p.muted.small { display: none; } /* long energy rules text: still on the RPE page */
  .energy { gap: .35rem; }
  .energy button { min-height: 60px; }
  .energy button span { font-size: .62rem; letter-spacing: 0; }
  #completeToggle { width: 24px; height: 24px; }
  .wo-head label.row { min-height: 44px; }
  .card { padding: .8rem; }
  .wo-ex .row { gap: .35rem; }
  .wo-ex > .row > strong { flex: 1 1 100%; font-size: 1.05rem; }
  .wo-big { font-size: 1.5rem; }
  .presc .chip.target { font-size: .9rem; }
  .cmt-ex { min-height: 40px; }

  .wo-ex .table-wrap { overflow: visible; margin: 0; }
  table.sets, table.sets tbody { display: block; width: 100%; }
  table.sets thead { display: none; }
  table.sets tr.set-main { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 4px; row-gap: 6px; align-items: end; padding: .55rem 0 .6rem; border-top: 1px solid var(--line); }
  table.sets tr.set-main > td { padding: 0; min-width: 0; background: none !important; }
  table.sets tr.set-main[data-done="1"] { background: color-mix(in srgb, var(--green) 8%, transparent); border-radius: 10px; }
  table.sets td.setno { grid-row: 1; grid-column: 1 / span 3; width: auto; text-align: left; align-self: center; font-size: 1rem; color: var(--text); padding-left: .2rem !important; cursor: default; }
  table.sets .sn-pre { font-family: var(--font); font-size: .72rem; font-weight: 800; text-transform: uppercase; color: var(--muted); }
  table.sets td.tgt { grid-row: 1; grid-column: 4 / span 4; align-self: center; text-align: left; white-space: normal; font-size: .82rem; line-height: 1.2; }
  table.sets td.sn-td { grid-row: 1; grid-column: 8 / span 2; align-self: center; text-align: right; }
  table.sets td.tick-td { grid-row: 1; grid-column: 10 / span 3; align-self: center; text-align: right; }
  table.sets td.c-w { grid-row: 2; grid-column: 1 / span 6; }
  table.sets td.c-r { grid-row: 2; grid-column: 7 / span 6; }
  table.sets td.c-p { grid-row: 3; grid-column: 1 / span 6; }
  table.sets td.e1 { grid-row: 3; grid-column: 7 / span 2; width: auto; align-self: center; font-size: .75rem; line-height: 1.1; }
  table.sets td.pl-td { grid-row: 3; grid-column: 9 / span 4; width: auto; text-align: right; }
  table.sets td[data-lbl]::before { content: attr(data-lbl); display: block; font-size: .62rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); text-align: left; margin: 0 0 2px 2px; }
  table.sets td.e1::before { text-align: center; margin: 0 0 2px; }
  table.sets .stepper { display: flex; width: 100%; gap: 3px; }
  table.sets .stepper .btn.icon { flex: 0 0 44px; min-width: 44px; min-height: 46px; padding: 0; font-size: 1.3rem; border-radius: 10px; }
  table.sets .stepper input { flex: 1 1 auto; width: 0; min-width: 0; min-height: 46px; padding: 0 2px; font-size: 1.1rem; }
  table.sets .clu-in { display: flex; gap: 3px; } table.sets .clu-in label { flex: 1; min-width: 0; margin: 0; font-size: .6rem; }
  table.sets .clu-in input { width: 100%; min-height: 46px; }
  .set-tick { width: 100%; max-width: 72px; height: 46px; border-radius: 12px; font-size: 1.35rem; }
  table.sets .note-btn { width: 44px; height: 44px; border-radius: 10px; }
  table.sets .plate-btn { width: 100%; height: 46px; margin: 0; border-radius: 10px; font-size: .85rem; font-weight: 800; white-space: nowrap; }
  .pl-t { display: inline; }
  /* ticked set folds to one line; tap it to edit again */
  table.sets td.sum-td { display: none; }
  table.sets tr.set-main[data-done="1"]:not(.open) > td:not(.setno):not(.tick-td):not(.sum-td) { display: none; }
  table.sets tr.set-main[data-done="1"]:not(.open) > td.sum-td { display: block; grid-row: 1; grid-column: 4 / span 6; align-self: center; font-weight: 800; font-size: 1rem; color: var(--text); cursor: pointer; text-align: left; }
  table.sets tr.set-main[data-done="1"]:not(.open) td.setno { cursor: pointer; }
  table.sets tr.part-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 4px; row-gap: 4px; padding: .3rem .3rem .5rem; border-radius: 8px; margin-bottom: .2rem; }
  table.sets tr.part-row > td { padding: 0; background: none; min-width: 0; }
  table.sets tr.part-row td.setno { grid-row: 1; grid-column: 1 / span 2; text-align: left; }
  table.sets tr.part-row td.tgt { grid-row: 1; grid-column: 3 / span 10; }
  table.sets tr.part-row td.c-w { grid-row: 2; grid-column: 1 / span 6; }
  table.sets tr.part-row td.c-r { grid-row: 2; grid-column: 7 / span 6; }
  table.sets tr.part-row td.c-x { display: none; }
  table.sets tr.note-row { display: block; padding: 0 0 .5rem; }
  table.sets tr.note-row[hidden] { display: none; }
  table.sets tr.note-row td { display: block; padding: 0; }
  table.sets tr.note-row td.setno { display: none; }
  .wo-ex [data-fb] { min-height: 44px; }
  .fc-row { gap: .4rem; }
  .fc-row select { min-height: 44px; flex: 1 1 100%; }
  .fc-up { flex: 1; min-height: 44px; }
  .fc-rec { display: inline-flex; }
  .fc-list a { display: inline-block; padding: .5rem 0; }
  /* supersets: one block, members as flat sections so A1/A2 read top to bottom */
  .ss-block { padding: .55rem .5rem .2rem .6rem; }
  .ss-block::before { display: none; }
  .ss-head { font-size: .9rem; line-height: 1.35; }
  .ss-block .wo-ex { border: 0; border-top: 1px dashed color-mix(in srgb, var(--st) 45%, var(--line)); border-radius: 0; background: transparent; box-shadow: none; padding: .7rem .1rem .4rem; margin: 0; }
  .ss-block .wo-ex .badge.ss-lbl { font-size: .95rem; padding: .15rem .5rem; }
  .ss-block .st-explain { font-size: .8rem; }
  .wu-fold > summary { margin: -.8rem; padding: .8rem; }
  .sess-notes textarea { min-height: 88px; }

  /* plate calculator as a bottom sheet */
  .plate-pop.as-sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; z-index: 95; border-radius: 18px 18px 0 0; border-bottom: 0; padding: .9rem 1rem calc(1rem + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px var(--shadow); }
  .plate-pop.as-sheet .pp-x { min-width: 44px; min-height: 44px; font-size: 1.6rem; }
  .plate-pop.as-sheet .pp-kg input { min-height: 48px; font-size: 1.3rem; }
  .plate-pop.as-sheet .seg-btn { min-height: 44px; }

  /* messages fill the screen above the tab bar */
  .msg-wrap { margin: -.75rem calc(-1 * max(.75rem, env(safe-area-inset-left))) 0; }
  .mc-row .btn.icon { min-width: 44px; min-height: 44px; }
  #mcSend { min-height: 44px; }
  .ml-item { min-height: 60px; }

  .check-inline { white-space: normal; }
  /* athlete overview (coach): section links become chips */
  .aside { display: flex; flex-wrap: wrap; gap: .3rem; padding: .5rem; }
  .aside .aside-name { flex: 0 0 100%; padding: .2rem .3rem .5rem; margin-bottom: .1rem; }
  .aside a { padding: 0 .7rem; min-height: 40px; display: inline-flex; align-items: center; border: 1px solid var(--line); font-size: .7rem; }
  .tabs-row { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs-row .seg-btn { flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center; }
  /* tables that are lists on phones */
  .pu-table, .pu-table tbody { display: block; }
  .pu-table thead { display: none; }
  .pu-table tr.pu-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .35rem .6rem; padding: .7rem .2rem; border-top: 1px solid var(--line); }
  .pu-table tr.pu-row > td { padding: 0; border: 0; min-width: 0; text-align: left; }
  .pu-table td.pu-name { grid-column: 1 / -1; order: -1; font-size: 1rem; }
  .pu-table td.pu-stc { grid-column: 1 / -1; order: -2; }
  .pu-table td[data-label]::before { content: attr(data-label); display: block; font-size: .62rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .pu-table td.pu-acts { grid-column: 1 / -1; display: flex; gap: .4rem; flex-wrap: wrap; }
  .pu-table td.pu-acts .btn { flex: 1 1 auto; min-height: 44px; }
  .pu-table tr.pu-prev-row, .pu-table tr.pu-prev-row td { display: block; }
  .pu-head { flex-wrap: wrap; }
}
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
/* phones in landscape / very small */
@media (max-width: 359px) {
  table.sets td.e1 { font-size: .68rem; }
  .pl-t { display: none; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 761px) { .fc-rec { display: none; } }

/* ---------------- coach quick-edit builder ---------------- */
.qb-head { margin-bottom: .5rem; }
.qb-title { font-size: 1.2rem; margin: .2rem 0; min-width: 0; overflow-wrap: anywhere; }
.qb-full { margin-top: .2rem; }
.qb-pick { display: flex; gap: .35rem; overflow-x: auto; padding: .3rem 0 .45rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.qb-pick::-webkit-scrollbar { display: none; }
.qb-chip { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; min-height: 48px; padding: .2rem .6rem; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-weight: 900; font-size: .85rem; cursor: pointer; }
.qb-chip small { font-weight: 700; font-size: .62rem; color: var(--muted); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.qb-chip.on small { color: var(--on-accent); opacity: .8; }
.qb-day-h { display: flex; flex-direction: column; gap: .1rem; margin: .4rem 0 .5rem; }
.qb-day-h h2 { margin: 0; font-size: 1.05rem; }
.qb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.qb-item { display: flex; align-items: stretch; gap: .3rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.qb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; text-align: left; padding: .65rem .75rem; background: none; border: 0; color: var(--text); cursor: pointer; font: inherit; min-height: 56px; }
.qb-name { font-weight: 800; overflow-wrap: anywhere; }
.qb-rx { font-size: .85rem; color: var(--accent-text); font-weight: 700; }
.qb-notes { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-acts { display: flex; flex-direction: column; justify-content: center; padding: .15rem; }
.qb-acts { flex-direction: row; align-items: center; }
.qb-acts .btn.icon { min-width: 40px; min-height: 44px; padding: 0; }
.qb-add { width: 100%; margin-top: .7rem; min-height: 50px; }
.qb-empty { padding: 1rem; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.qb-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .55rem .6rem; }
.qb-f label { margin: 0 0 .2rem; }
.qb-pair { display: flex; gap: .3rem; } .qb-pair input { flex: 1; min-width: 0; } .qb-pair select { width: auto; flex: 0 0 auto; }
.qb-step { display: flex; gap: 3px; } .qb-step input { flex: 1; width: 0; min-width: 0; text-align: center; font-weight: 800; }
.qb-step .btn.icon { flex: 0 0 44px; min-height: 44px; padding: 0; font-size: 1.2rem; }
.qb-form textarea { width: 100%; }
.qb-sheet-acts { display: flex; gap: .4rem; align-items: center; margin-top: .8rem; position: sticky; bottom: 0; background: var(--panel); padding: .5rem 0 .1rem; }
.qb-sheet-acts .btn { min-height: 48px; }
.qb-sum { margin: 0 0 .5rem; }
.qb-lib #qbLibQ { width: 100%; margin-bottom: .5rem; position: sticky; top: 0; }
.qb-lib-list { display: grid; gap: .3rem; }
.qb-lib-item { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; min-height: 52px; padding: .5rem .75rem; text-align: left; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; }
.qb-create { border-style: dashed; border-color: var(--accent); }
@media (max-width: 360px) { .qb-grid { grid-template-columns: minmax(0, 1fr); } }
.pu-panel[data-where="page"] .pu-head h2 { display: none; }
/* bars: plate popup, settings, athlete card */
.pp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; padding: .45rem .55rem; margin: .4rem 0; border-radius: 10px; background: var(--sunken); border: 1px solid var(--line); }
.pp-bar-kg { font-size: 1.05rem; } .pp-bar-kg b { font-family: var(--display); font-size: 1.25rem; color: var(--accent-text); }
.pp-bar .seg { margin-left: auto; }
.ramp-bar { color: var(--accent-text); font-weight: 800; }
.bar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .7rem 1rem; }
.bar-set input, .bar-custom input[name=ckg] { width: 7rem; }
.bar-custom { margin-bottom: .4rem; } .bar-custom input[name=cname] { flex: 1; min-width: 0; }
.bar-list { list-style: none; padding: 0; margin: .4rem 0; display: grid; gap: .35rem; }
.bar-list li { display: flex; flex-wrap: wrap; gap: .2rem .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.bar-add { flex-wrap: wrap; } .bar-add input { flex: 1 1 12rem; min-width: 0; } .bar-add select { width: auto; flex: 0 1 auto; min-width: 0; max-width: 100%; }
@media (max-width: 760px) { .plate-pop.as-sheet .pp-bar .seg-btn { min-height: 44px; min-width: 64px; font-size: .95rem; } .pp-bar .seg { margin-left: 0; } }
@media (max-width: 760px) {
  .exp-pop { position: fixed; left: .5rem; right: .5rem; top: auto; bottom: calc(var(--tb-h, 0px) + .5rem); z-index: 60; }
  .exp-pop a, .exp-pop button { min-height: 44px; }
  .btn.sm.fc-up { min-height: 44px; }
}
/* progression preview as cards on phones */
@media (max-width: 760px) {
  .prog-tbl, .prog-tbl tbody { display: block; } .prog-tbl thead { display: none; }
  .prog-tbl tr { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(0, 1fr); gap: .3rem .6rem; padding: .7rem 0; border-top: 1px solid var(--line); }
  .prog-tbl td { padding: 0 !important; border: 0 !important; min-width: 0; text-align: left; }
  .prog-tbl .pg-take { grid-row: 1 / span 2; align-self: start; } .prog-tbl .pg-take input { width: 26px; height: 26px; }
  .prog-tbl .pg-name { grid-column: 2 / -1; font-size: 1rem; } .prog-tbl .pg-day { grid-column: 2 / -1; color: var(--muted); font-size: .8rem; }
  .prog-tbl .pg-res, .prog-tbl .pg-sug, .prog-tbl .pg-dec { grid-column: 2 / -1; }
  .prog-tbl td[data-label]::before { content: attr(data-label); display: block; font-size: .62rem; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .prog-tbl .ov { width: 100% !important; } .prog-tbl .dec { width: 100%; }
  #applyProg { width: 100%; min-height: 50px; }
}
@media (max-width: 760px) { .max-upd th, .max-upd td { padding: .45rem .3rem; font-size: .85rem; } .max-upd .takeMax { width: 24px; height: 24px; } }
/* desktop / tablet logger: big per-set tick; rest timer sits above the sticky Save / Complete bar */
@media (min-width: 761px) {
  .set-tick { width: 48px; height: 48px; font-size: 1.35rem; }
  .rest-timer { bottom: 5.6rem; } /* sits above the sticky Save / Complete bar */
}
/* add / delete sets */
.del-td { width: 34px; }
.del-set { width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; }
.del-set:hover { color: var(--danger); border-color: var(--danger); }
.add-set-row { display: flex; justify-content: flex-start; margin: .35rem 0 .2rem; }
.add-set { border-style: dashed; }
.added-tag { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; font-size: .62rem; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; background: var(--warn-bg); color: var(--warn-fg); border: 1px solid var(--warn-line); vertical-align: middle; }
.sets tr.set-skipped td { opacity: .75; }
.sets tr.set-skipped .setno { text-decoration: line-through; color: var(--muted); }
.skip-td { font-size: .85rem; }
.hist-set.extra { color: var(--warn-fg); } .hist-set.skipped { color: var(--muted); text-decoration: line-through; }
@media (max-width: 760px) {
  table.sets td.c-p { grid-column: 1 / span 5; }
  table.sets td.e1 { grid-column: 6 / span 2; }
  table.sets td.pl-td { grid-column: 8 / span 3; }
  table.sets td.del-td { grid-row: 3; grid-column: 11 / span 2; width: auto; align-self: end; text-align: right; }
  table.sets .del-set { width: 100%; max-width: 48px; height: 46px; border-radius: 10px; font-size: 1rem; }
  table.sets tr.set-skipped { align-items: center; }
  table.sets tr.set-skipped td.skip-td { grid-row: 1; grid-column: 4 / -1; text-align: right; }
  table.sets tr.set-main[data-done="1"]:not(.open) > td.del-td { display: none; }
  .add-set { width: 100%; min-height: 46px; }
  table.sets tr.set-main { transition: transform .15s ease; }
}


/* ---- skip / undo / reopen / restart (athlete workout) ---- */
.undo-toast { position: fixed; z-index: 60; top: calc(env(safe-area-inset-top, 0px) + .75rem); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: .75rem;
  background: var(--toast-bg); color: var(--toast-fg); padding: .5rem .5rem .5rem 1rem; border-radius: 12px; font-weight: 800; box-shadow: 0 6px 30px var(--shadow); width: max-content; max-width: calc(100vw - 1.5rem); overflow: hidden; }
.undo-toast[hidden] { display: none; }
.undo-toast .ut-btn { min-height: 44px; min-width: 72px; padding: 0 .9rem; border-radius: 9px; border: 2px solid currentColor; background: transparent; color: inherit; font: inherit; font-weight: 900; cursor: pointer; }
.undo-toast .ut-btn:focus-visible { outline: 3px solid var(--accent-glow-strong); outline-offset: 2px; }
.undo-toast .ut-bar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: currentColor; opacity: .45; transform-origin: left; animation: ut-shrink linear forwards; }
@keyframes ut-shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .undo-toast .ut-bar { animation: none; } }
.done-banner { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.skip-banner { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-fg); padding: .7rem 1rem; border-radius: 10px; font-weight: 700; margin-bottom: 1rem; }
.ex-state { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem .75rem; border-radius: 10px; margin: .5rem 0; font-size: .92rem; }
.ex-state.done { background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-fg); }
.ex-state.skipped { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-fg); }
.ex-state .btn, .skip-banner .btn, .done-banner .btn { min-height: 40px; }
.wo-ex.ex-st-skipped { opacity: .9; }
.wo-ex.ex-st-skipped .wo-big, .wo-ex.ex-st-skipped .presc { opacity: .55; }
.wo-ex.ex-st-done .sets input:disabled { opacity: 1; color: var(--text); -webkit-text-fill-color: var(--text); background: transparent; }
.wo-ex.ex-st-done .sets .stepper .btn:disabled, .wo-ex.ex-st-done .sets .del-set:disabled, .wo-ex.ex-st-done .sets .plate-btn:disabled, .wo-ex.ex-st-done .sets .note-btn:disabled { visibility: hidden; }
.ex-badge.ex-b-done { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.ex-badge.ex-b-skip, .badge.hist-skip, .badge.st-skipped { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.ex-foot { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ex-foot .btn { min-height: 44px; }
.skip-reasons { border: 0; padding: 0; margin: .4rem 0 .6rem; display: flex; flex-wrap: wrap; gap: .4rem; }
.skip-reasons legend { font-weight: 800; font-size: .8rem; text-transform: uppercase; margin-bottom: .35rem; padding: 0; }
.skip-r { position: relative; }
.skip-r input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.skip-r span { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border-radius: 999px; border: 2px solid var(--line); font-weight: 800; }
.skip-r input:checked + span { border-color: var(--accent-glow-strong); background: var(--accent-glow); }
.skip-r input:focus-visible + span { outline: 3px solid var(--accent-glow-strong); outline-offset: 2px; }
.pu-skips { margin-top: .2rem; color: var(--warn-fg); font-weight: 700; }
.ib-note.skip { color: var(--warn-fg); }
.ib-skip { color: var(--warn-fg); }
@media (max-width: 640px) {
  .ex-foot .spacer { display: none; }
  .ex-foot .btn { flex: 1 1 auto; }
}

/* energy change: a set the athlete already logged keeps its kg; offer the new target */
table.sets tr.tgt-row td { padding-top: 0; padding-bottom: .35rem; font-size: .85rem; }
.tgt-hint { color: var(--warn-fg); font-weight: 700; }
table.sets .btn.tgt-use { min-height: 40px; min-width: 60px; margin-left: .35rem; }
@media (max-width: 640px) {
  table.sets tr.tgt-row { display: flex; align-items: center; gap: .4rem; padding: 0 0 .5rem; }
  table.sets tr.tgt-row td { display: block; padding: 0; }
  table.sets tr.tgt-row td.setno { display: none; }
  table.sets .btn.tgt-use { min-height: 44px; }
}

/* start-of-session energy prompt + read-only badge */
.energy-gate { border: 2px solid var(--gold); margin-bottom: 1rem; }
.energy-gate h2 { margin: 0 0 .3rem; font-size: 1.5rem; }
.energy-gate .energy { max-width: none; margin-top: .75rem; }
.energy-gate .energy button { min-height: 88px; }
.energy-gate .energy button b { font-size: 2rem; }
.en-badge-row { display: flex; align-items: center; gap: .6rem; margin-top: .55rem; flex-wrap: wrap; }
.en-badge { font-size: .85rem; padding: .3rem .7rem; background: var(--panel2); border: 1px solid var(--line-strong); color: var(--text); }
.linklike { background: none; border: 0; padding: .25rem .2rem; min-height: 44px; color: var(--text-2); text-decoration: underline; font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.linklike:hover { color: var(--text); }
.linklike:focus-visible { outline: 3px solid var(--accent-glow-strong); outline-offset: 2px; border-radius: 6px; }
@media (max-width: 640px) { .energy-gate .energy button { min-height: 76px; } }

/* ---------- library ownership (master library vs a coach's own exercises) ---------- */
.badge.own-badge { background: var(--panel2); color: var(--muted); border-color: var(--line); }
.badge.own-badge.mine { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }
.lib-note { margin: -.2rem 0 .7rem; max-width: 60rem; }
.save-to { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .25rem; }
.save-to label { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 10px; padding: .45rem .7rem; min-height: 44px; cursor: pointer; font-weight: 700; margin: 0; flex: 1 1 14rem; }
.save-to label:has(input:checked) { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.save-to input { width: auto; margin: 0; }
.save-to .lbl, span.lbl { display: block; font-weight: 800; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
/* finished week / block (read-only lock) */
.lock-banner { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; background: var(--panel2); border: 1px solid var(--line); padding: .7rem 1rem; border-radius: 10px; font-weight: 700; margin-bottom: 1rem; }
.lock-badge { background: var(--panel2); border: 1px solid var(--line); }
.wk-locked .sched-day { opacity: .8; }
/* ===== Gym Records boards — app theme (panel, gold header row, gold highlight), laid out like the gym wall boards ===== */
.grb-tabs { flex-wrap: wrap; }
.grb { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; color: var(--text); }
.grb-top { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; background: var(--panel2); border-radius: 10px; padding: .8rem 1.1rem; margin-bottom: .9rem; }
.grb-title { font-family: var(--display); font-size: clamp(1.6rem, 4.5vw, 3.2rem); letter-spacing: .03em; color: var(--strong); margin: 0; flex: 1; line-height: 1; }
.grb-tools { display: flex; gap: .5rem; flex-wrap: wrap; }
.grb-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 2px solid var(--line-strong); border-radius: 6px; background: var(--sunken); }
.grb-table { width: 100%; border-collapse: collapse; min-width: 640px; font-family: var(--display); }
.grb-table th, .grb-table td { border: 1px solid var(--line); padding: .45rem .6rem; text-align: center; white-space: nowrap; }
.grb-table thead th { background: var(--gold); color: var(--on-gold); font-size: 1.05rem; text-transform: uppercase; letter-spacing: .03em; padding: .6rem; }
.grb-table tbody th.grb-wc { font-size: 1.15rem; color: var(--text); background: var(--sunken); position: sticky; left: 0; z-index: 1; min-width: 4.2rem; }
.grb-table thead th.grb-wc { position: sticky; left: 0; z-index: 2; }
.grb-cell { position: relative; cursor: pointer; font-size: 1.02rem; color: var(--text); }
.grb-cell:hover, .grb-cell:focus-visible { background: var(--row-hover); outline: none; }
.grb-cell:focus-visible { box-shadow: inset 0 0 0 2px var(--gold); }
.grb-kg small { font-size: .55em; margin-left: .08em; letter-spacing: 0; }
.grb-slash { display: inline-block; width: 3px; height: 1.05em; background: var(--gold); transform: skewX(-18deg); margin: 0 .35em -.12em; }
.grb-name { letter-spacing: .01em; }
.grb-cell.hl, .grb-cell.hl .grb-name, .grb-cell.hl .grb-kg { color: var(--gold-text); }
.grb-cell.hl { box-shadow: inset 0 0 0 2px var(--gold); }
.grb-none { color: var(--muted); }
.grb-prev { position: absolute; top: 2px; right: 4px; font-family: var(--font); font-size: .62rem; font-weight: 700; color: var(--muted); }
.grb-rowtools { display: inline-flex; gap: 2px; margin-left: .3rem; vertical-align: middle; }
.grb-rowtools .btn { color: var(--text); border-color: var(--line); min-height: 26px; padding: 0 .35rem; }
.grb.editing .grb-cell::after { content: "✎"; position: absolute; bottom: 2px; right: 4px; font-size: .7rem; color: var(--muted); font-family: var(--font); }
.grb-foot { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-top: .8rem; color: var(--muted); }
.grb-foot .muted { color: var(--muted); }
.grb-panel { max-width: 560px; }
.grb-actions { flex-wrap: wrap; }
.grb-hist { margin-top: .6rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .7rem; background: var(--panel2); }
.grb-hist summary { cursor: pointer; font-weight: 800; }
.grb-hist ul { list-style: none; padding: 0; margin: .4rem 0 0; }
.grb-hist li { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .3rem 0; border-top: 1px solid var(--line); }
.grb-hist li > span:first-child { flex: 1; }
.grb-big { font-size: 1.4rem; margin: 0 0 .3rem; }
/* TV: full screen fills the display, type scales with the screen */
.grb:fullscreen { border-radius: 0; padding: 2vh 2vw; display: flex; flex-direction: column; overflow: auto; background: var(--panel); }
.grb:fullscreen .grb-tools { display: none; }
.grb:fullscreen .grb-title { font-size: 6vh; }
.grb:fullscreen .grb-scroll { flex: 1; overflow: hidden; border-width: 3px; }
.grb:fullscreen .grb-table { height: 100%; min-width: 0; }
.grb:fullscreen .grb-table thead th { font-size: 3.4vh; }
.grb:fullscreen .grb-table td, .grb:fullscreen .grb-table tbody th { font-size: 3.3vh; padding: .4vh .8vw; }
.grb:fullscreen .grb-rowtools, .grb:fullscreen .grb-prev, .grb:fullscreen .grb-foot, .grb:fullscreen.editing .grb-cell::after { display: none; }
/* phones: stacked cards (one per weight class) instead of a 5-column table */
@media (max-width: 640px) {
  .grb { padding: .6rem; border-radius: 12px; }
  .grb-top { padding: .6rem .8rem; }
  .grb-scroll { overflow: visible; border: 0; background: transparent; }
  .grb-table, .grb-table tbody, .grb-table tr, .grb-table th, .grb-table td { display: block; min-width: 0; }
  .grb-table thead { display: none; }
  .grb-table tbody tr { background: var(--sunken); border: 1px solid var(--line-strong); border-radius: 10px; margin-bottom: .55rem; overflow: hidden; }
  .grb-table tbody th.grb-wc { position: static; background: var(--gold); color: var(--on-gold); text-align: left; border: 0; padding: .4rem .75rem; display: flex; align-items: center; }
  .grb-table tbody th.grb-wc > span:first-child::before { content: "WC "; font-size: .75em; }
  .grb-table tbody th.grb-wc .grb-rowtools { margin-left: auto; }
  .grb-table tbody th.grb-wc .grb-rowtools .btn { color: var(--on-gold); border-color: var(--on-gold); }
  .grb-cell { display: flex !important; align-items: center; text-align: left; border: 0 !important; border-top: 1px solid var(--line) !important; padding: .5rem .75rem !important; min-height: 44px; font-size: .98rem; }
  .grb-cell::before { content: attr(data-label); font-size: .72rem; color: var(--muted); width: 5.2rem; flex: none; text-transform: uppercase; letter-spacing: .04em; }
  .grb-prev { position: static; margin-left: auto; padding-left: .4rem; }
}
.grb-hlbox { display: flex; align-items: flex-end; }
.grb-hl-lbl { display: flex; align-items: center; gap: .5rem; min-height: 44px; cursor: pointer; }
.grb-hl-lbl input { width: 1.2rem; height: 1.2rem; margin: 0; }
@media (max-width: 640px) { .grb-table tbody th.grb-wc { text-transform: uppercase; } }
