/* ===== Дизайн-система платформы TSS ===== */
:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f9; --border: #e3e7f0; --border-strong: #cfd6e4;
  --text: #121826; --text-2: #4a5468; --text-3: #7a8499;
  --accent: #4f46e5; --accent-soft: #eef0ff; --accent-text: #3730a3;
  --ok: #15803d; --ok-soft: #e7f6ec; --warn: #b45309; --warn-soft: #fdf3e3; --bad: #b91c1c; --bad-soft: #fdeceb;
  --info: #0e7490; --info-soft: #e3f5f8; --on-accent: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px -12px rgba(16, 24, 40, .14);
  --radius: 14px; --radius-sm: 10px; --sidebar: 268px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0b0e14; --surface: #121722; --surface-2: #19202e; --border: #242d3d; --border-strong: #303b50;
  --text: #e8ecf4; --text-2: #aab3c5; --text-3: #7d879b;
  --accent: #818cf8; --accent-soft: #1f2242; --accent-text: #c7d2fe;
  --ok: #4ade80; --ok-soft: #10261a; --warn: #fbbf24; --warn-soft: #2b2110; --bad: #f87171; --bad-soft: #2d1416;
  --info: #67e8f9; --info-soft: #0f2930; --on-accent: #0b0e14;
  --shadow-sm: none; --shadow: 0 10px 30px -15px rgba(0, 0, 0, .6); color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #0b0e14; --surface: #121722; --surface-2: #19202e; --border: #242d3d; --border-strong: #303b50;
  --text: #e8ecf4; --text-2: #aab3c5; --text-3: #7d879b;
  --accent: #818cf8; --accent-soft: #1f2242; --accent-text: #c7d2fe;
  --ok: #4ade80; --ok-soft: #10261a; --warn: #fbbf24; --warn-soft: #2b2110; --bad: #f87171; --bad-soft: #2d1416;
  --info: #67e8f9; --info-soft: #0f2930; --on-accent: #0b0e14;
  --shadow-sm: none; --shadow: 0 10px 30px -15px rgba(0, 0, 0, .6); color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 15.5px/1.6 var(--font); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 1.75rem; margin: 0 0 .4rem; font-weight: 700; }
h2 { font-size: 1.25rem; margin: 2rem 0 .8rem; font-weight: 650; }
h3 { font-size: 1.05rem; margin: 1.2rem 0 .5rem; font-weight: 650; }
p { margin: .5rem 0 .8rem; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-2); border: 1px solid var(--border); padding: .05rem .35rem; border-radius: 6px; }
pre { background: var(--surface-2); border: 1px solid var(--border); padding: .9rem; border-radius: var(--radius-sm); overflow-x: auto; }
pre code { border: 0; padding: 0; background: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.lg { width: 22px; height: 22px; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); } .small { font-size: .875rem; } .tiny { font-size: .78rem; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 2rem; } .mb-0 { margin-bottom: 0; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 1rem; top: 1rem; z-index: 99; background: var(--surface); padding: .5rem 1rem; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Оболочка ===== */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 1rem .8rem; }
.brand { display: flex; align-items: center; gap: .7rem; padding: .3rem .6rem 1.1rem; color: var(--text); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #4f46e5, #7c3aed); display: grid; place-items: center; color: #fff; flex: none; }
.brand small { display: block; font-weight: 500; color: var(--text-3); font-size: .74rem; letter-spacing: 0; }
.nav-group { margin: .2rem 0 .8rem; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 0 .7rem; margin: .5rem 0 .3rem; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 9px; color: var(--text-2); font-weight: 500; font-size: .92rem; }
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-link .badge { margin-left: auto; }
.side-progress { margin-top: auto; padding: .9rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); font-size: .85rem; }
.side-progress .row { margin-bottom: .45rem; }
.side-user { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; padding: .3rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: .85rem; flex: none; }
.side-user .who { min-width: 0; flex: 1; line-height: 1.25; } .side-user .who b { display: block; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; padding: 0; flex: none; }
.icon-btn:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .65rem 2rem; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--border); }
.crumbs { flex: 1; min-width: 0; font-size: .86rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs a { color: var(--text-2); } .crumbs .sep { margin: 0 .4rem; opacity: .6; }
.search { display: flex; align-items: center; gap: .5rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 0 .7rem; width: 300px; color: var(--text-3); }
.search input { border: 0 !important; box-shadow: none !important; background: transparent !important; padding: .5rem 0 !important; width: 100%; color: var(--text); font: inherit; font-size: .9rem; outline: none; }
.menu-btn { display: none; }
.scrim { display: none; position: fixed; inset: 0; background: rgba(10, 12, 20, .45); z-index: 55; border: 0; padding: 0; }
.content { max-width: 1140px; margin: 0 auto; padding: 2rem 2rem 4rem; }
.content.narrow { max-width: 880px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.6rem; }
.page-head h1 { margin: 0; }
.eyebrow { font-size: .76rem; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: .35rem; }
.lead { font-size: 1.04rem; color: var(--text-2); max-width: 72ch; margin: .4rem 0 0; }

/* ===== Компоненты ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.stack > * + * { margin-top: 1rem; } .stack > * { min-width: 0; }
.card-title { display: flex; align-items: center; gap: .55rem; font-weight: 650; margin: 0 0 .7rem; font-size: 1rem; }
.card-title .icon { color: var(--text-3); }
.card-link { display: block; color: inherit; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card-link:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.span-2 { grid-column: span 2; }
.row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.btn { display: inline-flex; align-items: center; gap: .5rem; font: inherit; font-weight: 600; font-size: .92rem; padding: .6rem 1.05rem; border-radius: 10px; border: 1px solid transparent; cursor: pointer; background: var(--accent); color: var(--on-accent); line-height: 1.2; white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(1.07); }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn.ghost:hover { background: var(--surface-2); filter: none; }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.success { background: var(--ok); color: var(--on-accent); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.sm { padding: .4rem .75rem; font-size: .84rem; }
.btn.lg { padding: .8rem 1.35rem; font-size: 1rem; }
.btn.block { width: 100%; justify-content: center; }
.btn .icon { width: 17px; height: 17px; }
.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; padding: .16rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.badge.info { background: var(--info-soft); color: var(--info); border-color: transparent; }
.badge .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.alert { display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--radius-sm); margin: 1rem 0; }
.alert .icon { margin-top: .15rem; }
.alert.ok { background: var(--ok-soft); color: var(--ok); } .alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.bad { background: var(--bad-soft); color: var(--bad); } .alert.info { background: var(--accent-soft); color: var(--accent-text); }
.alert p { margin: 0; }
.bar { display: block; width: 100%; height: 8px; border-radius: 99px; overflow: hidden; }
.bar.thin { height: 5px; }
.bar .track { fill: var(--surface-2); } .bar .fill { fill: var(--accent); }
.bar.ok .fill { fill: var(--ok); }
.side-progress .bar .track { fill: var(--border); }
.ring { flex: none; }
.ring .track { stroke: var(--surface-2); } .ring .fill { stroke: var(--accent); }
.ring text { fill: var(--text); font-weight: 700; font-family: var(--font); }
.stat { display: flex; gap: .9rem; align-items: center; }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.stat-icon.ok { background: var(--ok-soft); color: var(--ok); } .stat-icon.warn { background: var(--warn-soft); color: var(--warn); } .stat-icon.info { background: var(--info-soft); color: var(--info); }
.stat b { display: block; font-size: 1.35rem; line-height: 1.15; letter-spacing: -.02em; }
.stat span { font-size: .82rem; color: var(--text-2); }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-2); }
.empty .icon { width: 36px; height: 36px; color: var(--text-3); margin-bottom: .5rem; }
details.disclosure { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .2rem 1rem; background: var(--surface); }
details.disclosure summary { cursor: pointer; padding: .6rem 0; font-weight: 600; }

/* таблицы и формы */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); font-weight: 650; background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
label { display: block; font-weight: 600; font-size: .88rem; margin: .9rem 0 .35rem; }
label.check { display: flex; align-items: center; gap: .5rem; font-weight: 500; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea {
  font: inherit; width: 100%; padding: .6rem .75rem; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
textarea { min-height: 200px; resize: vertical; }
input[type=file] { font: inherit; font-size: .9rem; color: var(--text-2); }
.form-actions { display: flex; gap: .6rem; margin-top: 1.2rem; flex-wrap: wrap; align-items: center; }
.filters { display: flex; gap: .8rem; flex-wrap: wrap; align-items: flex-end; }
.filters > div { min-width: 200px; flex: 1; } .filters label { margin-top: 0; }

/* контент из markdown */
.prose { line-height: 1.7; }
.prose table { border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; overflow-x: auto; margin: 1rem 0; }
.prose ul, .prose ol { padding-left: 1.3rem; } .prose li { margin: .25rem 0; }
.prose blockquote { margin: 1rem 0; padding: .8rem 1rem; background: var(--accent-soft); border-radius: 12px; border-left: 4px solid var(--accent); }
.prose h1 { font-size: 1.4rem; } .prose h2 { font-size: 1.15rem; }
.prose > :first-child { margin-top: 0; }

/* ===== Дашборд ===== */
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 2rem 2.2rem; color: #fff; background: radial-gradient(120% 140% at 100% 0%, #7c3aed 0%, #4f46e5 45%, #1e1b4b 100%); box-shadow: var(--shadow); }
.hero h2 { color: #fff; margin: .2rem 0 .3rem; font-size: 1.5rem; }
.hero .eyebrow { color: #c7d2fe; }
.hero p { color: #e0e7ff; }
.hero .btn { background: #fff; color: #312e81; }
.hero .btn.ghost { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }
.hero-grid { display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: center; }
.hero .ring .track { stroke: rgba(255,255,255,.18); } .hero .ring .fill { stroke: #fff; } .hero .ring text { fill: #fff; }
.hero-meta { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .88rem; color: #c7d2fe; margin: .3rem 0 1.3rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.module-card { display: flex; flex-direction: column; gap: .7rem; height: 100%; }
.module-head { display: flex; align-items: center; gap: .8rem; }
.module-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.module-icon.done { background: var(--ok-soft); color: var(--ok); }
.module-head h3 { margin: 0; font-size: 1rem; }
.module-head .eyebrow { margin: 0 0 .1rem; font-size: .7rem; }
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.gate { padding: 1rem 1.1rem; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.gate.passed { border-color: color-mix(in srgb, var(--ok) 35%, var(--border)); background: var(--ok-soft); }
.gate b { display: flex; align-items: center; gap: .4rem; }

/* ===== Программа и неделя ===== */
.module-section + .module-section { margin-top: 2.2rem; }
.module-banner { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.module-banner h2 { margin: 0; }
.week-list { display: grid; gap: .6rem; }
.week-item { display: grid; grid-template-columns: 52px 1fr auto; gap: 1rem; align-items: center; padding: .95rem 1.15rem; }
.week-num { width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font-weight: 700; color: var(--text-2); font-size: 1.05rem; }
.week-num.done { background: var(--ok-soft); color: var(--ok); } .week-num.active { background: var(--accent); color: var(--on-accent); }
.week-item h3 { margin: 0 0 .25rem; font-size: .98rem; }
.week-item .bar { margin-top: .55rem; max-width: 380px; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li + li { border-top: 1px solid var(--border); }
.lesson { display: grid; grid-template-columns: 32px 1fr auto; gap: .9rem; align-items: center; padding: .85rem 1.15rem; color: inherit; }
.lesson:hover { background: var(--surface-2); text-decoration: none; }
.lesson-state { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); color: var(--text-3); font-size: .78rem; font-weight: 700; }
.lesson-state.done { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.lesson-state.current { border-color: var(--accent); color: var(--accent); }
.lesson-state .icon { width: 15px; height: 15px; stroke-width: 2.8; }
.lesson-title { font-weight: 550; }
.steps { display: grid; gap: .9rem; }
.step { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 1rem; align-items: start; }
.step-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.step-icon.done { background: var(--ok-soft); color: var(--ok); } .step-icon.accent { background: var(--accent-soft); color: var(--accent-text); }
.step h3 { margin: .1rem 0 .3rem; }
.figure { margin: 0; }
.figure img { width: 100%; height: auto; display: block; border-radius: 14px; border: 1px solid var(--border); background: #fff; }
.figure figcaption { font-size: .84rem; color: var(--text-3); text-align: center; margin-top: .5rem; }

/* ===== Урок ===== */
.lesson-layout { display: grid; grid-template-columns: 270px minmax(0, 760px) 210px; gap: 2.2rem; justify-content: center; padding: 1.6rem 2rem 4rem; }
.outline { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow-y: auto; }
.outline-head { padding: .2rem .5rem .8rem; }
.outline-head b { display: block; font-size: .92rem; line-height: 1.3; margin-top: .15rem; }
.outline a { display: grid; grid-template-columns: 22px 1fr; gap: .6rem; padding: .5rem .55rem; border-radius: 9px; color: var(--text-2); font-size: .87rem; line-height: 1.35; }
.outline a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.outline a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.outline .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; margin-top: 1px; font-size: .65rem; }
.outline .dot.done { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.outline .dot .icon { width: 12px; height: 12px; stroke-width: 3; }
.outline .extra { margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); }
.toc-side { position: sticky; top: 72px; align-self: start; font-size: .84rem; }
.toc-side .toc ul { list-style: none; padding: 0; margin: 0; }
.toc-side .toc ul ul { padding-left: .7rem; }
.toc-side .toc a { display: block; padding: .28rem 0 .28rem .8rem; border-left: 2px solid var(--border); color: var(--text-3); line-height: 1.35; }
.toc-side .toc a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.article-head { margin-bottom: 1.6rem; }
.article-head h1 { font-size: 2rem; letter-spacing: -.025em; }
.article-meta { display: flex; gap: 1rem; flex-wrap: wrap; color: var(--text-3); font-size: .86rem; margin-top: .6rem; }
.article-meta span { display: inline-flex; align-items: center; gap: .35rem; }
.article { font-size: 1.03rem; line-height: 1.78; }
.article h2 { font-size: 1.32rem; margin-top: 2.3rem; scroll-margin-top: 80px; }
.article h3 { scroll-margin-top: 80px; }
.article ul, .article ol { padding-left: 1.3rem; } .article li { margin: .3rem 0; }
.article img { max-width: 100%; height: auto; display: block; margin: 1.4rem 0; border-radius: 14px; border: 1px solid var(--border); background: #fff; }
.article blockquote { margin: 1.3rem 0; padding: .95rem 1.15rem; background: var(--accent-soft); border-radius: 12px; border-left: 4px solid var(--accent); }
.article blockquote p { margin: .25rem 0; }
.article table { border: 1px solid var(--border); border-radius: var(--radius-sm); display: block; overflow-x: auto; margin: 1.2rem 0; font-size: .9rem; line-height: 1.5; }
.article pre { font-size: .88rem; line-height: 1.5; }
.lesson-footer { margin-top: 2.6rem; padding: 1.3rem 1.4rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.pager a { display: block; padding: .9rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); font-weight: 550; line-height: 1.35; }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager .next { text-align: right; grid-column: 2; }
.pager small { display: block; color: var(--text-3); font-size: .76rem; font-weight: 500; margin-bottom: .2rem; }
.reading-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; background: transparent; }
.reading-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }

/* ===== Тесты ===== */
.quiz-q { padding: 1.3rem 1.4rem; }
.quiz-q + .quiz-q { margin-top: 1rem; }
.quiz-q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.quiz-q legend { font-weight: 600; font-size: 1.02rem; padding: 0; margin-bottom: .8rem; display: flex; gap: .6rem; }
.q-num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-size: .8rem; font-weight: 700; flex: none; }
.option { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem .9rem; border: 1px solid var(--border); border-radius: 11px; margin: .5rem 0 0; cursor: pointer; font-weight: 450; font-size: .95rem; transition: border-color .12s, background .12s; }
.option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.option input { margin-top: .28rem; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option.right { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: var(--ok-soft); cursor: default; }
.option.wrong { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: var(--bad-soft); cursor: default; }
.option.plain { cursor: default; } .option.plain:hover { background: transparent; border-color: var(--border); }
.option .mark { width: 18px; flex: none; margin-top: .2rem; }
.rationale { margin-top: .9rem; padding: .85rem 1rem; background: var(--surface-2); border-radius: 10px; font-size: .92rem; }
.quiz-bar { position: sticky; bottom: 0; margin-top: 1.4rem; padding: .9rem 1.1rem; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: space-between; gap: 1rem; box-shadow: var(--shadow); }
.score { display: grid; grid-template-columns: auto 1fr; gap: 1.6rem; align-items: center; }

/* ===== Вход ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(120% 120% at 0% 100%, #1e1b4b 0%, #312e81 40%, #6d28d9 100%); color: #e0e7ff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; }
.auth-art h1 { color: #fff; font-size: 2.3rem; max-width: 17ch; letter-spacing: -.03em; }
.auth-art p { color: #c7d2fe; max-width: 46ch; }
.auth-art .brand { color: #fff; padding: 0; } .auth-art .brand small { color: #c7d2fe; }
.auth-points { display: grid; gap: 1rem; margin: 2rem 0 0; }
.auth-points div { display: flex; gap: .75rem; align-items: flex-start; }
.auth-points .icon { color: #a5b4fc; margin-top: .2rem; }
.auth-form { display: grid; place-items: center; padding: 2rem; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { margin-top: 0; font-size: 1.5rem; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 11px; padding: 4px; gap: 4px; border: 1px solid var(--border); }
.seg label { position: relative; margin: 0; text-align: center; padding: .5rem; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--text-2); font-size: .88rem; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.auth-theme { position: fixed; top: 1rem; right: 1rem; }

/* ===== Адаптивность ===== */
@media (max-width: 1240px) { .lesson-layout { grid-template-columns: 250px minmax(0, 1fr); } .toc-side { display: none; } }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 286px; z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .menu-btn { display: inline-grid; }
  .search { display: none; }
  .topbar, .content { padding-left: 1rem; padding-right: 1rem; }
  .lesson-layout { grid-template-columns: 1fr; padding: 1.2rem 1rem 3rem; } .outline { display: none; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .timeline { grid-template-columns: repeat(2, 1fr); }
  .auth { grid-template-columns: 1fr; } .auth-art { display: none; }
  .span-2 { grid-column: auto; }
}
@media (max-width: 620px) {
  body { font-size: 15px; } h1 { font-size: 1.45rem; } .article-head h1 { font-size: 1.55rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 1.4rem; } .hero-grid { grid-template-columns: 1fr; } .hero-grid .ring { display: none; }
  .week-item { grid-template-columns: 42px 1fr; } .week-item > :last-child { grid-column: 1 / -1; }
  .week-num { width: 40px; height: 40px; }
  .pager { grid-template-columns: 1fr; } .pager .next { grid-column: 1; }
  .content { padding-top: 1.2rem; }
  .article { font-size: 1rem; }
  .score { grid-template-columns: 1fr; }
}
@media print { .sidebar, .topbar, .lesson-footer, .outline, .toc-side, .pager, .reading-progress { display: none !important; } .shell { display: block; } }

/* неделя */
.week-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1.2rem; align-items: start; }
.section-head { padding: 1rem 1.15rem; border-bottom: 1px solid var(--border); }
.card-title.mb-0 { margin-bottom: 0; }
.table-wrap.borderless { border: 0; border-radius: 0; }
.goal-list { padding-left: 1.1rem; margin: 0; } .goal-list li { margin: .35rem 0; } .goal-list p { margin: 0; }
.step details.disclosure + details.disclosure { margin-top: .5rem; }
.step details.disclosure { margin-top: .5rem; }
.figure figcaption { padding: 0 .8rem .7rem; }
.card.flush .figure img { border: 0; border-radius: 0; }
@media (max-width: 1100px) { .week-grid { grid-template-columns: minmax(0, 1fr); } }
.toc-nav-side ul { list-style: none; padding: 0; margin: .3rem 0 0; } .toc-nav-side ul ul { padding-left: .7rem; }
.toc-nav-side a { display: block; padding: .28rem 0 .28rem .8rem; border-left: 2px solid var(--border); color: var(--text-3); line-height: 1.35; }
.toc-nav-side a:hover { color: var(--text); border-color: var(--accent); text-decoration: none; }
.outline-head .bar { margin-top: .5rem; }

/* ===== Мобильные устройства ===== */
.side-head { display: flex; align-items: flex-start; gap: .5rem; }
.side-head .brand { flex: 1; min-width: 0; }
.side-close, .side-search, .search-btn, .tabbar, .lesson-mnav, .auth-mbrand { display: none; }
.page-head > div:first-child { flex: 1 1 420px; min-width: 0; }
.hero-meta span { align-items: flex-start; } .hero-meta .icon { margin-top: .2rem; }
.auth-mbrand { align-items: center; gap: .75rem; margin-bottom: 1.6rem; font-weight: 700; line-height: 1.25; }
.auth-mbrand small { display: block; font-weight: 500; font-size: .8rem; color: var(--text-3); margin-top: .15rem; }
.lesson-mnav summary { display: flex; align-items: center; gap: .6rem; list-style: none; }
.lesson-mnav summary::-webkit-details-marker { display: none; }
.lesson-mnav summary::after { content: ""; margin-left: auto; width: 8px; height: 8px; flex: none; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
.lesson-mnav[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.lesson-mnav summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-m { display: grid; gap: .1rem; padding: .3rem 0 .6rem; border-top: 1px solid var(--border); }
.outline-m a { display: grid; grid-template-columns: 22px 1fr; gap: .6rem; padding: .6rem .4rem; border-radius: 9px; color: var(--text-2); font-size: .92rem; line-height: 1.35; }
.outline-m a:hover { text-decoration: none; background: var(--surface-2); }
.outline-m a.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.outline-m .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; margin-top: 1px; }
.outline-m .dot.done { background: var(--ok); border-color: var(--ok); color: var(--on-accent); }
.outline-m .dot .icon { width: 12px; height: 12px; stroke-width: 3; }
.mnav-toc { margin: .6rem 0 .2rem; }
.lesson-mnav .toc-nav-side { padding-bottom: .7rem; }
.lesson-mnav .toc-nav-side a { padding-top: .45rem; padding-bottom: .45rem; }
@media (hover: none) {
  .card-link:hover { transform: none; box-shadow: var(--shadow-sm); }
  tbody tr:hover td { background: transparent; }
}

@media (max-width: 980px) {
  :root { --tabbar-h: 62px; }
  body { -webkit-tap-highlight-color: transparent; }
  body.nav-open { overflow: hidden; }
  .sidebar { width: min(86vw, 310px); padding: max(1rem, env(safe-area-inset-top)) .8rem max(1rem, env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .side-close { display: inline-grid; }
  .auth-mbrand { display: flex; }
  .side-search { display: flex; width: auto; margin: 0 .2rem .6rem; }
  .top-search { display: none; }
  .search-btn { display: inline-grid; }
  .icon-btn { width: 40px; height: 40px; border-radius: 11px; }
  .nav-link { padding: .68rem .75rem; font-size: .96rem; }
  .topbar { padding-top: max(.6rem, env(safe-area-inset-top)); padding-bottom: .6rem; gap: .5rem; }
  .crumbs { font-size: .84rem; }
  /* поля ввода 16px, чтобы iOS не увеличивал страницу при фокусе */
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select, textarea, .search input { font-size: 16px !important; }
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=search], select { min-height: 44px; }
  .search input { min-height: 0; }
  /* нижняя панель вкладок */
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 0 max(.25rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(.25rem, env(safe-area-inset-left)); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px); border-top: 1px solid var(--border); }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; font: inherit; font-size: .7rem; font-weight: 600; color: var(--text-3); background: none; border: 0; padding: 0; cursor: pointer; min-width: 0; }
  .tab .icon { width: 22px; height: 22px; }
  .tab:hover { text-decoration: none; color: var(--text); }
  .tab.active { color: var(--accent); }
  .tab span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .quiz-bar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + .5rem); }
  .lesson-mnav { display: block; margin-bottom: 1.2rem; padding: .1rem .9rem; }
  .lesson-mnav summary { padding: .75rem 0; }
  .content, .lesson-layout { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
}

@media (max-width: 620px) {
  h2 { margin-top: 1.6rem; }
  .card { padding: 1.05rem; }
  .page-head { margin-bottom: 1.2rem; }
  .page-head > form { width: 100%; flex-wrap: nowrap; }
  .page-head > form input { flex: 1; min-width: 0; }
  .lead { font-size: 1rem; }
  /* сводные показатели — плиткой 2×2 */
  .grid:has(> .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
  .card.stat { flex-direction: column; align-items: flex-start; gap: .55rem; padding: .9rem; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat b { font-size: 1.2rem; }
  .stat span { font-size: .78rem; line-height: 1.3; display: block; }
  .stat b span { display: inline; font-size: inherit; }
  .hero { border-radius: 16px; }
  .hero h2 { font-size: 1.3rem; }
  .hero .row .btn { flex: 1 1 100%; justify-content: center; }
  .timeline { gap: .6rem; }
  .gate { padding: .85rem; }
  /* неделя и уроки */
  .page-head > .ring { display: none; }
  .section-head { padding: .85rem 1rem; }
  .lesson { grid-template-columns: 30px minmax(0, 1fr); gap: .1rem .75rem; padding: .8rem 1rem; }
  .lesson > .tiny { grid-column: 2; }
  .step { grid-template-columns: minmax(0, 1fr); gap: .5rem; }
  .step-icon { width: 38px; height: 38px; border-radius: 10px; }
  .step .row.between > .btn { width: 100%; justify-content: center; }
  .lesson-footer { flex-direction: column; align-items: stretch; padding: 1.1rem; }
  .lesson-footer .row, .lesson-footer form { display: flex; flex-direction: column; align-items: stretch; width: 100%; }
  .lesson-footer .btn { width: 100%; justify-content: center; }
  .article h2 { font-size: 1.2rem; margin-top: 1.9rem; }
  .article img { border-radius: 10px; }
  .btn { white-space: normal; text-align: center; }
  .form-actions .btn { width: 100%; justify-content: center; }
  /* тесты */
  .quiz-q { padding: 1.05rem; }
  .quiz-q legend { font-size: .98rem; }
  .option { padding: .8rem .85rem; min-height: 48px; }
  .option input { width: 20px; height: 20px; margin-top: .12rem; }
  .quiz-bar { padding: .7rem .8rem; }
  .quiz-bar > span { white-space: nowrap; }
  /* таблицы — карточками */
  .table-wrap:has(table.stackable) { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  table.stackable, table.stackable tbody { display: block; }
  table.stackable thead { display: none; }
  table.stackable tr { display: flex; flex-wrap: wrap; gap: .1rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .75rem .95rem; }
  table.stackable tr + tr { margin-top: .6rem; }
  table.stackable td { display: block; flex: 1 1 auto; min-width: 0; padding: .35rem 0 0; border: 0; }
  table.stackable td:first-child { flex-basis: 100%; padding: 0 0 .55rem; border-bottom: 1px solid var(--border); }
  table.stackable td::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: .15rem; }
  table.stackable td:first-child::before, table.stackable td:not([data-label])::before { display: none; }
  table.stackable td:empty { display: none; }
  .table-wrap.borderless:has(table.stackable) { padding: .8rem; }
  .table-wrap.borderless table.stackable tr { background: var(--surface-2); border-color: transparent; }
  /* вход */
  .auth-form { align-items: start; padding: 4.5rem max(1rem, env(safe-area-inset-right)) 2rem max(1rem, env(safe-area-inset-left)); }
}
