/* «ВоркаутМания» — мобильный дневник тренировок.
   Визуальная система: «полоса нагрузки» — гриф и блины. Цвет и высота блина
   кодируют рабочий вес. База — тёмная (кремовый, ржавый, бирюза), светлая
   тема собрана из тех же трёх цветов. */

:root {
  color-scheme: dark;

  /* Ядро палитры */
  --vm-surface: #121319;
  --vm-ink: #f3ebdd;
  --vm-primary: #ee6a3c;
  --vm-accent: #4fa3a5;
  --vm-ok: #3dbe72;
  --vm-miss: #ee4b3c;

  /* Поверхности и текст */
  --card: #1c1d26;
  --card-2: #262734;
  --plan: #363846;
  --muted: #a9a396;
  --dim: #5e5a52;
  --soft: #e3dccf;
  --mint: #7fd1d3;

  --on-primary: #121319;
  --on-accent: #121319;
  --on-ink: #121319;
  --link: var(--vm-primary);

  --line: rgba(243, 235, 221, 0.08);
  --line-strong: rgba(243, 235, 221, 0.18);
  --rail: #121319;
  --rail-soft: rgba(243, 235, 221, 0.22);

  /* Блины: цвет по рабочему весу */
  --plate-green: #3dbe72;
  --plate-yellow: #f2c94c;
  --plate-blue: #4c7df0;
  --plate-red: #ee4b3c;
  --plate-body: #5a5c68;

  --r-xs: 10px;
  --r-s: 14px;
  --r-m: 20px;
  --r-l: 26px;
  --r-xl: 28px;
  --r-pill: 999px;

  --shadow-1: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 30px 60px rgba(0, 0, 0, 0.45);

  --font-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;

  --step-0: clamp(0.94rem, 0.9rem + 0.2vw, 1rem);
  --step-1: clamp(1.1rem, 1rem + 0.5vw, 1.3rem);
  --step-2: clamp(1.4rem, 1.2rem + 1vw, 1.7rem);
  --step-3: clamp(1.75rem, 1.45rem + 2vw, 2.125rem);
}

/* Светлая тема: кремовая бумага из той же палитры */
:root[data-theme="light"] {
  color-scheme: light;

  --vm-surface: #f3ebdd;
  --vm-ink: #121319;
  --card: #fbf6ec;
  --card-2: #eae2d2;
  --plan: #ded5c3;
  --muted: #5e5a52;
  --dim: #8a8272;
  --soft: #3a372f;
  --mint: #1f7c7e;

  --on-primary: #121319;
  --on-accent: #121319;
  --on-ink: #f3ebdd;
  --link: #b8400e;

  --line: rgba(18, 19, 25, 0.1);
  --line-strong: rgba(18, 19, 25, 0.22);
  --rail: #121319;
  --rail-soft: rgba(18, 19, 25, 0.3);

  --shadow-1: 0 10px 26px rgba(18, 19, 25, 0.12);
  --shadow-2: 0 30px 60px rgba(18, 19, 25, 0.18);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: var(--step-0);
  line-height: 1.45;
  color: var(--vm-ink);
  background: var(--vm-surface);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-2);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-transform: none;
  margin: 0;
  text-wrap: balance;
}

/* Числа и служебные подписи — та же гарнитура, но с табличными цифрами */
.mono {
  font-family: var(--font-display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

a { color: inherit; text-decoration: none; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; }
:focus-visible { outline: 3px solid var(--vm-primary); outline-offset: 2px; border-radius: 8px; }

/* Иконки (Lucide: линейные знаки 2.2px) */
i[data-lucide], svg.lucide { width: 22px; height: 22px; stroke-width: 2.2; flex: none; }
.ico--sm i[data-lucide], .ico--sm svg.lucide { width: 18px; height: 18px; }

/* ── Оболочка приложения ─────────────────────────────────────────── */

.wall { display: none; }

.shell {
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  min-height: 100dvh;
  background: var(--vm-surface);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* На большом экране за телефоном стоит гриф с блинами */
@media (min-width: 768px) {
  body {
    background:
      radial-gradient(70vmax 70vmax at 50% -20%, color-mix(in oklab, var(--vm-primary) 12%, var(--vm-surface)) 0%, transparent 65%),
      var(--vm-surface);
  }
  .wall {
    display: block;
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
  }
  .wall::before {
    content: "";
    position: absolute;
    inset-inline: 0;
    top: 50%;
    height: 14px;
    margin-top: -7px;
    background: var(--rail-soft);
    opacity: 0.35;
  }
  .wall__plate {
    position: absolute;
    top: 50%;
    width: clamp(46px, 5vw, 78px);
    height: 40vmin;
    border-radius: 8px;
    transform: translateY(-50%);
    background: color-mix(in oklab, var(--vm-primary) 42%, transparent);
  }
  .wall__plate--a { left: 4vw; }
  .wall__plate--b {
    right: 4vw;
    width: clamp(38px, 4vw, 62px);
    height: 32vmin;
    background: color-mix(in oklab, var(--vm-accent) 42%, transparent);
  }
  .wall__word {
    position: absolute;
    inset-block: 0;
    left: clamp(1rem, 5vw, 4rem);
    display: flex;
    align-items: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(3rem, 9vw, 9rem);
    letter-spacing: -0.04em;
    color: color-mix(in oklab, var(--vm-ink) 7%, transparent);
    writing-mode: vertical-rl;
    text-transform: uppercase;
  }
  .shell {
    z-index: 1;
    box-shadow: var(--shadow-2), inset 0 0 0 1px var(--line);
  }
}

/* ── Шапка экрана ────────────────────────────────────────────────── */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px 10px;
  padding-top: max(14px, env(safe-area-inset-top));
  background: linear-gradient(var(--vm-surface) 62%, rgba(18, 19, 25, 0));
}

.appbar__left, .appbar__right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.appbar__who { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.appbar__hi {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar__role { font-size: 0.78rem; color: var(--muted); }
.appbar__back {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--card);
  color: var(--vm-ink);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark {
  display: grid; place-items: center;
  width: 36px; height: 36px; flex: none;
  border-radius: 12px;
  background: var(--vm-primary);
  color: var(--on-primary);
}
.brand__mark svg.lucide, .brand__mark i[data-lucide] { width: 20px; height: 20px; stroke-width: 2.4; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screen {
  flex: 1;
  padding: 6px 18px calc(122px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.screen-head { display: flex; flex-direction: column; gap: 6px; padding: 2px 4px; }
.screen-head__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.04em;
}
.screen-head__sub { font-size: 0.86rem; color: var(--muted); }

/* ── Нижняя панель вкладок: плавающая пилюля ─────────────────────── */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(456px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  height: 64px;
  padding: 0 8px;
  border-radius: 32px;
  background: color-mix(in oklab, var(--card-2) 84%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.42), inset 0 0 0 1px var(--line);
  z-index: 30;
}
:root[data-theme="light"] .tabbar {
  background: color-mix(in oklab, var(--card) 88%, transparent);
  box-shadow: 0 12px 30px rgba(18, 19, 25, 0.16), inset 0 0 0 1px var(--line);
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.25s ease, color 0.25s ease;
}
.tab span { display: none; white-space: nowrap; }
.tab.is-active { background: var(--vm-primary); color: var(--on-primary); }
.tab.is-active span { display: inline; }
.tab.is-active svg.lucide, .tab.is-active i[data-lucide] { stroke-width: 2.4; }
.tab:active { transform: scale(0.97); }

/* ── Карточки и типографика ──────────────────────────────────────── */

.card {
  background: var(--card);
  border: 0;
  border-radius: var(--r-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card--quiet { background: var(--card-2); }
.card--load { background: var(--card); }
.card--link:active { transform: scale(0.995); }
.card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card__label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 0.98;
  letter-spacing: -0.04em;
}
.card__title--sm { font-size: var(--step-2); font-weight: 700; }
.card__side { text-align: right; }
.card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card--links { gap: 10px; }

.section { display: flex; flex-direction: column; gap: 10px; }
.section--first { margin-top: 0; }
.section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 0 4px; }
.section__title { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: -0.03em; }
.link { color: var(--link); font-size: 0.85rem; font-weight: 700; }
.hint { font-size: 0.8rem; color: var(--muted); }
.quote {
  border-radius: 18px 18px 18px 6px;
  padding: 12px 14px;
  background: var(--card-2);
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--vm-ink);
}
.quote--coach {
  border-radius: 18px 18px 6px 18px;
  background: var(--vm-primary);
  color: var(--on-primary);
  font-weight: 600;
  align-self: flex-end;
  max-width: 92%;
}

/* ── Кнопки, чипы, значки ────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  padding: 0 20px;
  min-height: 54px;
  border-radius: var(--r-m);
  border: 0;
  background: var(--card-2);
  color: var(--vm-ink);
  cursor: pointer;
  transition: transform 0.14s ease, background 0.2s ease;
}
.btn:active { transform: scale(0.985); }
.btn--primary { background: var(--vm-primary); color: var(--on-primary); }
.btn--accent { background: var(--vm-accent); color: var(--on-accent); }
.btn--ghost { background: transparent; box-shadow: inset 0 0 0 2px var(--line-strong); }
.btn--block { width: 100%; }
.btn--big { min-height: 58px; font-size: 1.05rem; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 0.85rem; border-radius: var(--r-s); }
.btn[disabled] { opacity: 0.6; }

/* Главная кнопка тренировки: тёмная плашка со стрелкой справа */
.btn--cta { justify-content: space-between; padding: 0 10px 0 22px; }
.btn__slab {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--r-s);
  background: var(--rail);
  color: var(--vm-ink);
}
.btn__slab svg.lucide, .btn__slab i[data-lucide] { width: 18px; height: 18px; stroke-width: 2.5; }

.iconbtn {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--card);
  color: var(--vm-ink);
  cursor: pointer;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px;
  min-height: 40px;
  border-radius: var(--r-pill);
  border: 0;
  background: var(--card-2);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.chip.is-active, .chip--live { background: var(--vm-primary); color: var(--on-primary); }
.chip--wait { background: var(--plan); color: var(--vm-ink); }
.chip--group {
  background: var(--vm-accent);
  color: var(--on-accent);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 34px;
  padding: 0 12px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: 0.74rem;
  font-weight: 700;
  white-space: nowrap;
  background: var(--card-2);
  color: var(--vm-ink);
}
.badge--ok { background: var(--vm-primary); color: var(--on-primary); }
.badge--warn { background: var(--vm-accent); color: var(--on-accent); }
.badge--miss { background: var(--vm-miss); color: var(--vm-ink); }
.badge--wait { background: var(--plan); color: var(--vm-ink); }

.pill { padding: 7px 12px; border-radius: var(--r-pill); background: var(--card-2); font-size: 0.8rem; }

.alert { border-radius: var(--r-m); padding: 13px 15px; font-size: 0.88rem; }
.alert--ok {
  background: color-mix(in oklab, var(--vm-ok) 16%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--vm-ok) 45%, transparent);
}
.alert--miss {
  background: color-mix(in oklab, var(--vm-miss) 16%, var(--card));
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--vm-miss) 45%, transparent);
}

/* ── Формы ───────────────────────────────────────────────────────── */

.form { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.field__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--vm-ink);
  background: var(--card-2);
  border: 0;
  border-radius: var(--r-s);
  padding: 0 14px;
  min-height: 48px;
}
select.field__input { appearance: none; }
.field__input::placeholder { color: var(--muted); }
textarea.field__input { padding: 13px 14px; min-height: 82px; resize: vertical; field-sizing: content; }
.field__file { font-size: 0.85rem; color: var(--muted); }
.field__file::file-selector-button {
  font: inherit; font-size: 0.85rem; font-weight: 700; margin-inline-end: 10px;
  padding: 10px 14px; border-radius: var(--r-pill);
  border: 0; background: var(--card-2); color: var(--vm-ink); cursor: pointer;
}
.field--grow { flex: 1; }
.grid { display: grid; gap: 10px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.86rem; }
.check input { width: 22px; height: 22px; accent-color: var(--vm-primary); flex: none; margin-top: 2px; }
.check--row { align-items: center; padding: 10px 12px; border-radius: var(--r-s); background: var(--card-2); }
.check a { color: var(--link); font-weight: 700; }
.checklist { display: flex; flex-direction: column; gap: 8px; }

.segmented {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: 4px; padding: 4px; border-radius: var(--r-pill);
  background: var(--card-2);
}
.segmented__item {
  text-align: center; padding: 11px 8px; border-radius: var(--r-pill);
  font-size: 0.85rem; font-weight: 700; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.segmented__item.is-active { background: var(--vm-primary); color: var(--on-primary); }
.segmented--tight .segmented__item { font-size: 0.78rem; padding: 9px 4px; }

/* ── Полоса нагрузки (Signature) ─────────────────────────────────── */

.load { display: flex; flex-direction: column; gap: 10px; padding: 14px 0 0; }
.load__rail {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  min-height: 62px;
  padding: 0 6px;
}
.load__rail::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 6px;
  margin-top: -3px;
  border-radius: 3px;
  background: var(--rail-soft);
}
.load__group { position: relative; display: flex; align-items: center; gap: 3px; }
.load__plate {
  position: relative;
  width: 10px;
  height: 34px;
  border-radius: 3px;
  background: var(--plate-body);
  box-shadow: inset -2px 0 0 rgba(0, 0, 0, 0.22);
  opacity: 0.34;
  transform-origin: 50% 50%;
}
.load--live .load__plate { cursor: pointer; }
.load__plate.is-done { opacity: 1; animation: plate-seat 0.34s cubic-bezier(0.2, 1.4, 0.5, 1); }
@keyframes plate-seat {
  0% { transform: translateY(-16px) scale(1.12); }
  60% { transform: translateY(2px) scale(0.98); }
  100% { transform: translateY(0) scale(1); }
}
.plate--green .load__plate, .load__plate.plate--green { background: var(--plate-green); }
.plate--yellow .load__plate, .load__plate.plate--yellow { background: var(--plate-yellow); }
.plate--blue .load__plate, .load__plate.plate--blue { background: var(--plate-blue); }
.plate--red .load__plate, .load__plate.plate--red { background: var(--plate-red); }
.plate--body .load__plate, .load__plate.plate--body { background: var(--plate-body); }

.load__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.load__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}
.load__legend { display: flex; align-items: center; gap: 8px; font-size: 0.72rem; font-weight: 700; color: var(--muted); }
.load__legend > span { display: inline-flex; align-items: center; gap: 4px; }
.load__key { width: 8px; height: 8px; border-radius: 2px; background: var(--plate-body); }
.load__key--green { background: var(--plate-green); }
.load__key--yellow { background: var(--plate-yellow); }
.load__key--blue { background: var(--plate-blue); }
.load__key--red { background: var(--plate-red); }

/* ── План упражнений, статистика, подсказка тренера ──────────────── */

.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.plan__row { display: flex; gap: 12px; align-items: flex-start; }
.plan__num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  padding-top: 3px;
  font-variant-numeric: tabular-nums;
}
.plan__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.plan__name { font-weight: 700; font-size: 0.98rem; }
.plan__meta { font-size: 0.8rem; color: var(--muted); }
.plan__hint { font-size: 0.78rem; color: var(--link); font-weight: 600; }
.plan--compact .plan__name { font-weight: 600; font-size: 0.9rem; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.stats__item, .stat-run {
  flex: 1 1 30%;
  min-width: 0;
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border-radius: var(--r-s);
  background: var(--rail);
}
/* Длинный контакт (email) занимает всю строку и переносится посимвольно,
   чтобы не вылезать за край карточки. */
.stats__item--wide { flex: 1 1 100%; }
:root[data-theme="light"] .stats__item, :root[data-theme="light"] .stat-run { background: var(--card-2); }
.stats dt {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats dd {
  margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.35rem; letter-spacing: -0.03em;
  overflow-wrap: anywhere; word-break: break-word;
}

/* Крупные карточки-числа: серия, объём, статус */
.statcard {
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 132px;
  border-radius: var(--r-xl);
  padding: 16px;
  background: var(--card);
  color: var(--vm-ink);
  text-align: left;
  border: 0;
}
.statcard--lead { background: var(--vm-primary); color: var(--on-primary); }
.statcard--mint { background: var(--mint); color: var(--on-ink); }
.statcard--paper { background: var(--vm-ink); color: var(--on-ink); }
.statcard__label {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.78;
}
.statcard__num {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 12vw, 3rem);
  line-height: 0.92;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.statcard__note { font-size: 0.82rem; line-height: 1.3; opacity: 0.85; }
.statcards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.coach { display: flex; gap: 10px; align-items: flex-start; padding: 0; border: 0; background: none; }
.coach__mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; flex: none;
  border-radius: 50%;
  background: var(--vm-accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.68rem;
}
.coach__text { font-size: 0.88rem; line-height: 1.45; color: var(--soft); }
.coach__who { display: none; }
.coach--tight { padding: 14px 16px; border-radius: 22px; background: var(--card); }
.coach--tight .coach__mark {
  width: auto; height: auto;
  border-radius: 8px;
  padding: 4px 7px;
  background: var(--plate-yellow);
  color: var(--on-primary);
  border-radius: 8px;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}
.coach--tight .coach__text { color: var(--soft); }

/* ── Строки, люди, лента ─────────────────────────────────────────── */

.row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-radius: var(--r-l);
  border: 0;
  background: var(--card);
}
.row__date {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 52px;
  padding: 8px 6px;
  border-radius: var(--r-s);
  background: var(--rail);
}
:root[data-theme="light"] .row__date { background: var(--card-2); }
.row__weekday { font-size: 0.68rem; color: var(--muted); }
.row__body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.row__title { font-weight: 700; font-size: 0.98rem; }
.row__meta { font-size: 0.78rem; color: var(--muted); }
.row--stack { flex-wrap: wrap; }

.person { display: flex; align-items: center; gap: 12px; }
.person__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.person__name { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }
.person__goal { font-size: 0.82rem; color: var(--muted); }
.person__foot { display: flex; flex-wrap: wrap; gap: 6px; }
.avatar { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; flex: none; background: var(--card-2); }
.avatar--mono {
  display: grid; place-items: center;
  background: var(--vm-accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.feed { gap: 13px; }
.feed__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.feed__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.feed__name { display: block; font-weight: 700; }
.feed__date { display: block; font-size: 0.76rem; color: var(--muted); }
.reply { display: flex; flex-direction: column; gap: 10px; }
.reply__row { display: flex; align-items: center; gap: 8px; }
.reply__row .field__input { background: var(--rail); border-radius: var(--r-s); min-height: 46px; }
:root[data-theme="light"] .reply__row .field__input { background: var(--card-2); }
.reply__row .btn {
  width: 46px; min-height: 46px; padding: 0; flex: none;
  border-radius: var(--r-s);
  background: var(--vm-ink);
  color: var(--on-ink);
}

.anchors { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 4px; scrollbar-width: none; }
.anchors::-webkit-scrollbar { display: none; }

/* ── Календарь ───────────────────────────────────────────────────── */

.month { display: flex; flex-direction: column; gap: 6px; }
/* Над сеткой: месяц с годом и стрелки перехода между месяцами.
   Стрелки стоят вплотную слева и справа от названия месяца — одной строкой,
   и не разъезжаются по краям карточки на узком экране телефона. */
.month__nav {
  display: flex; align-items: center; justify-content: center; flex-wrap: nowrap; gap: 12px;
  margin-bottom: 6px;
}
.month__title {
  margin: 0;
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  letter-spacing: -0.03em;
}
.month__arrow {
  display: grid; place-items: center;
  width: 40px; height: 40px; flex: none;
  border-radius: var(--r-pill);
  background: var(--card-2);
  color: var(--vm-ink);
  transition: background 0.2s ease;
}
:root[data-theme="light"] .month__arrow { background: var(--card-2); }
.month__arrow:hover { background: var(--plan); }
.month__arrow svg.lucide, .month__arrow i[data-lucide] { width: 20px; height: 20px; stroke-width: 2.4; }
.month__head {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.68rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
  text-align: center; margin-bottom: 4px;
}
.month__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day {
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 1;
  border-radius: var(--r-s);
  border: 0;
  background: transparent;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--vm-ink);
  font-variant-numeric: tabular-nums;
}
.day.is-out { opacity: 0.35; }
.day.is-today { box-shadow: inset 0 0 0 2px var(--vm-ink); }
.day--done { background: var(--vm-primary); color: var(--on-primary); }
.day--partial { background: var(--vm-accent); color: var(--on-accent); }
.day--planned { background: var(--plan); color: var(--vm-ink); }
.day--missed { color: var(--muted); }
.day__dot { position: absolute; bottom: 5px; width: 4px; height: 4px; border-radius: 50%; background: transparent; }
.day--done .day__dot { background: var(--on-primary); opacity: 0.7; }
.day--missed .day__dot { background: var(--vm-miss); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 0.74rem; font-weight: 600; color: var(--muted); }
.legend__item { display: inline-flex; align-items: center; gap: 6px; }
.legend__dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.legend__dot--done { background: var(--vm-primary); }
.legend__dot--partial { background: var(--vm-accent); }
.legend__dot--missed { width: 6px; height: 6px; border-radius: 50%; background: var(--vm-miss); }
.legend__dot--planned { background: var(--plan); }

/* ── Экран выполнения ────────────────────────────────────────────── */

.exec { display: flex; flex-direction: column; gap: 14px; }
.exec__track { display: flex; flex-direction: column; }
.exec__step { display: flex; flex-direction: column; gap: 14px; }
.exec__step[hidden] { display: none; }
.exec__head { display: flex; flex-direction: column; gap: 10px; }
.exec__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: -0.035em;
}
.exec__plan { font-size: 0.85rem; color: var(--muted); }
.exec__tip { font-size: 0.78rem; color: var(--muted); text-align: center; }
.exec__actions { margin-top: 2px; }
.exec__segs { display: flex; gap: 6px; }
.exec__seg { flex: 1; height: 8px; border-radius: 4px; background: var(--card-2); overflow: hidden; }
.exec__seg.is-active { box-shadow: 0 0 0 2px var(--rail-soft); }
.exec__seg i { display: block; height: 100%; width: 0; background: var(--vm-primary); border-radius: 4px; transition: width 0.3s ease; }

.sets { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sets__head {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 46px;
  gap: 8px; padding: 0 12px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.68rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.sets__head--time { grid-template-columns: 30px minmax(0, 1fr) 46px; }
/* Упражнение со своим весом: поле веса не нужно, остаются повторы и галочка. */
.sets__head--body { grid-template-columns: 30px minmax(0, 1fr) 46px; }
.sets__head span:nth-child(2), .sets__head span:nth-child(3) { text-align: center; }
.sets__head--time span:nth-child(2) { text-align: center; }
.set {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 46px;
  gap: 8px; align-items: center;
  padding: 10px 12px;
  border-radius: 22px;
  border: 0;
  background: var(--card);
  transition: background 0.25s ease;
}
.set--time { grid-template-columns: 30px minmax(0, 1fr) 46px; }
.set--body { grid-template-columns: 30px minmax(0, 1fr) 46px; }
.set.is-done { background: color-mix(in oklab, var(--vm-primary) 18%, var(--card)); }
.set__index {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.set.is-done .set__index { color: var(--vm-ink); }
.set__check {
  width: 46px; height: 46px; flex: none;
  border-radius: 50%;
  border: 2px solid var(--rail-soft);
  background: transparent; color: transparent;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.set__check svg.lucide, .set__check i[data-lucide] { width: 20px; height: 20px; stroke-width: 3; }
.set__check[aria-pressed="true"] { background: var(--vm-primary); border-color: var(--vm-primary); color: var(--on-primary); }
.set__check:active { transform: scale(0.9); }
.set__field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

/* Счётчик подхода: − значение + в тёмной выемке */
.stepper {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--rail);
  border-radius: var(--r-s);
  padding: 4px;
  min-width: 0;
}
:root[data-theme="light"] .stepper { background: var(--card-2); }
.stepper__btn {
  width: 30px; height: 38px; flex: none;
  border: 0; border-radius: 10px;
  background: transparent; color: var(--muted);
  font-size: 1.25rem; font-weight: 600; line-height: 1;
  cursor: pointer;
}
.stepper__btn:active { background: var(--card); }
.stepper__input {
  width: 100%; min-width: 0; height: 38px;
  border: 0; background: transparent; color: var(--vm-ink);
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 1rem;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper__input:focus-visible { outline: 2px solid var(--vm-primary); outline-offset: 1px; border-radius: 8px; }

.tech { border-top: 1px solid var(--line); padding-top: 10px; }
.tech summary { cursor: pointer; font-weight: 700; font-size: 0.85rem; color: var(--link); }
.tech p { margin-top: 8px; font-size: 0.88rem; color: var(--soft); }
.video { margin-top: 10px; }
.video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--r-s); }

/* ── Модальные листы (отдых, итоги) ──────────────────────────────── */

.sheet {
  border: 0; padding: 0; border-radius: var(--r-l) var(--r-l) 0 0;
  width: 100%; max-width: 480px;
  margin: auto auto 0;
  background: var(--vm-surface); color: var(--vm-ink);
  box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(12px);
  transition: opacity 0.22s ease, transform 0.22s ease, overlay 0.22s allow-discrete, display 0.22s allow-discrete;
}
.sheet[open] { opacity: 1; transform: translateY(0); }
@starting-style { .sheet[open] { opacity: 0; transform: translateY(18px); } }
.sheet::backdrop { background: rgba(0, 0, 0, 0.58); backdrop-filter: blur(4px); }

.rest-timer, .finish {
  padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 16px;
}
.ring { position: relative; display: grid; place-items: center; }
.ring svg { width: min(62vw, 210px); aspect-ratio: 1; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring__track { stroke: var(--card-2); }
.ring__value { stroke: var(--vm-primary); stroke-dasharray: 327; stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s linear; }
.ring__num {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 13vw, 3.4rem);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.rest-timer__row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.rest-timer__row .chip { justify-content: center; cursor: pointer; }
.finish__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.finish__actions { display: flex; gap: 9px; }
.finish__actions .btn { flex: 1; }

.wellbeing { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.wellbeing legend {
  font-family: var(--font-body);
  font-weight: 700; font-size: 0.72rem;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.wellbeing__scale { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.wellbeing__dot { display: grid; place-items: center; }
.wellbeing__dot input { position: absolute; opacity: 0; pointer-events: none; }
.wellbeing__dot span {
  display: grid; place-items: center; width: 100%; min-height: 44px;
  border-radius: 12px; border: 0; background: var(--card-2);
  font-family: var(--font-display); font-weight: 700; font-size: 0.8rem;
  color: var(--muted);
}
.wellbeing__dot input:checked + span { background: var(--vm-primary); color: var(--on-primary); }
.wellbeing__dot input:focus-visible + span { outline: 3px solid var(--vm-primary); outline-offset: 2px; }
.wellbeing__ends { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); }

/* ── Служебные состояния ─────────────────────────────────────────── */

.skeleton-stack { display: flex; flex-direction: column; gap: 10px; }
.skeleton {
  border-radius: var(--r-xl);
  background: linear-gradient(100deg, var(--card) 30%, var(--card-2) 50%, var(--card) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton--card { height: 104px; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }

.chart { position: relative; min-height: 200px; display: grid; }
.chart canvas { width: 100% !important; }

.empty { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 24px 14px; }
.empty--page { padding-block: 44px; }
.empty__mark {
  display: grid; place-items: center;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--card-2); color: var(--muted);
}
.empty__title { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }
.empty__text { font-size: 0.86rem; color: var(--muted); max-width: 34ch; }

.rest { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px 10px; }
.rest__mark {
  display: grid; place-items: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: color-mix(in oklab, var(--vm-accent) 26%, var(--card));
  color: var(--vm-ink);
}
.rest__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.9rem;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.rest__text { font-size: 0.88rem; color: var(--muted); max-width: 36ch; }

.photo { border-radius: var(--r-m); aspect-ratio: 4 / 5; object-fit: cover; width: 100%; background: var(--card-2); }

.toasts {
  /* Уведомление держим ниже шапки (.appbar, высота ≈ 44px + отступы), чтобы
     оно её не перекрывало. */
  position: fixed;
  top: calc(max(14px, env(safe-area-inset-top)) + 66px);
  left: 50%;
  transform: translateX(-50%);
  width: min(456px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px;
  z-index: 60;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-m);
  background: var(--vm-ink); color: var(--on-ink);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  opacity: 0; transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast[data-open] { opacity: 1; transform: translateY(0); }
@starting-style { .toast[data-open] { opacity: 0; transform: translateY(-14px); } }
.toast__text { flex: 1; }
.toast__action {
  color: inherit; font: inherit; font-weight: 700;
  background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.toast--miss { background: var(--vm-miss); color: var(--vm-ink); }
.toast--ok { background: var(--vm-accent); color: var(--on-accent); }

/* ── Авторизация ─────────────────────────────────────────────────── */

.auth { display: flex; flex-direction: column; gap: 16px; }
.auth-mark {
  display: grid; place-items: center;
  width: 68px; height: 68px;
  border-radius: 22px;
  background: var(--vm-primary);
  color: var(--on-primary);
}
.auth-mark svg.lucide, .auth-mark i[data-lucide] { width: 34px; height: 34px; stroke-width: 2.2; }
.auth__hero { margin: 0; border-radius: var(--r-l); overflow: hidden; position: relative; background: var(--card); }
.auth__hero img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.auth__herocap {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 26px 14px 12px;
  font-size: 0.74rem; font-weight: 700; color: #fff;
  background: linear-gradient(to top, rgba(18, 19, 25, 0.78), transparent);
}
.auth__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 0.98;
  letter-spacing: -0.045em;
}
.auth__lead { font-size: 0.92rem; color: var(--muted); }
.auth__note { display: flex; flex-direction: column; gap: 8px; font-size: 0.86rem; color: var(--muted); }

.legal { display: flex; flex-direction: column; gap: 12px; }
.legal__title { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -0.035em; }
.legal h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; margin-top: 8px; }
.legal p { font-size: 0.9rem; color: var(--soft); }

/* ── Конструктор ─────────────────────────────────────────────────── */

.builder { display: flex; flex-direction: column; gap: 16px; }
.rows { display: flex; flex-direction: column; gap: 12px; }
.row-item {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px; border-radius: var(--r-l);
  background: var(--card);
}
.row-item__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.field--time { max-width: 140px; }
.addbox { padding: 0; overflow: hidden; background: var(--card); border-radius: var(--r-l); }
.addbox__summary {
  padding: 16px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -0.03em;
  display: flex; align-items: center; gap: 10px;
}
.addbox[open] .addbox__summary { border-bottom: 1px solid var(--line); }
.addbox .form { padding: 16px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; }

.invite { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: var(--r-l); background: var(--card-2); }
.invite__link { font-size: 0.76rem; word-break: break-all; color: var(--muted); }
.invite__row { display: flex; flex-wrap: wrap; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sheet { opacity: 1; transform: none; }
}

@view-transition { navigation: auto; }
