/* study-hub. Дизайн: https://claude.ai/artifact/RteAfWjGRtXmEzFhEYW6E6
   Токены → тема: светлая по умолчанию, тёмная через data-theme="dark" или системную настройку,
   если пользователь выбрал «как в системе» (атрибута нет). */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --sunk: #ECEEF2; --ink: #15171C; --muted: #5B6370;
  --line: #E1E4E9; --accent: #0B7A63; --accent-ink: #FFFFFF; --accent-soft: #E0F1EC;
  --warm: #A85A00; --warm-soft: #FBEFDC; --danger: #B42318; --danger-soft: #FDECEA;
  --mark: #FDE68A; --scrim: rgba(20, 22, 28, .42); --shadow: 0 24px 60px rgba(0, 0, 0, .18);
  --ui: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --read: "Literata", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --r: 9px; --r-lg: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1014; --surface: #161920; --sunk: #1D2129; --ink: #E8EAEE; --muted: #9AA3B1;
    --line: #282D36; --accent: #3CC4A4; --accent-ink: #04261E; --accent-soft: #11332B;
    --warm: #F2A84B; --warm-soft: #33240F; --danger: #F2867B; --danger-soft: #3A1E1B;
    --mark: #5C4A12; --scrim: rgba(0, 0, 0, .6); --shadow: 0 24px 60px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1014; --surface: #161920; --sunk: #1D2129; --ink: #E8EAEE; --muted: #9AA3B1;
  --line: #282D36; --accent: #3CC4A4; --accent-ink: #04261E; --accent-soft: #11332B;
  --warm: #F2A84B; --warm-soft: #33240F; --danger: #F2867B; --danger-soft: #3A1E1B;
  --mark: #5C4A12; --scrim: rgba(0, 0, 0, .6); --shadow: 0 24px 60px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

/* ---------- База ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--ui); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: 28px; letter-spacing: -0.02em; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
code, kbd, pre { font-family: var(--mono); }
mark { background: var(--mark); color: inherit; padding: 0 2px; border-radius: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.between { justify-content: space-between; }
.end { align-items: flex-end; }
.baseline { align-items: baseline; }
.nowrap { flex-wrap: nowrap; }
.tight { gap: 6px; }
.gap8 { gap: 8px; }
.ink { color: var(--ink); }
.center { text-align: center; align-items: center; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.count { font: 500 12px var(--mono); color: var(--muted); }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Каркас ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1200px; margin: 0 auto; padding: 10px 24px; min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.brand::before { content: ""; width: 22px; height: 22px; border-radius: 6px; background: var(--accent); }
.brand:hover { color: var(--ink); }
.nav { display: flex; gap: 2px; flex: 1 1 auto; flex-wrap: wrap; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--muted); }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a.on { background: var(--sunk); color: var(--ink); font-weight: 600; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 24px 64px; display: flex; flex-direction: column; gap: 20px; }
.page.narrow { max-width: 880px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.side-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.side-layout > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 28px; }
.side-layout > .side { flex: 1 1 280px; max-width: 340px; display: flex; flex-direction: column; gap: 14px; }
.lib-layout { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.lib-layout > .side { flex: 1 1 240px; max-width: 280px; }
.lib-layout > .main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* ---------- Кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.danger { background: transparent; border-color: transparent; color: var(--danger); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; }
.btn.lg { height: 42px; padding: 0 18px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; }
.btn.icon.sm { width: 32px; }
form.inline { display: inline-flex; margin: 0; }
input[type=text], input[type=search], input[type=password], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: 0 12px; height: 40px; min-width: 0;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; width: 100%; }
select { padding: 0 10px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field > input, .field > select, .field > textarea { font-size: 15px; }
.field .hint { font-size: 12px; }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--sunk); border-radius: 8px; color: var(--muted); flex: 1 1 220px; min-width: 0; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; background: transparent; outline: none; }
.search.on-surface { background: var(--surface); border: 1px solid var(--line); }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--sunk); border-radius: 9px; }
.seg > a, .seg > button, .seg > label {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}
.seg > .on, .seg > [aria-pressed="true"], .seg > [aria-checked="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.seg.icons > * { width: 32px; padding: 0; }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; height: 32px; min-width: 36px; padding: 0 9px; justify-content: center; border: 1px dashed var(--line); border-radius: 7px; background: transparent; color: var(--muted); font: 500 13px var(--mono); cursor: pointer; }
.chip.on { border-style: solid; background: var(--surface); color: var(--ink); }

/* ---------- Бейджи, метры ---------- */
.lvl { flex: none; font: 500 11px/1.4 var(--mono); padding: 2px 7px; border-radius: 5px; background: var(--sunk); color: var(--ink); white-space: nowrap; }
.pill { display: inline-flex; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.pill.warm { background: var(--warm-soft); border-color: transparent; color: var(--warm); font-weight: 600; }
.pill.ok { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.tag { font: 12px var(--mono); color: var(--accent); }
.meter { display: inline-flex; gap: 3px; }
.meter i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); }
.meter i.on { background: var(--accent); }
.meter.xs i { width: 8px; height: 4px; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--sunk); overflow: hidden; flex: 1; }
.bar > i { display: block; height: 100%; background: var(--accent); opacity: .55; }
.bar.strong > i { opacity: 1; }
.bar.lg { height: 8px; }

/* ---------- Карточки и списки ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.panel.flush { padding: 0; overflow: hidden; }
.panel > .eyebrow + * { margin-top: 10px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); min-width: 0; }
.card .where { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .title { color: var(--ink); font-size: 17px; line-height: 1.35; font-weight: 600; overflow-wrap: anywhere; }
.card .title:hover { color: var(--accent); }
.card .foot { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); }
.card .foot .btn.soft { flex: 1; }
.card.slot { align-items: center; justify-content: center; text-align: center; min-height: 230px; border: 1.5px dashed var(--line); background: transparent; color: var(--muted); }
.card.slot:hover { border-color: var(--accent); color: var(--ink); }
.plus { width: 40px; height: 40px; border-radius: 10px; background: var(--sunk); display: grid; place-items: center; color: var(--ink); }
.rows > * { border-top: 1px solid var(--line); }
.rows > *:first-child { border-top: 0; }
.rowlink { display: flex; justify-content: space-between; gap: 16px; padding: 12px 18px; color: var(--ink); }
.rowlink:hover { background: var(--sunk); color: var(--ink); }
.group-h { padding: 11px 18px; background: var(--sunk); }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 5; min-width: 180px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu-pop button, .menu-pop .btn { justify-content: flex-start; border: 0; width: 100%; }

/* ---------- Отметки «пройдено» ---------- */
.check { flex: none; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: transparent; color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.check:hover { border-color: var(--accent); }
.check svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.check[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.check[aria-pressed="true"] svg { visibility: visible; }
.is-done .done-dim { color: var(--muted); }

/* ---------- Тема ---------- */
.topic-title { font-family: var(--read); font-weight: 600; font-size: 32px; line-height: 1.2; letter-spacing: -0.01em; max-width: 30ch; }
.lead { font-family: var(--read); font-size: 18px; line-height: 1.6; max-width: 66ch; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.prompt-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.prompt-toggle { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; padding: 0; }
.kind { flex: none; width: 96px; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 6px; background: var(--sunk); color: var(--ink); text-align: center; }
.kind.explain { background: var(--accent-soft); color: var(--accent); }
.kind.drill, .kind.interview { background: var(--warm-soft); color: var(--warm); }
.prompt-text { margin: 0 14px 14px 48px; padding: 14px 16px; background: var(--sunk); border-radius: 9px; font: 13px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 520px; overflow: auto; }
.task { display: flex; gap: 14px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.task.is-done { border-color: var(--accent); }
.task .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.task ul { margin: 0; padding-left: 18px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.q-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; }
.q-row .check { margin-top: 3px; }
.reading { font-family: var(--read); font-size: 16px; line-height: 1.6; }
.score-seg { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 3px; background: var(--sunk); border-radius: 9px; }
.score-seg button { height: 34px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 14px var(--mono); cursor: pointer; }
.score-seg button[aria-checked="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.toc { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.toc a { display: flex; justify-content: space-between; gap: 8px; color: var(--ink); padding: 4px 0; }
.toc a:hover { color: var(--accent); }
.toc.lines a { padding: 3px 0 3px 10px; border-left: 2px solid var(--line); color: var(--muted); }
.toc.lines a.h3 { padding-left: 22px; }
.toc.lines a:hover { color: var(--ink); border-left-color: var(--accent); }

/* ---------- Модалка ---------- */
dialog.modal { width: min(780px, calc(100vw - 32px)); max-height: calc(100vh - 64px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.modal::backdrop { background: var(--scrim); }
.modal-box { display: flex; flex-direction: column; max-height: calc(100vh - 66px); }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.modal-body { overflow: auto; padding: 8px 12px 16px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--sunk); font-size: 13px; color: var(--muted); }
.picker-page { max-width: 780px; margin: 32px auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.sec-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 16px; padding: 11px 10px; border-radius: 9px; color: var(--ink); }
.sec-row:hover { background: var(--sunk); color: var(--ink); }
.sec-row .bar { width: 80px; flex: none; }
.topic-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 10px; border-bottom: 1px solid var(--line); }
.topic-row .badge-col { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 34px; }

/* ---------- Библиотека ---------- */
.tree { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.tree a { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 8px; color: var(--ink); }
.tree a:hover { background: var(--sunk); }
.tree a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tree a.root { font-weight: 600; }
.tree .caret { width: 12px; color: var(--muted); font-size: 10px; }
.tree .d1 { padding-left: 26px; }
.tree .d2 { padding-left: 42px; }
.tree .d3 { padding-left: 58px; }
.side-links { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; }
.side-links a { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; color: var(--muted); }
.side-links a:hover, .side-links a.on { background: var(--sunk); color: var(--ink); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 10px; min-height: 92px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); }
.tile:hover { border-color: var(--accent); color: var(--ink); }
.hit { display: flex; flex-direction: column; gap: 4px; padding: 12px 18px; color: var(--ink); }
.hit:hover { background: var(--sunk); color: var(--ink); }
.hit .snip { font-family: var(--read); font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.hero-search { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 680px; height: 54px; padding: 0 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, .06); color: var(--muted); }
.hero-search input { flex: 1; min-width: 0; border: 0; padding: 0; height: 100%; background: transparent; font-size: 17px; outline: none; }
.shelves { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.shelf { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--ink); }
.shelf:hover { border-color: var(--accent); color: var(--ink); }
.shelf .recent { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; border-top: 1px solid var(--line); font-family: var(--read); font-size: 14px; }
.shelf .recent span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tagcloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tagcloud a { font: 13px var(--mono); padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.tagcloud a:hover { border-color: var(--accent); }
.columns { display: flex; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; min-height: 600px; }
.columns > .col { flex: 1 1 180px; border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; min-width: 0; }
.columns > .col.wide { flex-basis: 240px; }
.columns > .preview { flex: 2 1 320px; min-width: 0; padding: 22px 24px; display: flex; flex-direction: column; gap: 12px; }
.col a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.col a:hover { background: var(--sunk); }
.col a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.col a.sel { background: var(--sunk); font-weight: 600; }
.col a .meta { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- Загрузка ---------- */
.steps { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.steps .n { width: 22px; height: 22px; border-radius: 50%; background: var(--sunk); display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--ink); }
.steps .n.now { background: var(--accent); color: var(--accent-ink); }
.steps .n.ok { background: var(--accent-soft); color: var(--accent); }
.steps .now-label { color: var(--ink); font-weight: 600; }
.steps .sep { width: 32px; height: 1px; background: var(--line); }
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; min-height: 340px; padding: 32px; border: 2px dashed var(--accent); border-radius: 18px; background: var(--accent-soft); text-align: center; cursor: pointer; }
.dropzone.drag { background: var(--surface); border-style: solid; }
.dropzone .ico { width: 64px; height: 64px; border-radius: 16px; background: var(--surface); display: grid; place-items: center; color: var(--accent); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
.dropzone .ico svg { width: 28px; height: 28px; }
.dropzone input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
kbd { font: 500 12px var(--mono); padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.filechip { display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.editor { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.editor .tabs { display: flex; gap: 2px; padding: 8px; border-bottom: 1px solid var(--line); align-items: center; }
.editor textarea { display: block; border: 0; border-radius: 0; min-height: 560px; padding: 18px 20px; font: 14px/1.65 var(--mono); outline: none; }
.editor .preview-pane { padding: 22px 26px; min-height: 560px; }

/* ---------- Вход, сообщения ---------- */
.flash { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); }
.flash.ok { border-color: transparent; background: var(--accent-soft); color: var(--ink); }
.flash.error { border-color: transparent; background: var(--danger-soft); color: var(--ink); }
.login { max-width: 380px; width: 100%; margin: 72px auto 0; display: flex; flex-direction: column; gap: 16px; padding: 24px; }

/* ---------- Прогресс ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
b.stat { display: block; font: 600 24px var(--mono); margin-top: 4px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
thead th { border-top: 0; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.heat { display: inline-block; min-width: 48px; text-align: center; padding: 2px 6px; border-radius: 5px; font: 500 13px var(--mono); background: var(--sunk); color: var(--muted); }
.heat.h1 { background: var(--warm-soft); color: var(--warm); }
.heat.h2 { background: var(--accent-soft); color: var(--accent); }
.heat.h3 { background: var(--accent); color: var(--accent-ink); }
tr.area-row td:first-child, tr.area-row th { font-weight: 600; }
tr.sec-row-p td:first-child { padding-left: 34px; color: var(--muted); }
.disclose { border: 0; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; padding: 0; }
.disclose::before { content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s; }
.disclose[aria-expanded="true"]::before { transform: rotate(90deg); }

/* ---------- Markdown ---------- */
.md { font-family: var(--read); font-size: 18px; line-height: 1.7; overflow-wrap: anywhere; max-width: 72ch; }
.md.compact { font-size: 16px; line-height: 1.6; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--read); margin: 1.5em 0 .5em; scroll-margin-top: 12px; }
.md h1 { font-size: 34px; line-height: 1.15; }
.md h2 { font-size: 25px; }
.md h3 { font-size: 20px; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md pre, .md .tablewrap, .md table { margin: 0 0 1em; }
.md blockquote { border-left: 3px solid var(--line); padding: 2px 16px; color: var(--muted); }
.md code { font-size: .86em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }
.md pre { background: var(--sunk); padding: 16px 18px; border-radius: 10px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.md pre code { background: none; padding: 0; font-size: inherit; }
.md table { display: block; overflow-x: auto; font-family: var(--ui); font-size: 15px; }
.md th, .md td { border: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
.md thead th { border-bottom: 2px solid var(--line); text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
.md img { max-width: 100%; }
.md .task-list-item { list-style: none; margin-left: -22px; }
.inline-md code { font-family: var(--mono); font-size: .88em; background: var(--sunk); padding: 1px 5px; border-radius: 4px; }

@media (max-width: 720px) {
  .topbar .in { padding-inline: 16px; }
  .nav { order: 3; flex-basis: 100%; }
  .page { padding-inline: 16px; }
  .topic-title { font-size: 26px; }
  .prompt-text { margin-left: 14px; }
  .kind { width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Детали, которые выглядят как кнопки/строки, — без системного маркера. */
summary.btn, summary.prompt-row { list-style: none; }
summary.btn::-webkit-details-marker, summary.prompt-row::-webkit-details-marker { display: none; }
details[open] > summary.prompt-row .prompt-toggle { color: var(--ink); }
.side-layout > .main.editor { gap: 0; }
[data-theme-switch] { margin-left: auto; }
.editor .tabs [aria-selected="true"] { background: var(--sunk); color: var(--ink); font-weight: 600; }

/* Подменю трекера */
.subnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.subnav .in { max-width: 1200px; margin: 0 auto; padding: 0 24px; display: flex; gap: 22px; overflow-x: auto; }
.subnav a { padding: 11px 0 10px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.subnav a:hover { color: var(--ink); }
.subnav a.on { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 720px) { .subnav .in { padding-inline: 16px; } }
.topic-li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 14px; padding: 11px 16px; }
.topic-li .acts { display: flex; gap: 6px; }
.sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.inline-rename summary { list-style: none; cursor: pointer; }
.inline-rename summary::-webkit-details-marker { display: none; }
.inline-rename[open] summary { display: none; }
.inline-rename form { display: flex; gap: 8px; }
@media (max-width: 720px) { .topic-li { grid-template-columns: auto minmax(0, 1fr); } .topic-li .acts { grid-column: 1 / -1; } }
