:root {
  --brand: #0c3b2e;
  --on-brand: #ffffff;
  --accent: #f2c230;
  --on-accent: #10160f;
  --brand-2: color-mix(in srgb, var(--on-brand) 10%, var(--brand));
  --brand-3: color-mix(in srgb, var(--on-brand) 18%, var(--brand));
  --on-brand-2: color-mix(in srgb, var(--on-brand) 68%, var(--brand));
  --brand-tint: color-mix(in srgb, var(--brand) 8%, var(--surface));

  --bg: #f4f5f2;
  --surface: #ffffff;
  --sunken: #eceee9;
  --ink: #10160f;
  --ink-2: #4b554e;
  --ink-3: #6f7872;
  --line: #e5e7e2;
  --line-2: #d2d6cf;

  --ok: #15803d;
  --ok-soft: #e0f3e6;
  --warn: #7f5706;
  --warn-soft: #fbf0cf;
  --bad: #c9302c;
  --bad-soft: #fbe4e2;

  --r-s: 8px;
  --r-m: 12px;
  --r-l: 18px;
  --r-xl: 26px;
  --lift: 0 1px 2px rgb(16 22 15 / .05), 0 8px 24px -12px rgb(16 22 15 / .12);
  --float: 0 2px 6px rgb(16 22 15 / .08), 0 24px 60px -16px rgb(16 22 15 / .32);
  --ease: cubic-bezier(.2, .8, .2, 1);

  --tabbar-h: 66px;

  --cat-throwing: #d6403a;
  --cat-lifting: #2f6fde;
  --cat-mobility: #0d9aa6;
  --cat-conditioning: #e27f2e;
  --cat-arm-care: #7b5ad9;
  --cat-recovery: #2f9e6b;
  --cat-nutrition: #ae882a;
  --cat-other: #8b938d;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 Archivo, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 700; font-stretch: 112%; letter-spacing: -.018em; line-height: 1.12; }
h1 { font-size: 30px; }
h2 { font-size: 19px; letter-spacing: -.012em; }
h3 { font-size: 15.5px; font-weight: 650; font-stretch: 105%; letter-spacing: -.005em; line-height: 1.25; }
p { margin: 0 0 12px; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.i { flex: none; display: block; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.num { font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); }
.pad { padding: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 8px 16px; border: 1px solid var(--line-2); border-radius: var(--r-m);
  background: var(--surface); font-weight: 550; font-size: 14.5px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s var(--ease);
}
.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: scale(.975); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: color-mix(in srgb, var(--on-brand) 12%, var(--brand)); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 34px; padding: 4px 11px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink-2); text-decoration: none; transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.link:hover { color: var(--ink); text-decoration: underline; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none; margin-left: -4px; }
.back:hover { color: var(--ink); }

/* Fields */
label.field { display: block; font-weight: 550; font-size: 13.5px; }
.hint { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search], input[type=tel], select, textarea {
  display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: var(--r-m); background: var(--surface);
  font-weight: 400; font-size: 16px; transition: border-color .15s, box-shadow .15s; appearance: none;
}
select {
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236f7872' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 16%, transparent); }
::placeholder { color: var(--ink-3); }
textarea { min-height: 88px; resize: vertical; field-sizing: content; }
input[type=color] { width: 52px; height: 44px; padding: 3px; margin-top: 6px; border: 1px solid var(--line-2); border-radius: var(--r-m); background: var(--surface); display: block; cursor: pointer; }
.fields { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.fields .wide { grid-column: 1 / -1; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: 14.5px; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check .box { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 1.5px solid var(--line-2); border-radius: 7px; background: var(--surface); color: transparent; transition: background .15s, border-color .15s; }
.check input:checked + .box { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.check input:focus-visible + .box { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; font-weight: 500; cursor: pointer; }
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch { position: relative; width: 42px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--line-2); transition: background .18s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }
.drop {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px dashed var(--line-2); border-radius: var(--r-m);
  background: var(--surface); font-weight: 550; font-size: 14.5px; cursor: pointer; transition: border-color .15s, background .15s;
}
.drop:hover, .drop:focus-within { border-color: var(--brand); background: var(--brand-tint); }
.drop input { position: absolute; opacity: 0; width: 0; height: 0; }
.drop.picked { border-style: solid; border-color: var(--brand); }
.drop.picked .drop-ic { background: var(--brand-tint); color: var(--brand); }
.drop small { display: block; font-weight: 400; color: var(--ink-3); font-size: 13px; }
.drop-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--sunken); color: var(--ink-2); }

/* Tags and small marks */
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 550; padding: 2px 8px; border-radius: 6px; background: var(--sunken); color: var(--ink-2); white-space: nowrap; }
.tag.good { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.alert { background: var(--bad-soft); color: var(--bad); }
.count { display: inline-block; background: var(--bad); color: #fff; border-radius: 10px; min-width: 18px; padding: 0 5px; text-align: center; font-size: 11.5px; font-weight: 650; line-height: 18px; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat, var(--cat-other)); display: inline-block; flex: none; }
.avatar { display: inline-grid; place-items: center; flex: none; border-radius: 50%; font-weight: 650; letter-spacing: .01em; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line-2); background: var(--surface); border-radius: 18px; padding: 5px 12px; font-size: 13px; font-weight: 500; transition: background .15s, border-color .15s; }
.chip:hover { border-color: var(--ink-3); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
[data-cat='throwing'] { --cat: var(--cat-throwing); }
[data-cat='lifting'] { --cat: var(--cat-lifting); }
[data-cat='mobility'] { --cat: var(--cat-mobility); }
[data-cat='conditioning'] { --cat: var(--cat-conditioning); }
[data-cat='arm-care'] { --cat: var(--cat-arm-care); }
[data-cat='recovery'] { --cat: var(--cat-recovery); }
[data-cat='nutrition'] { --cat: var(--cat-nutrition); }

/* Split-flap tile: the one loud element */
.flap {
  position: relative; display: inline-grid; place-items: center; overflow: hidden; width: 40px; height: 48px; border-radius: 6px;
  background: linear-gradient(to bottom, var(--brand-3) 0 50%, var(--brand-2) 50% 100%);
  color: var(--on-brand); font-size: 25px; font-stretch: 88%; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .07), 0 1px 2px rgb(0 0 0 / .25);
}
.flap::after { content: ''; position: absolute; left: 0; right: 0; top: calc(50% - .5px); height: 1px; background: rgb(0 0 0 / .4); }
.flap b { font-weight: inherit; }
.flap.partial { color: var(--accent); }
.flap.missed { background: linear-gradient(to bottom, #d8413b 0 50%, #c4322d 50% 100%); color: #fff; }
.flap.open, .flap.upcoming { background: var(--brand-2); color: var(--on-brand-2); box-shadow: none; }
.flap.open::after, .flap.upcoming::after { background: rgb(0 0 0 / .18); }
.flap.rest { background: transparent; color: var(--on-brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); font-weight: 500; }
.flap.rest::after { display: none; }
.anim .flap { animation: flap-in .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms); transform-origin: center 50%; }
@keyframes flap-in { from { transform: perspective(240px) rotateX(-88deg); opacity: 0; } to { transform: perspective(240px) rotateX(0); opacity: 1; } }

/* App frame */
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px 14px; background: var(--surface); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; font-stretch: 112%; letter-spacing: -.02em; text-decoration: none; min-width: 0; }
.brand .logo { max-height: 34px; max-width: 160px; display: block; }
.rail > .brand { padding: 2px 10px 22px; }
.rail-nav { display: flex; flex-direction: column; gap: 2px; }
.nav { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; font-size: 14.5px; text-decoration: none; transition: background .12s, color .12s; }
.nav span:first-of-type { flex: 1; }
.nav:hover { background: var(--bg); color: var(--ink); }
.nav.on { background: var(--brand-tint); color: var(--brand); font-weight: 600; }
.rail-user { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 4px 0 8px; border-top: 1px solid var(--line); font-size: 13.5px; font-weight: 500; }
.content { min-width: 0; display: flex; flex-direction: column; }
.main { padding: 32px 40px 72px; width: 100%; max-width: 1240px; margin: 0 auto; }
.main.flush { padding: 0; max-width: none; }
.shell:has(.main.flush) { grid-template-columns: minmax(0, 1fr); }
.shell:has(.main.flush) .rail, .shell:has(.main.flush) .tabbar, .shell:has(.main.flush) .topbar { display: none; }
.topbar, .tabbar { display: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .sub { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
section.block { margin-top: 32px; }
section.block > h2 { margin-bottom: 12px; }
body.loading::before { content: ''; position: fixed; z-index: 90; top: 0; left: 0; height: 2px; width: 40%; background: var(--brand); animation: load 1s var(--ease) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

/* Scoreboard */
.board { position: relative; background: var(--brand); color: var(--on-brand); border-radius: var(--r-xl); padding: 22px 24px 18px; overflow: hidden; }
.board h2 { color: var(--on-brand); }
.score-head, .score-row { display: grid; grid-template-columns: minmax(170px, 1fr) auto auto; align-items: center; gap: 22px; }
.score-head { padding: 0 8px 10px; color: var(--on-brand-2); font-size: 12.5px; font-weight: 500; }
.score-head .lbl { font-size: 13.5px; }
.score-days { display: grid; grid-template-columns: repeat(7, 40px); gap: 5px; text-align: center; }
.score-days .d { line-height: 1.25; }
.score-days .d.today { color: var(--on-brand); font-weight: 650; }
.score-days .d b { display: block; font-weight: inherit; font-size: 14px; font-variant-numeric: tabular-nums; }
.score-tot { display: grid; grid-template-columns: repeat(3, 34px); gap: 2px; text-align: center; font-variant-numeric: tabular-nums; }
.score-row { padding: 7px 8px; border-radius: var(--r-m); text-decoration: none; color: inherit; transition: background .12s; }
a.score-row:hover { background: var(--brand-2); }
.score-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.score-who > span:not(.avatar) { min-width: 0; }
.score-who b { display: block; font-size: 15.5px; font-weight: 600; font-stretch: 105%; letter-spacing: -.005em; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-who small { display: block; color: var(--on-brand-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-tot span { font-size: 17px; font-weight: 650; font-stretch: 90%; }
.score-sum { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 14px 8px 0; margin-top: 10px; border-top: 1px solid var(--brand-2); color: var(--on-brand-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .flap { width: 16px; height: 20px; font-size: 11px; border-radius: 3px; }
.legend .flap.rest { font-size: 10px; }

/* Lists */
.inbox { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 20px; }
.inbox > section { padding: 20px 8px 10px; min-width: 0; }
.inbox > section + section { border-left: 1px solid var(--line); }
.inbox h2 { padding: 0 12px 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.line { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--r-m); text-decoration: none; color: inherit; width: 100%; background: none; border: 0; text-align: left; transition: background .12s; }
a.line:hover, button.line:hover { background: var(--bg); }
.line.on { background: var(--brand-tint); }
.line b { display: block; font-weight: 600; font-size: 14.5px; line-height: 1.3; }
.line small { display: block; color: var(--ink-3); font-size: 13px; line-height: 1.35; }
.line-none { padding: 6px 12px 14px; color: var(--ink-3); font-size: 14px; }
.group { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.group > * + * { border-top: 1px solid var(--line); }
.group .line { border-radius: 0; padding: 13px 16px; }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 44px 20px; color: var(--ink-3); font-size: 14px; }
.empty b { color: var(--ink); font-weight: 600; font-size: 15px; }
.empty-ic { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 8px; border-radius: 14px; background: var(--sunken); color: var(--ink-2); }
.tabs { display: flex; gap: 2px; padding: 3px; margin: 24px 0 20px; background: var(--sunken); border-radius: 12px; width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; transition: background .15s, color .15s; }
.tabs button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(16 22 15 / .1); }
.dl { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; }

/* Programs */
.program-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.program-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; transition: border-color .15s, box-shadow .2s; }
.program-card:hover { border-color: var(--line-2); box-shadow: var(--lift); }
.program-card a.title { text-decoration: none; }
.program-card a.title:hover h3 { text-decoration: underline; }
.pmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 7px); grid-auto-columns: 7px; gap: 2px; }
.pmap i { border-radius: 2px; background: var(--sunken); }
.pmap i.l1 { background: color-mix(in srgb, var(--brand) 35%, var(--surface)); }
.pmap i.l2 { background: color-mix(in srgb, var(--brand) 65%, var(--surface)); }
.pmap i.l3 { background: var(--brand); }
.program-foot { margin-top: auto; display: flex; align-items: center; gap: 6px; }

/* Library */
.lib-rows .line { display: grid; grid-template-columns: minmax(0, 1.6fr) 130px minmax(0, 1fr) 30px; }
.lib-rows .name { display: flex; align-items: center; gap: 10px; font-weight: 550; min-width: 0; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 220px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { margin: 0; padding-left: 38px; }

/* Master and detail */
.md { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.md-back { display: none; }
.md-list { padding: 8px; }
.md-list h3 { padding: 10px 12px 6px; color: var(--ink-2); }
.video-frame { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border: 0; border-radius: var(--r-m); }
video.video-frame { height: auto; max-height: 62dvh; }
.video-fallback { display: inline-flex; align-items: center; gap: 5px; margin-top: 7px; color: var(--ink-3); font-size: 12.5px; text-decoration: none; }
.video-fallback:hover { color: var(--ink); }
.quote { margin: 14px 0 0; padding: 12px 14px; background: var(--bg); border-radius: var(--r-m); }
.quote small { display: block; color: var(--ink-3); font-size: 12.5px; }

/* Messages */
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100dvh - 164px); min-height: 420px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; padding: 8px; }
.chat-pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-title { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-weight: 600; }
.chat-title a { text-decoration: none; }
.chat-title .md-back { margin: 0; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 18px; }
.chat { display: flex; flex-direction: column; gap: 2px; }
.bubble { max-width: min(78%, 520px); padding: 8px 13px; border-radius: 18px; background: var(--sunken); align-self: flex-start; font-size: 15px; line-height: 1.4; }
.bubble.mine { align-self: flex-end; background: var(--brand); color: var(--on-brand); }
.bubble.tail { margin-bottom: 10px; }
.bubble time { display: block; font-size: 11.5px; opacity: .62; margin-top: 2px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.composer textarea { margin: 0; min-height: 42px; max-height: 140px; border-radius: 21px; padding: 9px 16px; resize: none; background: var(--bg); border-color: transparent; }
.send { width: 42px; height: 42px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--brand); color: var(--on-brand); transition: transform .1s var(--ease); }
.send:active { transform: scale(.92); }

/* Charts */
.charts { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.chart { padding: 16px 18px 14px; min-width: 0; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.chart-head strong { color: var(--ink); font-size: 21px; font-weight: 700; font-stretch: 92%; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.chart-none { padding: 34px 0; text-align: center; color: var(--ink-3); font-size: 13.5px; }
.chart-plot { position: relative; margin-top: 8px; touch-action: pan-y; }
.chart-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-tip { position: absolute; top: -8px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 2px 9px; border-radius: 6px; font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.chart details { font-size: 13px; color: var(--ink-3); margin-top: 6px; }
.chart summary { cursor: pointer; }
.chart table { width: 100%; margin-top: 6px; font-variant-numeric: tabular-nums; border-collapse: collapse; }
.chart td + td { text-align: right; }

/* Settings */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.set-sec { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; padding: 24px; }
.set-sec > header h2 { font-size: 17px; }
.set-sec > header p { margin: 6px 0 0; color: var(--ink-3); font-size: 13.5px; }
.set-list > div { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.set-list > div:first-child { padding-top: 0; }
.inline-form { display: grid; gap: 10px; align-items: end; margin-top: 12px; }
.inline-form.q { grid-template-columns: minmax(0, 1fr) auto; }
.inline-form.q2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, .8fr) minmax(0, .9fr) auto; }
.inline-form input { margin-top: 6px; }

/* Dialogs */
dialog { border: 0; border-radius: var(--r-l); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); color: var(--ink); background: var(--surface); box-shadow: var(--float); overflow-y: auto; }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
dialog.narrow { width: min(420px, calc(100vw - 32px)); }
dialog[open] { animation: dlg-in .22s var(--ease); }
dialog::backdrop { background: rgb(14 20 16 / .46); backdrop-filter: blur(2px); animation: fade .2s; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes fade { from { opacity: 0; } }
.dlg-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 14px 10px 22px; background: var(--surface); }
.dlg-body { padding: 4px 22px 22px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.progress { height: 6px; background: var(--sunken); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }

/* Toasts */
#toasts { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 100; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 9px; background: var(--ink); color: #fff; padding: 10px 16px 10px 12px; border-radius: 22px; font-size: 14px; font-weight: 500; box-shadow: var(--float); animation: toast-in .28s var(--ease); }
.toast svg { color: #86e0a4; }
.toast.err { background: var(--bad); }
.toast.err svg { color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }

/* Program builder */
.builder { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: 100dvh; background: var(--bg); }
.lib-panel { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.lib-head { padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.lib-head .chips { margin-top: 10px; flex-wrap: wrap; overflow: visible; gap: 4px; }
.lib-head .chip { padding: 3px 9px; font-size: 12px; }
.lib-sheet-head { display: none; }
.lib-list { overflow-y: auto; flex: 1; padding: 6px; }
.lib-item { display: flex; width: 100%; gap: 10px; align-items: baseline; border-radius: 9px; padding: 8px 10px; cursor: grab; user-select: none; transition: background .1s; }
.lib-item .dot { transform: translateY(-1px); }
.lib-item:hover, .lib-item:focus-visible, .lib-item.hot { background: var(--brand-tint); }
.lib-item b { display: block; font-weight: 550; font-size: 14px; line-height: 1.3; }
.lib-item small { color: var(--ink-3); font-size: 12.5px; }
.active-hint { display: flex; align-items: center; gap: 6px; margin-top: 10px; color: var(--ink-3); font-size: 12.5px; }
.board-wrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 18px 0; }
.b-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
input.title-input[type=text] { font-size: 23px; font-weight: 700; font-stretch: 112%; letter-spacing: -.018em; line-height: 1.15; border: 1px solid transparent; background: transparent; padding: 3px 6px; margin: 0 0 0 -6px; min-height: 0; border-radius: 8px; }
input.title-input[type=text]:hover { background: var(--sunken); }
input.title-input[type=text]:focus { background: var(--surface); border-color: var(--brand); }
.b-meta { font-size: 13px; color: var(--ink-3); margin-top: 1px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.b-meta input { display: inline-block; width: auto; min-height: 28px; padding: 1px 8px; margin: 0; font-size: 13px; border-radius: 7px; }
.weekbar { display: flex; align-items: center; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.wk-seg { display: flex; gap: 2px; padding: 3px; background: var(--sunken); border-radius: 11px; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.wk { flex: none; min-width: 34px; height: 30px; padding: 0 8px; border: 0; background: none; border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.wk.on { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 1px 2px rgb(16 22 15 / .12); }
.day-pills { display: none; }
#board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(146px, 1fr)); gap: 8px; overflow: auto; padding-bottom: 18px; }
.day-col { display: flex; flex-direction: column; gap: 5px; min-height: 260px; padding: 9px; background: var(--sunken); border-radius: var(--r-m); box-shadow: inset 0 0 0 1px transparent; cursor: pointer; transition: box-shadow .12s, background .12s; }
.day-col.active { background: var(--brand-tint); box-shadow: inset 0 0 0 1.5px var(--brand); }
.day-col.drop { box-shadow: inset 0 0 0 2px var(--brand); background: color-mix(in srgb, var(--brand) 14%, var(--surface)); }
.day-head { display: flex; justify-content: space-between; align-items: baseline; font-weight: 650; font-size: 13.5px; font-stretch: 105%; padding: 0 2px; }
.day-head small { font-weight: 400; color: var(--ink-3); font-size: 12px; font-stretch: 100%; }
input.day-title[type=text] { width: 100%; font-size: 12.5px; color: var(--ink-2); padding: 1px 2px; min-height: 22px; margin: 0 0 3px; border: 0; border-radius: 5px; background: transparent; box-shadow: none; }
input.day-title[type=text]:hover, input.day-title[type=text]:focus { background: var(--surface); }
.block-item { display: block; width: 100%; padding: 7px 9px; background: var(--surface); border-radius: 9px; box-shadow: 0 0 0 1px var(--line); cursor: grab; font-size: 13px; line-height: 1.28; user-select: none; transition: box-shadow .12s, transform .1s; }
.block-item:hover { box-shadow: 0 0 0 1px var(--ink-3), 0 4px 12px -6px rgb(16 22 15 / .25); }
.block-item:active { transform: scale(.985); }
.block-item b { display: flex; gap: 6px; font-weight: 550; overflow-wrap: anywhere; }
.block-item .dot { width: 7px; height: 7px; margin-top: 5px; }
.block-item span.rx { display: flex; align-items: center; gap: 4px; margin: 2px 0 0 13px; color: var(--ink-3); font-size: 12px; }
.block-item.is-done { background: color-mix(in srgb, var(--ok) 7%, var(--surface)); }
.day-tools { display: flex; gap: 2px; margin-top: auto; padding-top: 4px; min-height: 32px; opacity: 0; transition: opacity .12s; }
.day-col:hover .day-tools, .day-col.active .day-tools, .day-tools:focus-within { opacity: 1; }
.day-tools .icon-btn { width: 28px; height: 28px; border-radius: 7px; }
.day-tools .icon-btn:hover { background: var(--surface); }
.fab { display: none; }

/* Sign in */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--surface); }
.auth-side { background: var(--brand); color: var(--on-brand); padding: 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-side .brand { color: var(--on-brand); }
.flapword { display: flex; flex-wrap: wrap; gap: 5px; --size: clamp(38px, calc((50vw - 88px - 5px * var(--n)) / var(--n)), 84px); }
.flapword .flap { width: var(--size); height: calc(var(--size) * 1.32); font-size: calc(var(--size) * .7); border-radius: calc(var(--size) * .1); }
.flapword .gap { width: calc(var(--size) * .4); }
.auth-side p { margin: 22px 0 0; max-width: 40ch; color: var(--on-brand-2); font-size: 17px; line-height: 1.4; }
.auth-form { padding: 40px 24px; display: flex; align-items: center; justify-content: center; }
.auth-form > div { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 27px; margin-bottom: 8px; letter-spacing: -.02em; }
.auth-form form { margin-top: 22px; }

/* Onboarding */
.onboard { max-width: 620px; margin: 0 auto; padding: 32px 16px 80px; }
.steps { display: flex; gap: 8px; margin: 26px 0 22px; }
.steps > span { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.steps > span::before { content: ''; display: block; height: 4px; margin-bottom: 7px; border-radius: 2px; background: var(--line-2); }
.steps > span.done::before, .steps > span.on::before { background: var(--brand); }
.steps > span.on { color: var(--ink); font-weight: 600; }
.agreement + .agreement { margin-top: 12px; }
.agreement .text { max-height: 220px; overflow-y: auto; background: var(--bg); padding: 12px 14px; border-radius: var(--r-m); margin: 10px 0 14px; font-size: 14px; }

/* Athlete: today */
.today-hero { background: var(--brand); color: var(--on-brand); border-radius: var(--r-xl); padding: 16px 22px 22px; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.hero-top .icon-btn { color: var(--on-brand-2); }
.hero-top .icon-btn:hover { background: var(--brand-2); color: var(--on-brand); }
.week-strip { display: flex; align-items: stretch; gap: 2px; flex: 1; min-width: 0; justify-content: space-between; max-width: 560px; margin: 0 auto; }
.wd { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 0 7px; border: 0; border-radius: 12px; background: transparent; color: var(--on-brand-2); text-decoration: none; transition: background .15s; }
.wd:hover { background: var(--brand-2); }
.wd small { font-size: 11.5px; font-weight: 500; }
.wd b { font-size: 16px; font-weight: 650; font-stretch: 92%; font-variant-numeric: tabular-nums; color: var(--on-brand); }
.wd i { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wd.open i, .wd.upcoming i { background: var(--on-brand-2); opacity: .55; }
.wd.partial i { background: var(--accent); }
.wd.done i { background: var(--accent); width: 12px; border-radius: 3px; }
.wd.missed i { background: #ef6b64; }
.wd.sel { background: var(--accent); color: var(--on-accent); }
.wd.sel:hover { background: var(--accent); }
.wd.sel b { color: var(--on-accent); }
.wd.sel i { background: var(--on-accent); opacity: .7; }
.wd.sel.rest i { background: transparent; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; }
.hero-main h1 { font-size: clamp(27px, 4.5vw, 38px); color: var(--on-brand); }
.hero-main .sub { margin-top: 5px; color: var(--on-brand-2); font-size: 14px; }
.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--brand-2); }
.ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s var(--ease); }
.ring div { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 21px; font-weight: 700; font-stretch: 88%; font-variant-numeric: tabular-nums; }
.ring div small { font-size: 13px; font-weight: 500; color: var(--on-brand-2); margin: 3px 0 0 1px; }
.seg { display: none; }
.today-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, 1fr); gap: 28px; margin-top: 24px; align-items: start; }
.side-col { display: flex; flex-direction: column; gap: 24px; }
.pane > h2 { margin-bottom: 10px; display: flex; align-items: center; gap: 7px; }
.banner { display: flex; align-items: center; gap: 10px; background: var(--warn-soft); color: var(--warn); padding: 10px 14px; border-radius: var(--r-m); margin: 14px 0 0; font-size: 14px; font-weight: 500; }
.cat-head { display: flex; align-items: center; gap: 8px; margin: 22px 2px 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.cat-head:first-child { margin-top: 0; }
.ex-row { display: flex; align-items: stretch; min-height: 62px; }
.ex-check { width: 56px; flex: none; display: grid; place-items: center; background: none; border: 0; }
.ex-check i { width: 28px; height: 28px; border: 1.5px solid var(--line-2); border-radius: 50%; display: grid; place-items: center; color: transparent; transition: background .18s, border-color .18s; }
.ex-check:hover i { border-color: var(--ok); }
.ex-row.done .ex-check i { background: var(--ok); border-color: var(--ok); color: #fff; animation: pop .32s var(--ease); }
@keyframes pop { 40% { transform: scale(1.18); } }
.ex-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; background: none; border: 0; padding: 10px 14px 10px 0; }
.ex-open > span:first-child { flex: 1; min-width: 0; }
.ex-open b { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; transition: color .15s; }
.ex-open small { display: block; color: var(--ink-3); font-size: 13.5px; }
.ex-row.done .ex-open b { color: var(--ink-3); }
.ex-tags { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; }
.ex-play { color: var(--ink-3); }
.ex-play .i { fill: currentColor; stroke: none; }
.metric-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 14px 8px 16px; min-height: 54px; font-weight: 500; font-size: 14.5px; cursor: text; }
.metric-input { display: flex; align-items: center; gap: 6px; flex: none; }
.metric-input input { width: 92px; margin: 0; min-height: 38px; padding: 6px 10px; text-align: right; background: var(--bg); border-color: transparent; font-variant-numeric: tabular-nums; }
.metric-input em { font-style: normal; color: var(--ink-3); font-size: 13px; min-width: 34px; }
.metric-block { display: block; padding: 12px 16px; font-weight: 500; font-size: 14.5px; }
.scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; margin-top: 8px; }
.scale label { cursor: pointer; }
.scale input { position: absolute; opacity: 0; width: 0; height: 0; }
.scale span { display: grid; place-items: center; height: 36px; border-radius: 8px; background: var(--bg); font-size: 14px; font-weight: 550; font-variant-numeric: tabular-nums; transition: background .12s, color .12s; }
.scale input:checked + span { background: var(--brand); color: var(--on-brand); }
.scale input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.form-foot { padding: 12px 16px; }
.q-field { display: block; padding: 14px 16px; font-weight: 550; font-size: 14.5px; }
.q-field textarea { min-height: 60px; background: var(--bg); border-color: transparent; }

/* Athlete: exercise sheet */
.rx-grid { display: flex; gap: 8px; margin: 14px 0; }
.rx-grid > div { flex: 1; min-width: 0; padding: 10px 12px; background: var(--bg); border-radius: var(--r-m); }
.rx-grid small { display: block; color: var(--ink-3); font-size: 12px; }
.rx-grid b { display: block; font-size: 17px; font-weight: 650; font-stretch: 94%; line-height: 1.2; overflow-wrap: anywhere; }
.note { margin: 0 0 12px; font-size: 14.5px; }
.note small { display: block; color: var(--ink-3); font-size: 12.5px; margin-bottom: 1px; }
.upload-opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
@media (hover: hover) and (pointer: fine) { .touch-only { display: none !important; } }

/* Athlete: plan and videos */
.plan-weeks { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; }
.plan-weeks h2 { margin-bottom: 10px; }
.plan-day { display: flex !important; align-items: center; gap: 12px; }
.plan-date { width: 42px; flex: none; text-align: center; line-height: 1.1; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.plan-date b { display: block; color: var(--ink); font-size: 17px; font-weight: 650; font-stretch: 92%; font-variant-numeric: tabular-nums; }
.feedback-list > div { padding: 16px; }
.feedback { margin: 10px 0 8px; padding: 10px 14px; border-radius: 4px 14px 14px 14px; background: var(--brand-tint); }
.feedback small { display: block; color: var(--ink-3); font-size: 12.5px; }
.ath-chat { display: flex; flex-direction: column; height: calc(100dvh - 164px); min-height: 400px; overflow: hidden; }

@media (max-width: 1100px) {
  .inbox { grid-template-columns: minmax(0, 1fr); }
  .inbox > section + section { border-left: 0; border-top: 1px solid var(--line); }
  .main { padding: 28px 24px 64px; }
}

/* Narrow desktop and tablet: rail stays, so the scoreboard drops its totals to keep the week readable */
@media (min-width: 861px) and (max-width: 1060px) {
  .score-head, .score-row { gap: 14px; }
  .score-days { grid-template-columns: repeat(7, 34px); gap: 4px; }
  .score-row .flap { width: 34px; height: 42px; font-size: 22px; }
  .score-tot { display: none; }
  .legend span:last-child { display: none; }
  .today-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  h1 { font-size: 26px; }
  .shell { display: block; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .shell:has(.main.flush) { padding-bottom: 0; }
  .rail { display: none; }
  .topbar { display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); }
  .tabbar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; padding: 7px 4px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--ink-3); text-decoration: none; }
  .tab-ic { position: relative; display: grid; place-items: center; width: 52px; height: 30px; border-radius: 15px; transition: background .15s; }
  .tab-ic .count { position: absolute; top: -3px; right: 5px; min-width: 16px; line-height: 16px; font-size: 10.5px; padding: 0 4px; box-shadow: 0 0 0 2px var(--surface); }
  .tabbar a.on { color: var(--brand); font-weight: 650; }
  .tabbar a.on .tab-ic { background: var(--brand-tint); }
  .main { padding: 8px 16px 32px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  section.block { margin-top: 26px; }

  /* Scoreboard stacks: who on top, the week full width below */
  .board { margin: 0 -8px; padding: 16px 14px 14px; border-radius: 22px; }
  .score-head { display: block; padding: 0 2px 6px; }
  .score-head .lbl, .score-head .score-tot { display: none; }
  .score-row { grid-template-columns: minmax(0, 1fr); gap: 9px; padding: 11px 2px; }
  .score-row + .score-row { border-top: 1px solid var(--brand-2); border-radius: 0; }
  a.score-row:hover { background: none; }
  .score-days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .score-row .score-tot { display: none; }
  .score-row .flap { width: 100%; height: 42px; font-size: 22px; }
  .score-sum { display: block; margin-left: auto; color: var(--on-brand-2); font-size: 12.5px; white-space: nowrap; }
  .legend { padding: 12px 2px 0; margin-top: 2px; font-size: 12px; gap: 5px 14px; }

  .inbox > section { padding: 16px 4px 8px; }
  .inbox { margin-top: 16px; }
  .lib-rows .line { grid-template-columns: minmax(0, 1fr) auto; row-gap: 0; }
  .lib-rows .hide-m { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .search { min-width: 0; flex: none; }
  .toolbar .chips { margin: 0 -16px; padding: 0 16px; }

  .md { display: block; }
  .md.has-detail .md-list { display: none; }
  .md:not(.has-detail) .md-detail { display: none; }
  .md-back { display: inline-flex; margin-bottom: 12px; }
  .chat-layout { display: block; height: auto; min-height: 0; border: 0; background: none; overflow: visible; }
  .chat-list { border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); }
  .chat-layout.has-detail .chat-list { display: none; }
  .chat-layout:not(.has-detail) .chat-pane { display: none; }
  .chat-layout.has-detail .chat-pane { height: calc(100dvh - var(--tabbar-h) - 74px - env(safe-area-inset-bottom)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
  .main:has(.chat-layout.has-detail) .page-head { display: none; }
  .main:has(.chat-layout.has-detail), .main:has(.ath-chat) { padding-bottom: 8px; }
  .md:not(.has-detail) .line.on, .chat-layout:not(.has-detail) .line.on { background: none; }
  .ath-chat { height: calc(100dvh - var(--tabbar-h) - 96px - env(safe-area-inset-bottom)); min-height: 0; }

  .set-sec { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 18px; }
  .inline-form.q2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .inline-form.q2 > :first-child { grid-column: 1 / -1; }
  .inline-form.q2 .btn { grid-column: 1 / -1; }

  /* Dialogs become sheets */
  dialog, dialog.wide, dialog.narrow { position: fixed; width: 100%; max-width: none; margin: auto 0 0; max-height: 92dvh; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  dialog[open] { animation: sheet-in .32s var(--ease); }
  .dlg-head { padding: 14px 10px 8px 18px; }
  .dlg-body { padding: 4px 18px 20px; }
  .dlg-actions .btn { flex: 1; }
  #toasts { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }

  /* Builder: one day at a time, library in a full-screen sheet */
  .builder { display: block; height: auto; min-height: 100dvh; }
  .lib-panel { display: none; position: fixed; inset: 0; z-index: 30; border: 0; }
  .lib-panel.open { display: flex; animation: sheet-in .28s var(--ease); }
  .lib-sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
  .lib-head .chips { flex-wrap: nowrap; overflow-x: auto; margin: 10px -14px 0; padding: 0 14px; }
  .lib-back-desktop { display: none !important; }
  .board-wrap { padding: calc(12px + env(safe-area-inset-top)) 16px 96px; }
  input.title-input[type=text] { font-size: 21px; }
  .b-top { row-gap: 10px; }
  .b-top .grow { flex: 1 1 calc(100% - 48px); }
  .b-top > .btn { width: 100%; }
  .weekbar .btn { flex: 1; }
  .weekbar .btn.danger { flex: none; width: 42px; padding: 0; }
  .hide-m { display: none; }
  .wk-seg { width: 100%; }
  .day-pills { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-bottom: 12px; }
  .day-pills button { display: flex; flex-direction: column; align-items: center; padding: 6px 0 5px; border: 0; border-radius: 10px; background: var(--sunken); font-size: 11.5px; color: var(--ink-3); font-weight: 500; }
  .day-pills b { font-size: 15px; color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
  .day-pills button.on { background: var(--brand); color: var(--on-brand); }
  .day-pills button.on b { color: var(--on-brand); }
  #board { display: block; overflow: visible; padding: 0; }
  .day-col:not(.active) { display: none; }
  .day-col.active { background: transparent; box-shadow: none; padding: 0; min-height: 0; }
  .day-head { display: none; }
  input.day-title[type=text] { font-size: 16px; font-weight: 550; color: var(--ink); min-height: 34px; margin-bottom: 6px; padding: 2px 4px; }
  .block-item { padding: 12px 14px; font-size: 15px; border-radius: var(--r-m); margin-bottom: 2px; }
  .block-item .dot { margin-top: 7px; }
  .block-item span.rx { font-size: 13.5px; }
  .day-tools { opacity: 1; padding-top: 8px; gap: 6px; }
  .day-tools .icon-btn { width: 40px; height: 40px; background: var(--sunken); border-radius: 10px; }
  .fab { display: flex; position: fixed; z-index: 15; right: 16px; bottom: calc(18px + env(safe-area-inset-bottom)); height: 52px; padding: 0 20px 0 16px; align-items: center; gap: 8px; border: 0; border-radius: 26px; background: var(--brand); color: var(--on-brand); font-weight: 600; box-shadow: var(--float); }

  /* Sign in */
  .auth { display: block; }
  .auth-side { padding: calc(18px + env(safe-area-inset-top)) 20px 26px; gap: 22px; }
  .flapword { --size: clamp(26px, calc((100vw - 40px - 5px * var(--n)) / var(--n)), 46px); }
  .auth-side p { font-size: 15px; margin-top: 14px; }
  .auth-form { padding: 28px 20px 40px; align-items: flex-start; }

  /* Athlete today */
  .main:has(.today-hero) { padding: 0 0 24px; }
  .today-hero { border-radius: 0 0 var(--r-xl) var(--r-xl); padding: calc(10px + env(safe-area-inset-top)) 12px 20px; }
  .hero-main { padding: 0 6px; margin-top: 14px; }
  .ring { width: 74px; height: 74px; }
  .ring div { font-size: 19px; }
  .seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 3px; margin: 14px 16px 0; background: var(--sunken); border-radius: 12px; position: sticky; top: calc(8px + env(safe-area-inset-top)); z-index: 5; }
  .seg button { display: flex; align-items: center; justify-content: center; gap: 5px; height: 36px; border: 0; background: none; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); transition: background .15s; }
  .seg button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(16 22 15 / .12); }
  .seg button .tick { color: var(--ok); }
  .today-grid { display: block; margin: 14px 16px 0; }
  .side-col { display: block; }
  .pane { display: none; }
  .pane.on { display: block; }
  .pane > h2 { display: none; }
  .banner { margin: 14px 16px 0; }
  .plan-weeks { grid-template-columns: minmax(0, 1fr); }
  .dl { grid-template-columns: 110px minmax(0, 1fr); }
}

@keyframes sheet-in { from { transform: translateY(40px); opacity: .4; } }

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

/* Hide any Netlify injected HUD, drawer, or badge */
iframe[style*="2147483645"], iframe[srcdoc*="netlify"], netlify-drawer, [data-netlify-site-id] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* ---------- Coach Today: the week at a glance ---------- */
.week { padding: 18px 20px 14px; }
.wk-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(150px, 190px); align-items: center; gap: 24px; padding: 10px 10px; border-radius: var(--r-m); color: inherit; text-decoration: none; }
a.wk-row { transition: background .12s; }
a.wk-row:hover { background: var(--sunken); }
.wk-row + .wk-row:not(.wk-head) { border-top: 1px solid var(--line); border-radius: 0; }
a.wk-row:hover, a.wk-row:hover + .wk-row { border-color: transparent; }
.wk-head { padding-top: 0; padding-bottom: 6px; }
.wk-title { font-size: 15px; font-weight: 650; }
.wk-days { display: grid; grid-template-columns: repeat(7, 38px); gap: 6px; }
.wk-dh { text-align: center; font-size: 11.5px; color: var(--ink-3, #8a8f88); line-height: 1.2; text-transform: uppercase; letter-spacing: .04em; }
.wk-dh b { display: block; font-size: 14px; font-weight: 600; color: var(--ink-2, #4b5049); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.wk-dh.today, .wk-dh.today b { color: var(--accent); }
.wk-who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wk-who > span:not(.avatar) { min-width: 0; }
.wk-who b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-who small { display: block; font-size: 12.5px; color: var(--ink-3, #8a8f88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.wk-cell { position: relative; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.wk-cell.done { background: var(--ink); color: var(--surface); }
.wk-cell.partial { background: var(--sunken); color: var(--ink); }
.wk-cell.partial .wk-frac { position: relative; z-index: 1; }
.wk-fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--p) * 100%); background: color-mix(in srgb, var(--ink) 18%, transparent); }
.wk-cell.missed { background: var(--bad-soft); color: var(--bad); }
.wk-cell.open { box-shadow: inset 0 0 0 1.5px var(--accent); background: transparent; }
.wk-cell.upcoming { box-shadow: inset 0 0 0 1px var(--line); }
.wk-cell.rest { background: transparent; }
.wk-cell.rest::after { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--line); }
.wk-ci { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.wk-ci.on { background: var(--accent); }
.wk-sum { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.wk-sum small { font-size: 12.5px; color: var(--ink-3, #8a8f88); }
.wk-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 10px 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3, #8a8f88); }
.wk-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.wk-legend .wk-cell { width: 18px; height: 18px; border-radius: 5px; }
.wk-legend .wk-ci { width: 7px; height: 7px; }
.tag.bad { background: var(--bad-soft); color: var(--bad); }

@media (max-width: 1100px) {
  .wk-row { grid-template-columns: minmax(0, 1fr) auto; }
  .wk-sum { grid-column: 1 / -1; flex-direction: row; align-items: center; gap: 10px; margin-top: -6px; padding-left: 48px; }
  .wk-head .wk-sum { display: none; }
}
@media (max-width: 700px) {
  .week { padding: 14px 12px 10px; }
  .wk-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 4px; }
  .wk-head .wk-title { display: none; }
  .wk-head { padding-bottom: 0; }
  .wk-days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
  .wk-cell { width: 100%; height: 36px; }
  .wk-sum { padding-left: 0; margin-top: 0; }
}
.b-desc { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); max-width: 80ch; }
