/* Shared, responsive training workspace. No external assets or fonts required. */
.template-tools { padding: 16px; margin-bottom: 22px; border: 1px solid var(--border); border-radius: 12px; }
.template-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.template-tools .status { margin: 12px 0 0; }
.template-save { margin-top: 16px; }
.field select { width: 100%; min-width: 0; min-height: 44px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--background); color: var(--text); font: inherit; font-size: 16px; }
.comparison-status { padding: 12px 0; margin: 8px 0; color: var(--muted); font-size: .875rem; }
.comparison-status:empty, .previous-set:empty, .previous-exercise:empty { display: none; }
.previous-set { grid-column: 1 / -1; color: var(--accent); font-size: .8125rem; overflow-wrap: anywhere; }
.previous-exercise { font-size: .8125rem; }
.recovery-shell { max-width: 520px; padding-block: 40px; }
.recovery-shell > .brand { margin-bottom: 24px; }
.recovery-shell h1 { font-size: 1.7rem; }
.recovery-shell .field > span, .recovery-shell .form-hint { font-size: .875rem; }
.recovery-links { margin: 24px 0 0; font-size: .875rem; }
/* Public sample dashboard and login invitation. */
.demo-invitation { margin-top: 28px; }
.demo-invitation p { font-size: .85rem; }
.demo-link { display: inline-flex; align-items: center; justify-content: center; gap: 12px; background: var(--accent); color: #19210c; padding: 12px 18px; border-radius: 12px; font-weight: 650; text-decoration: none; text-align: center; }
.demo-link:hover { background: var(--accent-hover); color: #19210c; }
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; }
.demo-banner > strong { color: var(--accent); white-space: nowrap; }
.demo-banner > span { flex: 1 1 240px; color: var(--muted); font-size: .85rem; }
.demo-banner p { color: var(--muted); }
#demo-date { max-width: 100%; }
#demo-history .history-meta { grid-column: 1; }
.exercise-heading h4 { margin: 0; font-size: .92rem; }

:root {
    color-scheme: dark;
    --background: #101311;
    --surface: #191d1a;
    --surface-light: #222823;
    --border: #353d36;
    --text: #f0f3eb;
    --muted: #a7b2a8;
    --accent: #d2f582;
    --accent-hover: #e1ffa5;
    --danger: #ffaaa1;
    --radius: 18px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; }
body { margin: 0; min-height: 100vh; background: var(--background); color: var(--text); font-family: "Segoe UI", system-ui, -apple-system, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button, a { touch-action: manipulation; }
button, input { min-height: 44px; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 10px; padding: 10px 18px; background: var(--accent); color: #19210c; font-weight: 650; transition: background 150ms ease, border-color 150ms ease; }
button:hover { background: var(--accent-hover); }
button:disabled { cursor: default; opacity: .5; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
input, textarea { min-width: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--background); color: var(--text); padding: 11px 12px; }
input::placeholder, textarea::placeholder { color: #859087; }
input:read-only { color: var(--muted); }
textarea { resize: vertical; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.035em; }
h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin-bottom: 12px; font-weight: 650; }
h2 { font-size: 1.25rem; margin-bottom: 0; font-weight: 600; }
h3 { font-size: 1rem; }
.accent, .brand-dot { color: var(--accent); }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 10; background: var(--accent); color: #101311; padding: 12px; }
.skip-link:focus { top: 12px; }
.topbar { display: flex; align-items: center; gap: 40px; min-height: 84px; padding: 16px max(24px, calc((100% - 1200px) / 2)); border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-size: 1.1rem; font-weight: 750; white-space: nowrap; letter-spacing: -.04em; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #19210c; font-size: .8rem; letter-spacing: -.06em; }
.brand-dot { margin-left: -9px; }
.main-nav { display: flex; gap: 6px; }
.main-nav a { padding: 10px 14px; text-decoration: none; border-radius: 8px; color: var(--muted); font-size: .88rem; }
.main-nav a:hover { background: var(--surface-light); color: var(--text); }
.user-menu { display: flex; align-items: center; gap: 14px; margin-left: auto; min-width: 0; }
.current-user { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .85rem; }
.header, main { width: min(100% - 48px, 1200px); margin-inline: auto; }
.header { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding-block: 42px 30px; }
.eyebrow { margin-bottom: 9px; font-size: .67rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.page-description { margin: 0; color: var(--muted); }
.date-control label { display: block; color: var(--muted); font-size: .75rem; margin-bottom: 7px; }
.date-row { display: flex; gap: 6px; }
.date-row input { width: 160px; font-size: .88rem; }
.text-button { min-height: 32px; padding: 6px 0; color: var(--accent); background: transparent; border: 0; font-size: .78rem; }
.text-button:hover { background: transparent; text-decoration: underline; }
section { min-width: 0; margin-bottom: 30px; scroll-margin-top: 20px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-actions { display: flex; align-items: center; gap: 16px; }
.weight { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.macro-card { min-width: 0; padding: 23px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.macro-card > span:first-child { font-size: .82rem; font-weight: 600; color: var(--muted); }
.macro-card strong { display: block; margin: 12px 0 2px; font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 600; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.macro-target { display: block; color: var(--muted); font-size: .75rem; }
.calories-card { background: var(--accent); color: #19210c; border-color: var(--accent); }
.calories-card > span:first-child, .calories-card .macro-target { color: #3d4c25; }
progress { display: block; width: 100%; height: 5px; margin-top: 22px; border: 0; border-radius: 10px; overflow: hidden; appearance: none; background: var(--border); }
progress::-webkit-progress-bar { background: var(--border); }
progress::-webkit-progress-value { background: var(--accent); border-radius: 10px; }
progress::-moz-progress-bar { background: var(--accent); }
.calories-card progress, .calories-card progress::-webkit-progress-bar { background: #abc76a; }
.calories-card progress::-webkit-progress-value { background: #33421b; }
.calories-card progress::-moz-progress-bar { background: #33421b; }
.notes { color: var(--muted); font-size: .83rem; margin: 12px 0 0; overflow-wrap: anywhere; }
.notes:empty { display: none; }
.weekly-section { padding-block: 24px; border-block: 1px solid var(--border); }
.weekly-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.summary-card { padding: 2px 20px; border-left: 1px solid var(--border); }
.summary-card:first-child { border: 0; padding-left: 0; }
.summary-card span { display: block; color: var(--muted); font-size: .73rem; }
.summary-card strong { display: block; margin-top: 6px; font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.section-caption { margin: 14px 0 0; color: var(--muted); font-size: .75rem; }
.dashboard-columns { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 32px; }
#workout-container { display: grid; gap: 16px; }
.workout-card { overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.workout-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.workout-title { margin: 0; font-size: 1.04rem; overflow-wrap: anywhere; }
.workout-note, .workout-empty { margin: 0; padding: 14px 22px; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.exercise { padding: 20px 22px; border-bottom: 1px solid var(--border); }
.exercise:last-child { border-bottom: 0; }
.exercise-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.exercise-heading h3 { margin: 0; font-size: .92rem; letter-spacing: -.015em; overflow-wrap: anywhere; }
.total-reps { color: var(--muted); font-size: .7rem; white-space: nowrap; }
.set-list { display: flex; flex-wrap: wrap; gap: 8px; }
.set { display: grid; gap: 3px; min-width: 92px; border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; font-size: .85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.set-label { color: var(--muted); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; }
.exercise-note { margin: 12px 0 0; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.history-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.history-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: transparent; color: var(--text); padding: 16px 20px; text-align: left; }
.history-row:last-child { border-bottom: 0; }
.history-row:hover { background: var(--surface-light); }
.history-row[aria-current="date"] { background: #252e20; box-shadow: inset 3px 0 var(--accent); }
.history-row:focus-visible { outline-offset: -4px; }
.history-date { grid-column: 1; font-size: .7rem; color: var(--muted); font-weight: 500; }
.history-details { grid-column: 1; display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.history-details strong { font-size: .85rem; font-weight: 600; }
.history-meta { color: var(--muted); font-size: .75rem; font-weight: 400; }
.history-arrow { grid-column: 2; grid-row: 1 / 3; color: var(--muted); font-size: 1.5rem; }
.status { color: var(--muted); font-size: .85rem; margin: 0 0 18px; }
.status:empty { display: none; }
.status.error { color: var(--danger); }
.status.success { color: var(--accent); }
.status.error, .status.success { padding: 12px 16px; border: 1px solid currentColor; border-radius: 10px; }
.empty-state { display: grid; justify-items: center; gap: 12px; min-height: 190px; align-content: center; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); padding: 28px; text-align: center; font-size: .85rem; }
.empty-state strong { color: var(--text); font-weight: 600; font-size: 1rem; }
.secondary-button { border: 1px solid var(--border); background: transparent; color: var(--text); }
.secondary-button:hover { background: var(--surface-light); border-color: #62705f; }
.compact-button { padding: 8px 12px; font-size: .78rem; }
.icon-button { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 1.4rem; }
.icon-button:hover { background: var(--surface-light); color: var(--text); }
dialog { width: min(100% - 32px, 560px); max-height: calc(100dvh - 40px); border: 1px solid var(--border); border-radius: 22px; background: var(--surface); color: var(--text); padding: 0; box-shadow: 0 24px 100px #0008; overscroll-behavior: contain; }
dialog.workout-form-dialog { width: min(100% - 32px, 720px); }
dialog::backdrop { background: #080d0bc9; backdrop-filter: blur(6px); }
body:has(dialog[open]) { overflow: hidden; }
dialog form { padding: 26px; }
.dialog-heading, .editor-section-heading, .exercise-editor-heading, .sets-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-heading { margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, .sets-heading > span { color: var(--muted); font-size: .78rem; }
.field input, .field textarea { width: 100%; font-size: 16px; }
.full-width { grid-column: 1 / -1; }
.rest-option { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; font-size: .85rem; }
.rest-option input { width: 20px; min-height: 20px; accent-color: var(--accent); }
.editor-section-heading { margin-block: 24px 14px; }
.editor-section-heading h3 { margin: 0; }
#exercise-editors { display: grid; gap: 16px; }
.exercise-editor { display: grid; gap: 16px; min-width: 0; margin: 0; border: 1px solid var(--border); border-radius: 14px; padding: 18px; background: var(--background); }
.exercise-editor-heading strong { color: var(--accent); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.set-editors { display: grid; gap: 10px; }
.set-editor { display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(0, 1fr) 44px; align-items: end; gap: 10px; }
.set-editor-number { align-self: end; display: grid; align-items: center; min-height: 46px; color: var(--muted); font-size: .72rem; font-weight: 500; }
.dialog-actions { position: sticky; bottom: -26px; display: flex; justify-content: end; gap: 10px; margin: 24px -26px -26px; padding: 18px 26px; border-top: 1px solid var(--border); background: var(--surface); }
dialog .status { margin-top: 16px; }
.auth-page { display: grid; align-items: center; }
.auth-shell { display: grid; grid-template-columns: 1fr 1.1fr; align-items: center; gap: 80px; max-width: 1060px; padding-block: 64px; }
.auth-heading .brand { margin-bottom: 72px; }
.auth-heading h1 { font-size: clamp(2.7rem, 5vw, 4.5rem); line-height: 1.07; letter-spacing: -.06em; max-width: 500px; margin-bottom: 24px; }
.auth-heading > p { max-width: 350px; color: var(--muted); line-height: 1.8; }
.auth-detail { display: flex; gap: 12px; align-items: baseline; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.auth-detail span:first-child { color: var(--accent); }
.auth-panel { border: 1px solid var(--border); border-radius: 22px; padding: 28px; background: var(--surface); }
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; margin-bottom: 28px; background: var(--background); border-radius: 12px; gap: 4px; }
.auth-switch button { background: transparent; color: var(--muted); font-size: .85rem; }
.auth-switch button[aria-pressed="true"] { background: var(--surface-light); color: var(--text); }
.auth-card { margin: 0; }
.auth-form { display: grid; gap: 18px; margin-top: 24px; }
.auth-form > button { width: 100%; }
.auth-form .status { margin-bottom: 0; }
.form-hint { font-size: .75rem; color: var(--muted); margin: 0; }
@media (max-width: 1050px) {
    .topbar { gap: 20px; }
    .current-user { max-width: 100px; }
    .weekly-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 0; }
    .summary-card:nth-child(4) { border-left: 0; padding-left: 0; }
    .auth-shell { gap: 36px; }
}
@media (max-width: 800px) {
    .topbar { flex-wrap: wrap; gap: 12px; padding: 16px 24px 8px; }
    .main-nav { order: 3; width: 100%; }
    .main-nav a { flex: 1; text-align: center; }
    .current-user { max-width: 140px; }
    .header { align-items: start; flex-direction: column; gap: 20px; padding-top: 30px; }
    .date-control { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
    .date-control label { width: 100%; margin: 0; }
    .macro-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-columns { grid-template-columns: 1fr; gap: 0; }
    .auth-shell { grid-template-columns: 1fr; max-width: 560px; gap: 28px; padding-block: 32px; }
    .auth-heading .brand { margin-bottom: 24px; }
    .auth-heading h1 { font-size: 2.5rem; }
    .auth-heading > p { margin-bottom: 0; max-width: none; }
    .auth-detail { display: none; }
}
@media (max-width: 520px) {
    .header, main { width: calc(100% - 32px); }
    .topbar { padding-inline: 16px; }
    .current-user { display: none; }
    .brand { font-size: 1rem; }
    .page-description { font-size: .85rem; }
    .date-row { width: 100%; }
    .date-row input { flex: 1; width: 120px; }
    .date-row > button:last-child { padding-inline: 14px; }
    .section-heading { flex-wrap: wrap; gap: 12px; }
    .section-actions { width: 100%; justify-content: space-between; }
    .macro-card { padding: 18px; }
    .macro-card strong { font-size: 1.8rem; }
    .weekly-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card:nth-child(n) { padding-inline: 16px; border-left: 1px solid var(--border); }
    .summary-card:nth-child(odd) { padding-left: 0; border: 0; }
    .workout-title-row, .exercise { padding-inline: 16px; }
    .total-reps { font-size: .65rem; }
    .set { min-width: 80px; padding-inline: 9px; }
    dialog, dialog.workout-form-dialog { width: calc(100% - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
    dialog form { padding: 18px; }
    .dialog-actions { bottom: -18px; margin-inline: -18px; margin-bottom: -18px; padding: 14px 18px; }
    .dialog-actions button { flex: 1; padding-inline: 10px; }
    .exercise-editor { padding: 12px; }
    .set-editor { grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 44px; gap: 6px; }
    .set-editor .field input { padding-inline: 7px; }
    .set-editor .field > span { font-size: .68rem; }
    .auth-panel { padding: 22px; }
    .auth-form .form-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
/* Progress panels share the dashboard's spacing and remain readable on phones. */
.progress-controls { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; margin-bottom: 16px; }
.progress-controls .field { flex: 1 1 180px; min-width: 0; }
.progress-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 16px; margin: 20px 0; }
.progress-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; background: var(--surface); color: var(--text); }
.progress-card > h3 { color: var(--text); }
.progress-card > p:last-child { color: var(--muted); margin-bottom: 0; }
.record-value { font-size: 1.8rem; font-weight: 700; color: var(--accent); margin: 12px 0; }
#account-dialog { max-width: 560px; }
#delete-account-form { display: grid; gap: 14px; margin: 24px 0; padding-top: 20px; border-top: 1px solid #dce4e1; }
#delete-account-button { color: #9b2525; border-color: #9b2525; }
.confirmation-dialog { max-width: 460px; }
.confirmation-dialog h2 { font-size: 1.35rem; line-height: 1.3; }
.confirmation-description { color: var(--muted); margin: 16px 0 24px; line-height: 1.6; }
.confirmation-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.confirmation-actions button { flex: 1 1 150px; }
