/* Body — оформление. Правила вида: design/DESIGN.md и ../Принципы дизайна.md.
   Один акцент (--accent): отказ, суперсет, большая цифра сводки. Всё остальное — бумага и чернила.
   Шаг отступов: 4 · 8 · 12 · 16 · 24 · 32. Размеры текста: 12 (подписи) · 14 · 16 · 19 · 26 · 46 · 104. */

:root {
  --bg: #F3F0E8;
  --ink: #151515;
  --muted: #6c675d;
  --line: #e0dbcf;
  --chip: #ffffff;
  --chip-line: #d8d3c7;
  --accent: #E04A26;
  --accent-ink: #b93618;
  --on-accent: #ffffff;
  --on-ink: #F3F0E8;
  --shade: rgba(21, 21, 21, .45);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --ink: #F1EEE6;
    --muted: #9c978b;
    --line: #2f2d28;
    --chip: #23211e;
    --chip-line: #3d3a34;
    --accent: #F2603A;
    --accent-ink: #ff8864;
    --on-accent: #161513;
    --on-ink: #161513;
    --shade: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.4 var(--font);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
  min-height: 100dvh; overscroll-behavior-y: none;
}
body.sheet-open { overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
b { font-weight: 780; }

.page { max-width: 560px; margin: 0 auto; padding: 16px 20px calc(96px + env(safe-area-inset-bottom)); }
.page.record { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }

/* ---- подписи и текст ---- */
.cap { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.cap.accent { color: var(--accent-ink); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.empty { color: var(--muted); padding: 24px 0; }
.title { font-size: 26px; font-weight: 780; letter-spacing: -.02em; line-height: 1.1; }
.link { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 8px 0; }
.link.danger, .menu-item.danger { color: var(--accent-ink); }
.note { font-size: 14px; color: var(--muted); margin-top: 6px; }
.names { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* ---- шапки ---- */
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; min-height: 40px; margin-bottom: 16px; }
.brand { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.brand b { color: var(--ink); font-weight: 700; }
.bar { display: flex; align-items: center; gap: 8px; margin: -4px -8px 12px; min-height: 48px; }
.bar-title { flex: 1; display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bar-title b { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.bar-title span { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-pad { width: 8px; }

/* ---- кнопки ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px;
  border: 1.5px solid var(--ink); border-radius: 12px; font-weight: 650; font-size: 16px; background: transparent; color: var(--ink);
  transition: transform .16s cubic-bezier(.45,.05,.4,.95), opacity .16s cubic-bezier(.45,.05,.4,.95); user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.98); opacity: .85; }
.btn.primary { background: var(--ink); color: var(--on-ink); }
.btn.ghost { border-color: var(--chip-line); color: var(--ink); font-weight: 600; }
.btn.danger { border-color: var(--accent); color: var(--accent); }
.btn.wide { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; border-radius: 14px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 10px; margin-right: 8px; }
.btn.grow { flex: 1; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; color: var(--ink); flex: none; }
.icon-btn:active { background: var(--line); }
.row { display: flex; gap: 8px; align-items: center; }
.row > .input { flex: 1; min-width: 0; }

/* ---- поля ---- */
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 1.5px solid var(--chip-line); border-radius: 12px;
  background: var(--chip); font-size: 16px; appearance: none; -webkit-appearance: none;
}
.input:focus { outline: none; border-color: var(--ink); }
textarea.input { resize: vertical; line-height: 1.4; }
.input.search { margin-bottom: 12px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.form, .sheet-body { display: flex; flex-direction: column; gap: 16px; }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; font-size: 15px; white-space: nowrap; }
.check input { width: 22px; height: 22px; accent-color: var(--ink); }

/* ---- переключатели-плашки ---- */
.seg { display: flex; gap: 6px; }
.seg.wrap { flex-wrap: wrap; }
.seg.scroll-x { overflow-x: auto; margin: 0 -20px 12px; padding: 0 20px 2px; scrollbar-width: none; }
.seg.scroll-x::-webkit-scrollbar { display: none; }
.seg-btn {
  min-height: 44px; padding: 0 14px; border: 1.5px solid var(--chip-line); border-radius: 10px; background: var(--chip);
  font-size: 15px; font-weight: 600; white-space: nowrap; flex: none;
}
.seg-btn.big { min-height: 48px; font-size: 16px; }
.seg-btn.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.seg.tags .seg-btn { flex: 1; text-align: center; padding: 0 6px; }
.seg.feel .seg-btn, .seg.week-pick .seg-btn { flex: 1; text-align: center; padding: 0; font-variant-numeric: tabular-nums; }
.scale-ends { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

/* ---- плашка подхода ---- */
.sets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: baseline; font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.2;
  background: var(--chip); border: 1px solid var(--chip-line); border-radius: 7px; padding: 5px 10px; white-space: pre; color: var(--ink);
}
.chip i { font-style: normal; font-size: .72em; font-weight: 600; color: var(--muted); margin: 0 3px 0 2px; }
.chip.warm { background: transparent; border-style: dashed; color: var(--muted); }
.chip.warm b { font-weight: 600; }
.chip.fail { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.fail i { color: var(--on-accent); opacity: .8; }
.chip.reserve { border: 1.5px solid var(--ink); }
button.chip { min-height: 40px; align-items: center; padding: 0 12px; font-size: 17px; }
.chip.editing { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip.ghost { background: transparent; color: var(--muted); min-height: 36px; font-size: 15px; }
.chip.ghost b { color: var(--muted); }
.chip.ghost.next { border-color: var(--ink); color: var(--ink); }
.chip.ghost.next b { color: var(--ink); }
/* «отказ» в подсказке прошлого раза — рамкой, без заливки: единица «кг» должна остаться видимой на бумаге */
.chip.ghost.fail i { color: var(--muted); opacity: 1; }
.chip.mini { font-size: 13px; padding: 1px 6px; border-radius: 5px; margin-right: 6px; }
.chip.plain { background: none; border: 0; padding: 0; font-size: 21px; }
.chip.plain.fail, .chip.plain.warm { color: var(--ink); }
.chip.plain.fail i { color: var(--muted); opacity: 1; }
.chip.huge { font-size: 46px; letter-spacing: -.03em; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.legend .chip { font-size: 13px; padding: 3px 8px; }

/* ---- карточка тренировки ---- */
.card { display: block; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.card-date, .card-focus { font-size: 26px; font-weight: 780; letter-spacing: -.02em; line-height: 1.15; }
.card-date span { color: var(--muted); font-weight: 500; }
.card-focus { text-align: right; }
.card-focus.unset { font-size: 19px;  color: var(--muted); font-weight: 500; text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 5px; text-decoration-thickness: 1.5px; }
.as-btn { position: relative; cursor: pointer; }
.date-input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.ex { padding: 12px 0; border-bottom: 1px solid var(--line); }
.exs > .ex:last-child { border-bottom: 0; }
.exn { font-size: 19px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; margin-bottom: 8px; }
.glab { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 8px; }
.gbox { border-left: 3px solid var(--accent); padding-left: 14px; }
.gsub { padding: 4px 0 10px; }
.gsub:last-child { padding-bottom: 2px; }
.gsub .exn { font-size: 17.5px; }
.card.tap { padding: 0 0 4px; }
.card.tap .card-head { margin-bottom: 10px; }
.card.tap .names { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card.tap .note { margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { font-size: 14px; color: var(--muted); margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.wnote { margin-top: 12px; font-size: 16px; line-height: 1.45; white-space: pre-wrap; }
.del { display: flex; align-items: center; min-height: 44px; margin-top: 32px; }

/* ---- сводка ---- */
.hero { padding: 8px 0 32px; }
.hero-title { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1; margin: 6px 0 10px; }
.hero-sub { font-size: 16px; color: var(--muted); margin-bottom: 20px; }
.big-num { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 14px; }
.big-num b { font-size: 104px; font-weight: 800; letter-spacing: -.05em; line-height: .86; color: var(--accent); display: inline-flex; font-variant-numeric: tabular-nums; }
.big-num b svg { stroke-width: 2.6; }
.big-num span { font-size: 22px; font-weight: 700; line-height: 1.1; padding-bottom: 4px; }
.block { padding: 0 0 32px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.block-head .link { padding: 0; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 4px 0; }
.day-name { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.day.today .day-name { color: var(--ink); font-weight: 800; }
.day-dot { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.day-dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--chip-line); }
.day.planned .day-dot { border: 1.5px solid var(--ink); }
.day.planned .day-dot::before, .day.done .day-dot::before { display: none; }
.day.missed .day-dot { border: 1.5px dashed var(--muted); }
.day.done .day-dot { background: var(--ink); color: var(--on-ink); border: 0; }
.day.today .day-dot { box-shadow: 0 0 0 3px var(--bg), 0 0 0 4.5px var(--accent); }
.strip { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; margin-top: 20px; align-items: end; }
.strip-col { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip-col.current { color: var(--ink); font-weight: 800; }
.strip-bar { width: 100%; height: 32px; display: flex; align-items: flex-end; border-bottom: 1.5px solid var(--chip-line); }
.strip-bar i { display: block; width: 100%; background: var(--ink); border-radius: 3px 3px 0 0; min-height: 0; }
.strip-cap { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---- строки «название — значение» ---- */
.pk { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.rows .pk:last-child { border-bottom: 0; }
.pk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pk-name { font-size: 16px; font-weight: 550; line-height: 1.25; }
.pk-sub { font-size: 13px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; }
.pk-val { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; }
.pk-date { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pk.dim .pk-name { color: var(--muted); font-weight: 450; }
.month { margin: 24px 0 4px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.month:first-child { margin-top: 0; }
.ex-list { margin-top: 20px; }

/* ---- история ---- */
.hist { display: block; padding: 14px 0; border-bottom: 1px solid var(--line); }
.hist-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.hist-date, .hist-focus { font-size: 19px; font-weight: 720; letter-spacing: -.01em; }
.hist-date span { color: var(--muted); font-weight: 500; font-size: 14px; }
.hist .names { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- запись тренировки ---- */
.rec-top { margin-top: 4px; }
.rec-head { display: flex; align-items: flex-start; gap: 4px; margin: -4px -10px 4px 0; }
.rec-name { flex: 1; font-size: 19px; font-weight: 650; letter-spacing: -.01em; line-height: 1.25; padding: 10px 0; min-height: 44px; }
.rec-entry.open > .rec-head .rec-name { font-weight: 780; }
.gsub.rec-entry { padding: 0 0 8px; }
.panel { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; padding: 16px; background: var(--chip); border: 1px solid var(--chip-line); border-radius: 16px; }
.last { display: flex; flex-direction: column; gap: 8px; }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.steppers.n1 { grid-template-columns: 1fr; }
.stepper { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.step-row { display: flex; align-items: center; border: 1.5px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--bg); }
.step-btn { width: 48px; height: 60px; display: flex; align-items: center; justify-content: center; flex: none; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.step-btn:active { background: var(--line); }
.step-input { flex: 1; min-width: 0; width: 100%; height: 60px; border: 0; background: none; text-align: center; font-size: 28px; font-weight: 780; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.step-input:focus { outline: none; background: var(--chip); }
.step-input::placeholder { color: var(--muted); font-weight: 500; }
.note-input { min-height: 44px; font-size: 15px; background: var(--bg); }
.start { padding: 24px 0 8px; display: flex; flex-direction: column; gap: 16px; }
.ask { font-size: 26px; font-weight: 780; letter-spacing: -.02em; }
.suggest { margin-top: 24px; }
.suggest .cap { margin-bottom: 4px; }
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; padding: 24px 20px calc(16px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 62%, transparent); pointer-events: none; }
.dock .btn { max-width: 520px; margin: 0 auto; display: flex; background: var(--bg); pointer-events: auto; }

/* ---- выбор упражнения ---- */
.pick-sec { margin-bottom: 20px; }
.pick-sec h3 { padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.pick-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 56px; }
.pick-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pick-name { font-size: 17px; font-weight: 600; line-height: 1.25; }
.pick-sub { font-size: 13px; color: var(--muted); display: flex; align-items: center; }
.pick-plus { width: 36px; height: 36px; border: 1.5px solid var(--ink); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.pick-mark { font-size: 12px; color: var(--muted); flex: none; }

/* ---- нижний лист ---- */
.backdrop { position: fixed; inset: 0; z-index: 20; background: var(--shade); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease both; }
.sheet { width: 100%; max-width: 560px; max-height: 90dvh; overflow-y: auto; background: var(--bg); border-radius: 20px 20px 0 0; padding: 8px 20px calc(24px + env(safe-area-inset-bottom)); animation: rise .24s cubic-bezier(.45, .05, .4, .95) both; overscroll-behavior: contain; }
.sheet-full { height: 94dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: -8px; background: var(--bg); padding: 8px 0; margin: 0 -8px 8px 0; z-index: 1; }
.sheet-title { font-size: 19px; font-weight: 780; letter-spacing: -.01em; line-height: 1.2; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; font-size: 17px; font-weight: 600; border-bottom: 1px solid var(--line); }
.sheet-body .menu-item { margin-top: -16px; }
.sheet-body .menu-item:first-child { margin-top: 0; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* ---- упражнение ---- */
.ex-title { margin-bottom: 20px; }
.best { margin-bottom: 20px; }
.best-row { display: flex; align-items: baseline; gap: 12px; margin-top: 6px; }
.chart-wrap { margin: 0 0 8px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-line { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.chart-dot { fill: var(--bg); stroke: var(--ink); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.chart-dot.last { fill: var(--accent); stroke: var(--accent); }
.chart-cap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 8px; font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.sess { display: block; }
.sess-date { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.sess-date span { color: var(--muted); font-weight: 500; }

/* ---- нижнее меню ---- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tab { flex: 1; max-width: 186px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--muted); min-height: 56px; }
.tab.on { color: var(--ink); }
.tab.on svg { stroke-width: 2.5; }

/* ---- индикатор сохранения ---- */
.sync { position: sticky; top: 0; left: 0; right: 0; z-index: 30; text-align: center; font-size: 13px; font-weight: 600; padding: calc(4px + env(safe-area-inset-top)) 12px 4px; background: var(--ink); color: var(--on-ink); }
.sync-retry { margin-left: 10px; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; color: inherit; min-height: 28px; }
.sync.error { background: var(--accent); color: var(--on-accent); }

/* ---- вход ---- */
/* Вход и «открыт в другой вкладке» — один вид: узкая колонка по центру экрана, сверху марка body
   с линией как в шапке сводки, затем заголовок, пояснение и одна главная кнопка. */
.login-body { display: flex; align-items: center; justify-content: center; padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom)); }
.login { width: 100%; max-width: 380px; }
.login .brand, .session-message .brand { padding-bottom: 20px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.login-title { font-size: 46px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.login-error { color: var(--accent-ink); font-weight: 600; }

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

/* Живой дневник: один ритм для обзора, поиска и записи. */
button, a, input { touch-action: manipulation; }
button:disabled { cursor: default; opacity: .5; }
.page { padding-top: max(20px, env(safe-area-inset-top)); }
.home-page .top { align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.brand { display: flex; flex-direction: column; gap: 2px; font-size: 12px; letter-spacing: .06em; }
.brand b { font-size: 28px; letter-spacing: -.06em; line-height: 1; text-transform: lowercase; }
.brand > span { font-size: 12px; letter-spacing: .02em; text-transform: none; margin-top: 4px; }
.today-label { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hero { padding: 8px 0 32px; }
.hero-title { text-wrap: balance; }
.block-head { border-bottom: 1px solid var(--line); padding-bottom: 12px; align-items: center; }
.block-head h2.cap { font-size: 19px; font-weight: 700; letter-spacing: -.025em; color: var(--ink); text-transform: none; }
/* Заголовок раздела и ссылка справа — одна строка: ссылка не переносится, заголовок сжимается первым. */
.block-head h2 { min-width: 0; }
.block-head .link, .top .link { flex: none; white-space: nowrap; line-height: 1.25; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: flex-end; }
.day-dot::before { display: none; }
.day-dot { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; width: min(44px, 100%); height: 44px; border-radius: 12px; color: var(--muted); }
.day.planned .day-dot { color: var(--ink); }
.day.done .day-dot { color: var(--on-ink); }
.day.today .day-dot { color: var(--accent-ink); box-shadow: inset 0 0 0 1.5px var(--accent); }
.day.today.done .day-dot { color: var(--on-ink); }
.day-name { font-size: 12px; }
.strip { margin-top: 24px; }
.last-block .card.tap { padding: 16px; background: var(--chip); border: 1px solid var(--chip-line); border-radius: 16px; }
.last-block .card-head { border-bottom: 0; gap: 8px; padding-bottom: 0; }
.last-block .card-date, .last-block .card-focus { font-size: 22px; }
.last-block .card.tap .names { margin-top: 14px; }
.last-block .card.tap .note { padding-top: 12px; border-top: 1px solid var(--line); margin-top: 12px; }
.pk-sub, .pick-sub, .pk-date, .chart-cap { font-size: 14px; }
.pick-sub { flex-wrap: wrap; gap: 4px; }
.pick-count { font-size: 14px; color: var(--muted); }
.pk-name { line-height: 1.4; }
.hist { padding: 20px 0; }
.hist-meta { margin-top: 8px; color: var(--muted); font-size: 14px; }
.hist-active { border-left: 3px solid var(--accent); padding-left: 12px; }
.history-summary { margin: 4px 0 20px; font-size: 14px; color: var(--muted); }
.workout-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.history-tools { margin-bottom: 20px; }
.search { padding-left: 16px; }
.panel { box-shadow: 0 2px 6px rgba(0,0,0,.025); }
.panel-heading { justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.panel-heading .link { font-size: 14px; }
.step-btn { width: 40px; min-height: 60px; }
.step-input { font-size: 26px; }
.rec-name { overflow-wrap: anywhere; }
.record .card-date, .record .card-focus { font-size: 24px; }
.record .card-date span { font-size: 16px; }
.record .card-head { align-items: center; }
.record .card-focus { max-width: 45%; overflow-wrap: anywhere; }
.record-feedback { pointer-events: auto; max-width: 520px; margin: 0 auto 8px; padding: 8px 12px; background: var(--ink); color: var(--on-ink); border-radius: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.record-feedback .link { color: inherit; padding: 8px; flex: none; }
.page.record:has(.record-feedback) { padding-bottom: calc(172px + env(safe-area-inset-bottom)); }
/* Панель записи на телефоне: поля и «Записать подход» помещаются на 375×667 вместе. */
.rec-last-sets { flex-wrap: nowrap; overflow-x: auto; margin: -5px -16px; padding: 5px 16px; scrollbar-width: none; overscroll-behavior-x: contain; }
.rec-last-sets::-webkit-scrollbar { display: none; }
.rec-last-sets .chip { flex: none; }
.rec-last-note { display: block; width: 100%; min-height: 44px; margin: -12px 0; padding: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec-last-note[aria-expanded="true"] { white-space: normal; overflow-wrap: anywhere; }
.panel .last { gap: 6px; }
/* Цели касания записи ≥ 44 px без раздувания вида: область нажатия шире видимой рамки. */
.record .card-focus.as-btn { padding: 9px 0; margin: -9px 0; }
.record .date-input { top: -9px; bottom: -9px; height: auto; }
.record button.chip { position: relative; }
.record button.chip::after { content: ''; position: absolute; inset: -5px -1px; } /* отсчёт от внутреннего края рамки */
.suggest-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.suggest-head .btn { align-self: flex-start; }
.finish-summary { padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--muted); }
.tab { font-size: 12px; min-height: 64px; padding-top: 10px; gap: 4px; }
.tab.on { color: var(--accent-ink); }
.sheet { box-shadow: 0 -12px 60px rgba(0,0,0,.12); }
.backdrop { animation-timing-function: cubic-bezier(.45,.05,.4,.95); }
input[type="date"] { min-width: 0; }
@media (hover: hover) {
  .pick-row:hover, .pk:hover, .hist:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
  .btn:hover, .seg-btn:hover { border-color: var(--accent-ink); }
  .icon-btn:hover { background: var(--line); }
}
@media (min-width: 900px) {
  .home-page { max-width: 1080px; padding: 40px 40px 128px; }
  .home-page .top { margin-bottom: 32px; }
  .home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 32px 48px; align-items: start; }
  .home-grid > .hero { grid-column: 1; grid-row: 1; padding-bottom: 0; }
  .home-grid > .week-block { grid-column: 2; grid-row: 1; padding-top: 8px; }
  .home-grid > .last-block { grid-column: 1; grid-row: 2; }
  .home-grid > .lifts-block { grid-column: 2; grid-row: 2; }
  .home-grid > .block { padding-bottom: 0; }
  .home-grid .hero-sub { min-height: 46px; }
  /* Левая колонка не обрывается раньше правой: на широком экране состав последней тренировки целиком, заметка до 4 строк. */
  .last-block .card.tap .names { display: block; -webkit-line-clamp: none; overflow: visible; }
  .last-block .card.tap .note { -webkit-line-clamp: 4; }
  /* Плавающая панель (64 px + 20 px от края) не закрывает конец содержимого. */
  .page { padding-bottom: 128px; }
  .home-page .big-num b { font-size: 120px; }
  .home-page .big-num { margin: 12px 0 24px; }
  .tabs { left: 50%; right: auto; transform: translateX(-50%); bottom: 20px; width: 520px; border: 1px solid var(--chip-line); border-radius: 20px; box-shadow: 0 8px 40px rgba(0,0,0,.1); background: var(--chip); overflow: hidden; }
  .sheet { margin-bottom: 24px; border-radius: 20px; max-height: calc(100dvh - 48px); }
  .page:not(.home-page) { padding-top: 32px; }
}
@media (max-width: 374px) {
  .page { padding-left: 16px; padding-right: 16px; }
  .panel { padding: 12px; }
  .steppers { gap: 8px; }
  .step-btn { width: 32px; }
  .card-date, .card-focus { font-size: 22px; }
  .block-head h2.cap { font-size: 17px; }
}

.exercise-count { margin: 12px 0; }

/* Произвольные пользовательские названия не расширяют экран. */
.hero-title, .card-focus, .hist-focus, .pick-name, .pk-name, .exn, .ex-title, .brand > span, .note, .wnote { min-width: 0; overflow-wrap: anywhere; }
.card-focus, .hist-focus { max-width: 50%; }
.sync { overflow-wrap: anywhere; }
/* После смены упражнения основная кнопка остаётся выше нижнего управления. */
.panel .btn.primary { scroll-margin-bottom: 180px; }

.drop-editor { display: flex; flex-direction: column; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.drop-part { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--chip-line); border-radius: 12px; background: var(--bg); }
.drop-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drop-title { font-size: 14px; font-weight: 650; color: var(--muted); }
.drop-part .step-row { background: var(--chip); }
.drop-part .step-btn { width: 32px; }
.drop-part .step-input { font-size: 22px; }
.exercise-actions { display: flex; flex-direction: column; gap: 12px; margin: 20px 0; }
.form-notice { display: flex; flex-direction: column; gap: 8px; }
.page.session-message { display: flex; flex-direction: column; justify-content: center; gap: 16px; max-width: 420px; min-height: 100dvh; padding-bottom: 20px; }
.session-message .btn { margin-top: 8px; }
/* pre-wrap: пробел между числом и словом («15 мин», «20 раз») не съедается во flex-плашке, перенос при этом есть. */
.chip { max-width: 100%; flex-wrap: wrap; white-space: pre-wrap; }
.set-part { display: inline-flex; align-items: baseline; white-space: pre; }
button.chip .set-part { padding: 4px 0; }
.cardio-progress { display: flex; flex-direction: column; gap: 16px; margin: 24px 0 32px; }
.cardio-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cardio-metric { padding: 16px; background: var(--chip); border: 1px solid var(--chip-line); border-radius: 12px; }
.cardio-metric b { font-size: 32px; font-variant-numeric: tabular-nums; }
.cardio-trend { padding-top: 8px; }
/* Число занимает всю ширину поля; крупные ± не отнимают место у дробного веса. */
.panel { container-type: inline-size; }
@container (max-width: 360px) {
  .step-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .step-input { grid-row: 1; grid-column: 1 / -1; height: 48px; font-size: 28px; }
  .step-btn { grid-row: 2; width: 100%; height: 40px; min-height: 40px; border-top: 1px solid var(--chip-line); }
  .step-btn:first-child { grid-column: 1; border-right: 1px solid var(--chip-line); }
  .step-btn:last-child { grid-column: 2; }
  .drop-part .step-btn { width: 100%; }
  .drop-part .step-input { font-size: 24px; }
}
.cardio-progress > .seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cardio-progress > .seg .seg-btn { text-align: center; }
.muscle-filter { padding-top: 8px; border-top: 1px solid var(--line); }
.draft-warning { padding: 16px; border: 1px solid var(--accent-ink); border-radius: 12px; background: var(--chip); }
.draft-warning .sets { margin: 8px 0; }
/* Шапка карточки: дата с годом одной строкой слева (дата фиксированной длины не переносится),
   направление забирает остаток справа и переносится само. Год мельче и серым на той же базовой линии. */
.card:not(.flat) .card-head { display: flex; align-items: baseline; }
.card:not(.flat) .card-date { flex: none; white-space: nowrap; }
.card:not(.flat) .card-focus { flex: 1 1 0; min-width: 0; max-width: none; }
.card:not(.flat) .card-date, .card:not(.flat) .card-focus { font-size: clamp(22px, 6.4vw, 26px); }
.card:not(.flat) .card-date span { font-size: .72em; }
.last-block .card:not(.flat) .card-date, .last-block .card:not(.flat) .card-focus { font-size: 22px; }
/* Подписи графика: даты с числом не рвутся; на узком экране диапазон «от … до …» — второй строкой по центру. */
.chart-cap span { white-space: nowrap; }
@media (max-width: 479px) { .chart-range { order: 3; flex-basis: 100%; text-align: center; } }
