/* Палитра курса */
:root {
  --burgundy: #a00f33;
  --academic-red: #c81240;
  --mid-red: #e63542;
  --coral: #ff5f61;
  --deep-blue: #002b5b;
  --rich-blue: #004c79;
  --azure: #5ba7d5;
  --energy-blue: #4d56bc;
  --ice: #d3e0e4;
  --black: #171f29;
  --mid-gray: #8b8a8f;
  --light-gray: #e9e8f1;
  --white: #ffffff;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(23, 31, 41, 0.06), 0 4px 16px rgba(0, 43, 91, 0.06);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "PT Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0;
  font: 17px/1.6 var(--font);
  color: var(--black);
  background: var(--light-gray);
}
a { color: var(--rich-blue); }
a:hover { color: var(--academic-red); }
h1, h2, h3 { color: var(--deep-blue); line-height: 1.25; }
h1 { font-size: 1.9rem; margin: 0.2em 0 0.5em; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 24px; }
main { padding-top: 28px; padding-bottom: 48px; }

/* Шапка */
.site-header {
  background: var(--deep-blue);
  color: var(--white);
  border-bottom: 4px solid var(--burgundy);
}
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--white); text-decoration: none; font-weight: 600; font-size: 1.05rem; }
.brand:hover { color: var(--white); }
.brand-mark {
  display: inline-grid; place-items: center; width: 38px; height: 38px; flex: none;
  background: var(--burgundy); border-radius: 8px; font-weight: 700; letter-spacing: 0.02em;
}
.userbar { display: flex; align-items: center; gap: 16px; font-size: 0.95rem; }
.userbar form { margin: 0; }
.who { color: var(--ice); }
.pill { color: var(--white); border: 1px solid var(--azure); border-radius: 999px; padding: 2px 12px; text-decoration: none; }
.pill:hover { background: var(--rich-blue); color: var(--white); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.site-header .link-btn { color: var(--ice); }
.site-header .link-btn:hover { color: var(--white); }

.site-footer { color: var(--mid-gray); font-size: 0.85rem; padding: 24px 0 32px; border-top: 1px solid var(--ice); }

/* Карточки и кнопки */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 8px; border: 2px solid transparent;
  font: 600 1rem var(--font); text-decoration: none; cursor: pointer;
}
.btn-sm { padding: 6px 14px; font-size: 0.92rem; }
.btn-primary { background: var(--burgundy); color: var(--white); }
.btn-primary:hover { background: var(--academic-red); color: var(--white); }
.btn-secondary { background: var(--white); color: var(--rich-blue); border-color: var(--rich-blue); }
.btn-secondary:hover { background: var(--rich-blue); color: var(--white); }
.btn-locked { background: var(--light-gray); color: var(--mid-gray); cursor: not-allowed; }
.muted { color: var(--mid-gray); }
.small { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }
.tag { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 999px; background: var(--light-gray); color: var(--burgundy); font-weight: 600; vertical-align: middle; }
.alert { background: #fdecee; border-left: 4px solid var(--mid-red); padding: 10px 14px; border-radius: 6px; margin: 0 0 16px; }
.alert.info { background: #e8f1f6; border-color: var(--azure); }

/* Главная */
.hero { margin: 8px 0 20px; }
.hero h1 { font-size: 2.1rem; margin: 0 0 6px; }
.hero-sub { color: var(--rich-blue); font-weight: 600; margin: 0 0 12px; }
.landing { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.login-card { position: sticky; top: 24px; border-top: 4px solid var(--burgundy); }
.login-card h2 { margin-top: 0; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 4px; font-weight: 600; font-size: 0.95rem; }
.login-form input {
  font: inherit; padding: 10px 12px; border: 1px solid var(--ice); border-radius: 8px; background: var(--white);
}
.login-form input:focus { outline: 2px solid var(--azure); border-color: var(--azure); }
.login-form .btn { justify-content: center; }

.progress-summary { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.95rem; }
.progress { width: 260px; height: 10px; background: var(--white); border-radius: 999px; overflow: hidden; border: 1px solid var(--ice); }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--rich-blue), var(--azure)); }

.about-fold summary { cursor: pointer; font-weight: 700; color: var(--deep-blue); font-size: 1.1rem; }
.about-fold[open] summary { margin-bottom: 8px; }

.section-title { margin: 32px 0 14px; font-size: 1.4rem; }
.webinar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(460px, 1fr)); gap: 20px; }
.webinar { display: flex; flex-direction: column; gap: 14px; margin: 0; border-top: 4px solid var(--rich-blue); }
.webinar-head { display: flex; gap: 14px; align-items: flex-start; }
.webinar-head h3 { margin: 2px 0 0; font-size: 1.12rem; }
.webinar-num {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--deep-blue); color: var(--white); font-weight: 700; font-size: 1.15rem;
}
.webinar-meta { color: var(--mid-gray); font-size: 0.9rem; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lesson-link {
  display: grid; grid-template-columns: 44px 1fr 24px; gap: 8px; align-items: start;
  padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--black);
  border: 1px solid var(--ice); background: var(--white);
}
.lesson-link:hover { border-color: var(--rich-blue); background: #f4f8fa; color: var(--black); }
.lesson-num { font-weight: 700; color: var(--rich-blue); }
.lesson-title { font-size: 0.95rem; line-height: 1.4; }
.lesson-state { color: var(--rich-blue); font-weight: 700; text-align: right; }
.lesson-link.is-read { background: #f1f6f8; }
.lesson-link.is-read .lesson-title { color: #3c4652; }
.webinar-test { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--light-gray); }
.score { font-size: 0.9rem; font-weight: 600; }
.score.passed { color: var(--rich-blue); }
.score.failed { color: var(--academic-red); }

.materials { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.material { display: grid; gap: 4px; text-decoration: none; color: var(--black); border-left: 4px solid var(--burgundy); }
.material strong { color: var(--deep-blue); font-size: 1.05rem; }
.material:hover { color: var(--black); box-shadow: 0 0 0 2px var(--azure); }

/* Урок */
.crumbs { font-size: 0.9rem; color: var(--mid-gray); margin-bottom: 14px; }
.crumbs a { color: var(--rich-blue); }
.lesson-layout { display: grid; grid-template-columns: 260px minmax(0, 860px); gap: 28px; justify-content: center; }
.toc-inner { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; font-size: 0.9rem; }
.toc-title { font-weight: 700; color: var(--deep-blue); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; }
.toc ol { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 2px; }
.toc a { display: block; padding: 4px 10px; border-left: 3px solid transparent; text-decoration: none; color: #3c4652; border-radius: 0 6px 6px 0; }
.toc a:hover { border-left-color: var(--burgundy); background: var(--white); color: var(--deep-blue); }
.toc-done { font-weight: 600; }
.lesson { padding: 36px 48px; }
.lesson-header { border-bottom: 1px solid var(--light-gray); margin-bottom: 20px; padding-bottom: 16px; }
.lesson-kicker { color: var(--burgundy); font-weight: 700; font-size: 0.92rem; text-transform: uppercase; letter-spacing: 0.04em; }
.video-chip {
  display: inline-block; margin-top: 4px; padding: 6px 14px; border-radius: 999px;
  background: #e8f1f6; color: var(--rich-blue); text-decoration: none; font-weight: 600; font-size: 0.92rem;
}
.video-chip:hover { background: var(--rich-blue); color: var(--white); }

.done-box { margin: 36px 0 8px; padding: 20px 24px; border-radius: var(--radius); background: #f1f6f8; border: 1px solid var(--ice); display: grid; gap: 12px; justify-items: start; }
.done-box p { margin: 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; }
.lesson-nav a { text-decoration: none; font-weight: 600; max-width: 48%; }
.lesson-nav a span { display: block; font-weight: 400; color: var(--mid-gray); font-size: 0.88rem; }
.lesson-nav-next { text-align: right; margin-left: auto; }

/* Текст уроков и материалов */
.prose { overflow-wrap: break-word; }
.prose h2 { font-size: 1.45rem; margin: 1.8em 0 0.6em; padding-top: 0.4em; }
.prose h3 { font-size: 1.15rem; margin: 1.5em 0 0.4em; }
.prose > :first-child { margin-top: 0; }
.prose hr { border: 0; border-top: 1px solid var(--light-gray); margin: 2em 0; }
.prose blockquote {
  margin: 1.2em 0; padding: 12px 20px; background: #f4f6fa; border-left: 4px solid var(--burgundy); border-radius: 0 8px 8px 0;
}
.prose blockquote p { margin: 0.4em 0; }
.prose blockquote ul { margin: 0.4em 0; padding-left: 1.2em; }
.prose code { background: var(--light-gray); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.prose pre { background: var(--black); color: var(--light-gray); padding: 14px 18px; border-radius: 8px; overflow: auto; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose li { margin: 0.25em 0; }
.prose details { margin: 1em 0; border: 1px solid var(--ice); border-radius: 8px; padding: 10px 16px; background: #fafbfd; }
.prose details > summary { cursor: pointer; font-weight: 600; color: var(--rich-blue); }
.prose details[open] > summary { margin-bottom: 8px; }
.prose details.track { border-left: 4px solid var(--rich-blue); background: var(--white); padding: 14px 20px; }
.prose details.track > summary { font-size: 1.08rem; color: var(--deep-blue); }

.table-wrap { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border: 1px solid var(--ice); padding: 8px 10px; text-align: left; vertical-align: top; }
thead th { background: var(--deep-blue); color: var(--white); font-weight: 600; border-color: var(--deep-blue); }
tbody tr:nth-child(even) td { background: #f7f9fb; }

/* Тест */
.test { max-width: 900px; margin: 0 auto 20px; }
.test-rules { color: #3c4652; }
.question { border: 1px solid var(--ice); border-radius: var(--radius); padding: 18px 22px 14px; margin: 0 0 18px; }
.question legend { font-weight: 600; padding: 0 6px; margin-left: -6px; display: flex; gap: 10px; line-height: 1.45; }
.q-num {
  flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--burgundy); color: var(--white); font-size: 0.9rem; margin-right: 8px;
}
.question legend .q-num { margin-right: 0; }
.hint { color: var(--burgundy); font-size: 0.88rem; margin: 6px 0 0 38px; font-weight: 600; }
.option { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; margin: 6px 0 0 28px; border-radius: 8px; cursor: pointer; }
.option:hover { background: #f4f8fa; }
.option input { margin-top: 5px; accent-color: var(--burgundy); width: 18px; height: 18px; flex: none; }
.option:has(input:checked) { background: #eef3f8; outline: 1px solid var(--azure); }

.result-banner { padding: 18px 22px; border-radius: var(--radius); margin: 8px 0 24px; }
.result-banner.passed { background: #e8f1f6; border-left: 6px solid var(--rich-blue); }
.result-banner.failed { background: #fdecee; border-left: 6px solid var(--academic-red); }
.result-score { font-size: 1.5rem; font-weight: 700; color: var(--deep-blue); }
.result-q { border: 1px solid var(--ice); border-radius: var(--radius); padding: 14px 22px; margin-bottom: 16px; }
.result-q h3 { margin: 0 0 6px; display: flex; align-items: center; font-size: 1rem; }
.result-q.is-ok h3 { color: var(--rich-blue); }
.result-q.is-ok .q-num { background: var(--rich-blue); }
.result-q.is-bad h3 { color: var(--academic-red); }
.q-text { font-weight: 600; margin-bottom: 8px; }
.result-options { list-style: none; padding: 0; margin: 0 0 10px; display: grid; gap: 4px; }
.result-options li { padding: 6px 10px; border-radius: 6px; display: flex; gap: 8px; }
.opt-mark { width: 18px; flex: none; font-weight: 700; }
.opt-correct { background: #e8f1f6; }
.opt-correct .opt-mark { color: var(--rich-blue); }
.opt-wrong { background: #fdecee; }
.opt-wrong .opt-mark { color: var(--academic-red); }
.explanation { background: #f7f8fb; border-left: 4px solid var(--azure); padding: 4px 16px; border-radius: 0 8px 8px 0; font-size: 0.95rem; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Видео */
.player { width: 100%; aspect-ratio: 16 / 9; background: var(--black); border: 0; border-radius: 8px; margin: 8px 0 16px; }
.chapters { padding-left: 0; list-style: none; display: grid; gap: 8px; }
.chapters .tc { font-variant-numeric: tabular-nums; font-weight: 700; margin-right: 10px; }

/* Файлы кейса и администратор */
.files tr.is-hidden td { background: #fff6f7; }
.progress-table { font-size: 0.88rem; }
.progress-table td { text-align: center; min-width: 38px; }
.progress-table tbody th { background: var(--white); color: var(--black); border-color: var(--ice); }
.progress-table thead tr:nth-child(2) th { background: var(--rich-blue); border-color: var(--rich-blue); font-weight: 500; }
.cell-ok { background: #e8f1f6 !important; color: var(--rich-blue); font-weight: 700; }
.cell-bad { background: #fdecee !important; color: var(--academic-red); font-weight: 700; }

/* Узкие экраны */
@media (max-width: 1000px) {
  .landing { grid-template-columns: 1fr; }
  .login-card { position: static; order: -1; }
  .lesson-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .lesson { padding: 24px 20px; }
  .webinar-grid { grid-template-columns: 1fr; }
}
