/* Reset, the app shell (top bar, scrolling view, bottom tabs / side navigation) and the shared
   building blocks: tiles, buttons, rows, pills, forms. Sizes of type are in rem (see tokens.css). */
html{box-sizing:border-box;height:100%;-webkit-tap-highlight-color:transparent;-webkit-text-size-adjust:100%;overscroll-behavior:none}
*,*::before,*::after{box-sizing:inherit}
body{height:100vh;height:100dvh;margin:0;display:flex;flex-direction:column;background:var(--bg);color:var(--ink);font-family:var(--font);font-size:.9375rem;line-height:1.45;overscroll-behavior:none}
/* An iPhone's installed app leaves a strip under the page, at the home indicator, that the page
   itself does not reach: it shows the root's colour. The tab bar's colour there reads as one bar
   down to the edge (body covers everything else, so nothing else changes colour). */
html{background:var(--tile)}
/* An iPhone's installed app (iOS 26): the system draws a blur over the first ~40pt of the page,
   under the clock, and nothing in CSS turns it off. What sits at the top (the bar with the logo,
   the head of a full-screen layer) starts below it: --edge is added to the top safe area there.
   Zero everywhere else — a browser, Android, a desktop — and in landscape. */
:root{--edge:0px}
@supports (-webkit-touch-callout:none){@media (display-mode:standalone) and (orientation:portrait){:root{--edge:2.25rem}}}
h1,h2,h3,p,ul,ol{margin:0;padding:0}
ul,ol{list-style:none}
button,a.btn{font:inherit;color:inherit;background:transparent;border:0;padding:0;cursor:pointer;touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;text-decoration:none}
a{color:var(--secondary-text)}
button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,[tabindex]:focus-visible{outline:2px solid var(--secondary-text);outline-offset:2px}
svg{display:block}
img{max-width:100%;display:block}
[hidden]{display:none !important}
.skip{position:absolute;inset-inline-start:8px;top:-60px;z-index:100;background:var(--accent);color:var(--on-accent);padding:8px 14px;border-radius:10px}
.skip:focus{top:8px}
/* The shell's footer: on every screen for a keyboard and a screen reader, shown when it takes focus. */
.foot{position:absolute;width:0;height:0}
.foot a{position:fixed;inset-inline-start:8px;bottom:-80px;z-index:100;background:var(--accent);color:var(--on-accent);padding:8px 14px;border-radius:10px}
.foot a:focus{bottom:calc(84px + env(safe-area-inset-bottom, 0px))}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* ---------- shell ---------- */
#app{flex:1;min-height:0;display:flex;flex-direction:column}
.shell{flex:1;min-height:0;width:100%;max-width:560px;margin-inline:auto;display:flex;flex-direction:column;background:var(--bg)}
.gut{padding-left:max(var(--gut), env(safe-area-inset-left, 0px));padding-right:max(var(--gut), env(safe-area-inset-right, 0px))}
.topbar{flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:max(10px, calc(env(safe-area-inset-top, 0px) + var(--edge)));padding-bottom:8px;min-height:52px}
.brand{font-size:1.3125rem;font-weight:800;letter-spacing:-.01em;direction:ltr}
.brand b{color:var(--decor);font-weight:800}
.topbar-acts{display:flex;align-items:center;gap:6px}
.icon-btn{position:relative;width:40px;height:40px;border-radius:50%;display:grid;place-items:center;color:var(--ink-2);transition:transform 120ms var(--ease-out),background-color 120ms ease}
.icon-btn:active{transform:scale(.94);background:var(--tile)}
.icon-btn svg{width:22px;height:22px}
.icon-btn .dot{position:absolute;top:7px;inset-inline-end:7px;min-width:9px;height:9px;border-radius:999px;background:var(--decor);box-shadow:0 0 0 2px var(--bg)}
.shell-body{flex:1;min-height:0;display:flex;flex-direction:column}
.side{display:none}
.view{flex:1;min-height:0;min-width:0;overflow-y:auto;scrollbar-width:thin;scrollbar-color:var(--line-2) transparent;overscroll-behavior:contain;padding-block:6px 22px;display:flex;flex-direction:column;gap:12px}
.view > *{flex:none}
.view:focus{outline:none}
.tabs{flex:none;display:grid;grid-auto-flow:column;grid-auto-columns:1fr;background:var(--tile);border-top:1px solid var(--line);padding-top:6px;padding-bottom:max(8px, env(safe-area-inset-bottom, 0px))}
.tabs a{display:flex;flex-direction:column;align-items:center;gap:2px;padding:4px 0;font-size:.72rem;font-weight:600;color:var(--ink-3);text-decoration:none;touch-action:manipulation;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;transition:transform 120ms var(--ease-out),color 160ms ease}
.tabs a:active{transform:scale(.94)}
.tabs svg,.side svg{width:23px;height:23px}
.tabs a[aria-current="page"],.side a[aria-current="page"]{color:var(--nav-on)}

/* full-screen layers above the shell: sign-in, the questionnaire, the live workout */
.bare{flex:1;min-height:0;width:100%;max-width:560px;margin-inline:auto;overflow-y:auto;overscroll-behavior:contain;display:flex;flex-direction:column;padding-top:max(16px, calc(env(safe-area-inset-top, 0px) + var(--edge)));padding-bottom:max(22px, env(safe-area-inset-bottom, 0px))}

/* ---------- type ---------- */
.hello{padding-top:4px;display:flex;flex-direction:column}
.eyebrow{font-size:.72rem;font-weight:600;letter-spacing:.04em;color:var(--ink-3)}
h1{font-size:1.5625rem;font-weight:800;line-height:1.2;text-wrap:balance}
h2{font-size:1.0625rem;font-weight:700;line-height:1.3}
h3,.h3{font-size:.8125rem;font-weight:700;color:var(--ink-3);letter-spacing:.03em}
.sub{font-size:.8125rem;color:var(--ink-3)}
.num{font-variant-numeric:tabular-nums}
.ltr{direction:ltr;unicode-bidi:isolate}

/* ---------- tiles ---------- */
.tile{background:var(--tile);border-radius:var(--r);padding:16px;display:flex;flex-direction:column;gap:12px;min-width:0}
button.tile,a.tile{text-align:start;text-decoration:none;color:inherit;transition:transform 120ms var(--ease-out)}
button.tile:active,a.tile:active{transform:scale(.985)}
.tile-h{display:flex;align-items:center;justify-content:space-between;gap:10px}
.tiles2{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.tile.flat{padding-block:6px}

/* ---------- buttons ---------- */
.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:50px;padding:0 16px;border-radius:var(--r-btn);font-size:1.03rem;font-weight:600;text-align:center;transition:transform 120ms var(--ease-out),opacity 160ms ease}
.btn:active{transform:scale(.97)}
.btn.primary{background:var(--accent);color:var(--on-accent)}
.btn.ghost{background:var(--tile-2);color:var(--ink)}
.btn.onbg{background:var(--tile);color:var(--ink)}
.btn.danger{background:var(--danger-wash);color:var(--danger)}
.btn.sm{min-height:40px;width:auto;font-size:.9rem;padding:0 14px;border-radius:12px}
.btn[disabled],.btn[aria-busy="true"]{opacity:.55;cursor:default;pointer-events:none}
.btn svg{width:20px;height:20px;flex:none}
.link{align-self:flex-start;display:inline-flex;align-items:center;gap:6px;padding:7px 12px;border-radius:10px;background:var(--tile-2);color:var(--secondary-text);font-size:.84rem;font-weight:600;text-decoration:none;transition:transform 120ms var(--ease-out)}
.link:active{transform:scale(.97)}
.link svg{width:16px;height:16px;flex:none}
.link.onbg{background:var(--tile)}
.textlink{color:var(--secondary-text);font-weight:600;text-decoration:none;padding:6px 2px}
.pill{flex:none;font-size:.75rem;font-weight:600;border-radius:999px;padding:3px 10px;white-space:nowrap}
.pill.ok{background:var(--wash);color:var(--secondary-text)}
.pill.drop{background:var(--drop-wash);color:var(--drop)}
.pill.super{background:var(--super-wash);color:var(--super)}
.pill.high{background:var(--high-wash);color:var(--high)}
.pill.low{background:var(--low-wash);color:var(--low)}
.pill.warn{background:var(--decor-tint);box-shadow:inset 0 0 0 1px var(--decor);color:var(--ink)}
.pill.mute{background:var(--tile-2);color:var(--ink-3)}
.pill.bad{background:var(--danger-wash);color:var(--danger)}

/* ---------- rows ---------- */
.rows{display:flex;flex-direction:column;margin-block:-5px}
.row{display:grid;grid-template-columns:auto minmax(0,1fr) auto auto;align-items:center;gap:12px;width:100%;padding:11px 2px;text-align:start;text-decoration:none;color:inherit;transition:background-color 120ms ease}
.row + .row{border-top:1px solid var(--line)}
button.row:active,a.row:active{background:var(--tile-2)}
.row.sel{background:var(--wash)}
.row-t{min-width:0;display:flex;flex-direction:column}
.row-t b{font-size:.97rem;font-weight:600}
.row-t small{font-size:.78rem;color:var(--ink-3);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.row-t small.wrap{white-space:normal}
.av{text-decoration:none;width:38px;height:38px;flex:none;border-radius:50%;display:grid;place-items:center;background:var(--wash);color:var(--secondary-text);font-size:.84rem;font-weight:700}
.av.lg{width:52px;height:52px;font-size:1.0625rem}
.av.n{background:var(--tile-2);color:var(--ink-3)}
.av svg{width:20px;height:20px}
.chev{width:18px;height:18px;color:var(--ink-3)}
.kv{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 2px}
.kv + .kv{border-top:1px solid var(--line)}
.kv-t{min-width:0;display:flex;flex-direction:column}
.kv-t b{font-size:.94rem;font-weight:600}
.kv-t small{font-size:.78rem;color:var(--ink-3)}

/* ---------- forms ---------- */
.field{display:flex;flex-direction:column;gap:6px}
.field > span,.field > label{font-size:.84rem;font-weight:600;color:var(--ink-2)}
.input,.search,textarea.input,select.input{width:100%;min-height:50px;border-radius:var(--r-sm);border:1.5px solid transparent;background:var(--tile);padding:0 14px;font:inherit;font-size:16px;color:var(--ink);appearance:none;-webkit-appearance:none}
html.big .input,html.big .search{font-size:18px}
.tile .input,.sheet .input,.tile .search,.sheet .search{background:var(--tile-2)}
textarea.input{padding-block:12px;min-height:96px;resize:vertical;line-height:1.45}
.input::placeholder,.search::placeholder{color:var(--ink-3)}
.input:focus,.search:focus{outline:none;border-color:var(--secondary-text);box-shadow:0 0 0 1px var(--secondary-text)}
.input[aria-invalid="true"]{border-color:var(--danger)}
.hint{font-size:.8rem;color:var(--ink-3)}
.err{font-size:.84rem;color:var(--danger);font-weight:500}
.pw{position:relative}
.pw .input{padding-inline-end:52px}
.pw button{position:absolute;inset-inline-end:4px;top:5px;width:40px;height:40px;border-radius:10px;display:grid;place-items:center;color:var(--ink-3)}
.pw svg{width:20px;height:20px}

/* ---------- states ---------- */
.empty{display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center;padding:34px 12px;color:var(--ink-3)}
.empty svg{width:34px;height:34px;color:var(--secondary)}
.empty b{font-size:1.0625rem;color:var(--ink);font-weight:700}
.empty p{max-width:34ch}
.empty .btn{width:auto;min-width:160px;margin-top:6px}
.sk{border-radius:var(--r);background:var(--tile);min-height:84px;position:relative;overflow:hidden}
.sk.tall{min-height:150px}
.sk.line{min-height:26px;width:60%;border-radius:8px}
.sk::after{content:"";position:absolute;inset:0;background:linear-gradient(100deg,transparent 30%,var(--tile-2) 50%,transparent 70%);animation:sk 1.2s linear infinite}
@keyframes sk{from{transform:translateX(100%)}to{transform:translateX(-100%)}}
.banner{display:flex;align-items:center;gap:10px;padding:10px 14px;border-radius:14px;background:var(--decor-tint);box-shadow:inset 0 0 0 1px var(--decor);font-size:.875rem;font-weight:500}
.banner svg{width:18px;height:18px;flex:none}
.banner.info{background:var(--wash);box-shadow:none;color:var(--ink)}
.offline-bar{flex:none;width:100%;text-align:center;font-size:.8rem;font-weight:600;padding:max(5px, env(safe-area-inset-top, 0px)) 12px 5px;background:var(--decor-tint);color:var(--ink);box-shadow:inset 0 -1px 0 var(--decor)}

@media (hover: hover) and (pointer: fine){
  button.row:hover,a.row:hover{background:var(--tile-2)}
  .row.sel:hover{background:var(--wash)}
  .link:hover{background:var(--wash)}
  .icon-btn:hover{background:var(--tile)}
  .side a:hover{background:var(--tile)}
}
@media (min-width: 600px){
  .shell,.bare{border-inline:1px solid var(--line)}
}
/* Trainer and owner on a wide screen: side navigation, room for a list beside a pane. */
@media (min-width: 900px){
  .shell.wide{max-width:1180px}
  .shell.wide .shell-body{flex-direction:row}
  .shell.wide .tabs{display:none}
  .shell.wide .side{display:flex;flex-direction:column;gap:4px;flex:none;width:210px;padding:8px 12px;border-inline-end:1px solid var(--line);overflow-y:auto}
  .shell.wide .side a{display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:12px;font-size:.94rem;font-weight:600;color:var(--ink-2);text-decoration:none;transition:background-color 120ms ease}
  .shell.wide .side a[aria-current="page"]{background:var(--tile);color:var(--nav-on)}
  .shell.wide .side h3{padding:14px 12px 4px}
  .shell.wide .view{padding-inline:24px;padding-block:14px 28px;gap:16px}
}
/* A list beside a detail pane, for staff on a wide screen. On a phone .pane is hidden and the detail opens as a sheet. */
.split{display:flex;flex-direction:column;gap:12px;min-width:0}
.split > .col{display:flex;flex-direction:column;gap:12px;min-width:0}
.pane{display:none}
@media (min-width: 900px){
  .shell.wide .split{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:16px;align-items:start}
  .shell.wide .pane{display:flex;flex-direction:column;gap:12px;position:sticky;top:0}
}
@media (prefers-reduced-motion: reduce){
  .btn:active,.link:active,.icon-btn:active,.tabs a:active,button.tile:active,a.tile:active{transform:none}
  .sk::after{animation:none}
}
