/* Nine27Fit app. Same tokens as the sales site (tokens.css, Steel palette): grey/white body, navy chrome,
   gold accent, Archivo at wide widths for headings, rounded cards, flat pill buttons.
   Client app = phone layout (header / scroll view / tab bar), shaped so the Expo port is a re-skin.
   Coach console = navy sidebar on desktop, bottom tabs on phones. */

:root {
  --navy: #0F1B33; --navy-2: #16264A; --navy-3: #1E3260;
  --good: #2E7D5B; --good-wash: #E3F1EA; --warn: #A86A12; --warn-wash: #FBF0DC; --bad: #B3402E; --bad-wash: #F8E4DF;
  --ring-track: #E1E3E5;
  --header-h: 60px; --tabbar-h: 64px; --side-w: 236px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter: 16px; --maxw: 680px;
}

html, body { min-height: 100%; }
body { min-height: 100dvh; background: var(--bg); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body.sheet-open { overflow: hidden; }
h1, h2, h3, h4 { margin: 0; color: var(--text-strong); }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.faint { color: var(--faint); }
.num { font-variant-numeric: tabular-nums; }
.ic { flex: none; display: inline-block; vertical-align: middle; }
.mark { color: var(--accent); flex: none; }
.boot { min-height: 100dvh; display: grid; place-items: center; background: var(--navy); }
.boot .mark { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; transform: scale(.94); } }
[hidden] { display: none !important; }

.label, .eyebrow {
  font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  font-stretch: 112%; font-variation-settings: "wdth" 112; color: var(--muted);
}
.eyebrow { color: var(--accent-deep); }
.h-wide { font-family: var(--font-display); font-weight: 800; text-transform: uppercase; letter-spacing: .01em; font-stretch: 115%; font-variation-settings: "wdth" 115; line-height: 1; }

/* ---------------------------------------------------------------- buttons */
.btn { min-height: 46px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-sm { min-height: 36px; padding: 0 16px; font-size: 11.5px; }
.btn-block { width: 100%; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-gold { background: var(--accent); color: var(--navy); }
.btn-ghost-dark { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.06); color: #F2EEE4; }
.btn-text { background: none; border: 0; padding: 0; min-height: 0; color: var(--accent-deep); font-weight: 700; cursor: pointer; font-size: 13px; letter-spacing: .02em; display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.btn-text:hover { text-decoration: underline; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: inline-grid; place-items: center; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text-strong); border-radius: 12px;
}
.icon-btn:hover { border-color: var(--line-strong); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.mini-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-soft); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 12px; }
.card.flush { padding: 0; overflow: hidden; }
.card.dark { background: var(--navy); border-color: var(--navy); color: #D3D7DF; box-shadow: var(--shadow-lift); }
.card.dark h2, .card.dark h3, .card.dark strong { color: #F4F1EA; }
.card.dark .label { color: #A3ACBD; }
.card.dark .eyebrow { color: var(--accent); }
.card.gold { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { font-size: 16px; }
a.card { display: block; text-decoration: none; color: inherit; transition: transform .15s var(--ease), border-color .15s; }
a.card:active { transform: scale(.99); }
a.card:hover { border-color: var(--line-strong); }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 2px 10px; }
.section-head h2 { font-size: 13px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 380px) { .grid3 { grid-template-columns: 1fr 1fr; } }

.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.list-row:first-child { border-top: 0; }
a.list-row:hover, button.list-row:hover { background: var(--bg); }
button.list-row { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; font: inherit; }
button.list-row:first-child { border-top: 0; }
.list-row .t { font-weight: 700; color: var(--text-strong); }
.list-row .s { font-size: 13px; color: var(--muted); }
.list-row > .ic:last-child { color: var(--faint); }

.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-wash); color: var(--good); }
.pill.warn { background: var(--warn-wash); color: var(--warn); }
.pill.bad { background: var(--bad-wash); color: var(--bad); }
.pill.gold { background: var(--accent-wash); color: var(--accent-deep); }
.pill.navy { background: var(--navy); color: #F2EEE4; }
.dot-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--navy); font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; }

.avatar { flex: none; border-radius: 50%; background: var(--navy); color: var(--accent); display: inline-grid; place-items: center; font-weight: 800; letter-spacing: .03em; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.stat { display: grid; gap: 4px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); }
.stat strong { font-size: 24px; line-height: 1; color: var(--text-strong); font-variant-numeric: tabular-nums; font-weight: 800; }
.stat strong small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat .stat-sub { font-size: 12px; color: var(--muted); }
.stat.tone-good strong { color: var(--good); }
.stat.tone-bad strong { color: var(--bad); }
.stat.tone-warn strong { color: var(--warn); }

.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 34px 20px; color: var(--muted); }
.empty-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); color: var(--muted); }
.empty strong { color: var(--text-strong); font-size: 15px; }
.empty p { max-width: 34ch; font-size: 14px; }

.spinner { display: grid; place-items: center; padding: 48px 0; }
.spinner span { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }

.toast {
  position: fixed; z-index: 300; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 18px); transform: translateX(-50%);
  background: var(--navy); color: #F4F1EA; padding: 12px 18px; border-radius: 14px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lift); animation: toastIn .3s var(--ease); max-width: calc(100vw - 32px);
}
.toast.err { background: var(--bad); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; }
.field + .field, .field + .grid2, .grid2 + .field, .grid2 + .grid2, .field + .row, .grid3 + .field, .field + .grid3 { margin-top: 14px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--text-strong); }
.field-hint { font-size: 12.5px; color: var(--muted); }
.input, .field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, textarea.input, select.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 12px;
  background: var(--field); color: var(--text-strong); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea, textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 12%, transparent); }
.input::placeholder, textarea::placeholder { color: var(--faint); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--navy); flex: none; margin-top: 1px; }

.seg { display: inline-flex; padding: 3px; border-radius: 99px; background: var(--bg-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 0 14px; height: 34px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text-strong); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-sm button { height: 28px; padding: 0 11px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn { height: 38px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text); }
.chip-btn.on { background: var(--navy); border-color: var(--navy); color: #F4F1EA; }

.scale-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale-row button { height: 46px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 800; font-size: 16px; cursor: pointer; color: var(--text-strong); }
.scale-row button.on { background: var(--navy); border-color: var(--navy); color: var(--accent); }
.scale-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px; }

/* ---------------------------------------------------------------- sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 200; background: rgba(8, 12, 22, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 560px; max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: 0 -20px 60px -20px rgba(0,0,0,.4);
  animation: sheetUp .32s var(--ease); padding-bottom: var(--safe-b);
}
.sheet.wide { max-width: 760px; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 17px; }
.sheet-body { padding: 18px 20px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px 16px; border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 24px; max-height: calc(100dvh - 80px); }
  .sheet-foot .btn { flex: none; }
}

/* ---------------------------------------------------------------- media */
.vid { position: relative; border-radius: var(--r-sm); overflow: hidden; background: #0A1426; aspect-ratio: 4 / 5; }
.vid.wide { aspect-ratio: 16 / 9; }
.vid video, .vid iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.vid.contain video { object-fit: contain; }
.vid-wait { display: grid; place-items: center; align-content: center; gap: 4px; color: #A3ACBD; font-size: 13px; }
.vid-wait .spinner { padding: 0; }
.img { display: block; border-radius: var(--r-sm); overflow: hidden; background: var(--bg-2); }
.img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aud { width: 100%; max-width: 300px; height: 40px; }
.recorder { display: grid; gap: 12px; }
.rec-preview { width: 100%; border-radius: var(--r-sm); background: #0A1426; aspect-ratio: 4 / 3; object-fit: cover; transform: scaleX(-1); }
.rec-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
.rec-time { font-variant-numeric: tabular-nums; font-size: 18px; }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .axis { fill: var(--faint); font-size: 11px; font-family: var(--font-body); }
.chart .dot { fill: color-mix(in srgb, var(--navy) 28%, transparent); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 3px; }
.bar { flex: 1; background: color-mix(in srgb, var(--navy) 22%, transparent); border-radius: 3px 3px 1px 1px; min-width: 3px; }
.bar.hit { background: var(--accent); }
.bars-target { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); opacity: .6; }
.ring { position: relative; flex: none; }
.ring svg circle:last-child { transition: stroke-dashoffset .8s var(--ease); }
.ring-in { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1; }
.ring-in strong { font-size: 22px; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ring-in small { font-size: 9.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.card.dark .ring-in strong { color: #F4F1EA; }
.card.dark { --ring-track: rgba(255,255,255,.12); }

.meter { display: grid; gap: 7px; }
.meter + .meter { margin-top: 14px; }
.meter-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; }
.meter-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; color: var(--text-strong); }
.meter-label .ic { color: var(--muted); }
.meter-val { color: var(--muted); font-variant-numeric: tabular-nums; }
.meter-val b { color: var(--text-strong); }
.meter-bar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.meter-bar span { display: block; height: 100%; border-radius: 99px; background: var(--navy); transition: width .6s var(--ease); }
.meter-bar span.full { background: var(--accent); }

.prose { display: grid; gap: 12px; line-height: 1.6; color: var(--text); }
.prose ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }

/* ================================================================ CLIENT APP SHELL */
.app-top {
  position: sticky; top: 0; z-index: 50; padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px);
}
.app-top-in { height: var(--header-h); max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); display: flex; align-items: center; gap: 10px; }
.app-top .brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text-strong); }
.app-top .brand .wordmark { font-size: 11.5px; }
.app-top h1 { font-size: 17px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-top .spacer { flex: 1; }
.app-top .me-btn { border: 0; background: none; padding: 0; cursor: pointer; border-radius: 50%; }

.view { max-width: var(--maxw); margin: 0 auto; padding: 8px var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 36px); animation: viewIn .35s var(--ease) both; }
.view.no-tabs { padding-bottom: calc(var(--safe-b) + 40px); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding-bottom: var(--safe-b);
  background: var(--navy); border-top: 1px solid rgba(255,255,255,.06);
}
.tabbar-in { max-width: var(--maxw); margin: 0 auto; height: var(--tabbar-h); display: grid; grid-template-columns: repeat(5, 1fr); }
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-decoration: none; color: #8E97A8; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  font-stretch: 110%; font-variation-settings: "wdth" 110;
}
.tab[aria-current="page"] { color: #F4F1EA; }
.tab[aria-current="page"] .ic { color: var(--accent); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); }
.tab .dot-badge { position: absolute; top: 8px; left: calc(50% + 6px); min-width: 16px; height: 16px; font-size: 10px; }

/* ---------------------------------------------------------------- today */
.hello { margin: 10px 2px 16px; }
.hello h1 { font-size: 30px; }
.hello p { color: var(--muted); margin-top: 6px; }

.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.wd { position: relative; display: grid; justify-items: center; gap: 4px; padding: 9px 0 10px; border-radius: 14px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--text-strong); }
.wd small { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.wd b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.wd .pips { display: flex; gap: 3px; height: 6px; }
.wd .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); }
.wd .pip.done { background: var(--accent); }
.wd.today { border-color: var(--line-strong); background: var(--surface); }
.wd[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #F4F1EA; }
.wd[aria-pressed="true"] small { color: var(--accent); }

.workout-card { display: grid; gap: 14px; position: relative; overflow: hidden; }
.workout-card::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%); pointer-events: none; }
.workout-card h2 { font-size: 26px; }
.workout-card .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #A3ACBD; }
.workout-card .ex-preview { display: flex; flex-wrap: wrap; gap: 6px; }
.workout-card .ex-preview span { font-size: 12px; padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.08); color: #D3D7DF; }
.done-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .04em; }

.momentum { display: flex; align-items: center; gap: 16px; }
.momentum p { font-size: 13px; color: var(--muted); }

.quick-log { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ql { display: grid; gap: 4px; padding: 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.ql:hover { border-color: var(--line-strong); }
.ql .ql-top { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ql b { font-size: 19px; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.ql b small { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.ql.set { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-wash); }
.ql.empty-val b { color: var(--faint); }

.coach-note { display: flex; gap: 12px; align-items: flex-start; }
.coach-note p { font-size: 14px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- train */
.day-list .list-row .wk { width: 44px; text-align: center; flex: none; }
.day-list .wk small { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.day-list .wk b { font-size: 18px; color: var(--text-strong); }
.check-circle { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; color: transparent; }
.check-circle.on { background: var(--accent); border-color: var(--accent); color: var(--navy); }

/* logger */
.logger-head { display: flex; align-items: center; gap: 10px; }
.logger-clock { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--text-strong); font-size: 15px; display: inline-flex; gap: 5px; align-items: center; }
.ex-card { padding: 0; overflow: hidden; }
.ex-card + .ex-card { margin-top: 14px; }
.ex-top { display: flex; gap: 12px; padding: 14px 14px 12px; align-items: flex-start; }
.ex-thumb { width: 64px; height: 64px; border-radius: 12px; overflow: hidden; flex: none; background: var(--navy); display: grid; place-items: center; color: var(--accent); cursor: pointer; border: 0; padding: 0; position: relative; }
.ex-thumb img, .ex-thumb video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.ex-thumb .ic { position: relative; z-index: 1; filter: drop-shadow(0 1px 4px rgba(0,0,0,.5)); }
.ex-name { font-weight: 800; font-size: 16px; color: var(--text-strong); line-height: 1.25; }
.ex-presc { font-size: 13px; color: var(--muted); margin-top: 3px; }
.ex-presc b { color: var(--text-strong); }
.ex-ss { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--navy); color: var(--accent); font-size: 11px; font-weight: 800; margin-right: 6px; vertical-align: 1px; }
.ex-note { margin: 0 14px 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-wash); font-size: 13px; color: var(--text); }
.ex-actions { display: flex; gap: 6px; padding: 0 14px 12px; flex-wrap: wrap; }
.ex-actions .btn-sm { min-height: 32px; padding: 0 12px; font-size: 11px; }

.sets { width: 100%; border-collapse: collapse; }
.sets th { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); text-align: center; padding: 6px 4px; }
.sets th:first-child, .sets td:first-child { padding-left: 14px; text-align: left; width: 34px; }
.sets th:last-child, .sets td:last-child { padding-right: 14px; width: 54px; text-align: right; }
.sets td { padding: 5px 4px; text-align: center; border-top: 1px solid var(--line); }
.sets .setno { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.sets .prev { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sets input { width: 100%; max-width: 76px; min-height: 40px; padding: 6px 4px; text-align: center; font-weight: 700; font-size: 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.sets input:focus { outline: none; border-color: var(--navy); background: var(--surface); }
.sets tr.done td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sets tr.done input { background: transparent; border-color: transparent; }
.tick { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line-strong); background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; color: transparent; }
.tick.on { background: var(--navy); border-color: var(--navy); color: var(--accent); }
.add-set { width: 100%; border: 0; border-top: 1px solid var(--line); background: none; padding: 11px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-set:hover { color: var(--text-strong); background: var(--bg); }

.rest-timer {
  position: fixed; z-index: 70; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 18px);
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 18px; border-radius: 99px;
  background: var(--navy); color: #F4F1EA; box-shadow: 0 18px 40px -16px rgba(0,0,0,.6); animation: toastIn .3s var(--ease);
}
.rest-timer b { font-size: 22px; font-variant-numeric: tabular-nums; min-width: 58px; }
.rest-timer .label { color: var(--accent); }
.rest-timer button { height: 36px; min-width: 36px; padding: 0 12px; border-radius: 99px; border: 0; background: rgba(255,255,255,.1); color: #F4F1EA; font-weight: 700; cursor: pointer; font-size: 13px; }
.rest-timer.over { background: var(--accent); color: var(--navy); }
.rest-timer.over .label { color: var(--navy); }
.rest-timer.over button { background: rgba(15,27,51,.12); color: var(--navy); }

.finish-bar { position: sticky; bottom: calc(var(--safe-b) + 12px); margin-top: 22px; z-index: 20; }
.pr-list { display: grid; gap: 8px; }
.pr { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-wash); }
.pr .ic { color: var(--accent-deep); }

/* ---------------------------------------------------------------- progress */
.photo-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-slot { aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--bg-2); position: relative; display: grid; place-items: center; color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; border: 1px dashed var(--line-strong); }
.photo-slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-slot.has { border: 0; }
.photo-slot .pose { position: absolute; left: 6px; bottom: 6px; z-index: 1; background: rgba(10,20,38,.7); color: #F2EEE4; padding: 2px 7px; border-radius: 6px; font-size: 10px; }
button.photo-slot { cursor: pointer; font: inherit; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare h4 { font-size: 12px; margin-bottom: 6px; color: var(--muted); font-weight: 700; }

.pr-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pr-table td { padding: 11px 0; border-top: 1px solid var(--line); }
.pr-table tr:first-child td { border-top: 0; }
.pr-table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.up { color: var(--good); font-weight: 700; }
.down { color: var(--bad); font-weight: 700; }

/* ---------------------------------------------------------------- messages */
.thread { display: grid; gap: 4px; padding-bottom: 8px; }
.msg-day { text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 14px 0 6px; }
.msg { max-width: 82%; display: grid; gap: 6px; justify-items: start; }
.msg.mine { justify-self: end; justify-items: end; }
.bubble { padding: 10px 14px; border-radius: 18px 18px 18px 6px; background: var(--surface); border: 1px solid var(--line); color: var(--text-strong); font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.mine .bubble { background: var(--navy); border-color: var(--navy); color: #F4F1EA; border-radius: 18px 18px 6px 18px; }
.msg .vid, .msg .img { width: 240px; max-width: 100%; }
.msg .img img { max-height: 320px; }
.msg-meta { font-size: 11px; color: var(--faint); padding: 0 6px; }
.msg-ctx { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-deep); padding: 0 6px; display: inline-flex; gap: 5px; align-items: center; }
.composer {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 30; margin: 0 calc(-1 * var(--gutter));
  padding: 10px var(--gutter); background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; min-height: 44px; max-height: 160px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--line-strong); background: var(--surface); resize: none; font-size: 16px; line-height: 1.35; outline: none; }
.composer textarea:focus { border-color: var(--navy); }
.composer .icon-btn { border-radius: 50%; width: 44px; height: 44px; }
.composer .send { background: var(--navy); color: var(--accent); border-color: var(--navy); }
.attach-preview { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }

/* ---------------------------------------------------------------- onboarding / login */
.auth { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; background: var(--navy); color: #D3D7DF; position: relative; overflow: hidden; }
.auth::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(160,190,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(160,190,255,.06) 1px, transparent 1px);
  background-size: 56px 56px; -webkit-mask-image: radial-gradient(ellipse 80% 60% at 60% 30%, #000 30%, transparent 80%); mask-image: radial-gradient(ellipse 80% 60% at 60% 30%, #000 30%, transparent 80%);
}
.auth::after { content: ""; position: absolute; right: -25%; top: -25%; width: 80%; height: 80%; background: radial-gradient(ellipse, color-mix(in srgb, var(--accent) 22%, transparent), transparent 62%); pointer-events: none; }
.auth-top { position: relative; z-index: 1; padding: calc(var(--safe-t) + 22px) 22px 0; display: flex; align-items: center; gap: 10px; }
.auth-top .wordmark { color: #F4F1EA; font-size: 12px; }
.auth-main { position: relative; z-index: 1; align-self: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 32px 22px calc(var(--safe-b) + 40px); }
.auth h1 { color: #F6F3EC; font-size: clamp(34px, 10vw, 46px); }
.auth h1 em { font-style: normal; color: var(--accent); display: block; }
.auth .sub { margin: 14px 0 28px; color: #A3ACBD; font-size: 16px; }
.auth .input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.18); color: #F4F1EA; }
.auth .input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(210,174,102,.18); }
.auth .input::placeholder { color: #6E7A90; }
.auth .field-label { color: #D3D7DF; }
.auth .btn-text { color: var(--accent); }
.code-input { letter-spacing: .5em; text-align: center; font-size: 26px !important; font-weight: 800; font-variant-numeric: tabular-nums; }

.steps-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 4px 0 20px; }
.steps-bar span { height: 4px; border-radius: 99px; background: var(--line); }
.steps-bar span.on { background: var(--accent); }
.parq { display: grid; gap: 10px; }
.parq-q { display: grid; gap: 10px; padding: 14px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); font-size: 14px; }
.waiver { max-height: 260px; overflow-y: auto; padding: 14px 16px; border-radius: var(--r-sm); background: var(--bg-2); font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

/* ================================================================ COACH CONSOLE */
.coach { min-height: 100dvh; }
.side {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--side-w); z-index: 60; background: var(--navy); color: #A3ACBD;
  display: flex; flex-direction: column; padding: calc(var(--safe-t) + 20px) 14px 16px;
}
.side .brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; text-decoration: none; }
.side .brand .wordmark { color: #F4F1EA; font-size: 11.5px; }
.side .brand .tag { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-top: 3px; font-weight: 700; }
.side nav { display: grid; gap: 2px; }
.side a {
  display: flex; align-items: center; gap: 11px; height: 42px; padding: 0 12px; border-radius: 12px; text-decoration: none;
  color: #A3ACBD; font-weight: 600; font-size: 14px;
}
.side a:hover { background: rgba(255,255,255,.05); color: #F4F1EA; }
.side a[aria-current="page"] { background: rgba(255,255,255,.08); color: #F4F1EA; }
.side a[aria-current="page"] .ic { color: var(--accent); }
.side a .dot-badge { margin-left: auto; }
.side .side-foot { margin-top: auto; display: grid; gap: 2px; border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; }
.side .side-foot button { all: unset; display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 12px; border-radius: 12px; cursor: pointer; font-size: 14px; color: #A3ACBD; }
.side .side-foot button:hover { background: rgba(255,255,255,.05); color: #F4F1EA; }
.coach-main { margin-left: var(--side-w); padding: 28px 32px 60px; max-width: 1240px; animation: viewIn .3s var(--ease) both; }
.coach-tabbar { display: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.page-head .back { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); text-decoration: none; margin-bottom: 8px; font-weight: 600; }
.page-head .back:hover { color: var(--text-strong); }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.cols { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--bg); }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who b { color: var(--text-strong); }
.table .who small { display: block; color: var(--muted); font-size: 12px; }
.mini-bar { width: 64px; height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 8px; }
.mini-bar span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.mini-bar.low span { background: var(--bad); }
.mini-bar.mid span { background: var(--warn); }
.mini-bar.hi span { background: var(--good); }

.tabs-row { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.tabs-row a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs-row a[aria-current="page"] { color: var(--text-strong); border-bottom-color: var(--accent); }

.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 0; font-size: 14px; }
.kv dt, .kv dd { margin: 0; padding: 10px 0; border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); padding-right: 12px; }
.kv dd { color: var(--text-strong); white-space: pre-wrap; }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; }

.answer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.answer { padding: 10px 12px; border-radius: 12px; background: var(--bg); }
.answer span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.answer b { font-size: 18px; color: var(--text-strong); }
.answer b small { font-size: 12px; color: var(--muted); font-weight: 600; }
.qa + .qa { margin-top: 14px; }
.qa h4 { font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.qa p { white-space: pre-wrap; }

/* program builder */
.week-tabs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.week-tabs button { height: 36px; min-width: 44px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 700; font-size: 13px; color: var(--text); }
.week-tabs button.on { background: var(--navy); border-color: var(--navy); color: #F4F1EA; }
.days-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; align-items: start; }
.day-card { padding: 0; overflow: hidden; }
.day-card .day-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg); }
.day-card .day-head input { border: 0; background: none; font-weight: 800; font-size: 15px; color: var(--text-strong); min-width: 0; flex: 1; padding: 4px 0; outline: none; }
.day-card .day-head select { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 4px 6px; font-size: 12px; font-weight: 700; }
.item-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px 10px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.item-row:first-child { border-top: 0; }
.item-row:hover { background: var(--bg); }
.item-row .t { font-weight: 700; font-size: 14px; color: var(--text-strong); }
.item-row .s { font-size: 12.5px; color: var(--muted); }
.item-row .order { display: grid; gap: 0; }
.item-row .order button { border: 0; background: none; color: var(--faint); cursor: pointer; padding: 0 2px; height: 16px; display: grid; place-items: center; }
.item-row .order button:hover { color: var(--text-strong); }
.add-row { width: 100%; padding: 12px; border: 0; border-top: 1px dashed var(--line-strong); background: none; color: var(--muted); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-row:hover { color: var(--text-strong); background: var(--bg); }

.picker { display: grid; gap: 10px; }
.picker-list { max-height: 50vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-sm); }
.picker-list button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 11px 14px; border: 0; border-top: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; font: inherit; }
.picker-list button:first-child { border-top: 0; }
.picker-list button:hover { background: var(--bg); }
.picker-list button.on { background: var(--accent-wash); }
.picker-list .t { font-weight: 700; color: var(--text-strong); font-size: 14px; }
.picker-list .s { font-size: 12px; color: var(--muted); }

.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.lib-card { padding: 0; overflow: hidden; cursor: pointer; text-align: left; font: inherit; border: 1px solid var(--line); }
.lib-card .vid, .lib-card .novid { aspect-ratio: 4 / 3; border-radius: 0; }
.lib-card .novid { display: grid; place-items: center; background: var(--bg-2); color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; gap: 6px; align-content: center; justify-items: center; }
.lib-card .lib-body { padding: 12px 14px; }
.lib-card .t { font-weight: 800; color: var(--text-strong); }
.lib-card .s { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, 1fr); } .cols, .cols-even { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .side { display: none; }
  .coach-main { margin-left: 0; padding: calc(var(--safe-t) + 18px) var(--gutter) calc(var(--tabbar-h) + var(--safe-b) + 36px); }
  .coach-tabbar { display: block; }
  .page-head h1 { font-size: 24px; }
  .answer-grid { grid-template-columns: repeat(2, 1fr); }
  .table .hide-sm { display: none; }
  .days-grid { grid-template-columns: 1fr; }
}

/* grid children are siblings too: cancel the stacked-card top margin inside grids */
.days-grid > *, .lib-grid > *, .kpis > *, .cols > *, .cols-even > *, .grid2 > *, .grid3 > * { margin-top: 0 !important; }
