:root {
    --ink: #0a0b0d;
    --ink-soft: #17191c;
    --paper: #f3f4f2;
    --white: #ffffff;
    --muted: #697077;
    --muted-light: #a9afb4;
    --line: #d7dadd;
    --line-dark: #30343a;
    --red: #e21c25;
    --red-dark: #b9151c;
    --success: #176c45;
    --sidebar-width: 236px;
    --header-height: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ink); }
body { margin: 0; overflow-x: clip; color: var(--ink); background: var(--paper); font: 16px/1.5 Arial, "Helvetica Neue", sans-serif; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .portal-brand, .auth-brand { font-family: "Arial Narrow", "HelveticaNeue-CondensedBold", "Franklin Gothic Medium", Arial, sans-serif; text-transform: uppercase; }
h1 { margin-bottom: .55rem; font-size: clamp(2.25rem, 4.5vw, 4.5rem); line-height: .95; letter-spacing: -.045em; }
h2 { margin-bottom: .45rem; font-size: clamp(1.5rem, 2.6vw, 2.25rem); line-height: 1; }
h3 { margin-bottom: .5rem; font-size: 1.25rem; line-height: 1.1; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.skip-link { position: fixed; top: -100px; left: 24px; z-index: 100; padding: 12px 18px; color: white; background: var(--red); }
.skip-link:focus { top: 18px; }
.portal-header { position: fixed; inset: 0 0 auto; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: var(--header-height); padding: 0 32px; color: white; background: var(--ink); border-bottom: 1px solid var(--line-dark); }
.portal-brand, .auth-brand { display: inline-flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: -.025em; }
.portal-brand strong, .auth-brand strong { color: var(--red); }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; color: white; background: var(--red); font-size: .9rem; letter-spacing: -.05em; }
.header-account { display: flex; align-items: center; gap: 18px; font-size: .9rem; }
.header-account form { margin: 0; }
.link-button { padding: 0; color: var(--muted-light); background: none; border: 0; cursor: pointer; }
.link-button:hover { color: white; }
.mobile-nav { display: none; position: relative; }
.sidebar { position: fixed; inset: var(--header-height) auto 0 0; z-index: 10; display: flex; flex-direction: column; justify-content: space-between; width: var(--sidebar-width); padding: 34px 20px 24px; color: white; background: var(--ink); border-right: 1px solid var(--line-dark); }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a { display: flex; align-items: center; gap: 15px; padding: 13px 14px; color: var(--muted-light); border-left: 3px solid transparent; font-size: .92rem; font-weight: 700; }
.sidebar nav a span { color: #656b71; font-size: .7rem; letter-spacing: .08em; }
.sidebar nav a:hover, .sidebar nav a[aria-current="page"] { color: white; background: var(--ink-soft); border-left-color: var(--red); }
.sidebar-footer { display: grid; gap: 8px; padding: 16px 14px; color: var(--muted-light); font-size: .75rem; }
.sidebar-footer a { color: white; font-weight: 700; }
.portal-main { min-height: 100vh; margin-left: var(--sidebar-width); padding: calc(var(--header-height) + 54px) clamp(28px, 4vw, 70px) 72px; }
.portal-main > * { width: min(1460px, 100%); margin-inline: auto; }

.kicker { margin-bottom: 10px; color: var(--red); font-size: .76rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 42px; }
.page-heading > div:first-child { max-width: 780px; }
.page-heading p:last-child { margin-bottom: 0; color: var(--muted); }
.compact-heading { align-items: center; }
.heading-actions, .form-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 11px 18px; border: 1px solid transparent; border-radius: 0; font-weight: 800; line-height: 1.15; cursor: pointer; }
.button-primary { color: white; background: var(--red); border-color: var(--red); }
.button-primary:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button-secondary { color: var(--ink); background: transparent; border-color: #a8adb1; }
.button-secondary:hover { background: white; border-color: var(--ink); }
.button-dark { color: white; background: var(--ink); border-color: var(--ink); }
.button-dark:hover { background: var(--red); border-color: var(--red); }
.button-wide { width: 100%; }
.text-link, .small-link { color: var(--red); font-weight: 800; }
.text-link { display: inline-flex; gap: 12px; margin-top: 20px; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, 350px); gap: 30px; align-items: start; }
.coach-grid { grid-template-columns: minmax(0, 1.2fr) minmax(280px, .55fr); }
.dashboard-main, .dashboard-rail { min-width: 0; }
.dashboard-rail { display: grid; gap: 20px; }
.section-title { display: flex; justify-content: space-between; align-items: end; margin-bottom: 20px; }
.section-title h2, .section-title p { margin-bottom: 0; }
.section-spaced { margin-top: 46px; }
.panel, .rail-panel, .metric-panel, .plan-card, .exercise-card { background: white; border: 1px solid var(--line); }
.plan-card { margin-bottom: 22px; }
.plan-card > header { display: flex; justify-content: space-between; gap: 24px; padding: 26px 28px; color: white; background: var(--ink); border-bottom: 3px solid var(--red); }
.plan-card header h3 { margin: 8px 0 0; font-size: 1.55rem; }
.date-range, .subtle-meta { color: var(--muted-light); font-size: .82rem; }
.status-badge { display: inline-flex; width: max-content; padding: 4px 8px; color: white; background: var(--success); font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.status-muted { color: #4f555a; background: #e3e5e6; }
.plan-goal { margin: 0; padding: 20px 28px; color: #4f555a; border-bottom: 1px solid var(--line); }
.workout-list { display: grid; }
.workout-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 20px 28px; border-bottom: 1px solid var(--line); }
.workout-row:last-child { border-bottom: 0; }
.workout-index { color: var(--red); font-weight: 800; }
.workout-name { display: grid; min-width: 0; }
.workout-name span { color: var(--muted); font-size: .85rem; }
.empty-state { display: grid; gap: 5px; color: var(--muted); }
.empty-state strong { color: var(--ink); }
.empty-large { place-items: center; min-height: 150px; padding: 28px; text-align: center; background: white; border: 1px dashed #b9bec1; }
.activity-list { display: grid; background: white; border: 1px solid var(--line); }
.activity-list a { display: grid; grid-template-columns: 56px 1fr auto; gap: 18px; align-items: center; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.activity-list a:last-child { border-bottom: 0; }
.activity-list a > span:nth-child(2), .compact-activity span { display: grid; }
.activity-list small, .compact-activity small, .client-name small { color: var(--muted); }
.activity-date { color: var(--red); font-weight: 800; }
.metric-panel, .rail-panel { padding: 25px; }
.calorie-total { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 22px; }
.calorie-total strong { font: 800 3.2rem/1 "Arial Narrow", Arial, sans-serif; }
.calorie-total span { color: var(--muted); }
.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.macro-grid div { display: grid; padding: 12px; background: var(--paper); }
.macro-grid span { color: var(--muted); font-size: .72rem; }
.rail-panel-heading { display: flex; justify-content: space-between; gap: 18px; }
.rail-panel h3 { margin-top: 18px; }
.rail-panel > p:last-of-type { color: var(--muted); }
.rail-dark { color: white; background: var(--ink); border-color: var(--ink); }
.rail-dark .kicker { color: #ff535a; }
.rail-dark > p:last-of-type, .rail-dark .target-list span { color: var(--muted-light); }
.measurement-highlight { display: flex; align-items: baseline; gap: 7px; }
.measurement-highlight strong { font: 800 3rem/1 "Arial Narrow", Arial, sans-serif; }
.measurement-highlight span { color: var(--muted); }

.summary-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 30px; color: white; background: var(--ink); border-bottom: 3px solid var(--red); }
.summary-strip > div { display: grid; padding: 24px 28px; border-right: 1px solid var(--line-dark); }
.summary-strip > div:last-child { border-right: 0; }
.summary-strip strong { font: 800 2.3rem/1 "Arial Narrow", Arial, sans-serif; }
.summary-strip span { margin-top: 5px; color: var(--muted-light); font-size: .78rem; text-transform: uppercase; }
.dashboard-main.panel { padding: 28px; }
.client-list { display: grid; }
.client-row { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 17px 0; border-top: 1px solid var(--line); }
.client-row:hover .client-name strong { color: var(--red); }
.avatar { display: grid; place-items: center; width: 48px; height: 48px; color: white; background: var(--ink); font-weight: 800; text-transform: uppercase; }
.avatar-large { width: 78px; height: 78px; font-size: 1.35rem; }
.client-name { display: grid; min-width: 0; }
.assignment-state { color: var(--muted); font-size: .76rem; text-transform: uppercase; }
.compact-activity { display: grid; }
.compact-activity a { display: flex; justify-content: space-between; gap: 18px; padding: 13px 0; border-top: 1px solid var(--line); }
.compact-activity time { color: var(--red); font-weight: 800; }

.client-heading { align-items: center; }
.client-identity { display: flex; align-items: center; gap: 20px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(290px, 380px); gap: 30px; align-items: start; }
.detail-side { display: grid; gap: 20px; }
.detail-card { margin-bottom: 14px; background: white; border: 1px solid var(--line); }
.detail-card > summary { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 20px 22px; cursor: pointer; list-style-position: outside; }
.detail-card > summary > span:first-of-type { display: grid; }
.detail-card > summary small { color: var(--muted); }
.detail-card-body { padding: 0 22px 22px; border-top: 1px solid var(--line); }
.detail-card-body > p { margin: 18px 0; color: var(--muted); }
.coach-workout { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.coach-workout > div:first-child { display: grid; }
.coach-workout > div:first-child span { color: var(--muted); font-size: .82rem; }
.coach-workout > ul { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; }
.coach-workout > ul > li { display: flex; justify-content: space-between; gap: 20px; padding: 7px 0; }
.coach-exercise-prescription { display: grid !important; gap: 10px; padding: 14px 0 !important; border-top: 1px solid var(--line); }
.coach-exercise-prescription > div { display: flex; justify-content: space-between; gap: 20px; }
.coach-exercise-prescription > div > span { display: grid; }
.coach-exercise-prescription > div small { color: var(--muted); font-weight: 400; }
.coach-exercise-prescription ol { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.coach-exercise-prescription ol li { display: grid; grid-template-columns: 24px 1fr; gap: 7px; color: var(--muted); font-size: .82rem; }
.coach-exercise-prescription p { margin: 0; color: var(--muted); font-size: .85rem; }
.muted-row { color: var(--muted); }
.coach-macros { grid-template-columns: repeat(4, 1fr); margin-top: 18px; }
.diet-meal { padding: 12px 0; border-top: 1px solid var(--line); }
.diet-meal p { margin: 4px 0 0; color: var(--muted); }
.measurement-list > div { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.measurement-list span { grid-column: 1 / -1; color: var(--muted); font-size: .82rem; }
.photo-grid, .progress-photo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.photo-grid a, .progress-photo-grid a { position: relative; overflow: hidden; background: var(--ink); }
.photo-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.photo-grid a span { position: absolute; inset: auto 0 0; padding: 30px 8px 8px; color: white; background: linear-gradient(transparent, rgba(0,0,0,.78)); font-size: .68rem; }

.form-panel { max-width: 900px; padding: clamp(24px, 4vw, 44px); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.stack-form { display: grid; gap: 20px; }
.form-full { grid-column: 1 / -1; }
.field { display: grid; align-content: start; gap: 7px; min-width: 0; }
.field > label { font-size: .86rem; font-weight: 800; }
.form-control, .set-row input, .actual-set-fields input { width: 100%; min-height: 48px; padding: 11px 12px; color: var(--ink); background: white; border: 1px solid #aeb3b6; border-radius: 0; }
.auth-card input[type="text"], .auth-card input[type="password"], .auth-card input[type="email"] { width: 100%; min-height: 48px; padding: 11px 12px; color: var(--ink); background: white; border: 1px solid #aeb3b6; border-radius: 0; }
textarea.form-control { min-height: 112px; resize: vertical; }
.form-control:focus, .set-row input:focus, .actual-set-fields input:focus { border-color: var(--red); outline: 2px solid rgba(226,28,37,.18); }
.form-check { width: 20px; height: 20px; accent-color: var(--red); }
.checkbox-label { display: flex; align-items: center; gap: 10px; }
.help-text { color: var(--muted); font-size: .78rem; }
.help-text ul { margin: 5px 0 0; padding-left: 18px; }
.errorlist { margin: 0; padding-left: 18px; color: var(--red-dark); font-size: .82rem; }
.form-errors { padding: 14px 16px; color: #8a1118; background: #ffe8e9; border-left: 4px solid var(--red); }
.form-errors .errorlist { margin: 0; }
.message-stack { display: grid; gap: 10px; margin-bottom: 24px; }
.message { padding: 14px 18px; background: white; border-left: 4px solid #55717f; }
.message-success { color: #0e5034; background: #e8f7ef; border-left-color: var(--success); }
.message-error { color: #841219; background: #ffe8e9; border-left-color: var(--red); }
.message-error ul { margin-bottom: 0; }

.session-builder-summary { display: grid; grid-template-columns: minmax(190px, .35fr) 1fr; gap: 28px; align-items: start; margin-bottom: 24px; padding: 24px; }
.session-builder-summary h2 { margin-bottom: 0; }
.builder-hint { max-width: 28ch; margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.builder-exercise-list { display: grid; }
.builder-exercise-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.builder-position { display: grid; width: 34px; height: 34px; place-items: center; color: white; background: var(--ink); font-size: .74rem; font-weight: 900; }
.builder-exercise-link { display: flex; justify-content: space-between; gap: 20px; min-width: 0; padding: 6px 0; }
.builder-exercise-link > span { display: grid; min-width: 0; }
.builder-exercise-list small { color: var(--muted); }
.exercise-order-controls { display: flex; gap: 6px; }
.exercise-order-controls form { margin: 0; }
.exercise-order-controls button { display: inline-flex; gap: 6px; align-items: center; min-height: 40px; padding: 0 11px; color: var(--ink); background: white; border: 1px solid var(--line); font: inherit; font-size: .74rem; font-weight: 800; cursor: pointer; }
.exercise-order-controls button:hover:not(:disabled), .exercise-order-controls button:focus-visible { color: white; background: var(--ink); border-color: var(--ink); }
.exercise-order-controls button:disabled { opacity: .28; cursor: not-allowed; }
.exercise-builder-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 24px; align-items: start; }
.library-panel { padding: clamp(24px, 3vw, 36px); }
.library-search { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, .55fr) auto; gap: 14px; align-items: end; margin-bottom: 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.library-results { display: grid; gap: 12px; }
.library-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 20px; background: var(--paper); border-left: 3px solid var(--ink); }
.library-item h3 { margin: 4px 0 8px; }
.library-item p { margin-bottom: 8px; color: var(--muted); }
.exercise-category { color: var(--red); font-size: .68rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.library-add-form { display: grid; grid-template-columns: 86px auto; gap: 7px 10px; align-items: end; }
.library-add-form label { grid-column: 1 / -1; font-size: .74rem; font-weight: 800; }
.library-add-form .form-control { min-height: 46px; }
.new-library-exercise { max-width: none; }
.set-count-panel { display: flex; justify-content: space-between; gap: 24px; align-items: center; margin-bottom: 24px; padding: 20px 24px; }
.set-count-panel > div { display: grid; }
.set-count-panel span { color: var(--muted); font-size: .82rem; }
.set-count-form { display: grid; grid-template-columns: 100px auto; gap: 10px; }
.exercise-details-panel { max-width: none; margin-bottom: 24px; }
.prescription-set-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.prescription-set-card { overflow: hidden; }
.prescription-set-card > header { display: flex; gap: 16px; align-items: center; padding: 18px 20px; color: white; background: var(--ink); border-bottom: 3px solid var(--red); }
.prescription-set-card header .kicker, .prescription-set-card header h2 { margin: 0; }
.prescription-set-card header h2 { font-size: 1.4rem; }
.prescription-set-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.button-on-dark { color: white; border-color: #777d83; }

.workout-heading { align-items: center; }
.coach-callout { max-width: 920px; margin: 16px 0 0; padding: 14px 16px; color: var(--ink) !important; background: #fff; border-left: 4px solid var(--red); }
.session-meta { display: grid; grid-template-columns: minmax(180px, .35fr) minmax(0, 1fr); gap: 22px; margin-bottom: 22px; padding: 20px; }
.exercise-card { margin-bottom: 22px; overflow: hidden; }
.exercise-card > header, .session-exercise > header { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 22px 24px; color: white; background: var(--ink); border-bottom: 3px solid var(--red); }
.exercise-card header h2, .exercise-card header p, .session-exercise header h2, .session-exercise header p { margin-bottom: 0; }
.exercise-card header p, .session-exercise header p { color: var(--muted-light); font-size: .85rem; }
.exercise-number { display: grid; place-items: center; width: 44px; height: 44px; color: white; background: var(--red); font-weight: 800; }
.prescription-tags { display: flex; gap: 8px; }
.prescription-tags > span { display: grid; min-width: 72px; padding: 7px 10px; background: var(--ink-soft); text-align: center; }
.prescription-tags small { color: var(--muted-light); font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; }
.technique-note { display: grid; grid-template-columns: 90px 1fr; gap: 15px; padding: 16px 24px; background: #fff7e6; border-bottom: 1px solid #edd8af; }
.technique-note p { margin: 0; }
.technique-note > div { display: grid; gap: 8px; }
.sets-header, .set-row { display: grid; grid-template-columns: 70px 1fr 1fr .7fr 1.6fr; gap: 12px; align-items: center; }
.sets-header { padding: 12px 24px; color: var(--muted); background: #eff0ee; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.set-row { padding: 12px 24px; border-top: 1px solid var(--line); }
.set-row:first-child { border-top: 0; }
.set-row label span, .set-number span { display: none; }
.set-number { color: var(--red); }
.set-row input { min-height: 42px; }
.prescribed-sets-list { display: grid; }
.prescribed-set-row { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); border-top: 1px solid var(--line); }
.prescription-brief { display: grid; gap: 13px; padding: 20px 24px; background: #eff0ee; }
.prescription-title { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: center; }
.set-type-badge { padding: 4px 8px; color: white; background: var(--ink); font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.prescription-targets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.prescription-targets div { display: grid; padding: 8px; background: white; }
.prescription-targets dt { color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.prescription-targets dd { margin: 0; font-weight: 800; }
.set-coach-note { margin: 0; color: #4e555b; font-size: .84rem; }
.actual-set-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-content: center; padding: 20px 24px; }
.actual-set-fields label { display: grid; gap: 5px; min-width: 0; }
.actual-set-fields label span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.actual-set-fields .actual-note { grid-column: 1 / -1; }
.sticky-save { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 18px; color: white; background: var(--ink); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.sticky-save span { color: var(--muted-light); }
.session-summary { display: grid; gap: 18px; }
.session-exercise { overflow: hidden; }
.session-exercise > header { grid-template-columns: 48px 1fr; }
.result-list > div { display: grid; grid-template-columns: 100px 1fr 1fr; gap: 20px; padding: 15px 24px; border-top: 1px solid var(--line); }
.result-list > div > span:last-child { color: var(--muted); }
.session-result-row > span { display: grid; }
.session-result-row small { color: var(--muted); font-size: .76rem; }

.nutrition-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(285px, 350px); gap: 30px; align-items: start; }
.macro-summary { grid-template-columns: repeat(4, 1fr); }
.date-filter { display: grid; grid-template-columns: auto minmax(180px, 280px) auto; gap: 14px; align-items: center; margin-bottom: 22px; padding: 14px 18px; }
.date-filter label { font-weight: 800; }
.food-list { display: grid; }
.food-row, .compact-food-list > div { display: flex; justify-content: space-between; gap: 24px; padding: 16px 0; border-top: 1px solid var(--line); }
.food-row > span, .compact-food-list > div > span { display: grid; }
.food-row small, .compact-food-list small { color: var(--muted); }
.food-macros { display: flex; flex-wrap: wrap; justify-content: end; gap: 8px; }
.food-macros span { padding: 5px 8px; background: var(--paper); font-size: .75rem; font-weight: 700; }
.target-list { display: grid; margin: 20px 0; }
.target-list div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; border-top: 1px solid var(--line-dark); }
.meal-detail { border-top: 1px solid var(--line); }
.meal-detail summary { padding: 14px 0; font-weight: 800; cursor: pointer; }
.meal-detail p { color: var(--muted); }
.meal-detail > span { display: block; margin-bottom: 16px; color: var(--red); font-size: .78rem; font-weight: 800; }

.progress-layout { display: grid; gap: 24px; }
.progress-layout > .panel { padding: 28px; }
.measurement-table-wrap { max-width: 100%; }
.measurement-table { width: 100%; border-collapse: collapse; }
.measurement-table th, .measurement-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.measurement-table th:first-child, .measurement-table td:first-child { text-align: left; }
.measurement-table th { color: var(--muted); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; }
.progress-photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.progress-photo-grid img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.progress-photo-grid a span { display: flex; justify-content: space-between; gap: 8px; padding: 10px; color: white; background: var(--ink); font-size: .75rem; }

.auth-body { min-height: 100vh; color: white; background: var(--ink); }
.auth-main { min-height: 100vh; }
.auth-shell { display: grid; align-content: center; min-height: 100vh; width: min(520px, calc(100% - 32px)); margin: auto; padding: 42px 0; }
.auth-shell-wide { width: min(700px, calc(100% - 32px)); }
.auth-brand { margin: 0 auto 22px; }
.auth-card { padding: clamp(28px, 6vw, 52px); color: var(--ink); background: var(--paper); border-top: 4px solid var(--red); }
.auth-card h1 { font-size: clamp(2.6rem, 8vw, 4.3rem); }
.auth-intro { margin-bottom: 28px; color: var(--muted); }
.auth-alternate { margin: 24px 0 0; color: var(--muted); text-align: center; }
.auth-alternate a { color: var(--red); font-weight: 800; }

@media (max-width: 1060px) {
    .dashboard-grid, .coach-grid, .detail-grid, .nutrition-layout, .exercise-builder-grid { grid-template-columns: 1fr; }
    .dashboard-rail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-rail > :last-child:nth-child(odd) { grid-column: 1 / -1; }
    .detail-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-side > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    :root { --header-height: 66px; }
    .portal-header { padding: 0 18px; }
    .portal-brand > span:last-child, .header-account { display: none; }
    .mobile-nav { display: block; }
    .mobile-nav summary { min-height: 42px; padding: 10px 14px; border: 1px solid var(--line-dark); cursor: pointer; font-weight: 800; list-style: none; }
    .mobile-nav summary::-webkit-details-marker { display: none; }
    .mobile-nav[open] nav { position: absolute; top: 48px; right: 0; display: grid; min-width: 210px; padding: 8px; color: white; background: var(--ink); border: 1px solid var(--line-dark); box-shadow: 0 16px 30px rgba(0,0,0,.3); }
    .mobile-nav nav a { padding: 12px 14px; border-bottom: 1px solid var(--line-dark); }
    .sidebar { display: none; }
    .portal-main { margin-left: 0; padding: calc(var(--header-height) + 34px) 16px 52px; }
    .page-heading, .client-heading { display: grid; gap: 22px; margin-bottom: 30px; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1 1 180px; }
    .summary-strip { grid-template-columns: 1fr 1fr; }
    .summary-strip > div { padding: 18px; }
    .summary-strip > div:nth-child(2) { border-right: 0; }
    .summary-strip > div:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line-dark); }
    .dashboard-rail, .detail-side { grid-template-columns: 1fr; }
    .dashboard-rail > :last-child:nth-child(odd), .detail-side > :last-child:nth-child(odd) { grid-column: auto; }
    .workout-row { grid-template-columns: 34px minmax(0, 1fr); padding: 18px; }
    .workout-row .button { grid-column: 1 / -1; }
    .plan-card > header { padding: 22px 18px; }
    .plan-goal { padding-inline: 18px; }
    .client-row { grid-template-columns: 46px minmax(0, 1fr) auto; }
    .assignment-state { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-full { grid-column: auto; }
    .session-meta { grid-template-columns: 1fr; }
    .exercise-card > header { grid-template-columns: 44px minmax(0, 1fr); padding: 18px; }
    .prescription-tags { grid-column: 1 / -1; }
    .technique-note { grid-template-columns: 1fr; padding: 16px 18px; }
    .sets-header { display: none; }
    .set-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 18px; }
    .set-row label { display: grid; gap: 5px; }
    .set-row label span, .set-number span { display: inline; color: var(--muted); font-size: .72rem; font-weight: 700; }
    .set-number { grid-column: 1 / -1; }
    .set-row label:last-child { grid-column: 1 / -1; }
    .sticky-save { bottom: 8px; }
    .sticky-save > span { display: none; }
    .sticky-save .button { width: 100%; }
    .result-list > div { grid-template-columns: 70px 1fr; }
    .result-list > div > span:last-child { grid-column: 1 / -1; }
    .macro-summary { grid-template-columns: repeat(2, 1fr); }
    .date-filter { grid-template-columns: 1fr; }
    .food-row { display: grid; }
    .food-macros { justify-content: start; }
    .progress-photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .measurement-table, .measurement-table tbody, .measurement-table tr, .measurement-table td { display: block; width: 100%; }
    .measurement-table thead { display: none; }
    .measurement-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 10px 0; border-bottom: 1px solid var(--line); }
    .measurement-table td { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 7px 10px; border: 0; text-align: right; white-space: normal; }
    .measurement-table td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
    .measurement-table td[colspan] { grid-column: 1 / -1; text-align: left; }
    .measurement-table td[colspan]::before { display: none; }
    .client-identity { align-items: start; }
    .avatar-large { width: 58px; height: 58px; flex: 0 0 auto; }
    .coach-macros { grid-template-columns: repeat(2, 1fr); }
    .session-builder-summary, .library-item, .prescribed-set-row { grid-template-columns: 1fr; }
    .library-search { grid-template-columns: 1fr 1fr; }
    .library-search .button { grid-column: 1 / -1; }
    .library-add-form { grid-template-columns: minmax(90px, .35fr) minmax(0, 1fr); }
    .prescription-set-list { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .portal-main { padding-inline: 12px; }
    .page-heading h1 { font-size: 2.45rem; }
    .form-panel, .dashboard-main.panel, .metric-panel, .rail-panel, .progress-layout > .panel { padding: 20px 16px; }
    .photo-grid, .progress-photo-grid { grid-template-columns: 1fr 1fr; }
    .set-row { grid-template-columns: 1fr; }
    .set-row label:last-child, .set-number { grid-column: auto; }
    .client-identity { display: grid; }
    .library-search, .actual-set-fields, .prescription-set-fields { grid-template-columns: 1fr; }
    .library-search .button, .actual-set-fields .actual-note, .prescription-set-fields .form-full { grid-column: auto; }
    .set-count-panel { display: grid; }
    .set-count-form { grid-template-columns: 1fr; }
    .builder-exercise-row { grid-template-columns: 36px minmax(0, 1fr); }
    .builder-exercise-link { display: grid; gap: 2px; }
    .exercise-order-controls { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
