/* Оформление внутренних страниц тренера.
   Без веб-шрифтов и внешних ресурсов: всё работает локально и не утекает наружу. */

:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --text: #1d211f;
  --muted: #6b736e;
  --line: #e2e5e1;
  --accent: #2f6b4f;
  --accent-soft: #eaf2ed;
  --warn-bg: #fdf3f2;
  --warn-line: #e8c4bf;
  --warn-text: #8c3a2f;
  --ok-bg: #f0f5f1;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px 20px; padding-top: 18px; padding-bottom: 16px; flex-wrap: wrap;
}
.top-inner > div:first-child { min-width: 0; flex: 0 1 auto; }
.top h1 { margin: 0; font-size: 22px; letter-spacing: -0.01em; line-height: 1.2; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.top-note { color: var(--muted); font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }

.top-nav { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top-nav a {
  padding: 7px 9px; border-radius: 999px; text-decoration: none;
  color: var(--muted); font-size: 14px; border: 1px solid transparent;
  white-space: nowrap;
}
.top-nav a:hover { color: var(--text); }
.top-nav a.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; }
.filters.levels { margin-top: 10px; align-items: center; }
.filters-label { color: var(--muted); font-size: 14px; margin-right: 2px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--text); text-decoration: none; font-size: 14px;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-count { color: var(--muted); font-size: 13px; }
.chip.on .chip-count { color: rgba(255, 255, 255, 0.75); }

.found { color: var(--muted); font-size: 14px; margin: 18px 0 12px; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.pattern { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.focus-strength { background: #f2ecf6; border-color: transparent; color: #7a3f66; }
.badge.level-1 { color: #2f6b4f; }
.badge.level-2 { color: #8a6a1f; }
.badge.level-3 { color: #7a3f66; }

.goal { margin: 10px 0 18px; color: #333934; }

.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.cols.variants { margin-top: 16px; gap: 14px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; gap: 16px; } }

.card h3 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.technique { margin: 0; padding-left: 20px; }
.technique li { margin-bottom: 5px; }
.equip { margin: 10px 0 0; color: var(--muted); font-size: 14px; }

.note { margin: 0 0 10px; padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.note.ok { background: var(--ok-bg); }
.note.stop { background: var(--warn-bg); color: var(--warn-text); }
.note-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; margin-bottom: 3px; }

.variant { margin: 0; padding: 10px 12px; background: #fafbfa; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.variant-label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 3px; }

.video { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); font-size: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.video-status { font-weight: 600; }
.video.todo .video-status { color: var(--warn-text); }
.video-note { color: var(--muted); }
.video-link { color: var(--accent); font-weight: 600; }

/* Пояснение RIR: клиент видит аббревиатуру в программе и должен понимать, что это. */
.rir-hint {
  margin: 10px 0 0; padding: 8px 11px; border-radius: 8px;
  background: var(--accent-soft); font-size: 13px;
}
.player { width: 100%; max-width: 480px; border: 1px solid var(--line); border-radius: 8px; background: #000; display: block; margin-top: 4px; }

.empty { padding: 40px 0; color: var(--muted); text-align: center; }
.foot { padding: 10px 20px 40px; color: var(--muted); font-size: 13px; }

/* --- Таблицы, формы, кнопки: экраны работы с клиентами --- */

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 22px 0 14px; }
.toolbar .filters { margin: 0; }

.button {
  display: inline-block; padding: 9px 16px; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 14px; cursor: pointer; font-family: inherit;
}
.button:hover { border-color: var(--accent); color: var(--accent); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { color: #fff; opacity: 0.92; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; margin-top: 6px; }
.table th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: none; }
.table a { color: var(--accent); text-decoration: none; font-weight: 600; }
.table a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

.badge.status-active { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.badge.status-paused { background: #fdf6e8; border-color: transparent; color: #8a6a1f; }
.badge.status-archived { background: #f1f2f1; border-color: transparent; color: var(--muted); }

.form { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: 1fr; } }

.field { display: block; margin-bottom: 12px; }
.field.wide { grid-column: 1 / -1; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 15px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}

.actions { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.adder { margin-top: 18px; border-top: 1px dashed var(--line); padding-top: 12px; }
.adder summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 15px; }
.adder[open] summary { margin-bottom: 14px; }

.kv { margin: 0 0 8px; font-size: 15px; }
.kv > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.empty-inline { color: var(--muted); margin: 0; }
.table-scroll { overflow-x: auto; margin-top: 6px; }
.table-scroll .table { min-width: 720px; }

/* --- Чек-лист клиента --- */

.intro { white-space: pre-line; color: #333934; margin: 0; }
.section-note { white-space: pre-line; color: var(--muted); margin: 0 0 14px; font-size: 14px; }
.card.critical { border-color: var(--warn-line); }
.card.critical h3 { color: var(--warn-text); }

.flags { display: flex; flex-direction: column; gap: 8px; }
.flag {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 15px; cursor: pointer;
}
.flag:hover { border-color: var(--accent); }
.flag input { margin-top: 3px; flex: none; }
.flag.consent { background: var(--accent-soft); border-color: transparent; }

.scale { display: flex; gap: 4px; flex-wrap: wrap; }
.scale-item { position: relative; display: inline-flex; }
/* Кнопка прозрачная, но занимает весь квадрат: клик и фокус попадают в неё. */
.scale-item input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; margin: 0; cursor: pointer;
}
.scale-item span {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; cursor: pointer; background: #fff;
}
.scale-item input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.scale-item input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.answers-title { font-size: 14px; margin: 18px 0 6px; }
.answers-q { width: 45%; font-size: 13px; }

/* --- Пошаговая форма чек-листа --- */

.steps-bar { margin: 18px 0 10px; }
.steps-progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.steps-progress > span { display: block; height: 100%; width: 25%; background: var(--accent); border-radius: 999px; transition: width 0.25s ease; }
.steps-label { margin: 8px 0 0; font-size: 14px; color: var(--muted); }

.step { display: none; }
.step.active { display: block; }

.steps-nav { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0 16px; margin-top: 0; }
.steps-hint { color: var(--warn-text); font-size: 14px; }

.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--warn-line); background: var(--warn-bg); }
.flag.invalid { border-color: var(--warn-line); background: var(--warn-bg); }

/* Атрибут hidden должен побеждать display из .button: иначе скрытые кнопки видны. */
[hidden] { display: none !important; }

/* --- Конструктор программы --- */

.workout { border-left: 3px solid var(--accent); }
.workout h3 { margin-top: 18px; }
.dosage-hint {
  margin: 14px 0 0; padding: 10px 12px; border-radius: 8px;
  background: var(--accent-soft); font-size: 14px; color: #2b4a3a;
}
.link-danger {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 4px 6px; border-radius: 6px; font-family: inherit;
}
.link-danger:hover { color: var(--warn-text); background: var(--warn-bg); }

/* --- Вход и шапка пользователя --- */

.login-card { max-width: 420px; margin: 40px auto 0; }
.login-hint { text-align: center; color: var(--muted); font-size: 14px; margin-top: 14px; }
.who {
  color: var(--muted); font-size: 13px; padding: 7px 4px;
  white-space: nowrap; max-width: 150px; overflow: hidden; text-overflow: ellipsis;
}
.inline-form { display: inline; }
.link-btn {
  border: none; background: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 999px;
}
.link-btn:hover { color: var(--warn-text); background: var(--warn-bg); }

/* --- Выдача доступа клиенту --- */

.credentials { margin: 16px 0; padding: 14px 16px; background: #fafbfa; border: 1px solid var(--line); border-radius: 10px; }
.cred { display: inline-block; padding: 4px 10px; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-size: 17px; letter-spacing: 0.03em; }
.plain-list { margin: 0; padding-left: 20px; }
.plain-list li { margin-bottom: 6px; }

/* --- Кабинет клиента --- */

.today-card { border-left: 3px solid var(--accent); }
.today-row { background: var(--accent-soft); }
.exercise { padding: 18px 0; border-bottom: 1px dashed var(--line); }
.exercise:last-child { border-bottom: none; padding-bottom: 0; }
.exercise h2 { font-size: 17px; }
.warn-text { color: var(--warn-text); font-weight: 600; }

/* --- Подходы в кабинете клиента --- */

.sets { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.prev-hint { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.set-rows { display: flex; flex-direction: column; gap: 8px; }
.set-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-num {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent); border-radius: 50%; font-size: 13px; font-weight: 600;
}
.set-row input {
  width: 92px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 15px; text-align: center;
}
.set-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.set-x { color: var(--muted); }
.set-unit { color: var(--muted); font-size: 13px; }

/* --- История тренировок в карточке клиента --- */

.log-row { padding: 16px 0; border-bottom: 1px dashed var(--line); }
.log-row:last-child { border-bottom: none; padding-bottom: 0; }
.log-row:first-of-type { padding-top: 6px; }
.badge.pain-grew { background: var(--warn-bg); border-color: transparent; color: var(--warn-text); font-weight: 600; }
.set-chip {
  display: inline-block; margin: 0 4px 4px 0; padding: 3px 9px;
  background: #fafbfa; border: 1px solid var(--line); border-radius: 999px; font-size: 13px; white-space: nowrap;
}
.comment-line { margin: 10px 0 0; font-style: italic; }

/* --- Динамика нагрузки --- */

.trend { font-weight: 600; white-space: nowrap; }
.trend.up { color: var(--accent); }
.trend.down { color: var(--warn-text); }
.trend.flat { color: #8a6a1f; }
.trend.new { color: var(--muted); font-weight: 400; }
.stale-row { background: #fffbf7; }

/* --- Сводка тренера --- */

.alert-list { display: flex; flex-direction: column; gap: 10px; }
.alert { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.alert-high { border-color: var(--warn-line); background: var(--warn-bg); }
.alert-medium { border-color: #e8dcc0; background: #fffcf5; }
.alert-info { background: #fafbfa; }
.alert-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.alert-client { font-weight: 600; color: var(--accent); text-decoration: none; }
.alert-client:hover { text-decoration: underline; }
.alert-title { font-weight: 600; }
.alert-high .alert-title { color: var(--warn-text); }
.alert-detail { margin: 6px 0 0; font-size: 14px; color: #4a524c; }

/* --- Контрольные точки --- */

.report-area {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px; line-height: 1.5;
}
.hint { color: var(--muted); font-size: 13px; }

/* --- Фото прогресса --- */

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin: 6px 0 14px; }
.photo-card { margin: 0; position: relative; }
.photo-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #f1f2f1; display: block; }
/* Пустое место под фото: пока клиент не загрузил снимок */
.photo-empty {
  width: 100%; aspect-ratio: 3 / 4; border-radius: 8px;
  border: 1px dashed var(--line); background: #fafbfa;
}
.photo-card figcaption { font-size: 13px; margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.photo-card .link-danger { position: absolute; top: 6px; right: 6px; background: rgba(255,255,255,0.9); }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .compare { grid-template-columns: 1fr; } }
.compare-item { margin: 0; }
.compare-item img { width: 100%; border-radius: 10px; border: 1px solid var(--line); display: block; }
.compare-item figcaption { font-size: 14px; margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.compare-empty {
  aspect-ratio: 3 / 4; border: 1px dashed var(--line); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px;
}
input[type="file"] { padding: 7px 10px; background: #fff; }

/* --- Управление доступами --- */

.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 14px; width: 150px;
}
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-cell form { margin: 0; }

/* --- Служебный раздел --- */

.check-mark { width: 30px; font-size: 16px; font-weight: 700; color: var(--accent); }
.check-mark:has(+ .warn-text) { color: var(--warn-text); }

/* --- Логотип и переход на публичный сайт из панели --- */

.brand {
  display: inline-block; margin-bottom: 6px; text-decoration: none;
  font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--text);
}
.brand span { color: var(--accent); }
.brand:hover span { text-decoration: underline; }
.nav-exit { color: var(--muted); }
.nav-exit:hover { color: var(--accent); }

/* --- Страница входа: форма и демо-доступ рядом --- */

.login-layout {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px; align-items: stretch; max-width: 940px; margin: 40px auto 0;
}
@media (max-width: 860px) { .login-layout { grid-template-columns: 1fr; margin-top: 24px; } }

/* Карточки одной высоты, кнопки прижаты к низу и одинаковой ширины */
.login-layout .card { margin: 0; display: flex; flex-direction: column; }
/* Старое ограничение ширины формы здесь не нужно: колонки задаёт сетка */
.login-layout .login-card { max-width: none; }
.login-layout .actions { margin-top: auto; padding-top: 6px; }
.login-layout .actions .button { width: 100%; text-align: center; }
.login-card .login-hint { margin: 12px 0 0; text-align: center; }

.demo-card { background: #f6f8f6; border-color: #dfe6e1; }
.demo-card h3 { text-transform: none; font-size: 17px; letter-spacing: -0.01em; margin-bottom: 12px; color: var(--text); }
.demo-lead { margin: 0 0 16px; font-size: 15px; color: #3a423c; }
.demo-card .demo-credentials { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; color: var(--muted); font-size: 15px; }
.demo-card .demo-credentials code {
  background: var(--accent-soft); color: #24543e; padding: 3px 9px;
  border-radius: 6px; font-size: 15px; font-weight: 600;
}
.demo-note { margin: 14px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
