/* ============================================================
   PleskovDEV · Docs Site — soft light theme
   Тёплая спокойная палитра: без неона, без ярких градиентов.
   Все имена классов сохранены (index.html / app.js не ломаем).
   ============================================================ */
:root {
  /* палитра */
  --bg: #f5f3ee;              /* тёплый «бумажный» фон */
  --glass: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --stroke: #e5e1d7;          /* мягкие рамки */
  --stroke-strong: #cfc9bb;
  --text: #2c3138;            /* тёмный текст */
  --text-dim: #66707b;
  --text-faint: #9aa2ab;
  --accent: #5d7f9e;          /* спокойный серо-синий */
  --accent-soft: rgba(93, 127, 158, 0.10);
  --accent-2: #4c8a8b;        /* приглушённый бирюзовый — ссылки */
  --accent-grad: linear-gradient(135deg, #6d89a5 0%, #7d9ab0 100%);
  --ok: #3e8e63;
  --warn: #a9791f;
  --err: #b95656;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --r-lg: 16px;
  --r-md: 12px;
  --shadow: 0 12px 32px -16px rgba(60, 66, 76, 0.25);
  --code-bg: #f1efe9;         /* подложка кода */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans); color: var(--text);
  background: linear-gradient(160deg, #f8f6f1 0%, var(--bg) 60%);
  overflow: hidden; -webkit-font-smoothing: antialiased;
}

/* мягкие пастельные пятна вместо неоновых орбов */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.5; }
.orb-a { width: 420px; height: 420px; left: -160px; top: -140px; background: rgba(198, 216, 230, 0.55); }
.orb-b { width: 380px; height: 380px; right: -120px; top: 24%; background: rgba(224, 214, 194, 0.5); }
.orb-c { width: 360px; height: 360px; left: 26%; bottom: -180px; background: rgba(196, 220, 218, 0.5); }

.glass {
  background: var(--glass);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--stroke);
}

/* header */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 14px;
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  position: fixed; top: 8px; left: 16px; right: 16px; z-index: 50;
}
/* минимальная шапка: только кнопка в чат + название + меню */
.topbar .root-pick,
.topbar .live-dot,
.topbar #btnRefresh,
.topbar .sep,
.topbar #btnNewDoc,
.topbar #btnCopyPath,
.topbar #btnOpenScratch,
.topbar .badge,
.brand-text p { display: none !important; }
.brand { flex: 1; justify-content: center; }
.brand-text h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  font-size: 26px; line-height: 1; width: 46px; height: 46px;
  display: grid; place-items: center; border-radius: 13px;
  background: #fff; border: 1px solid var(--stroke);
  box-shadow: 0 4px 12px -6px rgba(60, 66, 76, 0.3);
}
.brand-text h1 { font-size: 17px; font-weight: 800; letter-spacing: 0.2px; }
.brand-text p { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.actions { display: flex; align-items: center; gap: 8px; }
.sep { width: 1px; height: 26px; background: var(--stroke); margin: 0 4px; }
.live-dot { color: var(--ok); font-size: 15px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.root-pick { display: flex; align-items: center; gap: 6px; min-width: 0; }
.rp-label { font-size: 14px; }
.select, .root-pick select {
  font-family: var(--sans); font-size: 12.5px; color: var(--text);
  background: #fff;
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 7px 10px; outline: none; cursor: pointer;
  max-width: 240px;
}

/* home button — всегда на виду, возврат в чат */
.home-btn {
  flex: none;
  background: var(--accent-grad); color: #fff; border-color: transparent;
  box-shadow: 0 6px 18px -10px rgba(93, 127, 158, 0.55);
  font-weight: 700; padding: 9px 16px; text-decoration: none;
}
.home-btn:hover { background: linear-gradient(135deg, #5f7d9c 0%, #6f8fa8 100%); color: #fff; transform: translateY(-1px); box-shadow: 0 10px 22px -10px rgba(93, 127, 158, 0.65); }

/* buttons */
.btn {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 8px 14px; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex; align-items: center; gap: 6px; user-select: none;
}
.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #fff;
  border-color: var(--stroke-strong);
  box-shadow: 0 8px 18px -10px rgba(60, 66, 76, 0.28);
}
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--accent-grad); color: #fff; border-color: transparent; box-shadow: 0 6px 18px -10px rgba(93, 127, 158, 0.55); }
.btn.primary:hover:not(:disabled) { box-shadow: 0 10px 22px -10px rgba(93, 127, 158, 0.65); }
.btn.big { padding: 12px 20px; font-size: 14px; border-radius: 12px; }
.btn.small { padding: 5px 10px; font-size: 12px; border-radius: 9px; }

/* layout */
.layout {
  display: flex; gap: 14px;
  margin: 96px 16px 16px; height: calc(100vh - 112px);
}
/* сайдбар скрыт по умолчанию — информация прежде всего; открывается кнопкой «📚 Документы» */
.sidebar { width: 300px; flex: none; }
.layout:not(.sidebar-open) .sidebar { display: none; }
.content { flex: 1; min-width: 0; }
.sidebar {
  border-radius: var(--r-lg); display: flex; flex-direction: column;
  overflow: hidden; box-shadow: var(--shadow); min-height: 0;
}
.search { padding: 12px; border-bottom: 1px solid var(--stroke); }
.search input {
  width: 100%; font-family: var(--sans); font-size: 13px; color: var(--text);
  background: #fff;
  border: 1px solid var(--stroke); border-radius: 10px;
  padding: 9px 12px; outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.tree { flex: 1; overflow-y: auto; padding: 8px; min-height: 0; }
.tree::-webkit-scrollbar, .diagram-list::-webkit-scrollbar, .md::-webkit-scrollbar,
#srcArea::-webkit-scrollbar, .src-split::-webkit-scrollbar, .graph-wrap::-webkit-scrollbar,
.tabs::-webkit-scrollbar { width: 8px; height: 8px; }
.tree::-webkit-scrollbar-thumb, .diagram-list::-webkit-scrollbar-thumb,
.md::-webkit-scrollbar-thumb, .tabs::-webkit-scrollbar-thumb { background: #d8d3c8; border-radius: 8px; }

.nav-section { margin-bottom: 10px; }
.nav-section-title {
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 8px 4px;
}
.tree-node { display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 9px; cursor: pointer; font-size: 13px; }
.tree-node:hover { background: var(--accent-soft); }
.tree-node.dir { font-weight: 600; color: #3d4450; }
.tree-node.file { padding-left: 24px; }
.tree-node.file.active { background: var(--accent-soft); border: 1px solid rgba(93, 127, 158, 0.35); }
.tree-node .t-icon { flex: none; font-size: 13px; }
.tree-node .t-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-node .t-dia { font-size: 10px; color: var(--accent-2); flex: none; }
.tree-children { margin-left: 14px; border-left: 1px dashed var(--stroke); padding-left: 4px; }
.tree-children.closed { display: none; }
.tree-loading { padding: 6px 8px; font-size: 12px; color: var(--text-faint); }
.sidebar-foot {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-top: 1px solid var(--stroke);
}
.spacer { flex: 1; }
.stats { font-size: 11px; color: var(--text-dim); }

/* content / tabs */
.content {
  border-radius: var(--r-lg); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 14px 0; border-bottom: 1px solid var(--stroke);
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: #d8d3c8 transparent;
  flex-wrap: nowrap;
}
.tab {
  font-family: var(--sans); font-size: 13px; font-weight: 600; color: var(--text-dim);
  background: transparent; border: none; border-radius: 10px 10px 0 0;
  padding: 9px 16px; cursor: pointer; position: relative; white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.tab:hover { color: var(--text); background: var(--accent-soft); }
.tab.active { color: var(--accent); background: var(--accent-soft); }
.tab.active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px;
  background: var(--accent); border-radius: 2px;
}
.chip {
  display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px;
  font-size: 10.5px; font-weight: 700; color: #fff;
  background: var(--accent-grad); border-radius: 999px; vertical-align: 1px; margin-left: 4px;
}
.tabs-fill { flex: 1; min-width: 8px; }
.active-file { font-size: 11.5px; color: var(--text-dim); max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; }

.tabpane { display: none; flex: 1; min-height: 0; position: relative; }
.tabpane.active { display: flex; flex-direction: column; }
.doc-meta {
  padding: 8px 34px; font-size: 11px; color: var(--text-faint);
  border-bottom: 1px solid var(--stroke);
  background: rgba(0, 0, 0, 0.015);
  font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* markdown */
.md { flex: 1; overflow-y: auto; padding: 26px 34px 60px; font-size: 14.5px; line-height: 1.7; color: var(--text); }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.35; margin: 1.4em 0 0.55em; font-weight: 800; }
.md h1 { font-size: 25px; padding-bottom: 10px; border-bottom: 1px solid var(--stroke); }
.md h2 { font-size: 20px; }
.md h3 { font-size: 16.5px; color: #454c57; }
.md p { margin: 0.7em 0; }
.md a { color: var(--accent-2); text-decoration: none; }
.md a:hover { text-decoration: underline; }
.md a.wiki-link { font-weight: 600; border-bottom: 1px dashed rgba(76, 138, 139, 0.5); }
.md a.wiki-link:hover { border-bottom-style: solid; text-decoration: none; }
.md a.wiki-link::after { content: " ↗"; font-size: 0.75em; }
.md strong { color: #1f242b; }
.md ul, .md ol { margin: 0.7em 0; padding-left: 1.5em; }
.md li { margin: 0.3em 0; }
.md blockquote {
  margin: 0.9em 0; padding: 6px 16px; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--text-dim);
}
.md code {
  font-family: var(--mono); font-size: 12.5px;
  background: var(--code-bg); padding: 2px 6px; border-radius: 6px; color: #7a4b44;
}
.md pre {
  background: #fbfaf7; border: 1px solid var(--stroke);
  border-radius: 12px; padding: 14px 16px; overflow-x: auto; margin: 1em 0;
}
.md pre code { background: none; padding: 0; color: #3a4150; font-size: 12.5px; }
.md { overflow-x: auto; }
.md-table-wrap { overflow-x: auto; margin: 1em 0; -webkit-overflow-scrolling: touch; }
.md-table-wrap table { min-width: 100%; width: auto; border-collapse: collapse; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--stroke); padding: 8px 10px; text-align: left; vertical-align: top; overflow-wrap: break-word; word-break: normal; hyphens: none; }
.md th { white-space: nowrap; }
.md th { background: #eef1f4; font-weight: 700; }
.md tr:nth-child(even) td { background: rgba(0, 0, 0, 0.015); }
.md hr { border: none; height: 1px; background: var(--stroke); margin: 2em 0; }
.md img { max-width: 100%; border-radius: 12px; }
.md .mermaid-box, .diagram-canvas, .graph-wrap .mermaid-box, #srcPreview .mermaid-box {
  display: flex; justify-content: center;
  background: #fff;
  border: 1px solid var(--stroke); border-radius: 14px;
  padding: 18px; margin: 1.1em 0; overflow-x: auto;
}
.md .mermaid-box svg, .diagram-canvas svg, .graph-wrap svg, #srcPreview svg { max-width: 100%; height: auto; flex: none; }
.mermaid-error {
  color: var(--err); font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap;
  background: rgba(185, 86, 86, 0.07); border: 1px solid rgba(185, 86, 86, 0.35);
  border-radius: 12px; padding: 12px 14px; margin: 1em 0;
}

/* empty state */
.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; padding: 40px;
}
.empty-icon { font-size: 56px; animation: float 3.5s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.empty-state h2 { font-size: 24px; font-weight: 800; }
.empty-state p { color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.empty-state code { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); padding: 2px 7px; border-radius: 7px; color: #7a4b44; }
.empty-actions { display: flex; gap: 12px; margin-top: 10px; flex-wrap: wrap; justify-content: center; }
.empty-state .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; }

/* schemes */
.diagram-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--stroke); flex-wrap: wrap;
}
.hint-inline { font-size: 11.5px; color: var(--text-faint); }
.diagram-list { flex: 1; overflow-y: auto; padding: 16px; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.diagram-card {
  border: 1px solid var(--stroke); border-radius: 14px;
  background: #fff; overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.diagram-card:hover { border-color: var(--stroke-strong); box-shadow: 0 12px 28px -18px rgba(60, 66, 76, 0.3); }
.diagram-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--stroke); background: rgba(0, 0, 0, 0.015);
  cursor: pointer; user-select: none;
}
.diagram-head:hover { background: rgba(0, 0, 0, 0.03); }
.file-tag {
  font-size: 10.5px; font-weight: 700; color: var(--accent-2);
  background: rgba(76, 138, 139, 0.09); border: 1px solid rgba(76, 138, 139, 0.3);
  padding: 2px 8px; border-radius: 999px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px;
}
.type-tag {
  font-size: 10px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border: 1px solid rgba(93, 127, 158, 0.3);
  padding: 2px 7px; border-radius: 999px; flex: none;
}
.diagram-title { font-size: 13px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.diagram-chevron { transition: transform 0.2s ease; color: var(--text-dim); }
.diagram-card.open .diagram-chevron { transform: rotate(180deg); }
.diagram-body { display: none; padding: 14px; }
.diagram-card.open .diagram-body { display: block; }
.diagram-canvas {
  display: flex; justify-content: center; background: #f7f6f2;
  border: 1px dashed var(--stroke); border-radius: 12px;
  padding: 14px; margin-top: 4px; overflow-x: auto; min-height: 60px;
}
.diagram-editor {
  width: 100%; min-height: 130px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55; color: #3a4150;
  background: #fbfaf7; border: 1px solid var(--stroke); border-radius: 12px;
  padding: 12px 14px; resize: vertical; outline: none; white-space: pre;
}
.diagram-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.editor-actions { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.editor-actions .btn.act-save { margin-left: auto; }
.diagram-err-inline { color: var(--err); font-family: var(--mono); font-size: 11.5px; margin-top: 8px; white-space: pre-wrap; }
.diagram-note { font-size: 11px; color: var(--text-faint); margin-top: 8px; }

/* graph / mindmap */
.graph-wrap { flex: 1; overflow: auto; padding: 20px; display: flex; align-items: flex-start; justify-content: center; }
.graph-node-hint { font-size: 12px; color: var(--text-dim); }
.graph-wrap .mermaid-box { min-width: 60%; }

/* source */
.source-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-bottom: 1px solid var(--stroke); flex-wrap: wrap;
}
.badge { font-size: 11px; font-weight: 700; color: var(--warn); padding: 3px 9px; border-radius: 999px; background: rgba(169, 121, 31, 0.10); border: 1px solid rgba(169, 121, 31, 0.35); }
.badge.hidden { display: none; }
.auto-render { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-dim); cursor: pointer; }
.auto-render input { accent-color: var(--accent); }
.src-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.src-split.preview-off { grid-template-columns: 1fr; }
#srcArea {
  width: 100%; height: 100%; min-height: 0; resize: none;
  font-family: var(--mono); font-size: 13px; line-height: 1.6; color: #3a4150;
  background: #fbfaf7; border: none; outline: none; padding: 18px 22px; white-space: pre;
}
#srcPreview { border-left: 1px solid var(--stroke); overflow: auto; }

/* modal */
.modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgba(50, 54, 62, 0.35); backdrop-filter: blur(4px);
}
.modal.hidden { display: none; }
.modal-card { width: 420px; max-width: 92vw; border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.modal-card h3 { font-size: 17px; margin-bottom: 8px; }
.modal-card p { font-size: 12.5px; color: var(--text-dim); margin: 10px 0 6px; }
.text-input {
  width: 100%; font-family: var(--mono); font-size: 13px; color: var(--text);
  background: #fff; border: 1px solid var(--stroke); border-radius: 10px;
  padding: 8px 12px; outline: none;
}
.text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* loading */
.loading { display: flex; align-items: center; gap: 10px; padding: 12px 16px; font-size: 13px; color: var(--text-dim); border-bottom: 1px solid var(--stroke); }
.loading.hidden { display: none; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(93, 127, 158, 0.2); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* update banner (PWA: нет кнопки обновления — показываем сами) */
.update-banner {
  position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 16px);
  z-index: 120;
  display: flex; align-items: center; gap: 12px;
  background: var(--glass-strong); backdrop-filter: blur(10px);
  border: 1px solid rgba(93, 127, 158, 0.45); border-radius: 14px;
  padding: 10px 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 24px);
}
.update-banner.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.ub-text { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
@media (max-width: 700px) { .update-banner { bottom: 12px; width: calc(100vw - 24px); justify-content: space-between; } }

/* toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  background: var(--glass-strong); backdrop-filter: blur(10px);
  border: 1px solid var(--stroke); border-radius: 12px;
  padding: 12px 18px; font-size: 13px; font-weight: 600; color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none; max-width: min(460px, calc(100vw - 40px));
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok { border-color: rgba(62, 142, 99, 0.45); }
.toast.err { border-color: rgba(185, 86, 86, 0.45); }

.hidden { display: none !important; }

/* ============================================================
   Адаптивность
   ============================================================ */
@media (max-width: 980px) {
  body { overflow: auto; }
  .topbar { flex-wrap: nowrap; }
  .actions { flex-wrap: nowrap; justify-content: flex-end; flex: none; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .sidebar { max-height: 300px; }
  .content { min-height: 72vh; }
  .src-split { grid-template-columns: 1fr; }
  #srcPreview { display: none; }
}

@media (max-width: 700px) {
  .topbar { padding: 8px 10px; gap: 6px; top: 4px; left: 8px; right: 8px; }
  .layout { margin: 82px 8px 16px; gap: 10px; height: auto; }
  .brand-text p { display: none; }           /* экономим место */
  .brand-text h1 { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .h1-sub { display: none; }                 /* название: только PleskovDEV */
  .logo { width: 30px; height: 30px; font-size: 16px; border-radius: 9px; }
  .brand { gap: 8px; }
  .home-btn { padding: 7px 10px; font-size: 12px; }
  #btnDocs { padding: 7px 10px; font-size: 12px; }
  .actions { flex: none; width: auto; }
  .root-pick { display: none; }              /* читателю не нужен выбор корня */
  .btn { padding: 7px 11px; font-size: 12.5px; }
  .sep, .live-dot { display: none; }
  .active-file { display: none; }            /* табам больше места */
  .tab { padding: 8px 12px; font-size: 12.5px; }
  .doc-meta { padding: 6px 16px; }
  .md { padding: 14px 14px 44px; font-size: 14px; }
  .md h1 { font-size: 20px; }
  .md h2 { font-size: 16.5px; }
  .md th, .md td { padding: 6px 8px; font-size: 12.5px; }
  .md pre { font-size: 12px; }
  .graph-wrap { padding: 12px; }
  .diagram-list { padding: 12px; }
  /* сайдбар — выдвижная панель поверх контента */
  .layout:not(.sidebar-open) .sidebar { display: flex; }  /* всегда flex внутри панели */
  .sidebar {
    position: fixed; top: 64px; bottom: 8px; left: 8px; z-index: 45;
    width: min(88vw, 360px); max-height: none; height: auto;
    display: flex; flex-direction: column;
    transform: translateX(-130%); transition: transform 0.25s ease;
    box-shadow: 0 20px 50px -20px rgba(60, 66, 76, 0.45);
  }
  .layout.sidebar-open .sidebar { transform: translateX(0); }
  /* диаграммы в натуральном размере — горизонтальный скролл, ничего не растягиваем */
  .md .mermaid-box, .diagram-canvas, #srcPreview .mermaid-box, .graph-wrap .mermaid-box {
    justify-content: flex-start;
  }
  .empty-state { padding: 24px 16px; }
  .modal-card { padding: 18px; }
  .toast { right: 10px; bottom: 10px; left: 10px; max-width: none; }
}