/*
  Витрина сотрудника. Основной девайс — дешёвый Android с плохим интернетом (§12),
  поэтому здесь нет ни фреймворка, ни шрифтов с чужих серверов: только системный
  шрифт и один файл стилей.

  Размеры кнопок не меньше 44px: уроки проходят стоя за баром, часто одной рукой.
*/

:root {
  color-scheme: light dark;
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #1b1f24;
  --muted: #5c6570;
  --line: #e2e5ea;
  --accent: #2f6fed;
  --done: #1f9254;
  --warn: #c0392b;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --card: #1c2024;
    --ink: #e8eaed;
    --muted: #9aa4af;
    --line: #2a3037;
    --accent: #5b8cff;
    --done: #35b46e;
    --warn: #e5705f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

/* --- шапка --- */

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.top__home {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.top__exit {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

/* --- заголовки --- */

h1 { font-size: 24px; line-height: 1.25; margin: 8px 0 16px; }
h2 { font-size: 19px; margin: 28px 0 10px; }
h3 { font-size: 17px; margin: 20px 0 8px; }

.muted { color: var(--muted); font-size: 15px; }

/* --- карточки курсов --- */

.card {
  display: block;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: inherit;
  text-decoration: none;
}

.card__title { font-weight: 600; margin-bottom: 6px; }

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 14px;
}

.bar {
  height: 8px;
  margin-top: 10px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.bar__fill { height: 100%; background: var(--accent); }
.bar__fill--done { background: var(--done); }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 13px;
  background: var(--line);
  color: var(--muted);
}

.tag--overdue { background: var(--warn); color: #fff; }
.tag--done { background: var(--done); color: #fff; }

/* --- список уроков --- */

.lessons { list-style: none; margin: 0; padding: 0; }

.lessons li { border-bottom: 1px solid var(--line); }
.lessons li:last-child { border-bottom: 0; }

.lesson-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 0;
  color: inherit;
  text-decoration: none;
}

.lesson-row--locked { color: var(--muted); }

.mark {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.mark--done { background: var(--done); border-color: var(--done); color: #fff; }

.lesson-row__time { margin-left: auto; color: var(--muted); font-size: 14px; white-space: nowrap; }


/* --- урок ---

   Оформление самой статьи переехало в lesson-article.css: тот же файл
   подключает редактор в админке, чтобы методист видел текст ровно так, как
   его увидит сотрудник (правки заказчика 25.09.2026). */

/* --- кнопки --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn--ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn--done { background: var(--done); }

.actions { display: grid; gap: 10px; margin-top: 28px; }

.nav-pair { display: flex; gap: 10px; margin-top: 14px; }
.nav-pair .btn { flex: 1; min-height: 46px; font-weight: 500; font-size: 15px; }

/* --- сообщения --- */

.note {
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--card);
  font-size: 15px;
}

.note--error { border-left-color: var(--warn); }

.empty { padding: 32px 0; text-align: center; color: var(--muted); }

/* --- иконки --- */

.icon {
  width: 22px;
  height: 22px;
  flex: none;
  color: inherit;
}

.icon--tab { width: 24px; height: 24px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.icon-btn:active { background: var(--line); }
.icon-btn__text { display: none; }

@media (min-width: 480px) {
  .icon-btn__text { display: inline; }
}

/* --- шапка --- */

.top__title {
  flex: 1;
  min-width: 0;  /* иначе длинное название курса распирает шапку */
}

/* --- выдвижное меню --- */

.drawer { position: fixed; inset: 0; z-index: 40; }

.drawer__shade {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 15, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drawer__panel {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(84vw, 320px);
  display: flex;
  flex-direction: column;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  background: var(--card);
  border-right: 1px solid var(--line);
  transform: translateX(-100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
}

.drawer--on .drawer__shade { opacity: 1; }
.drawer--on .drawer__panel { transform: translateX(0); }

.drawer__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.drawer__name { font-weight: 600; line-height: 1.3; }
.drawer__role { font-size: 13px; margin-top: 2px; }

.drawer__nav { display: flex; flex-direction: column; gap: 2px; }

.drawer__link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.drawer__link:active { background: var(--bg); }
.drawer__link--on { background: var(--bg); color: var(--accent); font-weight: 600; }

.drawer__exit { margin-top: auto; padding-top: 18px; }

/* --- «продолжить» --- */

.resume {
  display: block;
  padding: 16px 18px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

.resume__label { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.resume__title { font-size: 18px; font-weight: 600; line-height: 1.3; }
.resume__course { font-size: 13px; opacity: 0.85; margin-top: 6px; }

/* --- цифры в профиле --- */

.stats { display: flex; gap: 12px; margin: 16px 0 8px; }

.stats__item {
  flex: 1;
  padding: 14px;
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.stats__value { font-size: 26px; font-weight: 600; line-height: 1.1; }
.stats__label { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* --- тесты --- */

.question {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 18px 0 6px;
}

.question__text { font-weight: 600; padding: 0; margin-bottom: 10px; }
.question img { max-width: 100%; height: auto; border-radius: 12px; margin-bottom: 10px; }

/* Вариант ответа — крупная зона нажатия целиком, а не только кружок:
   промахнуться пальцем на ходу слишком легко. */
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}

.option input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
.option:active { border-color: var(--accent); }

.verdict {
  padding: 22px;
  margin: 16px 0 22px;
  border-radius: 16px;
  text-align: center;
  color: #fff;
}

.verdict--ok { background: var(--done); }
.verdict--no { background: var(--warn); }
.verdict__value { font-size: 44px; font-weight: 700; line-height: 1; }
.verdict__label { margin-top: 8px; opacity: 0.9; font-size: 14px; }

.test-row { border-left: 3px solid var(--accent); }
.test-row--done { border-left-color: var(--done); }

/* Результат аттестации у сотрудника. */
.plain-list { padding-left: 1.2em; }
.plain-list li { margin: 4px 0; }
.plain-list--good li::marker { color: var(--done); }
.plain-list--work li::marker { color: var(--warn); }

/* --- юзабилити (ответ заказчика 15.09.2026) --- */

/* Закон Фиттса: «Урок пройден» прилипает к низу экрана, пока человек читает. */
.actions--sticky {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin-left: -16px;
  margin-right: -16px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}

/* Обратная связь: всплывающее сообщение после действия. */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast__text { margin: 0; font-weight: 600; }
.toast__text + .toast__text { margin-top: 4px; }
.toast--gone { opacity: 0; transform: translateY(12px); pointer-events: none; }

/* Нажатие видно сразу, даже на медленном телефоне. */
.btn { transition: transform 0.05s ease, opacity 0.15s ease; }
.btn:active { transform: scale(0.98); opacity: 0.85; }

/* --- траектория: опросы и закрытые курсы (ответ заказчика 15.09.2026) --- */

.card--survey { border-left: 4px solid var(--accent); }
.card--locked { opacity: 0.6; }
.card--locked .card__title { color: var(--muted); }

.survey__question { margin: 18px 0 6px; font-weight: 600; }

.survey__answer {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

.survey__answer--missing { border-color: var(--warn); }
.survey__hint { margin: 4px 0 0; color: var(--warn); font-size: 14px; }

/* Запрос на ещё одну попытку (правки 22.09.2026). */
.ask { display: grid; gap: 8px; margin-top: 12px; text-align: left; }
.ask__label { color: var(--muted); font-size: 14px; }
.ask__note {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}

/* Цитата с автором (правки заказчика 23.09.2026). */
.quote {
  margin: 20px 0;
  padding: 22px 20px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  text-align: center;
}

.quote__mark { display: block; margin-bottom: -6px; color: var(--accent); font-size: 40px; line-height: 1; }

.quote__text {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 0;
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
}

.quote__text > *:first-child { margin-top: 0; }
.quote__text > *:last-child { margin-bottom: 0; }

.quote__author { margin-top: 10px; color: var(--muted); font-size: 14px; font-weight: 600; }

/* --- вход (правки заказчика 01.10.2026) ---

   Экран входа рассчитан на ярлык на телефоне: крупная главная кнопка, ожидание
   подтверждения из бота и поле для шести цифр — без переходов между экранами. */

.signin { max-width: 420px; margin: 24px auto 0; text-align: center; }
.signin__logo {
  display: grid; place-items: center;
  width: 64px; height: 64px; margin: 0 auto 14px;
  border-radius: 18px; background: #f47b20; color: #fff;
  font-size: 24px; font-weight: 700;
}
.signin__title { margin: 0 0 4px; }
.signin__lead { margin: 0 0 22px; }
.signin__hint { margin: 12px 0 0; font-size: 14px; }
.signin [hidden] { display: none !important; }
.btn--wide { display: flex; justify-content: center; width: 100%; }
.btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }

.signin__wait {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 14px; padding: 16px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--card);
  text-align: left;
}
.signin__wait p { margin: 0; }
.signin__wait-title { font-weight: 600; }
.signin__spinner {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: signin-spin .9s linear infinite;
}
@keyframes signin-spin { to { transform: rotate(360deg); } }

.signin__pin { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--line); text-align: left; }
.signin__pin-label { display: block; margin-bottom: 8px; font-size: 14px; color: var(--muted); }
/* Поле и кнопка — друг под другом. В одну строку не помещались: у .btn ширина
   100%, и на iPhone кнопка сжимала поле до узкой полоски, цифр было не видно
   (скриншот заказчика 01.10.2026). */
.signin__pin-row { display: flex; flex-direction: column; gap: 10px; }
.signin__pin-row input {
  width: 100%; min-height: 56px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 22px; letter-spacing: .3em; text-align: center;
}
.signin__pin .note { margin-top: 10px; }
.signin__more { margin-top: 26px; text-align: left; }
.signin__staff { margin-top: 22px; font-size: 14px; }

/* --- инструкция «на экран телефона» (/install/) --- */

.install { margin: 18px 0; }
.install__tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.install__tab {
  flex: 1; min-height: 44px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600;
}
.install__tab--on { border-color: #f47b20; background: #fdf0e6; color: #b85a12; }
.install__card { display: block; width: 100%; height: auto; border-radius: 16px; }
.install__card[hidden] { display: none; }
