/* Client workflow: shared styles for /client and /coach. Same greyscale tokens as the main site. */
:root {
  /* Matte black with a soft metallic sheen, matching the website. */
  --bg: #0A0A0A; --surface: #171717; --sunk: #101010; --ink: #ECECEC; --muted: #A6A6A6; --line: rgb(255 255 255 / .10);
  --soft: #1E1E1E; --on-ink: #0A0A0A; --danger: #FFFFFF;
  --sheen: linear-gradient(150deg, #262626 0%, #1A1A1A 45%, #121212 100%);
  --silver: linear-gradient(180deg, #F7F7F7 0%, #D9D9D9 48%, #B9B9B9 100%);
  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-text: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--f-text); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--f-display); margin: 0; line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); font-weight: 900; font-stretch: 112%; }
h2 { font-size: 1.35rem; font-weight: 800; font-stretch: 110%; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--muted); }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* layout */
.wrap { max-width: 980px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.topbar { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand b { font-family: var(--f-display); font-weight: 900; font-stretch: 118%; font-size: 1rem; line-height: 1; display: block; }
.brand small { display: block; font-family: var(--f-display); font-stretch: 125%; font-size: .55rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.who { display: flex; align-items: center; gap: 10px; font-size: .875rem; color: var(--muted); min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
main.wrap { padding-block: 24px 64px; display: grid; gap: 20px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { font: 600 .9375rem/1 var(--f-text); padding: 10px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: clamp(16px, 3vw, 24px); display: grid; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
.list { display: grid; gap: 10px; }
.empty { border: 1.5px dashed var(--line); border-radius: 10px; padding: 22px; text-align: center; color: var(--muted); }

/* forms */
label.f { display: grid; gap: 6px; font-weight: 600; font-size: .875rem; min-width: 0; }
input, select, textarea { width: 100%; font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: 600 .9375rem/1 var(--f-text); padding: 12px 16px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--ink); color: var(--on-ink); cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn.small { padding: 8px 11px; font-size: .8125rem; }
.btn[disabled] { opacity: .5; cursor: progress; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.error { font-weight: 600; font-size: .875rem; }
.error::before { content: "! "; }

/* sign-in */
.signin { max-width: 420px; margin: 8vh auto 0; }
.signin .card { gap: 18px; }

/* workouts */
.workout { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.workout summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface); }
.workout summary::-webkit-details-marker { display: none; }
.workout summary b { font-weight: 700; }
.workout .body { padding: 6px 16px 14px; background: var(--surface); display: grid; gap: 10px; }
.sets { width: 100%; border-collapse: collapse; font-size: .875rem; }
.sets th { text-align: left; font-family: var(--f-mono); font-weight: 500; font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); }
.sets td { padding: 7px 8px 7px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.sets tr:last-child td { border-bottom: 0; }
.table-scroll { overflow-x: auto; }

/* workout logger (coach) */
.ex-block { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 10px; background: var(--bg); }
.set-row { display: grid; grid-template-columns: 28px repeat(4, minmax(0, 1fr)) 36px; gap: 6px; align-items: center; }
.set-row .n { font-family: var(--f-mono); font-size: .8125rem; color: var(--muted); text-align: center; }
.set-row input, .set-row select { padding: 9px 8px; }
.set-head { font-family: var(--f-mono); font-size: .625rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.icon-btn { width: 36px; height: 36px; border-radius: 6px; border: 1.5px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 1.1rem; line-height: 1; }

/* goals */
.goal { display: grid; gap: 8px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.goal:last-child { border-bottom: 0; }
.goal-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.bar { height: 8px; background: var(--sunk); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; }
.pill { font-family: var(--f-mono); font-size: .6875rem; letter-spacing: .08em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--line); }
.pill.solid { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }

/* nutrition */
.macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .macros { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.macro { background: var(--bg); border-radius: 8px; padding: 12px; display: grid; gap: 2px; }
.macro b { font-family: var(--f-display); font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* progress chart */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--on-ink); font: 500 .75rem/1.3 var(--f-mono); padding: 6px 8px; border-radius: 4px; transform: translate(-50%, -120%); white-space: nowrap; }

/* form tracker */
.player { position: relative; background: #000; border-radius: 10px; overflow: hidden; width: 100%; max-width: 460px; justify-self: center; }
.player video { display: block; width: 100%; height: auto; }
.player canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.player .hud { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; gap: 8px; pointer-events: none; }
.player .hud span { font: 500 .6875rem/1 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: #fff; background: rgb(0 0 0 / .65); padding: 5px 8px; border-radius: 3px; }
.findings { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.findings li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 10px; font-size: .9375rem; }
.findings li::before { content: ""; width: 8px; height: 8px; margin-top: 7px; background: var(--ink); }
.progress { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }
.video-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.video-item:last-child { border-bottom: 0; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--on-ink); padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: .9375rem; z-index: 50; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* status chip for background uploads */
.status-chip { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(68px + env(safe-area-inset-bottom, 0px)); z-index: 40; width: min(420px, calc(100% - 32px)); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; font-weight: 600; font-size: .875rem; box-shadow: 0 12px 32px -12px rgb(0 0 0 / .35); }

/* in-page camera */
.camera { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
.camera-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; font: 500 .8125rem/1.3 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; }
.camera video { width: 100%; height: 100%; object-fit: contain; background: #000; min-height: 0; }
.camera-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 18px 20px 24px; gap: 12px; }
.camera-bar .side { display: flex; }
.camera-bar .side:last-child { justify-content: flex-end; }
.rec-btn { width: 76px; height: 76px; border-radius: 50%; border: 4px solid #fff; background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.rec-btn i { width: 58px; height: 58px; border-radius: 50%; background: #fff; transition: all .15s ease; }
.rec-btn.on i { width: 28px; height: 28px; border-radius: 6px; }
.cam-btn { background: rgb(255 255 255 / .14); color: #fff; border: 0; border-radius: 999px; padding: 10px 14px; font: 600 .875rem/1 var(--f-text); cursor: pointer; }
.rec-time { font-variant-numeric: tabular-nums; }
.rec-time.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-right: 8px; animation: recblink 1s steps(2) infinite; }
@keyframes recblink { 50% { opacity: .2; } }
.capture-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 420px) { .capture-actions { grid-template-columns: minmax(0, 1fr); } }
.capture-actions .btn { padding: 16px; font-size: 1rem; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Loading: the logo with a shine sweeping left to right */
.loader { min-height: 60vh; display: grid; place-items: center; }
.loader-mark { width: 88px; height: 88px;
  -webkit-mask: url("/logo/mark-black.svg") center / contain no-repeat; mask: url("/logo/mark-black.svg") center / contain no-repeat;
  background: linear-gradient(100deg, var(--ink) 0%, var(--ink) 38%, color-mix(in srgb, var(--ink) 25%, var(--bg)) 50%, var(--ink) 62%, var(--ink) 100%) 0 0 / 300% 100%;
  animation: shine 1.4s ease-in-out infinite; }
@keyframes shine { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@media (prefers-reduced-motion: reduce) { .loader-mark { animation: none; } }

/* Google sign-in */
.google-btn { width: 100%; padding: 14px 16px; font-size: 1rem; background: var(--surface); }
.google-btn span { display: inline-flex; }
.or { text-align: center; color: var(--muted); font-size: .8125rem; font-family: var(--f-mono); letter-spacing: .1em; text-transform: uppercase; }

/* messages */
.chat-list { display: flex; flex-direction: column; gap: 8px; max-height: min(60vh, 520px); min-height: 180px; overflow-y: auto; padding: 4px 2px; }
.chat-empty { margin: auto; text-align: center; max-width: 40ch; }
.bubble { max-width: min(80%, 520px); padding: 10px 14px; border-radius: 16px; display: grid; gap: 4px; overflow-wrap: anywhere; }
.bubble p { white-space: pre-wrap; }
.bubble.theirs { align-self: flex-start; background: var(--sunk); border-bottom-left-radius: 4px; }
.bubble.mine { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 4px; }
.chat-time { font-family: var(--f-mono); font-size: .6875rem; opacity: .65; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.chat-form textarea { min-height: 48px; }
.inbox-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; text-align: left; width: 100%; padding: 14px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); font: inherit; cursor: pointer; }
.inbox-row:hover { background: var(--bg); }
.inbox-name { display: flex; gap: 8px; align-items: center; }
.inbox-last { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9375rem; }
.inbox-time { grid-column: 2; grid-row: 1; font-size: .75rem; }
.inbox-row.unread .inbox-last { color: var(--ink); font-weight: 600; }

/* rig verdict: green = full range, red = not full (the only colors outside the greyscale brand) */
.rig-verdict { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); background: #E12626; color: #fff; font: 600 .8125rem/1 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; padding: 9px 12px; border-radius: 4px; white-space: nowrap; pointer-events: none; }
.rig-verdict.ok { background: #1FA34A; }

/* ---------- Matte black luxury layer ---------- */
html:root { --msp-load-bg: #0A0A0A; --msp-load-ink: #E6E6E6; --msp-load-shine: #6A6A6A; }
body { background:
  radial-gradient(1200px 560px at 15% -10%, rgb(255 255 255 / .12), transparent 60%),
  radial-gradient(800px 520px at 100% 22%, rgb(255 255 255 / .06), transparent 62%),
  linear-gradient(115deg, transparent 30%, rgb(255 255 255 / .045) 46%, rgb(255 255 255 / .015) 52%, transparent 66%),
  linear-gradient(180deg, #111111 0%, #0A0A0A 40%, #080808 100%);
  background-attachment: fixed; }
.topbar { background: rgb(10 10 10 / .78); }
.card, .workout, .workout summary, .workout .body, .status-chip { background: var(--sheen); border-color: var(--line); box-shadow: inset 0 1px 0 rgb(255 255 255 / .06), 0 24px 48px -24px rgb(0 0 0 / .9); }
.workout summary, .workout .body { box-shadow: none; }
.btn { background: var(--silver); color: #0A0A0A; border-color: transparent; box-shadow: inset 0 1px 0 #fff, 0 10px 24px -14px rgb(255 255 255 / .35); }
.btn.ghost { background: linear-gradient(180deg, rgb(255 255 255 / .05), rgb(255 255 255 / .01)); color: var(--ink); border-color: rgb(255 255 255 / .16); box-shadow: none; }
.btn.ghost:hover { border-color: rgb(255 255 255 / .38); }
.tab { background: linear-gradient(180deg, rgb(255 255 255 / .04), transparent); border-color: rgb(255 255 255 / .14); }
.tab[aria-selected="true"], .pill.solid { background: var(--silver); color: #0A0A0A; border-color: transparent; }
h1 { background: linear-gradient(180deg, #FFFFFF 0%, #BFBFBF 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
input, select, textarea { background: #0C0C0C; border-color: rgb(255 255 255 / .12); }
input:focus, select:focus, textarea:focus { border-color: rgb(255 255 255 / .5); }
.ex-block, .macro { background: rgb(255 255 255 / .03); border-color: var(--line); }
.bubble.theirs { background: #2A2A2A; }
.bubble.mine { background: var(--silver); color: #0A0A0A; }
.toast { background: var(--silver); color: #0A0A0A; }
.bar i, .progress i { background: var(--silver); }

/* log in: smooth step transitions */
.signin { transition: opacity .32s cubic-bezier(.2,.7,.2,1), transform .42s cubic-bezier(.2,.7,.2,1), filter .32s ease; }
.signin.enter { opacity: 0; transform: translateY(14px) scale(.985); filter: blur(4px); }
.signin.leave { opacity: 0; transform: translateY(-10px) scale(.985); filter: blur(3px); transition-duration: .22s; }
.signin.busy .card { opacity: .55; pointer-events: none; transition: opacity .25s ease; }
.signin .card > * { animation: rise .5s cubic-bezier(.2,.7,.2,1) both; }
.signin .card > *:nth-child(2) { animation-delay: .04s; } .signin .card > *:nth-child(3) { animation-delay: .08s; } .signin .card > *:nth-child(4) { animation-delay: .12s; } .signin .card > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.signin input { transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease; }
.signin input:focus { box-shadow: 0 0 0 4px rgb(255 255 255 / .07); background: #111; }
.signin .btn { transition: transform .15s ease, box-shadow .2s ease, filter .2s ease, border-color .2s ease; }
.signin .btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.signin .btn:active { transform: translateY(0) scale(.98); }
.signin .error:not([hidden]) { animation: rise .3s ease both; }
.card.shake { animation: shake .36s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.step-dots { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }
.step-dots i { width: 6px; height: 6px; border-radius: 3px; background: rgb(255 255 255 / .18); transition: width .3s ease, background .3s ease; }
.step-dots i.on { width: 20px; background: #D9D9D9; }
@media (prefers-reduced-motion: reduce) { .signin, .signin .card > *, .card.shake { transition: none !important; animation: none !important; transform: none !important; filter: none !important; } }

