:root {
  color-scheme: light dark;
  --bg: #f2efe8;
  --surface: #fffdf8;
  --surface-2: #e8e3d9;
  --ink: #171a18;
  --muted: #5d625f;
  --line: #cdc8bd;
  --brand: #b52e1d;
  --brand-dark: #7f1d12;
  --accent: #d9a521;
  --success: #17633b;
  --success-bg: #dcecdf;
  --success-ink: #104d2d;
  --success-line: #6b9878;
  --status-idle: #6f746f;
  --shadow: 0 10px 30px rgba(34, 28, 23, .09);
  --radius: 18px;
  --max: 1180px;
}

.sample-label{display:inline-flex;align-items:center;gap:.35rem;margin:.4rem 0;padding:.3rem .55rem;border:1px dashed var(--line);border-radius:999px;color:var(--muted);background:var(--surface-2);font-size:.75rem;font-weight:800;letter-spacing:.03em}
.quick-links a{display:block;padding:.7rem .8rem;border:1px solid var(--line);border-radius:.55rem;background:var(--surface-2);color:var(--ink);font-weight:750;text-decoration:none}
.quick-links a:hover,.quick-links a:focus-visible{border-color:var(--accent);color:var(--accent)}
.topic-compose{scroll-margin-top:5rem}
.topic-compose:target{outline:3px solid var(--accent);outline-offset:4px}

@media (max-width:420px){
  .set-table,.set-table tbody,.set-table tr,.set-table td{display:block;width:100%}
  .set-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .set-table tr{display:grid;grid-template-columns:1fr 1fr;gap:.45rem .75rem;padding:.8rem 0;border-bottom:1px solid var(--line)}
  .set-table td{display:grid;grid-template-columns:4.5rem 1fr;align-items:center;min-width:0;padding:0;border:0}
  .set-table td::before{color:var(--muted);font-size:.72rem;font-weight:800;text-transform:uppercase;letter-spacing:.05em}
  .set-table td:nth-child(1)::before{content:"Set"}.set-table td:nth-child(2)::before{content:"Target"}.set-table td:nth-child(3)::before{content:"Weight"}.set-table td:nth-child(4)::before{content:"Done"}
  .set-table input[type=number]{width:100%;min-width:0}
  .set-table input[type=checkbox]{justify-self:start}
}
* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-family: Arial, Helvetica, sans-serif; line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: repeating-linear-gradient(135deg, transparent 0 22px, rgba(41,35,29,.035) 22px 23px); }
a { color: inherit; }
svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; }
button, .button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; background: var(--ink); color: var(--surface); border-radius: 8px; }
.visually-hidden { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
.skip-link:focus { top: 1rem; }
.shell { width: min(calc(100% - 2rem), var(--max)); margin-inline: auto; }
.app-header { position: sticky; top: 0; z-index: 30; background: rgba(23,26,24,.97); color: #fffdf8; border-bottom: 3px solid var(--brand); }
.header-row { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.brand-mark { width: 36px; height: 36px; color: var(--accent); }
.brand span { color: #fff; }
.brand small { display: block; color: #d6d2c9; font-size: .62rem; letter-spacing: .16em; line-height: 1; }
.desktop-nav { display: none; }
.mobile-menu { position: relative; }
.mobile-menu summary { list-style: none; display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid #777b76; border-radius: 10px; cursor: pointer; }
.mobile-menu summary::-webkit-details-marker { display:none; }
.menu-icon { width: 22px; height: 16px; border-block: 2px solid currentColor; position: relative; }
.menu-icon::after { content:""; position:absolute; left:0; right:0; top:5px; border-top:2px solid currentColor; }
.mobile-panel { position: absolute; right: 0; top: 54px; width: min(86vw, 310px); padding: .7rem; background: #202421; border: 1px solid #4b504c; border-radius: 14px; box-shadow: 0 18px 50px rgba(0,0,0,.35); }
.mobile-panel a { display: block; padding: .8rem .9rem; text-decoration: none; border-radius: 8px; color: #f5f2eb; }
.mobile-panel a[aria-current="page"] { background: var(--brand); font-weight: 800; }
.mobile-panel a + a { margin-top: .15rem; }
.page { padding: 1.4rem 0 4rem; min-height: calc(100vh - 150px); }
.eyebrow { margin: 0 0 .4rem; color: var(--brand); font-size: .76rem; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1,h2,h3 { margin: 0; line-height: 1.1; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 8vw, 4.4rem); max-width: 820px; }
h2 { font-size: clamp(1.45rem, 5vw, 2.35rem); }
h3 { font-size: 1.1rem; }
p { margin: .65rem 0 0; }
.lede { max-width: 700px; color: var(--muted); font-size: clamp(1rem, 3vw, 1.22rem); }
.page-head { padding: 1rem 0 1.4rem; display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.page-head h1 { font-size: clamp(2rem, 7vw, 3.4rem); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.button { display: inline-flex; min-height: 50px; align-items: center; justify-content: center; gap: .55rem; padding: .75rem 1.1rem; border: 2px solid transparent; border-radius: 12px; background: var(--brand); color: #fff; font-weight: 900; text-decoration: none; text-align: center; }
.button:hover { background: var(--brand-dark); }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.secondary:hover { background: var(--ink); color: var(--surface); }
.button.light { background:#fff; color:#6f160d; }
.button.full { width: 100%; }
.button svg { width: 20px; height: 20px; }
.pill { display:inline-flex; align-items:center; gap:.4rem; padding:.3rem .65rem; border-radius:999px; background:var(--surface-2); color:var(--ink); font-size:.76rem; font-weight:800; }
.pill.live { background:var(--success-bg); color:var(--success-ink); }
.grid { display:grid; gap:1rem; }
.section { margin-top: 2rem; }
.section-heading { display:flex; align-items:end; justify-content:space-between; gap:1rem; margin-bottom:1rem; }
.section-heading a { color:var(--brand); font-weight:800; }
.muted { color:var(--muted); }
.app-footer { background:#171a18; color:#e7e4dd; padding:1.8rem 0; }
.footer-row { display:flex; flex-wrap:wrap; justify-content:space-between; gap:1rem; align-items:center; }
.app-footer p { margin:0; font-size:.88rem; }
.app-footer a { color:#fff; }

/* Login */
.login-layout { display:grid; gap:1rem; align-items:stretch; }
.login-story { overflow:hidden; padding:1.5rem; color:#fff; background:linear-gradient(145deg,#1b201d 0%,#292e2a 62%,#6f1a11 100%); position:relative; }
.login-story::after { content:""; position:absolute; width:240px; height:240px; right:-90px; bottom:-90px; border:28px solid rgba(217,165,33,.25); border-radius:50%; }
.login-story h1 { font-size:clamp(2.5rem,10vw,5.4rem); text-transform:uppercase; max-width:560px; }
.login-story .eyebrow { color:#f1c54f; }
.login-story p { max-width:540px; color:#e7e4dd; font-size:1.06rem; }
.session-preview { margin-top:2rem; max-width:470px; padding:1rem; border:1px solid rgba(255,255,255,.3); border-radius:14px; background:rgba(0,0,0,.22); }
.session-preview strong { display:block; color:#f3c851; }
.login-box { padding:1.4rem; }
.login-box h2 { margin-bottom:.5rem; }
.form-group { margin-top:1rem; }
label { display:block; margin-bottom:.35rem; font-weight:800; }
input, textarea, select { width:100%; border:1px solid #9b9a93; border-radius:10px; padding:.78rem .85rem; background:var(--surface); color:var(--ink); }
textarea { min-height:150px; resize:vertical; }
.field-help { display:block; margin-top:.3rem; color:var(--muted); font-size:.82rem; }
.form-row { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; gap:.7rem; margin:1rem 0; }
.check-label { display:flex; gap:.5rem; align-items:center; margin:0; font-weight:600; }
.check-label input { width:20px; height:20px; accent-color:var(--brand); }
.text-link { color:var(--brand); font-weight:800; }
.secure-note { display:flex; gap:.6rem; align-items:flex-start; margin-top:1rem; color:var(--muted); font-size:.82rem; }
.secure-note svg { flex:0 0 20px; }

/* Dashboard */
.hero-workout { padding:1.35rem; color:#fff; background:linear-gradient(130deg,#8b2115,#b52e1d 58%,#742016); position:relative; overflow:hidden; }
.hero-workout::before { content:"TODAY"; position:absolute; right:-.2rem; top:1rem; font-size:clamp(4rem,18vw,9rem); line-height:1; font-weight:900; color:rgba(255,255,255,.08); }
.hero-workout h2 { font-size:clamp(2rem,8vw,4.3rem); max-width:700px; }
.hero-workout .eyebrow { color:#ffe28c; }
.workout-meta { display:flex; flex-wrap:wrap; gap:.7rem 1.2rem; margin:1rem 0 1.2rem; font-weight:700; }
.workout-meta span { display:flex; align-items:center; gap:.4rem; }
.workout-meta svg { width:19px; }
.week-strip { grid-template-columns:repeat(7, minmax(0,1fr)); overflow:hidden; }
.day { padding:.7rem .15rem; text-align:center; border-radius:13px; background:var(--surface); border:1px solid var(--line); }
.day b { display:block; font-size:.72rem; text-transform:uppercase; }
.day span { display:block; margin-top:.3rem; font-size:.9rem; }
.day.done { background:var(--success-bg); color:var(--success-ink); border-color:var(--success-line); }
.day.today { background:var(--ink); color:var(--surface); border-color:var(--ink); box-shadow:inset 0 -4px var(--accent); }
.day.rest { color:var(--muted); }
.stat-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.stat { padding:1rem; }
.stat strong { display:block; font-size:clamp(1.6rem,7vw,2.6rem); line-height:1; }
.stat span { display:block; margin-top:.4rem; color:var(--muted); font-size:.83rem; }
.schedule { overflow:hidden; }
.schedule-item { display:grid; grid-template-columns:64px 1fr auto; align-items:center; gap:.7rem; padding:1rem; border-bottom:1px solid var(--line); }
.schedule-item:last-child { border-bottom:0; }
.schedule-day { font-size:.75rem; font-weight:900; color:var(--muted); text-transform:uppercase; }
.schedule-item h3 { margin-bottom:.2rem; }
.schedule-item p { margin:0; font-size:.83rem; color:var(--muted); }
.status-dot { width:12px; height:12px; border-radius:50%; background:var(--status-idle); }
.status-dot.complete { background:var(--success); }
.status-dot.current { background:var(--brand); box-shadow:0 0 0 5px rgba(181,46,29,.15); }
.coach-note { padding:1.2rem; border-left:5px solid var(--accent); }
.coach-note blockquote { margin:.6rem 0 0; font-size:1.05rem; }

/* Workout */
.workout-titlebar { padding:1.25rem; }
.back-link { display:inline-flex; align-items:center; gap:.4rem; color:var(--brand); font-weight:800; margin-bottom:1rem; }
.exercise-list { display:grid; gap:1rem; counter-reset:exercise; }
.exercise { overflow:hidden; counter-increment:exercise; }
.exercise-head { padding:1rem; background:var(--surface-2); display:grid; grid-template-columns:42px 1fr; gap:.8rem; align-items:center; }
.exercise-head::before { content:counter(exercise); width:38px; height:38px; display:grid; place-items:center; border-radius:50%; background:var(--ink); color:var(--surface); font-weight:900; }
.exercise-head p { margin:.2rem 0 0; color:var(--muted); font-size:.86rem; }
.set-table { width:100%; border-collapse:collapse; }
.set-table th, .set-table td { padding:.75rem .45rem; text-align:center; border-top:1px solid var(--line); }
.set-table th { color:var(--muted); text-transform:uppercase; font-size:.7rem; letter-spacing:.08em; }
.set-table input[type="number"] { width:74px; padding:.5rem; text-align:center; }
.set-table input[type="checkbox"] { width:24px; height:24px; accent-color:var(--success); }
.exercise-cue { padding:.8rem 1rem; border-top:1px solid var(--line); color:var(--muted); font-size:.88rem; }
.finish-panel { position:sticky; bottom:0; z-index:10; padding:1rem; margin-top:1rem; background:rgba(255,253,248,.96); border:1px solid var(--line); border-radius:16px; box-shadow:0 -8px 28px rgba(0,0,0,.12); }
.finish-check { display:flex; align-items:center; gap:.8rem; margin-bottom:.8rem; font-weight:800; }
.finish-check input { width:26px; height:26px; accent-color:var(--brand); }

/* Progress */
.metric-tabs { display:flex; gap:.5rem; overflow:auto; padding-bottom:.3rem; }
.metric-tabs a { flex:0 0 auto; padding:.6rem .9rem; border:1px solid var(--line); border-radius:999px; text-decoration:none; background:var(--surface); font-weight:800; }
.metric-tabs a[aria-current="true"] { background:var(--ink); color:var(--surface); }
.chart-card { padding:1rem; overflow:hidden; }
.chart-summary { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:end; gap:1rem; }
.chart-summary strong { font-size:2.3rem; line-height:1; }
.chart-wrap { margin-top:1rem; min-height:240px; }
.chart-wrap svg { width:100%; height:auto; }
.chart-label { fill:var(--muted); font-size:12px; }
.chart-line { fill:none; stroke:var(--brand); stroke-width:4; stroke-linecap:round; stroke-linejoin:round; }
.chart-area { fill:url(#chartFill); }
.chart-grid { stroke:var(--line); stroke-width:1; }
.chart-point { fill:var(--surface); stroke:var(--brand); stroke-width:3; }
.log-table-wrap { overflow-x:auto; }
.log-table { width:100%; border-collapse:collapse; min-width:520px; }
.log-table th,.log-table td { padding:.85rem; text-align:left; border-bottom:1px solid var(--line); }
.log-table th { font-size:.73rem; text-transform:uppercase; color:var(--muted); }
.trend-up { color:var(--success); font-weight:900; }
.milestone { padding:1.1rem; display:flex; gap:.9rem; align-items:flex-start; }
.milestone-icon { flex:0 0 45px; height:45px; display:grid; place-items:center; border-radius:50%; background:#f5dc91; color:#593f00; }

/* Nutrition */
.nutrition-hero { padding:1.3rem; background:linear-gradient(135deg,#183e2a,#245b3c); color:#fff; }
.nutrition-hero .eyebrow { color:#f4ce65; }
.nutrition-hero p { color:#e2eee5; max-width:720px; }
.target-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.target { padding:1rem; position:relative; overflow:hidden; }
.target::after { content:""; position:absolute; width:54px; height:54px; right:-17px; top:-17px; border-radius:50%; background:var(--accent); opacity:.25; }
.target strong { display:block; font-size:1.6rem; }
.target span { color:var(--muted); font-size:.82rem; }
.meal { padding:1rem; }
.meal-head { display:flex; justify-content:space-between; gap:1rem; align-items:center; }
.meal ul { margin:.7rem 0 0; padding-left:1.2rem; color:var(--muted); }
.meal li + li { margin-top:.25rem; }
.note-list { margin:0; padding:0; list-style:none; }
.note-list li { padding:1rem 1rem 1rem 3rem; border-bottom:1px solid var(--line); position:relative; }
.note-list li:last-child { border-bottom:0; }
.note-list li::before { background:var(--success-bg); color:var(--success-ink); }
.note-list li::before { content:"✓"; position:absolute; left:1rem; top:1rem; width:22px; height:22px; display:grid; place-items:center; border-radius:50%; background:#d9efdf; color:#104d2d; font-weight:900; }
.note-list.note-list li::before { background:var(--success-bg); color:var(--success-ink); }

/* Messages */
.message-layout { display:grid; gap:1rem; }
.conversation { padding:1rem; }
.coach-profile { display:flex; align-items:center; gap:.8rem; padding-bottom:1rem; border-bottom:1px solid var(--line); }
.avatar { width:48px; height:48px; border-radius:50%; display:grid; place-items:center; background:var(--ink); color:var(--surface); font-weight:900; }
.online { display:inline-flex; align-items:center; gap:.35rem; color:var(--success); font-size:.78rem; font-weight:800; }
.online::before { content:""; width:8px; height:8px; border-radius:50%; background:var(--success); }
.messages { display:flex; flex-direction:column; gap:.85rem; padding:1rem 0; }
.bubble { max-width:88%; padding:.8rem 1rem; border-radius:15px; background:var(--surface-2); }
.bubble.coach { border-bottom-left-radius:3px; }
.bubble.client { align-self:flex-end; background:var(--brand); color:#fff; border-bottom-right-radius:3px; }
.bubble p { margin:0; }
.bubble time { display:block; margin-top:.35rem; font-size:.7rem; opacity:.75; }
.quick-links { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.8rem; }
.quick-links button { border:1px solid var(--line); border-radius:999px; background:var(--surface); color:var(--ink); padding:.45rem .7rem; }
.response-card { padding:1rem; }
.composer-grid { grid-template-columns:1fr; }
.expectation { padding:1rem; }
.expectation dl { margin:0; }
.expectation div { padding:.8rem 0; border-bottom:1px solid var(--line); }
.expectation div:last-child { border:0; }
.expectation dt { font-weight:900; }
.expectation dd { margin:.2rem 0 0; color:var(--muted); }

@media (min-width:700px) {
  .shell { width:min(calc(100% - 3rem),var(--max)); }
  .page { padding-top:2rem; }
  .login-layout { grid-template-columns:1.15fr .85fr; min-height:680px; }
  .login-story,.login-box { padding:clamp(2rem,5vw,4rem); }
  .login-box { display:flex; flex-direction:column; justify-content:center; }
  .dashboard-grid { grid-template-columns:1.5fr .8fr; }
  .stat-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .target-grid { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .composer-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .meal-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .progress-grid { grid-template-columns:1.5fr .7fr; }
  .message-layout { grid-template-columns:1.5fr .7fr; align-items:start; }
  .exercise-head { padding:1.15rem 1.3rem; }
  .set-table th,.set-table td { padding:.85rem; }
}
@media (min-width:920px) {
  .desktop-nav { display:flex; align-items:center; gap:.2rem; }
  .desktop-nav a { padding:.6rem .68rem; border-radius:8px; text-decoration:none; color:#e7e4dd; font-size:.85rem; font-weight:700; }
  .desktop-nav a:hover { background:#323733; }
  .desktop-nav a[aria-current="page"] { background:var(--brand); color:#fff; }
  .mobile-menu { display:none; }
}
@media (prefers-color-scheme:dark) {
  :root { --bg:#121512; --surface:#1d211e; --surface-2:#292e2a; --ink:#f4f1e9; --muted:#b9bdb8; --line:#555e58; --brand:#e85a46; --brand-dark:#bd3f2e; --accent:#f1bc42; --success:#79d99d; --success-bg:#173c27; --success-ink:#a7edc0; --success-line:#41865c; --status-idle:#9da49f; --shadow:0 12px 30px rgba(0,0,0,.3); }
  .login-story { border-color:#484d49; }
  .finish-panel { background:rgba(29,33,30,.97); }
  input,textarea,select { border-color:#666d67; }
  .milestone-icon { background:#5b4816; color:#ffe28c; }
}
@media (prefers-reduced-motion:reduce) { html { scroll-behavior:auto; } }
