/* Онбординг МОП — токены как в дашборде v2 (ОП/v2/theme.css),
   чтобы обучение выглядело частью той же платформы. */
:root {
  --bg: #F3F5F2;
  --card: #FFFFFF;
  --surface-2: #EEF2EE;
  --border: #DFE5E0;
  --text: #142320;
  --text-dim: #5D6E69;
  --accent: #0E7A65;
  --accent-hover: #0B6553;
  --accent-soft: #D8EFE8;
  --green: #16865B;
  --green-bg: #DDF2E6;
  --yellow: #B7791F;
  --yellow-bg: #FBEFD6;
  --red: #C2413A;
  --red-bg: #F9E0DD;
  --f-display: "Unbounded", "Manrope", system-ui, sans-serif;
  --f-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 35, 32, .05), 0 4px 16px rgba(20, 35, 32, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0D1412; --card: #141D1A; --surface-2: #1A2522; --border: #25332F;
    --text: #E6EEEB; --text-dim: #8C9E98; --accent: #3CC4A4; --accent-hover: #5AD3B7; --accent-soft: #163A31;
    --green: #4CC98D; --green-bg: #163327; --yellow: #E3AA4E; --yellow-bg: #3A2D16; --red: #EE7A70; --red-bg: #3D1F1C;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0D1412; --card: #141D1A; --surface-2: #1A2522; --border: #25332F;
  --text: #E6EEEB; --text-dim: #8C9E98; --accent: #3CC4A4; --accent-hover: #5AD3B7; --accent-soft: #163A31;
  --green: #4CC98D; --green-bg: #163327; --yellow: #E3AA4E; --yellow-bg: #3A2D16; --red: #EE7A70; --red-bg: #3D1F1C;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; margin: 0; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 15px; }
.dim { color: var(--text-dim); }
.hidden { display: none !important; }

/* ---------- Кнопки, поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 10px;
  padding: 10px 18px; font-weight: 600; cursor: pointer;
  background: var(--accent); color: #fff; text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn.danger { background: var(--red); }
input[type=text], input[type=tel], input[type=password], textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--card);
  outline: none; transition: border-color .15s;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { min-height: 130px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; font-weight: 600; }
.error { color: var(--red); font-size: 14px; min-height: 20px; }

/* ---------- Вход ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
}
.login-box {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--border);
  border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--accent);
  display: grid; place-items: center; color: #fff; font-family: var(--f-display); font-weight: 700; font-size: 15px;
}
.brand b { font-family: var(--f-display); font-size: 15px; display: block; line-height: 1.2; }
.brand small { color: var(--text-dim); font-size: 12px; }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100vh; }
.side {
  background: var(--card); border-right: 1px solid var(--border);
  padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.me { padding: 14px; border-radius: var(--radius); background: var(--surface-2); }
.me-name { font-weight: 700; }
.bar { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  text-decoration: none; color: var(--text); border: 1px solid transparent; cursor: pointer;
}
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--accent-soft); border-color: transparent; }
.nav-item.locked { color: var(--text-dim); cursor: not-allowed; }
.nav-num {
  flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-family: var(--f-display); font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim);
}
.nav-item.active .nav-num { background: var(--accent); color: #fff; }
.nav-item.done .nav-num { background: var(--green-bg); color: var(--green); }
.nav-text { min-width: 0; }
.nav-text b { display: block; font-size: 14px; font-weight: 600; line-height: 1.3; }
.nav-text small { color: var(--text-dim); font-size: 12px; }
.side-foot { margin-top: auto; display: flex; gap: 8px; }

.main { padding: 32px 40px 80px; max-width: 920px; width: 100%; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.lead { color: var(--text-dim); margin: 10px 0 0; max-width: 680px; }
.section { margin-top: 30px; }
.section > h2 { margin-bottom: 12px; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 22px; }
.meter { padding: 14px 16px; }
.meter small { color: var(--text-dim); font-size: 12px; font-weight: 600; }
.meter b { display: block; font-family: var(--f-display); font-size: 20px; margin-top: 2px; }

.lesson-list { display: flex; flex-direction: column; gap: 8px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  text-decoration: none; color: var(--text);
}
.lesson-row:hover { border-color: var(--accent); }
.check {
  flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border);
  display: grid; place-items: center; font-size: 13px; color: transparent;
}
.check.on { background: var(--green); border-color: var(--green); color: #fff; }
.lesson-row b { font-weight: 600; }
.lesson-row .dim { margin-left: auto; font-size: 13px; white-space: nowrap; }

.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--green-bg); color: var(--green); }
.pill.warn { background: var(--yellow-bg); color: var(--yellow); }
.pill.bad { background: var(--red-bg); color: var(--red); }
.pill.neutral { background: var(--surface-2); color: var(--text-dim); }

.task { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.task + .task { margin-top: 10px; }
.task-head { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.task-head h3 { font-family: var(--f-body); font-weight: 700; font-size: 15px; }
.task-check { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.task-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.comment { border-left: 3px solid var(--yellow); padding: 8px 12px; background: var(--yellow-bg); border-radius: 0 8px 8px 0; font-size: 14px; }
.comment.ok { border-color: var(--green); background: var(--green-bg); }

.test-card { display: flex; align-items: center; gap: 20px; justify-content: space-between; flex-wrap: wrap; }
.test-card p { margin: 4px 0 0; }

/* ---------- Урок ---------- */
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--text-dim); text-decoration: none; font-size: 14px; margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.lesson { margin-top: 22px; display: flex; flex-direction: column; gap: 16px; }
.lesson p { margin: 0; }
.lesson h3 { font-size: 16px; margin-top: 10px; }
.lesson ul, .lesson ol { margin: 0; padding-left: 22px; }
.lesson li + li { margin-top: 6px; }
.callout { border-radius: var(--radius); padding: 16px 18px; background: var(--accent-soft); border: 1px solid transparent; }
.callout.warn { background: var(--yellow-bg); }
.callout b.t { display: block; margin-bottom: 4px; font-family: var(--f-display); font-size: 14px; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.grid2 .card { padding: 16px 18px; }
.grid2 .card h3 { margin-bottom: 8px; font-size: 14px; }
.grid2 .card ul, .grid2 .card ol { font-size: 14px; }
.grid2 .card p { font-size: 14px; color: var(--text-dim); }
.steps { counter-reset: s; display: flex; flex-direction: column; gap: 10px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.step::before {
  counter-increment: s; content: counter(s);
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; font-family: var(--f-display);
}
.step b { display: block; }
.step span { color: var(--text-dim); font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.script { border-radius: 12px; background: var(--surface-2); padding: 14px 16px 14px 18px; border-left: 3px solid var(--accent); }
.script small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.script p + p { margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat b { display: block; font-family: var(--f-display); font-size: 24px; color: var(--accent); }
.stat span { font-size: 13px; color: var(--text-dim); }
.qa details { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 0 16px; }
.qa details + details { margin-top: 8px; }
.qa summary { cursor: pointer; padding: 13px 0; font-weight: 600; }
.qa details p { padding-bottom: 14px; color: var(--text-dim); }
.video { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: #000; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-empty { aspect-ratio: auto; background: var(--surface-2); border: 1px dashed var(--border); padding: 28px; text-align: center; color: var(--text-dim); }
.lesson-foot { margin-top: 28px; display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; align-items: center; }

.stage { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.stage-head { display: flex; gap: 12px; align-items: flex-start; }
.stage-n { flex: none; width: 32px; height: 32px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: var(--f-display); font-weight: 600; font-size: 14px; }
.lesson .stage h3 { margin: 0; font-size: 16px; }
.stage-goal { display: block; font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.stage-tips { margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-dim); }
.stage-tips li + li { margin-top: 4px; }
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.quote { margin: 0; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.quote blockquote { margin: 0; font-size: 14px; }
.quote figcaption { margin-top: 8px; font-size: 12px; font-weight: 700; color: var(--text-dim); }
.template { border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.template-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: var(--surface-2); }
.template-head b { font-size: 14px; }
.template pre { margin: 0; padding: 12px 14px; white-space: pre-wrap; font: 14px/1.55 var(--f-body); }

/* Переключатель уроков внутри дня */
.lesson-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin: 0 0 22px; scrollbar-width: thin; }
.lesson-tab {
  flex: none; display: flex; align-items: center; gap: 8px; max-width: 240px;
  padding: 8px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); text-decoration: none; font-size: 13px; font-weight: 600;
}
.lesson-tab:hover { border-color: var(--accent); }
.lesson-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.lesson-tab .ln { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: var(--surface-2); color: var(--text-dim); }
.lesson-tab.done .ln { background: var(--green); color: #fff; }
.lesson-tab.active .ln { background: rgba(255,255,255,.25); color: #fff; }
.lesson-tab span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-nav { display: flex; gap: 10px; flex-wrap: wrap; }

/* Уроки дня в боковом меню */
.nav-sub { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px 42px; }
.nav-sub a { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; color: var(--text-dim); text-decoration: none; font-size: 13px; line-height: 1.3; }
.nav-sub a:hover { background: var(--surface-2); color: var(--text); }
.nav-sub a.active { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.nav-sub i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.nav-sub a.done i { background: var(--green); }

.preview-bar { background: var(--yellow-bg); color: var(--yellow); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.opt.right { border-color: var(--green); background: var(--green-bg); }
.opt.right::after { content: '✓ верный'; margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); white-space: nowrap; }

.weak { display: flex; flex-direction: column; gap: 10px; }
.weak-item { background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--red); border-radius: 12px; padding: 14px 16px; }
.weak-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.weak-item ul { margin: 8px 0; padding-left: 20px; font-size: 14px; color: var(--text-dim); }
.weak-item a { font-size: 14px; font-weight: 600; }

/* ---------- Тест ---------- */
.quiz { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.q { padding: 18px 20px; }
.q-num { font-size: 12px; color: var(--text-dim); font-weight: 700; }
.q-text { font-weight: 700; margin: 4px 0 12px; }
.q-hint { font-size: 13px; color: var(--text-dim); margin: -8px 0 12px; }
.opt {
  display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); cursor: pointer; transition: border-color .15s, background .15s;
}
.opt + .opt { margin-top: 8px; }
.opt:hover { border-color: var(--accent); }
.opt input { margin-top: 3px; accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.order-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.order-item + .order-item { margin-top: 8px; }
.order-item .n { font-family: var(--f-display); font-weight: 600; font-size: 13px; color: var(--accent); width: 18px; }
.order-item span { flex: 1; }
.order-btns { display: flex; gap: 4px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: transparent; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover:not(:disabled) { background: var(--surface-2); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.quiz-foot { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%); display: flex; align-items: center; gap: 14px; justify-content: space-between; }

.result { text-align: center; padding: 34px 24px; }
.score { font-family: var(--f-display); font-size: 56px; font-weight: 700; line-height: 1; }
.score.ok { color: var(--green); }
.score.bad { color: var(--red); }
.wrong-list { text-align: left; margin-top: 22px; display: flex; flex-direction: column; gap: 8px; }
.wrong-item { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.wrong-item a { font-size: 13px; }

.cert { text-align: center; padding: 44px 28px; background: linear-gradient(135deg, var(--accent-soft), var(--card)); }
.cert .big { font-size: 46px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 16px; gap: 12px; }
  .nav { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .nav-item { flex: none; padding: 8px 10px; }
  .nav-text small { display: none; }
  .nav-text b { font-size: 13px; white-space: nowrap; }
  .nav-sub { display: none; }
  .side-foot { margin-top: 0; }
  .main { padding: 22px 16px 60px; }
  .meters { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .meter { padding: 10px 12px; }
  .meter b { font-size: 16px; }
  h1 { font-size: 21px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 10px; }
  .stat b { font-size: 17px; }
  .stat span { font-size: 12px; line-height: 1.35; display: block; }
}
