/* Kwest Coach. Brand: Kwest Health + Fitness amber (#e58f26, sampled from the logo and the kwest site),
   Barlow Condensed headlines and DM Sans body, matching the marketing site. Warm light theme with a dark mode. */
:root {
  --accent: #e58f26;
  --accent-ink: #9a560a;      /* amber dark enough for text on cream (AA) */
  --accent-soft: #fbead3;
  --bg: #f7f2ea;
  --surface: #fffdf9;
  --surface-2: #f2ebe0;
  --ink: #17130e;
  --muted: #6c6356;
  --line: #e6dccd;
  --good: #2f7d4f;
  --good-soft: #dcefe2;
  --warn: #b5401f;
  --warn-soft: #f8dfd6;
  --radius: 14px;
  --shadow: 0 1px 2px #3b2a1210, 0 6px 24px #3b2a120d;
  --font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Barlow Condensed', 'Arial Narrow', Impact, sans-serif;
  --demo-ink: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent-ink: #f2a64c;
    --accent-soft: #2e2012;
    --bg: #0b0b0b;
    --surface: #151311;
    --surface-2: #1d1a17;
    --ink: #f5f3ef;
    --muted: #aaa49b;
    --line: #2c2823;
    --good: #6cc48e;
    --good-soft: #15291d;
    --warn: #f08b6b;
    --warn-soft: #33180f;
    --shadow: 0 1px 2px #0006;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: fixed; top: -60px; left: 12px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 99; border-radius: 8px; }
.skip:focus { top: 12px; }

/* ---------- shell ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px; padding: 22px 16px; border-right: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 44px; height: 44px; border-radius: 12px; background: #fff; object-fit: contain; }
.brand b { display: block; font: 700 24px/1 var(--display); letter-spacing: .04em; }
.brand small { display: block; color: var(--muted); font-size: 11px; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tagline { margin-top: auto; font: 600 13px var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
main { padding: 28px clamp(16px, 4vw, 44px) 60px; min-width: 0; max-width: 1240px; outline: none; }

/* ---------- type + page head ---------- */
h1, h2, h3 { margin: 0; }
h1 { font: 600 clamp(32px, 4vw, 46px)/1 var(--display); text-transform: uppercase; letter-spacing: .01em; }
h2 { font: 600 22px/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em; }
.h3 { font: 600 17px var(--display); text-transform: uppercase; letter-spacing: .03em; margin: 18px 0 8px; }
.eyebrow { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.warn { color: var(--warn); min-height: 1em; margin: 0; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head > div:first-child, .page-head .grow { flex: 1; min-width: 200px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { font-size: 30px; line-height: 1; text-decoration: none; color: var(--muted); padding: 0 6px 4px 0; align-self: center; }
.grow { flex: 1; min-width: 0; }
.link { color: var(--accent-ink); font-weight: 600; text-decoration: none; background: none; border: 0; padding: 0; cursor: pointer; font-size: 14px; }
.link:hover { text-decoration: underline; }

/* ---------- buttons + forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1006; }
.btn.primary:hover { background: #d9821b; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--warn); }
.btn.danger:not(.ghost) { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.big { padding: 14px 28px; font-size: 16px; }
.btn:disabled { opacity: .4; cursor: default; }
.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: inline-grid; place-items: center; font-size: 16px; line-height: 1; }
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent-ink); }
.icon-btn:disabled { opacity: .3; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.actions.wrap { flex-wrap: wrap; justify-content: flex-start; }
.form { display: grid; gap: 12px; }
.form.narrow { max-width: 360px; margin: 0 auto; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.inline { display: inline-flex; align-items: center; gap: 8px; }
label.inline input { width: 80px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-weight: 400; color: var(--ink); min-height: 42px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
.row2, .row3, .row4 { display: grid; gap: 10px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: repeat(3, 1fr); }
.row4 { grid-template-columns: repeat(4, 1fr); }
.file-btn input { display: none; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form select { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
details.more { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--accent-ink); font-size: 14px; }
details.more[open] summary { margin-bottom: 12px; }

/* ---------- cards + layout ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; margin-bottom: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.empty { text-align: center; padding: 18px 8px; color: var(--muted); }
.empty p { margin: 0 0 10px; }
.empty.card { padding: 40px 20px; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; }
.kpi-n { font: 600 38px/1 var(--display); color: var(--ink); }
.kpi:first-child .kpi-n { color: var(--accent-ink); }
.kpi-l { font-size: 13px; color: var(--muted); }
.kpi-l small { opacity: .8; }

/* avatars + chips */
.avatar { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); font: 700 16px var(--display); letter-spacing: .04em; flex: none; border: 1.5px solid var(--accent); }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.xs { width: 18px; height: 18px; font-size: 9px; border-width: 1px; font-style: normal; }
.avatar.lg { width: 60px; height: 60px; font-size: 22px; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-scheduled { background: var(--accent-soft); color: var(--accent-ink); }
.st-done { background: var(--good-soft); color: var(--good); }
.st-missed { background: var(--warn-soft); color: var(--warn); }
.st-skipped { background: var(--surface-2); color: var(--muted); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip-btn { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; text-decoration: none; cursor: pointer; color: var(--muted); }
.chip-btn.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.flag { display: block; font-size: 12px; color: var(--warn); }
.flag::before { content: '● '; font-size: 9px; vertical-align: 2px; }
.flag-silent { color: var(--muted); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.filters { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.filters select { width: auto; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar select { width: auto; }

/* session rows */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.session-row { display: flex; align-items: center; gap: 10px 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; flex-wrap: wrap; }
.session-row .grow { min-width: 120px; }
.session-row:hover { outline: 1px solid var(--accent); }
.session-row b { display: block; font-weight: 600; }
.session-row small { color: var(--muted); display: block; font-size: 13px; }
.session-row .time { font: 600 16px var(--display); min-width: 74px; color: var(--accent-ink); }
.session-row .time small { font: 400 12px var(--font); }
.sessions.compact .session-row { background: transparent; padding: 6px 4px; }
.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.attention a { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; padding: 10px; border-radius: 12px; }
.attention a:hover { background: var(--surface-2); }
.attention b { display: block; }

/* rings + bars */
.ring { flex: none; }
.ring-track { fill: none; stroke: var(--surface-2); }
.ring-fill { fill: none; stroke: var(--accent); stroke-linecap: round; transition: stroke-dasharray .5s; }
.ring.low .ring-fill { stroke: var(--warn); }
.ring-label { font: 600 26px var(--display); fill: var(--ink); text-anchor: middle; dominant-baseline: middle; }
.ring-sub { font: 500 11px var(--font); fill: var(--muted); text-anchor: middle; }
svg.ring[width="54"] .ring-label, svg.ring[width="76"] .ring-label { font-size: 22px; }
.wellness-strip { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.wellness-tile { display: grid; justify-items: center; gap: 2px; text-decoration: none; padding: 10px; border-radius: 12px; min-width: 104px; }
.wellness-tile:hover { background: var(--surface-2); }
.wellness-tile small { color: var(--muted); font-size: 12px; }
.macro { margin: 10px 0; }
.macro-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.macro-top span:first-child { font-weight: 600; }
.macro-top span:last-child { color: var(--muted); }
.macro-track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.macro-fill { height: 100%; background: var(--accent); border-radius: 99px; }
.macro-fill.over { background: var(--warn); }
.bars { display: grid; grid-template-columns: repeat(14, 1fr); gap: 6px; align-items: end; height: 140px; }
.bar-col { display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; font-size: 11px; color: var(--muted); }
.bar-stick { align-self: end; background: var(--accent); border-radius: 6px 6px 2px 2px; min-height: 4px; }
.bar-stick.low { background: var(--warn); }
.bar-stick.empty { background: var(--surface-2); }
.chart { width: 100%; height: auto; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent-soft); opacity: .7; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.chart .grid { stroke: var(--line); stroke-dasharray: 4 4; }
.chart .axis { fill: var(--muted); font-size: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 16px 0 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font: 600 22px var(--display); }

/* clients */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.client-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; display: grid; gap: 10px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.client-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.client-top { display: flex; gap: 12px; align-items: center; }
.client-top b { display: block; font-size: 16px; }
.client-top small, .client-meta { color: var(--muted); font-size: 13px; }
.client-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.client-head { align-items: center; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 16px; text-decoration: none; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--accent); }
.date-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .date-nav { margin: 0; }
.date-nav b { min-width: 110px; text-align: center; font: 600 20px var(--display); text-transform: uppercase; }
.cal-summary { display: flex; align-items: center; gap: 20px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-eq { display: flex; align-items: center; gap: 10px; flex: 1; justify-content: space-around; }
.cal-eq div { text-align: center; }
.cal-eq b { display: block; font: 600 22px var(--display); }
.cal-eq small { color: var(--muted); font-size: 12px; }
.cal-eq span { color: var(--muted); }
.meal { border-top: 1px solid var(--line); padding: 12px 0 4px; margin-top: 12px; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; }
.meal h3 { font: 600 16px var(--display); text-transform: uppercase; letter-spacing: .04em; }
.food-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.food-row .icon-btn { width: 26px; height: 26px; font-size: 14px; }
.add-food { margin: 8px 0 4px; }
.score-row { display: flex; gap: 16px; align-items: center; margin-bottom: 8px; }
.score-row p { margin: 0; }
.field { margin: 14px 0; }
.field-l { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field-l small { color: var(--muted); font-weight: 400; margin-left: 6px; }
.cups { display: flex; gap: 6px; flex-wrap: wrap; }
.cup { width: 28px; height: 36px; border: 2px solid var(--line); border-radius: 4px 4px 9px 9px; background: transparent; cursor: pointer; padding: 0; }
.cup.on { border-color: var(--accent); background: linear-gradient(to top, var(--accent) 70%, transparent 70%); }
.cup:hover { border-color: var(--accent); }
.segs { display: flex; gap: 6px; }
.seg { flex: 1; min-width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; display: grid; place-items: center; color: var(--muted); position: relative; }
.seg.on, .seg:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #1a1006; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 12px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.note { background: var(--surface-2); padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 8px 0; }
.food-list, .pick-list { display: grid; gap: 6px; max-height: 46vh; overflow-y: auto; margin: 4px 0; padding: 2px; }
.food-pick, .pick { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; cursor: pointer; }
.food-pick:hover, .pick:hover { border-color: var(--accent); }
.food-pick b, .pick b { display: block; font-weight: 600; }
.food-pick small, .pick small { color: var(--muted); font-size: 12px; display: block; }
.pick-add { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; margin-left: auto; flex: none; }
.pick.added .pick-add { background: var(--good-soft); color: var(--good); }

/* schedule week */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-height: 260px; display: flex; flex-direction: column; overflow: hidden; }
.day header { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.day header b { font: 600 24px var(--display); color: var(--ink); }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.day.today header { background: var(--accent-soft); }
.day.past { opacity: .82; }
.day-body { padding: 8px; display: grid; gap: 6px; align-content: start; flex: 1; }
.slot { display: grid; gap: 1px; text-align: left; padding: 8px; border-radius: 10px; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); cursor: pointer; font-size: 12px; min-width: 0; }
.slot-time { font-weight: 700; }
.slot-who { display: flex; align-items: center; gap: 4px; color: var(--ink); font-weight: 600; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slot-what { color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.slot-add { border: 1px dashed var(--line); background: transparent; border-radius: 10px; color: var(--muted); cursor: pointer; padding: 4px; font-size: 18px; margin-top: auto; }
.slot-add:hover { border-color: var(--accent); color: var(--accent-ink); }

/* workouts */
.workout-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.workout-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.workout-card h2 a { text-decoration: none; }
.workout-card h2 a:hover { color: var(--accent-ink); }
.workout-body { padding: 16px; display: grid; gap: 6px; }
.workout-body p { margin: 0; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.builder { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.builder-row { display: grid; grid-template-columns: 64px minmax(140px, 1fr) 80px 160px 90px auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.builder-row label { font-size: 11px; }
.builder-row label:nth-of-type(2) { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; align-self: end; }
.builder-row input, .builder-row select { padding: 6px 8px; min-height: 36px; }
.builder-name b { display: block; }
.builder-name small { color: var(--muted); font-size: 12px; }
.builder-demo { padding: 0; border: 0; background: var(--surface-2); border-radius: 10px; cursor: pointer; }
.builder-move { display: flex; gap: 4px; }

/* library */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.lib-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding: 0; text-align: left; cursor: pointer; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.lib-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lib-card .demo { background: var(--surface-2); border-bottom: 1px solid var(--line); }
.lib-text { padding: 12px 14px 14px; display: grid; gap: 2px; }
.lib-text .eyebrow { font-size: 10px; margin: 0; }
.lib-text b { font-size: 15px; }
.lib-text small { color: var(--muted); font-size: 12px; }
.lib-text .dose { color: var(--accent-ink); }

/* demos: the figure is drawn in the logo's single-weight amber outline */
.demo { display: block; aspect-ratio: 25 / 24; width: 100%; }
.demo-xs { width: 56px; height: 54px; flex: none; }
.demo-lg { max-width: 420px; margin: 0 auto; border-radius: var(--radius); background: var(--surface-2); }
.demo-xl { width: 100%; max-width: 520px; margin: 0 auto; }
.demo-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.demo-line { fill: none; stroke: var(--demo-ink); stroke-width: 7.5; stroke-linecap: round; stroke-linejoin: round; }
.demo-far { opacity: .42; }
.demo-ghost { fill: none; stroke: var(--demo-ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.demo-kit { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; opacity: .75; }
.demo-floor { stroke: var(--line); stroke-width: 2.5; stroke-linecap: round; }
.demo-mat { stroke: var(--accent-soft); stroke-width: 6; stroke-linecap: round; }
.demo-bar { stroke: var(--ink); stroke-width: 4; stroke-linecap: round; opacity: .6; }
.demo-ring { fill: var(--accent); stroke: none; opacity: 0; }
.demo-xs .demo-line { stroke-width: 10; }
.ex-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ex-stage { position: sticky; top: 0; }
.demo-controls { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.why { font-size: 15px; border-left: 3px solid var(--accent); padding-left: 12px; margin: 10px 0; }
.cues { padding-left: 20px; margin: 6px 0; display: grid; gap: 4px; }
.plain-list { padding-left: 20px; display: grid; gap: 2px; font-size: 14px; }
.ex-form-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; }
.ex-form-grid > div:first-child { display: grid; gap: 12px; align-content: start; }

/* player */
body.playing { grid-template-columns: 1fr; }
body.playing .sidebar { display: none; }
body.playing main { max-width: 980px; margin: 0 auto; width: 100%; }
.player-head { display: flex; align-items: center; gap: 14px; }
.player-head .back { font-size: 34px; }
.step-count { font: 600 18px var(--display); color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: var(--surface-2); margin: 14px 0 18px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s; }
.player-main { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: center; min-height: 52vh; }
.player-stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 12px; }
.player-stage.resting .demo { opacity: .35; }
.rest-overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.rest-overlay[hidden] { display: none; }
.rest-overlay span { font: 700 56px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.player-info .ex-name { font: 600 clamp(34px, 4.5vw, 52px)/1 var(--display); text-transform: uppercase; margin: 4px 0 10px; }
.timer { font: 700 clamp(64px, 9vw, 104px)/1 var(--display); color: var(--accent-ink); font-variant-numeric: tabular-nums; margin: 6px 0; }
.target { font: 600 28px var(--display); text-transform: uppercase; color: var(--muted); }
.target b { font-size: clamp(64px, 9vw, 104px); line-height: 1; color: var(--accent-ink); margin-right: 6px; }
.player-controls { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }
.player-controls[hidden] { display: none; }
.player-controls .big { min-width: 200px; }
.finish { grid-column: 1 / -1; text-align: center; display: grid; justify-items: center; gap: 10px; }
.finish-logo { width: 120px; height: 120px; border-radius: 24px; background: #fff; object-fit: contain; }
.finish h2 { font-size: 44px; }
.finish p { margin: 0; }
.finish .form { width: 100%; text-align: left; }

/* settings */
.about { display: flex; gap: 16px; align-items: flex-start; }
.about img { border-radius: 12px; background: #fff; flex: none; }
.about p { margin: 4px 0; }

/* modal + toast */
dialog#modal { border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px #0005; }
dialog#modal.wide { width: min(920px, calc(100vw - 24px)); }
dialog::backdrop { background: #160e0599; backdrop-filter: blur(2px); }
.modal-body { padding: 26px; overflow-y: auto; max-height: calc(100vh - 34px); }
.modal-title { font: 600 30px/1.05 var(--display); text-transform: uppercase; margin-bottom: 10px; padding-right: 30px; }
.modal-x { position: absolute; top: 12px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 22px; cursor: pointer; line-height: 1; z-index: 1; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .builder-row { grid-template-columns: 56px 1fr 70px 150px 80px; }
  .builder-move { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 860px) {
  body { grid-template-columns: 1fr; padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .sidebar { position: fixed; inset: auto 0 0 0; height: auto; z-index: 20; flex-direction: row; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); }
  .brand, .tagline { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11px; flex: 1; align-items: center; }
  main { padding-top: 20px; }
  .grid-2, .ex-detail, .ex-form-grid, .player-main { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .day-body { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .ex-stage { position: static; }
  .player-main { min-height: 0; gap: 12px; }
  .player-controls { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); z-index: 5; }
  .player-controls .big { min-width: 0; flex: 1; }
  body.playing { padding-bottom: 90px; }
  .builder-row { grid-template-columns: 56px 1fr 1fr; }
  .builder-name { grid-column: 2 / -1; }
}
@media (max-width: 520px) {
  h1 { font-size: 34px; }
  .row3, .row4 { grid-template-columns: 1fr 1fr; }
  .lib-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .client-grid, .workout-grid { grid-template-columns: 1fr; }
  .card { padding: 16px; }
  .modal-body { padding: 20px 18px; }
  .cal-summary { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
