/* ===== MRCbook – GitBook-szerű dokumentációs felület ===== */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --bg-side: #f7f8fa;
  --bg-hover: #eef1f5;
  --bg-active: #e3ebf7;
  --border: #e4e7ec;
  --text: #1b2430;
  --text-2: #4b5563;
  --muted: #8a94a6;
  --primary: #1f3b63;
  --primary-2: #2d5a9a;
  --accent: #2f80ed;
  --danger: #c0392b;
  --ok: #1e8e5a;
  --warn: #b7791f;
  --bg-canvas: #f3f5f8;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(16, 24, 40, .12);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --sidebar-w: 300px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---- splash ---- */
.splash { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- gombok, mezők ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); cursor: pointer; font-weight: 500; font-size: 13.5px; line-height: 1.2; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--bg-hover); border-color: #d0d5dd; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fdecea; border-color: #f5c6c2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; border-radius: 8px; color: var(--text-2); font-size: 15px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 34px; min-height: 34px; }
.icon-btn .ic { display: block; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
  box-sizing: border-box; line-height: 20px; font-size: 14.5px;
}
input[type=text], input[type=password], input[type=search], input[type=email], input[type=number], input:not([type]), select { height: 38px; }
select { -webkit-appearance: none; appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; }
input[type=color] { height: 38px; padding: 2px 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); width: 100%; box-sizing: border-box; }
.btn { box-sizing: border-box; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,128,237,.15); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--text); }
label.check { display: block; position: relative; padding-left: 24px; line-height: 1.45; }   /* a szöveg (benne <b>) egy folyamban törjön */
label.check input { width: auto; margin: 0; position: absolute; left: 0; top: .2em; }
.pw-wrap { position: relative; display: block; margin-top: 4px; }
.pw-wrap > input[type=password], .pw-wrap > input[type=text] { margin-top: 0; padding-right: 38px; font-weight: 400; color: var(--text); }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; cursor: pointer; padding: 4px; border-radius: 6px; color: var(--muted); display: flex; align-items: center; }
.pw-eye:hover { color: var(--text); background: var(--bg-hover); }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.pill.draft { background: #fff4d6; color: #8a5a00; }
.pill.published { background: #dff5e8; color: #1e6b45; }
.pill.admin { background: #e3ebf7; color: var(--primary); padding: 2px 8px; width: auto; max-width: none; border: 0; border-radius: 999px; }
.pill.edit { background: #e8f1ff; color: #1b5cb8; }
.pill.read { background: #eef0f3; color: #4b5563; }
.pill.off { background: #fdecea; color: var(--danger); }
.kbd { font-family: var(--mono); font-size: 11px; background: #eef0f3; border: 1px solid #dde1e7; border-bottom-width: 2px; padding: 0 5px; border-radius: 4px; color: var(--text-2); }

/* ---- login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(160deg, #f3f6fb, #e8edf5); padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 32px 30px 26px; box-shadow: var(--shadow); }
.login-card .brand { margin-bottom: 4px; }
.login-card p { margin: 0 0 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 22px; color: var(--text); letter-spacing: -.01em; }
.brand .logo { width: 28px; height: 28px; display: block; flex: none; }
.brand .wm { font-weight: 800; letter-spacing: -.02em; color: var(--primary); }
.brand .wm em { font-style: normal; font-weight: 500; color: #E8A33D; }
.brand .logo .lg-bg { fill: #1E3A5F; } .brand .logo .lg-fg { fill: #fff; } .brand .logo .lg-ac { fill: #E8A33D; }
.theme-btn { font-size: 16px; }
.login-card .theme-btn { position: absolute; right: 14px; top: 14px; }
.login-card { position: relative; }
.brand.small { font-size: 17px; }
.brand.small { gap: 7px; }
.brand.small .logo { width: 22px; height: 22px; }
.brand:hover { text-decoration: none; }

/* ---- shell ---- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--bg-side); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; transition: margin-left .18s ease; }
.shell.collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w) - 2px); visibility: hidden; }
.sb-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 12px 10px 18px; }
.sb-expand { position: fixed; left: 12px; top: 11px; z-index: 60; display: none; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 1px 4px rgba(16,24,40,.08); }
.sb-expand:hover { background: var(--bg-hover); }
.shell.collapsed .sb-expand { display: inline-flex; }
.shell.collapsed .topbar { padding-left: 56px; }   /* hely a lebegő ☰ gombnak, ne csússzon a morzsasorra */
.space-switch { padding: 4px 14px 10px; }
.space-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; text-align: left; }
.space-btn:hover { border-color: #cfd6e0; }
.sp-icon.emoji { background: #eef1f5 !important; color: inherit; font-size: 18px; }
.card .sp-icon.emoji { font-size: 22px; }
.menu .mi .sp-icon.emoji { font-size: 14px; }
.space-btn .sp-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary); font-size: 13px; flex: 0 0 30px; }
.space-btn .sp-name { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.space-btn .sp-caret { color: var(--muted); }
.sb-search { padding: 0 14px 10px; }
.sb-search input { background: var(--surface); padding: 7px 10px; font-size: 13.5px; }
.page-tree { flex: 1; overflow: auto; padding: 6px 10px 12px; }
.page-tree ul { list-style: none; margin: 0; padding: 0; }
.page-tree ul ul { margin-left: 14px; padding-left: 8px; border-left: 1px solid #e1e5ea; }
.page-tree li { position: relative; }
.tree-row { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); font-size: 13.5px; user-select: none; line-height: 1.35; margin: 1px 0; }
.tree-row:hover { background: var(--bg-hover); color: var(--text); }
.tree-row.active { background: var(--bg-active); color: var(--primary); font-weight: 600; }
.tree-row .tw { order: 3; width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 6px; font-size: 11px; color: var(--muted); transition: transform .15s; }
.tree-row .tw:hover { background: #d9dfe8; color: var(--text); }
.tree-row .tw.open { transform: rotate(90deg); }
.tree-row .tw.leaf { visibility: hidden; }
.tree-row .tmore { order: 2; }
.tree-row .tt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .tdraft { flex: 0 0 auto; margin-left: 6px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 16px; background: #fff4d6; color: #8a5a00; }
[data-theme="dark"] .tree-row .tdraft { background: #4a3a10; color: #f2cf7a; }
.card .c-title .pill { vertical-align: 2px; margin-left: 4px; }
.tree-row .tmore { visibility: hidden; font-size: 14px; padding: 0 4px; color: var(--muted); border-radius: 4px; }
.tree-row:hover .tmore { visibility: visible; }
.tree-row .tmore:hover { background: #d9dfe8; color: var(--text); }
.page-tree li.collapsed > ul { display: none; }
.page-tree li.dragging > .tree-row { opacity: .45; }
.page-tree .tree-row.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.page-tree .tree-row.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.page-tree .tree-row.drop-inside { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tree-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--bg-side); z-index: 1; }
.tree-add { width: 22px; height: 22px; border-radius: 6px; border: 0; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; transition: background .12s, color .12s; }
.tree-add:hover { background: var(--bg-active); color: var(--primary); }
.tree-add .ic { display: block; }
.sb-bottom { border-top: 1px solid var(--border); padding: 8px 10px; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sb-bottom .icon-btn { font-size: 20px; padding: 6px; }
.sb-bottom .uname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 28px; }

/* ---- main ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 22px; border-bottom: 1px solid var(--border); min-height: 54px; background: var(--surface); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; overflow: hidden; white-space: nowrap; }
.crumbs a { color: var(--text-2); }
.crumbs .crumb-back { margin-right: 2px; }
.crumbs a.home { display: inline-flex; align-items: center; padding: 4px; border-radius: 6px; }
.crumbs a.home:hover { background: var(--bg-hover); color: var(--text); }
.crumbs a.home .ic { width: 20px; height: 20px; }
.crumbs .sep { color: #c3c9d3; }
.crumbs .cur { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.content { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; gap: 28px; padding: 28px 36px 60px; background: var(--bg-canvas); }
.article { flex: 0 1 920px; min-width: 0; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 48px 64px 72px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 12px 40px -18px rgba(16,24,40,.18); }
.article-wide { flex: 1 1 auto; max-width: 1400px; padding: 36px 40px 48px; }
.toc { width: 230px; flex: 0 0 230px; position: sticky; top: 0; font-size: 12.5px; padding: 6px 0 0 4px; }
.toc h5 { margin: 0 0 8px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.toc a { display: block; color: var(--text-2); padding: 3px 0 3px 10px; border-left: 2px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc a.l3 { padding-left: 22px; }
.toc a:hover, .toc a.on { color: var(--primary); border-left-color: var(--primary); text-decoration: none; }
@media (max-width: 1180px) { .toc { display: none; } }
@media (max-width: 1000px) { .article { padding: 32px 28px 48px; } .content { padding: 16px; } }

.page-title { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin: 0 0 8px; }
.page-title[contenteditable] { outline: none; border-bottom: 2px dashed transparent; }
.page-title[contenteditable]:focus { border-bottom-color: var(--border); }
.page-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 28px; padding-bottom: 18px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* tartalom megjelenítés (olvasó nézet) */
.doc { font-size: 15.5px; line-height: 1.75; color: var(--text); }
.doc img { display: block; margin: 8px 0 14px; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 2px 10px rgba(16,24,40,.08); max-width: 100%; height: auto; }
.doc > :first-child { margin-top: 0; }
.doc h1 { font-size: 26px; margin: 34px 0 10px; letter-spacing: -.01em; }
.doc h2 { font-size: 21px; margin: 30px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.doc h3 { font-size: 17.5px; margin: 24px 0 6px; }
.doc h4 { font-size: 15.5px; margin: 20px 0 4px; }
.doc p { margin: 0 0 14px; }
.doc ul, .doc ol { padding-left: 26px; margin: 0 0 14px; }
.doc li { margin: 3px 0; }
.doc li > p, .doc td > p, .doc th > p { margin: 0; }
.doc li.task-list-item { list-style: none; position: relative; }
.doc li.task-list-item::before { content: "☐"; position: absolute; left: -22px; color: var(--muted); }
.doc li.task-list-item.checked::before, .doc li.task-list-item[data-task-checked="true"]::before { content: "☑"; color: var(--ok); }
.doc blockquote { margin: 0 0 14px; padding: 8px 16px; border-left: 4px solid #c9d6ea; background: #f5f8fc; color: #3d4a5c; border-radius: 0 6px 6px 0; }
.doc pre { background: #0f172a; color: #e2e8f0; padding: 14px 16px; border-radius: 8px; overflow: auto; font-family: var(--mono); font-size: 13px; line-height: 1.55; margin: 0 0 16px; }
.doc pre code { background: transparent; padding: 0; color: inherit; }
.doc code { font-family: var(--mono); font-size: 13px; background: #eef1f5; padding: 1px 5px; border-radius: 4px; color: #b42318; }
.doc table { border-collapse: collapse; width: 100%; margin: 0 0 18px; font-size: 14px; }
.doc th, .doc td { border: 1px solid var(--border); padding: 7px 10px; vertical-align: top; text-align: left; }
.doc th { background: var(--bg-side); font-weight: 600; }
.doc tr:nth-child(even) td { background: #fbfcfd; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 26px 0; }
.doc a { text-decoration: underline; text-decoration-color: #b9d3f5; text-underline-offset: 2px; }
.doc del { color: var(--muted); }
.doc .mb-anchor { opacity: 0; margin-left: 6px; font-size: .8em; color: var(--muted); }
.doc h1:hover .mb-anchor, .doc h2:hover .mb-anchor, .doc h3:hover .mb-anchor { opacity: 1; }

/* szerkesztő */
.editor-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.editor-bar .status { font-size: 12.5px; color: var(--muted); margin-left: 4px; }
.editor-bar .status.dirty { color: var(--warn); }
.editor-bar .status.saved { color: var(--ok); }
.editor-host { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.toastui-editor-defaultUI { border: 0 !important; }
.toastui-editor-contents { font-family: var(--font) !important; font-size: 15px !important; }
.toastui-editor-contents pre { font-family: var(--mono); }
.toastui-editor-contents table th, .toastui-editor-contents table td { padding: 6px 10px !important; }

/* home / dashboard */
.home { padding: 44px 56px 60px; max-width: 1500px; width: 100%; }
.home h1 { font-size: 28px; margin: 0 0 4px; letter-spacing: -.02em; }
.home .lead { color: var(--text-2); margin: 0 0 26px; }
.home-wrap { width: 100%; display: flex; justify-content: center; }
.recent { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; background: var(--surface); min-height: 118px; cursor: pointer; transition: box-shadow .15s, transform .15s; display: flex; gap: 12px; align-items: flex-start; }
.card:hover { box-shadow: 0 6px 20px rgba(16,24,40,.08); transform: translateY(-1px); text-decoration: none; }
.card .sp-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; background: var(--primary); font-size: 15px; flex: 0 0 40px; }
.card .c-title { font-weight: 600; color: var(--text); }
.card .c-desc { color: var(--muted); font-size: 13px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .c-foot { color: var(--muted); font-size: 12px; margin-top: 8px; }
.section-h { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 12px; }
.section-h h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.recent li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.recent ul { list-style: none; padding: 0; margin: 0; }
.recent .r-sp { color: var(--muted); min-width: 120px; }
.recent .r-t { flex: 1; }
.recent .r-d { color: var(--muted); font-size: 12px; }

/* keresés */
.search-res { padding: 36px 48px; max-width: 900px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.search-res .hit { padding: 12px 0; border-bottom: 1px solid var(--border); }
.search-res .hit .h-t { font-weight: 600; }
.search-res .hit .h-s { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.search-res .hit .h-p { color: var(--muted); font-size: 12px; }
mark { background: #fff1a8; padding: 0 1px; border-radius: 2px; }

/* dropdown menü */
.menu { position: fixed; z-index: 100; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); min-width: 210px; padding: 6px; font-size: 13.5px; max-height: calc(100vh - 24px); overflow: auto; }
.menu .mfilter { padding: 4px 4px 6px; position: sticky; top: -6px; background: var(--surface); z-index: 1; }
.menu .mfilter input { padding: 6px 9px; font-size: 13px; }
.menu .mi { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.menu .mi:hover { background: var(--bg-hover); }
.menu .mi.danger { color: var(--danger); }
.menu .mi .k { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.menu .sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu .mh { padding: 5px 10px 3px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.menu .mi.cur { background: var(--bg-active); color: var(--primary); font-weight: 600; }
.menu .mi .sp-icon { width: 22px; height: 22px; border-radius: 6px; font-size: 10.5px; display: grid; place-items: center; color: #fff; background: var(--primary); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(16,24,40,.45); z-index: 200; display: grid; place-items: center; padding: 20px; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal.lg { max-width: 860px; }
.modal .m-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 16px; }
.modal .m-body { padding: 18px 20px; }
.modal .m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
.modal .m-foot .left { margin-right: auto; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
table.list { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.list th, table.list td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; }
table.list tr:hover td { background: #fafbfc; }
table.list td.act { white-space: nowrap; text-align: right; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #1b2430; color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 13.5px; box-shadow: var(--shadow); animation: fadein .2s; max-width: 380px; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); }
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* admin oldalak */
.admin { padding: 36px 48px; max-width: 1200px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.admin h1 { font-size: 24px; margin: 0 0 16px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tabs a { padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); text-decoration: none; }
.perm-grid { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; align-items: center; }
.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.version-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.version-row .v-no { font-weight: 700; width: 44px; }
.version-row .v-meta { flex: 1; color: var(--text-2); }
.diffview { border: 1px solid var(--border); border-radius: 8px; padding: 14px; max-height: 50vh; overflow: auto; background: #fafbfc; }

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 50; height: 100vh; }
  .article { padding: 24px 20px 60px; }
  .home, .admin, .search-res { padding: 24px 20px; }
}
@media print {
  .sidebar, .topbar, .toc, .sb-expand { display: none !important; }
  .content { overflow: visible; }
}

/* előző / következő oldal */
.pagenav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.pagenav a { display: block; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: var(--text); transition: border-color .12s, box-shadow .12s; }
.pagenav a:hover { text-decoration: none; border-color: #c9d2de; box-shadow: 0 6px 18px rgba(16,24,40,.08); }
.pagenav a.next { text-align: right; grid-column: 2; }
.pagenav a.prev { grid-column: 1; }
.pagenav .pn-l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.pagenav .pn-t { font-weight: 600; margin-top: 2px; }
.pagenav .pn-t::before { content: "‹ "; color: var(--muted); }
.pagenav a.next .pn-t::before { content: ""; }
.pagenav a.next .pn-t::after { content: " ›"; color: var(--muted); }
.page-foot { margin-top: 36px; color: var(--muted); font-size: 12.5px; }

.home-filter { margin: -6px 0 18px; display: flex; gap: 10px; align-items: center; }
.home-filter input { max-width: 420px; }
.home-filter .btn { height: 38px; white-space: nowrap; }
.grp-h { font-size: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); margin: 26px 0 12px; }
.grp-sec:first-child .grp-h { margin-top: 0; }
.perm-grp { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.perm-grid > select[data-grp] { margin-top: 10px; border-top: 0; }
.modal .perm-grid { max-height: 60vh; overflow: auto; padding-right: 4px; }

/* ===== Sötét mód ===== */
:root[data-theme="dark"] {
  --bg: #0f141b; --surface: #171d26; --bg-side: #131920; --bg-hover: #1f2733; --bg-active: #1e3350; --border: #2a3342;
  --text: #e6eaf0; --text-2: #b6bfcb; --muted: #8391a3; --primary: #2d5a9a; --primary-2: #3a6fb8; --accent: #7db0ff;
  --danger: #f0776a; --ok: #4cc38a; --warn: #e2b25c; --bg-canvas: #0b0f15; --shadow: 0 8px 30px rgba(0,0,0,.55);
  color-scheme: dark;
}
[data-theme="dark"] .brand .logo .lg-bg { fill: #fff; } [data-theme="dark"] .brand .logo .lg-fg { fill: #1E3A5F; }
[data-theme="dark"] .brand .wm { color: #fff; }
[data-theme="dark"] .login-wrap { background: linear-gradient(160deg, #111822, #0b0f15); }
[data-theme="dark"] .tree-row.active, [data-theme="dark"] .tabs a.on, [data-theme="dark"] .toc a:hover, [data-theme="dark"] .toc a.on, [data-theme="dark"] .menu .mi.cur { color: #9ec1ef; }
[data-theme="dark"] .tabs a.on { border-bottom-color: #9ec1ef; }
[data-theme="dark"] .toc a:hover, [data-theme="dark"] .toc a.on { border-left-color: #9ec1ef; }
[data-theme="dark"] .btn:hover { border-color: #3a4556; }
[data-theme="dark"] .btn.danger:hover { background: #3a1d1b; border-color: #5a2c28; }
[data-theme="dark"] .space-btn:hover, [data-theme="dark"] .pagenav a:hover { border-color: #3a4556; }
[data-theme="dark"] .tree-row .tw:hover, [data-theme="dark"] .tree-row .tmore:hover { background: #2a3444; }
[data-theme="dark"] .page-tree ul ul { border-left-color: var(--border); }
[data-theme="dark"] .crumbs .sep { color: #4a5565; }
[data-theme="dark"] .pill.draft { background: #4a3a10; color: #f2cf7a; }
[data-theme="dark"] .pill.published { background: #123b2a; color: #6fdba6; }
[data-theme="dark"] .pill.admin { background: #1e3350; color: #9ec1ef; }
[data-theme="dark"] .pill.edit { background: #1b3a66; color: #9ec1ef; }
[data-theme="dark"] .pill.read { background: #2a3240; color: #c0c8d4; }
[data-theme="dark"] .pill.off { background: #4a1f1c; color: #f3a097; }
[data-theme="dark"] .kbd { background: #222a36; border-color: #353f4e; }
[data-theme="dark"] .sp-icon.emoji { background: #222a36 !important; }
[data-theme="dark"] .doc blockquote { background: #1a2230; border-left-color: #35507a; color: #c5cfdc; }
[data-theme="dark"] .doc code { background: #222a36; color: #ff9d94; }
[data-theme="dark"] .doc tr:nth-child(even) td, [data-theme="dark"] table.list tr:hover td { background: #1b222c; }
[data-theme="dark"] .doc a { text-decoration-color: #3b5f8f; }
[data-theme="dark"] mark { background: #7a6300; color: #fff; }
[data-theme="dark"] .modal-bg { background: rgba(0,0,0,.62); }
[data-theme="dark"] .toast { background: #2a3240; }
[data-theme="dark"] .diffview { background: var(--bg-side); }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus, [data-theme="dark"] textarea:focus { box-shadow: 0 0 0 3px rgba(125,176,255,.22); }
/* TOAST UI szerkesztő sötétben */
[data-theme="dark"] .toastui-editor-defaultUI, [data-theme="dark"] .toastui-editor-defaultUI-toolbar, [data-theme="dark"] .toastui-editor-md-container,
[data-theme="dark"] .toastui-editor-ww-container, [data-theme="dark"] .toastui-editor-md-preview, [data-theme="dark"] .toastui-editor-mode-switch,
[data-theme="dark"] .toastui-editor-defaultUI .ProseMirror, [data-theme="dark"] .toastui-editor-md-splitter, [data-theme="dark"] .toastui-editor-popup,
[data-theme="dark"] .toastui-editor-md-tab-container, [data-theme="dark"] .toastui-editor-defaultUI .toastui-editor-tabs .tab-item { background: var(--surface) !important; color: var(--text) !important; }
[data-theme="dark"] .toastui-editor-defaultUI-toolbar, [data-theme="dark"] .toastui-editor-mode-switch, [data-theme="dark"] .toastui-editor-popup, [data-theme="dark"] .toastui-editor-md-tab-container { border-color: var(--border) !important; }
[data-theme="dark"] .toastui-editor-toolbar-icons, [data-theme="dark"] .toastui-editor-toolbar-divider { filter: invert(.82); }
[data-theme="dark"] .toastui-editor-toolbar-icons:hover, [data-theme="dark"] .toastui-editor-toolbar-icons.active { background-color: #d8dee8 !important; }
[data-theme="dark"] .toastui-editor-mode-switch .tab-item { color: var(--text-2) !important; border-color: var(--border) !important; background: var(--bg-side) !important; }
[data-theme="dark"] .toastui-editor-mode-switch .tab-item.active { background: var(--surface) !important; color: var(--text) !important; }
[data-theme="dark"] .toastui-editor-contents, [data-theme="dark"] .toastui-editor-contents h1, [data-theme="dark"] .toastui-editor-contents h2, [data-theme="dark"] .toastui-editor-contents h3,
[data-theme="dark"] .toastui-editor-contents h4, [data-theme="dark"] .toastui-editor-contents h5, [data-theme="dark"] .toastui-editor-contents h6, [data-theme="dark"] .toastui-editor-contents p,
[data-theme="dark"] .toastui-editor-contents li, [data-theme="dark"] .toastui-editor-contents td, [data-theme="dark"] .toastui-editor-contents th, [data-theme="dark"] .toastui-editor-md-container .toastui-editor { color: var(--text) !important; }
[data-theme="dark"] .toastui-editor-contents h1, [data-theme="dark"] .toastui-editor-contents h2, [data-theme="dark"] .toastui-editor-contents th, [data-theme="dark"] .toastui-editor-contents td { border-color: var(--border) !important; }
[data-theme="dark"] .toastui-editor-contents th { background: var(--bg-side) !important; }
[data-theme="dark"] .toastui-editor-contents code { background: #222a36 !important; color: #ff9d94 !important; }
[data-theme="dark"] .toastui-editor-contents pre, [data-theme="dark"] .toastui-editor-md-code-block { background: #0f172a !important; color: #e2e8f0 !important; }
[data-theme="dark"] .toastui-editor-contents blockquote { border-left-color: #35507a !important; color: #c5cfdc !important; }
[data-theme="dark"] .toastui-editor-popup .toastui-editor-popup-body input, [data-theme="dark"] .toastui-editor-popup .toastui-editor-popup-body textarea { background: var(--bg-side) !important; color: var(--text) !important; border-color: var(--border) !important; }
[data-theme="dark"] .toastui-editor-md-code-block-line-background, [data-theme="dark"] .toastui-editor-md-preview-highlight::after { background: #1e2a3d !important; }


/* ===== API kulcsok / integráció ===== */
.keybox { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.keybox code { flex: 1; display: block; padding: 8px 10px; background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px; word-break: break-all; white-space: pre-wrap; user-select: all; }
.howto h3 { font-size: 15px; margin: 18px 0 6px; }
.howto pre { background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 12.5px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.howto ol, .howto ul { padding-left: 20px; }
.howto li { margin: 4px 0; }
.keybox code, .howto pre { font-family: var(--mono); }

/* ===== kétlépcsős azonosítás ===== */
.tfa-steps { padding-left: 20px; margin: 0 0 12px; }
.tfa-steps li { margin: 4px 0; }
.tfa-qr { display: flex; justify-content: center; margin: 8px 0; }
.tfa-qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); }
.tfa-secret { font-family: var(--mono); letter-spacing: .05em; user-select: all; }
.tfa-codes { font-family: var(--mono); font-size: 15px; line-height: 1.7; background: var(--bg-side); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; columns: 2; user-select: all; }
.card2fa { border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; background: var(--bg-side); }

/* ===== AI asszisztens panel ===== */
.main.with-ai { display: grid; grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: auto minmax(0, 1fr); }
.main.with-ai > .topbar { grid-column: 1 / 3; }
.main.with-ai > .content { grid-column: 1; grid-row: 2; min-height: 0; }
.ai-panel { grid-column: 2; grid-row: 2; min-height: 0; border-left: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.ai-head .muted { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-body { padding: 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.ai-scope { display: flex; gap: 14px; }
.ai-scope label { margin: 0; }
.ai-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ai-act { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 7px 9px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.ai-act b { font-size: 13px; font-weight: 600; }
.ai-act span { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.ai-act:hover { background: var(--bg-hover); }
.ai-act.on { border-color: var(--accent); background: var(--bg-active); }
.ai-body label { margin-bottom: 0; }
.ai-body textarea { resize: vertical; min-height: 44px; }
.ai-result { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ai-result-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; background: var(--bg-side); font-size: 13px; }
.ai-preview { padding: 10px 12px; max-height: 40vh; overflow: auto; font-size: 13.5px; white-space: pre-wrap; }
.ai-preview .toastui-editor-contents { font-size: 13.5px; }
.ai-result-foot { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@media (max-width: 1100px) { .main.with-ai { grid-template-columns: minmax(0, 1fr) 320px; } }

/* ===== megosztás / nyilvános ===== */
.tpub { display: inline-flex; color: var(--accent); margin-left: 4px; opacity: .8; }
.tpub .ic { width: 13px; height: 13px; }
.sh-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.sh-row .sp { flex: 1; }
.sh-row select { width: 140px; }

/* ===== lábléc / copyright ===== */
.sb-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--muted); background: var(--bg-side); }
.sb-foot .co-logo { height: 14px; width: auto; object-fit: contain; border-radius: 3px; flex: 0 0 auto; }
.sb-foot span { line-height: 1.3; }
.login-foot { justify-content: center; border-top: 1px solid var(--border); margin-top: 18px; padding-top: 14px; background: transparent; gap: 10px; }
.login-foot .co-logo { height: 18px; border-radius: 4px; }
[data-theme="dark"] .sb-foot .co-logo, [data-theme="dark"] .login-foot .co-logo { box-shadow: 0 0 0 1px rgba(255,255,255,.12); }
/* halvány madár-vízjel a bejelentkező kártyán */
.login-card { position: relative; overflow: hidden; }
.login-card::after { content: ""; position: absolute; right: -30px; bottom: 28px; width: 260px; height: 238px; background: url("img/login-watermark.png") no-repeat center / contain; opacity: .18; pointer-events: none; }
[data-theme="dark"] .login-card::after { opacity: .12; filter: invert(1); }
.login-card > * { position: relative; z-index: 1; }

.mb-hl { background: #fff3a0; transition: background .6s; border-radius: 4px; }

/* kezdőoldal: csempék drag & drop rendezése */
.sort-hint { color: var(--muted); font-size: 12.5px; margin: -8px 0 14px; }
#spaceGrid .card[draggable="true"] { cursor: grab; }
#spaceGrid.sorting .card { transition: none; }
#spaceGrid.sorting .card:hover { transform: none; box-shadow: none; }
#spaceGrid .card.dragging { opacity: .35; outline: 2px dashed var(--accent); outline-offset: -2px; box-shadow: none; transform: none; }
#spaceGrid.sorting .grp-sec { border-radius: 12px; transition: background .12s; }
#spaceGrid.sorting .grp-sec.over { background: color-mix(in srgb, var(--accent) 6%, transparent); }
#spaceGrid .grp-sec.drop-target { border: 2px dashed var(--border); border-radius: 12px; padding: 0 12px 12px; margin-top: 18px; }
#spaceGrid .grp-sec.drop-target .grp-h { margin: 12px 0 8px; color: var(--muted); }
#spaceGrid .grp-sec.drop-target .grid { min-height: 90px; }
#spaceGrid .grp-sec.drop-target.over { border-color: var(--accent); }
#spaceGrid.saving { opacity: .7; pointer-events: none; }

/* space-választó: hangsúlyos csoportnév, beljebb húzott space-ek */
.menu .mh.grp { font-size: 12px; font-weight: 700; color: var(--text); letter-spacing: .06em; padding: 12px 10px 5px; margin-top: 4px; border-top: 1px solid var(--border); }
.menu .mfilter + .mh.grp, .menu > .mh.grp:first-child { border-top: 0; margin-top: 0; padding-top: 6px; }
.menu .mi.ind { padding-left: 26px; }

/* vázlat kiemelése a csempéken */
.card .c-foot .pill.draft, .card .c-title .pill.draft { font-size: 11.5px; padding: 2px 9px; background: #ffe7a3; color: #7a4d00; border: 1px solid #f0c24b; }
.card.all-draft { border: 1.5px dashed #e0a800; background: color-mix(in srgb, #fff4d6 35%, var(--surface)); }
[data-theme="dark"] .card .c-foot .pill.draft, [data-theme="dark"] .card .c-title .pill.draft { background: #5a4510; color: #ffd978; border-color: #8a6a1a; }
[data-theme="dark"] .card.all-draft { border-color: #8a6a1a; background: color-mix(in srgb, #4a3a10 30%, var(--surface)); }
.tree-row .tdraft { background: #ffe7a3; color: #7a4d00; border: 1px solid #f0c24b; }

/* space-választó: összecsukható csoportok, csak vázlat szűrő */
.menu .mfilter .mtools { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mchip { display: inline-flex !important; align-items: center; gap: 6px; padding: 3px 10px 3px 8px !important; border: 1px solid #f0c24b; background: #fff4d6; color: #7a4d00; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; margin: 0; }
.mchip input { position: static !important; width: auto; margin: 0; }
[data-theme="dark"] .mchip { background: #4a3a10; color: #f2cf7a; border-color: #8a6a1a; }
.menu .mtoggle-all { margin-left: auto; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 6px; font-size: 12px; padding: 3px 8px; cursor: pointer; }
.menu .mtoggle-all:disabled { opacity: .45; cursor: default; }
.menu .mh.grp[data-grp] { cursor: pointer; display: flex; align-items: center; gap: 6px; user-select: none; }
.menu .mh.grp[data-grp]:hover { background: var(--bg-hover); border-radius: 6px; }
.menu .mh .mcaret { display: inline-block; width: 14px; font-size: 13px; line-height: 1; color: var(--text-2); transition: transform .12s; }
.menu .mh.grp.collapsed { padding-top: 8px; padding-bottom: 8px; margin-top: 0; }
.menu .mh.collapsed .mcaret { transform: rotate(-90deg); }
.menu .mh .mcount { margin-left: auto; font-weight: 600; font-size: 11px; color: var(--muted); letter-spacing: 0; }
.menu .mi .k.kdraft { color: #8a5a00; background: #fff4d6; border: 1px solid #f0c24b; border-radius: 999px; padding: 0 7px; font-weight: 600; }
[data-theme="dark"] .menu .mi .k.kdraft { background: #4a3a10; color: #f2cf7a; border-color: #8a6a1a; }
.home-filter .mchip { height: 38px; padding: 0 12px !important; }
