/* Shared layout for every screen. No viewport-scaled fonts or tab-specific shell rules. */
:root {
  color-scheme: dark;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  --accent: #58f9a6;
  --accent-hi: #93ffcb;
  --accent-lo: #42f69a;
  --accent-ink: #002011;
  --plan-accent: var(--accent);
  --muted: #a9bec3;
  --plan-muted: var(--muted);
  --text: #f7faf8;
  --background: #03170e;
  --border: #315d456e;
  --surface: linear-gradient(130deg, #17372acc, #071d14ee);
  --glow-1: #0c3520aa;
  --glow-2: #0b291baa;
  --orbit-line: #5be39255;
  --nav-bg: linear-gradient(130deg, #123524f5, #051b12fa);
  --nav-border: #294f3a77;
  --nav-active: linear-gradient(160deg, #99ffcc, #41f899);
  --btn-primary: linear-gradient(160deg, #93ffcb, #42f69a);
  --progress-fill: linear-gradient(90deg, #1cf781, #31ed91);
  --progress-track: #203b2e;
  --dialog-bg: linear-gradient(140deg, #163426, #091c14 65%);
  --ring-track: #1b4934;
  --theme-color: #03190f;
  --icon-surface: linear-gradient(130deg, #224d3899, #102c1f99);
  --time-bg: linear-gradient(140deg, #285941b3, #173c2bad);
  --time-border: #427d5b99;
  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-left: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --safe-right: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --inset-top: calc(var(--safe-top) + var(--tg-content-safe-area-inset-top, 0px));
  --inset-bottom: calc(var(--safe-bottom) + var(--tg-content-safe-area-inset-bottom, 0px));
  --gutter: 16px;
  --nav-height: 68px;
}
html[data-theme="green"] {
  --accent: #58f9a6;
  --accent-hi: #93ffcb;
  --accent-lo: #42f69a;
  --accent-ink: #002011;
  --text: #f7faf8;
  --muted: #a9bec3;
  --background: #03170e;
  --border: #315d456e;
  --surface: linear-gradient(130deg, #17372acc, #071d14ee);
  --glow-1: #0c3520aa;
  --glow-2: #0b291baa;
  --orbit-line: #5be39255;
  --nav-bg: linear-gradient(130deg, #123524f5, #051b12fa);
  --nav-border: #294f3a77;
  --nav-active: linear-gradient(160deg, #99ffcc, #41f899);
  --btn-primary: linear-gradient(160deg, #93ffcb, #42f69a);
  --progress-fill: linear-gradient(90deg, #1cf781, #31ed91);
  --progress-track: #203b2e;
  --dialog-bg: linear-gradient(140deg, #163426, #091c14 65%);
  --ring-track: #1b4934;
  --theme-color: #03190f;
  --icon-surface: linear-gradient(130deg, #224d3899, #102c1f99);
  --time-bg: linear-gradient(140deg, #285941b3, #173c2bad);
  --time-border: #427d5b99;
}
html[data-theme="purple"] {
  --accent: #d8b4fe;
  --accent-hi: #f3e8ff;
  --accent-lo: #a855f7;
  --accent-ink: #1a0828;
  --text: #f7faf8;
  --muted: #c4b5d4;
  --background: #10081c;
  --border: #6b4a8a6e;
  --surface: linear-gradient(130deg, #2a1840cc, #12081eee);
  --glow-1: #3b1d66aa;
  --glow-2: #24123faa;
  --orbit-line: #c084fc55;
  --nav-bg: linear-gradient(130deg, #2a1848f5, #12081cfa);
  --nav-border: #5b3d7a77;
  --nav-active: linear-gradient(160deg, #e9d5ff, #a855f7);
  --btn-primary: linear-gradient(160deg, #e9d5ff, #a855f7);
  --progress-fill: linear-gradient(90deg, #c084fc, #a855f7);
  --progress-track: #2a1a40;
  --dialog-bg: linear-gradient(140deg, #2a1840, #12081c 65%);
  --ring-track: #3d2460;
  --theme-color: #10081c;
  --icon-surface: linear-gradient(130deg, #3b246099, #1a0f2e99);
  --time-bg: linear-gradient(140deg, #4a2d78b3, #241248ad);
  --time-border: #7c5aa699;
}
html[data-theme="red"] {
  --accent: #ff8a8a;
  --accent-hi: #ffc9c9;
  --accent-lo: #f04343;
  --accent-ink: #2a0606;
  --text: #faf5f5;
  --muted: #d4b5b5;
  --background: #1a0808;
  --border: #8a4a4a6e;
  --surface: linear-gradient(130deg, #401818cc, #1e0808ee);
  --glow-1: #661d1daa;
  --glow-2: #3f1212aa;
  --orbit-line: #fc848455;
  --nav-bg: linear-gradient(130deg, #481818f5, #1c0808fa);
  --nav-border: #7a3d3d77;
  --nav-active: linear-gradient(160deg, #ffd5d5, #f04343);
  --btn-primary: linear-gradient(160deg, #ffd5d5, #f04343);
  --progress-fill: linear-gradient(90deg, #fc8484, #f04343);
  --progress-track: #401a1a;
  --dialog-bg: linear-gradient(140deg, #401818, #1c0808 65%);
  --ring-track: #602424;
  --theme-color: #1a0808;
  --icon-surface: linear-gradient(130deg, #60242499, #2e0f0f99);
  --time-bg: linear-gradient(140deg, #782d2db3, #481212ad);
  --time-border: #a65a5a99;
}
html[data-theme="yellow"] {
  --accent: #f5d76e;
  --accent-hi: #ffe9a8;
  --accent-lo: #e0b12a;
  --accent-ink: #241800;
  --text: #faf8f2;
  --muted: #d4cbb5;
  --background: #141008;
  --border: #8a7a4a6e;
  --surface: linear-gradient(130deg, #3a3018cc, #1a1408ee);
  --glow-1: #66551daa;
  --glow-2: #3f3012aa;
  --orbit-line: #f5d76e55;
  --nav-bg: linear-gradient(130deg, #483818f5, #1c1408fa);
  --nav-border: #7a6a3d77;
  --nav-active: linear-gradient(160deg, #ffe9a8, #e0b12a);
  --btn-primary: linear-gradient(160deg, #ffe9a8, #e0b12a);
  --progress-fill: linear-gradient(90deg, #f5d76e, #e0b12a);
  --progress-track: #3a3018;
  --dialog-bg: linear-gradient(140deg, #3a3018, #1c1408 65%);
  --ring-track: #5a4820;
  --theme-color: #141008;
  --icon-surface: linear-gradient(130deg, #5a482099, #2e241099);
  --time-bg: linear-gradient(140deg, #78682db3, #483012ad);
  --time-border: #a68a5a99;
}
html[data-theme="light"] {
  color-scheme: light;
  --accent: #1a9f5c;
  --accent-hi: #2fd47a;
  --accent-lo: #128a4c;
  --accent-ink: #ffffff;
  --text: #14201a;
  --muted: #5a6b63;
  --background: #f4f6f8;
  --border: #c5d0c96e;
  --surface: linear-gradient(130deg, #ffffffee, #eef2f0cc);
  --glow-1: #c8e8d6aa;
  --glow-2: #dce8e2aa;
  --orbit-line: #1a9f5c33;
  --nav-bg: linear-gradient(130deg, #fffffff5, #eef2f0fa);
  --nav-border: #c5d0c977;
  --nav-active: linear-gradient(160deg, #2fd47a, #1a9f5c);
  --btn-primary: linear-gradient(160deg, #2fd47a, #1a9f5c);
  --progress-fill: linear-gradient(90deg, #2fd47a, #1a9f5c);
  --progress-track: #d8e4de;
  --dialog-bg: linear-gradient(140deg, #ffffff, #eef2f0 65%);
  --ring-track: #c5d8cc;
  --theme-color: #f4f6f8;
  --icon-surface: linear-gradient(130deg, #e8f5ee, #dceae3);
  --time-bg: linear-gradient(140deg, #dff3e8, #cfe8da);
  --time-border: #8bc4a499;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--background); color: var(--text); }
body { margin: 0; color: var(--text); background: var(--background); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
button { border: 0; padding: 0; background: transparent; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
button:not(:disabled):active { filter: brightness(1.12); }
svg { display: block; width: 24px; height: 24px; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3, strong { overflow-wrap: anywhere; }
h1, h2 { font-size: 20px; font-weight: 700; line-height: 1.3; letter-spacing: -.3px; }
h3 { font-size: 17px; line-height: 1.35; }

/* A normal document flow lets cards grow without shrinking or clipping their children. */
.diary {
  position: relative; isolation: isolate; width: 100%; max-width: 600px; margin: 0 auto;
  min-height: 100vh; min-height: var(--tg-viewport-stable-height, 100dvh);
  padding: calc(12px + var(--inset-top)) calc(var(--gutter) + var(--safe-right))
    calc(var(--nav-height) + 34px + var(--inset-bottom)) calc(var(--gutter) + var(--safe-left));
  background: radial-gradient(ellipse at 76% 7%, var(--glow-1), transparent 26%), radial-gradient(ellipse at 28% 50%, var(--glow-2), transparent 46%), var(--background);
}
.orbit { position: absolute; z-index: -1; inset: 0; overflow: hidden; pointer-events: none; }
.orbit::after { content: ''; position: absolute; width: 430px; height: 560px; left: 65%; top: -20px; border-radius: 50%; transform: rotate(28deg); border: 1px solid var(--orbit-line); box-shadow: inset 10px 4px 30px color-mix(in srgb, var(--accent) 13%, transparent); mask-image: linear-gradient(#000, transparent 40%); }
.diary > header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 10px; min-height: 44px; margin-bottom: 20px; }
.diary > header h1 { font-size: 20px; text-align: center; }
.round { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid color-mix(in srgb, var(--accent) 19%, transparent); border-radius: 50%; background: color-mix(in srgb, var(--accent) 8%, #111); }
.round svg { width: 19px; height: 19px; }
.card, .plan-card { min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: inset 0 1px 0 #c4ffda07, 0 12px 25px #00000015; }
.next { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 6px 10px; }
.next-icon { align-self: center; color: var(--accent); }
.next-icon svg { width: 20px; height: 20px; }
.eyebrow { font-size: 11px; line-height: 1.4; letter-spacing: .8px; color: var(--muted); }
.next .eyebrow { align-self: center; }
.date { grid-column: 2; font-size: 30px; line-height: 1.2; letter-spacing: -.6px; margin-top: 4px; }
.muscles { grid-column: 2; font-size: 15px; overflow-wrap: anywhere; }
.time { grid-column: 2; justify-self: start; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 15px; margin-top: 4px; border: 1px solid var(--time-border); border-radius: 18px; background: var(--time-bg); font-size: 16px; }
.time svg { width: 20px; height: 20px; color: var(--accent); }
.workout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 14px; }
.workout-head { display: flex; align-items: center; gap: 14px; min-width: 0; }
.workout-head > div:last-child { min-width: 0; }
.weight-icon { display: grid; place-items: center; flex: 0 0 56px; height: 56px; border: 1px solid var(--border); border-radius: 17px; background: var(--icon-surface); color: var(--accent); }
.weight-icon svg { width: 34px; height: 30px; }
.workout-head p { font-size: 14px; color: var(--muted); margin-top: 6px; overflow-wrap: anywhere; }
.start, .plan-btn.primary { color: var(--accent-ink); background: var(--btn-primary); border-color: transparent; box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent-hi) 40%, transparent); }
.start { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-width: 0; min-height: 50px; padding: 13px 14px; border-radius: 18px; font-size: 16px; font-weight: 700; line-height: 1.4; }
.start svg { width: 20px; height: 20px; }
.week { display: flex; align-items: center; gap: 16px; margin-top: 14px; }
.ring { flex: 0 0 72px; height: 72px; position: relative; }
.ring > svg { width: 100%; height: 100%; }
.ring b { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 18px; letter-spacing: -.6px; }
.ring small { font-size: 13px; }
.week-info { flex: 1; min-width: 0; }
.week-info h2 { font-size: 15px; margin-top: 5px; letter-spacing: 0; }
.fraction { display: block; text-align: right; font-size: 12px; color: var(--muted); margin-top: 6px; }
.progress { height: 7px; margin-top: 6px; overflow: hidden; border-radius: 99px; background: var(--progress-track); }
.progress i { display: block; height: 100%; border-radius: inherit; background: var(--progress-fill); }
.history-heading, .section-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }
.section-label > span { flex-shrink: 0; color: var(--muted); font-size: 13px; }
.history-heading button { min-height: 44px; min-width: 44px; color: var(--accent); font-size: 14px; flex-shrink: 0; }
.history-list, .session-list, .template-list, .workout-exercise-list, .workout-picks { display: grid; gap: 12px; }
.history { width: 100%; text-align: left; }
.history-date { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.history-date svg { width: 18px; height: 18px; }
.history h3 { font-size: 18px; margin: 10px 0 14px; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.stats > div { min-width: 0; padding: 12px; border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent); border-radius: 15px; background: var(--icon-surface); }
.stats b { display: block; font-size: 18px; overflow-wrap: anywhere; }
.stats span { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.empty, .empty-history { text-align: center; padding: 24px 18px; }
.empty-history { display: grid; align-content: center; gap: 8px; min-height: 116px; }
.empty-history h3 { font-size: 17px; margin: 0; }
.empty p, .empty-history p { font-size: 14px; color: var(--muted); line-height: 1.5; }
.empty p { margin-top: 8px; }
.empty-symbol { display: grid; place-items: center; margin: 0 auto 12px; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 14px; color: var(--accent); font-size: 25px; }

/* One navigation definition, regardless of the selected tab or screen width. */
.diary nav { position: fixed; z-index: 3; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--inset-bottom)); width: calc(100% - 24px - var(--safe-left) - var(--safe-right)); max-width: 576px; height: var(--nav-height); padding: 6px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; border: 1px solid var(--nav-border); border-radius: 36px; background: var(--nav-bg); backdrop-filter: blur(15px); }
.diary nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-width: 0; padding: 4px 0; border-radius: 28px; font-size: 11px; font-weight: 400; line-height: 1.2; color: var(--muted); }
.diary nav svg { width: 22px; height: 22px; }
.diary nav .active { background: var(--nav-active); color: var(--accent-ink); box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 13%, transparent); }
.plan-page { font-size: 15px; }
.plan-page > .wide:first-child { margin-top: 0; }
.plan-page > .section-label:first-child { margin-top: 0; }
.plan-intro, .plan-muted { font-size: 14px; color: var(--muted); margin: 8px 0 16px; }
.plan-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 11px 16px; border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent); border-radius: 16px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: 15px; font-weight: 600; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
.wide { width: 100%; margin-top: 18px; }
.template { display: flex; align-items: center; width: 100%; text-align: left; gap: 12px; }
.template > span:first-child, .planned-info { min-width: 0; }
.template p, .planned-info p, .card-link p { font-size: 13px; color: var(--muted); margin-top: 5px; }
.template-icon { flex-shrink: 0; width: 35px; font-size: 24px; color: var(--accent); }
.chevron { flex-shrink: 0; margin-left: auto; font-size: 26px; color: var(--accent); }
.planned-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; width: 100%; text-align: left; }
.planned-date { grid-column: 1; color: var(--accent); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.planned-card .chevron { grid-column: 2; grid-row: 1 / 3; }
.session-date { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.session-date b { color: var(--accent); }
.card-link { display: block; width: 100%; text-align: left; padding: 4px 0; }
.small-actions, .confirm-actions { display: flex; gap: 10px; margin-top: 18px; }
.small-actions > *, .confirm-actions > * { flex: 1; min-width: 0; }
.storage-note, .quick-label, #dates-summary { font-size: 12px; color: var(--muted); margin: 18px 0 4px; overflow-wrap: anywhere; }

/* Sheets and workout screens share typography, controls and safe-area handling. */
.sheet-open { overflow: hidden; }
.plan-dialog { color: var(--text); font: 15px/1.45 Arial, Helvetica, sans-serif; background: var(--dialog-bg); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); border-radius: 26px 26px 0 0; width: min(100%, 600px); max-width: 100%; max-height: calc(100dvh - 12px - var(--inset-top)); margin: auto auto 0; padding: 16px calc(18px + var(--safe-right)) calc(24px + var(--inset-bottom)) calc(18px + var(--safe-left)); box-shadow: 0 -15px 80px #0009; overflow-y: auto; overscroll-behavior-y: contain; }
.plan-dialog::backdrop { background: #000a; backdrop-filter: blur(5px); }
.sheet-top { position: relative; flex-shrink: 0; height: 36px; margin-bottom: 12px; }
.sheet-handle { display: block; width: 38px; height: 4px; margin: 0 auto; border-radius: 8px; background: color-mix(in srgb, var(--muted) 40%, transparent); }
.sheet-top button { position: absolute; top: -4px; right: 0; width: 44px; height: 44px; background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--muted); font-size: 25px; border-radius: 50%; }
.plan-dialog h2 { font-size: 22px; padding-right: 24px; margin-bottom: 20px; }
.plan-dialog h3 { font-size: 17px; }
.plan-dialog label { display: flex; flex-direction: column; min-width: 0; gap: 7px; font-size: 13px; color: var(--muted); margin: 12px 0; }
.plan-dialog input, .plan-dialog textarea { width: 100%; min-width: 0; min-height: 46px; padding: 12px; font-size: 16px; color: var(--text); background: color-mix(in srgb, var(--background) 72%, transparent); border: 1px solid var(--border); border-radius: 13px; }
.plan-dialog textarea { min-height: 110px; resize: vertical; line-height: 1.4; }
.form-error { font-size: 13px; color: #ffb0b0; margin: 14px 0; }
.exercise-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: end; gap: 0 10px; padding: 8px 0 14px; border-bottom: 1px solid #ffffff0a; }
.exercise-row > label:first-child { grid-column: 1 / -1; }
.exercise-row label { margin-bottom: 0; }
.remove-exercise, .remove-result-set { width: 44px; height: 46px; border-radius: 12px; background: #ff7c8110; color: #ffb0b0; font-size: 24px; }
.exercise-details { margin: 20px 0; padding-left: 24px; }
.exercise-details li { padding: 14px 0; border-bottom: 1px solid #71988325; }
.exercise-details li span { display: block; overflow-wrap: anywhere; padding-bottom: 6px; }
.exercise-details li b { font-size: 13px; color: var(--accent); }
.sheet-actions { display: grid; gap: 10px; }
.danger { color: #ffd0d0; background: #7d2638; border-color: #ed647355; }
.planned-sheet-date { color: var(--accent); font-size: 14px; margin: -10px 0 12px; }
.planner-block { margin-bottom: 24px; }
.planner-block > h3 { margin-bottom: 12px; }
#planner-calendar { padding: 10px; }
.calendar-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.calendar-title h3 { text-align: center; font-size: 16px; font-weight: 600; text-transform: capitalize; }
.calendar-title button { flex-shrink: 0; width: 44px; height: 44px; border: 1px solid #69be8c1e; border-radius: 14px; background: #6cd99b0c; color: var(--accent); font-size: 26px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; text-align: center; }
.weekday { font-size: 12px; color: var(--muted); padding: 4px 0 8px; }
.day { position: relative; min-width: 0; height: 44px; font-size: 14px; border: 1px solid transparent; border-radius: 13px; }
.day.today { border-color: #60e99e77; }
.day.marked::after { content: ''; position: absolute; bottom: 4px; left: calc(50% - 2px); width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.day.selected { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.day.selected::after { background: #063d23; }
.day:disabled { opacity: .25; }
.workout-picks button { width: 100%; padding: 12px 14px; min-height: 58px; border: 1px solid #65bc882f; border-radius: 16px; background: #1638278a; text-align: left; }
.workout-picks strong, .workout-picks span { display: block; }
.workout-picks span { font-size: 13px; color: var(--muted); margin-top: 4px; }
.workout-picks [aria-pressed=true] { border-color: var(--accent); background: #28583da8; box-shadow: 0 0 0 1px var(--accent); }
.weekday-picks { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.weekday-picks button { border-radius: 12px; border: 1px solid #60987a44; min-height: 44px; padding: 7px 11px; color: var(--muted); background: #123c2899; }
.weekday-picks [aria-pressed=true] { color: var(--accent-ink); background: var(--accent); }
#dates-summary { max-height: 90px; overflow: auto; }
.plan-dialog.workout-fullscreen { inset: 0; margin: 0 auto; height: 100dvh; max-height: 100dvh; border-radius: 0; border: 0; padding-top: calc(12px + var(--inset-top)); padding-bottom: 0; display: flex; flex-direction: column; overflow: hidden; }
.workout-sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; padding-bottom: calc(18px + var(--inset-bottom)); scroll-padding-block: 16px; }
.workout-sheet-footer { flex-shrink: 0; padding: 12px 0 calc(18px + var(--inset-bottom)); background: #091c14; }
.workout-sheet-footer .wide { margin-top: 0; }
.workout-exercise { display: grid; grid-template-columns: 38px minmax(0, 1fr) 14px; align-items: center; gap: 10px; width: 100%; min-height: 68px; padding: 12px; border: 1px solid #65bc882f; border-radius: 17px; background: #1638278a; text-align: left; }
.exercise-order { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border: 1px solid #65bc8838; border-radius: 12px; color: var(--accent); font-weight: 700; }
.exercise-copy { min-width: 0; }
.exercise-copy strong, .exercise-copy small { display: block; overflow-wrap: anywhere; }
.exercise-copy small { font-size: 12px; color: var(--muted); margin-top: 4px; }
.workout-exercise.completed { border-color: #58f9a672; background: #28583d7a; }
.workout-exercise.completed .exercise-order { color: var(--accent-ink); background: var(--accent); }
.workout-status { font-size: 13px; color: var(--muted); margin-top: 16px; }
.sheet-back { min-height: 44px; padding: 10px 0; margin-bottom: 12px; color: var(--accent); font-size: 14px; text-align: left; }
.previous-result, .completed-exercise { padding: 14px; border: 1px solid #65bc882f; border-radius: 17px; background: #102e207d; }
.previous-result { margin-bottom: 22px; }
.previous-result h3 { font-size: 16px; }
.previous-result p { margin-top: 7px; color: var(--muted); font-size: 13px; }
.previous-result-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.previous-result-head span { color: var(--muted); font-size: 12px; }
.previous-sets { display: grid; gap: 7px; margin-top: 12px; }
.previous-sets > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 8px 10px; border-radius: 11px; background: #071d1480; font-size: 12px; overflow-wrap: anywhere; }
.previous-sets span { color: var(--muted); text-align: right; }
.result-set { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px; align-items: center; gap: 8px; padding: 14px 0; border-bottom: 1px solid #71988325; }
.set-number { grid-column: 1 / -1; font-size: 13px; font-weight: 700; color: var(--accent); }
.result-set label { margin: 0; font-size: 12px; }
.result-set input { padding: 10px; }
.result-set .remove-result-set { margin-top: 0; align-self: center; }
.wheel-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wheel-label { font-size: 12px; color: #c3d5cc; }
.wheel {
  position: relative;
  height: 132px;
  border: 1px solid #65987940;
  border-radius: 13px;
  background: #03170e8a;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(180deg, transparent 0%, #000 18%, #000 82%, transparent 100%);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-highlight {
  position: absolute;
  left: 4px;
  right: 4px;
  top: 44px;
  z-index: 1;
  height: 44px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 33%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  pointer-events: none;
}
.wheel-list { position: relative; z-index: 0; padding: 44px 0; }
.wheel-item { height: 44px; }
.wheel-item {
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  color: #6f8b7d;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wheel-item[aria-selected=true] { color: #f5fff9; font-size: 22px; font-weight: 700; }
.wheel-item.below-prev { color: #ff7f86; }
.wheel-item.below-prev[aria-selected=true] { color: #ffb4b8; }
#exercise-result-form [data-do="add-result-set"] { margin-top: 22px; }
.completed-details { display: grid; gap: 14px; margin-top: 8px; }
.completed-exercise-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.completed-exercise-head > div { min-width: 0; }
.completed-exercise-head strong, .completed-exercise-head small { display: block; }
.completed-exercise-head small { color: var(--muted); font-size: 12px; margin-top: 3px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: calc(90px + var(--inset-bottom)); max-width: calc(100% - 32px); width: max-content; transform: translate(-50%, 10px); padding: 12px 18px; border-radius: 18px; color: var(--accent-ink); background: var(--accent-hi); font-size: 14px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.sheet-open .toast { display: none; }
.profile-stack { display: grid; gap: 12px; }
.profile-link, .profile-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  min-height: 64px; padding: 14px 16px; text-align: left;
  border: 1px solid var(--border); border-radius: 22px;
  background: var(--surface); color: var(--text);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 8%, transparent), 0 10px 22px #00000012;
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.profile-link:active, .profile-row:active { transform: scale(.985); }
.profile-link.account { min-height: 76px; }
.profile-avatar {
  display: grid; place-items: center; flex: 0 0 56px; width: 56px; height: 56px;
  overflow: hidden; border-radius: 18px; border: 1px solid var(--border);
  background: var(--icon-surface); color: var(--accent); font-size: 22px; font-weight: 700;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.profile-link .profile-copy, .profile-row .profile-copy { min-width: 0; flex: 1; }
.profile-link strong, .profile-row strong, .profile-stat strong { display: block; font-size: 16px; }
.profile-link small, .profile-row small, .profile-stat small { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; }
.profile-stat {
  position: relative; display: grid; gap: 8px; width: 100%; padding: 18px 44px 18px 18px; text-align: left;
  border: 1px solid var(--border); border-radius: 22px; background: var(--surface);
  color: var(--text); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 8%, transparent);
  transition: border-color .2s, box-shadow .2s;
}
.profile-stat .chevron { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); margin-left: 0; }
.profile-stat.control { gap: 10px; padding: 20px; border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); box-shadow: 0 0 28px color-mix(in srgb, var(--accent) 10%, transparent); }
.profile-stat.control .plan-btn { margin-top: 6px; }
.profile-stat .stat-line { color: var(--muted); font-size: 14px; }
.profile-stat .stat-line b { color: var(--accent); font-weight: 700; }
.profile-badges { display: flex; gap: 8px; }
.status-pill.active-sub { color: var(--accent-ink); background: var(--accent); border-color: transparent; }
.profile-desc { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.profile-panel {
  display: grid; gap: 10px; padding: 18px; border: 1px solid var(--border); border-radius: 22px;
  background: var(--surface); box-shadow: inset 0 1px 0 color-mix(in srgb, var(--accent) 8%, transparent);
}
.profile-panel > strong { font-size: 16px; }
.profile-panel label { display: flex; flex-direction: column; gap: 7px; margin: 0; font-size: 13px; color: var(--muted); }
.profile-panel input {
  width: 100%; min-height: 46px; padding: 12px; font-size: 16px; color: var(--text);
  background: color-mix(in srgb, var(--background) 72%, transparent); border: 1px solid var(--border); border-radius: 13px;
}
.profile-panel .form-error { margin: 0; }
.profile-panel .wide { margin-top: 4px; }
.control-level-panel { gap: 12px; }
.control-level-list { display: grid; gap: 10px; }
.control-level-option {
  display: flex; align-items: flex-start; gap: 12px; width: 100%;
  padding: 14px 14px 14px 12px; text-align: left;
  border: 1px solid var(--border); border-radius: 18px;
  background: var(--icon-surface); color: var(--text);
  transition: border-color .2s, box-shadow .2s, transform .15s;
}
.control-level-option:active { transform: scale(.985); }
.control-level-option[aria-pressed=true] {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 16%, transparent);
  background: color-mix(in srgb, var(--accent) 8%, var(--icon-surface));
}
.control-level-icon {
  width: 42px; height: 42px; flex-shrink: 0; border-radius: 14px;
  display: grid; place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.control-level-icon svg { width: 22px; height: 22px; }
.control-level-copy { min-width: 0; flex: 1; display: grid; gap: 4px; }
.control-level-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.control-level-top strong { font-size: 15px; }
.control-level-desc { font-size: 13px; line-height: 1.4; color: var(--muted); }
.control-level-badge {
  display: inline-flex; align-items: center; width: fit-content;
  margin-top: 2px; padding: 3px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.status-pill.selected-level {
  min-height: 22px; padding: 1px 8px; font-size: 11px;
  color: var(--accent-ink); background: var(--accent); border-color: transparent;
}
.control-level-check {
  flex-shrink: 0; margin-top: 10px; width: 22px; height: 22px;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent); opacity: 0; transform: scale(.85);
  transition: opacity .15s, transform .15s;
}
.control-level-option[aria-pressed=true] .control-level-check { opacity: 1; transform: scale(1); }
.control-level-hint, .control-level-hard-note {
  margin: 0; font-size: 12px; line-height: 1.45; color: var(--muted);
}
.control-level-hard-note { color: var(--accent); }
.hard-zone-card {
  display: grid; gap: 10px; margin-top: 4px; padding: 14px;
  border-radius: 18px; border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--border));
  background: color-mix(in srgb, var(--accent) 8%, var(--icon-surface));
}
.hard-zone-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hard-zone-head strong { font-size: 15px; }
.hard-zone-preview { min-height: 140px; max-height: 220px; }
.hard-zone-preview img { max-height: 220px; }
.hard-zone-label {
  margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--accent);
}
.gym-photo-preview {
  display: grid; place-items: center; min-height: 180px; padding: 16px;
  border-radius: 18px; border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--background) 70%, transparent);
  color: var(--muted); font-size: 13px; text-align: center; overflow: hidden;
}
.gym-photo-preview.has-photo { padding: 0; border-style: solid; }
.gym-photo-preview img { width: 100%; max-height: 280px; object-fit: cover; display: block; }
.visit-verify-sheet {
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: stretch;
}
.visit-verify-sheet .plan-btn.wide { margin-top: 4px; }
.visit-verify-sheet .plan-btn.visit-start-btn {
  width: auto;
  min-width: 0;
  max-width: 100%;
  justify-self: start;
  margin-top: 8px;
  padding: 11px 20px;
}
.visit-photo-preview {
  display: grid; place-items: center; min-height: 200px; padding: 16px;
  border-radius: 18px; border: 1px dashed color-mix(in srgb, var(--accent) 35%, var(--border));
  background: color-mix(in srgb, var(--background) 70%, transparent);
  color: var(--muted); font-size: 13px; text-align: center; overflow: hidden;
}
.visit-photo-preview.has-photo { padding: 0; border-style: solid; }
.visit-photo-preview img { width: 100%; max-height: 320px; object-fit: cover; display: block; }
.visit-spinner {
  width: 34px; height: 34px; margin: 8px auto 0; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-top-color: var(--accent); animation: visit-spin .8s linear infinite;
}
@keyframes visit-spin { to { transform: rotate(360deg); } }
@media (max-width: 380px) {
  .control-level-option { padding: 12px 10px; gap: 10px; }
  .control-level-icon { width: 38px; height: 38px; border-radius: 12px; }
  .control-level-check { display: none; }
}
.notify-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; display: grid; gap: 4px; }
.notify-example {
  margin: 4px 0 0; padding: 12px 14px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text); font-size: 13px; line-height: 1.45;
}
.profile-links { display: grid; gap: 8px; margin-top: 4px; }
.profile-links .profile-row { min-height: 52px; border-radius: 18px; padding: 12px 14px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-option {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  min-height: 108px; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--border); border-radius: 18px; background: var(--icon-surface); color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.theme-option[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 20px color-mix(in srgb, var(--accent) 18%, transparent); }
.theme-option .theme-preview { height: 36px; border-bottom: 1px solid color-mix(in srgb, var(--border) 80%, transparent); }
.theme-option .theme-meta { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px 14px; }
.theme-option strong { font-size: 15px; }
.theme-option span { font-size: 12px; color: var(--muted); }
.theme-option[data-theme-pick="green"] .theme-preview { background: linear-gradient(160deg, #93ffcb, #03190f); }
.theme-option[data-theme-pick="purple"] .theme-preview { background: linear-gradient(160deg, #e9d5ff, #10081c); }
.theme-option[data-theme-pick="red"] .theme-preview { background: linear-gradient(160deg, #ffd5d5, #1a0808); }
.theme-option[data-theme-pick="yellow"] .theme-preview { background: linear-gradient(160deg, #ffe9a8, #141008); }
.theme-option[data-theme-pick="light"] .theme-preview { background: linear-gradient(160deg, #2fd47a, #f4f6f8); }
.theme-swatch { width: 36px; height: 36px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--text) 12%, transparent); }
.theme-swatch.green { background: linear-gradient(160deg, #93ffcb, #42f69a); }
.theme-swatch.purple { background: linear-gradient(160deg, #e9d5ff, #a855f7); }
.theme-swatch.red { background: linear-gradient(160deg, #ffd5d5, #f04343); }
.theme-swatch.yellow { background: linear-gradient(160deg, #ffe9a8, #e0b12a); }
.theme-swatch.light { background: linear-gradient(160deg, #e8f5ee, #2fd47a); }
.tariff-picks { display: grid; gap: 10px; margin-bottom: 16px; }
.tariff-option {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 72px;
  padding: 14px 16px; text-align: left; border: 1px solid var(--border); border-radius: 18px;
  background: var(--icon-surface); color: var(--text); transition: border-color .2s, box-shadow .2s;
}
.tariff-option[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tariff-option strong, .tariff-option small { display: block; }
.tariff-option small { margin-top: 4px; color: var(--muted); font-size: 13px; }
.tariff-option .check { margin-left: auto; color: var(--accent); font-size: 18px; opacity: 0; }
.tariff-option[aria-pressed=true] .check { opacity: 1; }
.fine-card {
  display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 18px; background: var(--icon-surface);
}
.fine-card .fine-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fine-card strong { font-size: 15px; }
.fine-card .fine-amount { color: var(--accent); font-weight: 700; font-size: 16px; }
.fine-card small { color: var(--muted); font-size: 12px; }
.status-pill {
  display: inline-flex; align-items: center; min-height: 26px; padding: 2px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent);
}
.status-pill.charged { color: #ffb0b0; border-color: #ed647355; background: #ff7c8114; }
.status-pill.disputed, .status-pill.review { color: #ffd0a0; border-color: #e0b12a55; background: #f5d76e18; }
.status-pill.refunded { color: var(--accent); }
.status-pill.cancelled { color: var(--muted); border-color: color-mix(in srgb, var(--muted) 35%, transparent); background: color-mix(in srgb, var(--muted) 12%, transparent); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; margin: 8px 0 16px; }
.toggle-row span { font-size: 15px; font-weight: 600; }
.toggle {
  position: relative; width: 52px; height: 32px; flex-shrink: 0; border-radius: 999px;
  border: 1px solid var(--border); background: color-mix(in srgb, var(--muted) 22%, transparent);
  transition: background .2s, border-color .2s;
}
.toggle[aria-pressed=true] { background: color-mix(in srgb, var(--accent) 35%, transparent); border-color: var(--accent); }
.toggle::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px;
  border-radius: 50%; background: var(--text); transition: transform .2s, background .2s;
}
.toggle[aria-pressed=true]::after { transform: translateX(20px); background: var(--accent); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.chip-row button {
  min-height: 40px; padding: 8px 14px; border-radius: 14px; font-size: 14px; font-weight: 600;
  border: 1px solid var(--border); background: var(--icon-surface); color: var(--text);
  transition: border-color .2s, background .2s;
}
.chip-row button[aria-pressed=true] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.reason-picks { display: grid; gap: 8px; margin: 12px 0 16px; }
.reason-picks button {
  min-height: 48px; padding: 12px 14px; text-align: left; border-radius: 14px;
  border: 1px solid var(--border); background: var(--icon-surface); color: var(--text);
}
.reason-picks button[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.faq-list { display: grid; gap: 10px; margin-top: 4px; }
.faq-item {
  border: 1px solid var(--border); border-radius: 16px; background: var(--icon-surface);
  overflow: hidden; transition: border-color .2s, box-shadow .2s;
}
.faq-item[open] { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 18%, transparent); }
.faq-item summary {
  list-style: none; cursor: pointer; min-height: 52px; padding: 14px 44px 14px 16px;
  font-size: 15px; font-weight: 600; line-height: 1.35; position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '›'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%) rotate(90deg);
  color: var(--accent); font-size: 22px; transition: transform .2s;
}
.faq-item[open] summary::after { transform: translateY(-50%) rotate(-90deg); }
.faq-item p {
  margin: 0; padding: 0 16px 16px; color: var(--muted); font-size: 14px; line-height: 1.5;
}
@media (max-width: 350px) { .diary nav button { font-size: 10px; } :root { --gutter: 12px; } .card, .plan-card { padding: 16px; } .workout-head { gap: 10px; } .weight-icon { flex-basis: 48px; height: 48px; } }
@media (min-width: 700px) { .plan-dialog:not(.workout-fullscreen) { margin: auto; border-radius: 26px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
