:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --text-muted: #6b7280;
  --accent: #3b5bdb;
  --accent-hover: #2f4bc0;
  --danger: #d64550;
  --success: #2f9e44;
  --radius: 10px;

  --rail-bg: #2f3746;
  --rail-hover: #3a4353;
  --rail-active: #39435a;
  --rail-icon-bg: #414b5c;
  --rail-avatar-bg: #5b6578;
  --rail-text: #b7c0cd;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.layout { display: flex; min-height: 100vh; align-items: stretch; }

.rail {
  width: 78px;
  flex: 0 0 78px;
  background: var(--rail-bg);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 8px 0;
}
.rail-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px 12px;
  color: var(--rail-text);
  border-bottom: 1px solid rgba(255,255,255,.12);
  margin-bottom: 6px;
  font-size: 11px;
  text-align: center;
  text-decoration: none;
}
.rail-brand-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--rail-avatar-bg); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.rail-brand .rail-label { font-weight: 600; color: #fff; }
.rail-brand:hover { text-decoration: none; }

.rail-nav { display: flex; flex-direction: column; flex: 1; }
.rail-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 12px 4px; color: var(--rail-text); font-size: 11px; line-height: 1.2;
  text-align: center; cursor: pointer;
}
.rail-nav a:hover { background: var(--rail-hover); color: #fff; text-decoration: none; }
.rail-nav a.active { background: var(--rail-active); color: #fff; font-weight: 600; }
.rail-icon {
  width: 38px; height: 38px; border-radius: 50%; background: var(--rail-icon-bg);
  display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1;
}
.rail-nav a.active .rail-icon { background: var(--accent); color: #fff; }

.rail-logout { margin-top: auto; }
.rail-logout button {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; padding: 12px 4px; color: var(--rail-text); font-size: 11px;
  border: none; background: none; width: 100%; cursor: pointer; font-family: inherit;
}
.rail-logout button:hover { background: var(--rail-hover); color: #fff; }

.main { flex: 1; min-width: 0; }
.container { max-width: 1320px; margin: 0 auto; padding: 24px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-note { color: var(--text-muted); font-size: 13px; line-height: 1.55; margin: 0 0 20px; }

/* свёрнутая подсказка (2026-10-02, static/page-note-toggle.js): по умолчанию видна
   только кнопка, текст — после клика. data-no-toggle — исключение для подписей,
   которые не «подсказка», а часть содержимого (например «Учебный план (N курсов)» в
   progress.html — текст над списком, а не объяснение страницы) */
.page-note:not(.page-note-open) > .page-note-body { display: none; }
.page-note-body { margin-top: 8px; }
.page-note-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.page-note-toggle:hover { background: var(--bg); }
.page-note-toggle-icon { font-size: 11px; }

.search-wrap { position: relative; max-width: 420px; margin: 0 0 20px; }
.search-input {
  width: 100%; box-sizing: border-box; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 20;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(20,25,40,.12); max-height: 360px; overflow-y: auto;
}
.search-result { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 12px; color: var(--text); font-size: 14px; border-bottom: 1px solid var(--border); }
.search-result:last-child { border-bottom: none; }
.search-result:hover { background: var(--bg); text-decoration: none; }
.search-result-title { flex: 1; }
.search-result-block { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
.search-empty { padding: 12px; color: var(--text-muted); font-size: 13px; text-align: center; }

.progress-wrap { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.progress-bar { flex: 1; height: 8px; border-radius: 999px; background: var(--border); overflow: hidden; }
.progress-fill { height: 100%; background: var(--success); border-radius: 999px; transition: width .35s ease; }
.progress-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.course-grid { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.lesson-list { padding: 8px; }
.lesson-list-head { padding: 10px 12px 6px; color: var(--text-muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.lesson-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.lesson-item:hover { background: var(--bg); text-decoration: none; }
.lesson-item.active { background: #e8ecfd; color: var(--accent); font-weight: 600; }
.lesson-num {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; background: var(--border);
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.lesson-item.done .lesson-num { background: var(--success); color: #fff; }
.lesson-item.active .lesson-num { background: var(--accent); color: #fff; }
.lesson-select-check, .block-select-check { flex: 0 0 auto; width: 15px; height: 15px; cursor: pointer; }
.lesson-title { flex: 1; }
.lesson-review-dot {
  flex: 0 0 16px; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); cursor: pointer; background: var(--surface);
}
.lesson-review-dot:hover { border-color: #f5b800; box-shadow: 0 0 0 3px rgba(245, 184, 0, .15); }
.lesson-review-dot.reviewed { background: #f5b800; border-color: #f5b800; }
.lesson-review-dot.needs-info { background: #a78bfa; border-color: #a78bfa; }
.lesson-review-dot.needs-info:hover { border-color: #a78bfa; box-shadow: 0 0 0 3px rgba(167, 139, 250, .18); }
.lesson-review-dot.needs-redo { background: #e03131; border-color: #e03131; }
.lesson-review-dot.needs-redo:hover { border-color: #e03131; box-shadow: 0 0 0 3px rgba(224, 49, 49, .18); }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-quiz { background: #fff4e6; color: #e8590c; }
.badge-active { background: #ebfbee; color: var(--success); }
.badge-closed { background: #f1f3f5; color: var(--text-muted); }

/* Настоящий видеоплеер вместо картинки-заглушки */
video.video-frame {
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 8px;
  background: #000;
  margin-bottom: 8px;
}

.video-extra-controls { margin-bottom: 16px; }
.speed-btn { font-size: 15px; padding: 10px 20px; }

.doc-block { border-top: 1px solid var(--border); padding-top: 18px; }
.doc-block-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.doc-block-head h2 { font-size: 16px; margin: 0; }
.doc-source { font-size: 12px; color: var(--text-muted); }

.doc-content { max-width: 68ch; }
.doc-lead { margin: 0 0 14px; color: var(--text); font-size: 14px; line-height: 1.6; }
.doc-content h3 { font-size: 14px; margin: 22px 0 8px; color: var(--text); }
.doc-content h3:first-of-type { margin-top: 0; }
.doc-content p { margin: 0 0 10px; color: var(--text); font-size: 14px; line-height: 1.6; }
.doc-content ul { margin: 0 0 10px; padding-left: 20px; }
.doc-content li { margin-bottom: 5px; font-size: 14px; line-height: 1.55; }
.doc-note {
  display: flex; gap: 8px; align-items: flex-start;
  margin: 4px 0 14px; padding: 10px 12px; border-radius: 8px;
  background: #fff8ec; border: 1px solid #f3d9a4; font-size: 13px; line-height: 1.55; color: #6b4b12;
}
.doc-note b { color: #8a5a10; }

.doc-shot { margin: 4px 0 18px; }
.doc-shot img {
  display: block; width: 100%; max-width: 560px; border-radius: 8px;
  border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(20,25,40,.08);
  cursor: zoom-in;
}
.doc-shot img:fullscreen,
.doc-shot img:-webkit-full-screen {
  max-width: none; width: 100%; height: 100%; object-fit: contain; background: #000;
}
.doc-shot figcaption { margin-top: 6px; font-size: 12px; color: var(--text-muted); }

.lesson-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font-family: inherit; font-size: 13px; font-weight: 600;
  line-height: 1.4; cursor: pointer;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { background: #2b8a3e; border-color: #2b8a3e; }
.btn[disabled] { opacity: .45; cursor: default; pointer-events: none; }

@media (max-width: 860px) {
  .course-grid { grid-template-columns: 1fr; }
  .rail { width: 62px; flex: 0 0 62px; }
  .rail-icon { width: 32px; height: 32px; font-size: 15px; }
  .container { padding: 16px 12px; }
}

/* ── Справочники: те же классы, что в ip-clients / rental ── */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.subnav a { padding: 9px 14px; color: var(--text-muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.page-head-note { display: flex; flex-direction: column; align-items: stretch; }
.page-head-note h2 { margin: 0; }
.page-note-block { color: var(--text-muted); font-size: 13px; line-height: 1.55; margin: 10px 0 16px; }

.head-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin-left: auto; }
.btn-create { background: var(--success); color: #fff; border-color: var(--success); }
.btn-create:hover { background: #2b8a3e; border-color: #2b8a3e; }
.btn-warning { background: #f59f00; color: #fff; border-color: #f59f00; }
.btn-warning:hover { background: #e08e00; border-color: #e08e00; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #c22a35; border-color: #c22a35; }
.btn-save { background: #e8ecfd; color: var(--accent); border-color: #c9d1f7; }
.btn-save:hover { background: #d7deff; border-color: var(--accent); }
.head-actions .btn { min-width: 98px; padding: 4px 10px; font-size: 13px; text-align: center; white-space: nowrap; }
.head-actions .btn[disabled] { opacity: .45; pointer-events: none; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
tr:hover td { background: #fafbfc; }
.sticky-col-check { width: 34px; }

.cell-input {
  width: 100%; min-width: 7rem; padding: 6px 8px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text);
}
.row-inline { display: flex; gap: 6px; align-items: center; }
.row-inline .cell-input { flex: 1; }
.row-disabled td { color: var(--text-muted); }

.role-select { font-weight: 600; cursor: pointer; }
.role-select.role-owner { color: var(--success); border-color: var(--success); }
.role-select.role-editor { color: var(--accent); border-color: var(--accent); }
.role-select.role-staff { color: var(--text-muted); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { width: 320px; }
.error { color: var(--danger); font-size: 14px; margin-bottom: 12px; }
.hint { color: var(--text-muted); font-size: 13px; line-height: 1.55; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text); max-width: 560px;
}

/* ── Прогресс: матрица пользователь × урок ── */
.progress-table th, .progress-table td { text-align: center; white-space: normal; word-break: break-word; width: 110px; min-width: 110px; max-width: 110px; }
.progress-table th:first-child, .progress-table td:first-child { text-align: left; width: auto; min-width: 140px; max-width: none; white-space: nowrap; }
.watch-yes { color: var(--success); font-weight: 700; }
.watch-count { display: block; font-size: 11px; color: var(--text-muted); font-weight: 400; }
.watch-no { color: var(--border); }
.score-good { color: var(--success); font-weight: 700; }
.score-bad { color: var(--danger); font-weight: 700; }

/* ── Тест ── */
.quiz-q { margin-bottom: 22px; }
.quiz-q-title { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.quiz-opt {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 6px; font-size: 14px; cursor: pointer;
}
.quiz-opt:hover { background: var(--bg); }
.quiz-opt input { width: auto; }
.quiz-opt.correct { border-color: var(--success); background: #ebfbee; }
.quiz-opt.wrong { border-color: var(--danger); background: #fff0f0; }
.quiz-score { font-size: 22px; font-weight: 700; }
.quiz-score.pass { color: var(--success); }
.quiz-score.fail { color: var(--danger); }
.attempts-list { font-size: 13px; color: var(--text-muted); margin-top: 14px; }
.attempts-list li { margin-bottom: 3px; }

/* ── Список блоков курсов: курс — заголовок, подразделы — строками ── */
.course-group { margin-bottom: 22px; }
.course-group-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 8px;
}
.course-group-title { font-size: 16px; margin: 0; }
.course-hidden-tag {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 2px 8px; vertical-align: middle;
}
.course-hide-btn {
  flex: none; font-size: 12px; color: var(--text-muted);
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 10px; cursor: pointer;
}
.course-hide-btn:hover { background: var(--bg); color: var(--text); }
.course-group-hidden { opacity: .55; }
.course-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px; border-radius: 8px; color: var(--text);
}
.course-row:hover { background: var(--bg); text-decoration: none; }
.course-row-num {
  flex: none; font-size: 12px; font-weight: 700; color: var(--text-muted);
  font-variant-numeric: tabular-nums; width: 34px;
}
.course-row-label { flex: 1; font-size: 14px; font-weight: 600; }
.course-row-count { flex: none; font-size: 12px; color: var(--text-muted); width: 90px; }
.course-row-bar {
  flex: none; width: 140px; height: 8px; border-radius: 999px;
  background: var(--border); overflow: hidden;
}
.course-row-bar .progress-fill { height: 100%; }
.course-row-done { flex: none; width: 56px; text-align: right; font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.course-row-review-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  border: 1.5px solid var(--border); cursor: pointer;
}
.course-row-review-dot:hover { border-color: #f5b800; box-shadow: 0 0 0 3px rgba(245, 184, 0, .15); }
.course-row-review-dot.reviewed { background: #f5b800; border-color: #f5b800; }
.course-row-review-dot.needs-info { background: #a78bfa; border-color: #a78bfa; }
.course-row-review-dot.needs-redo { background: #e03131; border-color: #e03131; }
.course-row-expand {
  flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.course-row-expand:hover { background: var(--bg); color: var(--text); }
.course-row-lessons { padding: 2px 12px 10px 46px; display: flex; flex-direction: column; gap: 2px; }
.course-row-lessons[hidden] { display: none; }
.course-sublesson {
  display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.course-sublesson:hover { background: var(--bg); text-decoration: none; }

.course-coming-soon {
  display: flex; align-items: center;
  padding: 14px 16px; color: var(--text-muted); font-size: 14px;
}

/* ── Форма загрузки урока ── */
.upload-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Стрелка «назад» — тот же вид, что в ip-clients/rental */
.back-arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text); font-size: 18px; line-height: 1;
  text-decoration: none;
}
.back-arrow:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.radio-row { display: flex; gap: 16px; align-items: center; margin-bottom: 6px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 400; color: var(--text); }
.radio-row input { width: auto; }
