:root {
  --ink: #18211d;
  --muted: #6d7872;
  --line: #dfe5e1;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --sidebar: #eef2ec;
  --accent: #16634a;
  --accent-2: #dff0e7;
  --danger: #a53d35;
  --warning: #9a640a;
  --shadow: 0 18px 60px rgba(27, 52, 41, .12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: var(--paper); }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
.muted { color: var(--muted); }

.login-screen { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.05fr) minmax(420px, .95fr); background: var(--surface); }
.login-aside { position: relative; overflow: hidden; padding: 54px 7vw; color: #f7fbf8; background: #123d31; display: flex; flex-direction: column; justify-content: space-between; }
.login-aside::after { content: ""; position: absolute; width: 520px; height: 520px; right: -210px; bottom: -230px; border: 1px solid rgba(255,255,255,.22); border-radius: 50%; box-shadow: 0 0 0 70px rgba(255,255,255,.03), 0 0 0 140px rgba(255,255,255,.025); }
.login-aside .eyebrow { color: #a9d6c2; }
.login-aside h1 { margin: 0; max-width: 680px; font-family: Georgia, "Songti SC", serif; font-size: clamp(48px, 5vw, 78px); line-height: 1.08; letter-spacing: -.035em; font-weight: 500; }
.login-copy { color: #bed0c8; font-size: 17px; }
.login-feature { position: relative; z-index: 1; display: flex; gap: 20px; padding: 16px 0; border-top: 1px solid rgba(255,255,255,.16); color: #d9e7e0; }
.login-feature + .login-feature { margin-top: -1px; }
.login-feature span { color: #8fbca8; font: 12px ui-monospace, monospace; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent); color: white; font-family: Georgia, serif; font-size: 21px; font-weight: 700; }
.brand-mark.large { width: 48px; height: 48px; background: #d7efe3; color: #123d31; }
.login-panel { display: grid; place-items: center; padding: 48px; }
.login-form { width: min(390px, 100%); }
.login-form h2 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 38px; font-weight: 500; }
.login-form label, .field { display: grid; gap: 8px; margin-top: 22px; color: #39443f; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); outline: none; transition: border-color .16s, box-shadow .16s; }
input, select { min-height: 42px; padding: 0 12px; }
textarea { padding: 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: #75a28f; box-shadow: 0 0 0 3px rgba(22,99,74,.1); }
.form-error { min-height: 20px; color: var(--danger); font-size: 13px; }
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 60px; }

.button, .icon-button, .sidebar-link, .user-card { border: 0; cursor: pointer; transition: background .16s, color .16s, transform .08s; }
.button:active, .icon-button:active { transform: translateY(1px); }
.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 750; }
.ui-icon { width: 1em; height: 1em; display: block; flex: none; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: #0e533c; }
.button.secondary { background: var(--accent-2); color: var(--accent); }
.button.ghost { background: transparent; color: #46534d; }
.button.ghost:hover { background: #edf1ee; }
.button.danger { background: #fae8e6; color: var(--danger); }
.button.wide { width: 100%; margin-top: 28px; }
.grow { flex: 1; }
.icon-button { width: 38px; height: 38px; border-radius: 8px; background: transparent; font-size: 18px; }
.icon-button:hover { background: rgba(25,60,46,.08); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 286px; z-index: 10; display: flex; flex-direction: column; padding: 22px 16px 14px; background: var(--sidebar); border-right: 1px solid #d9dfda; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 25px; font-size: 17px; letter-spacing: -.02em; }
.space-picker-wrap { padding: 0 6px; }
.tiny-label { display: block; margin: 0 0 7px 3px; color: #7b8781; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.space-picker { height: 44px; background: rgba(255,255,255,.72); font-weight: 700; }
.sidebar-actions { display: flex; gap: 6px; padding: 14px 6px 10px; }
.sidebar-actions .icon-button { background: rgba(255,255,255,.7); border: 1px solid #d8dfda; }
.document-tree { flex: 1; overflow: auto; padding: 6px 2px 20px; }
.tree-item { position: relative; }
.tree-row { display: flex; align-items: center; min-height: 36px; padding: 5px 8px; border-radius: 7px; color: #435049; cursor: pointer; font-size: 13px; }
.tree-row:hover { background: rgba(255,255,255,.62); }
.tree-row.active { background: white; color: var(--accent); box-shadow: 0 1px 4px rgba(22,55,42,.07); font-weight: 750; }
.tree-toggle { width: 20px; color: #929d97; text-align: center; font-size: 10px; }
.tree-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-status { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: #c0c7c3; }
.tree-status.published { background: #42a177; }
.tree-children { padding-left: 16px; }
.empty-tree { margin: 30px 12px; color: var(--muted); font-size: 13px; text-align: center; }
.sidebar-footer { padding-top: 10px; border-top: 1px solid #d6ddd8; }
.sidebar-link, .user-card { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: transparent; border-radius: 8px; color: inherit; text-align: left; text-decoration: none; font-size: 13px; }
.sidebar-link:hover, .user-card:hover { background: rgba(255,255,255,.65); }
.user-card { margin-top: 4px; }
.user-card > span:nth-child(2) { min-width: 0; display: grid; flex: 1; }
.user-card strong, .user-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-card small { color: var(--muted); margin-top: 2px; }
.avatar { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #d5e7de; color: var(--accent); font-weight: 800; }
.more { color: #89938e; letter-spacing: 1px; }

.workspace { grid-column: 2; min-width: 0; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 8; height: 68px; display: flex; align-items: center; gap: 20px; padding: 0 30px; border-bottom: 1px solid var(--line); background: rgba(251,252,250,.91); backdrop-filter: blur(14px); }
.breadcrumb { min-width: 120px; flex: 1; color: #5d6963; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-wrap { width: min(360px, 35vw); display: flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.search-wrap input { min-height: 36px; padding: 0; border: 0; box-shadow: none; background: transparent; font-size: 13px; }
kbd { padding: 2px 5px; border: 1px solid #d9dfdb; border-radius: 4px; color: #89938e; background: #f6f8f6; font: 10px ui-monospace, monospace; }
.topbar-actions { display: flex; gap: 6px; }
.content-view { min-height: calc(100vh - 68px); }
.content-narrow { width: min(920px, calc(100% - 64px)); margin: 0 auto; padding: 58px 0 100px; }
.content-wide { width: min(1180px, calc(100% - 64px)); margin: 0 auto; padding: 48px 0 100px; }
.dashboard > h1, .admin-page > h1, #search-heading { margin: 0; font: 500 clamp(34px, 4vw, 52px)/1.15 Georgia, "Songti SC", serif; letter-spacing: -.035em; }
.lead { margin: 13px 0 35px; color: var(--muted); font-size: 16px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 28px 0 50px; }
.stat-card { padding: 20px; border: 1px solid var(--line); border-radius: 12px; background: white; }
.stat-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 10px; font: 500 32px Georgia, serif; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin: 28px 0 15px; }
.section-heading h2 { margin: 0 0 4px; font-size: 18px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.recent-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.recent-card, .search-card, .space-admin-card { padding: 18px; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; }
.recent-card:hover, .search-card:hover { border-color: #9eb9ac; box-shadow: 0 8px 25px rgba(25,60,46,.06); }
.recent-card h3, .search-card h3 { margin: 0 0 12px; font-size: 15px; }
.recent-card p, .search-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.document-page { width: min(820px, calc(100% - 64px)); margin: 0 auto; padding: 62px 0 120px; }
.document-page > h1 { margin: 13px 0 38px; font: 500 clamp(34px, 5vw, 54px)/1.13 Georgia, "Songti SC", serif; letter-spacing: -.035em; }
.document-meta { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: 12px; }
.status-badge, .role-badge { display: inline-flex; align-items: center; min-height: 23px; padding: 0 8px; border-radius: 999px; background: #eef1ef; color: #627069; font-size: 11px; font-weight: 800; }
.status-badge.published { background: #dff0e7; color: var(--accent); }
.status-badge.archived { background: #f5ead8; color: var(--warning); }
.markdown-body { color: #28332e; font: 16px/1.82 Georgia, "Songti SC", serif; overflow-wrap: anywhere; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin: 1.7em 0 .65em; line-height: 1.25; color: #18211d; }
.markdown-body h1 { font-size: 30px; }.markdown-body h2 { padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 24px; }.markdown-body h3 { font-size: 19px; }
.markdown-body p { margin: 0 0 1.1em; }
.markdown-body pre { overflow: auto; padding: 18px; border-radius: 10px; background: #17211d; color: #e5efe9; font: 13px/1.7 ui-monospace, SFMono-Regular, Consolas, monospace; }
.markdown-body code { padding: 2px 5px; border-radius: 4px; background: #edf1ee; color: #9d3d36; font: .86em ui-monospace, monospace; }
.markdown-body pre code { padding: 0; background: transparent; color: inherit; }
.markdown-body blockquote { margin: 1.5em 0; padding: 4px 18px; border-left: 3px solid #83ac99; color: #65726b; }
.markdown-body a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.markdown-body img { max-width: 100%; border-radius: 8px; }
.markdown-body hr { height: 1px; margin: 2.4em 0; border: 0; background: linear-gradient(90deg, transparent, #cfd7d2 12%, #cfd7d2 88%, transparent); }
.markdown-body .table-scroll { max-width: 100%; overflow: auto; margin: 1.5em 0; border: 1px solid var(--line); border-radius: 10px; }
.markdown-body table { width: 100%; border-collapse: collapse; background: #fff; font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13px; }
.markdown-body th, .markdown-body td { min-width: 120px; padding: 11px 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.markdown-body th { background: #f4f7f5; color: #34413b; font-weight: 800; }
.markdown-body tr:last-child td { border-bottom: 0; }.markdown-body th:last-child, .markdown-body td:last-child { border-right: 0; }
.markdown-body .task-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.markdown-body .task-item label { display: flex; align-items: flex-start; gap: 9px; }
.markdown-body .task-item input { width: 16px; min-height: 16px; margin: 6px 0 0; accent-color: var(--accent); }
.markdown-body .task-item.checked span { color: #89938e; text-decoration: line-through; }
.markdown-body pre.code-block { position: relative; padding-top: 42px; }
.markdown-body pre.code-block::before { content: attr(data-language); position: absolute; top: 0; left: 0; right: 0; height: 29px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid rgba(255,255,255,.1); color: #91a39a; font: 700 10px/1 Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; }
.syntax-comment { color: #7f968a; font-style: italic; }.syntax-string { color: #b9d991; }.syntax-number { color: #e8b875; }.syntax-keyword { color: #91b9f4; font-weight: 700; }.syntax-function { color: #e3d28b; }.syntax-property { color: #a9d8d1; }.syntax-tag { color: #9ec5f7; }
.document-attachment-ref { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid #d9e4de; border-radius: 6px; background: #f2f7f4; font-family: Inter, sans-serif; font-size: .82em; font-weight: 700; text-decoration: none; }
.attachment-section { margin-top: 60px; padding-top: 12px; border-top: 1px solid var(--line); }
.attachment-list { display: grid; gap: 8px; }
.attachment-row { width: 100%; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: white; font-size: 13px; }
.attachment-row .file-meta { min-width: 0; flex: 1; }
.attachment-row .file-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-row .file-meta small { color: var(--muted); }
.attachment-row a.button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.editor-attachment-panel { border-bottom: 1px solid var(--line); background: #fbfcfc; }
.editor-attachment-head { min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 6px 28px; }
.editor-attachment-toggle { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 6px 8px; border: 0; border-radius: 7px; background: transparent; color: #40474d; cursor: pointer; }
.editor-attachment-toggle:hover { background: #f0f2f2; }
.editor-attachment-title { display: inline-flex; align-items: center; gap: 7px; }
.editor-attachment-title .ui-icon { width: 15px; height: 15px; }
.editor-attachment-count { min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 6px; border-radius: 10px; background: #e9edeb; color: #56615c; font-size: 10px; font-weight: 800; }
.editor-attachment-chevron { color: #8a938e; font-size: 13px; }
.editor-attachment-hint { color: #929a96; font-size: 10px; }
.editor-upload-attachment { min-height: 32px; margin-left: auto; }
.editor-attachment-body { max-height: 260px; overflow: auto; padding: 10px 28px 14px; border-top: 1px solid #edf0ee; }
.editor-attachment-panel.collapsed .editor-attachment-body { display: none; }
.editor-attachment-list { gap: 6px; }
.editor-attachment-row { min-height: 52px; padding: 8px 10px; border-color: #e5e9e7; box-shadow: 0 1px 2px rgba(26, 35, 31, .02); }
.editor-attachment-row .button { min-height: 30px; padding: 0 10px; font-size: 11px; }
.editor-attachment-empty { min-height: 74px; display: grid; place-content: center; gap: 4px; color: #929a96; text-align: center; font-size: 11px; }
.editor-attachment-empty strong { color: #656d69; font-size: 12px; }

.editor-shell { min-height: calc(100vh - 68px); display: flex; flex-direction: column; }
.editor-toolbar { min-height: 82px; display: flex; align-items: center; gap: 20px; padding: 14px 32px; border-bottom: 1px solid var(--line); background: white; }
.editor-title { flex: 1; min-height: 52px; padding: 0; border: 0; box-shadow: none !important; font: 500 31px Georgia, "Songti SC", serif; }
.toolbar-actions { display: flex; gap: 6px; }
.editor-tabs { height: 46px; display: flex; align-items: end; gap: 4px; padding: 0 32px; border-bottom: 1px solid var(--line); background: #f7f9f7; }
.editor-tab { height: 45px; padding: 0 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; font-weight: 800; }
.editor-tab.active { border-color: var(--accent); color: var(--accent); }
.editor-hint { margin: 0 0 14px auto; color: #8a958f; font-size: 11px; }
.formatting-toolbar { min-height: 50px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 7px 32px; border-bottom: 1px solid var(--line); background: #fff; }
.format-button { min-width: 31px; height: 31px; display: inline-grid; place-items: center; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #525d57; cursor: pointer; font-size: 12px; }
.format-button:hover { border-color: #dfe5e1; background: #f3f6f4; color: var(--accent); }
.format-button:disabled { opacity: .34; cursor: not-allowed; }
.format-button.italic { font-style: italic; }.format-button.underline { text-decoration: underline; }.format-button.strike { text-decoration: line-through; }
.format-select { width: auto; min-width: 92px; min-height: 31px; height: 31px; padding: 0 25px 0 8px; border-radius: 6px; font-size: 11px; }
.format-select.compact { min-width: 66px; }
.format-select.language-select { min-width: 96px; }
.format-divider { width: 1px; height: 21px; margin: 0 3px; background: #e4e8e5; }
.color-control { width: 32px; height: 31px; position: relative; display: grid; place-items: center; border: 1px solid transparent; border-radius: 6px; color: #313a36; cursor: pointer; font-weight: 800; }
.color-control:hover { border-color: #dfe5e1; background: #f3f6f4; }
.color-control input { position: absolute; left: 7px; right: 7px; bottom: 3px; width: 18px; min-height: 3px; height: 3px; padding: 0; border: 0; border-radius: 0; background: transparent; cursor: pointer; }
.color-control input::-webkit-color-swatch-wrapper { padding: 0; }.color-control input::-webkit-color-swatch { border: 0; border-radius: 2px; }
.format-tip { margin-left: auto; color: #98a19c; font-size: 10px; }
.markdown-editor { flex: 1; min-height: calc(100vh - 246px); padding: 34px max(32px, calc((100vw - 286px - 820px) / 2)); border: 0; border-radius: 0; box-shadow: none !important; background: white; font: 14px/1.75 ui-monospace, SFMono-Regular, Consolas, monospace; resize: none; }
.rich-text-editor { flex: 1; min-height: calc(100vh - 246px); padding: 34px max(32px, calc((100vw - 286px - 820px) / 2)); border: 0; outline: 0; background: #fff; }
.rich-text-editor:empty::before { content: attr(data-placeholder); color: #a0a8a4; pointer-events: none; }
.rich-text-editor:focus { box-shadow: inset 0 0 0 2px rgba(22,99,74,.08); }
.rich-text-editor.drag-image-over { box-shadow: inset 0 0 0 3px rgba(22,99,74,.3); background: #f5fbf8; }
.rich-text-editor > :first-child { margin-top: 0; }
.rich-text-editor .table-scroll { overflow: visible; }
.rich-text-editor th, .rich-text-editor td { outline: none; }
.rich-text-editor th:focus, .rich-text-editor td:focus { box-shadow: inset 0 0 0 2px rgba(22,99,74,.18); }
.rich-text-editor .document-figure { cursor: pointer; }
.rich-text-editor .document-figure.selected { outline: 2px solid #536cf1; outline-offset: 5px; }
.rich-text-editor .selected-editor-block { position: relative; outline: 2px solid #536cf1; outline-offset: 4px; }
.rich-text-editor figcaption:empty::before, .rich-text-editor figcaption:has(> br:only-child)::before { content: attr(data-placeholder); color: #a0a8a4; }
.editor-save-status { align-self: center; margin-right: 4px; color: #838e88; font-size: 11px; white-space: nowrap; }
.editor-save-status.saving { color: #78671e; }
.editor-save-status.dirty { color: #8b6832; }
.editor-save-status.error { color: var(--danger); }
.editor-save-status.saved::before { content: "✓ "; color: #3e9c70; }
.editor-preview { width: min(820px, calc(100% - 64px)); margin: 0 auto; padding: 38px 0 100px; }
.markdown-body .md-align { display: block; width: 100%; }.markdown-body .align-left { text-align: left; }.markdown-body .align-center { text-align: center; }.markdown-body .align-right { text-align: right; }
.image-toolbar { min-height: 44px; display: flex; align-items: center; gap: 6px; padding: 6px 32px; border-bottom: 1px solid #dfe4ff; background: #f5f6ff; color: #454657; font-family: Inter, sans-serif; font-size: 11px; }
.image-toolbar strong { margin-right: 7px; color: #34344a; }
.image-toolbar label { display: flex; align-items: center; gap: 6px; }
.image-toolbar select { width: 72px; min-height: 30px; height: 30px; padding: 0 22px 0 8px; font-size: 11px; }
.image-toolbar button { min-height: 30px; padding: 0 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; cursor: pointer; font-size: 11px; }
.image-toolbar button:hover, .image-toolbar button.active { border-color: #cfd3f6; background: #fff; color: #3e4fc1; }
.image-toolbar .component-delete { margin-left: 4px; border-color: #f0d7d5; background: #fff; color: var(--danger); }
.image-toolbar .component-delete:hover { border-color: #e4b9b5; background: #fff3f2; color: var(--danger); }
.image-toolbar .image-toolbar-close { margin-left: auto; font-size: 16px; }
.editor-block-toolbar > span { color: #77798a; }
.slash-menu { position: fixed; z-index: 50; width: 288px; max-height: 370px; overflow: auto; padding: 7px; border: 1px solid #dcdfdd; border-radius: 10px; background: #fff; box-shadow: 0 16px 48px rgba(26,35,31,.18); }
.slash-menu-label, .slash-menu-empty { padding: 7px 9px; color: #929b96; font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.slash-menu button { width: 100%; display: grid; grid-template-columns: 34px 1fr; align-items: center; gap: 8px; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; cursor: pointer; text-align: left; }
.slash-menu button > span:first-child { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid #e5e8e6; border-radius: 6px; color: #59645f; font-size: 11px; font-weight: 800; }
.slash-menu button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.slash-menu button strong { font-size: 12px; }.slash-menu button small { color: #8d9691; font-size: 10px; }
.slash-menu button:hover, .slash-menu button.active { background: #eef4f0; }
.attachment-picker { display: grid; gap: 7px; margin-top: 16px; }
.attachment-picker button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; text-align: left; }
.attachment-picker button:hover { border-color: #92af9f; background: #f7faf8; }
.attachment-picker button > span:last-child { min-width: 0; display: grid; gap: 3px; }.attachment-picker strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.attachment-picker small { color: var(--muted); }

.search-filters { display: flex; align-items: end; gap: 10px; margin-top: 26px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.search-filters label { display: grid; gap: 5px; color: var(--muted); font-size: 10px; font-weight: 750; }
.search-filters select { min-width: 130px; min-height: 34px; padding-top: 0; padding-bottom: 0; font-size: 12px; }
.search-summary { margin-left: auto; align-self: center; color: var(--muted); font-size: 11px; }
.search-results { display: grid; gap: 10px; margin-top: 18px; }
.search-card mark { background: #f6e9a8; color: inherit; }
.admin-tabs { display: flex; gap: 5px; margin: 34px 0 28px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.admin-tab { padding: 9px 15px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 750; }
.admin-tab.active { background: var(--accent-2); color: var(--accent); }
.data-table { overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: white; }
.table-row { display: grid; grid-template-columns: 1.4fr 1fr .8fr 1fr; align-items: center; gap: 14px; min-height: 57px; padding: 9px 16px; border-bottom: 1px solid #edf0ee; font-size: 13px; }
#audit-table .table-row { grid-template-columns: minmax(105px, .8fr) minmax(90px, .7fr) minmax(180px, 1.25fr) minmax(150px, 1.15fr) minmax(120px, .8fr); }
.audit-object, .audit-note { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-note { color: #4d5a54; font-weight: 650; }
.table-row:last-child { border-bottom: 0; }
.table-head { min-height: 42px; color: var(--muted); background: #f6f8f6; font-size: 11px; font-weight: 800; }
.row-actions { display: flex; justify-content: flex-end; gap: 4px; }
.row-actions .button { min-height: 31px; padding: 0 10px; }
.card-list { display: grid; gap: 10px; }
.space-admin-card { cursor: default; display: flex; align-items: center; gap: 20px; }
.space-admin-card > div:first-child { min-width: 0; flex: 1; }
.space-admin-card h3 { margin: 0 0 5px; }
.space-admin-card p { margin: 0; color: var(--muted); font-size: 12px; }

.modal { width: min(560px, calc(100% - 32px)); max-height: min(800px, calc(100vh - 40px)); padding: 0; border: 0; border-radius: 15px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(17,30,24,.42); backdrop-filter: blur(4px); }
.modal-card { display: flex; flex-direction: column; max-height: inherit; }
.modal-header { display: flex; align-items: start; justify-content: space-between; padding: 23px 24px 16px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 0; font: 500 25px Georgia, "Songti SC", serif; }
.modal-body { overflow: auto; padding: 6px 24px 24px; }
.modal-feedback { margin: 0 24px 14px; padding: 10px 12px; border: 1px solid #efc9c5; border-radius: 8px; background: #fff4f3; color: #b23b32; font-size: 12px; line-height: 1.55; }
.modal-feedback.success { border-color: #c8e4d5; background: #f0faf5; color: #23724f; }
.password-guidance { margin: 18px 0 4px; padding: 10px 12px; border-radius: 8px; background: #f2f5f3; color: #66716b; font-size: 12px; line-height: 1.6; }
.modal-body input[aria-invalid="true"] { border-color: #cf655c; box-shadow: 0 0 0 3px rgba(207, 101, 92, .1); }
.modal-actions { display: flex; justify-content: flex-end; gap: 7px; padding: 14px 24px; border-top: 1px solid var(--line); background: #f8faf8; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.checkbox-field { display: flex; align-items: flex-start; gap: 10px; margin-top: 22px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 9px; background: #f8faf8; cursor: pointer; }
.checkbox-field input { width: 17px; min-height: 17px; margin-top: 1px; accent-color: var(--accent); }
.checkbox-field span { display: grid; gap: 3px; color: #39443f; font-size: 13px; font-weight: 750; }
.checkbox-field small { color: var(--muted); font-weight: 500; line-height: 1.45; }
.inline-message { margin-top: 18px; padding: 12px; border-radius: 8px; background: #f2f5f3; color: #526059; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.member-list, .revision-list { display: grid; gap: 7px; margin-top: 18px; }
.member-row, .revision-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.member-row > div, .revision-row > div { min-width: 0; flex: 1; }
.member-row strong, .revision-row strong { display: block; }
.member-row small, .revision-row small { color: var(--muted); }
.empty-state { padding: 50px 20px; color: var(--muted); text-align: center; }
.toast-container { position: fixed; z-index: 100; right: 22px; top: 20px; display: grid; gap: 8px; }
.toast { min-width: 260px; max-width: 420px; padding: 13px 16px; border: 1px solid #d8e4dd; border-radius: 9px; background: white; box-shadow: 0 10px 35px rgba(24,48,38,.14); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { border-color: #e8c9c5; color: var(--danger); }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } }
.mobile-only { display: none; }

@media (max-width: 920px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .mobile-brand { display: flex; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .workspace { min-height: 100vh; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 0 14px; gap: 8px; }
  .breadcrumb { display: none; }
  .search-wrap { flex: 1; width: auto; }
  .topbar-actions .button.ghost { display: none; }
  .content-narrow, .content-wide, .document-page { width: min(100% - 32px, 820px); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .recent-grid { grid-template-columns: 1fr; }
  .editor-toolbar { padding: 12px 16px; }
  .editor-title { font-size: 23px; }
  .editor-tabs { padding: 0 16px; }
  .markdown-editor, .rich-text-editor { padding: 24px 18px; }
  .table-row { grid-template-columns: 1.3fr .8fr 1fr; }
  .table-row > :nth-child(2) { display: none; }
}

@media (max-width: 560px) {
  .login-panel { padding: 28px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar-actions .button { padding: 0 11px; }
  .document-page { padding-top: 38px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .space-admin-card { align-items: flex-start; flex-direction: column; }
}

@media print {
  .sidebar, .topbar, .attachment-section { display: none !important; }
  .app-shell, .workspace { display: block; }
  .content-view { min-height: auto; }
  .document-page { width: 100%; padding: 0; }
  .document-page > h1 { font-size: 34px; }
  body { background: white; }
}

/* PandaWiki-inspired administration shell */
.app-shell {
  --admin-bg: #f4f4fa;
  --admin-ink: #202027;
  --admin-muted: #858590;
  display: block;
  min-height: 100vh;
  color: var(--admin-ink);
  background: var(--admin-bg);
}

.app-shell .sidebar {
  inset: 10px auto 10px 10px;
  width: 158px;
  padding: 15px 12px 12px;
  border: 1px solid #eeeef4;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(31, 31, 44, .045);
}

.app-shell .sidebar-brand {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  column-gap: 9px;
  padding: 3px 7px 21px;
  font-size: 14px;
}

.app-shell .sidebar-brand .brand-mark {
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #25252d;
  font-family: Inter, sans-serif;
  font-size: 17px;
}

.app-shell .sidebar-brand strong { align-self: end; }
.app-shell .sidebar-brand small { align-self: start; color: #9999a3; font-size: 9px; font-weight: 600; }
.primary-nav { display: grid; gap: 6px; }

.app-shell .sidebar-link {
  min-height: 42px;
  padding: 0 12px;
  border-radius: 9px;
  color: #64646e;
  font-size: 13px;
  font-weight: 650;
}

.app-shell .sidebar-link:hover { background: #f3f3f7; color: #292931; }
.app-shell .sidebar-link.active { color: #fff; background: #202027; box-shadow: 0 8px 18px rgba(30, 30, 38, .18); }
.nav-icon { width: 18px; display: grid; place-items: center; color: inherit; text-align: center; font-size: 17px; }
.app-shell .document-tree { display: none; }
.app-shell .sidebar-footer { margin-top: auto; padding-top: 12px; border: 0; }
.app-shell .portal-nav { margin-bottom: 7px; border: 1px solid #ececf1; color: #33333b; }
.app-shell .user-card { min-height: 52px; padding: 7px; border-top: 1px solid #eeeef2; border-radius: 0; font-size: 11px; }
.app-shell .user-card:hover { background: #f6f6f8; border-radius: 9px; }
.app-shell .avatar { width: 29px; height: 29px; background: #ededf2; color: #34343d; }
.app-shell .user-card small { color: #9a9aa3; font-size: 9px; }
.app-shell .more { display: none; }

.app-shell .workspace {
  min-height: 100vh;
  margin-left: 178px;
  padding: 10px 10px 10px 0;
  background: var(--admin-bg);
}

.app-shell .topbar {
  position: sticky;
  top: 10px;
  height: 54px;
  margin-bottom: 10px;
  padding: 0 14px;
  gap: 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(244, 244, 250, .92);
  backdrop-filter: blur(16px);
}

.workspace-picker { min-width: 310px; display: flex; flex: 1; align-items: center; gap: 10px; }
.space-selector { min-width: 220px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 5px 10px; border: 1px solid #dfe7e3; border-radius: 10px; background: linear-gradient(135deg, #fff 0%, #f2f8f5 100%); box-shadow: 0 3px 12px rgba(31, 67, 52, .06); transition: border-color .16s, box-shadow .16s, transform .16s; }
.space-selector:hover, .space-selector:focus-within { border-color: #8db6a5; box-shadow: 0 4px 16px rgba(31, 67, 52, .11); }
.space-selector-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: none; border-radius: 8px; background: #dff0e7; color: #16634a; font-size: 15px; }
.space-selector-copy { min-width: 0; display: grid; flex: 1; }
.space-selector-copy small { color: #7b8881; font-size: 8px; font-weight: 800; letter-spacing: .08em; line-height: 1.15; }
.app-shell .space-picker {
  width: 100%;
  max-width: none;
  min-height: 22px;
  padding: 0 24px 0 0;
  border: 0;
  background-color: transparent;
  box-shadow: none;
  color: #24322c;
  font-size: 12px;
  font-weight: 800;
}
.app-shell select.select-native-hidden,
.document-list-toolbar select.select-native-hidden { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; margin: -1px !important; padding: 0 !important; overflow: hidden !important; border: 0 !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.custom-select { position: relative; min-width: 0; }
.space-selector-copy .custom-select { width: 100%; }
.custom-select-trigger { width: 100%; min-height: 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0; border: 0; background: transparent; color: #24322c; cursor: pointer; text-align: left; }
.custom-select-trigger:focus-visible { outline: 2px solid rgba(22,99,74,.3); outline-offset: 3px; border-radius: 4px; }
.custom-select-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 800; }
.custom-select-chevron { display: grid; place-items: center; flex: none; color: #68746e; font-size: 13px; transition: transform .18s ease; }
.custom-select.open .custom-select-chevron { transform: rotate(180deg); }
.custom-select-menu { position: absolute; top: calc(100% + 10px); left: 0; z-index: 60; min-width: 220px; padding: 6px; border: 1px solid #e0e5e2; border-radius: 12px; background: rgba(255,255,255,.98); box-shadow: 0 18px 50px rgba(32,47,40,.16), 0 3px 12px rgba(32,47,40,.06); backdrop-filter: blur(16px); }
.custom-select-space .custom-select-menu { left: -40px; min-width: 230px; }
.custom-select-status .custom-select-menu { left: -38px; min-width: 228px; }
.custom-select-option { width: 100%; min-height: 48px; display: grid; grid-template-columns: 28px minmax(0, 1fr) 22px; align-items: center; gap: 9px; padding: 6px 8px; border: 0; border-radius: 8px; background: transparent; color: #35413b; cursor: pointer; text-align: left; transition: background .14s, color .14s; }
.custom-select-option:hover, .custom-select-option:focus-visible { outline: none; background: #f1f6f3; color: #174f3d; }
.custom-select-option.active { background: #e7f2ec; color: #12563f; }
.custom-select-option-icon { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 7px; background: #edf3f0; color: #557166; font-size: 14px; }
.custom-select-option.active .custom-select-option-icon { background: #cfe8dc; color: #126247; }
.custom-select-status-dot { width: 9px; height: 9px; justify-self: center; border-radius: 50%; background: #9da6a1; box-shadow: 0 0 0 4px #f0f2f1; }
.custom-select-status-dot.published { background: #35a46f; box-shadow: 0 0 0 4px #e5f4ec; }
.custom-select-status-dot.draft { background: #818995; box-shadow: 0 0 0 4px #eef0f3; }
.custom-select-status-dot.archived { background: #d79537; box-shadow: 0 0 0 4px #fff1dc; }
.custom-select-option-copy { min-width: 0; display: grid; gap: 2px; }
.custom-select-option-copy strong, .custom-select-option-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-select-option-copy strong { font-size: 11px; font-weight: 800; }
.custom-select-option-copy small { color: #929c97; font-size: 9px; font-weight: 500; }
.custom-select-check { opacity: 0; color: #167253; font-size: 13px; font-weight: 900; text-align: center; }
.custom-select-option.active .custom-select-check { opacity: 1; }
.breadcrumb-separator { color: #b1b1ba; }
.app-shell .breadcrumb { min-width: 80px; flex: 0 1 auto; color: #303038; font-size: 12px; font-weight: 700; }
.app-shell .search-wrap { width: min(300px, 28vw); height: 38px; border-color: #ebebf0; border-radius: 8px; box-shadow: 0 2px 8px rgba(35, 35, 48, .025); }
.app-shell .search-wrap input { font-size: 12px; }
.search-leading { display: grid; place-items: center; color: #777781; font-size: 15px; }
.app-shell kbd { border: 0; background: #f2f2f5; }
.button.dark { display: inline-flex; align-items: center; justify-content: center; background: #202027; color: #fff; text-decoration: none; }
.button.dark:hover { background: #34343e; }
.app-shell .button.primary { background: #202027; }
.app-shell .button.primary:hover { background: #34343e; }
.app-shell .button.secondary { background: #f0f0f5; color: #3a3a43; }
.topbar-search { min-height: 36px; padding: 0 14px; white-space: nowrap; }

.app-shell .content-view { min-height: calc(100vh - 84px); }
.app-shell .content-wide,
.app-shell #search-view > .content-narrow {
  width: 100%;
  min-height: calc(100vh - 84px);
  margin: 0;
  padding: 26px 28px 42px;
  border: 1px solid #ececf2;
  border-radius: 14px;
  background: #fff;
}

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-heading.compact { align-items: center; }
.page-heading .eyebrow { margin-bottom: 5px; color: #8e8e99; font-size: 9px; }
.page-heading h1,
.app-shell .admin-page > h1,
.app-shell #search-heading { margin: 0; font: 750 25px/1.2 Inter, "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: -.02em; }
.app-shell .lead { margin: 7px 0 0; color: #96969f; font-size: 12px; }
.page-actions { display: flex; gap: 8px; }

.dashboard-banner {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-top: 22px;
  padding: 17px 20px;
  border: 1px solid #e8e8f4;
  border-radius: 12px;
  background: linear-gradient(115deg, #f2f6ff 0%, #f9f4ff 58%, #fff 100%);
}
.banner-symbol { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px; background: #25252d; color: #fff; font-size: 22px; font-weight: 800; }
.dashboard-banner span { color: #8d8d99; font-size: 10px; font-weight: 700; }
.dashboard-banner h2 { margin: 2px 0 3px; font-size: 19px; }
.dashboard-banner p { margin: 0; color: #888893; font-size: 11px; }
.banner-status { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: rgba(255,255,255,.7); color: #5e5e69; font-size: 10px; font-weight: 700; }
.banner-status span { width: 7px; height: 7px; border-radius: 50%; background: #49b484; box-shadow: 0 0 0 3px rgba(73,180,132,.12); }

.app-shell .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0; }
.app-shell .stat-card { min-height: 88px; display: flex; align-items: center; gap: 14px; padding: 16px 18px; border: 0; border-radius: 10px; }
.app-shell .stat-card.blue { background: #e8f2ff; }
.app-shell .stat-card.cyan { background: #e9f8f9; }
.app-shell .stat-card.violet { background: #f1eaff; }
.app-shell .stat-card.amber { background: #fff4dc; }
.app-shell .stat-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 9px; background: rgba(255,255,255,.7); color: #4c4c57; font-size: 17px; }
.app-shell .stat-card div > span { color: #84848f; font-size: 10px; }
.app-shell .stat-card strong { margin-top: 4px; color: #26262e; font: 750 24px/1 Inter, sans-serif; }

.dashboard-columns { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, .9fr); gap: 14px; }
.dashboard-panel { min-width: 0; padding: 18px; border: 1px solid #ececf1; border-radius: 11px; background: #fff; }
.app-shell .section-heading { align-items: center; margin: 0 0 12px; }
.app-shell .section-heading h2 { font-size: 14px; }
.app-shell .section-heading p { margin-top: 4px; color: #9a9aa4; font-size: 10px; }
.text-button { padding: 6px 0; border: 0; background: transparent; color: #6f6f79; cursor: pointer; font-size: 11px; font-weight: 700; }
.app-shell .recent-grid { display: block; }
.app-shell .recent-card {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto 112px;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border: 0;
  border-bottom: 1px solid #f0f0f3;
  border-radius: 0;
  background: #fff;
  color: inherit;
  text-align: left;
}
.app-shell .recent-card:last-child { border-bottom: 0; }
.app-shell .recent-card:hover { border-color: #ececf1; background: #f8f8fa; box-shadow: none; }
.recent-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: #f0f0f5; color: #676772; }
.recent-copy { min-width: 0; display: grid; gap: 3px; }
.recent-copy strong, .recent-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-copy strong { font-size: 12px; }
.recent-copy small, .recent-card time { color: #9a9aa4; font-size: 10px; }
.recent-card time { text-align: right; }
.publish-chart-wrap { min-height: 175px; display: flex; align-items: center; justify-content: center; gap: 24px; }
.publish-chart { --progress: 0deg; position: relative; width: 112px; height: 112px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#536cf1 var(--progress), #ededf3 0); }
.publish-chart::after { content: ""; position: absolute; inset: 15px; border-radius: 50%; background: #fff; }
.publish-chart span { position: relative; z-index: 1; color: #303039; font-size: 20px; font-weight: 800; }
.publish-legend { min-width: 92px; }
.publish-legend p { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 6px; margin: 10px 0; color: #868690; font-size: 10px; }
.publish-legend strong { color: #34343c; font-size: 12px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.published { background: #536cf1; }
.legend-dot.draft { background: #d8d8e1; }

.directory-panel { overflow: hidden; margin-top: 22px; border: 1px solid #ececf1; border-radius: 11px; background: #fff; }
.document-list-toolbar { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.document-filter-control { min-width: 208px; display: flex; align-items: center; gap: 10px; padding: 7px 11px; border: 1px solid #e1e6e3; border-radius: 10px; background: #f8faf9; color: #66736d; transition: border-color .16s, box-shadow .16s; }
.document-filter-control:hover, .document-filter-control:focus-within { border-color: #9ab8aa; box-shadow: 0 4px 14px rgba(31,67,52,.08); }
.document-filter-control > .ui-icon { width: 18px; height: 18px; color: #16634a; }
.document-filter-control > span:last-child { min-width: 0; display: grid; flex: 1; }
.document-list-toolbar small { font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.document-list-toolbar select { min-height: 24px; padding: 0 24px 0 0; border: 0; background-color: transparent; box-shadow: none; color: #252d29; font-size: 12px; font-weight: 750; }
.document-filter-count { color: #8b948f; font-size: 11px; }
.document-list-toolbar + .directory-panel { margin-top: 10px; }
.directory-head,
.directory-row { display: grid; grid-template-columns: minmax(260px, 1fr) 120px 150px 82px; align-items: center; gap: 12px; }
.directory-head { min-height: 42px; padding: 0 16px; background: #f8f8fa; color: #92929c; font-size: 10px; font-weight: 750; }
.directory-row { position: relative; width: 100%; min-height: 54px; padding: 0 16px; border: 0; border-bottom: 1px solid #f0f0f3; background: #fff; color: #303038; cursor: pointer; text-align: left; }
.directory-row:last-child { border-bottom: 0; }
.directory-row:hover { background: #fafafd; }
.directory-row:focus-visible { outline: 2px solid #7373e8; outline-offset: -2px; }
.directory-row[draggable="true"] { cursor: grab; }
.directory-row.dragging { opacity: .42; cursor: grabbing; }
.directory-row.drop-before { box-shadow: inset 0 3px #566be9; }
.directory-row.drop-after { box-shadow: inset 0 -3px #566be9; }
.directory-row.drop-inside { z-index: 1; outline: 2px solid #566be9; outline-offset: -3px; background: #f0f2ff; }
.directory-row.drop-inside::after { content: "设为子文档"; position: absolute; right: 94px; top: 50%; transform: translateY(-50%); padding: 3px 7px; border-radius: 5px; background: #566be9; color: #fff; font-size: 9px; font-weight: 750; }
.directory-title { min-width: 0; display: flex; align-items: center; gap: 8px; padding-left: calc(var(--tree-depth) * 20px); }
.directory-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.directory-toggle { width: 20px; height: 24px; display: grid; place-items: center; flex: none; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #8c8c97; cursor: pointer; font-size: 14px; transition: background .16s, color .16s; }
.directory-toggle:hover { background: #ebebf0; color: #303038; }
.directory-toggle .ui-icon { transition: transform .16s ease; }
.directory-toggle.collapsed .ui-icon { transform: rotate(-90deg); }
.directory-toggle-spacer { width: 20px; flex: none; }
.directory-file { width: 18px; display: grid; place-items: center; color: #787883; font-size: 16px; }
.attachment-icon { width: 30px; height: 30px; display: grid; place-items: center; flex: none; border-radius: 8px; background: #f0f0f5; color: #656570; font-size: 16px; }
.directory-date { color: #9898a2; font-size: 10px; }
.directory-more { color: #8d8d97; letter-spacing: 1px; }
.directory-actions { display: flex; justify-content: flex-end; }
.directory-edit { min-height: 29px; padding: 0 12px; border: 1px solid #e3e3e9; border-radius: 7px; background: #fff; color: #484852; cursor: pointer; font-size: 10px; font-weight: 750; }
.directory-edit:hover { border-color: #202027; background: #202027; color: #fff; }
.directory-empty { grid-column: 1 / -1; }
.app-shell .status-badge { min-height: 21px; padding: 0 8px; background: #f0f0f4; color: #777782; font-size: 9px; }
.app-shell .status-badge.published { background: #e6f5ed; color: #218358; }
.app-shell .status-badge.archived { background: #fff1df; color: #a56c1a; }

.app-shell .document-reading-layout { display: grid; grid-template-columns: minmax(0, 1fr) 210px; align-items: start; gap: 10px; }
.app-shell .document-page {
  width: 100%;
  min-height: calc(100vh - 84px);
  margin: 0;
  padding: 54px max(36px, calc((100% - 820px) / 2)) 110px;
  border: 1px solid #ececf2;
  border-radius: 14px;
  background: #fff;
}
.document-toc { position: sticky; top: 74px; max-height: calc(100vh - 94px); overflow: auto; padding: 20px 16px; border: 1px solid #ececf2; border-radius: 12px; background: rgba(255,255,255,.92); }
.document-toc > strong { display: block; margin-bottom: 11px; color: #33333c; font-size: 12px; }
.document-toc nav { display: grid; gap: 2px; }
.toc-link { display: block; overflow: hidden; padding: 6px 8px; border-radius: 6px; color: #777783; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; line-height: 1.35; }
.toc-link:hover { background: #f1f1f6; color: #33333b; }
.toc-link.level-2 { padding-left: 17px; }
.toc-link.level-3 { padding-left: 27px; color: #9696a0; }
.document-figure { max-width: 100%; margin-top: 24px; margin-bottom: 24px; }
.document-figure.align-left { margin-left: 0; margin-right: auto; text-align: left; }.document-figure.align-center { margin-left: auto; margin-right: auto; text-align: center; }.document-figure.align-right { margin-left: auto; margin-right: 0; text-align: right; }
.document-figure figcaption { margin-top: 8px; color: #888893; font: 11px/1.6 Inter, sans-serif; text-align: center; }
.document-figure .document-image { width: 100%; margin: 0; }
.document-image { display: block; max-width: 100%; height: auto; margin: 22px auto; border: 1px solid #ececf0; border-radius: 10px; box-shadow: 0 8px 24px rgba(28,28,40,.06); }
.app-shell .editor-shell { min-height: calc(100vh - 84px); overflow: hidden; border: 1px solid #ececf2; border-radius: 14px; background: #fff; }
.app-shell .editor-toolbar { border-radius: 14px 14px 0 0; }
.app-shell .admin-tabs { margin-top: 24px; }
.app-shell .admin-tab.active { background: #202027; color: #fff; }

@media (max-width: 1120px) {
  .topbar-search { padding: 0 11px; }
  .app-shell .search-wrap { width: min(260px, 27vw); }
  .dashboard-columns { grid-template-columns: 1fr; }
  .app-shell .document-reading-layout { display: block; }
  .app-shell .document-toc { display: none; }
}

@media (max-width: 920px) {
  .app-shell .sidebar { inset: 8px auto 8px 8px; width: 168px; }
  .app-shell .workspace { margin-left: 0; padding: 0; }
  .app-shell .topbar { top: 0; height: 60px; margin: 0; border-radius: 0; }
  .workspace-picker { min-width: 0; flex: 0 1 auto; }
  .space-selector { min-width: 160px; }
  .breadcrumb-separator, .app-shell .breadcrumb { display: none; }
  .app-shell .search-wrap { flex: 1; width: auto; }
  .app-shell .content-wide,
  .app-shell #search-view > .content-narrow,
  .app-shell .document-page,
  .app-shell .editor-shell { width: calc(100% - 20px); min-height: calc(100vh - 70px); margin: 10px; border-radius: 12px; }
  .app-shell .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .directory-head, .directory-row { grid-template-columns: minmax(180px, 1fr) 90px 110px 72px; }
  .formatting-toolbar { padding: 7px 16px; }
  .image-toolbar { padding: 6px 16px; }
  .format-tip { display: none; }
}

@media (max-width: 640px) {
  .app-shell .content-wide, .app-shell #search-view > .content-narrow { padding: 20px 16px 32px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-heading.compact { align-items: flex-start; }
  .dashboard-banner { grid-template-columns: 46px 1fr; }
  .banner-symbol { width: 44px; height: 44px; }
  .banner-status { display: none; }
  .app-shell .stat-card { min-height: 76px; padding: 12px; }
  .app-shell .stat-icon { display: none; }
  .app-shell .recent-card { grid-template-columns: 30px minmax(0, 1fr) auto; }
  .recent-card time { display: none; }
  .publish-chart-wrap { justify-content: flex-start; }
  .directory-head { display: none; }
  .directory-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 12px; }
  .document-list-toolbar { align-items: stretch; flex-direction: column; }
  .document-filter-control { width: 100%; }
  .directory-date, .directory-more { display: none; }
  .app-shell .document-page { padding: 36px 22px 80px; }
  .editor-save-status { display: none; }
  .format-select.language-select { min-width: 80px; }
  .image-toolbar { overflow-x: auto; }
  .search-filters { align-items: stretch; flex-direction: column; }
  .search-summary { margin-left: 0; }
}

/* Distraction-free document editor */
.app-shell.editor-mode {
  display: block;
  min-height: 100vh;
  background: #f3f5f7;
}
.app-shell.editor-mode > .sidebar,
.app-shell.editor-mode .topbar { display: none; }
.app-shell.editor-mode .workspace {
  min-height: 100vh;
  margin-left: 0;
  padding: 0;
  background: #f3f5f7;
}
.app-shell.editor-mode #editor-view { min-height: 100vh; }
.app-shell.editor-mode .editor-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  margin: 0;
  padding: 32px 24px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: #f3f5f7;
  transition: grid-template-columns .2s ease;
}
.editor-outline {
  position: sticky;
  top: 32px;
  height: calc(100vh - 64px);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 7px 24px rgba(28, 38, 48, .035);
}
.editor-outline-head {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid #e9ecef;
  color: #30343a;
}
.editor-outline-head strong { flex: 1; font-size: 13px; font-weight: 650; }
.editor-outline-toggle {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #697078;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.editor-outline-toggle:hover { background: #f1f3f5; color: #171a1e; }
.editor-outline-toggle:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(83,108,241,.15); }
.editor-outline-arrow { width: 9px; height: 9px; display: block; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(135deg); transition: transform .2s ease; }
.editor-outline-body { min-height: 0; flex: 1; display: flex; flex-direction: column; overflow: auto; padding: 14px 10px; }
.editor-outline-body nav { display: grid; gap: 3px; }
.editor-outline-link {
  width: 100%;
  display: block;
  overflow: hidden;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5f6770;
  cursor: pointer;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.4;
}
.editor-outline-link:hover { background: #f2f4f6; color: #15191e; }
.editor-outline-link.level-2 { padding-left: 22px; }
.editor-outline-link.level-3 { padding-left: 34px; color: #8b9299; }
.editor-outline-empty { margin: auto 10px; color: #8b9299; text-align: center; font-size: 12px; line-height: 1.7; }
.app-shell.editor-mode .editor-shell.outline-collapsed { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; }
.editor-shell.outline-collapsed .editor-outline { width: 48px; height: 48px; min-height: 0; border-radius: 12px; box-shadow: 0 7px 24px rgba(28,38,48,.06); }
.editor-shell.outline-collapsed .editor-outline-head { justify-content: center; padding: 0; }
.editor-shell.outline-collapsed .editor-outline-head strong,
.editor-shell.outline-collapsed .editor-outline-body { display: none; }
.editor-shell.outline-collapsed .editor-outline-head { min-height: 46px; border-bottom: 0; }
.editor-shell.outline-collapsed .editor-outline-arrow { transform: rotate(-45deg); }
.editor-stage { min-width: 0; display: flex; justify-content: center; padding: 2px 24px 72px 0; }
.editor-paper {
  width: min(920px, 100%);
  min-height: calc(100vh - 68px);
  overflow: visible;
  border: 1px solid #eceff1;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 10px 35px rgba(25, 35, 45, .04);
}
.app-shell.editor-mode .editor-toolbar {
  min-height: 102px;
  align-items: flex-start;
  padding: 24px 36px 18px;
  border-radius: 4px 4px 0 0;
}
.editor-title-wrap { min-width: 0; flex: 1; display: grid; gap: 7px; }
.app-shell.editor-mode .editor-title {
  width: 100%;
  min-height: 44px;
  color: #252a30;
  font: 600 30px/1.35 Inter, "Microsoft YaHei", sans-serif;
}
.app-shell.editor-mode .editor-title::placeholder { color: #aeb4ba; }
.editor-title-count { color: #a0a6ad; font-size: 10px; }
.app-shell.editor-mode .toolbar-actions { flex: 0 0 auto; align-items: center; padding-top: 5px; }
.app-shell.editor-mode .editor-tabs { padding: 0 36px; background: #fafbfb; }
.app-shell.editor-mode .formatting-toolbar { padding: 8px 28px; background: #fff; }
.app-shell.editor-mode .image-toolbar { padding-right: 28px; padding-left: 28px; }
.app-shell.editor-mode .rich-text-editor,
.app-shell.editor-mode .markdown-editor {
  min-height: calc(100vh - 270px);
  padding: 40px 56px 120px;
}
.app-shell.editor-mode .rich-text-editor:focus { box-shadow: none; }
.app-shell.editor-mode .editor-preview { width: 100%; padding: 40px 56px 120px; }

@media (max-width: 1180px) {
  .app-shell.editor-mode .editor-shell { grid-template-columns: 220px minmax(0, 1fr); gap: 18px; padding: 20px; }
  .app-shell.editor-mode .editor-shell.outline-collapsed { grid-template-columns: 48px minmax(0, 1fr); gap: 14px; }
  .editor-outline { top: 20px; height: calc(100vh - 40px); }
  .editor-stage { padding-right: 0; }
}

@media (max-width: 760px) {
  .app-shell.editor-mode .editor-shell,
  .app-shell.editor-mode .editor-shell.outline-collapsed { display: block; padding: 0; }
  .editor-outline {
    position: fixed;
    z-index: 45;
    top: 12px;
    left: 12px;
    width: min(260px, calc(100vw - 24px));
    height: calc(100vh - 24px);
    box-shadow: 0 16px 45px rgba(25, 35, 45, .16);
  }
  .editor-shell.outline-collapsed .editor-outline { width: 44px; height: 44px; min-height: 0; border-radius: 10px; }
  .editor-shell.outline-collapsed .editor-outline-head { min-height: 42px; }
  .editor-stage { display: block; padding: 0; }
  .editor-paper { width: 100%; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
  .app-shell.editor-mode .editor-toolbar { min-height: 118px; flex-wrap: wrap; gap: 8px; padding: 18px 16px 14px 66px; }
  .app-shell.editor-mode .toolbar-actions { width: 100%; justify-content: flex-end; }
  .app-shell.editor-mode .editor-tabs { padding: 0 16px; }
  .app-shell.editor-mode .formatting-toolbar { padding: 8px 12px; }
  .editor-attachment-head { padding: 6px 12px; }
  .editor-attachment-hint { display: none; }
  .editor-attachment-body { padding: 8px 12px 12px; }
  .editor-attachment-row { align-items: flex-start; flex-wrap: wrap; }
  .editor-attachment-row .file-meta { min-width: calc(100% - 46px); }
  .app-shell.editor-mode .rich-text-editor,
  .app-shell.editor-mode .markdown-editor,
  .app-shell.editor-mode .editor-preview { padding: 28px 20px 90px; }
  .editor-title-count { display: none; }
}
