:root {
  --bg: #090a0d;
  --bg-soft: #0d0f13;
  --panel: #111319;
  --panel-2: #151821;
  --panel-3: #1a1e27;
  --line: #232834;
  --line-soft: rgba(255,255,255,.075);
  --text: #f5f7f8;
  --muted: #8d95a3;
  --muted-2: #626a76;
  --acid: #9cff72;
  --acid-soft: rgba(156,255,114,.12);
  --danger: #ff6d6d;
  --warning: #ffd46d;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 20px 70px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

/* ---------- auth ---------- */
.auth-body {
  min-height: 100svh;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    radial-gradient(circle at 73% 18%, rgba(156,255,114,.08), transparent 24rem),
    #090a0d;
  background-size: 48px 48px, 48px 48px, auto, auto;
}
.auth-body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(120deg, transparent 0 48%, rgba(156,255,114,.02) 48% 49%, transparent 49% 100%);
}
.auth-shell { min-height: 100svh; width: min(1120px, calc(100% - 32px)); margin: auto; display: grid; place-items: center; position: relative; padding: 44px 0 68px; }
.auth-card { width: min(470px, 100%); position: relative; padding: 44px 42px 40px; border: 1px solid var(--line); background: rgba(15,17,22,.88); backdrop-filter: blur(18px); border-radius: 22px; box-shadow: var(--shadow); overflow: hidden; }
.auth-card::before { content:""; position:absolute; inset:0 auto auto 0; width:100%; height:2px; background: linear-gradient(90deg, var(--acid), transparent 68%); opacity:.75; }
.auth-card::after { content:"01"; position:absolute; right:20px; top:15px; color:#313744; font:700 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing:1px; }
.auth-mark { display:flex; gap:5px; margin-bottom:34px; align-items:flex-end; height:34px; }
.auth-mark span { display:block; width:9px; border-radius:1px; background:var(--acid); transform:skewX(-20deg); }
.auth-mark span:nth-child(1){height:18px; opacity:.6}.auth-mark span:nth-child(2){height:27px;}.auth-mark span:nth-child(3){height:34px; opacity:.8}
.auth-kicker { color: var(--acid); font: 800 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1.7px; margin-bottom: 10px; }
.auth-card h1 { margin: 0; font-size: clamp(40px, 8vw, 62px); line-height: .95; letter-spacing: -3px; font-weight: 850; }
.auth-copy { color: var(--muted); margin: 16px 0 29px; max-width: 35ch; line-height: 1.5; font-size: 14px; }
.auth-error { border: 1px solid rgba(255,109,109,.24); background: rgba(255,109,109,.08); color: #ffb0b0; border-radius: 10px; padding: 11px 13px; margin: -6px 0 18px; font-size: 13px; }
.auth-form { display: grid; gap: 15px; }
.auth-form label:not(.remember-row) { display: grid; gap: 7px; }
.auth-form label > span:first-child { color: var(--muted); font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: 1px; }
.auth-form input[type="text"], .auth-form input[type="password"], .auth-form input:not([type]) { height: 51px; border: 1px solid var(--line); border-radius: 11px; background: #0c0e12; padding: 0 14px; color: white; outline: none; font-size: 16px; transition: border-color .15s, background .15s, box-shadow .15s; }
.auth-form input:focus { border-color: #485061; background:#0e1116; box-shadow: 0 0 0 3px rgba(156,255,114,.05); }
.auth-submit { margin-top: 8px; height: 54px; border: 0; border-radius: 11px; background: var(--acid); color: #081006; font-weight: 900; letter-spacing: -.2px; display:flex; align-items:center; justify-content:space-between; padding:0 18px; cursor:pointer; }
.auth-submit span { font-size: 20px; }
.remember-row { display:flex; align-items:center; gap:10px; position:relative; cursor:pointer; margin: 1px 0 4px; }
.remember-row input { position:absolute; opacity:0; pointer-events:none; }
.remember-box { width:20px; height:20px; border:1px solid var(--line); border-radius:6px; background:#0c0e12; position:relative; flex:0 0 auto; }
.remember-row input:checked + .remember-box { background: var(--acid); border-color: var(--acid); }
.remember-row input:checked + .remember-box::after { content:""; position:absolute; width:7px; height:4px; border-left:2px solid #071006; border-bottom:2px solid #071006; transform:rotate(-45deg); left:5px; top:5px; }
.remember-text { color: var(--muted)!important; font: 600 13px/1.3 Inter, sans-serif!important; text-transform:none!important; letter-spacing:0!important; }
.auth-foot { position:absolute; bottom:22px; left:50%; transform:translateX(-50%); white-space:nowrap; color:#444b56; font:700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing:1.4px; }

/* ---------- app shell ---------- */
.app-body { min-height: 100svh; background: #090a0d; overflow-x:hidden; }
.app-body::before { content:""; position:fixed; inset:0; pointer-events:none; background: radial-gradient(circle at 78% -12%, rgba(156,255,114,.06), transparent 30rem), radial-gradient(circle at 0% 60%, rgba(90,120,255,.035), transparent 30rem); z-index:0; }
.grain { position:fixed; inset:0; pointer-events:none; z-index:50; opacity:.035; background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"); }
.app-shell { position:relative; z-index:1; width:min(1260px, calc(100% - 40px)); margin:0 auto; }
.desktop-header { height:86px; display:grid; grid-template-columns: 1fr auto 1fr; align-items:center; border-bottom:1px solid var(--line-soft); position:relative; }
.wordmark { border:0; background:none; padding:0; display:flex; align-items:center; gap:11px; cursor:pointer; justify-self:start; }
.wordmark-glyph { display:flex; align-items:flex-end; gap:3px; height:22px; }
.wordmark-glyph i { display:block; width:5px; background:var(--acid); transform:skewX(-18deg); border-radius:1px; }
.wordmark-glyph i:nth-child(1){height:10px; opacity:.65}.wordmark-glyph i:nth-child(2){height:16px}.wordmark-glyph i:nth-child(3){height:22px; opacity:.82}
.wordmark-copy { font-size:13px; font-weight:900; letter-spacing:.6px; }
.wordmark-copy span { color:#4c5360; padding:0 2px; }
.desktop-nav { display:flex; gap:4px; padding:4px; border:1px solid var(--line-soft); background:rgba(17,19,25,.65); border-radius:12px; }
.desktop-nav button { border:0; background:transparent; color:var(--muted); height:36px; padding:0 14px; border-radius:8px; font-size:12px; font-weight:800; cursor:pointer; }
.desktop-nav button.active { color:var(--text); background:var(--panel-3); box-shadow: inset 0 0 0 1px rgba(255,255,255,.03); }
.header-actions { justify-self:end; display:flex; align-items:center; gap:8px; }
.ghost-button,.profile-pill { border:1px solid var(--line-soft); background:rgba(17,19,25,.6); height:38px; border-radius:10px; cursor:pointer; }
.ghost-button { color:var(--muted); padding:0 13px; font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.7px; }
.profile-pill { padding:0 12px; display:flex; gap:8px; align-items:center; font-size:12px; font-weight:800; }
.profile-dot { width:7px; height:7px; border-radius:50%; background:var(--acid); box-shadow:0 0 0 4px var(--acid-soft); }
.account-menu { position:absolute; right:0; top:69px; width:200px; z-index:20; border:1px solid var(--line); background:#101218; border-radius:12px; padding:14px; box-shadow:0 20px 60px rgba(0,0,0,.45); }
.account-label { color:var(--muted-2); font:800 9px/1 ui-monospace, monospace; letter-spacing:1px; margin-bottom:5px; }
.account-menu strong { font-size:13px; }
.account-menu form { margin-top:13px; padding-top:12px; border-top:1px solid var(--line-soft); }
.account-menu button { width:100%; height:34px; border:1px solid var(--line); background:#0c0e12; border-radius:8px; color:#d6d9de; font-size:11px; font-weight:800; cursor:pointer; }
.main-stage { padding:58px 0 110px; }
.page-view { display:none; animation: pageIn .22s ease both; }
.page-view.active { display:block; }
@keyframes pageIn { from{opacity:0; transform:translateY(5px)} to{opacity:1; transform:none} }

/* ---------- headings ---------- */
.session-topline { display:flex; align-items:flex-end; justify-content:space-between; gap:30px; padding-bottom:27px; }
.eyebrow { color:var(--acid); font:800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing:1.6px; text-transform:uppercase; margin-bottom:10px; }
.display-title,.section-heading h1 { margin:0; font-size:clamp(46px, 6vw, 84px); line-height:.9; letter-spacing:-4.2px; font-weight:880; }
.display-subtitle,.section-heading p { color:var(--muted); margin-top:13px; font-size:14px; }
.date-control { display:grid; grid-template-columns:42px auto 42px; height:42px; border:1px solid var(--line-soft); background:rgba(17,19,25,.65); border-radius:11px; position:relative; overflow:hidden; }
.date-control > button { border:0; background:none; min-width:42px; cursor:pointer; }
.date-control > button:first-child { border-right:1px solid var(--line-soft); }.date-control > button:last-child { border-left:1px solid var(--line-soft); }
.date-control > button:first-child,.date-control > button:last-child { color:var(--muted); font-size:22px; }
.date-button { padding:0 14px; font-size:11px; font-weight:850; letter-spacing:.2px; white-space:nowrap; }
#datePicker { position:absolute; opacity:0; pointer-events:none; width:1px; height:1px; }
.section-heading { margin-bottom:34px; }
.split-heading { display:flex; justify-content:space-between; align-items:flex-end; gap:30px; border-bottom:1px solid var(--line-soft); padding-bottom:31px; }
.section-heading h1 { font-size:clamp(44px,5vw,70px); }
.section-heading p { margin-bottom:0; }

/* ---------- session signal ---------- */
.session-signal { border-top:1px solid var(--line-soft); border-bottom:1px solid var(--line-soft); padding:14px 0 15px; margin-bottom:4px; }
.signal-line { height:3px; background:#171b22; overflow:hidden; }
.signal-line span { display:block; height:100%; width:0; background:linear-gradient(90deg, var(--acid), #d5ffc4); transition:width .28s ease; }
.signal-metrics { display:flex; gap:30px; margin-top:11px; justify-content:flex-end; }
.signal-metrics div { display:flex; gap:7px; align-items:baseline; }
.signal-metrics strong { font:800 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing:-.4px; }
.signal-metrics span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:.9px; }

/* ---------- today / exercises ---------- */
.today-content { min-height:300px; }
.exercise-block { position:relative; border-bottom:1px solid var(--line-soft); padding:31px 0 29px; }
.exercise-block::before { content:attr(data-index); position:absolute; left:-2px; top:34px; color:#343b47; font:800 9px/1 ui-monospace, monospace; letter-spacing:1px; }
.exercise-main { padding-left:38px; }
.exercise-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:24px; align-items:start; margin-bottom:19px; }
.exercise-title { font-size:19px; font-weight:820; letter-spacing:-.45px; line-height:1.2; }
.exercise-meta { color:var(--muted); font-size:11px; margin-top:6px; display:flex; flex-wrap:wrap; gap:7px; align-items:center; }
.exercise-meta .dot { width:3px; height:3px; background:#424956; border-radius:50%; }
.previous-date { text-align:right; color:var(--muted-2); font:800 9px/1.25 ui-monospace, monospace; letter-spacing:.7px; text-transform:uppercase; }
.previous-date strong { display:block; color:#aeb4bd; font-size:10px; margin-top:5px; letter-spacing:.2px; }
.set-grid-head,.set-row { display:grid; grid-template-columns:52px minmax(90px,1.15fr) minmax(84px,.8fr) minmax(84px,.8fr) 52px; gap:8px; align-items:center; }
.set-grid-head { color:#555d68; font:800 8px/1 ui-monospace, monospace; letter-spacing:1px; text-transform:uppercase; height:25px; }
.set-grid-head > *:not(:first-child) { padding-left:4px; }
.set-row { min-height:54px; position:relative; }
.set-number { color:#69717e; font:800 12px/1 ui-monospace, monospace; padding-left:4px; }
.set-row.completed .set-number { color:var(--acid); }
.previous-value { color:#9da4ae; font:700 12px/1.1 ui-monospace, monospace; letter-spacing:-.2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.metric-input { width:100%; height:44px; border:1px solid var(--line); border-radius:9px; background:#0d0f14; color:white; padding:0 11px; outline:none; font-size:16px; font-weight:750; transition:.15s; -moz-appearance:textfield; }
.metric-input::-webkit-inner-spin-button,.metric-input::-webkit-outer-spin-button { -webkit-appearance:none; margin:0; }
.metric-input:focus { border-color:#485160; background:#10131a; box-shadow:0 0 0 3px rgba(156,255,114,.045); }
.metric-input::placeholder { color:#424954; font-size:11px; font-weight:700; }
.metric-input.hidden-input { visibility:hidden; }
.complete-button { width:44px; height:44px; border:1px solid var(--line); border-radius:9px; background:#0d0f14; display:grid; place-items:center; cursor:pointer; transition:.15s; justify-self:end; }
.complete-button svg { width:16px; height:16px; stroke:#525a66; stroke-width:2.3; fill:none; }
.complete-button.completed { background:var(--acid); border-color:var(--acid); box-shadow:0 0 0 3px rgba(156,255,114,.07); }
.complete-button.completed svg { stroke:#081006; }
.set-row.completed .metric-input { border-color:rgba(156,255,114,.18); background:rgba(156,255,114,.025); }
.delta-pill { position:absolute; left:calc(52px + 1.15fr); display:none; }
.session-notes { display:grid; grid-template-columns:1fr 220px; gap:16px; padding:30px 0 0; }
.note-panel,.weight-panel { border:1px solid var(--line-soft); border-radius:13px; background:rgba(17,19,25,.48); padding:15px; }
.panel-label { color:var(--muted-2); font:800 9px/1 ui-monospace, monospace; letter-spacing:1px; text-transform:uppercase; margin-bottom:10px; }
.note-panel textarea { width:100%; min-height:86px; resize:vertical; border:0; outline:0; background:transparent; color:#dfe2e7; padding:0; line-height:1.5; font-size:14px; }
.note-panel textarea::placeholder { color:#474f5a; }
.weight-entry { display:flex; align-items:baseline; gap:8px; }
.weight-entry input { width:100%; border:0; outline:0; background:transparent; color:white; font-size:32px; font-weight:850; letter-spacing:-1.5px; -moz-appearance:textfield; }
.weight-entry input::-webkit-inner-spin-button,.weight-entry input::-webkit-outer-spin-button { -webkit-appearance:none; }
.weight-entry span { color:var(--muted); font:800 10px/1 ui-monospace, monospace; }
.rest-panel { margin-top:31px; min-height:270px; border:1px solid var(--line-soft); border-radius:17px; background:linear-gradient(135deg,rgba(156,255,114,.035),rgba(255,255,255,.012)); display:grid; place-items:center; position:relative; overflow:hidden; text-align:center; }
.rest-panel::before { content:"REST"; position:absolute; right:-20px; bottom:-32px; font-weight:900; font-size:150px; letter-spacing:-12px; color:rgba(255,255,255,.018); }
.rest-panel .rest-inner { position:relative; z-index:1; }
.rest-index { color:var(--acid); font:800 10px/1 ui-monospace, monospace; letter-spacing:1.4px; margin-bottom:12px; }
.rest-panel h2 { margin:0; font-size:38px; letter-spacing:-2px; }
.rest-panel p { margin:8px 0 0; color:var(--muted); font-size:13px; }

/* ---------- history ---------- */
.history-summary { display:flex; align-items:center; gap:22px; }
.history-summary .mini-stat { text-align:right; }
.mini-stat strong { display:block; font-size:18px; letter-spacing:-.8px; }
.mini-stat span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:.8px; }
.history-list { border-top:1px solid var(--line-soft); }
.history-row { display:grid; grid-template-columns:70px minmax(0,1fr) repeat(3,110px) 30px; align-items:center; min-height:84px; border-bottom:1px solid var(--line-soft); cursor:pointer; transition:background .15s, padding .15s; }
.history-row:hover { background:rgba(255,255,255,.016); padding-left:8px; }
.history-daybox { width:50px; text-align:center; }
.history-daybox strong { font-size:22px; display:block; letter-spacing:-1px; }
.history-daybox span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:1px; text-transform:uppercase; }
.history-name strong { display:block; font-size:15px; letter-spacing:-.2px; }
.history-name span { display:block; margin-top:5px; color:var(--muted); font-size:11px; }
.history-metric { text-align:right; }
.history-metric strong { display:block; font:800 13px/1 ui-monospace, monospace; }
.history-metric span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:.8px; }
.history-arrow { color:#4b5260; font-size:18px; text-align:right; }
.empty-state { border:1px solid var(--line-soft); border-radius:14px; padding:60px 20px; color:var(--muted); text-align:center; margin-top:20px; }

/* ---------- progress ---------- */
.select-wrap { position:relative; width:min(360px,100%); }
.select-wrap::after { content:"⌄"; position:absolute; right:13px; top:50%; transform:translateY(-57%); pointer-events:none; color:var(--muted); }
.select-wrap select { width:100%; height:45px; appearance:none; border:1px solid var(--line); background:#0e1116; border-radius:10px; color:white; padding:0 36px 0 13px; outline:none; font-size:12px; font-weight:750; }
.progress-stat-grid { display:grid; grid-template-columns:repeat(4,1fr); border-top:1px solid var(--line-soft); border-bottom:1px solid var(--line-soft); margin-bottom:28px; }
.progress-stat { padding:18px 18px 17px 0; border-right:1px solid var(--line-soft); margin-right:18px; }
.progress-stat:last-child { border-right:0; margin-right:0; }
.progress-stat strong { display:block; font-size:26px; letter-spacing:-1.4px; line-height:1; }
.progress-stat strong.positive { color:var(--acid); }
.progress-stat span { display:block; color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:.9px; margin-top:7px; }
.chart-grid { display:grid; grid-template-columns:1.4fr 1fr; gap:18px; }
.chart-card { border:1px solid var(--line-soft); border-radius:14px; background:rgba(17,19,25,.5); padding:16px 16px 12px; min-width:0; }
.chart-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; }
.chart-head strong { font-size:12px; }
.chart-head span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:.8px; }
.chart-wrap { height:250px; position:relative; }
.chart-wrap canvas { display:block; width:100%; height:100%; }
.session-table { margin-top:18px; border-top:1px solid var(--line-soft); }
.progress-session { display:grid; grid-template-columns:120px 1fr 100px; align-items:center; min-height:62px; border-bottom:1px solid var(--line-soft); }
.progress-session-date { color:var(--muted); font-size:11px; }
.progress-session-sets { font:700 11px/1.4 ui-monospace, monospace; color:#bcc2ca; }
.progress-session-best { text-align:right; }
.progress-session-best strong { display:block; font:800 12px/1 ui-monospace, monospace; }
.progress-session-best span { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; }

/* ---------- schedule ---------- */
.week-stamp { color:var(--muted); font:800 9px/1 ui-monospace, monospace; letter-spacing:1px; }
.week-stamp span { color:var(--acid); font-size:26px; margin-right:7px; vertical-align:-4px; }
.schedule-grid { display:grid; grid-template-columns:repeat(7,1fr); border-top:1px solid var(--line-soft); border-left:1px solid var(--line-soft); }
.schedule-day { min-width:0; min-height:290px; border-right:1px solid var(--line-soft); border-bottom:1px solid var(--line-soft); padding:15px 13px; background:rgba(255,255,255,.006); position:relative; }
.schedule-day.training { background:linear-gradient(180deg,rgba(156,255,114,.018),transparent 48%); }
.schedule-day.today { box-shadow: inset 0 2px 0 var(--acid); }
.schedule-day-name { color:var(--muted-2); font:800 8px/1 ui-monospace, monospace; letter-spacing:1px; text-transform:uppercase; }
.schedule-day h3 { margin:14px 0 3px; font-size:16px; letter-spacing:-.5px; }
.schedule-code { color:var(--acid); font:800 8px/1 ui-monospace, monospace; letter-spacing:.8px; }
.schedule-exercises { margin-top:18px; display:grid; gap:10px; }
.schedule-exercise { color:#a8afb8; font-size:10px; line-height:1.3; }
.schedule-exercise b { display:block; color:#d5d9de; font-size:10px; font-weight:750; overflow:hidden; text-overflow:ellipsis; }
.schedule-exercise span { color:#59616d; font:700 8px/1 ui-monospace, monospace; }
.schedule-rest { color:#4f5662; font:800 9px/1.4 ui-monospace, monospace; text-transform:uppercase; margin-top:18px; }

/* ---------- misc ---------- */
.skeleton-block { height:160px; margin-top:22px; border-radius:14px; background:linear-gradient(90deg,#10131a,#151922,#10131a); background-size:220% 100%; animation:shimmer 1.3s infinite; }
.skeleton-block.short { height:100px; }
@keyframes shimmer { 0%{background-position:100% 0}100%{background-position:-100% 0} }
.save-toast { position:fixed; left:50%; bottom:24px; transform:translate(-50%,18px); z-index:80; background:#edf0ec; color:#0b0d0c; border-radius:999px; height:34px; padding:0 13px 0 9px; display:flex; align-items:center; gap:8px; opacity:0; pointer-events:none; transition:.2s; box-shadow:0 10px 35px rgba(0,0,0,.35); }
.save-toast.show { opacity:1; transform:translate(-50%,0); }
.save-toast span { width:8px; height:8px; border-radius:50%; background:#4fca28; }
.save-toast b { font-size:11px; }
.offline-toast { position:fixed; top:12px; left:50%; transform:translateX(-50%); z-index:90; background:#ffda70; color:#17130a; border-radius:8px; padding:9px 12px; font-size:11px; font-weight:850; }
.mobile-nav { display:none; }

@media (max-width: 980px) {
  .app-shell { width:min(100% - 28px, 900px); }
  .desktop-header { grid-template-columns:1fr auto; height:75px; }
  .desktop-nav { display:none; }
  .header-actions { grid-column:2; }
  .main-stage { padding-top:42px; }
  .session-topline { align-items:flex-start; }
  .chart-grid { grid-template-columns:1fr; }
  .schedule-grid { grid-template-columns:repeat(2,1fr); }
  .schedule-day { min-height:230px; }
}

@media (max-width: 720px) {
  :root { --radius:14px; }
  .app-shell { width:100%; margin:0; }
  .desktop-header { height:64px; width:calc(100% - 28px); margin:auto; border-bottom:1px solid var(--line-soft); grid-template-columns:1fr auto; }
  .wordmark-copy { font-size:11px; }
  .header-actions .ghost-button { display:none; }
  .profile-pill { width:35px; height:35px; padding:0; justify-content:center; }
  .profile-pill > span:last-child { display:none; }
  .account-menu { right:0; top:52px; }
  .main-stage { padding:31px 14px calc(98px + env(safe-area-inset-bottom)); }
  .session-topline { display:block; padding-bottom:20px; }
  .display-title { font-size:49px; letter-spacing:-3.2px; }
  .display-subtitle { font-size:13px; margin-top:10px; }
  .date-control { margin-top:21px; width:100%; grid-template-columns:44px 1fr 44px; height:44px; }
  .session-signal { margin-top:0; padding-top:13px; }
  .signal-metrics { justify-content:space-between; gap:6px; }
  .signal-metrics div { gap:5px; }
  .signal-metrics strong { font-size:12px; }
  .signal-metrics span { font-size:7px; }
  .exercise-block { padding:25px 0 24px; }
  .exercise-block::before { top:28px; left:1px; }
  .exercise-main { padding-left:29px; }
  .exercise-head { gap:10px; margin-bottom:14px; }
  .exercise-title { font-size:16px; }
  .exercise-meta { font-size:10px; gap:5px; }
  .previous-date { font-size:7px; }
  .previous-date strong { font-size:8px; }
  .set-grid-head,.set-row { grid-template-columns:34px minmax(64px,.9fr) minmax(68px,.82fr) minmax(68px,.82fr) 46px; gap:5px; }
  .set-grid-head { font-size:7px; }
  .set-number { padding-left:0; font-size:10px; }
  .previous-value { font-size:10px; }
  .metric-input { height:46px; padding:0 8px; font-size:16px; border-radius:9px; }
  .complete-button { width:44px; height:46px; }
  .session-notes { grid-template-columns:1fr; gap:10px; padding-top:23px; }
  .weight-panel { order:-1; }
  .weight-entry input { font-size:29px; }
  .section-heading,.split-heading { display:block; margin-bottom:25px; padding-bottom:24px; }
  .section-heading h1 { font-size:50px; letter-spacing:-3px; }
  .select-wrap { width:100%; margin-top:19px; }
  .history-summary { margin-top:18px; justify-content:flex-start; }
  .history-summary .mini-stat { text-align:left; }
  .history-row { grid-template-columns:54px minmax(0,1fr) 70px 24px; min-height:76px; }
  .history-row .history-metric:nth-of-type(3) { display:none; }
  .history-row .history-metric:nth-of-type(4) { display:none; }
  .history-daybox { width:42px; }
  .history-daybox strong { font-size:20px; }
  .history-name strong { font-size:13px; }
  .history-name span { font-size:9px; }
  .progress-stat-grid { grid-template-columns:1fr 1fr; margin-bottom:18px; }
  .progress-stat { margin:0; padding:16px 12px 15px 0; border-bottom:1px solid var(--line-soft); }
  .progress-stat:nth-child(2) { border-right:0; padding-left:12px; }
  .progress-stat:nth-child(3) { padding-top:16px; }
  .progress-stat:nth-child(4) { border-right:0; padding-left:12px; }
  .progress-stat strong { font-size:23px; }
  .chart-card { padding:13px 12px 10px; }
  .chart-wrap { height:220px; }
  .progress-session { grid-template-columns:92px minmax(0,1fr) 70px; gap:8px; }
  .progress-session-sets { font-size:9px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .schedule-grid { grid-template-columns:1fr; border-left:0; }
  .schedule-day { min-height:0; border-left:1px solid var(--line-soft); padding:16px; }
  .schedule-exercises { grid-template-columns:1fr 1fr; gap:12px 14px; }
  .week-stamp { margin-top:18px; }
  .mobile-nav { display:grid; grid-template-columns:repeat(4,1fr); position:fixed; z-index:60; left:10px; right:10px; bottom:calc(10px + env(safe-area-inset-bottom)); height:66px; padding:5px; border:1px solid rgba(255,255,255,.10); background:rgba(14,16,21,.88); backdrop-filter:blur(20px) saturate(130%); border-radius:18px; box-shadow:0 16px 50px rgba(0,0,0,.5); }
  .mobile-nav button { border:0; background:transparent; border-radius:13px; color:#69717d; display:grid; place-items:center; align-content:center; gap:5px; cursor:pointer; }
  .mobile-nav button.active { background:#1a1e26; color:white; }
  .mobile-nav em { font-style:normal; font-size:8px; font-weight:800; letter-spacing:.3px; }
  .nav-icon { width:18px; height:16px; display:block; position:relative; }
  .nav-session::before,.nav-session::after { content:""; position:absolute; left:2px; right:2px; height:2px; background:currentColor; border-radius:2px; }
  .nav-session::before { top:3px; box-shadow:0 5px 0 currentColor, 0 10px 0 currentColor; }
  .nav-history { border:2px solid currentColor; border-radius:50%; }
  .nav-history::after { content:""; position:absolute; width:5px; height:2px; background:currentColor; left:7px; top:6px; transform-origin:left center; transform:rotate(35deg); }
  .nav-progress::before { content:""; position:absolute; left:1px; bottom:2px; width:3px; height:6px; background:currentColor; box-shadow:5px -4px 0 currentColor, 10px -8px 0 currentColor, 15px -12px 0 currentColor; }
  .nav-schedule { border:1.7px solid currentColor; border-radius:3px; }
  .nav-schedule::before { content:""; position:absolute; left:2px; right:2px; top:4px; border-top:1.7px solid currentColor; }
  .save-toast { bottom:calc(88px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .auth-shell { width:calc(100% - 20px); padding-top:16px; padding-bottom:50px; }
  .auth-card { padding:34px 22px 30px; border-radius:18px; }
  .auth-card h1 { font-size:47px; }
  .auth-foot { font-size:7px; bottom:14px; }
  .display-title { font-size:44px; }
  .exercise-main { padding-left:25px; }
  .set-grid-head,.set-row { grid-template-columns:29px minmax(56px,.85fr) minmax(63px,.82fr) minmax(63px,.82fr) 44px; gap:4px; }
  .metric-input { padding:0 6px; }
  .previous-value { font-size:9px; }
}


/* ---------- v3 refinement pass ---------- */
@media (min-width: 721px) {
  .app-shell { width:min(1320px, calc(100% - 56px)); }
  .main-stage { padding-top:52px; }
  .set-grid-head,.set-row { grid-template-columns:52px minmax(130px,1fr) 200px 200px 52px; gap:9px; }
  .metric-input { max-width:200px; justify-self:stretch; }
  .session-topline { align-items:center; }
  .section-heading { min-height:112px; align-items:flex-end; }
  .section-heading h1 { font-size:64px; letter-spacing:-3.6px; }
}

.metric-input.carried {
  color:#9ba2ac;
  background:rgba(255,255,255,.012);
  border-color:rgba(255,255,255,.075);
}
.metric-input.carried:focus { color:white; }

.rest-panel {
  min-height:190px;
  margin-top:26px;
  text-align:left;
  place-items:stretch;
  background:linear-gradient(120deg,rgba(156,255,114,.028),rgba(255,255,255,.006));
}
.rest-panel::before { display:none; }
.rest-inner {
  width:100%;
  display:grid;
  grid-template-columns:150px 1fr auto;
  align-items:center;
  gap:28px;
  padding:34px 38px;
}
.rest-panel h2 { font-size:42px; margin:0; }
.rest-index { align-self:start; margin-top:8px; }
.rest-next {
  min-width:260px;
  border-left:1px solid var(--line-soft);
  padding-left:28px;
}
.rest-next span { display:block; color:var(--muted-2); font:800 8px/1 ui-monospace,monospace; letter-spacing:1px; margin-bottom:9px; }
.rest-next strong { display:block; font-size:15px; }
.rest-next em { display:block; margin-top:7px; color:var(--muted); font:700 10px/1 ui-monospace,monospace; font-style:normal; }

.auth-card h1 { font-size:54px; }
.auth-copy { margin-top:12px; margin-bottom:25px; }
.auth-foot { display:none; }

.history-name span { text-transform:none; }
.select-wrap select { font-size:13px; }
.chart-card { background:rgba(13,15,20,.72); }
.chart-head strong { font-size:13px; }

@media (max-width: 720px) {
  .rest-panel { min-height:0; }
  .rest-inner { display:block; padding:28px 24px; }
  .rest-panel h2 { font-size:35px; margin-top:7px; }
  .rest-next { min-width:0; margin-top:26px; padding:20px 0 0; border-left:0; border-top:1px solid var(--line-soft); }
  .auth-card h1 { font-size:46px; }
}


/* ---------- v3.1 iPhone installed-web-app safe-area fix ---------- */
html,
body {
  min-height: 100%;
}

.app-body {
  min-height: 100dvh;
}

@media (max-width: 720px) {
  html.pwa-standalone,
  html.pwa-standalone body {
    min-height: 100dvh;
    height: auto;
    background: var(--bg);
  }

  html.pwa-standalone .desktop-header {
    height: calc(64px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  html.pwa-standalone .account-menu {
    top: calc(52px + env(safe-area-inset-top));
  }

  html.pwa-standalone .main-stage {
    padding-top: 31px;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
  }

  /* Keep the iPhone safe area inside the tab bar instead of lifting the
     whole bar upward and creating a dead strip beneath it. */
  html.pwa-standalone .mobile-nav {
    left: 10px;
    right: 10px;
    bottom: 0;
    height: calc(76px + env(safe-area-inset-bottom));
    padding: 5px 5px calc(5px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }

  html.pwa-standalone .save-toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
  }
}
