/* Обучалка — стили */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #1b2330;
  --text-2: #3d4757;
  --muted: #6b7585;
  --border: #e3e6eb;
  --border-strong: #cfd4dc;
  --primary: #2458d6;
  --primary-hover: #1c49b8;
  --primary-weak: #ebf1ff;
  --primary-text: #ffffff;
  --success: #15803d;
  --success-weak: #e8f6ee;
  --warn: #b45309;
  --warn-weak: #fdf3e2;
  --danger: #c62828;
  --danger-weak: #fdecec;
  --info: #0e7490;
  --info-weak: #e3f5f9;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 272px;
  --rail: 64px;
  --topbar: 60px;
  --ease: cubic-bezier(.32, .72, 0, 1);      /* близко к пружине без перелёта (damping 1.0) */
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --glass: rgba(255, 255, 255, .72);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131a; --surface: #151b24; --surface-2: #1a212c; --text: #e7eaf0; --text-2: #c5cbd6;
    --muted: #97a1b1; --border: #263040; --border-strong: #354155; --primary: #6d95ff; --primary-hover: #86a8ff;
    --primary-weak: #1c2a4a; --primary-text: #0b1220; --success: #4ade80; --success-weak: #16321f;
    --warn: #fbbf24; --warn-weak: #362a12; --danger: #f87171; --danger-weak: #3a1a1a; --info: #22d3ee;
    --info-weak: #0f2d35; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
    --glass: rgba(21, 27, 36, .72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131a; --surface: #151b24; --surface-2: #1a212c; --text: #e7eaf0; --text-2: #c5cbd6;
  --muted: #97a1b1; --border: #263040; --border-strong: #354155; --primary: #6d95ff; --primary-hover: #86a8ff;
  --primary-weak: #1c2a4a; --primary-text: #0b1220; --success: #4ade80; --success-weak: #16321f;
  --warn: #fbbf24; --warn-weak: #362a12; --danger: #f87171; --danger-weak: #3a1a1a; --info: #22d3ee;
  --info-weak: #0f2d35; --shadow: 0 1px 2px rgba(0,0,0,.4); --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  --glass: rgba(21, 27, 36, .72);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
html { font-size: 100%; }
body { background: var(--bg); color: var(--text); font: .9375rem/1.5 var(--font); -webkit-font-smoothing: antialiased;
  transition: background-color .3s ease, color .3s ease; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
h2 { font-size: 19px; font-weight: 650; letter-spacing: -.01em; }
h3 { font-size: 16px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.stat .label .i { width: 15px; height: 15px; }
.mat-meta .i { width: 14px; height: 14px; vertical-align: -2px; }
.finish h2 .i, .page-head h2 .i, #test-area h2 .i { width: 20px; height: 20px; color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- layout ---------- */
@property --sb-w { syntax: "<length>"; inherits: true; initial-value: 272px; }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; grid-template-rows: var(--topbar) 1fr; min-height: 100vh; }
/* Компьютер: кнопкой меню оно сворачивается в полосу иконок.
   Ширина колонок меняется один раз, мгновенно; плавно анимируется только видимая граница меню (маска clip-path
   по --sb-w), а страница переезжает сдвигом (FLIP в app.js) — текст не пересчитывается в каждом кадре и не «сжимается».
   Подписи не переносятся (nowrap) и лишь гаснут; иконки стоят на месте. */
.rail-ico { display: none; }
.nav .lbl { min-width: 0; }
.nav .course-link .lbl { display: flex; flex-direction: column; gap: 6px; }
@media (min-width: 861px) {
  .shell { --sb-w: var(--sidebar); overflow-x: clip; transition: --sb-w .38s var(--ease); }
  .shell.nav-collapsed { --sb-w: var(--rail); grid-template-columns: var(--rail) 1fr; }
  .sidebar { width: var(--sidebar); z-index: 20; border-right: 0; overflow-x: hidden;
    clip-path: inset(0 calc(100% - var(--sb-w)) 0 0);
    background: linear-gradient(var(--border), var(--border)) no-repeat calc(var(--sb-w) - 1px) 0 / 1px 100%, var(--surface); }
  .sidebar > .nav { width: calc(var(--sidebar) - 24px); }
  .nav a { width: calc(var(--sidebar) - 24px); overflow: hidden; position: relative; transition: width .38s var(--ease), background-color .15s ease; }
  .nav .lbl { white-space: nowrap; transition: opacity .22s ease .1s; }
  .nav .course-link .row span:first-child { overflow: hidden; text-overflow: ellipsis; }
  .nav-title { position: relative; white-space: nowrap; transition: color .22s ease .1s; }
  .nav-title::after { content: ""; position: absolute; left: 0; width: 40px; top: 50%; border-top: 1px solid var(--border); opacity: 0; transition: opacity .15s ease; }
  .nav-empty { white-space: nowrap; transition: opacity .2s ease; }
  .rail-ico { display: grid; position: absolute; left: 5px; top: 50%; transform: translateY(-50%) scale(.85); opacity: 0;
    transition: opacity .15s ease, transform .3s var(--ease); }
  .readbar { left: var(--sb-w); }

  .shell.nav-collapsed .nav a { width: 40px; }
  .shell.nav-collapsed .nav .lbl { opacity: 0; transition: opacity .12s ease; }
  .shell.nav-collapsed .nav-title { color: transparent; transition: color .12s ease; }
  .shell.nav-collapsed .nav-title::after { opacity: 1; transition: opacity .2s ease .15s; }
  .shell.nav-collapsed .nav-empty { opacity: 0; }
  .shell.nav-collapsed .rail-ico { opacity: 1; transform: translateY(-50%); transition: opacity .2s ease .12s, transform .35s var(--ease) .08s; }
}
/* подпись к иконке в свёрнутом меню */
.rail-tip { position: fixed; z-index: 150; left: 0; top: 0; transform: translate(-4px, -50%); opacity: 0; pointer-events: none;
  white-space: nowrap; background: #1b2330; color: #fff; font-size: 13px; font-weight: 500; padding: 6px 10px; border-radius: 8px;
  box-shadow: var(--shadow-lg); transition: opacity .12s ease, transform .2s var(--ease); }
.rail-tip.show { opacity: 1; transform: translate(0, -50%); }
/* курс в свёрнутом меню — номер в кольце прогресса */
.rail-ico { place-items: center; width: 30px; height: 30px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--ring, var(--primary)) calc(var(--p) * 1%), var(--border) 0); }
.rail-ico b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface);
  font-size: 12px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rail-ico.c-taxi1 { --ring: #0e7490; } .rail-ico.c-taxi2 { --ring: #7c3aed; }
.nav a.active .rail-ico b { color: var(--primary); }
.topbar { grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px;
  padding: 0 20px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent; transition: border-color .2s ease, box-shadow .2s ease; }
.topbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 1px 12px rgba(16, 24, 40, .06); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; color: var(--text); min-width: calc(var(--sidebar) - 40px); }
.brand:hover { text-decoration: none; }
.brand img { height: 30px; width: auto; }
.brand img.logo-light { filter: brightness(0) invert(1); }  /* на синем фоне страницы входа логотип белый */
.brand small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; height: 38px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px;
  padding: 0 12px 0 36px; }
.search input:focus { outline: none; border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-weak); }
.search svg { position: absolute; left: 11px; top: 11px; width: 16px; height: 16px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-weak); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.usermenu .who { line-height: 1.2; text-align: right; }
.usermenu .who b { display: block; font-size: 14px; font-weight: 600; }
.usermenu .who span { font-size: 12px; color: var(--muted); }
.topbar .burger { display: inline-grid; }
.scrim { display: none; }

.sidebar { position: sticky; top: var(--topbar); height: calc(100vh - var(--topbar)); overflow-y: auto; padding: 16px 12px 24px;
  background: var(--surface); border-right: 1px solid var(--border); }
.nav-title { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nav a.active { background: var(--primary-weak); color: var(--primary); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .course-link { flex-direction: column; align-items: stretch; gap: 6px; }
.nav .course-link .row { display: flex; justify-content: space-between; gap: 8px; }
.nav .course-link .row span:last-child { font-size: 12px; color: var(--muted); }
.main { min-width: 0; padding: 28px 32px 64px; }
.page { max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 860px; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 6px 0 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn { transition: transform .1s ease-out, background-color .15s ease, border-color .15s ease; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active:not(:disabled), .icon-btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger-weak); background: var(--danger-weak); }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 16px; }
.btn svg { width: 16px; height: 16px; }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer;
  display: inline-grid; place-items: center; color: var(--muted); }
.icon-btn { transition: transform .1s ease-out, background-color .15s ease; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.sm { width: 28px; height: 28px; } .icon-btn.sm svg { width: 15px; height: 15px; }
.icon-btn svg { width: 18px; height: 18px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.input, select.input, textarea.input { height: 40px; border: 1px solid var(--border-strong); border-radius: 9px; padding: 0 12px; background: var(--surface); width: 100%; }
textarea.input { height: auto; min-height: 140px; padding: 10px 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.error-box { background: var(--danger-weak); color: var(--danger); padding: 10px 12px; border-radius: 9px; font-size: 14px; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.success { background: var(--success-weak); color: var(--success); border-color: transparent; }
.badge.warn { background: var(--warn-weak); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-weak); color: var(--danger); border-color: transparent; }
.badge.info { background: var(--primary-weak); color: var(--primary); border-color: transparent; }

.bar { height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; transition: width .4s ease; }
.bar.success > i { background: var(--success); }
.bar.thin { height: 5px; border: 0; background: var(--border); }
.progress-inline { display: flex; align-items: center; gap: 10px; min-width: 140px; }
.progress-inline .bar { flex: 1; }
.progress-inline b { font-size: 13px; min-width: 36px; text-align: right; }

.stat { padding: 16px 18px; }
.stat .label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; font-weight: 500; color: var(--muted); }

.ring { position: relative; width: 120px; height: 120px; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-bg { stroke: var(--primary-weak); }
.ring .ring-fg { stroke: var(--primary); transition: stroke-dashoffset .6s ease; }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .ring-label b { font-size: 26px; }
.ring .ring-label span { display: block; font-size: 11px; color: var(--muted); }

.hero { display: flex; gap: 28px; align-items: center; padding: 24px 26px; }
.hero h1 { font-size: 24px; }
.hero p { margin: 6px 0 16px; color: var(--muted); }

.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
.person { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.person b { display: block; font-weight: 600; }
.person span { font-size: 12px; color: var(--muted); }

.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty svg { width: 40px; height: 40px; color: var(--border-strong); margin-bottom: 8px; }

/* course cards */
.course-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; color: inherit; transition: border-color .15s, transform .2s var(--ease); }
.course-card:hover { text-decoration: none; }
@media (hover: hover) { .course-card:hover { border-color: var(--primary); transform: translateY(-2px); } }
.course-card:active { transform: scale(.99); }
.course-card .cover { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #7c9cff); }
.course-card.c-taxi1 .cover { background: linear-gradient(90deg, #0e7490, #22b8cf); }
.course-card.c-taxi2 .cover { background: linear-gradient(90deg, #7c3aed, #b794f6); }
.course-card p { margin: 0; color: var(--muted); font-size: 14px; flex: 1; }
.course-card .meta { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }

.continue { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.continue .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; flex: none; }
.continue .ico svg { width: 22px; height: 22px; }
.continue .txt { flex: 1; min-width: 0; }
.continue .txt b { display: block; font-size: 16px; }

/* modules & materials */
.module { overflow: hidden; }
.module + .module { margin-top: 12px; }
.module-head { width: 100%; display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: none; border: 0; cursor: pointer; text-align: left; }
.module-head:hover { background: var(--surface-2); }
.module-head .num { width: 32px; height: 32px; border-radius: 9px; background: var(--primary-weak); color: var(--primary); display: grid; place-items: center; font-weight: 700; flex: none; }
.module-head .t { flex: 1; min-width: 0; }
.module-head .t b { display: block; font-size: 16px; }
.module-head .t span { font-size: 13px; color: var(--muted); }
.module-head:active { background: var(--surface-2); }
.module-head .chev { transition: transform .35s var(--ease); color: var(--muted); }
.module.open .module-head .chev { transform: rotate(90deg); }
.module-body { display: grid; grid-template-rows: 0fr; visibility: hidden; border-top: 1px solid transparent;
  transition: grid-template-rows .35s var(--ease), border-color .35s, visibility 0s .35s; }
.module.open .module-body { grid-template-rows: 1fr; visibility: visible; border-top-color: var(--border);
  transition: grid-template-rows .35s var(--ease), border-color .35s, visibility 0s; }
.module-inner { overflow: hidden; min-height: 0; }
.mat-row { display: flex; align-items: center; gap: 12px; padding: 11px 20px 11px 22px; color: inherit; border-top: 1px solid var(--border); }
.mat-row:first-child { border-top: 0; }
.mat-row:hover, .mat-row:active { background: var(--surface-2); text-decoration: none; }
.mat-row .idx { width: 26px; color: var(--muted); font-size: 13px; text-align: right; flex: none; font-variant-numeric: tabular-nums; }
.mat-row .title { flex: 1; min-width: 0; }
.mat-row .extra { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.st { width: 22px; height: 22px; flex: none; display: grid; place-items: center; }
.st svg { width: 20px; height: 20px; }
.st-new { color: var(--border-strong); }
.st-in_progress { color: var(--primary); }
.st-studied { color: var(--warn); }
.st-failed { color: var(--danger); }
.st-completed { color: var(--success); }

/* material page */
.crumbs { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.crumbs a { color: var(--muted); }
.mat-head h1 { font-size: 28px; letter-spacing: -.022em; }
.mat-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 12px 0 0; font-size: 13px; color: var(--muted); }
.mat-meta .sep { width: 4px; height: 4px; background: var(--border-strong); border-radius: 50%; }
.readbar { position: fixed; top: var(--topbar); left: var(--sidebar); right: 0; height: 3px; z-index: 25; }
.readbar i { display: block; height: 100%; width: 0; background: var(--primary); }
.doc-card { margin-top: 20px; padding: 32px 40px; }
.doc { font-size: 1rem; line-height: 1.68; color: var(--text); overflow-wrap: anywhere; }
.doc > *:first-child { margin-top: 0; }
.doc h2 { font-size: 1.375rem; margin: 2em 0 .55em; letter-spacing: -.015em; }
.doc h3 { font-size: 1.1875rem; margin: 1.75em 0 .5em; letter-spacing: -.01em; }
.doc h4 { font-size: 1.0625rem; margin: 1.4em 0 .45em; }
.doc h5 { font-size: .9375rem; margin: 1.2em 0 .4em; }
.doc p { margin: 0 0 12px; }
.doc ul, .doc ol { margin: 0 0 12px; padding-left: 26px; }
.doc li { margin: 4px 0; }
.doc .lvl-1 { margin-left: 22px; } .doc .lvl-2 { margin-left: 44px; } .doc .lvl-3 { margin-left: 66px; }
.doc ul + ul, .doc ol + ol, .doc ul + ol, .doc ol + ul { margin-top: -8px; }
.doc img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: zoom-in; }
.doc p.shot { margin: 14px 0; }
.doc p.center { text-align: center; }
.doc p.step { margin: 22px 0 6px; }
.doc p.step span { display: inline-block; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-weak); padding: 2px 10px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
.doc .table-wrap { overflow-x: auto; margin: 14px 0; }
.doc table { border-collapse: collapse; min-width: 50%; font-size: 14px; }
.doc td, .doc th { border: 1px solid var(--border-strong); padding: 8px 10px; vertical-align: top; }
.doc td p { margin: 0 0 6px; } .doc td p:last-child { margin: 0; }
.doc a { word-break: break-word; }
.doc .mark { border-radius: 3px; padding: 0 2px; }
.doc details.pdf-text { margin-top: 18px; }
.doc details summary { cursor: pointer; font-weight: 600; color: var(--primary); }
.pdf-embed object { width: 100%; height: 78vh; border: 1px solid var(--border); border-radius: 8px; }
.notice { display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px; background: var(--info-weak); color: var(--text); font-size: 14px; }
.notice svg { width: 20px; height: 20px; color: var(--info); flex: none; margin-top: 1px; }
.notice.warn { background: var(--warn-weak); } .notice.warn svg { color: var(--warn); }

.finish { margin-top: 20px; padding: 24px 28px; }
.finish h2 { display: flex; align-items: center; gap: 10px; }
.finish p { color: var(--muted); margin: 8px 0 16px; }
.question { padding: 18px 0; border-top: 1px solid var(--border); }
.question:first-of-type { border-top: 0; }
.question .qn { display: block; margin-bottom: 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.question .qt { font-weight: 600; font-size: 16px; margin: 4px 0 12px; }
.question .qtype { font-weight: 500; font-size: 12px; color: var(--muted); }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; margin-top: 8px; cursor: pointer; background: var(--surface); }
.opt { transition: border-color .15s ease, background-color .15s ease, transform .1s ease-out; }
.opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.opt:active { transform: scale(.99); }
.opt input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--primary); flex: none; }
.opt.chosen { border-color: var(--primary); background: var(--primary-weak); }
.opt.right { border-color: var(--success); background: var(--success-weak); }
.opt.wrong { border-color: var(--danger); background: var(--danger-weak); }
.question.bad .qt::after { content: " — неверно"; color: var(--danger); font-weight: 600; font-size: 13px; }
.question.good .qt::after { content: " — верно"; color: var(--success); font-weight: 600; font-size: 13px; }
.explain { margin-top: 10px; font-size: 14px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.result { display: flex; align-items: center; gap: 20px; padding: 20px 22px; border-radius: 12px; margin-bottom: 8px; }
.result.pass { background: var(--success-weak); }
.result.fail { background: var(--danger-weak); }
.result .big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.result.pass .big { color: var(--success); } .result.fail .big { color: var(--danger); }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.pager a { flex: 1; max-width: 48%; padding: 14px 16px; color: inherit; }
.pager a:hover { border-color: var(--primary); text-decoration: none; }
.pager a span { display: block; font-size: 12px; color: var(--muted); }
.pager a.next { text-align: right; margin-left: auto; }

/* tracker heatmap */
.heat td.cell { text-align: center; font-size: 12px; font-weight: 600; min-width: 64px; }
.heat .h0 { background: var(--surface-2); color: var(--muted); }
.heat .h1 { background: color-mix(in srgb, var(--primary) 12%, var(--surface)); }
.heat .h2 { background: color-mix(in srgb, var(--primary) 26%, var(--surface)); }
.heat .h3 { background: color-mix(in srgb, var(--primary) 45%, var(--surface)); }
.heat .h4 { background: color-mix(in srgb, var(--success) 40%, var(--surface)); color: var(--text); }
.heat th.mod { writing-mode: vertical-rl; transform: rotate(180deg); text-transform: none; font-weight: 600; letter-spacing: 0; height: 170px; vertical-align: bottom; font-size: 12px; }
.legend { display: flex; gap: 14px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 14px; height: 14px; border-radius: 4px; margin-right: 5px; vertical-align: -2px; border: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { width: auto; min-width: 220px; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(10, 14, 22, .45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .25s ease both; }
.modal { width: min(640px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: modal-in .34s var(--ease) both; }
.modal-back.closing { animation: fade .2s var(--ease-in) reverse both; }
.modal-back.closing .modal { animation: modal-out .2s var(--ease-in) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 16px 16px; }
.cred { background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px; padding: 14px 16px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; }
.cred div + div { margin-top: 4px; }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.82); z-index: 120; display: grid; place-items: center; padding: 24px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; background: #fff; will-change: transform; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 200; background: #1b2330; color: #fff;
  padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); transition: transform .35s var(--ease), opacity .25s ease; pointer-events: none; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: var(--danger); }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(145deg, #1d3fa3 0%, #2458d6 45%, #0e7490 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-side h2 { font-size: 34px; line-height: 1.12; letter-spacing: -.025em; max-width: 460px; font-weight: 750; }
.auth-side p { opacity: .85; max-width: 440px; font-size: 16px; }
.auth-side ul { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.auth-side li { display: flex; gap: 10px; align-items: center; opacity: .95; }
.auth-side li svg { width: 20px; height: 20px; flex: none; }
.auth-form { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-form form { width: min(380px, 100%); display: grid; gap: 16px; }
.auth-form h1 { font-size: 24px; }
.auth-form .brand { min-width: 0; margin-bottom: 8px; }

.booting::after { content: ""; position: fixed; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg) } }
mark { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-result { display: block; padding: 14px 18px; color: inherit; border-top: 1px solid var(--border); }
.search-result:first-child { border-top: 0; }
.search-result:hover { background: var(--surface-2); text-decoration: none; }
.search-result b { display: block; }
.search-result p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- окно теста ---------- */
body.noscroll { overflow: hidden; }
.test-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0 4px; }
.test-facts > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.test-facts b { display: block; font-size: 18px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.test-facts span { font-size: 12px; color: var(--muted); }
.test-window { position: fixed; inset: 0; z-index: 90; display: grid; grid-template-rows: auto auto 1fr auto; background: var(--bg);
  animation: tw-in .38s var(--ease) both; }
.test-window.closing { animation: tw-out .22s var(--ease-in) both; }
@keyframes tw-in { from { opacity: 0; transform: translateY(16px) scale(.985); } }
@keyframes tw-out { to { opacity: 0; transform: translateY(16px) scale(.985); } }
.tw-head { display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid var(--border); }
.tw-title { flex: 1; min-width: 0; }
.tw-title span { display: block; font-size: 12px; color: var(--muted); }
.tw-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tw-timer { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: var(--primary-weak);
  color: var(--primary); font-weight: 700; font-size: 20px; letter-spacing: -.01em; font-variant-numeric: tabular-nums;
  transition: background-color .3s ease, color .3s ease; }
.tw-timer svg { width: 18px; height: 18px; }
.test-window.warn .tw-timer { background: var(--warn-weak); color: var(--warn); }
.test-window.danger .tw-timer { background: var(--danger-weak); color: var(--danger); }
.test-window.done .tw-timer { background: var(--surface-2); color: var(--text-2); font-size: 15px; }
.tw-bar { height: 4px; background: var(--border); }
.tw-bar i { display: block; height: 100%; background: var(--primary); transform-origin: left; will-change: transform; transition: background-color .3s ease; }
.test-window.warn .tw-bar i { background: var(--warn); } .test-window.danger .tw-bar i { background: var(--danger); }
.test-window.done .tw-bar { visibility: hidden; }
.tw-body { overflow-y: auto; padding: 24px 20px 32px; }
.tw-body form { max-width: 760px; margin: 0 auto; }
.tw-body .question { border: 0; margin: 0; padding: 18px 0; border-top: 1px solid var(--border); }
.tw-body .question:first-of-type { border-top: 0; }
.tw-body .qt { padding: 0; }
.tw-foot { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 12px 20px; background: var(--surface); border-top: 1px solid var(--border); }
.tw-foot > span:first-child { margin-right: auto; }
.mat-row.locked { color: var(--muted); cursor: not-allowed; }
.mat-row.locked:hover, .mat-row.locked:active { background: transparent; }
.st-locked { color: var(--border-strong); } .st-blocked { color: var(--danger); }
.pager .locked { flex: 1; max-width: 48%; padding: 14px 16px; margin-left: auto; text-align: right; color: var(--muted); cursor: not-allowed; }
.pager .locked span { display: flex; justify-content: flex-end; gap: 6px; align-items: center; font-size: 12px; }
.pager .locked svg { width: 14px; height: 14px; }

.test-lock { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 36px 16px; color: var(--muted); }
.test-lock svg { width: 36px; height: 36px; color: var(--primary); }
.test-lock b { color: var(--text); font-size: 18px; }
.test-lock p { margin: 0 0 8px; max-width: 520px; }

/* ---------- роли и учётные записи ---------- */
.badge.role { background: color-mix(in srgb, var(--info) 14%, var(--surface)); color: var(--info); border-color: transparent; }
fieldset.roles { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.roles legend { font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0; margin-bottom: 6px; }
.role-opt { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease; }
.role-opt + .role-opt { margin-top: 6px; }
.role-opt:hover { border-color: var(--border-strong); }
.role-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-weak); }
.role-opt input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.role-opt b { display: block; font-weight: 600; }
.role-opt small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-weak); }
.hint.bad { color: var(--danger); }
.deliv { display: flex; gap: 6px; align-items: center; font-family: var(--font); font-size: 13px; margin-top: 6px; }
.deliv svg { width: 15px; height: 15px; flex: none; }
.deliv.ok { color: var(--success); } .deliv.no { color: var(--muted); }
table.data tr.blocked td:not(:last-child) { opacity: .6; }

/* ---------- редактор материала ---------- */
.title-input { width: 100%; font: 700 28px/1.2 var(--font); letter-spacing: -.022em; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px; padding: 6px 12px; }
.title-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-weak); }
.doc-card { position: relative; }
.ed-bar { position: sticky; top: calc(var(--topbar) + 8px); z-index: 20; display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap;
  margin: -16px -24px 24px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); box-shadow: var(--shadow-lg);
  animation: bar-in .34s var(--ease) both; }
@keyframes bar-in { from { opacity: 0; transform: translateY(-6px); } }
.ed-group { display: flex; gap: 2px; align-items: center; }
.ed-group + .ed-group { padding-left: 8px; border-left: 1px solid var(--border); }
.ed-group.end { margin-left: auto; gap: 6px; border-left: 0; }
.ed-status { font-size: 12px; color: var(--muted); flex: 1 1 180px; min-width: 0; }
.editing .doc { outline: 2px dashed color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 12px; border-radius: 4px; min-height: 120px; }
.editing .doc:focus { outline-color: var(--primary); }
.editing .doc img { cursor: pointer; }
.editing .doc a { cursor: text; }
.doc .ed-selected { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.ed-pop { position: absolute; z-index: 25; width: min(380px, calc(100% - 16px)); padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow-lg); animation: pop-in .26s var(--ease) both; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
.hist-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); }
.hist-row:first-child { border-top: 0; }

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: var(--topbar); bottom: 0; width: min(300px, 86vw); z-index: 40; transform: translateX(-100%); transition: transform .4s var(--ease), visibility 0s .4s; visibility: hidden; box-shadow: var(--shadow-lg); }
  .shell.nav-open .sidebar { transform: none; visibility: visible; transition: transform .4s var(--ease), visibility 0s; }
  .scrim { position: fixed; inset: var(--topbar) 0 0 0; z-index: 35; background: rgba(10, 14, 22, .35); opacity: 0; pointer-events: none; transition: opacity .3s ease; }
  .shell.nav-open .scrim { opacity: 1; pointer-events: auto; }

  .scrim { display: block; }
  .brand { min-width: 0; }
  .brand small, .usermenu .who { display: none; }
  .search { max-width: none; }
  .main { padding: 18px 16px 48px; }
  .readbar { left: 0; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .doc-card { padding: 20px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .mat-row .extra .mins, .hide-sm { display: none; }
  .module-head { padding: 14px 16px; gap: 12px; }
  .pager { flex-direction: column; } .pager a, .pager .locked { max-width: none; }
  .test-facts { grid-template-columns: 1fr 1fr; }
  .tw-head { padding: 10px 12px; gap: 10px; } .tw-timer { font-size: 17px; padding: 0 12px; height: 36px; }
  .tw-body { padding: 16px 14px 24px; } .tw-foot { padding: 10px 12px; flex-wrap: wrap; } #tw-save { display: none; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand span.bn { display: none; }
  h1, .mat-head h1 { font-size: 22px; }
}
/* ---------- касания, доступность ---------- */
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn.sm { width: 36px; height: 36px; }
  .btn { min-height: 44px; }
  .btn.sm { min-height: 36px; }
  .opt { padding: 12px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
  .btn:active:not(:disabled), .icon-btn:active, .opt:active, .course-card:active, .course-card:hover { transform: none !important; }
  .modal, .modal-back.closing .modal { animation: fade .15s ease both; }
  .ed-bar, .ed-pop, .test-window, .test-window.closing { animation: fade .15s ease both; }
  .test-window.closing { animation-direction: reverse; }
  .module-body, .module.open .module-body, .module-head .chev { transition: none; }
  .sidebar, .shell.nav-open .sidebar { transition: opacity .2s ease, visibility 0s; }
  .shell, .nav a, .nav .lbl, .nav-title, .nav-title::after, .rail-ico, .rail-tip { transition: none !important; }
  #toast { transition: opacity .2s ease; transform: translateX(-50%); }
  .bar > i, .ring .ring-fg { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .ed-bar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --border: color-mix(in srgb, var(--text) 45%, var(--surface)); --border-strong: color-mix(in srgb, var(--text) 65%, var(--surface)); --muted: color-mix(in srgb, var(--text) 80%, var(--surface)); }
  .topbar, .ed-bar { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; border-bottom-color: var(--border-strong); }
}
@media print {
  .topbar, .sidebar, .finish, .pager, .readbar { display: none !important; }
  .shell { display: block; } .doc-card { border: 0; box-shadow: none; padding: 0; }
}
