:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --text: #333333;
  --heading: #1f1f1f;
  --muted: #6b6b6b;
  --border: #e5e5e5;
  --brand: #eb303a;
  --primary: #d1232e;
  --primary-strong: #ad1b25;
  --primary-soft: #fdecee;
  --on-primary: #ffffff;
  --navy: #001f7a;
  --navy-soft: #e9edf8;
  --accent: #23874f;
  --accent-soft: #e5f4eb;
  --warn: #b4540f;
  --warn-soft: #fdf1e6;
  --danger: #c4161c;
  --hero-bg: linear-gradient(115deg, #f6f1ea 0%, #fbf9f6 55%, #efe9e1 100%);
  --footer-bg: #333333;
  --shadow: 0 2px 4px rgba(0, 0, 0, .04), 0 10px 28px rgba(0, 0, 0, .07);
  --radius: 8px;
  --font-head: 'Montserrat', Arial, sans-serif;
  --font-body: 'Montserrat', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121318;
    --surface: #1b1d24;
    --surface-2: #242731;
    --text: #e8e8ec;
    --heading: #f4f4f6;
    --muted: #a5a8b3;
    --border: #30333e;
    --brand: #ff5a62;
    --primary: #ff5a62;
    --primary-strong: #ff8086;
    --primary-soft: #3b1d21;
    --on-primary: #1b0a0c;
    --navy: #9db0ff;
    --navy-soft: #20263d;
    --accent: #52c785;
    --accent-soft: #16301f;
    --warn: #f0a062;
    --warn-soft: #3a2616;
    --danger: #ff7b80;
    --hero-bg: linear-gradient(115deg, #1d1b1a 0%, #18191d 55%, #1f1c1a 100%);
    --footer-bg: #0c0d10;
    --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121318;
  --surface: #1b1d24;
  --surface-2: #242731;
  --text: #e8e8ec;
  --heading: #f4f4f6;
  --muted: #a5a8b3;
  --border: #30333e;
  --brand: #ff5a62;
  --primary: #ff5a62;
  --primary-strong: #ff8086;
  --primary-soft: #3b1d21;
  --on-primary: #1b0a0c;
  --navy: #9db0ff;
  --navy-soft: #20263d;
  --accent: #52c785;
  --accent-soft: #16301f;
  --warn: #f0a062;
  --warn-soft: #3a2616;
  --danger: #ff7b80;
  --hero-bg: linear-gradient(115deg, #1d1b1a 0%, #18191d 55%, #1f1c1a 100%);
  --footer-bg: #0c0d10;
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 10px 28px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; outline: none; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.35rem, 3vw, 1.8rem); }
h3 { font-size: 1.12rem; margin-top: 1.6em; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
img { max-width: 100%; }
.muted { color: var(--muted); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ── Header ── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo__mark { color: var(--primary); display: flex; }
.logo__text { font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; }
.logo__text b { color: var(--primary); font-weight: 700; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 8px 14px; border-radius: 10px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--primary); background: var(--primary-soft); }
.theme-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; margin-left: 6px;
  display: inline-grid; place-items: center;
}
.menu-btn { display: none; background: none; border: 0; padding: 8px; cursor: pointer; }
.menu-btn span { display: block; width: 22px; height: 2px; background: var(--text); margin: 5px 0; border-radius: 2px; }

@media (max-width: 1300px) {
  .menu-btn { display: block; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 8px 16px 16px; display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .theme-btn { margin: 8px 0 0; width: 100%; }
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .98rem var(--font-body);
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; transition: transform .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-strong); }
.btn--ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { padding: 8px 14px; font-size: .9rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ── Hero ── */
.hero { padding: 56px 0 40px; }
.hero__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 40px; align-items: center; }
.eyebrow {
  display: inline-block; font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft); padding: 6px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; margin-bottom: 28px; }
.hero__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 24px;
  box-shadow: var(--shadow);
}
.hero__card h3 { margin-top: 0; }
.mini-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mini-list li { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface-2); border-radius: 12px; }
.mini-list .ico { font-size: 1.4rem; }
.mini-list small { display: block; color: var(--muted); }
@media (max-width: 860px) { .hero__grid { grid-template-columns: 1fr; } .hero { padding-top: 32px; } }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 8px 0 56px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat b { display: block; font: 700 1.8rem var(--font-head); color: var(--primary); }
.stat span { color: var(--muted); font-size: .92rem; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

.section { margin-bottom: 64px; }
.section__head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.section__head p { margin: 0; color: var(--muted); }

.how { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; counter-reset: how; }
.how div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; }
.how div::before {
  counter-increment: how; content: counter(how);
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary-soft); color: var(--primary); font: 700 1rem var(--font-head); margin-bottom: 12px;
}
.how b { display: block; margin-bottom: 4px; }
.how p { margin: 0; color: var(--muted); font-size: .94rem; }
@media (max-width: 860px) { .how { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .how { grid-template-columns: 1fr; } }

/* ── Courses grid ── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font: 500 .9rem var(--font-body);
}
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.search {
  width: 100%; max-width: 420px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; margin-bottom: 16px;
}
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
@media (max-width: 360px) { .grid { grid-template-columns: 1fr; } }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 10px;
  text-decoration: none; color: inherit; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--primary); }
.card__top { display: flex; justify-content: space-between; align-items: start; gap: 8px; }
.card__icon { font-size: 1.8rem; width: 52px; height: 52px; display: grid; place-items: center; background: var(--surface-2); border-radius: 14px; }
.card h3 { margin: 4px 0 0; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: .94rem; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: .85rem; }
.badge { font-size: .76rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge--done { background: var(--accent-soft); color: var(--accent); }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

/* ── Course page ── */
.crumbs { font-size: .9rem; color: var(--muted); margin: 24px 0 16px; }
.crumbs a { color: var(--muted); }
.course-head {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: 28px;
  display: grid; grid-template-columns: 1fr 280px; gap: 28px; margin-bottom: 28px;
}
.course-head .card__icon { width: 64px; height: 64px; font-size: 2.2rem; margin-bottom: 12px; }
.course-head aside { background: var(--surface-2); border-radius: var(--radius); padding: 20px; align-self: start; }
.course-head aside .btn { width: 100%; margin-top: 14px; }
@media (max-width: 820px) { .course-head { grid-template-columns: 1fr; padding: 20px; } }

.lesson-list { list-style: none; padding: 0; margin: 0 0 28px; display: grid; gap: 10px; }
.lesson-list a {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  text-decoration: none; color: var(--text);
}
.lesson-list a:hover { border-color: var(--primary); }
.lesson-num {
  flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-weight: 600;
}
.done .lesson-num { background: var(--accent); color: var(--on-primary); }
.lesson-list .t { flex: 1; }
.lesson-list small { color: var(--muted); }
.quiz-link .lesson-num { background: var(--primary-soft); color: var(--primary); }

/* ── Lesson ── */
.lesson { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: clamp(20px, 4vw, 40px); margin-bottom: 24px; }
.lesson h1 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.lesson ul, .lesson ol { padding-left: 1.3em; }
.lesson li { margin-bottom: .4em; }
.note { background: var(--primary-soft); border-left: 4px solid var(--primary); padding: 14px 18px; border-radius: 10px; margin: 20px 0; }
.note.warn { background: var(--warn-soft); border-color: var(--warn); }
.flags li::marker { content: '⚑  '; color: var(--danger); }
.steps { display: grid; gap: 8px; margin: 16px 0; }
.step { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 12px 16px; background: var(--surface-2); border-radius: 12px; }
.step b { color: var(--primary); font-family: var(--font-head); }
.step span { color: var(--muted); }
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; margin: 16px 0; background: var(--bg); }
.dialog p { margin: 0 0 .6em; }
.dialog p:last-child { margin: 0; }
.dialog em { font-style: normal; font-weight: 600; color: var(--primary); }
.pair { padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 10px; }
.pair b { display: block; color: var(--danger); margin-bottom: 2px; }
.pair span { color: var(--muted); }
.takeaways { background: var(--accent-soft); border-radius: var(--radius); padding: 20px 24px; margin-top: 28px; }
.takeaways h3 { margin-top: 0; color: var(--accent); }
.takeaways ul { margin: 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 48px; }

/* ── Quiz ── */
.quiz { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: clamp(20px, 4vw, 36px); margin-bottom: 48px; }
.quiz__top { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.quiz .progress { margin-bottom: 24px; }
.quiz h2 { font-size: 1.3rem; }
.options { display: grid; gap: 10px; margin: 20px 0; }
.option {
  text-align: left; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.option:hover:not([disabled]) { border-color: var(--primary); }
.option.correct { border-color: var(--accent); background: var(--accent-soft); }
.option.wrong { border-color: var(--danger); background: var(--warn-soft); }
.option[disabled] { cursor: default; }
.explain { padding: 14px 16px; border-radius: 12px; background: var(--surface-2); margin-bottom: 20px; }
.result { text-align: center; padding: 12px 0; }
.result__score { font: 700 3.4rem var(--font-head); color: var(--primary); }
.result.pass .result__score { color: var(--accent); }

/* ── Profile ── */
.profile-grid { display: grid; grid-template-columns: 320px 1fr; gap: 24px; margin: 24px 0 48px; align-items: start; }
@media (max-width: 860px) { .profile-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.panel h3 { margin-top: 0; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field input {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit;
}
.ring { width: 140px; height: 140px; margin: 8px auto 16px; display: block; }
.row-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.row-list li { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; flex-wrap: wrap; }
.row-list .grow { flex: 1; min-width: 180px; }
.row-list .progress { margin-top: 8px; }

/* ── Certificate ── */
.cert-wrap { padding: 24px 0 48px; }
.cert {
  background: #fffdf8; color: #17313d; max-width: 900px; margin: 0 auto 24px;
  border: 10px solid #13708a; outline: 2px solid #c9a24a; outline-offset: -22px;
  padding: clamp(28px, 6vw, 64px); text-align: center; border-radius: 6px;
}
.cert .logo__text { font-size: 1.4rem; }
.cert .logo__text b { color: #13708a; }
.cert h1 { font-size: clamp(1.6rem, 5vw, 2.6rem); color: #13708a; margin: 20px 0 6px; letter-spacing: .06em; text-transform: uppercase; }
.cert .name { font: 600 clamp(1.4rem, 4vw, 2.2rem) var(--font-head); border-bottom: 2px solid #c9a24a; display: inline-block; padding: 0 20px 6px; margin: 16px 0; }
.cert .course { font-size: 1.2rem; font-weight: 600; margin: 8px 0 24px; }
.cert .cert__foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .9rem; color: #5b7380; margin-top: 32px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 500;
  transition: transform .3s, opacity .3s; z-index: 50; max-width: calc(100% - 32px);
  opacity: 0; visibility: hidden;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

/* ── Footer ── */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 28px 0; margin-top: auto; }
.footer__inner { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
.footer p { margin: 6px 0 0; font-size: .9rem; }
.disclaimer { color: var(--muted); }
@media (max-width: 720px) { .footer__inner { grid-template-columns: 1fr; } }

@media print {
  .topbar, .footer, .no-print, .toast, .skip { display: none !important; }
  body { background: #fff; }
  .cert-wrap { padding: 0; }
  .cert { margin: 0; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ── Личные кабинеты ── */
.nav-logout {
  border: 0; background: none; color: var(--muted); font: 500 1rem var(--font-body);
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
}
.nav-logout:hover { color: var(--text); background: var(--surface-2); }
[hidden] { display: none !important; }
.small { font-size: .88rem; }
.btn--block { width: 100%; }
.btn--danger { background: var(--danger); color: var(--on-primary); }
.demo-banner {
  margin: 16px 0 0; padding: 10px 14px; border-radius: 12px;
  background: var(--warn-soft); color: var(--warn); font-size: .9rem;
}
.form-error { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--danger); font-size: .92rem; }
.auth { padding: 40px 16px 64px; display: flex; justify-content: center; }
.auth__panel { width: 100%; max-width: 440px; padding: 28px; }
.auth__panel h1 { font-size: 1.6rem; }
.auth__alt { margin: 18px 0 0; text-align: center; color: var(--muted); }
.field input, .field textarea, .field select, .toolbar select, .toolbar .search {
  width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font: inherit;
}
.field textarea { resize: vertical; font-size: .92rem; }
.field label { font-weight: 500; font-size: .94rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }
.input-with-btn { display: flex; gap: 8px; }
.input-with-btn input { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.panel-details { margin-top: 16px; border-top: 1px solid var(--border); padding-top: 12px; }
.panel-details summary { cursor: pointer; font-weight: 500; margin-bottom: 12px; }
.cert__verify { font-size: .78rem; color: #5b7380; margin: 14px 0 0; word-break: break-all; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }

/* Кабинет руководителя */
.admin-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; margin-bottom: 48px; align-items: start; }
.admin-side { display: grid; gap: 20px; }
@media (max-width: 1000px) { .admin-grid { grid-template-columns: 1fr; } }
.toolbar { display: grid; grid-template-columns: 1fr 180px 160px; gap: 10px; margin-bottom: 8px; }
.toolbar .search { max-width: none; margin: 0; }
@media (max-width: 720px) { .toolbar { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; margin: 0 -22px -22px; padding: 0 22px 22px; }
.table { width: 100%; border-collapse: collapse; min-width: 680px; font-size: .94rem; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; padding: 10px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table td small { display: block; color: var(--muted); font-size: .82rem; }
.table .t-progress { min-width: 120px; }
.table .t-progress span { display: block; font-weight: 600; margin-bottom: 4px; }
.table .t-num { white-space: nowrap; }
.table .t-actions { text-align: right; }
.table tr.is-blocked td { opacity: .55; }
.detail-row td { background: var(--surface-2); }
.link-btn { background: none; border: 0; padding: 0; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.link-btn:hover { color: var(--primary); text-decoration: underline; }
.detail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.detail-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.branch-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.branch-list small { display: block; color: var(--muted); margin-bottom: 4px; }

.modal {
  border: 1px solid var(--border); border-radius: 20px; padding: 0; width: min(560px, calc(100% - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(8, 24, 31, .5); }
.modal__body { padding: 24px; max-height: calc(100vh - 64px); overflow-y: auto; }
.modal__body h2 { margin-bottom: 16px; }
.danger-zone { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.cred-list { max-height: 260px; overflow-y: auto; padding-left: 1.2em; font-size: .92rem; }

/* ═════════ Фирменный стиль «Вивафарм» ═════════
   Красный #EB303A и тёмно-синий #001F7A из логотипа, Montserrat,
   строгие формы и прописные кнопки — как на vivafarm.md. */

body { font-size: 15px; line-height: 1.65; }
h1, h2, h3 { color: var(--heading); font-weight: 700; letter-spacing: 0; }
h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
a { color: var(--primary); }
:focus-visible { outline-color: var(--brand); }

/* Шапка */
.topbar { background: var(--surface); backdrop-filter: none; }
.topbar__inner { height: 76px; }
.logo { gap: 14px; }
.logo__img { height: 40px; width: auto; display: block; }
.logo__divider { width: 1px; height: 34px; background: var(--border); }
.logo__text { font-size: 1.05rem; font-weight: 700; line-height: 1.1; color: var(--navy); }
.logo__text b { color: var(--brand); }
.logo__text small {
  display: block; font-size: .62rem; font-weight: 500; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em; margin-top: 3px;
}
@media (max-width: 420px) { .logo__divider, .logo__text small { display: none; } .logo { gap: 10px; } .logo__img { height: 34px; } }
.nav a, .nav-logout { color: var(--text); font-size: .9rem; font-weight: 500; border-radius: 0; padding: 8px 12px; }
.nav a:hover, .nav-logout:hover { background: none; color: var(--brand); }
.nav a.active { background: none; color: var(--brand); box-shadow: inset 0 -2px 0 var(--brand); }
.theme-btn { border-radius: 4px; }
@media (max-width: 1300px) {
  .nav { top: 76px; }
  .nav a.active { box-shadow: inset 3px 0 0 var(--brand); }
}

/* Кнопки */
.btn {
  border-radius: 4px; text-transform: uppercase; letter-spacing: .08em;
  font: 600 .78rem var(--font-body); padding: 15px 26px;
}
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-strong); }
.btn--ghost { background: transparent; color: var(--primary); border-color: color-mix(in srgb, var(--primary) 45%, transparent); }
.btn--ghost:hover { background: var(--primary-soft); }
.btn--sm { padding: 10px 16px; font-size: .72rem; border-radius: 4px; }
.btn--danger { background: var(--danger); }

/* Первый экран */
.hero { background: var(--hero-bg); padding: 64px 0 56px; margin-bottom: 40px; border-bottom: 1px solid var(--border); }
.eyebrow {
  background: none; padding: 0; border-radius: 0; color: var(--muted);
  font-weight: 500; font-size: .74rem; letter-spacing: .14em; margin-bottom: 18px;
}
.hero p.lead { font-size: 1.12rem; color: var(--text); }
.hero__card { border-radius: var(--radius); box-shadow: var(--shadow); border-color: transparent; }
.mini-list li { border-radius: 6px; }
.stat { border-radius: var(--radius); }
.stat b { color: var(--navy); }

/* Карточки курсов */
.card { border-radius: 6px; }
.card:hover { transform: none; border-color: var(--brand); box-shadow: var(--shadow); }
.card__icon { border-radius: 6px; }
.badge {
  border-radius: 3px; background: var(--navy-soft); color: var(--navy);
  text-transform: uppercase; letter-spacing: .06em; font-size: .66rem; padding: 4px 8px;
}
.badge--done { background: var(--accent-soft); color: var(--accent); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }

/* Фильтры — вкладки с красным подчёркиванием, как «Хит / Советуем / Новинка» */
.filters { gap: 4px 22px; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.chip {
  border: 0; border-radius: 0; background: none; color: var(--muted);
  padding: 10px 0; font-size: .9rem; font-weight: 500;
}
.chip:hover { color: var(--text); }
.chip[aria-pressed="true"] { background: none; color: var(--heading); box-shadow: inset 0 -2px 0 var(--brand); }
.search { border-radius: 4px; }

.how div { border-radius: var(--radius); }
.how div::before { background: var(--primary-soft); color: var(--brand); border-radius: 4px; }

/* Курс, урок, тест */
.course-head, .lesson, .quiz { border-radius: var(--radius); }
.course-head aside { border-radius: 6px; }
.lesson-list a { border-radius: 6px; }
.lesson-list a:hover { border-color: var(--brand); }
.quiz-link .lesson-num { background: var(--primary-soft); color: var(--brand); }
.note { background: var(--navy-soft); border-left-color: var(--navy); border-radius: 4px; }
.note.warn { background: var(--primary-soft); border-left-color: var(--brand); }
.flags li::marker { color: var(--brand); }
.step { border-radius: 6px; }
.step b { color: var(--navy); }
.dialog { border-radius: 6px; }
.dialog em { color: var(--navy); }
.pair { border-radius: 6px; }
.pair b { color: var(--navy); }
.takeaways { border-radius: 6px; }
.option { border-radius: 6px; border-width: 1px; }
.option:hover:not([disabled]) { border-color: var(--brand); }
.option.correct { border-width: 2px; }
.option.wrong { border-width: 2px; background: var(--primary-soft); }
.result__score { color: var(--navy); }
.panel, .modal { border-radius: var(--radius); }
.field input, .field textarea, .field select, .toolbar select, .toolbar .search { border-radius: 4px; }

/* Сертификат */
.cert { border-color: #001f7a; outline-color: #eb303a; }
.cert h1 { color: #001f7a; }
.cert .logo__img { height: 54px; }
.cert .name { border-bottom-color: #eb303a; color: #1f1f1f; }

/* Тёмная тема: логотип на светлой подложке */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .topbar .logo__img { background: #fff; border-radius: 4px; padding: 3px 5px; }
}
:root[data-theme="dark"] .topbar .logo__img { background: #fff; border-radius: 4px; padding: 3px 5px; }

/* Подвал как на vivafarm.md */
.footer { background: var(--footer-bg); border-top: 0; color: #bdbdbd; padding: 48px 0 28px; }
.footer__inner { grid-template-columns: repeat(3, minmax(0, 1fr)) 1.4fr; gap: 28px 32px; }
.footer__col { display: grid; gap: 10px; align-content: start; }
.footer h4 { margin: 0 0 6px; color: #fff; font: 700 .8rem var(--font-head); text-transform: uppercase; letter-spacing: .06em; }
.footer a { color: #bdbdbd; text-decoration: none; font-size: .88rem; }
.footer a:hover { color: #fff; }
.footer__contacts span { font-size: .88rem; }
.footer .disclaimer { color: #9a9a9a; font-size: .8rem; margin: 0; }
.footer__copy { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .12); color: #9a9a9a; font-size: .82rem; }
@media (max-width: 860px) { .footer__inner { grid-template-columns: 1fr 1fr; } .footer .disclaimer { grid-column: 1 / -1; } }
@media (max-width: 480px) { .footer__inner { grid-template-columns: 1fr; } }
.cert .logo__text { color: #001f7a; }
.cert .logo__text b { color: #eb303a; }
.cert .logo__divider { background: #d9d9d9; }

/* Листы доступа по аптекам */
.sheet-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border-top: 1px solid var(--border); }
.sheet-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sheet-list small { display: block; color: var(--muted); }
.sheet-list .btn-row { gap: 6px; }
#print-sheets { display: none; }
@media print {
  @page { margin: 15mm; }
  body.printing > *:not(#print-sheets) { display: none !important; }
  body.printing #print-sheets { display: block; }
  .sheet { page-break-after: always; break-after: page; color: #000; font-size: 11pt; }
  .sheet:last-child { page-break-after: auto; break-after: auto; }
  .sheet__head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #eb303a; padding-bottom: 8px; margin-bottom: 10px; }
  .sheet__head b { display: block; font-size: 14pt; color: #001f7a; }
  .sheet__head span { color: #444; }
  .sheet__steps { margin: 0 0 12px; padding-left: 1.3em; }
  .sheet__table { width: 100%; border-collapse: collapse; }
  .sheet__table th, .sheet__table td { border: 1px solid #999; padding: 5px 8px; text-align: left; }
  .sheet__table th { background: #f2f2f2; }
  .sheet__table td:nth-child(3), .sheet__table td:nth-child(4) { font-family: 'Courier New', monospace; font-size: 11.5pt; }
  .sheet__table tr { page-break-inside: avoid; }
  .sheet__note { margin-top: 10px; font-size: 9pt; color: #444; }
}

/* ═════════ Быстрые ссылки на главной ═════════ */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: -32px 0 56px; }
.quick-link {
  display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  text-decoration: none; color: var(--text);
}
.quick-link:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.quick-link span { grid-row: 1 / 3; font-size: 1.6rem; width: 44px; height: 44px; display: grid; place-items: center; background: var(--surface-2); border-radius: 6px; }
.quick-link b { color: var(--heading); }
.quick-link small { color: var(--muted); font-size: .84rem; }

/* ═════════ Четыре опоры фармацевта ═════════ */
:root { --pl1: #001f7a; --pl2: #8a6cc4; --pl3: #23874f; --pl4: #eb303a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pl1: #9db0ff; --pl2: #b9a2e8; --pl3: #52c785; --pl4: #ff5a62; } }
:root[data-theme="dark"] { --pl1: #9db0ff; --pl2: #b9a2e8; --pl3: #52c785; --pl4: #ff5a62; }
.pillars { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 860px) { .pillars { grid-template-columns: 1fr; } .pl-diagram { order: -1; max-width: 400px; } }
.pl-list { list-style: none; padding: 0; margin: 20px 0 0; border-top: 1px solid var(--border); }
.pl-item { border-bottom: 1px solid var(--border); }
.pl-item button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: grid; grid-template-columns: 14px 1fr; column-gap: 14px; padding: 14px 4px; }
.pl-item button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }
.pl-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; background: var(--dot); }
.pl-name { display: block; font-size: 1.08rem; color: var(--heading); }
.pl-item small { display: block; color: var(--muted); }
.pl-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .35s ease; }
.pl-inner { overflow: hidden; min-height: 0; display: grid; gap: 4px; }
.pl-inner > span:first-child { padding-top: 8px; }
.pl-item.is-active .pl-body { grid-template-rows: 1fr; }
.pl-item.is-active .pl-name { color: var(--dot); }
.pl-diagram { width: 100%; max-width: 520px; justify-self: center; }
.pl-diagram svg { width: 100%; height: auto; display: block; overflow: visible; }
.pl-ring { fill: transparent; stroke-width: 1.5; transition: fill .4s, stroke-width .4s; }
.pl-label { font: 600 17px var(--font-head); }
.pl-q { font-size: 12px; opacity: .8; }
.pl-g { cursor: pointer; transition: opacity .4s; }
.pl-orbit, .pl-core, .pl-halo { transform-box: fill-box; transform-origin: center; }
@keyframes plD1 { 50% { transform: translate(-6px, 5px); } }
@keyframes plD2 { 50% { transform: translate(6px, 6px); } }
@keyframes plD3 { 50% { transform: translate(-5px, -6px); } }
@keyframes plD4 { 50% { transform: translate(6px, -5px); } }
@keyframes plPulse { 50% { transform: scale(1.08); } }
@keyframes plHalo { 50% { opacity: .45; transform: scale(1.25); } }
.pl-o1 { animation: plD1 9s ease-in-out infinite; }
.pl-o2 { animation: plD2 11s ease-in-out infinite; }
.pl-o3 { animation: plD3 10s ease-in-out infinite; }
.pl-o4 { animation: plD4 12s ease-in-out infinite; }
.pl-core { animation: plPulse 4s ease-in-out infinite; }
.pl-halo { animation: plHalo 4s ease-in-out infinite; }
.pl-diagram[data-active] .pl-g { opacity: .45; }
.pl-diagram[data-active="1"] .pl-g1, .pl-diagram[data-active="2"] .pl-g2,
.pl-diagram[data-active="3"] .pl-g3, .pl-diagram[data-active="4"] .pl-g4 { opacity: 1; }
.pl-diagram[data-active="1"] .pl-g1 .pl-ring { stroke-width: 3; fill: color-mix(in srgb, var(--pl1) 9%, transparent); }
.pl-diagram[data-active="2"] .pl-g2 .pl-ring { stroke-width: 3; fill: color-mix(in srgb, var(--pl2) 9%, transparent); }
.pl-diagram[data-active="3"] .pl-g3 .pl-ring { stroke-width: 3; fill: color-mix(in srgb, var(--pl3) 9%, transparent); }
.pl-diagram[data-active="4"] .pl-g4 .pl-ring { stroke-width: 3; fill: color-mix(in srgb, var(--pl4) 9%, transparent); }
@media (prefers-reduced-motion: reduce) { .pl-o1, .pl-o2, .pl-o3, .pl-o4, .pl-core, .pl-halo { animation: none; } .pl-body { transition: none; } }

/* ═════════ Нормативная база ═════════ */
.law { margin-bottom: 56px; }
.law__lead { font-size: 1.05rem; max-width: 60ch; }
.law-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 6px; background: var(--surface-2); margin: 8px 0 18px; }
.law-tab { font: 600 .9rem var(--font-body); color: var(--text); padding: 10px 18px; border: 0; border-radius: 4px; background: transparent; cursor: pointer; }
.law-tab[aria-selected="true"] { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .law-tab[aria-selected="true"] { color: #0f1424; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .law-tab[aria-selected="true"] { color: #0f1424; } }
.law-alert {
  display: grid; grid-template-columns: 40px 1fr; gap: 14px; align-items: start; margin-bottom: 20px;
  padding: 16px 18px; border-radius: var(--radius); background: var(--primary-soft); border: 1.5px solid var(--brand);
  animation: lawIn .45s ease-out;
}
.law-alert[hidden] { display: none; }
.law-alert p { margin: 0 0 6px; }
.law-alert__icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 700; font-size: 1.2rem; }
.law-alert__title { font-weight: 700; font-size: 1.05rem; color: var(--heading); }
@keyframes lawIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .law-alert { animation: none; } }
.law-search .search { max-width: none; min-height: 54px; font-size: 1.02rem; margin-bottom: 10px; }
.law-hints { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 18px; }
.law-hint { font: 500 .84rem var(--font-body); color: var(--text); padding: 7px 12px; border-radius: 999px; border: 1px dashed var(--border); background: transparent; cursor: pointer; }
.law-hint:hover { border-color: var(--brand); color: var(--brand); }
.law-docs { display: grid; gap: 12px; }
.law-doc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.law-doc h3 { margin: 0 0 8px; font-size: 1.05rem; }
.law-doc p { margin: 0 0 4px; max-width: 75ch; }
.law-doc__meta { font-size: .84rem; color: var(--muted); }
.law-doc__meta b { color: var(--accent); font-weight: 600; }
.law-doc__warn { margin-top: 10px !important; font-size: .86rem; padding: 8px 12px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); }
.law-doc__foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 14px; }
.law__disclaimer { margin-top: 28px; max-width: 75ch; }
mark { background: #fff1b8; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] mark { background: #5a4a12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark { background: #5a4a12; } }

/* ═════════ К кому обращаться ═════════ */
.team { margin-bottom: 56px; }
.team__label { width: 100%; }
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 36px 22px; margin-top: 24px; }
.team-card { text-align: center; transition: opacity .35s, transform .35s; }
.team-card.is-dim { opacity: .3; }
.team-card.is-match { transform: translateY(-4px); }
.team-card h3 { margin: 0; font-size: 1.05rem; }
.team-card p { margin: 4px 0 8px; }
.team-card__text { max-width: 30ch; margin: 10px auto !important; font-size: .92rem; }
.team-photo { width: 128px; height: 128px; margin: 0 auto 14px; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: conic-gradient(from 210deg, #001f7a, #eb303a, #23874f, #001f7a); color: #fff; font: 700 2.2rem var(--font-head); }
.team-photo img { width: 100%; height: 100%; object-fit: cover; }
.team-card.is-match .team-photo { box-shadow: 0 0 0 4px var(--bg), 0 0 0 7px var(--brand); }
@media (max-width: 520px) { .team-grid { grid-template-columns: 1fr 1fr; } .team-photo { width: 100px; height: 100px; } }

/* ══════════════════════════════════════════════════════════════
   Стиль ВИВААКАДЕМИИ: шрифт Onest, тёмно-синий #17324D и зелёный #3FA36B,
   кнопки-«таблетки», мягкие карточки. Красный — только для предупреждений.
   Блок стоит последним и переопределяет предыдущие правила.
   ══════════════════════════════════════════════════════════════ */
:root {
  --bg: #f5f7f9;
  --surface: #ffffff;
  --surface-2: #eaf0f5;
  --text: #17324d;
  --heading: #17324d;
  --muted: #5a6b7c;
  --border: #e1e7ed;
  --brand: #3fa36b;
  --primary: #2e8754;          /* зелёный для кнопок: контраст с белым текстом ≥ 4.5 */
  --primary-strong: #256f45;
  --primary-soft: #e6f4ec;
  --on-primary: #ffffff;
  --navy: #17324d;
  --navy-soft: #eaf0f5;
  --accent: #2e8754;
  --accent-soft: #e6f4ec;
  --warn: #9a5b13;
  --warn-soft: #fff4e5;
  --danger: #c8393b;
  --alert: #c8393b;
  --alert-soft: #fdecec;
  --hero-bg: radial-gradient(120% 90% at 80% 20%, #24507a 0%, #17324d 45%, #0e2236 100%);
  --footer-bg: #0e2236;
  --shadow: 0 2px 6px rgba(23, 50, 77, .05), 0 12px 32px rgba(23, 50, 77, .08);
  --radius: 16px;
  --font-head: 'Onest', 'Segoe UI', Roboto, Arial, sans-serif;
  --font-body: 'Onest', 'Segoe UI', Roboto, Arial, sans-serif;
  --pl1: #2b7fb8; --pl2: #8a6cc4; --pl3: #3fa36b; --pl4: #e08a3c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1a26; --surface: #152435; --surface-2: #1c2e41; --text: #eaf0f6; --heading: #f2f6fa;
    --muted: #9db0c2; --border: #24364a; --brand: #5cc28a; --primary: #5cc28a; --primary-strong: #7fd3a4;
    --primary-soft: #183526; --on-primary: #0b1a12; --navy: #7fb2e0; --navy-soft: #1c2e41;
    --accent: #5cc28a; --accent-soft: #183526; --warn: #f2c27d; --warn-soft: #3a2a14;
    --danger: #e0605f; --alert: #e0605f; --alert-soft: #3a1a1c;
    --hero-bg: radial-gradient(120% 90% at 80% 20%, #1d3b5a 0%, #12263a 50%, #0a1826 100%);
    --footer-bg: #0a141e; --shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .3);
    --pl1: #5aa8dd; --pl2: #a890dd; --pl3: #5cc28a; --pl4: #f0a35e;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1a26; --surface: #152435; --surface-2: #1c2e41; --text: #eaf0f6; --heading: #f2f6fa;
  --muted: #9db0c2; --border: #24364a; --brand: #5cc28a; --primary: #5cc28a; --primary-strong: #7fd3a4;
  --primary-soft: #183526; --on-primary: #0b1a12; --navy: #7fb2e0; --navy-soft: #1c2e41;
  --accent: #5cc28a; --accent-soft: #183526; --warn: #f2c27d; --warn-soft: #3a2a14;
  --danger: #e0605f; --alert: #e0605f; --alert-soft: #3a1a1c;
  --hero-bg: radial-gradient(120% 90% at 80% 20%, #1d3b5a 0%, #12263a 50%, #0a1826 100%);
  --footer-bg: #0a141e; --shadow: 0 2px 6px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .3);
  --pl1: #5aa8dd; --pl2: #a890dd; --pl3: #5cc28a; --pl4: #f0a35e;
  color-scheme: dark;
}

body { font-size: 16px; line-height: 1.6; }
h1, h2, h3 { letter-spacing: -.02em; }
h1 { font-size: clamp(1.9rem, 4.2vw, 2.9rem); line-height: 1.1; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

/* Шапка */
.logo__text { color: var(--navy); letter-spacing: .01em; }
.logo__text b { color: var(--brand); }
.nav a, .nav-logout { border-radius: 999px; padding: 8px 14px; }
.nav a:hover, .nav-logout:hover { color: var(--text); background: var(--surface-2); }
.nav a.active { color: var(--heading); background: var(--surface-2); box-shadow: none; font-weight: 600; }
.theme-btn { border-radius: 999px; }
@media (max-width: 1300px) { .nav a.active { box-shadow: inset 3px 0 0 var(--brand); border-radius: 8px; } }

/* Кнопки-«таблетки» */
.btn { border-radius: 999px; text-transform: none; letter-spacing: 0; font: 500 1rem var(--font-body); min-height: 50px; padding: 0 26px; }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .9rem; border-radius: 999px; }
.btn--primary { background: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-strong); }
.btn--ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn--ghost:hover { background: var(--primary); color: var(--on-primary); }
.btn--danger { background: var(--danger); color: #fff; }

/* Первый экран: тёмно-синий градиент, белый текст */
.hero { background: var(--hero-bg); color: #fff; border-bottom: 0; padding: clamp(48px, 7vw, 88px) 0; }
.hero h1 { color: #fff; max-width: 15ch; }
.hero p.lead { color: rgba(255, 255, 255, .8); }
.hero .eyebrow { color: rgba(255, 255, 255, .72); letter-spacing: .04em; font-weight: 600; }
.hero .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .55); }
.hero .btn--ghost:hover { background: rgba(255, 255, 255, .1); border-color: #fff; color: #fff; }
.hero__card { background: var(--surface); color: var(--text); border-radius: 20px; }
.mini-list li { border-radius: 12px; }

/* Карточки, панели, метки */
.card, .stat, .panel, .course-head, .lesson, .quiz, .law-doc, .quick-link, .how div, .modal, .lesson-list a { border-radius: var(--radius); }
.course-head aside, .step, .pair, .dialog, .takeaways, .option, .note, .mini-list li, .card__icon, .quick-link span { border-radius: 12px; }
.card:hover, .quick-link:hover, .lesson-list a:hover, .option:hover:not([disabled]) { border-color: var(--brand); }
.stat b { color: var(--heading); font-weight: 700; }
.badge { border-radius: 999px; text-transform: none; letter-spacing: 0; font-size: .74rem; font-weight: 500; padding: 4px 10px; background: var(--surface-2); color: var(--text); }
.badge--done { background: var(--accent-soft); color: var(--accent); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.how div::before { background: var(--accent-soft); color: var(--accent); border-radius: 999px; }
.quiz-link .lesson-num { background: var(--accent-soft); color: var(--accent); }
.note { background: var(--surface-2); border-left-color: var(--navy); }
.note.warn { background: var(--alert-soft); border-left-color: var(--alert); }
.flags li::marker { color: var(--alert); }
.step b, .pair b, .dialog em { color: var(--heading); }
.result__score { color: var(--heading); }
.option.wrong { background: var(--alert-soft); border-color: var(--alert); }
.search, .field input, .field textarea, .field select, .toolbar select, .toolbar .search { border-radius: 14px; border-width: 1.5px; }
.search:focus, .field input:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 20%, transparent); }

/* Фильтры — «таблетки» */
.filters { gap: 8px; border-bottom: 0; }
.chip { border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); padding: 9px 15px; font-size: .92rem; font-weight: 500; }
.chip:hover { border-color: var(--text); }
.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: none; }
.chip[aria-pressed="true"] .muted { color: rgba(255, 255, 255, .7); }
:root[data-theme="dark"] .chip[aria-pressed="true"], :root[data-theme="dark"] .law-tab[aria-selected="true"] { color: #0f1a26; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .chip[aria-pressed="true"], :root:not([data-theme="light"]) .law-tab[aria-selected="true"] { color: #0f1a26; }
}

/* Нормативная база */
.law-tabs { border-radius: 999px; }
.law-tab { border-radius: 999px; font-size: 1rem; font-weight: 500; padding: 11px 20px; }
.law-alert { background: var(--alert-soft); border-color: var(--alert); border-radius: var(--radius); }
.law-alert__icon { background: var(--alert); }
.law-hint:hover { border-color: var(--text); color: var(--text); }
.law-doc__meta b { color: var(--accent); }
.law-doc__warn { border-radius: 10px; }

/* Сертификат */
.cert { border-color: #17324d; outline-color: #3fa36b; }
.cert h1 { color: #17324d; }
.cert .logo__text { color: #17324d; }
.cert .logo__text b { color: #3fa36b; }
.cert .name { border-bottom-color: #3fa36b; }

/* Листы доступа */
@media print { .sheet__head { border-bottom-color: #3fa36b; } .sheet__head b { color: #17324d; } }

/* Подвал */
.footer { background: var(--footer-bg); }
.footer h4 { letter-spacing: .04em; }
.footer a { color: #b9c7d4; }
.footer__contacts span, .footer .disclaimer, .footer__copy { color: #93a5b6; }
/* Вкладки нормативной базы на узком экране переносятся */
.law-tabs { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 520px) { .law-tabs { border-radius: 20px; } .law-tab { padding: 10px 14px; font-size: .92rem; } }

/* Тесты до запуска Академии */
.ext-title { margin-top: 28px; }
.ext-list li { align-items: flex-start; }
.ext-list small { display: block; margin-top: 2px; }
.ext-admin-title { margin: 14px 0 6px; font-weight: 600; }
.table td.t-num small { display: block; }

/* Топ-10 по результатам тестов */
.top-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.top-list li { display: flex; align-items: center; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.top-list li.is-me { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.top-list .grow { flex: 1; min-width: 0; }
.top-list .grow small { display: block; color: var(--muted); font-size: .86rem; margin-top: 2px; }
.top-place { flex: none; width: 34px; text-align: center; font: 700 1.15rem var(--font-head); color: var(--heading); }
.top-points { flex: none; text-align: right; line-height: 1.1; }
.top-points b { display: block; font: 700 1.25rem var(--font-head); color: var(--heading); }
.top-points small { color: var(--muted); font-size: .78rem; }
.top-me { margin: 12px 0 0; color: var(--muted); }
.top-list--compact li { padding: 8px 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; gap: 10px; }
.top-list--compact li.is-me { box-shadow: none; }
.top-list--compact .top-place { width: 26px; font-size: 1rem; }
.top-list--compact .top-points b { font-size: 1rem; }
@media (max-width: 520px) { .top-list li { padding: 10px 12px; gap: 10px; } }

/* Учебные материалы */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; margin: 8px 0 48px; }
.mat-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.mat-cover { position: relative; display: flex; align-items: flex-end; aspect-ratio: 16 / 7; padding: 16px 18px; text-decoration: none;
  background: linear-gradient(135deg, #17324d 0%, #23506f 60%, #3fa36b 140%); color: #fff; }
.mat-cover__type { position: absolute; top: 14px; right: 14px; font: 700 .72rem var(--font-head); letter-spacing: .08em; padding: 4px 8px; border-radius: 6px; background: rgba(255,255,255,.16); }
.mat-cover__brand { font: 700 1.3rem/1.2 var(--font-head); overflow-wrap: anywhere; }
.mat-body { display: flex; flex-direction: column; gap: 8px; padding: 16px 18px 18px; flex: 1; }
.mat-body h3 { margin: 0; font-size: 1.08rem; line-height: 1.35; }
.mat-body p { margin: 0; }
.mat-body .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--muted); font-size: .85rem; }
.mat-body .btn-row { margin-top: auto; padding-top: 6px; }
.mat-admin { display: flex; gap: 16px; font-size: .88rem; }
@media (max-width: 520px) { .mat-grid { grid-template-columns: 1fr; } }

/* Шапка: пункты меню в одну строку; на узких экранах — меню-гамбургер (до 1300px) */
.nav a, .nav-logout { white-space: nowrap; }
@media (min-width: 1301px) { .nav a, .nav-logout { padding: 8px 11px; } .logo__text { white-space: nowrap; } }
/* Шапка шире контента: в меню 8 пунктов */
.topbar__inner { max-width: 1340px; }
.logo { flex: none; }
@media (min-width: 1301px) and (max-width: 1440px) { .logo__text small, .logo__divider { display: none; } .logo { gap: 10px; } }

/* Афиша */
.ev-list { display: grid; gap: 16px; margin: 8px 0 32px; }
.ev-card { display: flex; gap: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.ev-card--past { opacity: .75; }
.ev-date { flex: none; width: 84px; text-align: center; border-radius: var(--radius); padding: 12px 6px; background: linear-gradient(160deg, #17324d, #23506f); color: #fff; align-self: flex-start; }
.ev-date b { display: block; font: 700 2rem/1 var(--font-head); }
.ev-date span { display: block; text-transform: uppercase; font-size: .8rem; letter-spacing: .06em; margin-top: 4px; }
.ev-date small { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.25); font-weight: 600; }
.ev-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ev-body h3 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.ev-body p { margin: 0; }
.ev-body .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: .86rem; }
.ev-speaker { font-weight: 600; color: var(--brand); }
.ev-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 8px; }
.ev-past summary { cursor: pointer; color: var(--muted); margin: 8px 0 12px; }
.ev-people { margin: 12px 0; padding-left: 22px; max-height: 50vh; overflow: auto; }
.ev-people li { margin: 4px 0; }
.tg-banner { display: flex; align-items: center; gap: 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin: 8px 0 20px; }
.tg-banner > span { font-size: 1.6rem; }
.tg-banner .grow { flex: 1; min-width: 0; }
.tg-banner small { display: block; color: var(--muted); }
.tg-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.tg-panel:empty { display: none; }
.tg-panel p { margin: 0 0 10px; }
@media (max-width: 560px) {
  .ev-card { flex-direction: column; gap: 12px; padding: 16px; }
  .ev-date { display: flex; align-items: baseline; gap: 8px; width: auto; padding: 8px 12px; }
  .ev-date b { font-size: 1.3rem; } .ev-date span, .ev-date small { margin: 0; padding: 0; border: 0; }
  .tg-banner { flex-wrap: wrap; }
}

/* Кабинет руководителя: таблица не распирает колонку на телефоне; блок подключения бота */
.admin-grid > * { min-width: 0; }
.tg-setup { margin-bottom: 20px; border-color: var(--accent); }
.tg-setup h3 { margin-top: 0; }
.tg-setup form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.tg-setup .field { flex: 1 1 260px; margin: 0; }
.tg-setup .form-msg { flex-basis: 100%; }

/* Кабинет руководителя: записи на мероприятия */
.admin-events { margin-bottom: 20px; }
.admin-events h3 { margin-top: 0; }
.admin-ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.admin-ev-list li { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.admin-ev-list li:last-child { border-bottom: 0; }
.admin-ev-list .grow { flex: 1 1 220px; min-width: 0; }
.admin-ev-list small { display: block; color: var(--muted); }
.admin-ev-count { white-space: nowrap; }
.admin-ev-count small { display: inline; }
.admin-ev-count b { font: 700 1.2rem var(--font-head); color: var(--heading); }

/* ═══════════ Интерфейс «как приложение» ═══════════ */
.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a, .nav-logout { display: inline-flex; align-items: center; gap: 8px; }
.nav .ico { display: none; }
.tabbar { display: none; }

/* Компьютер (вошедший сотрудник): меню слева */
@media (min-width: 1101px) {
  body.logged-in { padding-left: 252px; }
  body.logged-in .topbar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 252px; z-index: 30;
    border-bottom: 0; border-right: 1px solid var(--border); overflow-y: auto; background: var(--surface);
  }
  body.logged-in .topbar__inner { max-width: none; height: 100%; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 22px; padding: 22px 14px; }
  body.logged-in .logo { padding: 0 8px; flex-direction: column; align-items: flex-start; gap: 8px; }
  body.logged-in .logo__divider { display: none; }
  body.logged-in .logo__img { height: 34px; width: auto; }
  body.logged-in .logo__text small { display: block; }
  body.logged-in .menu-btn { display: none; }
  body.logged-in .nav {
    position: static; display: flex; flex-direction: column; align-items: stretch; gap: 2px; flex: 1;
    padding: 0; border: 0; background: none;
  }
  body.logged-in .nav .ico { display: block; }
  body.logged-in .nav a, body.logged-in .nav-logout {
    width: 100%; gap: 12px; padding: 11px 12px; border-radius: 10px; font-size: .95rem; text-align: left; white-space: nowrap;
  }
  body.logged-in .nav a.active { background: var(--surface-2); color: var(--heading); box-shadow: inset 3px 0 0 var(--brand); font-weight: 600; }
  body.logged-in .nav-logout { margin-top: auto; color: var(--muted); background: none; border: 0; cursor: pointer; font: inherit; }
  body.logged-in .theme-btn { margin: 4px 0 0; width: 100%; border-radius: 10px; }
  body.logged-in .wrap { max-width: 1160px; }
}

/* Телефон и планшет (вошедший сотрудник): нижняя панель */
@media (max-width: 1100px) {
  body.logged-in { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.logged-in .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0;
    color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 500; line-height: 1.1;
  }
  .tabbar .ico { width: 24px; height: 24px; }
  .tabbar a.active { color: var(--brand); font-weight: 700; }
  .tabbar a.active .ico { stroke-width: 2.2; }
  .tabbar a[hidden] { display: none; }
  body.logged-in .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  /* В меню-гамбургере — значки и всё остальное */
  .nav.open .ico { display: block; }
}

/* Главная: лента «что сделать сегодня» */
.today { padding-top: 28px; padding-bottom: 8px; }
.today__hello { margin: 0 0 4px; font-size: clamp(1.6rem, 4vw, 2.2rem); }
.today__date { color: var(--muted); margin: 0 0 20px; }
.today__date::first-letter { text-transform: uppercase; }
.today-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.today-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.today-card h2 { margin: 0; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.today-card h3 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.today-card .btn-row { margin-top: auto; }
.today-card--accent { background: linear-gradient(140deg, #17324d 0%, #23506f 70%, #2f7a5a 130%); color: #fff; border: 0; }
.today-card--accent h2 { color: rgba(255,255,255,.7); }
.today-card--accent h3 { color: #fff; }
.today-card--accent .muted { color: rgba(255,255,255,.75); }
.today-card--accent .bar { background: rgba(255,255,255,.18); }
.today-card--accent .btn--primary { background: #fff; color: #17324d; border-color: #fff; }
.me-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.me-stats div { text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--surface-2); }
.me-stats b { display: block; font: 700 1.5rem/1.1 var(--font-head); color: var(--heading); }
.me-stats span { font-size: .78rem; color: var(--muted); }
.today-full { grid-column: 1 / -1; }
.today-links { display: flex; flex-wrap: wrap; gap: 8px; }
.today-links a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: .92rem; }
.today-links a:hover { border-color: var(--brand); }
.today-links .ico { width: 18px; height: 18px; color: var(--brand); }
.mat-mini { display: grid; gap: 8px; }
.mat-mini a { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--text); padding: 8px 0; border-bottom: 1px solid var(--border); }
.mat-mini a:last-child { border-bottom: 0; }
.mat-mini .pdf { flex: none; font: 700 .68rem var(--font-head); padding: 6px 7px; border-radius: 6px; background: #17324d; color: #fff; }
.mat-mini small { display: block; color: var(--muted); }
.install-card { display: flex; gap: 14px; align-items: center; }
.install-card img { width: 52px; height: 52px; border-radius: 12px; border: 1px solid var(--border); flex: none; }
.install-card .grow { flex: 1; min-width: 0; }
.install-card p { margin: 2px 0 0; }
@media (max-width: 860px) { .today-grid { grid-template-columns: 1fr; } }

/* ═══════════ Шлифовка визуала ═══════════ */
/* Узкие страницы (урок, тест, проверка) остаются узкими и при меню слева — удобная длина строки */
body.logged-in .wrap.narrow { max-width: 780px; }

/* Мягкое появление страницы при переходе */
#app > * { animation: page-in .22s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #app > * { animation: none; } }

/* Касания: без синей вспышки, с лёгким откликом */
a, button { -webkit-tap-highlight-color: transparent; }
.btn:active, .chip:active, .tabbar a:active, .option:active { transform: scale(.97); }
.btn, .chip, .option { transition: transform .08s ease, background-color .15s, border-color .15s, color .15s; }

/* Нижняя панель: активная вкладка — «пилюля» под значком */
@media (max-width: 1100px) {
  .tabbar .ico { padding: 3px 14px; width: 52px; height: 30px; border-radius: 999px; box-sizing: border-box; transition: background-color .2s; }
  .tabbar a.active .ico { background: color-mix(in srgb, var(--brand) 16%, transparent); }
}

/* Подвал для вошедших: коротко, без дублирования меню */
body.logged-in .footer { padding: 18px 0 22px; background: transparent; color: var(--muted); border-top: 1px solid var(--border); }
body.logged-in .footer__col { display: none; }
body.logged-in .footer__inner { display: block; }
body.logged-in .footer .disclaimer, body.logged-in .footer__copy { color: var(--muted); font-size: .78rem; margin: 0 0 6px; max-width: 80ch; border: 0; padding: 0; }

@media (max-width: 720px) {
  /* Заголовки поскромнее */
  h1 { font-size: clamp(1.55rem, 7vw, 1.9rem); }
  .course-head h1 { font-size: 1.6rem; }
  .course-head .card__icon { width: 48px; height: 48px; font-size: 1.6rem; }
  /* «Хлебные крошки» — одна строка */
  .crumbs { margin: 14px 0 10px; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Фильтры и подсказки — лента с прокруткой вбок вместо столбца */
  .filters, .law-hints {
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin-left: -16px; margin-right: -16px; padding: 2px 16px 6px; border-bottom: 0;
  }
  .filters::-webkit-scrollbar, .law-hints::-webkit-scrollbar { display: none; }
  .filters > *, .law-hints > * { flex: none; white-space: nowrap; }
  .law-tabs { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .law-tab { padding: 9px 6px; font-size: .82rem; line-height: 1.2; text-align: center; }
  /* Обложка материала ниже */
  .mat-cover { aspect-ratio: auto; min-height: 92px; }
  /* Карточки поплотнее */
  .today-card, .panel { padding: 16px; }
  .section { margin-top: 28px; }
}

/* Уроки: таблицы, клинические случаи, примеры с полки */
.lesson table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; font-size: .93rem; }
.lesson th, .lesson td { text-align: left; vertical-align: top; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.lesson th { background: var(--surface-2); color: var(--heading); font-weight: 600; }
.lesson .table-scroll { overflow-x: auto; margin: 0 -4px; }
.lesson .case { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: 10px; padding: 14px 18px; margin: 20px 0; background: var(--surface); }
.lesson .case > b:first-child { display: block; color: var(--brand); text-transform: uppercase; font-size: .78rem; letter-spacing: .06em; margin-bottom: 6px; }
.lesson .shelf { background: var(--surface-2); border-radius: 10px; padding: 14px 18px; margin: 20px 0; }
.lesson .shelf > b:first-child { display: block; margin-bottom: 6px; color: var(--heading); }
.lesson .shelf ul { margin: 0; }
.lesson .shelf small { display: block; color: var(--muted); margin-top: 8px; }
@media (max-width: 600px) {
  .lesson table.stack, .lesson table.stack tbody, .lesson table.stack tr, .lesson table.stack td { display: block; width: 100%; }
  .lesson table.stack tr:first-child { display: none; }
  .lesson table.stack tr { border: 1px solid var(--border); border-radius: 10px; margin: 0 0 10px; padding: 4px 12px; background: var(--surface); }
  .lesson table.stack td { border: 0; padding: 6px 0; border-bottom: 1px dashed var(--border); }
  .lesson table.stack td:last-child { border-bottom: 0; }
  .lesson table.stack td:first-child { font-weight: 700; color: var(--heading); font-size: 1rem; padding-top: 8px; }
  .lesson table.stack td:not(:first-child)::before { content: attr(data-label); display: block; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
  .lesson .table-scroll { overflow: visible; margin: 0; }
}

/* Справочник по МНН */
.drug-sec { margin: 24px 0; }
.drug-sec h2 { font-size: 1.15rem; margin-bottom: 10px; }
.drug-sec h2 .muted { font-weight: 500; font-size: .95rem; }
.drug-src { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 8px; }
.drug-src .btn { flex-direction: column; align-items: flex-start; line-height: 1.2; padding: 10px 16px; height: auto; }
.drug-src .btn small { font-weight: 400; font-size: .75rem; opacity: .8; }
.drug-hits, .drug-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.drug-hits li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.drug-hits a { text-decoration: none; color: var(--heading); }
.drug-hits small { display: block; color: var(--muted); }
.drug-hits p { margin: 6px 0 0; font-size: .9rem; color: var(--text); }
.drug-hits mark, .drug-items mark { background: color-mix(in srgb, var(--brand) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }
.drug-items li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.drug-items a { color: var(--text); }
.drug-items small { display: block; color: var(--muted); font-size: .82rem; }

/* Проверка взаимодействий */
.drug-tabs { margin: 4px 0 16px; }
.drug-tabs .law-tab { text-decoration: none; display: inline-block; }
.ix-form { display: flex; gap: 10px; align-items: stretch; }
.ix-form .search { flex: 1; margin: 0; }
.ix-extras { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.ix-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 6px; }
.ix-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; padding: 8px 10px 8px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; }
.ix-chip small { flex-basis: 100%; order: 3; font-weight: 400; color: var(--muted); font-size: .76rem; }
.ix-chip .link-btn { font-size: 1.2rem; line-height: 1; order: 2; text-decoration: none; }
.ix-chip--unknown { border-style: dashed; }
.ix-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ix-item { border: 1px solid var(--border); border-left: 5px solid var(--border); border-radius: var(--radius); padding: 14px 18px; background: var(--surface); }
.ix-item p { margin: 6px 0 0; }
.ix-sev { display: table; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 6px; margin-bottom: 6px; }
.ix-item--contra { border-left-color: #b42318; } .ix-item--contra .ix-sev { background: #fde8e7; color: #b42318; }
.ix-item--high { border-left-color: #dc6803; } .ix-item--high .ix-sev { background: #fef0e1; color: #b54708; }
.ix-item--mod { border-left-color: #d4a106; } .ix-item--mod .ix-sev { background: #fdf6d8; color: #8a6a00; }
.ix-item--time { border-left-color: #2e7d9a; } .ix-item--time .ix-sev { background: #e2f1f6; color: #1f5d73; }
.ix-do { font-size: .93rem; }
.ix-none { background: var(--surface-2); border-radius: var(--radius); padding: 14px 18px; }
.ix-none p { margin: 6px 0 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ix-sev { filter: brightness(.9); } }
@media (max-width: 520px) { .ix-form { flex-direction: column; } }
.ix-form-sel { order: 4; flex-basis: 100%; margin-top: 4px; font: inherit; font-size: .8rem; font-weight: 500; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); max-width: 100%; }
.ix-local { order: 5; color: var(--brand) !important; }
.ix-item--low { border-left-color: #6b9a6b; } .ix-item--low .ix-sev { background: #e7f3e7; color: #2f6b2f; }
.drug-forms { margin: 0 0 8px; }
.drug-forms .chip small { opacity: .7; margin-left: 2px; }

/* Рецептурный препарат в справочнике */
.rx-badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 700; line-height: 18px; color: #b42318; background: #fee4e2; vertical-align: 1px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rx-badge { color: #fda29b; background: rgba(240, 68, 56, .18); } }
:root[data-theme="dark"] .rx-badge { color: #fda29b; background: rgba(240, 68, 56, .18); }

/* Презентация PowerPoint в материалах */
.mat-cover--ppt .mat-cover__type { background: #c43e1c; color: #fff; }
.mat-orig { margin: 4px 0 0; }
.mat-orig a { color: var(--muted, #667085); }

/* ── Раздел «Ортопедия» ── */
.ortho-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 28px; margin: 8px 0 24px;
  border-radius: calc(var(--radius) * 2); background: linear-gradient(120deg, #17324d 0%, #1f4a6b 55%, #2a7563 100%); color: #fff; }
.ortho-hero h1 { color: #fff; margin: 6px 0 10px; }
.ortho-hero p { margin: 0; max-width: 720px; color: rgba(255,255,255,.88); }
.ortho-hero__kicker { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.75); }
.ortho-hero__stat { min-width: 180px; padding: 14px 16px; border-radius: var(--radius); background: rgba(255,255,255,.12); }
.ortho-hero__stat b { display: block; font: 700 1.6rem var(--font-head); }
.ortho-hero__stat span { display: block; margin-bottom: 10px; font-size: .85rem; color: rgba(255,255,255,.8); }
.ortho-blocks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ortho-block { display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--border); border-radius: calc(var(--radius) * 1.5);
  background: var(--surface); box-shadow: var(--shadow); min-width: 0; }
.ortho-block__head { display: flex; align-items: center; gap: 10px; }
.ortho-block__icon { font-size: 1.6rem; }
.ortho-block__num { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ortho-block__head .badge { margin-left: auto; }
.ortho-block h2 { margin: 0; font-size: 1.15rem; }
.ortho-block h2 a { color: var(--heading); text-decoration: none; }
.ortho-block h2 a:hover { text-decoration: underline; }
.ortho-block p { margin: 0; }
.ortho-lessons { margin: 0; padding-left: 20px; font-size: .92rem; }
.ortho-lessons li { margin: 3px 0; }
.ortho-lessons li.done { color: var(--muted); }
.ortho-lessons li.done::marker { content: '✓  '; color: var(--accent); }
.ortho-lessons a { color: inherit; }
.ortho-block__foot { margin-top: auto; display: grid; gap: 10px; }
.ortho-videos { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 8px; }
.ortho-video { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--heading); text-decoration: none; text-align: left; font: inherit; cursor: pointer; }
.ortho-video:hover { border-color: var(--accent); }
.ortho-video small { display: block; color: var(--muted); font-size: .78rem; }
.ortho-video__play { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; }
.ortho-video--cloud .ortho-video__play { background: #1f4a6b; }
.ortho-news { margin: 24px 0 12px; padding: 18px 20px; border-radius: calc(var(--radius) * 1.5); background: var(--accent-soft); }
.ortho-news h2 { margin: 0 0 8px; font-size: 1.1rem; }
.ortho-news ul { margin: 0 0 12px; padding-left: 20px; }
.ortho-promo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--heading);
  background: linear-gradient(120deg, #17324d 0%, #1f4a6b 60%, #2a7563 100%); color: #fff; }
.ortho-promo small { display: block; margin-top: 3px; color: rgba(255,255,255,.82); font-size: .82rem; }
.ortho-promo__icon { font-size: 1.8rem; }
.ortho-promo__go { margin-left: auto; font-size: 1.4rem; }
@media (max-width: 760px) {
  .ortho-hero { grid-template-columns: 1fr; padding: 20px; }
  .ortho-blocks { grid-template-columns: 1fr; }
}

/* Видео в материалах */
.mat-cover--video .mat-cover__type { background: var(--accent); color: #fff; }
.mat-cover__play { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); display: grid; place-items: center; width: 52px; height: 52px;
  border-radius: 50%; background: rgba(255,255,255,.22); color: #fff; font-size: 1.2rem; }
.modal:has(.modal__body--video) { width: min(960px, 94vw); max-width: 94vw; }
.modal__body--video { width: 100%; box-sizing: border-box; }
.mat-video { display: block; width: 100%; max-height: 70vh; margin: 8px 0 14px; border-radius: var(--radius); background: #000; }
.mat-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; margin: 8px 0 14px; border-radius: var(--radius); overflow: hidden; background: #000; }
.mat-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.ortho-mats { margin: 28px 0 8px; }
.ortho-mats .section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ortho-video--doc .ortho-video__play { background: #1f4a6b; font: 700 .62rem var(--font-head); letter-spacing: .04em; }
.ortho-video--ppt .ortho-video__play { background: #c43e1c; }
.conv-steps { margin: 4px 0 12px; padding-left: 18px; } .conv-steps li { margin: 3px 0; }
.ortho-sub { margin: 18px 0 10px; font-size: 1rem; }
.ortho-notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 8px; }
.ortho-note { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--heading); text-decoration: none; }
.ortho-note:hover { border-color: var(--accent); }
.ortho-note small { color: var(--muted); }
.ortho-note__tag { align-self: flex-start; display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 700 .7rem var(--font-head); letter-spacing: .06em; text-transform: uppercase; }
.ortho-video--note .ortho-video__play { background: #6b4fa3; font: 700 .7rem var(--font-head); }
.crumbs { overflow-wrap: anywhere; }

/* ── Рейтинг продаж по акциям ── */
.sales-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.sales-grid h2, .panel > h2 { font-size: 1.15rem; margin: 0 0 12px; }
@media (max-width: 860px) { .sales-grid { grid-template-columns: 1fr; } }
.sales-me { display: flex; align-items: center; gap: 14px; margin: 4px 0 12px; }
.sales-me__place { display: grid; place-items: center; min-width: 56px; height: 56px; padding: 0 8px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font: 700 1.5rem var(--font-head); }
.sales-me small { display: block; color: var(--muted); }
.sales-promos { list-style: none; margin: 0 0 12px; padding: 0; }
.sales-promos li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); }
.sales-promos li:last-child { border-bottom: 0; }
.sales-promos li span { min-width: 0; overflow-wrap: anywhere; }
.sales-promos li small { display: block; color: var(--muted); font-size: .8rem; }
.sales-promos li b { white-space: nowrap; }
.sales-table td:nth-child(n+4), .sales-table th:nth-child(n+4) { text-align: right; white-space: nowrap; }
.prof-sales { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.prof-sales h3 { margin-bottom: 2px; }
.modal__body--wide { width: min(820px, 94vw); box-sizing: border-box; }
.modal:has(.modal__body--wide) { width: min(820px, 94vw); max-width: 94vw; }
.sales-map select { min-width: 210px; }
.sales-kpi { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 4px 0 10px; }
.sales-kpi div { padding: 10px; border-radius: var(--radius); background: var(--surface-2); text-align: center; }
.sales-kpi b { display: block; font: 700 1.15rem var(--font-head); color: var(--heading); }
.sales-kpi span { font-size: .78rem; color: var(--muted); }
.sales-groups summary { cursor: pointer; font-size: .9rem; margin-bottom: 6px; }
.sales-promos .progress { margin-top: 4px; }
.pct-ok { color: var(--accent); }
.pct-mid { color: var(--warn); }
.pct-low { color: var(--danger); }
.sales-zone { font-size: .95rem; margin: 14px 0 4px; }
.sales-zone--top { color: var(--accent); }
.sales-zone--mid { color: var(--warn); }
.sales-zone--low { color: var(--danger); }
.sales-table tr.is-me td { background: var(--accent-soft); }
.sales-table small { display: block; }
.table-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sales-grid > *, .panel { min-width: 0; }
.sales-tabs { margin-bottom: 10px; }

/* Инструкция по сайту */
.modal--guide { width: min(860px, calc(100% - 24px)); }
.guide { padding: 18px; }
.guide__media { border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2, #f4f7f8); aspect-ratio: 16 / 10; max-height: 50vh; width: 100%; }
.guide__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.guide__text { margin: 12px 2px 4px; min-height: 6.4em; }
.guide__text h2 { margin: 2px 0 6px; font-size: 1.25rem; }
.guide__text p { margin: 0; line-height: 1.5; }
.guide__dots { display: flex; justify-content: center; gap: 6px; margin: 8px 0 12px; flex-wrap: wrap; }
.guide__dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: var(--border); cursor: pointer; }
.guide__dots button.is-on { background: var(--accent); width: 22px; border-radius: 4px; }
.guide__nav { display: flex; gap: 8px; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.guide__nav .guide__voice { margin: 0 auto; }
.guide__foot { display: flex; justify-content: space-between; gap: 12px; margin: 12px 2px 0; flex-wrap: wrap; }
@media (max-width: 560px) {
  .guide { padding: 12px; }
  .guide__text { min-height: 0; }
  .guide__text h2 { font-size: 1.1rem; }
  .guide__nav .guide__voice { order: -1; width: 100%; margin: 0 0 4px; }
}
.help-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 45; width: 46px; height: 46px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; font-family: inherit; font-size: 1.4rem; font-weight: 700; line-height: 1; cursor: pointer;
  box-shadow: 0 6px 18px rgba(8, 24, 31, .25);
}
.help-fab:hover { filter: brightness(1.08); }
.help-fab:focus-visible { outline: 3px solid var(--accent, #f5a623); outline-offset: 2px; }
@media (max-width: 1100px) { body.logged-in .help-fab { bottom: calc(76px + env(safe-area-inset-bottom)); right: 12px; width: 42px; height: 42px; } }
@media print { .help-fab { display: none; } }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.help-card { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.help-card img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 12px; border: 1px solid var(--border); }
.help-card h2 { margin: 0 0 6px; }
.help-card details { margin-top: 12px; }
.help-steps { margin: 8px 0 0; padding-left: 1.4em; }
.help-steps li { margin: 4px 0; }
