:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17212b;
  background: #f4f6f8;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; background: #f4f6f8; touch-action: pan-x pan-y; -webkit-tap-highlight-color: transparent; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select { font: inherit; }
button { touch-action: manipulation; }

.app-shell {
  width: min(100%, 620px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(104px + env(safe-area-inset-bottom));
}

.app-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px 2px 20px; }
.app-header.header-hidden { display: none; }
.app-header h1 { margin: 0; font-size: 31px; line-height: 1.1; letter-spacing: -1px; }
.app-header p { margin: 5px 0 0; color: #697582; font-size: 14px; }
.version-control { position: relative; display: flex; align-items: flex-end; flex-direction: column; flex-shrink: 0; }
.today-mode-switch { order: 2; display: flex; gap: 2px; padding: 3px; margin-top: 10px; border-radius: 12px; background: #e9edf3; }
.today-mode-switch button { padding: 8px 10px; min-height: 40px; font-size: 13px; background: transparent; border-radius: 9px; }
.today-mode-switch .selected { background: #1677ff; color: #fff; }
.today-meal-card { display: block; width: 100%; text-align: left; margin-top: 12px; padding: 16px; border-radius: 17px; background: #fff; }
.today-meal-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.today-meal-heading strong { font-size: 19px; }
.today-meal-heading span, .today-meal-card small { color: #697582; font-size: 12px; }
.today-meal-heading .action-status.completed, .today-meal-heading .action-status.completed span { color: #159858; font-size: 13px; }
.today-meal-foods { display: block; margin-top: 9px; padding-left: 10px; border-left: 2px solid #dce9fa; font-size: 13px; color: #697582; }
#today-meal-sheet { z-index: 29; }
#today-meal-sheet .food-quantity { display: flex; justify-content: flex-end; gap: 4px; width: auto; margin-left: auto; }
#today-meal-sheet .nutrition-food-row { flex-wrap: wrap; }
#today-meal-sheet .nutrition-food-row > div:first-child { flex: 1 0 max-content; max-width: 100%; overflow-wrap: anywhere; }
#today-meal-sheet .food-quantity span { min-width: 12px; }
#today-meal-sheet .food-quantity input { width: 54px; min-width: 0; text-align: center; font-size: 16px; padding: 7px 3px; border: 1px solid #dce3eb; border-radius: 9px; background: #fff; }
#today-meal-sheet .food-quantity button { min-width: 34px; min-height: 34px; border: 0; }
#today-meal-sheet .nutrition-meal { padding: 12px; }
#today-meal-sheet .nutrition-food-rows { margin-left: 0; padding-left: 8px; }
#today-meal-sheet .nutrition-food-row strong { font-size: 14px; }
#today-meal-sheet .today-partial-intake { margin-top: 14px; font-size: 12px; color: #697582; }
#today-meal-sheet .explicit-eaten { display: block; margin: 8px 0; }
#today-meal-sheet .explicit-eaten input { width: 60px; padding: 6px; font-size: 16px; }
#today-meal-sheet .food-quantity .delete { width: auto; white-space: nowrap; }
@media (max-width: 380px) { .app-header p { font-size: 12px; } .today-mode-switch button { padding: 8px; } }
.version-badge { margin-top: 4px; padding: 6px 9px; border: 0; border-radius: 999px; color: #0868e4; background: #eaf3ff; font-size: 11px; font-weight: 700; white-space: nowrap; }
.version-popover { position: absolute; z-index: 20; top: 37px; right: 0; width: max-content; max-width: 230px; padding: 12px 14px; border: 1px solid #dfe6ee; border-radius: 13px; background: #fff; box-shadow: 0 12px 32px rgba(31, 45, 61, 0.16); }
.version-popover strong, .version-popover span { display: block; }
.version-popover strong { font-size: 12px; }
.version-popover span { margin-top: 5px; color: #697582; font-size: 10px; }
.view:not(.active-view) { display: none; }

.loading-card,
.page-card,
.today-hero,
.plan-section,
.workout-card {
  border: 1px solid rgba(23, 33, 43, 0.06);
  border-radius: 21px;
  background: #fff;
  box-shadow: 0 9px 28px rgba(35, 49, 63, 0.07);
}

.loading-card { padding: 28px 22px; color: #697582; }
.page-card { padding: 22px 20px; }
.page-card h2, .plan-section > h2 { margin: 0; font-size: 21px; }
.page-card > p, .muted { color: #697582; line-height: 1.55; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading p { margin-top: 5px; color: #697582; font-size: 12px; line-height: 1.45; }
.compact-primary { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 0; border-radius: 12px; background: #1677ff; color: #fff; font-size: 12px; font-weight: 750; }

.today-hero { position: relative; min-height: 204px; padding: 22px; overflow: hidden; }
.today-copy { position: relative; z-index: 2; width: 100%; }
.eyebrow { color: #1677ff; font-size: 12px; font-weight: 700; }
.today-hero h2 { margin: 10px 0 0; font-size: 24px; letter-spacing: -0.4px; }
.today-hero p { margin: 8px 0 0; color: #697582; line-height: 1.45; }
.today-hero > .primary-button { position: absolute; z-index: 2; right: 22px; bottom: 20px; left: 22px; width: auto; }
.compact-hero { min-height: 132px; padding: 22px; background: linear-gradient(145deg, #fff, #edf5ff); }
.next-plan-button { position: absolute; z-index: 3; top: 18px; right: 18px; min-height: 36px; padding: 0 11px; border: 0; border-radius: 11px; background: #e2edfb; color: #0868e4; font-size: 11px; font-weight: 750; }
.direct-today-hero { margin-bottom: 12px; }

.primary-button,
.secondary-button,
.finish-button {
  width: 100%;
  min-height: 50px;
  border-radius: 15px;
  font-weight: 750;
  cursor: pointer;
}
.primary-button, .finish-button { border: 0; background: #1677ff; color: #fff; }
.secondary-button { border: 1px solid rgba(23, 33, 43, 0.11); background: #f5f7fa; color: #17212b; }
#add-custom-meal-food { margin-bottom: 10px; }
.record-note { display: block; margin-top: 14px; color: #596675; font-size: 13px; }
.record-note textarea { display: block; width: 100%; min-height: 76px; margin: 8px 0; padding: 10px; border: 1px solid #dce1e6; border-radius: 10px; background: #fff; color: #17212b; font: inherit; font-size: 16px; resize: vertical; }
.note-text { margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.primary-button:active, .finish-button:active { transform: scale(0.987); background: #0868e4; }

.plan-section { margin-top: 16px; padding: 21px 19px; }
.body-part-group { margin-top: 20px; }
.body-part-group h3 { margin: 0 0 9px; color: #697582; font-size: 14px; }
.plan-card { padding: 14px; border-radius: 15px; background: #f5f7fa; }
.plan-card + .plan-card { margin-top: 9px; }
.plan-card > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan-card strong { font-size: 15px; }
.plan-card span, .plan-card small { color: #7d8792; font-size: 12px; }
.plan-card p { margin: 8px 0 5px; font-size: 14px; font-weight: 650; }
.direct-plan-section { padding: 18px 16px; }
.today-action-group + .today-action-group { margin-top: 18px; }
.today-action-group > h3 { margin: 0 0 7px 3px; color: #697582; font-size: 13px; }
.today-action-group > div { display: grid; gap: 7px; }
.today-action-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 62px; padding: 11px 12px; border: 0; border-radius: 13px; background: #f5f7fa; color: #17212b; text-align: left; }
.today-action-row > span:first-child { min-width: 0; }
.today-action-row strong, .today-action-row small { display: block; }
.today-action-row strong { font-size: 14px; }
.today-action-row small { margin-top: 5px; color: #7d8792; font-size: 11px; }
.action-status { display: grid; flex: 0 0 auto; grid-template-columns: 22px 48px; align-items: center; justify-content: end; gap: 7px; min-width: 77px; font-size: 12px; font-weight: 700; line-height: 1; white-space: nowrap; }
.status-mark { position: relative; display: block; width: 22px; height: 22px; border-radius: 50%; box-sizing: border-box; }
.action-status.pending .status-mark { border: 2px solid #b7c0ca; background: #fff; }
.action-status.pending .status-mark::after { content: ""; position: absolute; top: 8px; left: 5px; width: 8px; height: 2px; border-radius: 2px; background: #9ba6b2; }
.action-status.skipped .status-mark { border: 2px solid #aeb8c3; background: #eef1f4; }
.action-status.skipped .status-mark::after { content: ""; position: absolute; top: 9px; left: 4px; width: 10px; height: 2px; border-radius: 2px; background: #8d99a6; transform: rotate(-35deg); }
.action-status.partial .status-mark { padding: 3px; background: conic-gradient(#1677ff 0 var(--status-progress, 0deg), #d9e7f8 var(--status-progress, 0deg) 360deg); }
.action-status.partial .status-mark::before { content: ""; display: block; width: 100%; height: 100%; border-radius: 50%; background: #fff; }
.action-status.partial .status-mark::after { content: ""; position: absolute; top: 8px; left: 8px; width: 6px; height: 6px; border-radius: 50%; background: #1677ff; }
.action-status.completed .status-mark { background: linear-gradient(145deg, #32ca7a, #19a95e); box-shadow: 0 4px 10px rgba(24, 169, 94, 0.22); }
.action-status.completed .status-mark::after { content: ""; position: absolute; top: 5px; left: 7px; width: 6px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.action-status.pending { color: #8a949f; }
.action-status.skipped { color: #7d8792; }
.action-status.partial { color: #1677ff; }
.action-status.completed { color: #218653; }

.completion-date { display: block; margin-bottom: 8px; }
.start-timed-training { width: 100%; margin: 4px 0 14px; }
.today-action-row:disabled { opacity: 1; cursor: default; }
.training-duration { margin: 8px 0; color: #697582; font-size: 14px; }
.duration-values { display: flex; flex-wrap: wrap; gap: 6px 14px; color: #697582; font-size: 12px; }
.completed-plan-hero { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 210px; padding: 18px 20px; overflow: hidden; background: linear-gradient(135deg, #dceeff 0%, #edf7ff 50%, #dff8ec 100%); text-align: center; }
.completed-plan-hero::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 38%, rgba(255,255,255,0.9), transparent 34%); pointer-events: none; }
.completion-seal { position: relative; z-index: 2; display: grid; place-items: center; width: 72px; height: 72px; border: 8px solid rgba(255,255,255,0.52); border-radius: 50%; background: linear-gradient(145deg, #35cf80, #18aa60); box-shadow: 0 10px 24px rgba(24, 169, 96, 0.24), 0 0 0 1px rgba(255,255,255,0.8); }
.completed-plan-hero .completion-seal { transform-style: preserve-3d; animation: completion-coin-cycle 3.2s ease-in-out infinite; }
.completion-seal svg { width: 48px; height: 48px; overflow: visible; backface-visibility: hidden; transform: translateZ(1px); }
.completion-seal path { fill: none; stroke: #fff; stroke-width: 5.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; animation: completion-check-write 3.2s ease-in-out infinite; }
.completed-plan-hero h2 { position: relative; z-index: 2; margin-top: 16px; font-size: 23px; }
.completed-plan-hero p { position: relative; z-index: 2; max-width: 290px; margin-top: 8px; color: #526271; font-size: 13px; }
.completion-celebration-overlay { position: fixed; z-index: 80; inset: 0; display: grid; place-items: center; pointer-events: none; }
.viewport-celebration { position: relative; display: grid; place-items: center; width: 230px; height: 230px; }
.viewport-completion-seal { position: relative; z-index: 2; display: grid; place-items: center; width: 92px; height: 92px; border: 10px solid rgba(255,255,255,.72); border-radius: 50%; background: linear-gradient(145deg, #35cf80, #18aa60); box-shadow: 0 18px 46px rgba(24,169,96,.35), 0 0 0 1px rgba(255,255,255,.9); opacity: 0; }
.viewport-completion-seal span { width: 23px; height: 40px; margin-top: -8px; border: solid #fff; border-width: 0 7px 7px 0; transform: rotate(45deg); }
.viewport-celebration-particles { position: absolute; inset: 0; }
.viewport-celebration-particles i { --angle: calc(var(--particle) * 22.5deg); position: absolute; top: calc(50% - 4px); left: calc(50% - 4px); width: 8px; height: 8px; border-radius: 2px; background: #1677ff; opacity: 0; }
.viewport-celebration-particles i:nth-child(3n + 1) { background: #25b96a; border-radius: 50%; }
.viewport-celebration-particles i:nth-child(3n + 2) { background: #f4b83f; }
.completion-celebration-overlay.play .viewport-completion-seal { animation: completion-pop 820ms cubic-bezier(.16, 1.25, .35, 1) both; }
.completion-celebration-overlay.play .viewport-celebration-particles i { animation: celebration-burst 1050ms cubic-bezier(.2,.7,.25,1) calc(var(--particle) * 18ms) both; }
@keyframes completion-pop { 0% { opacity: 0; transform: scale(.58); } 65% { transform: scale(1.08); } 100% { opacity: 1; transform: scale(1); } }
@keyframes completion-check-write { 0%, 7% { stroke-dashoffset: 100; opacity: 0; } 8% { opacity: 1; } 34%, 78% { stroke-dashoffset: 0; opacity: 1; } 79%, 100% { stroke-dashoffset: 100; opacity: 0; } }
@keyframes completion-coin-cycle { 0%, 43% { transform: perspective(420px) rotateY(0deg); } 76%, 100% { transform: perspective(420px) rotateY(360deg); } }
@keyframes celebration-burst { 0% { opacity: 0; transform: rotate(var(--angle)) translateY(-34px) scale(.4); } 24% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--angle)) translateY(-104px) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .completed-plan-hero .completion-seal,
  .completion-seal path { animation: none; }
  .completion-seal path { stroke-dashoffset: 0; opacity: 1; }
  .completion-celebration-overlay.play .viewport-completion-seal { animation: completion-pop 180ms ease-out both; }
  .completion-celebration-overlay.play .viewport-celebration-particles i { display: none; }
}

.workout-list { display: grid; gap: 14px; margin-top: 15px; }
.workout-card { padding: 18px 15px; }
.workout-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.workout-card-header h3 { margin: 7px 0 0; font-size: 18px; }
.workout-card-header p { margin: 6px 0 0; color: #697582; font-size: 12px; line-height: 1.45; }
.body-part-chip { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: #eaf3ff; color: #0868e4; font-size: 11px; font-weight: 700; }
.skip-button { min-width: 58px; min-height: 35px; padding: 0 10px; border: 1px solid #d9dee4; border-radius: 11px; background: #fff; color: #697582; font-size: 12px; }

.set-heading,
.set-row { display: grid; grid-template-columns: 22px minmax(128px, 1.55fr) minmax(84px, 1fr) 44px; align-items: center; gap: 5px; }
.set-heading { margin-top: 15px; padding: 0 4px 6px; color: #8a949f; font-size: 10px; text-align: center; }
.set-row { margin-top: 7px; padding: 7px 4px; border-radius: 13px; background: #f5f7fa; transition: background 120ms ease; }
.set-row.set-achieved { background: #e9f8ef; }
.set-row.set-below { background: #fff1df; }
.set-number { color: #697582; text-align: center; }
.stepper { display: grid; grid-template-columns: 43px minmax(42px, 64px) 43px; justify-content: center; align-items: center; gap: 3px; min-width: 0; }
.stepper button { min-width: 0; height: 38px; padding: 0 2px; border: 0; border-radius: 9px; background: #e7ebf0; color: #34404c; font-size: 11px; font-weight: 750; white-space: nowrap; }
.step-value { display: grid; grid-template-columns: minmax(16px, 1fr) auto; align-items: center; min-width: 0; height: 38px; }
.stepper input { width: 100%; min-width: 0; height: 38px; padding: 0; border: 1px solid #dce1e6; border-radius: 8px; background: #fff; text-align: center; font-size: 14px; font-weight: 700; -moz-appearance: textfield; }
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { margin: 0; -webkit-appearance: none; }
.stepper span { padding-left: 2px; color: #697582; font-size: 9px; white-space: nowrap; }
.reps-stepper { grid-template-columns: 29px minmax(28px, 44px) 29px; }
.bodyweight-label { display: block; color: #34404c; font-size: 13px; font-weight: 700; text-align: center; }
.set-check { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: transparent; font-size: 0; }
.set-check::before { content: "○"; display: grid; place-items: center; width: 38px; height: 38px; box-sizing: border-box; border: 1px solid #cdd4dc; border-radius: 50%; background: #fff; color: #8a949f; font-size: 18px; }
.set-check.checked::before { content: "✓"; border-color: #26a269; background: #26a269; color: #fff; }

.exercise-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.exercise-actions button { min-height: 36px; border: 0; border-radius: 10px; background: #eef1f5; color: #4f5b67; font-size: 11px; font-weight: 650; }
.exercise-actions button:last-child:nth-child(3) { grid-column: 1 / -1; color: #0868e4; background: #eaf3ff; }
.exercise-skipped { background: #eceff2; box-shadow: none; }
.exercise-skipped h3, .exercise-skipped p { color: #78828c; }
.skipped-message { margin-top: 16px; padding: 13px; border-radius: 12px; background: #e1e5e9; color: #697582; font-size: 13px; text-align: center; }
.finish-button { margin-top: 16px; }

.catalog-list { display: grid; gap: 10px; margin-top: 18px; }
.calendar-toolbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; }
.calendar-toolbar h2 { text-align: center; }
.calendar-toolbar button { width: 42px; height: 42px; border: 0; border-radius: 12px; background: #f5f7fa; color: #1677ff; font-size: 28px; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.calendar-weekdays { margin-top: 18px; color: #8a949f; font-size: 10px; text-align: center; }
.calendar-grid { margin-top: 7px; }
.calendar-blank, .calendar-day { min-height: 86px; }
.calendar-day { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px; min-width: 0; padding: 4px 1px; border: 0; border-radius: 10px; background: transparent; color: #34404c; }
.calendar-day.has-training { color: #17212b; font-weight: 750; }
.calendar-date { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; line-height: 24px; }
.calendar-day.selected .calendar-date { background: #1677ff; color: #fff; }
.calendar-day.indulgence-day .calendar-date { background: #ffead0; color: #9b530c; border-radius: 50%; }
.calendar-day.indulgence-day.selected .calendar-date { outline: 2px solid #1677ff; outline-offset: 2px; }
.indulgence-option { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 14px; font-size: 14px; }
.indulgence-option input { width: 20px; height: 20px; accent-color: #db8529; }
.indulgence-label { color: #9b530c; font-size: 14px; }
.calendar-parts { display: grid; gap: 2px; width: 100%; }
.calendar-parts small { overflow: hidden; padding: 2px 1px; border-radius: 3px; background: #e7ecf2; color: #607080; font-size: 8px; font-weight: 700; line-height: 11px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.history-detail { margin-top: 18px; }
.history-placeholder { margin: 0; padding: 16px; border-radius: 14px; background: #f5f7fa; color: #697582; font-size: 12px; text-align: center; }
.calendar-detail-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 12px; padding: 4px; border-radius: 12px; background: #eef1f5; }
.calendar-detail-tabs button { min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: #697582; font-weight: 750; }
.calendar-detail-tabs button.active { background: #fff; color: #17212b; box-shadow: 0 2px 8px rgba(23, 33, 43, 0.09); }
.calendar-empty-panel { padding: 18px 14px; border: 1px solid #e3e8ed; border-radius: 16px; text-align: center; }
.calendar-empty-panel h3 { margin: 0; font-size: 16px; }
.calendar-empty-panel p { margin: 8px 0 16px; color: #697582; font-size: 12px; }
.calendar-plan-picker { margin-top: 12px; padding: 12px; border-radius: 13px; background: #f5f7fa; text-align: left; }
.calendar-plan-picker > span, .calendar-plan-picker > small { display: block; color: #697582; font-size: 11px; }
.calendar-plan-picker > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin: 9px 0; }
.calendar-plan-picker button { min-height: 42px; border: 0; border-radius: 11px; background: #1677ff; color: #fff; font-weight: 750; }
.calendar-nutrition-detail { margin-top: 0; padding-top: 0; border-top: 0; }
.history-detail-card { overflow: hidden; border: 1px solid #e3e8ed; border-radius: 16px; }
.history-detail-card + .history-detail-card { margin-top: 12px; }
.editing-history { border-color: #f1a43c; }
.editing-banner { padding: 8px 12px; background: #fff1df; color: #9a5700; font-size: 12px; font-weight: 750; text-align: center; }
.history-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 14px; }
.history-detail-heading span { color: #1677ff; font-size: 11px; font-weight: 750; }
.history-detail-heading h3 { margin: 5px 0 0; font-size: 15px; }
.history-detail-heading button, .history-exercise-heading button { flex: 0 0 auto; min-height: 34px; padding: 0 10px; border: 0; border-radius: 10px; background: #eaf3ff; color: #0868e4; font-size: 11px; }
.history-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; border-top: 1px solid #edf0f3; border-bottom: 1px solid #edf0f3; background: #edf0f3; }
.history-summary span { padding: 9px 4px; background: #fff; color: #697582; font-size: 11px; text-align: center; }
.history-exercises { display: grid; gap: 8px; padding: 10px; }
.history-exercise { padding: 12px; border-radius: 13px; background: #f5f7fa; }
.history-exercise-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.history-exercise-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.history-exercise-heading .history-delete-exercise { background: #fff0f0; color: #b42318; }
.history-exercise-heading span, .history-exercise-heading strong { display: block; }
.history-exercise-heading span { color: #697582; font-size: 10px; }
.history-exercise-heading strong { margin-top: 3px; font-size: 13px; }
.history-exercise-heading small { color: #697582; font-size: 10px; }
.history-skipped { opacity: 0.62; }
.history-skipped p { margin-bottom: 0; font-size: 11px; }
.history-set-heading, .history-set-row { display: grid; grid-template-columns: 28px 1fr 1fr 52px; align-items: center; gap: 6px; text-align: center; }
.history-set-heading { margin-top: 11px; color: #8a949f; font-size: 9px; }
.history-set-row { margin-top: 5px; min-height: 36px; padding: 4px; border-radius: 9px; background: #fff; font-size: 11px; }
.history-set-row input { width: 100%; min-width: 0; height: 31px; padding: 0 4px; border: 1px solid #dce1e6; border-radius: 8px; text-align: center; }
.history-check { width: 32px; height: 32px; margin: 0 auto; border: 1px solid #cdd4dc; border-radius: 50%; background: #fff; }
.history-check.checked { border-color: #26a269; background: #26a269; color: #fff; }
.history-set-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.history-set-actions button { min-height: 38px; border: 1px dashed #9ec6ff; border-radius: 10px; background: #f2f7ff; color: #1677ff; font-size: 12px; font-weight: 750; }
.history-set-actions button:disabled { opacity: 0.4; }
.history-result { color: #8a949f; }
.history-result.done { color: #228b57; }
.history-merged-row { margin-top: 6px; padding: 9px 11px; border-radius: 9px; background: #fff; color: #26323e; font-size: 12px; font-weight: 700; }
.history-add-record { width: calc(100% - 20px); min-height: 42px; margin: 0 10px 9px; border: 1px dashed #9ec6ff; border-radius: 11px; background: #f2f7ff; color: #1677ff; font-weight: 750; }
.history-edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 0 10px 12px; }
.history-edit-actions button { min-height: 44px; border: 0; border-radius: 12px; font-weight: 750; }
.history-edit-actions button:first-child { background: #eef1f5; color: #34404c; }
.history-edit-actions button:last-child { background: #1677ff; color: #fff; }
.catalog-list section + section { margin-top: 18px; }
.action-primary-tabs, .plan-day-tabs { display: grid; gap: 4px; padding: 4px; border-radius: 14px; background: #eef2f6; }
.action-primary-tabs { grid-template-columns: 1fr 1fr; margin-top: 16px; }
.plan-day-tabs { grid-template-columns: repeat(3, 1fr); margin-top: 9px; }
.plan-day-tabs[hidden] { display: none; }
.action-primary-tabs button, .plan-day-tabs button { min-height: 40px; border: 0; border-radius: 11px; background: transparent; color: #697582; font-weight: 750; }
.plan-day-tabs button { min-height: 34px; font-size: 13px; border-radius: 9px; }
#add-exercise[hidden] { display: none; }
.action-primary-tabs button.active, .plan-day-tabs button.active { background: #fff; color: #17212b; box-shadow: 0 3px 12px rgba(23, 33, 43, 0.1); }
.exercise-library-group { padding-top: 2px; }
.exercise-library-group .library-item { padding-left: 14px; }
.catalog-list h3 { margin: 4px 0 8px; color: #17212b; font-size: 15px; }
.catalog-list .configured-day > h3 { font-size: 18px; }
.catalog-list h3 span { margin-left: 5px; color: #697582; font-size: 11px; font-weight: 500; }
.catalog-list h4 { margin: 12px 3px 6px; color: #697582; font-size: 11px; }
.catalog-item { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 13px; border-radius: 12px; background: #f5f7fa; transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms ease, background-color 180ms ease, opacity 180ms ease; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#actions-view { overflow-anchor: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#actions-view *:not(input):not(select):not(option) { caret-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.catalog-item + .catalog-item { margin-top: 6px; }
.catalog-item > div:first-of-type { flex: 1; min-width: 0; }
.catalog-item strong, .catalog-item small { display: block; }
.catalog-item small { margin-top: 4px; color: #697582; font-size: 11px; }
.catalog-item > button, .catalog-actions button { min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: #e6ebf1; color: #34404c; font-size: 12px; }
.catalog-actions { display: flex; flex: 0 0 auto; gap: 5px; }
.catalog-actions button:disabled { opacity: 0.3; }
.catalog-item .drag-handle { flex: 0 0 34px; width: 34px; min-height: 42px; padding: 0; background: transparent; color: #8a949f; font-size: 18px; cursor: grab; touch-action: none; transition: color 160ms ease, transform 160ms ease; }
.catalog-item.dragging { position: fixed; z-index: 60; margin: 0; pointer-events: none; opacity: 0.97; transform: scale(1.025); box-shadow: 0 18px 38px rgba(23, 33, 43, 0.22); transition: top 150ms cubic-bezier(0.22, 1, 0.36, 1), left 150ms cubic-bezier(0.22, 1, 0.36, 1), width 150ms cubic-bezier(0.22, 1, 0.36, 1), transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease; }
.catalog-item.dragging .drag-handle { color: #1677ff; transform: scale(1.08); cursor: grabbing; }
.catalog-item.dragging.dropping { transform: scale(1); box-shadow: 0 5px 15px rgba(23, 33, 43, 0.1); }
.catalog-item.drag-target { z-index: 2; background: #eaf3ff; box-shadow: 0 8px 20px rgba(22, 119, 255, 0.14); }
.catalog-drag-placeholder { min-height: 42px; border: 2px dashed #9ec6ff; background: #edf5ff; box-shadow: inset 0 0 0 1px rgba(22, 119, 255, 0.05); }
.catalog-drag-placeholder > * { visibility: hidden; }
.is-sorting { cursor: grabbing; }
.is-sorting .catalog-item:not(.dragging) { transition-duration: 150ms; }
.disabled-item { opacity: 0.62; }

@media (prefers-reduced-motion: reduce) {
  .catalog-item, .catalog-item .drag-handle { transition-duration: 0.01ms !important; }
}

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 18px; }
.stats-grid div { padding: 14px 8px; border-radius: 14px; background: #f5f7fa; text-align: center; }
.stats-grid span, .stats-grid strong { display: block; }
.stats-grid span { color: #697582; font-size: 11px; }
.stats-grid strong { margin-top: 7px; font-size: 24px; }
.stat-section { margin-top: 22px; padding-top: 20px; border-top: 1px solid #edf0f3; }
.stat-section:first-child { margin-top: 16px; padding-top: 0; border-top: 0; }
.stats-primary-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 16px; padding: 4px; border-radius: 14px; background: #eef2f6; }
.stats-primary-tabs[hidden] { display: none; }
.stats-primary-tabs button { min-height: 42px; border: 0; border-radius: 11px; background: transparent; color: #697582; font-weight: 700; }
.stats-primary-tabs button.active { background: #fff; color: #17212b; box-shadow: 0 3px 12px rgba(23, 33, 43, 0.1); }
.stat-section h3 { margin: 0; font-size: 16px; }
.trend-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.trend-section-heading h3 { min-width: 0; }
.trend-range-switch { display: grid; grid-template-columns: 1fr 1fr; flex: 0 0 108px; gap: 3px; padding: 3px; border-radius: 10px; background: #eef2f6; }
.trend-range-switch button { min-height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #697582; font-size: 11px; font-weight: 750; }
.trend-range-switch button.active { background: #fff; color: #1677ff; box-shadow: 0 2px 8px rgba(23, 33, 43, 0.1); }
.decline-list { display: grid; gap: 7px; margin-top: 12px; }
.decline-list > p:not(.empty-chart) { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 12px 13px; border-radius: 12px; background: #f5f7fa; }
.decline-list strong { font-size: 12px; }
.decline-list span { color: #697582; font-size: 11px; text-align: right; }
.trend-svg { display: block; width: 100%; height: auto; margin-top: 10px; overflow: visible; }
.empty-chart { padding: 30px 10px; border-radius: 14px; background: #f5f7fa; color: #697582; text-align: center; }
.chart-note { margin: 7px 0 0; color: #697582; font-size: 10px; line-height: 1.5; }
.exercise-trend-list { display: grid; gap: 12px; margin-top: 12px; }
.exercise-trend-group { display: grid; gap: 9px; }
.exercise-trend-group > h4 { margin: 5px 2px 0; color: #697582; font-size: 12px; }
.exercise-trend-card { padding: 13px; border-radius: 14px; background: #f5f7fa; }
.exercise-trend-card h5, .exercise-trend-card p { margin: 0; }
.exercise-trend-card h5 { font-size: 14px; }
.exercise-trend-card p { margin-top: 4px; color: #697582; font-size: 10px; }
.exercise-trend-card .trend-svg { margin-top: 5px; }
.body-indices { display: grid; gap: 10px; margin-top: 14px; }
.body-indices > div { display: grid; grid-template-columns: 40px 1fr 38px; align-items: center; gap: 8px; font-size: 11px; }
.body-indices progress { width: 100%; height: 9px; border: 0; border-radius: 999px; overflow: hidden; background: #e8edf2; }
.body-indices progress::-webkit-progress-bar { background: #e8edf2; }
.body-indices progress::-webkit-progress-value { border-radius: 999px; background: #1677ff; }
.body-indices strong { text-align: right; }
.weakness-card { margin-top: 16px; padding: 14px; border-radius: 14px; background: #f5f7fa; }
.weakness-card strong { font-size: 12px; }
.weakness-card p { margin: 7px 0 0; color: #697582; font-size: 11px; line-height: 1.5; }
.nutrition-trends, .nutrition-record, .nutrition-manage { margin-top: 20px; padding-top: 18px; border-top: 1px solid #edf0f3; }
.nutrition-trends { padding-top: 0; border-top: 0; }
.nutrition-trends > h3, .nutrition-record h3, .nutrition-manage h3 { margin: 0; font-size: 16px; }
.nutrition-trends > article { margin-top: 12px; padding: 13px; border-radius: 14px; background: #f5f7fa; }
.nutrition-trends > article > div { display: flex; justify-content: space-between; }
.nutrition-trends > article strong { font-size: 13px; }
.nutrition-trends > article span { color: #697582; font-size: 10px; }
.nutrition-overage-card { margin-top: 12px; padding: 13px; border-radius: 14px; background: #f5f7fa; }
.nutrition-overage-card h4, .nutrition-overage-card p { margin: 0; }
.nutrition-overage-card h4 { font-size: 13px; }
.nutrition-mean { margin-top: 6px !important; color: #697582; font-size: 11px; }
.nutrition-overage { display: grid; gap: 7px; }
.nutrition-overage > p:not(.nutrition-mean):not(.empty-chart) { display: grid; grid-template-columns: 72px 1fr; gap: 8px; padding-top: 8px; border-top: 1px solid #e5eaf0; }
.nutrition-overage > p strong { font-size: 11px; }
.nutrition-overage > p span { color: #56616d; font-size: 10px; line-height: 1.45; }
.nutrition-trend { margin-top: 2px; }
.nutrition-start, .nutrition-save { width: 100%; margin-top: 16px; }
.nutrition-meal { margin-top: 10px; padding: 13px; border-radius: 14px; background: #f5f7fa; }
.nutrition-meal.skipped { opacity: 0.65; }
.nutrition-meal-filter { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.nutrition-meal-filter button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 9px; background: #eef2f6; color: #596675; font-size: 12px; }
.nutrition-meal-filter button[aria-pressed="true"] { background: #e5efff; color: #0868e4; font-weight: 700; }
.nutrition-meal-heading, .nutrition-meal-heading > div, .nutrition-food-row > div:first-child { min-width: 0; }
.nutrition-meal-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.nutrition-meal-heading strong, .nutrition-meal-heading span, .nutrition-food-row strong, .nutrition-food-row span { display: block; }
.nutrition-meal-heading strong { font-size: 16px; }
.nutrition-meal-heading span, .nutrition-food-row span { margin-top: 3px; color: #697582; font-size: 10px; }
.nutrition-meal-heading button, .add-meal-food, .nutrition-manage button, .food-catalog button { min-height: 36px; padding: 0 11px; border: 0; border-radius: 9px; background: #e7edf4; color: #1677ff; font-weight: 700; }
.nutrition-meal-heading button { font-size: 11px; }
.nutrition-food-rows { margin: 10px 0 0 3px; padding-left: 8px; border-left: 3px solid #d9e8ff; }
.nutrition-food-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid #e3e8ed; }
.nutrition-food-row:first-child { border-top: 0; }
.nutrition-food-row strong { color: #374351; font-size: 13px; }
.food-quantity { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
.food-quantity button { display: inline-flex; width: 32px; height: 32px; min-height: 0; align-items: center; justify-content: center; padding: 0; border-radius: 50%; line-height: 1; }
.food-quantity span { min-width: 34px; margin: 0; text-align: center; }
.food-quantity .delete { width: auto; min-width: 34px; padding: 0 5px; border-radius: 8px; white-space: nowrap; font-size: 10px; }
.food-quantity .delete, .food-catalog .delete { color: #b42318; }
.add-meal-food { width: 100%; margin-top: 8px; border: 1px dashed #9ec6ff; background: #f2f7ff; }
.nutrition-table-wrap { margin-top: 14px; }
.nutrition-summary-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 9px; }
.calendar-nutrition-detail .nutrition-summary-table { font-size: 11px; }
.nutrition-summary-table th, .nutrition-summary-table td { padding: 8px 2px; border-bottom: 1px solid #e7ebef; text-align: right; white-space: nowrap; }
.nutrition-summary-table th:first-child { width: 24%; }
.nutrition-summary-table th:first-child { text-align: left; }
.nutrition-summary-table thead th { color: #697582; font-weight: 600; }
.nutrition-summary-table tbody th { font-weight: 700; }
.nutrition-summary-table .total { background: #eef5ff; }
.nutrition-entry-list { display: grid; gap: 2px; }
.nutrition-entry-list > button { display: flex; width: 100%; min-height: 64px; align-items: center; justify-content: space-between; padding: 10px 2px; border-radius: 0; border-bottom: 1px solid #edf0f3; background: transparent; color: #17212b; text-align: left; }
.nutrition-entry-list > button span, .nutrition-entry-list > button strong, .nutrition-entry-list > button small { display: block; }
.nutrition-entry-list > button strong { font-size: 14px; }
.nutrition-entry-list > button small { margin-top: 4px; color: #697582; font-size: 10px; font-weight: 500; }
.nutrition-entry-list > button b { color: #8a949f; font-size: 22px; }
.nutrition-edit-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }
.nutrition-edit-actions button { width: 100%; }
.inventory-monitor-option { display: flex !important; align-items: center; gap: 8px; min-height: 44px; }
.inventory-monitor-option input { width: 20px; height: 20px; margin: 0; accent-color: #1677ff; }
.food-catalog.inventory-list article { display: grid; grid-template-columns: minmax(0, 1fr) 90px auto; gap: 12px; padding: 18px 0; }
.inventory-list article > div { min-width: 0; overflow-wrap: anywhere; }
.inventory-list article > button { flex-shrink: 0; }
.inventory-actions { display: flex !important; align-items: center; gap: 5px; }
.inventory-actions button, .inventory-buy { min-height: 36px; padding: 0 10px; border: 0; border-radius: 9px; background: #e7edf4; color: #1677ff; font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.inventory-buy { display: inline-flex; align-items: center; }
.inventory-list strong { font-size: 14px; }
.inventory-list span { font-size: 12px; }
.inventory-food { position: relative; padding-right: 72px; }
.inventory-food > small { display: block; margin-top: 3px; color: #8a949f; font-size: 10px; line-height: 1.35; }
.inventory-quick { position: absolute; top: 0; right: 0; display: flex; gap: 4px; }
.nutrition-subpage .inventory-quick button { width: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 50%; background: #e7edf4; color: #1677ff; font-size: 18px; font-weight: 650; line-height: 30px; }
.nutrition-subpage .inventory-quick button:disabled { cursor: not-allowed; opacity: .45; }
.inventory-gauge { position: relative; padding: 8px 0; }
.inventory-track { position: relative; height: 8px; border-radius: 8px; background: #e9edf1; }
.inventory-fill { display: block; height: 100%; border-radius: inherit; background: #6ca5a4; }
.inventory-warning { position: absolute; top: -4px; width: 2px; height: 16px; transform: translateX(-1px); background: #e98a31; }
.inventory-status { position: absolute; top: 22px; left: 0; width: 100%; color: #697582; font-size: 11px; text-align: center; white-space: nowrap; }
.inventory-gauge.low .inventory-fill { background: #ed913e; }
.inventory-gauge.low .inventory-status { color: #b65f12; }
.inventory-legend { display: flex; align-items: center; gap: 7px; margin-top: 16px; color: #697582; font-size: 11px; }
.inventory-legend > i { flex: 0 0 2px; height: 14px; background: #e98a31; }
.inventory-legend > span { flex: 1; color: #8a949f; }
@media (max-width: 374px) { .food-catalog.inventory-list article { grid-template-columns: minmax(0, 1fr) 68px auto; gap: 8px; } }
.nutrition-subpage { margin-top: 4px; }
.nutrition-subpage-active > .page-card > h2 { position: sticky; z-index: 12; top: env(safe-area-inset-top); margin: -22px -20px 0; padding: 18px 20px 10px; background: #fff; }
.nutrition-plan-sticky { position: sticky; z-index: 11; top: calc(env(safe-area-inset-top) + 53px); margin: 0 -20px; padding: 0 20px 10px; background: #fff; box-shadow: 0 7px 12px -13px rgba(23, 33, 43, 0.4); }
.nutrition-plan-sticky .nutrition-subpage-header { margin: 0; }
.nutrition-plan-sticky > .chart-note { margin-top: 2px; }
.nutrition-subpage-header { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; min-height: 44px; }
.nutrition-subpage-header h3 { margin: 0; font-size: 17px; text-align: center; }
.nutrition-subpage-header button { min-height: 40px; padding: 0; border: 0; background: transparent; color: #1677ff; font-weight: 700; text-align: left; }
.nutrition-subpage > .chart-note { margin-top: 8px; }
.nutrition-subpage > .section-heading { margin-top: 14px; }
.nutrition-subpage > .section-heading p { margin: 0; color: #697582; font-size: 11px; }
.nutrition-subpage > .section-heading button, .nutrition-subpage .meal-plan-row button, .nutrition-subpage .food-category-tabs button, .nutrition-subpage .food-catalog button { min-height: 36px; padding: 0 11px; border: 0; border-radius: 9px; background: #e7edf4; color: #1677ff; font-size: 12px; font-weight: 700; }
.meal-plan-list { margin-top: 12px; }
.meal-plan-row, .food-catalog article { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 58px; border-bottom: 1px solid #edf0f3; }
.meal-plan-row { display: block; padding: 14px 0; }
.meal-plan-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.meal-plan-row strong, .meal-plan-row span, .food-catalog strong, .food-catalog span { display: block; }
.meal-plan-row > .meal-plan-heading > strong { color: #17212b; font-size: 16px; }
.food-catalog strong { font-size: 12px; }
.meal-plan-row span, .food-catalog span { margin-top: 4px; color: #697582; font-size: 10px; line-height: 1.45; }
.meal-plan-default-foods { display: grid; margin: 10px 0 0 5px; padding-left: 12px; border-left: 3px solid #d9e8ff; }
.meal-plan-default-foods span { margin-top: 0; padding: 8px 0; font-size: 11px; }
.meal-plan-default-foods span + span { border-top: 1px solid #edf0f3; }
.meal-plan-default-foods b, .meal-plan-default-foods small { display: block; }
.meal-plan-default-foods b { color: #374351; font-size: 13px; }
.meal-plan-default-foods small { margin-top: 3px; color: #697582; font-size: 11px; font-weight: 500; }
.meal-plan-empty { margin: 9px 0 0 17px; color: #8a949f; font-size: 11px; }
.food-category-tabs { display: flex; gap: 7px; margin-top: 13px; }
.food-category-tabs button { flex: 1; background: #eef2f6; color: #596675; }
.food-category-tabs button.active { background: #1677ff; color: #fff; }
#meal-food-filters { margin: 0 0 12px; }
#meal-food-sheet { align-items: flex-start; padding-top: max(18px, env(safe-area-inset-top)); }
#meal-food-sheet .editor-sheet { max-height: 100%; overflow-anchor: none; }
#meal-food-filters button { min-height: 40px; padding: 0 8px; border: 0; border-radius: 9px; font-size: 14px; white-space: nowrap; }
#meal-food-list .meal-plan-food[hidden], #meal-food-empty[hidden] { display: none; }
.food-catalog article > div:last-child { display: flex; flex: 0 0 auto; gap: 5px; }
.calendar-nutrition-summary { display: grid; width: 100%; gap: 4px; margin-top: 12px; padding: 14px; border: 0; border-radius: 14px; background: #eef5ff; color: #17212b; text-align: left; }
.calendar-nutrition-summary strong { font-size: 13px; }
.calendar-nutrition-summary span { font-size: 11px; line-height: 1.5; }
.calendar-nutrition-summary small { color: #1677ff; }
.calendar-nutrition-empty { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: #f5f7fa; color: #697582; font-size: 11px; text-align: center; }
.stack-actions { display: grid; gap: 10px; margin-top: 20px; }
.reset-today-button { border-color: #f0b7b7; color: #b42318; }
.database-info { margin: 20px 0 0; }
.database-info div { display: flex; justify-content: space-between; padding: 11px 2px; border-bottom: 1px solid #eceff2; }
.database-info dt { color: #697582; }
.database-info dd { margin: 0; font-weight: 650; }
.history-add-field { display: grid; gap: 7px; margin: 17px 0 10px; color: #697582; font-size: 12px; font-weight: 650; }
.history-add-field select { width: 100%; min-height: 44px; padding: 0 10px; border: 1px solid #dce1e6; border-radius: 11px; background: #fff; color: #17212b; }

body.sheet-open { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }
.sheet-backdrop { position: fixed; z-index: 30; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: rgba(23, 33, 43, 0.46); overscroll-behavior: contain; }
.sheet-backdrop[hidden] { display: none; }
#today-exercise-sheet { align-items: flex-start; padding-top: calc(18px + env(safe-area-inset-top)); }
.confirm-sheet { width: min(100%, 560px); padding: 22px; border-radius: 23px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); }
.confirm-sheet h2 { margin: 0; font-size: 21px; }
.finish-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.finish-summary div { padding: 12px 5px; border-radius: 12px; background: #f5f7fa; text-align: center; }
.finish-summary dt { color: #697582; font-size: 11px; }
.finish-summary dd { margin: 5px 0 0; font-size: 22px; font-weight: 750; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.plan-switch-options { display: grid; gap: 8px; margin: 17px 0; }
.plan-switch-option { display: grid; grid-template-columns: 24px 1fr; align-items: center; gap: 10px; min-height: 58px; padding: 10px 12px; border-radius: 13px; background: #f5f7fa; }
.plan-switch-option:has(input:checked) { background: #eaf3ff; box-shadow: inset 0 0 0 1px #8fc1ff; }
.plan-switch-option input { width: 21px; height: 21px; }
.plan-switch-option strong, .plan-switch-option small { display: block; }
.plan-switch-option strong { font-size: 14px; }
.plan-switch-option small { margin-top: 4px; color: #697582; font-size: 11px; }
.editor-sheet { width: min(100%, 560px); max-height: calc(100dvh - 28px - env(safe-area-inset-top)); overflow-x: hidden; overflow-y: auto; padding: 22px; border-radius: 23px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2); overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.direct-exercise-sheet { display: flex; flex-direction: column; max-height: calc(100dvh - 36px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.direct-exercise-sheet #today-exercise-editor { min-height: 0; overflow-y: auto; }
.direct-exercise-sheet .workout-card { margin: 14px 0 0; padding: 18px 10px; box-shadow: none; }
.direct-exercise-sheet .sets-list { min-height: 260px; }
.direct-exercise-sheet [data-action="set-plan"] { display: none; }
.direct-exercise-actions { flex: 0 0 auto; grid-template-columns: 1fr; margin-top: 14px; }
.extra-sheet { display: flex; flex-direction: column; overflow: hidden; }
.extra-sheet .editor-heading p { margin: 5px 0 0; font-size: 11px; }
.extra-body-filter { display: flex; flex: 0 0 auto; gap: 7px; margin: 14px -6px 0; padding: 0 6px 5px; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.extra-body-filter::-webkit-scrollbar { display: none; }
.extra-body-filter button { flex: 0 0 auto; min-height: 34px; padding: 0 13px; border: 0; border-radius: 999px; background: #eef2f6; color: #596675; font-size: 12px; font-weight: 700; }
.extra-body-filter button.active { background: #1677ff; color: #fff; }
.extra-plan-toolbar { display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 10px; margin-top: 16px; }
.extra-plan-toolbar > div { text-align: center; }
.extra-plan-toolbar strong, .extra-plan-toolbar small { display: block; }
.extra-plan-toolbar small { margin-top: 4px; color: #697582; font-size: 11px; }
.extra-plan-toolbar button { width: 42px; height: 42px; border: 0; border-radius: 12px; background: #eef3f8; color: #1677ff; font-size: 25px; }
.extra-plan-list { display: grid; flex: 1 1 auto; gap: 13px; min-height: 0; margin: 16px -6px; padding: 0 6px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.extra-body-group h3 { margin: 0 0 7px; color: #697582; font-size: 12px; }
.extra-exercise-row { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 9px 11px; border-radius: 12px; background: #f5f7fa; }
.extra-exercise-row + .extra-exercise-row { margin-top: 6px; }
.extra-exercise-row input { flex: 0 0 auto; width: 22px; height: 22px; }
.extra-exercise-row span, .extra-exercise-row strong, .extra-exercise-row small { display: block; }
.extra-exercise-row span { min-width: 0; }
.extra-exercise-row strong { font-size: 13px; }
.extra-exercise-row small { margin-top: 4px; color: #697582; font-size: 10px; }
.extra-exercise-row.already-added { opacity: 0.58; }
.extra-workout-actions { display: grid; grid-template-columns: 1fr 1.2fr; gap: 9px; margin-top: 18px; }
.extra-workout-actions .finish-button { margin-top: 0; }
.cardio-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 14px; }
.cardio-fields label { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px; color: #697582; font-size: 11px; }
.cardio-fields input { grid-column: 1 / -1; width: 100%; min-width: 0; height: 42px; border: 1px solid #dce1e6; border-radius: 10px; background: #fff; text-align: center; font-size: 16px; }
.cardio-complete { width: 100%; min-height: 43px; margin-top: 10px; border: 0; border-radius: 11px; background: #e8edf3; color: #34404c; font-weight: 750; }
.cardio-complete.checked { background: #26a269; color: #fff; }
.history-cardio-row { display: grid; grid-template-columns: repeat(3, 1fr) 48px; align-items: end; gap: 6px; margin-top: 7px; padding: 8px; border-radius: 10px; background: #fff; }
.history-cardio-row label, .history-cardio-row label small, .history-cardio-row label span { display: block; }
.history-cardio-row label small { color: #697582; font-size: 9px; }
.history-cardio-row label span { margin-top: 5px; font-size: 11px; }
.history-cardio-row input { width: 100%; height: 31px; margin-top: 3px; padding: 0 3px; border: 1px solid #dce1e6; border-radius: 8px; text-align: center; }
.distance-history-row { grid-template-columns: 1fr 48px; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.editor-heading h2 { margin: 0; font-size: 21px; }
.text-button { padding: 8px; border: 0; background: transparent; color: #1677ff; }
#exercise-form > label, .field-grid label, .day-plan-row label { display: grid; gap: 6px; color: #697582; font-size: 12px; font-weight: 650; }
#exercise-form > label { margin-top: 16px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.cardio-defaults { margin-top: 12px; padding: 12px; border-radius: 14px; background: #f5f7fa; }
.cardio-defaults [hidden] { display: none !important; }
.cardio-defaults .field-grid { margin-top: 0; }
.cardio-defaults p { margin: 9px 0 0; font-size: 11px; }
#exercise-form input:not([type="checkbox"]), #exercise-form select { width: 100%; min-height: 43px; padding: 0 11px; border: 1px solid #dce1e6; border-radius: 11px; background: #fff; color: #17212b; font-size: 16px; }
#food-form > label, #food-form .field-grid label, .nutrition-field-grid label, #inventory-form label { display: grid; gap: 6px; color: #697582; font-size: 12px; font-weight: 650; }
#food-form > label, #inventory-form > label { margin-top: 15px; }
#food-form input:not([type="checkbox"]), #food-form select, #inventory-form input:not([type="hidden"]), #inventory-form select { width: 100%; min-height: 43px; padding: 0 11px; border: 1px solid #dce1e6; border-radius: 11px; background: #fff; color: #17212b; font-size: 16px; }
#inventory-custom-label[hidden] { display: none; }
.nutrition-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 17px; }
.meal-plan-foods { display: grid; gap: 7px; margin: 16px 0; }
.swap-actions, .swap-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.swap-actions > button, .swap-tabs > button { flex: 1; min-width: 80px; }
.swap-tabs [aria-pressed="true"] { background: #1677ff; color: white; }
#snack-sheet .editor-sheet { width: min(100% - 20px, 580px); overscroll-behavior: contain; }
#snack-content { min-width: 0; overflow-wrap: anywhere; }
#snack-content .editor-heading { position: sticky; top: 0; background: white; z-index: 1; padding: 8px 0; }
#snack-content label, .explicit-eaten { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0; }
#snack-content input[type="checkbox"], .explicit-eaten input[type="checkbox"] { width: 22px; height: 22px; flex: none; }
#snack-content input[type="number"], .explicit-eaten input[type="number"] { width: 80px; min-width: 0; min-height: 44px; padding: 8px; font-size: 16px; text-align: center; }
#snack-content select { width: 100%; min-width: 0; font-size: 16px; }
#snack-content button { min-height: 44px; white-space: normal; border: 0; border-radius: 10px; padding: 10px 12px; font: inherit; background: #edf2f8; color: #1769c6; }
#snack-content button.primary-button, #snack-content button[aria-pressed="true"] { background: #1677ff; color: white; }
.swap-amount { display: flex; gap: 6px; align-items: center; justify-content: space-between; }
.swap-amount label { flex: 1; justify-content: center; }
.swap-food { border-top: 1px solid #e2e8ef; padding: 12px 0; }
.swap-meal, .swap-summary { padding: 12px; border-radius: 12px; background: #f3f6fa; margin: 12px 0; }
.swap-error { color: #b42318; }
.meal-plan-food { display: grid; grid-template-columns: 24px 1fr 65px; align-items: center; gap: 8px; min-height: 52px; padding: 9px 11px; border-radius: 12px; background: #f5f7fa; }
.meal-plan-food.has-stepper { grid-template-columns: 24px minmax(70px, 1fr) 112px; }
.meal-plan-food input[type="checkbox"] { width: 21px; height: 21px; }
.meal-plan-food input[type="number"] { width: 65px; min-height: 38px; border: 1px solid #dce1e6; border-radius: 9px; text-align: center; font-size: 16px; }
.meal-plan-food-label { min-width: 0; }
.meal-plan-food-label strong, .meal-plan-food-label small { display: block; }
.meal-plan-food-label strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.meal-plan-food-label small { margin-top: 4px; color: #697582; font-size: 10px; white-space: nowrap; }
.meal-plan-quantity { display: grid; grid-template-columns: 32px 1fr 32px; align-items: center; gap: 3px; }
.meal-plan-quantity button { display: grid; width: 32px; height: 32px; place-items: center; padding: 0; border: 0; border-radius: 50%; background: #e7edf4; color: #1677ff; font-size: 18px; line-height: 1; }
.meal-plan-quantity span { color: #596675; font-size: 11px; text-align: center; white-space: nowrap; }
.meal-plan-food.gram-selector { grid-template-columns: 24px minmax(0, 1fr) 144px; }
.gram-selector .meal-plan-quantity { grid-column: 3; grid-template-columns: 32px 72px 32px; gap: 4px; }
.gram-selector .meal-plan-food-label small { white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
.gram-selector .gram-input { display: flex; align-items: center; gap: 5px; margin: 0; }
.gram-selector .gram-input input { width: 56px; min-width: 0; padding: 8px 4px; text-align: center; font-size: 16px; appearance: textfield; }
.gram-selector .gram-input input::-webkit-inner-spin-button, .gram-selector .gram-input input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.meal-plan-total-weight { margin: -3px 0 14px; padding: 11px 13px; border-radius: 11px; background: #eef5ff; color: #17212b; font-size: 13px; font-weight: 750; text-align: right; }
.toggle-label { display: flex !important; align-items: center; justify-content: space-between; min-height: 43px; padding: 0 11px; border-radius: 11px; background: #f5f7fa; color: #17212b !important; }
.toggle-label input, .day-check input { width: 21px; height: 21px; }
.day-plan-fields { margin: 17px 0; padding: 0; border: 0; }
.day-plan-fields legend { font-size: 14px; font-weight: 750; }
.day-plan-fields > p { margin: 5px 0 11px; font-size: 11px; }
.day-plan-row { display: grid; grid-template-columns: 1.25fr repeat(3, minmax(54px, 0.8fr)); gap: 7px; padding: 10px; border-radius: 13px; background: #f5f7fa; }
.day-plan-row + .day-plan-row { margin-top: 7px; }
.day-check { display: flex !important; align-items: center; gap: 7px !important; color: #17212b !important; }
.day-plan-row input:not([type="checkbox"]) { min-height: 37px !important; padding: 0 5px !important; text-align: center; }
.field-disabled { opacity: 0.38; }

.tab-bar { position: fixed; z-index: 20; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(5, 1fr); min-height: calc(64px + env(safe-area-inset-bottom)); padding: 7px max(6px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(6px, env(safe-area-inset-left)); border-top: 1px solid rgba(23, 33, 43, 0.09); background: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 49px; padding: 0; border: 0; background: transparent; color: #8a949f; font-size: 10px; }
.tab span { height: 19px; font-size: 17px; line-height: 19px; }
.tab.active { color: #1677ff; font-weight: 750; }

.toast { position: fixed; z-index: 40; bottom: calc(82px + env(safe-area-inset-bottom)); left: 50%; width: max-content; max-width: calc(100vw - 36px); box-sizing: border-box; padding: 12px 2em; border-radius: 13px; background: rgba(23, 33, 43, 0.93); color: #fff; font-size: 13px; text-align: center; opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity 150ms ease, transform 150ms ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(22, 119, 255, 0.35); outline-offset: 2px; }

@media (max-width: 370px) {
  .app-shell { padding-right: 11px; padding-left: 11px; }
  .direct-exercise-sheet { padding-right: 12px; padding-left: 12px; }
  .direct-exercise-sheet .workout-card { padding-right: 8px; padding-left: 8px; }
  .set-heading, .set-row { grid-template-columns: 20px minmax(128px, 1.5fr) minmax(86px, 1fr) 42px; gap: 3px; }
  .stepper { grid-template-columns: 39px minmax(42px, 64px) 39px; gap: 2px; }
  .reps-stepper { grid-template-columns: 27px minmax(28px, 44px) 27px; }
  .set-check { width: 42px; height: 42px; }
  .set-check::before { width: 36px; height: 36px; }
  .day-plan-row { grid-template-columns: 1fr repeat(3, 52px); gap: 4px; padding: 8px 6px; }
}

@media (min-width: 700px) {
  .tab-bar { right: 50%; left: auto; width: 620px; transform: translateX(50%); border-right: 1px solid rgba(23, 33, 43, 0.09); border-left: 1px solid rgba(23, 33, 43, 0.09); border-radius: 20px 20px 0 0; }
}
