/* Дизайн-система приложения «Тренер»: спокойная, плотная типографика и много воздуха. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f0f1f4;
  --line: #e5e7eb;
  --line-strong: #d3d7de;
  --text: #10131a;
  --text-2: #545b68;
  --text-3: #878e9b;
  --accent: #2f6df6;
  --accent-soft: #eaf0ff;
  --ink: #14181f;
  --ok: #12855a;
  --ok-soft: #e6f5ee;
  --warn: #b4711b;
  --warn-soft: #fdf2e2;
  --danger: #c8362f;
  --danger-soft: #fdecea;
  --r-s: 10px;
  --r: 14px;
  --r-l: 20px;
  --shadow: 0 1px 2px rgba(16, 19, 26, .05), 0 8px 24px -12px rgba(16, 19, 26, .12);
  --shadow-lg: 0 24px 60px -20px rgba(16, 19, 26, .28);
  --nav-h: 64px;
  --topbar-h: 63px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --num: 'SF Mono', ui-monospace, 'Segoe UI', var(--font);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0f13;
    --surface: #16191f;
    --surface-2: #1b1f26;
    --surface-3: #232830;
    --line: #262b33;
    --line-strong: #333a45;
    --text: #f2f4f7;
    --text-2: #a4acba;
    --text-3: #78808e;
    --accent: #5b8cff;
    --accent-soft: #1a2440;
    --ink: #f2f4f7;
    --ok: #3ec18a;
    --ok-soft: #14291f;
    --warn: #e0a95d;
    --warn-soft: #2b2113;
    --danger: #ef6b62;
    --danger-soft: #2e1817;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -18px rgba(0, 0, 0, .8);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, .8);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { overscroll-behavior-y: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

/* ─────────── Загрузка ─────────── */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 16px; }
.boot-logo {
  width: 52px; height: 52px; border-radius: 16px; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; font-weight: 700; font-size: 24px;
}
.boot-text { color: var(--text-3); font-size: 14px; }

/* ─────────── Каркас ─────────── */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px calc(var(--nav-h) + 32px); }
.main.wide { max-width: 1400px; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { width: 100%; max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.topbar.wide .topbar-inner { max-width: 1400px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: var(--surface);
  display: grid; place-items: center; font-size: 15px; font-weight: 700;
}
.spacer { flex: 1; }

.desk-nav { display: none; gap: 4px; }
.desk-nav a {
  padding: 8px 12px; border-radius: 10px; font-size: 14px; font-weight: 550; color: var(--text-2);
}
.desk-nav a:hover { background: var(--surface-3); color: var(--text); }
.desk-nav a.active { background: var(--ink); color: var(--surface); }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  display: grid; justify-items: center; gap: 3px; padding: 9px 4px 8px;
  font-size: 11px; color: var(--text-3); font-weight: 550;
}
.bottom-nav a.active { color: var(--text); }
.bottom-nav svg { width: 22px; height: 22px; stroke-width: 1.7; }
.bottom-nav a.active svg { stroke-width: 2.2; }

@media (min-width: 860px) {
  .bottom-nav { display: none; }
  .desk-nav { display: flex; }
  .main { padding: 28px 24px 64px; }
  h1 { font-size: 30px; }
}

/* ─────────── Базовые элементы ─────────── */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 18px; box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card.flat { box-shadow: none; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { flex: 1; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: 1fr; }
.g3 { grid-template-columns: 1fr; }
.g4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 700px) {
  .g2 { grid-template-columns: repeat(2, 1fr); }
  .g3 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .g4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1080px) {
  .g3 { grid-template-columns: repeat(3, 1fr); }
}
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 10px; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.mb { margin-bottom: 16px; }

.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

.page-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { flex: 1; min-width: 200px; }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; height: 42px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 550;
  cursor: pointer; transition: transform .06s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 88%, var(--accent)); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0d0f13; } }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-lg { height: 54px; font-size: 17px; border-radius: 14px; padding: 0 22px; }
.btn-sm { height: 34px; font-size: 13px; padding: 0 12px; border-radius: 10px; }
.btn-icon { width: 38px; padding: 0; }
.btn-block { width: 100%; }

/* Поля ввода */
.field { display: grid; gap: 6px; }
.field > label { font-size: 13px; font-weight: 550; color: var(--text-2); }
.input, select.input, textarea.input {
  width: 100%; height: 44px; padding: 0 12px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  outline: none; transition: border-color .15s ease, box-shadow .15s ease;
}
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23878e9b' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.hint { font-size: 12px; color: var(--text-3); }
.err { font-size: 13px; color: var(--danger); }

/* Метки и статусы */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-2);
  white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.own { background: var(--accent-soft); color: var(--accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 550;
  padding: 7px 12px; border-radius: 9px; cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* Аватар */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 650; font-size: 16px; color: #fff; flex: none; letter-spacing: -.02em;
}
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.xs { width: 26px; height: 26px; font-size: 10px; box-shadow: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }

/* Крупные показатели */
.stat { display: grid; gap: 3px; }
.stat-value { font-size: 28px; font-weight: 680; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 550; }
.stat-sub { font-size: 13px; color: var(--text-2); }
.stat.big .stat-value { font-size: 40px; }
.delta { font-size: 13px; font-weight: 600; }
.delta.down { color: var(--ok); }
.delta.up { color: var(--warn); }
.delta.flat { color: var(--text-3); }
.delta.neutral { color: var(--text); }

/* Списки */
.list { display: grid; gap: 1px; background: var(--line); border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.list-item { background: var(--surface); padding: 13px 14px; display: flex; align-items: center; gap: 12px; }
.list-item.link { cursor: pointer; }
.list-item.link:hover { background: var(--surface-2); }
.list-item .grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }

.empty { text-align: center; padding: 36px 20px; color: var(--text-3); display: grid; gap: 10px; justify-items: center; }
.empty h3 { color: var(--text-2); }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

/* Вкладки */
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 11px 14px; font-size: 14.5px; font-weight: 550;
  color: var(--text-3); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--ink); }

/* ─────────── Главная ученика ─────────── */
.hero {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; inset: auto -60px -80px auto; width: 220px; height: 220px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  pointer-events: none;
}
.hero-label { font-size: 12.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.hero h2 { font-size: 25px; margin: 6px 0 10px; }
.hero-meta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-2); font-size: 14px; margin-bottom: 16px; }
.hero-note {
  background: var(--surface-3); border-radius: var(--r); padding: 11px 13px; font-size: 14px;
  color: var(--text-2); margin-bottom: 16px; border-left: 3px solid var(--accent);
}

/* ─────────── Режим тренировки ─────────── */
/* Прилипает под верхней панелью, чтобы прогресс и таймер были видны всю тренировку. */
.workout-top {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
  padding: 10px 16px; margin: -20px -16px 0;
}
@media (min-width: 860px) { .workout-top { margin: -28px -24px 0; } }
.workout-top-inner { max-width: 900px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.progress-line { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; flex: 1; }
.progress-line span { display: block; height: 100%; background: var(--ok); transition: width .3s ease; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; }

.ex-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); overflow: hidden; }
.ex-card.done { border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); }
.ex-card.skipped { opacity: .6; }
.ex-head { padding: 16px 16px 12px; display: flex; gap: 12px; align-items: flex-start; }
.ex-index {
  width: 28px; height: 28px; border-radius: 9px; background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center; font-size: 13px; font-weight: 650; flex: none;
}
.ex-card.done .ex-index { background: var(--ok-soft); color: var(--ok); }
.ex-plan { font-size: 14px; color: var(--text-2); margin-top: 3px; }
.ex-comment {
  margin: 0 16px 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: var(--r-s);
  font-size: 13.5px; color: var(--text); line-height: 1.45;
}
.ex-prev { margin: 0 16px 12px; font-size: 13.5px; color: var(--text-2); }
.ex-prev b { color: var(--text); font-weight: 600; }

.sets { display: grid; gap: 8px; padding: 0 12px 12px; }
.set-row {
  display: grid; grid-template-columns: 34px 1fr 1fr 52px; gap: 8px; align-items: center;
  padding: 8px; border-radius: var(--r); background: var(--surface-2); border: 1px solid transparent;
}
.set-row.done { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.set-no { text-align: center; font-size: 13px; font-weight: 650; color: var(--text-3); }
.set-row.done .set-no { color: var(--ok); }
.set-field { position: relative; }
.set-field input {
  width: 100%; height: 46px; text-align: center; font-size: 17px; font-weight: 600;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  outline: none; font-variant-numeric: tabular-nums; padding: 0 4px 0 0;
}
.set-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.set-field .unit { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-3); pointer-events: none; }
.set-check {
  width: 46px; height: 46px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-3);
}
.set-check:hover { border-color: var(--ok); color: var(--ok); }
.set-row.done .set-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.set-check svg { width: 22px; height: 22px; }
.sets-head { display: grid; grid-template-columns: 34px 1fr 1fr 52px; gap: 8px; padding: 0 8px; font-size: 11.5px; color: var(--text-3); font-weight: 600; }
.ex-actions { display: flex; gap: 8px; padding: 0 12px 14px; flex-wrap: wrap; }

/* ─────────── Графики ─────────── */
.chart { width: 100%; display: block; overflow: visible; touch-action: pan-y; }
.chart-wrap { position: relative; }
.chart-tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg);
  padding: 6px 9px; border-radius: 8px; font-size: 12px; font-weight: 550; white-space: nowrap;
  transform: translate(-50%, -120%); opacity: 0; transition: opacity .12s ease; z-index: 5;
}
@media (prefers-color-scheme: dark) { .chart-tip { color: #0d0f13; } }
.chart-tip.show { opacity: 1; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }

/* ─────────── Календарь ─────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.cal-wd { text-align: center; font-size: 11.5px; color: var(--text-3); font-weight: 600; padding-bottom: 4px; }
.cal-day {
  aspect-ratio: 1; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2);
  display: grid; place-content: center; gap: 3px; justify-items: center; cursor: pointer; position: relative;
  font-size: 13px; color: var(--text-2);
}
.cal-day:hover { border-color: var(--line-strong); }
.cal-day.other { opacity: .35; }
.cal-day.today { border-color: var(--accent); border-width: 2px; color: var(--text); font-weight: 650; }
.cal-day.done { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok); font-weight: 600; }
.cal-day.planned { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent); font-weight: 600; }
.cal-day.skipped { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 25%, transparent); color: var(--danger); }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ─────────── Карточка упражнения (наведение) ─────────── */
.popover {
  position: fixed; z-index: 90; width: 320px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  box-shadow: var(--shadow-lg); overflow: hidden; animation: pop .14s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(.98); } }
.popover-media { height: 148px; background: var(--surface-3); display: grid; place-items: center; position: relative; }
.popover-media img { width: 100%; height: 100%; object-fit: cover; }
.popover-body { padding: 12px 14px 14px; display: grid; gap: 7px; }
.ex-link { border-bottom: 1px dotted var(--line-strong); cursor: pointer; }
.ex-link:hover { border-bottom-color: var(--accent); color: var(--accent); }
.help-dot {
  width: 19px; height: 19px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text-3); font-size: 11px; font-weight: 700; display: inline-grid; place-items: center;
  cursor: pointer; flex: none; vertical-align: middle;
}
.help-dot:hover { border-color: var(--accent); color: var(--accent); }

/* ─────────── Модальные окна ─────────── */
.modal-back {
  position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 16, .45);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .16s ease;
  backdrop-filter: blur(2px);
}
@keyframes fade { from { opacity: 0; } }
.modal {
  background: var(--surface); width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto;
  border-radius: 22px 22px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: slide .22s cubic-bezier(.2, .8, .3, 1); box-shadow: var(--shadow-lg);
}
@keyframes slide { from { transform: translateY(24px); opacity: .6; } }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { flex: 1; }
@media (min-width: 700px) {
  .modal-back { align-items: center; padding: 20px; }
  .modal { border-radius: var(--r-l); }
}

/* ─────────── Всплывающие сообщения ─────────── */
.toast-root {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px);
  z-index: 95; display: grid; gap: 8px; width: min(420px, calc(100vw - 24px));
}
@media (min-width: 860px) { .toast-root { bottom: 20px; } }
.toast {
  background: var(--ink); color: var(--bg); padding: 12px 14px; border-radius: 12px;
  font-size: 14px; font-weight: 550; box-shadow: var(--shadow-lg); animation: pop .16s ease;
  display: flex; gap: 8px; align-items: center;
}
@media (prefers-color-scheme: dark) { .toast { color: #0d0f13; } }
.toast.err { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }

/* ─────────── Вход ─────────── */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo { display: grid; justify-items: center; gap: 10px; margin-bottom: 22px; }
.auth-logo .brand-mark { width: 46px; height: 46px; border-radius: 14px; font-size: 21px; }
.role-pick { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.role-btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r);
  padding: 14px 12px; cursor: pointer; text-align: left; display: grid; gap: 3px; color: var(--text);
}
.role-btn.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.demo-users { display: grid; gap: 6px; }
.demo-user {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); cursor: pointer; font-size: 13.5px;
}
.demo-user:hover { border-color: var(--line-strong); }

/* ─────────── Ученики (тренер) ─────────── */
.student-card { display: grid; gap: 14px; cursor: pointer; align-content: start; }
.student-card .grow { min-width: 0; }
.student-card:hover { border-color: var(--line-strong); }
.kv { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 3px 0; }
.kv span:first-child { color: var(--text-3); }
.kv span:last-child { font-weight: 550; text-align: right; }

/* Перетаскивание упражнений в программе */
.drag-item { cursor: grab; }
.drag-item.dragging { opacity: .4; }
.drag-item.over { box-shadow: inset 0 2px 0 var(--accent); }
.drag-handle { color: var(--text-3); cursor: grab; padding: 4px; line-height: 0; }

.notif-dot { position: absolute; top: 5px; right: 5px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.icon-btn { position: relative; }

.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }

.scroll-x { overflow-x: auto; scrollbar-width: thin; }

/* ─────────── Визуальное обновление 2026 ───────────
   Тёплая нейтральная основа, один лаймовый акцент и спокойная геометрия. */
:root {
  --bg: #f3f4ee;
  --surface: #ffffff;
  --surface-2: #f8f9f4;
  --surface-3: #eceee6;
  --line: rgba(23, 28, 23, .09);
  --line-strong: rgba(23, 28, 23, .16);
  --text: #171b17;
  --text-2: #626a62;
  --text-3: #92998f;
  --accent: #719b17;
  --accent-bright: #c8f169;
  --accent-soft: #eff9d9;
  --ink: #191e19;
  --ok: #397b52;
  --ok-soft: #e8f4eb;
  --warn: #a86b19;
  --warn-soft: #fbf0dc;
  --danger: #b84238;
  --danger-soft: #fae9e7;
  --r-s: 12px;
  --r: 17px;
  --r-l: 24px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .8) inset, 0 8px 30px rgba(25, 30, 25, .035);
  --shadow-lg: 0 28px 70px rgba(17, 22, 17, .2);
  --nav-h: 70px;
  --topbar-h: 66px;
  --font: 'Segoe UI Variable', 'Segoe UI', -apple-system, BlinkMacSystemFont, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111411;
    --surface: #191d19;
    --surface-2: #1e231e;
    --surface-3: #272d27;
    --line: rgba(242, 246, 238, .08);
    --line-strong: rgba(242, 246, 238, .15);
    --text: #f2f5ee;
    --text-2: #aab1a7;
    --text-3: #777f75;
    --accent: #b8e35d;
    --accent-bright: #c8f169;
    --accent-soft: #29351e;
    --ink: #eff3eb;
    --ok: #71c48c;
    --ok-soft: #1c3022;
    --warn: #e3ae62;
    --warn-soft: #34291a;
    --danger: #ee8177;
    --danger-soft: #38201e;
    --shadow: 0 1px 0 rgba(255, 255, 255, .025) inset, 0 12px 36px rgba(0, 0, 0, .14);
    --shadow-lg: 0 32px 80px rgba(0, 0, 0, .52);
  }
}

html { scrollbar-color: var(--line-strong) transparent; }
html, body { min-height: 100%; }
body {
  background:
    radial-gradient(circle at 80% -10%, color-mix(in srgb, var(--accent-bright) 11%, transparent), transparent 31rem),
    var(--bg);
}

button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 30%, transparent); outline-offset: 2px; }
h1, h2, h3, h4 { font-weight: 680; letter-spacing: -.035em; }
h1 { font-size: clamp(28px, 3vw, 38px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; letter-spacing: -.025em; }

/* Каркас и навигация */
.topbar { padding: 11px 14px; border-color: var(--line); }
.topbar-inner { gap: 10px; }
.brand { gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--ink); color: var(--bg); font-size: 16px;
  box-shadow: 0 8px 24px rgba(15, 20, 15, .12);
}
.brand-copy { display: grid; line-height: 1.05; gap: 4px; }
.brand-copy > span { font-size: 16px; }
.brand-copy small { font-size: 10px; color: var(--text-3); font-weight: 550; letter-spacing: .02em; }
.topbar-actions { display: flex; align-items: center; gap: 5px; }
.profile-shortcut {
  border: 0; background: transparent; color: inherit; display: flex; align-items: center; gap: 10px;
  padding: 4px; border-radius: 14px; cursor: pointer; font-family: inherit;
}
.profile-shortcut:hover { background: var(--surface-3); }
.profile-shortcut-copy { display: none; min-width: 0; line-height: 1.2; text-align: left; }
.profile-shortcut-copy b { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.profile-shortcut-copy small { color: var(--text-3); font-size: 11px; }

.bottom-nav {
  left: 10px; right: 10px; bottom: 9px; border: 1px solid var(--line);
  border-radius: 20px; overflow: hidden; padding: 5px 4px calc(5px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 16px 40px rgba(20, 25, 20, .12);
}
.bottom-nav a { padding: 7px 2px 5px; border-radius: 15px; transition: color .18s ease, background .18s ease; }
.bottom-nav a.active { color: var(--text); background: var(--accent-soft); }
.bottom-nav a.active svg { color: var(--accent); }

@media (min-width: 860px) {
  .shell { display: block; }
  .topbar {
    position: fixed; left: 18px; top: 18px; bottom: 18px; width: 246px; z-index: 50;
    padding: 18px 14px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 28px;
    color: #f4f7ef; background: #1b201b; box-shadow: 0 24px 64px rgba(18, 23, 18, .16);
    backdrop-filter: none;
  }
  .topbar-inner { height: 100%; flex-direction: column; align-items: stretch; max-width: none; margin: 0; }
  .topbar.wide .topbar-inner { max-width: none; }
  .topbar .brand { padding: 2px 7px 22px; }
  .topbar .brand-mark { background: var(--accent-bright); color: #1a2115; box-shadow: none; }
  .topbar .brand-copy > span { color: #f4f7ef; font-size: 17px; }
  .topbar .brand-copy small { color: #8f998c; }
  .desk-nav { display: flex; flex-direction: column; gap: 5px; }
  .desk-nav a {
    min-height: 43px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border-radius: 14px;
    color: #aeb6ab; font-size: 14px; font-weight: 560; transition: background .16s ease, color .16s ease, transform .16s ease;
  }
  .desk-nav a svg { color: #788176; }
  .desk-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: translateX(2px); }
  .desk-nav a.active { background: var(--accent-bright); color: #192015; }
  .desk-nav a.active svg { color: #192015; }
  .topbar .spacer { min-height: 18px; }
  .topbar-actions { flex-direction: column; align-items: stretch; gap: 7px; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 13px; }
  .topbar-actions .icon-btn { position: absolute; right: 15px; top: 16px; color: #aeb6ab; border-radius: 12px; }
  .topbar-actions .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .07); }
  .profile-shortcut { padding: 7px; color: #f4f7ef; }
  .profile-shortcut:hover { background: rgba(255, 255, 255, .06); }
  .profile-shortcut-copy { display: grid; }
  .profile-shortcut-copy small { color: #8f998c; }
  .main, .main.wide {
    max-width: 1460px; width: auto; margin: 0 0 0 282px; padding: 34px 34px 64px;
  }
  .workout-top { top: 0; margin: -34px -34px 0; padding-left: 316px; }
}

/* Поверхности и ритм */
.main > .col { animation: page-in .28s ease both; }
@keyframes page-in { from { opacity: 0; transform: translateY(5px); } }
.card, .hero, .ex-card {
  border-color: var(--line); box-shadow: var(--shadow);
}
.card { padding: 20px; }
.card.tight { padding: 16px; }
.card-head { margin-bottom: 16px; }
.card-head .btn-ghost { margin-right: -7px; }
.grid { gap: 16px; }
.col { gap: 12px; }
.page-head { align-items: center; margin-bottom: 22px; }
.page-head h1 { min-width: min(260px, 100%); }
.divider { margin: 17px 0; }

/* Кнопки и поля */
.btn {
  height: 44px; border-radius: 14px; border-color: var(--line-strong); padding: 0 17px;
  font-weight: 620; transition: transform .12s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.btn:hover { border-color: color-mix(in srgb, var(--text) 24%, transparent); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); box-shadow: 0 8px 22px rgba(20, 25, 20, .14); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 90%, var(--accent)); box-shadow: 0 10px 28px rgba(20, 25, 20, .18); }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-lg { height: 54px; border-radius: 16px; }
.btn-sm { height: 34px; border-radius: 11px; padding: 0 12px; }
.btn-icon { width: 42px; padding: 0; }
.input, select.input, textarea.input {
  height: 48px; padding-left: 14px; border-radius: 14px; background: var(--surface-2); border-color: var(--line);
}
textarea.input { padding: 12px 14px; }
.input:hover { border-color: var(--line-strong); }
.input:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.field { gap: 7px; }
.field > label { font-size: 12px; font-weight: 650; letter-spacing: .01em; }

/* Главный акцент */
.hero {
  padding: clamp(22px, 4vw, 36px); border: 0; color: #f5f8f0; background:
    radial-gradient(circle at 88% 20%, rgba(200, 241, 105, .18), transparent 25rem),
    linear-gradient(135deg, #1b211b 0%, #222a20 100%);
  box-shadow: 0 24px 60px rgba(25, 32, 25, .16);
}
.hero::before {
  content: ''; position: absolute; width: 170px; height: 170px; right: -45px; bottom: -72px;
  border: 34px solid rgba(200, 241, 105, .07); border-radius: 50%; pointer-events: none;
}
.hero::after { background: none; }
.hero-label { color: var(--accent-bright); font-size: 11px; letter-spacing: .1em; }
.hero h2 { margin: 9px 0 12px; font-size: clamp(25px, 4vw, 34px); color: #fff; }
.hero .muted, .hero .dim, .hero-meta { color: #aeb7aa; }
.hero-meta { gap: 9px 20px; margin-bottom: 20px; }
.hero-note { color: #dde4d8; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .08); border-left: 3px solid var(--accent-bright); }
.hero .btn-primary { background: var(--accent-bright); border-color: var(--accent-bright); color: #172015; box-shadow: none; }
.hero .btn-primary:hover { background: #d4fa7d; box-shadow: 0 10px 34px rgba(165, 214, 71, .18); }
.hero .badge.warn { background: rgba(255, 210, 127, .12); color: #f2c575; }

/* Статистика, списки, вкладки */
.stat { gap: 5px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.045em; }
.stat-label { font-size: 11.5px; letter-spacing: .015em; text-transform: uppercase; }
.stat.big .stat-value { font-size: clamp(38px, 5vw, 50px); }
.badge { padding: 4px 9px; font-size: 11px; font-weight: 680; }
.list { gap: 0; background: transparent; border-radius: var(--r); }
.list-item { padding: 14px 15px; border-bottom: 1px solid var(--line); transition: background .15s ease; }
.list-item:last-child { border-bottom: 0; }
.list-item.link:hover { background: var(--surface-2); }
.tabs { gap: 5px; border-bottom: 0; background: var(--surface-3); padding: 4px; border-radius: 15px; }
.tabs button { padding: 9px 13px; border: 0; border-radius: 11px; }
.tabs button.active { background: var(--surface); border: 0; box-shadow: 0 3px 12px rgba(20, 25, 20, .06); }
.segmented { border-radius: 14px; }
.segmented button { border-radius: 11px; }
.chip { border-color: var(--line); background: var(--surface-2); }
.chip.active { color: var(--bg); }
.avatar { box-shadow: 0 0 0 3px var(--surface); }
.student-card { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.student-card:hover { transform: translateY(-2px); box-shadow: 0 18px 46px rgba(25, 30, 25, .08); }

/* Питание и индивидуальные задачи */
.student-picker { width: min(260px, 100%); height: 44px; }
.nutrition-intro {
  display: flex; align-items: center; gap: 13px; padding: 16px 18px; border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 18%, var(--line));
}
.nutrition-intro-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--surface); color: var(--accent); flex: none; }
.nutrition-list, .task-list { max-width: 940px; width: 100%; }
.nutrition-card, .task-card { overflow: hidden; }
.nutrition-card .card-head { align-items: flex-start; }
.meal-badge, .status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px;
  font-size: 11px; line-height: 1; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
.meal-badge { margin-right: 8px; }
.nutrition-body, .task-body { white-space: pre-wrap; line-height: 1.65; color: var(--text-2); margin: 2px 0 15px; }
.nutrition-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 17px; }
.nutrition-photo { border: 0; padding: 0; background: var(--surface-2); border-radius: 15px; overflow: hidden; cursor: zoom-in; aspect-ratio: 1.12; }
.nutrition-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.nutrition-photo:hover img { transform: scale(1.025); }
.photo-input { display: none; }
.photo-drop { min-height: 108px; border: 1.5px dashed var(--line-strong); border-radius: 17px; display: grid; place-items: center; align-content: center; gap: 4px; cursor: pointer; color: var(--text-2); background: var(--surface-2); }
.photo-drop:hover { border-color: var(--accent); color: var(--accent); }
.photo-view { display: grid; place-items: center; min-height: 200px; }
.photo-view img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: 14px; }
.bench-easter { text-align: center; display: grid; justify-items: center; gap: 14px; padding: 4px 4px 8px; }
.bench-easter-weight {
  width: 136px; height: 136px; display: grid; place-content: center; border-radius: 50%; color: #172015;
  background: var(--accent-bright); box-shadow: 0 18px 45px color-mix(in srgb, var(--accent) 22%, transparent);
  transform: rotate(-3deg);
}
.bench-easter-weight b { display: block; font-size: 54px; line-height: .85; letter-spacing: -.07em; }
.bench-easter-weight span { display: block; margin-top: 8px; font-size: 15px; font-weight: 800; letter-spacing: .18em; }
.bench-easter h2 { max-width: 360px; font-size: clamp(22px, 6vw, 30px); }
.bench-easter p { max-width: 360px; }
.nutrition-discussion, .task-thread { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.discussion-title { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .035em; margin-bottom: 11px; }
.discussion-title .badge { margin-left: auto; }
.nutrition-comments, .task-comments { display: grid; gap: 9px; }
.comment-bubble { display: flex; align-items: flex-start; gap: 9px; max-width: 86%; }
.comment-bubble.student { margin-left: auto; flex-direction: row-reverse; }
.comment-bubble > .grow { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px 14px 14px; padding: 9px 11px; min-width: 0; }
.comment-bubble.student > .grow { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 15%, var(--line)); border-radius: 14px 5px 14px 14px; }
.comment-meta { display: flex; gap: 9px; align-items: baseline; font-size: 10px; color: var(--text-3); }
.comment-meta b { color: var(--text-2); font-size: 11px; }
.comment-text { white-space: pre-wrap; font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.comment-compose { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.comment-compose textarea.input { min-height: 44px; max-height: 110px; resize: vertical; flex: 1; padding-top: 10px; }
.comment-compose .btn { flex: none; }
.task-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 940px; }
.task-card { border-left: 4px solid var(--accent); }
.task-card.done { border-left-color: var(--ok); opacity: .9; }
.task-card-top { display: flex; align-items: flex-start; gap: 12px; }
.task-card h3 { font-size: 19px; }
.task-student { display: flex; align-items: center; gap: 5px; color: var(--accent); font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.task-meta { margin-top: 7px; gap: 6px 16px; color: var(--text-3); font-size: 12px; }
.task-meta span { display: inline-flex; gap: 5px; align-items: center; }
.task-meta .overdue { color: var(--danger); font-weight: 650; }
.task-body { padding: 14px 0 2px; }
.task-status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 13px 0 15px; }
.status-pill.open { background: var(--warn-soft); color: var(--warn); }
.status-pill.done { background: var(--ok-soft); color: var(--ok); }

/* Тренировка */
.workout-top { background: color-mix(in srgb, var(--bg) 90%, transparent); }
.progress-line { height: 6px; }
.progress-line span { background: var(--accent); }
.ex-card { border-radius: 22px; }
.ex-card.done { border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); }
.ex-head { padding: 19px 18px 14px; }
.ex-index { width: 32px; height: 32px; border-radius: 11px; }
.sets { gap: 7px; padding: 0 14px 14px; }
.set-row { border-radius: 14px; background: var(--surface-2); }
.set-field input { border-radius: 12px; background: var(--surface); }
.set-check { border-radius: 13px; }
.ex-actions { padding: 1px 14px 16px; }

/* Календарь, окна и вход */
.cal { gap: 7px; }
.cal-day { border-radius: 13px; border-color: transparent; background: var(--surface-2); }
.cal-day.today { border-color: var(--text); }
.modal-back { background: rgba(12, 16, 12, .55); backdrop-filter: blur(6px); }
.modal { border: 1px solid var(--line); }
.toast { border-radius: 15px; }
.auth-wrap {
  padding: 28px 18px; background:
    radial-gradient(circle at 14% 12%, color-mix(in srgb, var(--accent-bright) 24%, transparent), transparent 25rem),
    radial-gradient(circle at 90% 88%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 28rem);
}
.auth-card { max-width: 440px; }
.auth-logo { margin-bottom: 24px; }
.auth-logo .brand-mark { width: 54px; height: 54px; border-radius: 18px; background: #1b211b; color: var(--accent-bright); font-size: 22px; }
.auth-logo h1 { font-size: 30px; }
.auth-card > .card { padding: 24px; border-radius: 26px; box-shadow: 0 24px 70px rgba(26, 33, 25, .09); }
.role-btn { border-color: var(--line); background: var(--surface-2); border-radius: 16px; transition: border .15s ease, background .15s ease; }
.role-btn.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.demo-user { padding: 10px 11px; border-radius: 13px; background: var(--surface-2); border-color: transparent; flex-wrap: wrap; }

@media (max-width: 699px) {
  .main { padding: 18px 13px calc(var(--nav-h) + 34px); }
  .card { padding: 17px; border-radius: 20px; }
  .hero { border-radius: 22px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 29px; }
  .g4 { gap: 10px; }
  .g4 .stat-value { font-size: 24px; }
  .cal { gap: 4px; }
  .cal-day { border-radius: 10px; }
  .table { min-width: 600px; }
  .role-pick { grid-template-columns: 1fr; }
  .nutrition-photos { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .nutrition-photo { border-radius: 12px; }
  .task-toolbar { align-items: flex-start; flex-direction: column; }
  .comment-bubble { max-width: 96%; }
  .student-picker { width: 100%; }
}

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