/* Progress, goals, photos, food, community and achievements.
 *
 * Same tokens as styles.css, so both themes and both directions work
 * unchanged. Mobile first: nothing here scrolls sideways, every control is
 * at least 40px tall, and wide layouts only add columns.
 */

.line { display: block; }
.end { align-items: flex-end; }
.wrap { flex-wrap: wrap; }
.ok-text { color: var(--ok); font-weight: 600; }
.chip.static { cursor: default; min-height: 32px; padding: 4px 12px; }
.chip[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.qty { width: 5.5em; min-width: 0; }
.toggle-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; min-height: 40px; cursor: pointer; }
.toggle-row input { margin-block-start: 3px; width: 20px; height: 20px; flex: none; accent-color: var(--accent); }
.choice-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); cursor: pointer; }
.choice-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice-row input { margin-block-start: 4px; accent-color: var(--accent); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; margin-block-end: 8px; }
.link-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.link-card:hover { border-color: var(--accent); }

/* Section links under a title: wrap, never scroll sideways. */
.life-subnav { display: flex; flex-wrap: wrap; gap: 6px; margin-block-end: var(--gap); }
.life-subnav-item {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); text-decoration: none; font-size: 0.88rem; font-weight: 600; min-height: 36px; display: inline-flex; align-items: center;
}
.life-subnav-item[aria-current='page'] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin-block: 8px; }
.segmented-item {
  flex: 1 1 auto; min-height: 36px; padding: 6px 10px; border-radius: 9px; background: transparent; border: 0; box-shadow: none;
  color: var(--text-dim); font-weight: 600; font-size: 0.85rem;
}
.segmented-item[aria-checked='true'] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* Charts over dates */
.dated-chart svg { width: 100%; display: block; }
.dated-axis { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-faint); margin-block-start: 4px; }
.chart-controls { display: flex; flex-direction: column; gap: 6px; margin-block-end: 8px; }
.chart-controls .chips { gap: 6px; }
.chart-controls .chip { min-height: 34px; padding: 4px 12px; font-size: 0.82rem; }

/* Summary */
.summary-list { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.summary-line { padding-inline-start: 14px; position: relative; }
.summary-line::before { content: ''; position: absolute; inset-inline-start: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.summary-line.down::before { background: var(--ok); }
.summary-line.stable::before { background: var(--text-faint); }
.pill.confidence-low { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.pill.confidence-medium { color: var(--accent); background: var(--accent-soft); }
.pill.confidence-high { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }

/* Goals */
.goal-list { display: flex; flex-direction: column; gap: 10px; }
.goal-card { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
.goal-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.goal-bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ok))); transition: width 0.6s var(--ease); }
[dir='rtl'] .goal-bar > span { background: linear-gradient(270deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ok))); }
.goal-numbers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.goal-numbers > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.goal-numbers b { font-size: 0.92rem; overflow-wrap: anywhere; }
.pill.goal-achieved { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.pill.goal-paused { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.pill.pr { color: #b45309; background: color-mix(in srgb, #f59e0b 16%, transparent); }
.pill.adjusted { color: var(--accent); background: var(--accent-soft); margin-inline-start: 6px; }
.pill.estimate { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* Photos */
.photo-preview img, .photo-options-img { max-width: 100%; max-height: 50vh; border-radius: var(--radius-s); display: block; margin-inline: auto; }
.photo-session { padding-block: 10px; border-block-start: 1px solid var(--border); }
.photo-session:first-of-type { border-block-start: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block-start: 8px; }
.photo-tile { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.photo-tag { position: absolute; inset-block-end: 6px; inset-inline-start: 6px; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: rgb(0 0 0 / 0.55); color: #fff; }
.photo-lock { position: absolute; inset-block-start: 6px; inset-inline-start: 6px; font-size: 0.8rem; }
.photo-comments { position: absolute; inset-block-start: 6px; inset-inline-end: 38px; font-size: 0.72rem; background: rgb(0 0 0 / 0.55); color: #fff; border-radius: 999px; padding: 2px 6px; }
.photo-menu { position: absolute; inset-block-start: 4px; inset-inline-end: 4px; min-height: 30px; min-width: 30px; padding: 0; background: rgb(0 0 0 / 0.45); color: #fff; border: 0; border-radius: 50%; }
.photo-full { position: fixed; inset: 0; z-index: 90; background: rgb(0 0 0 / 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; }
.photo-full img { max-width: 100%; max-height: 82vh; object-fit: contain; }
.photo-full-caption { color: #fff; margin-block-start: 10px; font-size: 0.9rem; }
.photo-full-close { position: absolute; inset-block-start: max(12px, env(safe-area-inset-top)); inset-inline-end: 12px; min-width: 44px; min-height: 44px; border-radius: 50%; font-size: 1.6rem; background: rgb(255 255 255 / 0.15); color: #fff; border: 0; }
.compare-stage { margin-block: 10px; }
.compare-side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare-photo { margin: 0; }
.compare-photo img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; cursor: zoom-in; display: block; background: var(--surface-2); }
.compare-photo figcaption { margin-block-start: 4px; color: var(--text-dim); }
.compare-slider { position: relative; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-2); max-width: 520px; margin-inline: auto; }
.compare-slider > img, .compare-top { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare-divider { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgb(0 0 0 / 0.4); pointer-events: none; }
.compare-card input[type='range'] { width: 100%; margin-block: 10px; accent-color: var(--accent); }

/* Strength */
.lift-card { border-block-start: 1px solid var(--border); padding-block: 12px; display: flex; flex-direction: column; gap: 6px; }
.lift-card:first-of-type { border-block-start: 0; }
.lift-log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.lift-log li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Cycle calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-block: 10px; }
.cal-head { text-align: center; font-size: 0.75rem; color: var(--text-faint); }
.cal-cell { aspect-ratio: 1; min-height: 36px; border-radius: 10px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); padding: 0; font-size: 0.85rem; box-shadow: none; }
.cal-cell.empty { background: transparent; }
.cal-cell.period { background: color-mix(in srgb, #e11d48 22%, var(--surface)); }
.cal-cell.predicted { border: 1.5px dashed #e11d48; background: transparent; }
.cal-cell.logged { font-weight: 700; }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-cell:disabled { opacity: 0.45; }
.cal-legend { display: flex; align-items: center; gap: 6px; color: var(--text-dim); }
.cal-key { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.cal-key.period { background: color-mix(in srgb, #e11d48 40%, var(--surface)); }
.cal-key.predicted { border: 1.5px dashed #e11d48; }

/* Food */
.food-items { display: flex; flex-direction: column; gap: 8px; }
.food-item { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.food-item.needs-input { border-color: var(--warn); }
.food-item input[type='text']:first-child { flex: 1; min-width: 0; }
.food-amount select { width: auto; }
.food-kcal { display: inline-flex; align-items: center; gap: 4px; }
.food-total { font-size: 1rem; margin: 4px 0; }
.food-estimate-note { font-weight: 600; margin: 8px 0 4px; }
.food-photo-preview { max-width: 100%; max-height: 220px; border-radius: 12px; display: block; }
.day-nav { margin-block-end: var(--gap); }
.diary-planned, .diary-log { padding-block: 8px; border-block-start: 1px solid var(--border); }
.diary-items { margin: 4px 0; padding-inline-start: 18px; font-size: 0.9rem; }
.shop-group h3 { font-size: 0.9rem; color: var(--text-dim); margin: 14px 0 6px; }
.shop-list { list-style: none; padding: 0; margin: 0; }
.shop-item { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-block-end: 1px solid var(--border); }
.shop-item.checked .shop-check span { text-decoration: line-through; color: var(--text-faint); }
.shop-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; min-height: 40px; }
.shop-check input { width: 22px; height: 22px; accent-color: var(--ok); flex: none; }
.shop-qty { display: inline-flex; align-items: center; gap: 4px; }
.shop-add { margin-block-start: 12px; }
.shop-add input { flex: 1 1 10em; min-width: 0; }

/* Today */
.today-extras { display: flex; flex-direction: column; gap: 8px; }
.extra-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-height: 40px; }
.extra-label { font-weight: 600; min-width: 7.5em; }

/* Workout adjustment */
.adjust-options { display: flex; flex-direction: column; gap: 8px; }
.option-button, .alt-option {
  text-align: start; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-s); border: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
}
.option-button:hover, .alt-option:hover { border-color: var(--accent); }
.adapt-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.adapt-list { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; }
.adapt-list li { display: flex; flex-direction: column; }
.adapt-list li.replaced { color: var(--accent); }
.adapt-proposal { border-color: var(--accent); }

/* Community */
.community-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-block-end: var(--gap); }
.community-tile {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); text-decoration: none; color: inherit; box-shadow: var(--shadow); min-height: 108px;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease);
}
.community-tile:active { transform: scale(0.98); }
.community-tile:hover { border-color: var(--accent); }
.community-tile .badge { position: absolute; inset-block-start: 10px; inset-inline-end: 10px; }
.community-tile-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); }
.community-tile.messages .community-tile-icon { background: color-mix(in srgb, #0ea5e9 18%, transparent); }
.community-tile.friends .community-tile-icon { background: color-mix(in srgb, #10b981 18%, transparent); }
.community-tile.challenges .community-tile-icon { background: color-mix(in srgb, #f59e0b 20%, transparent); }
.community-tile.achievements .community-tile-icon { background: color-mix(in srgb, #a855f7 18%, transparent); }
.community-tile.discover .community-tile-icon { background: color-mix(in srgb, #ec4899 16%, transparent); }
.level-card { display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; }
.member-list { display: flex; flex-direction: column; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-block-end: 1px solid var(--border); text-decoration: none; color: inherit; min-height: 56px; }
.member-id { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.member-id span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; flex: none; background: var(--accent-soft); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.member-avatar.large { width: 72px; height: 72px; font-size: 1.6rem; }
.member-profile h2 { margin: 0 0 4px; }
.dm-card { display: flex; flex-direction: column; gap: 10px; }
.dm-thread { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; padding: 4px; }
.dm { max-width: 82%; padding: 8px 12px; border-radius: 16px; background: var(--surface-2); align-self: flex-start; }
.dm.mine { align-self: flex-end; background: var(--accent); color: var(--accent-text); }
.dm p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dm-meta { display: block; font-size: 0.72rem; opacity: 0.75; margin-block-start: 2px; }
.dm-composer { display: flex; gap: 8px; align-items: flex-end; }
.dm-composer textarea { flex: 1; min-width: 0; resize: vertical; }
button.link { background: none; border: 0; box-shadow: none; padding: 0; min-height: 0; color: inherit; text-decoration: underline; }
.challenge-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-s); text-decoration: none; color: inherit; background: var(--surface); }
.challenge-card.done { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.leaderboard { margin: 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.leaderboard li { padding: 6px 8px; border-radius: 8px; }
.leaderboard li > span:first-child { display: inline-block; max-width: 60%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.leaderboard li { display: list-item; }
.leaderboard li .row { float: inline-end; }
.leaderboard li.self { background: var(--accent-soft); }
.mission-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.mission-list li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.mission-list li.done { color: var(--ok); }

/* Achievements */
.medal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.medal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.medal-disc {
  width: 64px; height: 64px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.7rem;
  background: radial-gradient(circle at 30% 25%, #fff8, transparent 45%), var(--medal, var(--accent));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--medal, var(--accent)) 35%, transparent), inset 0 -3px 0 rgb(0 0 0 / 0.12);
  animation: medal-in 0.5s var(--ease) both;
}
.medal.small .medal-disc { width: 44px; height: 44px; font-size: 1.2rem; }
.medal-name { font-size: 0.8rem; font-weight: 600; line-height: 1.3; }
.medal.locked .medal-disc { filter: grayscale(1); opacity: 0.35; box-shadow: none; animation: none; }
.medal.locked .medal-name { color: var(--text-faint); }
.medal-toggle { display: flex; align-items: center; gap: 4px; }
.tone-indigo { --medal: #6366f1; } .tone-violet { --medal: #8b5cf6; } .tone-amber { --medal: #f59e0b; } .tone-green { --medal: #10b981; }
.tone-sky { --medal: #0ea5e9; } .tone-rose { --medal: #f43f5e; } .tone-teal { --medal: #14b8a6; } .tone-mint { --medal: #34d399; } .tone-gold { --medal: #eab308; }
@keyframes medal-in { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .medal-disc, .goal-bar > span { animation: none; transition: none; } }

@media (min-width: 720px) {
  .community-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .goal-numbers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adapt-columns { grid-template-columns: 1fr; }
}

/* ─────────────────────────── Today dashboard ───────────────────────────
 * Greeting, the day's score, what to do now, then the day's cards. One
 * accent for action; green only for done, amber only for late. Every offset
 * is logical, so Persian mirrors it without a second stylesheet.
 */
@property --p { syntax: '<number>'; inherits: false; initial-value: 0; }

.today-hero { align-items: flex-start; margin-block-end: 12px; }
.today-hero h1 { font-size: 1.7rem; }
.hero-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.hero-day { margin: 0; color: var(--text-dim); font-size: 0.95rem; display: flex; flex-wrap: wrap; gap: 0 8px; }
.hero-day .hero-date { color: var(--text-faint); }
.program-pill {
  align-self: flex-start; margin-block-start: 4px; padding: 5px 12px; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), color-mix(in srgb, var(--ok) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}

.today-hero .hero-text { flex: 1; }
.day-message { margin: -2px 0 14px; padding-inline-start: 12px; border-inline-start: 3px solid var(--accent); }
.day-message.complete { border-color: var(--ok); }
.day-message.complete .score-line { color: var(--ok); }
.score-ring {
  --size: 64px; flex: none; width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0);
  transition: --p 0.9s var(--ease); animation: ring-in 0.9s var(--ease) both;
}
.score-ring.complete { background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--surface-3) 0); }
.score-ring::before { content: ''; grid-area: 1 / 1; width: calc(var(--size) - 14px); height: calc(var(--size) - 14px); border-radius: 50%; background: var(--surface); }
.score-value { grid-area: 1 / 1; position: relative; font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }
@keyframes ring-in { from { --p: 0; } }
.score-line { margin: 0; font-weight: 700; font-size: 0.95rem; }
.score-message { margin: 2px 0 0; color: var(--text-dim); font-size: 0.88rem; line-height: 1.5; }

.section-title { font-size: 0.8rem; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 8px; }
html[lang='fa'] .section-title { text-transform: none; letter-spacing: 0; font-size: 0.9rem; }
.next-section { margin-block-end: 16px; }
.next-section .reminder { margin-block-end: 0; }
.reminder-when { display: flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; }
.reminder .reminder-title { font-size: 1.25rem; font-weight: 800; }
.reminder-workout { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: linear-gradient(180deg, color-mix(in srgb, var(--warn) 7%, var(--surface)), var(--surface) 60%); }
.reminder-workout .reminder-when { color: var(--warn); }

.next-card {
  display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, var(--surface)), var(--surface) 75%);
  border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent); box-shadow: var(--shadow);
  animation: rise 0.35s var(--ease) both;
}
.next-card.next-done { background: linear-gradient(135deg, color-mix(in srgb, var(--ok) 9%, var(--surface)), var(--surface) 75%); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.next-card.next-done .ticon { color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); }
.next-body { min-width: 0; flex: 1; }
.next-label { margin: 0; font-size: 0.78rem; font-weight: 700; color: var(--accent); }
.next-title { margin: 2px 0; font-size: 1.12rem; font-weight: 750; line-height: 1.35; }

.ticon { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; color: var(--accent); background: var(--accent-soft); }
.ticon svg { width: 20px; height: 20px; }
.ticon-lg { width: 44px; height: 44px; border-radius: 14px; }
.ticon-lg svg { width: 24px; height: 24px; }
.ticon-inline { width: 18px; height: 18px; background: none; }
.ticon-inline svg { width: 16px; height: 16px; }
.ticon-water { color: #0e8fd6; background: color-mix(in srgb, #0e8fd6 12%, transparent); }
.ticon-steps { color: #0f9d7a; background: color-mix(in srgb, #0f9d7a 12%, transparent); }
.ticon-sleep { color: #7c5cd6; background: color-mix(in srgb, #7c5cd6 13%, transparent); }
.ticon-nutrition { color: #d9730d; background: color-mix(in srgb, #d9730d 12%, transparent); }
.ticon-consistency { color: #e0533d; background: color-mix(in srgb, #e0533d 12%, transparent); }
.ticon-strength { color: #b8860b; background: color-mix(in srgb, #b8860b 13%, transparent); }
.ticon-done { width: 28px; height: 28px; border-radius: 50%; color: var(--ok); background: color-mix(in srgb, var(--ok) 13%, transparent); animation: pop 0.35s var(--ease) both; }
.ticon-done svg { width: 16px; height: 16px; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }

.tcard { position: relative; transition: border-color 0.2s, opacity 0.2s; }
.tcard-head { display: flex; align-items: center; gap: 10px; margin-block-end: 12px; }
.tcard-head h2 { margin: 0; flex: 1; font-size: 1rem; }
.tcard.is-done { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); }
.tcard.is-done .tcard-head h2::after { content: ' ✓'; color: var(--ok); }
.tactions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 10px; align-items: center; }
.big-figure { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; margin: 0 0 8px; letter-spacing: -0.01em; }
.big-figure .tunit { font-size: 0.95rem; font-weight: 600; color: var(--text-dim); }
.tfigure { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tfigure .measurement { font-weight: 700; }
.tunit { color: var(--text-dim); font-size: 0.9em; }
.late-text { color: var(--warn); font-weight: 600; }

.tbar { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-block: 6px; }
.tbar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.6s var(--ease); animation: grow 0.8s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.tbar.water > span { background: linear-gradient(90deg, #38b6f5, #0e8fd6); }
.tbar.steps > span { background: linear-gradient(90deg, #2fc79c, #0f9d7a); }
.tbar.protein > span, .tbar.meals > span { background: linear-gradient(90deg, #f3a14b, #d9730d); }
.tbar.calories > span { background: linear-gradient(90deg, #f6c35b, #d99b0d); }
.tbar.strength > span { background: linear-gradient(90deg, #e2b33d, #b8860b); }
.tbar-mark { position: absolute; inset-block: -2px; width: 2px; background: var(--text-faint); border-radius: 2px; }
.is-done .tbar > span { background: var(--ok); }

.session { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding-block: 4px; }
.session + .session { border-block-start: 1px solid var(--border); padding-block-start: 12px; margin-block-start: 8px; }
.session-main { min-width: 0; flex: 1; }
.session-name { margin: 0 0 2px; font-size: 1.1rem; font-weight: 750; }
.session-dur { color: var(--text-dim); font-weight: 600; }
.session .muted.small { margin: 0 0 6px; }
.session .tactions { margin: 0; flex-direction: column; align-items: stretch; }
.session .tactions button.primary { min-height: 46px; padding-inline: 18px; }
.session.done .session-name { color: var(--text-dim); }
.tcard-workout.rest { background: linear-gradient(135deg, color-mix(in srgb, #7c5cd6 7%, var(--surface)), var(--surface) 70%); }
.rest-title { font-size: 1.1rem; font-weight: 750; margin: 0 0 4px; }

.tmetric { margin-block-end: 8px; }
.tmetric-label { font-weight: 600; }
.meal-list { list-style: none; padding: 0; margin: 10px 0 0; }
.meal { display: grid; grid-template-columns: 10px auto 1fr auto auto; gap: 10px; align-items: center; padding-block: 8px; border-block-start: 1px solid var(--border); }
.meal-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--border-strong); }
.meal.done .meal-dot { background: var(--ok); border-color: var(--ok); }
.meal.late .meal-dot { background: var(--warn); border-color: var(--warn); }
.meal-time { font-variant-numeric: tabular-nums; color: var(--text-dim); font-size: 0.88rem; }
.meal-name { min-width: 0; font-weight: 600; }
.meal.done .meal-name > span:first-child { color: var(--text-dim); }
.meal-kcal { font-size: 0.85rem; color: var(--text-dim); }
.meal .ticon-done { width: 22px; height: 22px; }
.next-meal { margin: 10px 0 0; font-weight: 600; color: var(--accent); }
.no-targets { padding: 10px 12px; border-radius: var(--radius-s); background: var(--surface-2); }
.no-targets p { margin: 0 0 4px; }

.steps-form { margin-block-start: 8px; }
.steps-form input { max-width: 150px; }
.sleep-row p { margin: 0; }
.sleep-row .big-figure { font-size: 1.2rem; margin-block-start: 2px; }
.sleep-target { margin: 10px 0 2px; font-weight: 600; color: #7c5cd6; }
.consistency-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--gap); }

.tmissions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.tmission { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); transition: background 0.3s; }
.tmission.done { background: color-mix(in srgb, var(--ok) 9%, var(--surface-2)); }
.tmission.done .tmission-label { color: var(--text-dim); }
.tmission-body { flex: 1; min-width: 0; }
.tmission-label { margin: 0; font-weight: 650; font-size: 0.95rem; }
.tmission-progress { display: flex; align-items: center; gap: 8px; }
.tmission-progress .tbar { flex: 1; height: 7px; margin-block: 4px; }
.tmission .muted.small { margin: 2px 0 0; }

.tcard-timeline .entry:first-of-type { border-block-start: none; }
.brief-offer { border-style: dashed; }
.workout-sheet .exercise-list { padding: 0; margin: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.exercise { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); cursor: pointer; }
.exercise input { width: 20px; height: 20px; flex: none; }
.exercise-name { flex: 1; font-weight: 600; }
.exercise:has(input:checked) { background: color-mix(in srgb, var(--ok) 10%, var(--surface-2)); }
.exercise:has(input:checked) .exercise-name { text-decoration: line-through; color: var(--text-dim); }

@media (min-width: 720px) {
  .today-hero h1 { font-size: 2rem; }
  .score-ring { --size: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .score-ring, .tbar > span, .next-card, .ticon-done { animation: none; transition: none; }
}

/* ─────────────────────────── Weekly plan ───────────────────────────
 * A horizontal day selector, the day's meals as stacked cards with their
 * actual foods, and the full workout below — built for a thumb, not a
 * desktop table.
 */
.week-card { margin-block-end: 12px; }
.week-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-block-end: 8px; }
.week-nav button { min-width: 44px; font-size: 1.3rem; line-height: 1; }
.week-range { font-size: 0.88rem; color: var(--text-dim); text-align: center; }
.day-selector {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.day-selector::-webkit-scrollbar { display: none; }
.day-chip {
  flex: 0 0 auto; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 64px; min-height: 64px; padding: 8px 10px; border-radius: 16px; position: relative;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow-1);
}
.day-chip .chip-day { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); white-space: nowrap; }
.day-chip .chip-date { font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.day-chip.today { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.day-chip.today .chip-day { color: var(--accent); }
.day-chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.day-chip.on .chip-day { color: color-mix(in srgb, var(--accent-text) 85%, transparent); }
.chip-dot { position: absolute; inset-block-end: 6px; width: 5px; height: 5px; border-radius: 50%; }
.chip-dot.workout { background: var(--warn); }
.chip-dot.rest { background: var(--text-faint); }
.day-chip.on .chip-dot { background: var(--accent-text); }

.day-head { display: flex; align-items: center; gap: 8px; margin: 4px 0 10px; }
.day-head h2 { margin: 0; font-size: 1.1rem; }
.plan-section { padding: 14px; }
.section-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-block-end: 6px; }
.section-label { margin: 0; font-size: 0.95rem; font-weight: 800; color: var(--text-dim); }
.plan-meal, .plan-session { padding: 12px 0; border-block-start: 1px solid var(--border); }
.plan-section .section-row + .plan-meal, .plan-section .section-row + .plan-session { border-block-start: none; }
.plan-meal.done h3, .plan-session.done h3 { color: var(--text-dim); }
.plan-meal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plan-meal-head h3 { margin: 0; font-size: 1rem; font-weight: 750; flex: 1; min-width: 0; }
.plan-time {
  font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.85rem; padding: 3px 8px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent);
}
.food-list { margin: 8px 0 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 3px; }
.food-list li { line-height: 1.5; }
.food-list li::marker { color: var(--text-faint); }
.food-list li.more, .exercise-lines li.more { list-style: none; color: var(--text-dim); font-size: 0.85rem; margin-inline-start: -20px; }
.alternatives { margin-block-start: 8px; display: flex; flex-direction: column; gap: 6px; }
.alternative { padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.alternative .food-list { margin-block-start: 4px; }
.alt-label { font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.plan-note { margin: 8px 0 0; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 8%, var(--surface)); font-size: 0.88rem; }
.macro-line { margin: 8px 0 0; font-size: 0.85rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.exercise-lines { margin: 8px 0 0; padding-inline-start: 22px; display: flex; flex-direction: column; gap: 6px; }
.exercise-lines li { line-height: 1.4; }
.exercise-lines .ex-name { font-weight: 650; }
.exercise-lines .ex-meta { display: block; font-size: 0.85rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.exercise-lines .ex-note { display: block; font-size: 0.82rem; color: var(--text-faint); }
.plan-section.rest { background: linear-gradient(135deg, color-mix(in srgb, #7c5cd6 7%, var(--surface)), var(--surface) 70%); }
.rest-block .rest-title { font-size: 1.05rem; font-weight: 800; margin: 0 0 4px; }

.plans-manage { margin-block-start: 18px; }
.plan-meta { margin: 4px 0 0; }
.previous-plans { margin-block-start: 10px; }
.previous-plans > summary { cursor: pointer; font-weight: 650; color: var(--text-dim); padding: 6px 0; }
.plan-row.status-archived .name { color: var(--text-dim); }

.sched-card { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.sched-list { list-style: none; padding: 0; margin: 10px 0; display: flex; flex-direction: column; gap: 6px; }
.sched-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface-2); }
.sched-row.moved .sched-times b { color: var(--accent); }
.sched-row.fixed { background: color-mix(in srgb, var(--warn) 7%, var(--surface-2)); }
.sched-row.workout-mark { background: color-mix(in srgb, var(--warn) 12%, var(--surface-2)); }
.sched-name { font-weight: 650; min-width: 0; }
.sched-times, .sched-fixed { font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 0.9rem; }
.sched-fixed { color: var(--text-dim); font-size: 0.8rem; white-space: normal; text-align: end; }
.sched-row input[type='time'] { max-width: 130px; }

.entry-detail { margin-block-start: 4px; }
.entry-detail .food-list, .entry-detail .exercise-lines { margin-block-start: 4px; font-size: 0.92rem; }
.entry-detail .macro-line { margin-block-start: 4px; }
.entry-detail .view-meal, .entry-detail .view-workout { margin-block-start: 6px; }
.workout-preview { margin-block-start: 6px; }
.workout-preview .exercise-lines { font-size: 0.92rem; }
.reminder-detail .food-list, .reminder-detail .exercise-lines { margin: 0 0 10px; }
.meal-detail .food-list { margin-block-start: 4px; }
.alt-editor { display: flex; flex-direction: column; gap: 8px; }
.alt-row { padding: 8px; border-radius: 12px; background: var(--surface-2); }
.history-version > summary { display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.history-shape { margin: 10px 0 0; padding-inline-start: 18px; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.activation { margin-block: 12px; }
.draft-note { display: flex; flex-direction: column; gap: 6px; margin-block-end: 8px; }
.week-link { font-weight: 650; }
