:root {
  --bg: #ffffff;
  --sidebar: #f7f7f5;
  --hover: rgba(55, 53, 47, 0.06);
  --active: rgba(55, 53, 47, 0.1);
  --text: #37352f;
  --muted: rgba(55, 53, 47, 0.62);
  --faint: rgba(55, 53, 47, 0.38);
  --border: rgba(55, 53, 47, 0.12);
  --accent: #2383e2;
  --danger: #eb5757;
  --shadow: 0 0 0 1px rgba(15, 15, 15, 0.05), 0 3px 6px rgba(15, 15, 15, 0.1), 0 9px 24px rgba(15, 15, 15, 0.2);
  --code: rgba(135, 131, 120, 0.15);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Segoe UI Emoji";
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  --c-gray: #e3e2e0; --c-brown: #eee0da; --c-orange: #fadec9; --c-yellow: #fdecc8; --c-green: #dbeddb;
  --c-blue: #d3e5ef; --c-purple: #e8deee; --c-pink: #f5e0e9; --c-red: #ffe2dd;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #191919; --sidebar: #202020; --hover: rgba(255, 255, 255, 0.055); --active: rgba(255, 255, 255, 0.1);
    --text: rgba(255, 255, 255, 0.86); --muted: rgba(255, 255, 255, 0.55); --faint: rgba(255, 255, 255, 0.3);
    --border: rgba(255, 255, 255, 0.1); --code: rgba(255, 255, 255, 0.08);
    --shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 3px 6px rgba(0, 0, 0, 0.4), 0 9px 24px rgba(0, 0, 0, 0.5);
    --c-gray: #373737; --c-brown: #4a3a32; --c-orange: #5c3b23; --c-yellow: #564328; --c-green: #243d30;
    --c-blue: #143a4e; --c-purple: #3c2d49; --c-pink: #4e2c3c; --c-red: #522e2a;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[contenteditable] { outline: none; }
[contenteditable]:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 260px; flex-shrink: 0; background: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--border); user-select: none; transition: margin .2s; }
.sidebar.collapsed { margin-left: -260px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 45px; display: flex; align-items: center; padding: 0 12px; gap: 6px; flex-shrink: 0; }
.crumbs { display: flex; align-items: center; gap: 2px; min-width: 0; flex: 1; overflow: hidden; }
.crumb { padding: 2px 6px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; cursor: pointer; }
.crumb:hover { background: var(--hover); }
.crumb-sep { color: var(--faint); }
.scroller { flex: 1; overflow-y: auto; position: relative; }

.ws-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 600; }
.ws-logo { width: 22px; height: 22px; border-radius: 4px; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 12px; }
.ws-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item { display: flex; align-items: center; gap: 8px; padding: 4px 14px; min-height: 28px; color: var(--muted); cursor: pointer; font-weight: 500; }
.side-item:hover { background: var(--hover); }
.side-item .ico { width: 18px; text-align: center; }
.side-section { padding: 14px 14px 4px; font-size: 12px; color: var(--faint); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.side-section button { opacity: 0; padding: 0 4px; border-radius: 3px; font-size: 16px; color: var(--muted); }
.side-section:hover button { opacity: 1; }
.side-section button:hover { background: var(--active); }
.tree { overflow-y: auto; flex: 1; padding-bottom: 12px; }
.tree-row { display: flex; align-items: center; height: 28px; padding-right: 6px; cursor: pointer; color: var(--muted); border-radius: 0; position: relative; }
.tree-row:hover { background: var(--hover); }
.tree-row.active { background: var(--active); color: var(--text); font-weight: 500; }
.tree-row.drop-in { box-shadow: inset 0 0 0 2px var(--accent); }
.tree-toggle { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 3px; color: var(--faint); flex-shrink: 0; font-size: 10px; transition: transform .1s; }
.tree-toggle:hover { background: var(--active); }
.tree-toggle.open { transform: rotate(90deg); }
.tree-icon { width: 20px; text-align: center; flex-shrink: 0; }
.tree-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.tree-actions { display: none; gap: 2px; }
.tree-row:hover .tree-actions { display: flex; }
.tree-actions button { width: 20px; height: 20px; border-radius: 3px; color: var(--muted); display: grid; place-items: center; }
.tree-actions button:hover { background: var(--active); }
.tree-empty { color: var(--faint); height: 28px; display: flex; align-items: center; font-size: 13px; }
.side-foot { border-top: 1px solid var(--border); padding: 6px 0; }

.icon-btn { height: 28px; min-width: 28px; padding: 0 8px; border-radius: 4px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.on { color: #e9b200; }

/* ---------- page ---------- */
.page { max-width: 900px; margin: 0 auto; padding: 0 96px 30vh; }
.page.full { max-width: none; padding: 0 64px 30vh; }
.cover { height: 200px; position: relative; }
.cover-actions { position: absolute; right: 12px; bottom: 10px; display: none; gap: 4px; }
.cover:hover .cover-actions { display: flex; }
.cover-actions button { background: var(--bg); padding: 4px 8px; border-radius: 4px; font-size: 12px; color: var(--muted); box-shadow: var(--shadow); }
.page-head { padding-top: 64px; position: relative; }
.has-cover .page-head { padding-top: 0; }
.page-icon { font-size: 72px; line-height: 1; cursor: pointer; display: inline-block; border-radius: 6px; padding: 4px; margin-left: -4px; }
.has-cover .page-icon { margin-top: -42px; position: relative; }
.page-icon:hover { background: var(--hover); }
.page-meta-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; margin: 8px 0 4px -6px; height: 28px; }
.page-head:hover .page-meta-actions { opacity: 1; }
.page-title { font-size: 40px; font-weight: 700; line-height: 1.2; padding: 3px 2px; margin-bottom: 8px; word-break: break-word; }
.page-info { color: var(--faint); font-size: 12px; margin: 0 2px 16px; }
.trash-banner { background: var(--danger); color: white; padding: 8px; text-align: center; display: flex; gap: 12px; justify-content: center; align-items: center; }
.trash-banner button { border: 1px solid rgba(255,255,255,.6); padding: 2px 10px; border-radius: 4px; }

/* ---------- blocks ---------- */
.editor { padding-bottom: 40px; }
.block { position: relative; display: flex; align-items: flex-start; margin: 1px 0; border-radius: 3px; }
.block.dragging { opacity: .4; }
.block.drop-above::before, .block.drop-below::after { content: ""; position: absolute; left: 0; right: 0; height: 3px; background: var(--accent); opacity: .6; border-radius: 2px; }
.block.drop-above::before { top: -2px; }
.block.drop-below::after { bottom: -2px; }
.block.selected { background: rgba(35, 131, 226, .14); }
.handle { position: absolute; left: -48px; top: 3px; display: flex; opacity: 0; transition: opacity .1s; }
.block:hover > .handle { opacity: 1; }
.handle button { width: 22px; height: 24px; border-radius: 3px; color: var(--faint); font-size: 15px; display: grid; place-items: center; }
.handle button:hover { background: var(--hover); }
.handle .drag { cursor: grab; font-size: 13px; letter-spacing: -2px; }
.h1 .handle, .h2 .handle { top: 12px; }
.bc { flex: 1; min-width: 0; padding: 3px 2px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.bc code, .db-cell code { background: var(--code); color: #eb5757; padding: 0.2em 0.4em; border-radius: 4px; font-family: var(--mono); font-size: 85%; }
.bc a { color: inherit; text-decoration: underline; text-decoration-color: var(--faint); }
.bc mark { background: var(--c-yellow); color: inherit; }
.block.h1 { margin-top: 1.4em; } .block.h1 .bc { font-size: 1.875em; font-weight: 600; line-height: 1.3; }
.block.h2 { margin-top: 1.1em; } .block.h2 .bc { font-size: 1.5em; font-weight: 600; line-height: 1.3; }
.block.h3 { margin-top: .8em; } .block.h3 .bc { font-size: 1.25em; font-weight: 600; line-height: 1.3; }
.marker { width: 24px; flex-shrink: 0; text-align: center; padding-top: 3px; line-height: 1.5; user-select: none; }
.bulleted .marker::before { content: "•"; font-size: 1.4em; line-height: 1; }
.numbered .marker { font-variant-numeric: tabular-nums; }
.todo .marker input { width: 16px; height: 16px; margin: 3px 0 0; cursor: pointer; accent-color: var(--accent); }
.todo.checked .bc { text-decoration: line-through; color: var(--faint); }
.quote .bc { border-left: 3px solid currentColor; padding-left: 14px; font-size: 1.1em; }
.callout { background: var(--c-gray); border-radius: 4px; padding: 12px 12px 12px 10px; margin: 4px 0; }
.callout .emoji { font-size: 20px; padding: 0 8px 0 4px; cursor: pointer; line-height: 1.2; }
.callout .handle { left: -48px; }
.divider-wrap { flex: 1; padding: 10px 0; cursor: pointer; }
.divider-wrap hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
.code-wrap { flex: 1; background: var(--code); border-radius: 4px; position: relative; margin: 4px 0; }
.code-wrap pre { margin: 0; padding: 32px 18px 18px; font-family: var(--mono); font-size: 13px; line-height: 1.5; white-space: pre-wrap; tab-size: 2; }
.code-lang { position: absolute; top: 6px; left: 10px; font-size: 12px; color: var(--muted); background: transparent; border: 0; }
.code-copy { position: absolute; top: 6px; right: 8px; font-size: 12px; color: var(--muted); padding: 2px 6px; border-radius: 3px; }
.code-copy:hover { background: var(--hover); }
.toggle-wrap { flex: 1; }
.toggle-head { display: flex; align-items: flex-start; }
.toggle-arrow { width: 24px; height: 27px; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; font-size: 11px; transition: transform .1s; }
.toggle-arrow.open { transform: rotate(90deg); }
.toggle-body { margin-left: 24px; padding: 3px 2px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }
.image-wrap { flex: 1; margin: 6px 0; }
.image-wrap img { max-width: 100%; border-radius: 4px; display: block; }
.image-wrap .caption { color: var(--muted); font-size: 13px; padding: 6px 2px; }
.image-empty { background: var(--hover); padding: 14px; border-radius: 4px; display: flex; gap: 8px; color: var(--muted); }
.image-empty input { flex: 1; border: 1px solid var(--border); background: var(--bg); padding: 4px 8px; border-radius: 4px; }
.page-link { flex: 1; display: flex; align-items: center; gap: 6px; padding: 3px 2px; cursor: pointer; border-radius: 3px; text-decoration: underline; text-decoration-color: var(--faint); font-weight: 500; }
.page-link:hover { background: var(--hover); }
.editor-tail { min-height: 120px; cursor: text; }

/* ---------- menus & popovers ---------- */
.pop { position: fixed; z-index: 1000; background: var(--bg); border-radius: 6px; box-shadow: var(--shadow); padding: 6px 0; min-width: 220px; max-height: 60vh; overflow-y: auto; }
.pop-label { padding: 6px 14px 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.pop-item { display: flex; align-items: center; gap: 10px; padding: 0 14px; min-height: 30px; cursor: pointer; margin: 0 4px; border-radius: 4px; }
.pop-item.big { min-height: 46px; }
.pop-item.sel, .pop-item:hover { background: var(--hover); }
.pop-item .pi { width: 22px; text-align: center; color: var(--muted); }
.pop-item.big .pi { width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 4px; display: grid; place-items: center; font-size: 18px; background: var(--bg); color: var(--text); }
.pop-item small { display: block; color: var(--muted); font-size: 12px; }
.pop-item.danger { color: var(--danger); }
.pop-item .kbd { margin-left: auto; color: var(--faint); font-size: 12px; }
.pop-sep { height: 1px; background: var(--border); margin: 4px 0; }
.pop input.pop-input { margin: 4px 10px 6px; width: calc(100% - 20px); padding: 5px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--hover); }
.emoji-grid { display: grid; grid-template-columns: repeat(10, 32px); gap: 2px; padding: 6px 10px; }
.emoji-grid button { font-size: 20px; height: 32px; border-radius: 4px; }
.emoji-grid button:hover { background: var(--hover); }
.format-bar { position: fixed; z-index: 1001; background: var(--bg); box-shadow: var(--shadow); border-radius: 6px; display: flex; padding: 2px; }
.format-bar button { min-width: 30px; height: 30px; border-radius: 4px; padding: 0 6px; }
.format-bar button:hover { background: var(--hover); }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 15, 15, 0.45); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.modal { background: var(--bg); border-radius: 10px; box-shadow: var(--shadow); width: min(680px, 92vw); max-height: 80vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.wide { width: min(900px, 94vw); height: 75vh; flex-direction: row; }
.search-input { border: 0; border-bottom: 1px solid var(--border); padding: 16px 18px; font-size: 17px; background: transparent; outline: none; }
.search-results { overflow-y: auto; padding: 6px 0; }
.sr { display: flex; gap: 10px; padding: 8px 18px; cursor: pointer; align-items: flex-start; }
.sr.sel, .sr:hover { background: var(--hover); }
.sr .sr-title { font-weight: 500; }
.sr .sr-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 560px; }
.empty-note { color: var(--muted); padding: 18px; text-align: center; }

.settings-nav { width: 220px; background: var(--sidebar); padding: 12px 0; flex-shrink: 0; }
.settings-nav .side-item.active { background: var(--active); color: var(--text); }
.settings-body { flex: 1; overflow-y: auto; padding: 28px 40px; }
.settings-body h2 { font-size: 16px; font-weight: 600; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.settings-body h3 { font-size: 14px; margin: 24px 0 8px; }
.settings-body p { color: var(--muted); line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.field label { font-size: 12px; color: var(--muted); }
.input { border: 1px solid var(--border); background: var(--hover); border-radius: 4px; padding: 6px 10px; outline: none; width: 100%; }
.input:focus { box-shadow: 0 0 0 2px rgba(35, 131, 226, .4); }
.btn { background: var(--accent); color: white; border-radius: 4px; padding: 6px 14px; font-weight: 500; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid rgba(235, 87, 87, .5); }
.row-list { border: 1px solid var(--border); border-radius: 6px; }
.row-list > div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.row-list > div:last-child { border-bottom: 0; }
.row-list .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); font-size: 12px; }
.codebox { background: var(--code); font-family: var(--mono); font-size: 12px; padding: 10px 12px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; position: relative; }
.token-reveal { border: 1px solid #2c9a5a; background: rgba(44, 154, 90, .08); border-radius: 6px; padding: 12px; margin: 12px 0; }
.tabs { display: flex; gap: 4px; margin: 14px 0 10px; border-bottom: 1px solid var(--border); }
.tabs button { padding: 6px 10px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--text); border-color: var(--text); }
.steps { padding-left: 20px; line-height: 1.7; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(360px, 100%); }
.auth-card h1 { font-size: 26px; margin: 0 0 6px; }
.auth-card p { color: var(--muted); margin: 0 0 20px; }
.auth-card .btn { width: 100%; padding: 9px; margin-top: 8px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }

/* ---------- database ---------- */
.db-bar { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.db-bar .view-tab { padding: 8px 6px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; gap: 6px; align-items: center; }
.db-bar .view-tab.active { color: var(--text); border-color: var(--text); font-weight: 500; }
.db-bar .spacer { flex: 1; }
.db-search { border: 0; background: transparent; outline: none; width: 0; transition: width .2s; }
.db-search.open { width: 160px; border-bottom: 1px solid var(--border); }
.btn-new { background: var(--accent); color: #fff; border-radius: 4px; padding: 3px 10px; font-weight: 500; }
.db-table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.db-table { border-collapse: collapse; min-width: 100%; font-size: 14px; }
.db-table th, .db-table td { border: 1px solid var(--border); height: 34px; padding: 0; text-align: left; vertical-align: top; }
.db-table tr > :first-child { border-left: 0; }
.db-table tr > :last-child { border-right: 0; }
.db-table th { font-weight: 400; color: var(--muted); white-space: nowrap; }
.db-table th > div { padding: 7px 8px; display: flex; gap: 6px; align-items: center; cursor: pointer; min-width: 140px; }
.db-table th > div:hover { background: var(--hover); }
.db-table th.title-col > div { min-width: 260px; }
.db-table th.add-col > div { min-width: 40px; justify-content: center; }
.db-cell { padding: 7px 8px; min-height: 34px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.db-cell:hover { background: var(--hover); }
.db-cell input[type=text], .db-cell input[type=number], .db-cell input[type=date], .db-cell input[type=url] { border: 0; background: transparent; outline: none; width: 100%; padding: 0; }
.db-title-cell { display: flex; align-items: center; gap: 6px; position: relative; }
.db-title-cell .open-btn { display: none; position: absolute; right: 6px; top: 6px; font-size: 12px; background: var(--bg); box-shadow: var(--shadow); border-radius: 4px; padding: 1px 6px; color: var(--muted); }
.db-title-cell:hover .open-btn { display: block; }
.db-title-cell span[contenteditable] { flex: 1; font-weight: 500; white-space: nowrap; overflow: hidden; }
.db-newrow { color: var(--faint); padding: 8px; cursor: pointer; border-bottom: 1px solid var(--border); }
.db-newrow:hover { background: var(--hover); }
.tag { display: inline-flex; align-items: center; padding: 0 6px; border-radius: 3px; height: 20px; line-height: 20px; font-size: 13px; margin-right: 4px; white-space: nowrap; color: var(--text); }
.tag-gray { background: var(--c-gray); } .tag-brown { background: var(--c-brown); } .tag-orange { background: var(--c-orange); }
.tag-yellow { background: var(--c-yellow); } .tag-green { background: var(--c-green); } .tag-blue { background: var(--c-blue); }
.tag-purple { background: var(--c-purple); } .tag-pink { background: var(--c-pink); } .tag-red { background: var(--c-red); }
.person { display: inline-flex; align-items: center; gap: 6px; }
.avatar { width: 20px; height: 20px; border-radius: 50%; background: var(--c-blue); display: inline-grid; place-items: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.avatar.big { width: 28px; height: 28px; font-size: 13px; }
.board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding: 8px 0 20px; }
.board-col { width: 260px; flex-shrink: 0; border-radius: 6px; padding: 6px; }
.board-col.drop { background: var(--hover); }
.board-col-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 8px; color: var(--muted); font-size: 13px; }
.card { background: var(--bg); box-shadow: 0 0 0 1px var(--border), 0 2px 4px rgba(15, 15, 15, 0.06); border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; }
.card:hover { background: var(--hover); }
.card-title { font-weight: 500; margin-bottom: 4px; }
.card-props { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; color: var(--muted); }
.board-add { color: var(--faint); padding: 6px; border-radius: 4px; cursor: pointer; }
.board-add:hover { background: var(--hover); }
.props-panel { margin: 0 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.prop-row { display: flex; align-items: flex-start; min-height: 34px; }
.prop-name { width: 160px; flex-shrink: 0; color: var(--muted); padding: 7px 6px; display: flex; gap: 6px; align-items: center; }
.prop-val { flex: 1; min-width: 0; }
.prop-val .db-cell { max-width: none; border-radius: 4px; white-space: normal; }

/* ---------- comments ---------- */
.comments { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 14px; }
.comment { display: flex; gap: 10px; margin: 10px 0; }
.comment .c-body { flex: 1; white-space: pre-wrap; line-height: 1.5; }
.comment .c-head { font-weight: 500; font-size: 13px; }
.comment .c-head span { color: var(--faint); font-weight: 400; margin-left: 6px; font-size: 12px; }
.comment-box { display: flex; gap: 8px; align-items: center; }
.comment-box input { flex: 1; border: 0; outline: none; background: transparent; padding: 6px 0; }

/* ---------- home ---------- */
.home h1 { font-size: 32px; margin: 72px 0 24px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.home-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; cursor: pointer; min-height: 110px; display: flex; flex-direction: column; gap: 8px; }
.home-card:hover { background: var(--hover); }
.home-card .hc-icon { font-size: 26px; }
.home-card .hc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: #fff; padding: 8px 16px; border-radius: 6px; z-index: 2000; font-size: 13px; box-shadow: var(--shadow); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #2c9a5a; display: inline-block; }

@media (max-width: 800px) {
  .page, .page.full { padding: 0 24px 30vh; }
  .handle { display: none; }
  .sidebar { position: fixed; z-index: 800; height: 100vh; box-shadow: var(--shadow); }
  .page-title { font-size: 30px; }
}
.block.paragraph .bc:empty:not(:focus)::before { content: none; }
.block .toggle-body:empty:not(:focus)::before { content: attr(data-placeholder); }

/* ---------- co-editing presence ---------- */
.block.remote { box-shadow: -3px 0 0 0 var(--rc); }
.remote-cursor { position: absolute; right: 100%; top: -14px; margin-right: 6px; color: #fff; font-size: 10px; font-weight: 600; line-height: 1; padding: 2px 5px; border-radius: 3px; white-space: nowrap; pointer-events: none; opacity: .9; }
.viewers { display: flex; margin-right: 6px; }
.viewers .avatar { width: 24px; height: 24px; font-size: 10px; color: #fff; border: 2px solid var(--bg); margin-left: -6px; }
.viewers .avatar:first-child { margin-left: 0; }
