:root {
  color-scheme: light;
  --text: #1f2329;
  --muted: #646a73;
  --accent: #245bdb;
  --accent-hover: #1746b2;
  --selected: #eaf0ff;
  --sidebar: #f7f8fa;
  --border: #e4e7ed;
  --paper: #fff;
  --error: #a9262c;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--paper);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; line-height: 1.5; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid #83a7ff; outline-offset: 3px; }
input { caret-color: var(--accent); }
::selection { background: #d6e3ff; color: #122b5f; }
* { scrollbar-width: thin; scrollbar-color: #bec5d0 transparent; }
h1, h2, p { margin: 0; }
h1, h2 { text-wrap: balance; }
.icon { width: 20px; height: 20px; display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; }
.icon svg { display: block; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 700; letter-spacing: -.035em; width: fit-content; }
.brand-mark { display: grid; place-items: center; background: var(--accent); color: white; width: 32px; height: 34px; border-radius: 8px; }
.brand-mark .icon { width: 22px; height: 22px; }
.language-switch { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.language-switch > .icon { margin-right: 2px; width: 17px; }
.language-switch svg { width: 17px; }
.language { padding: 5px 4px; border: 0; background: transparent; color: var(--muted); border-radius: 4px; }
.language:hover { color: var(--accent); background: var(--selected); }
.language.active { color: var(--accent); font-weight: 600; }
.language-divider { color: #b0b5be; }
.login-page { min-height: 100vh; display: flex; flex-direction: column; }
.login-header { height: 96px; padding: 0 56px; display: flex; align-items: center; justify-content: space-between; }
.login-main { display: grid; grid-template-columns: 1.1fr 1fr; align-items: center; width: min(1080px, calc(100% - 112px)); margin: auto; gap: 120px; padding: 44px 0 64px; }
.login-intro { align-self: center; padding: 20px 0; }
.intro-symbol { color: var(--accent); margin-bottom: 25px; }
.intro-symbol .icon, .intro-symbol svg { width: 36px; height: 36px; }
.login-intro h1 { font-size: clamp(34px, 3.2vw, 46px); line-height: 1.2; font-weight: 650; letter-spacing: -.035em; white-space: pre-line; }
.intro-copy { margin-top: 24px; font-size: 16px; color: var(--muted); max-width: 370px; line-height: 1.8; white-space: pre-line; }
.intro-preview { margin-top: 48px; display: grid; grid-template-columns: 66px 1fr; background: #f3f6fc; border-radius: 12px; padding: 20px 22px 0 0; max-width: 440px; overflow: hidden; height: 206px; }
.preview-sidebar { padding: 3px 15px; }
.preview-avatar { display: grid; place-items: center; background: #dce7ff; color: var(--accent); border-radius: 7px; width: 30px; height: 30px; font-size: 13px; font-weight: 700; margin-bottom: 26px; }
.preview-paper { background: white; border-radius: 7px 7px 0 0; padding: 24px; box-shadow: 0 6px 24px #2548810a; }
.preview-paper > .icon { color: var(--accent); margin-bottom: 10px; }
.preview-paper h2 { font-size: 15px; font-weight: 650; }
.preview-paper p { font-size: 10px; color: var(--muted); margin: 8px 0 17px; }
.preview-line { height: 5px; width: 100%; background: #e8edf5; border-radius: 2px; margin: 10px 0; }
.preview-line.short { width: 66%; }
.login-panel { width: 100%; max-width: 380px; }
.login-panel > h2 { font-size: 27px; font-weight: 650; letter-spacing: -.02em; }
.panel-description { color: var(--muted); margin: 9px 0 34px; }
.login-panel label { display: block; font-weight: 550; margin: 20px 0 8px; font-size: 13px; }
.login-panel input { width: 100%; height: 44px; border: 1px solid #c5cbd4; border-radius: 6px; padding: 0 12px; color: var(--text); background: white; transition: border-color .15s; }
.login-panel input:hover { border-color: #8c96a6; }
.login-panel input:focus { border-color: var(--accent); }
.login-panel input::placeholder { color: var(--muted); font-size: 13px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; background: var(--accent); color: white; min-height: 40px; padding: 10px 20px; border: 0; border-radius: 6px; font-weight: 550; transition: background .15s; }
.primary-button:hover { background: var(--accent-hover); }
.sign-in { width: 100%; margin-top: 27px; height: 44px; }
.test-accounts { margin-top: 28px; border-top: 1px solid var(--border); padding-top: 22px; }
.test-accounts h2 { font-size: 13px; font-weight: 600; }
.test-accounts > p { color: var(--muted); font-size: 12px; margin: 5px 0 13px; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: 12px; margin: 8px 0; }
.account-row span { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: #38465b; }
.test-accounts .test-password { display: flex; justify-content: space-between; gap: 12px; border-top: 1px dashed var(--border); margin: 14px 0 0; padding-top: 12px; }
.login-footer { padding: 22px 24px 28px; text-align: center; font-size: 12px; color: var(--muted); }
.error-banner { display: flex; align-items: flex-start; gap: 9px; background: #fff0f0; color: var(--error); font-size: 13px; border-radius: 6px; padding: 11px 13px; margin-top: 18px; }
.error-banner p { flex: 1; }
.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: var(--sidebar); border-right: 1px solid var(--border); padding: 26px 14px 0; }
.sidebar > .brand { margin-left: 12px; font-size: 22px; }
.space-identity { display: flex; align-items: center; gap: 10px; padding: 30px 10px 24px; min-width: 0; }
.space-avatar { width: 36px; height: 36px; display: grid; place-items: center; color: #6d48b1; font-weight: 650; background: #eae1f8; border-radius: 9px; flex: 0 0 auto; }
.space-identity strong { font-size: 14px; font-weight: 600; }
.space-caption { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; }
.nav-link { display: flex; gap: 10px; align-items: center; border-radius: 6px; min-height: 39px; padding: 9px 12px; color: #464c56; font-size: 13px; }
.nav-link:hover { background: #edf0f5; }
.nav-link.selected { background: var(--selected); color: var(--accent); font-weight: 550; }
.nav-caption { margin: 28px 12px 9px; color: var(--muted); font-size: 10px; letter-spacing: .04em; font-weight: 600; }
.sidebar nav { min-height: 0; overflow: auto; }
.sidebar-documents { display: flex; flex-direction: column; gap: 3px; }
.document-link span:not(.icon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-link .icon { color: #798395; width: 17px; }
.document-link svg { width: 17px; height: 17px; }
.document-link.selected .icon { color: var(--accent); }
.sidebar-bottom { margin-top: auto; padding-top: 24px; }
.preview-notice { display: flex; gap: 9px; color: var(--muted); padding: 14px 12px; margin-bottom: 18px; }
.preview-notice > .icon { width: 15px; height: 17px; }
.preview-notice svg { width: 15px; height: 17px; }
.preview-notice strong { font-size: 11px; font-weight: 550; }
.preview-notice p { font-size: 10px; line-height: 1.7; margin-top: 3px; }
.user-row { display: flex; gap: 9px; align-items: center; border-top: 1px solid var(--border); padding: 18px 4px; }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; background: #e0eafa; color: #31538a; border-radius: 50%; font-size: 12px; font-weight: 600; }
.user-info { flex: 1; min-width: 0; }
.user-info strong { display: block; font-size: 12px; font-weight: 550; }
.user-info > span { display: block; font-size: 10px; color: var(--muted); }
.icon-button { border: 0; background: transparent; width: 30px; height: 34px; display: grid; place-items: center; border-radius: 5px; color: var(--muted); }
.icon-button:hover { background: #e7ebf2; color: var(--text); }
.main-panel { min-width: 0; }
.main-panel > .error-banner { margin: 20px 32px; }
.workspace-topbar { height: 64px; padding: 0 32px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.breadcrumbs { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--muted); font-size: 12px; }
.breadcrumbs a { display: flex; align-items: center; gap: 8px; min-width: 0; }
.breadcrumbs a span:not(.icon) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .icon, .breadcrumbs svg { width: 16px; height: 16px; }
.breadcrumb-current { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.breadcrumb-current .icon { color: #a0a6af; width: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 24px; flex-shrink: 0; }
.read-only-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); background: #f5f6f8; padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.read-only-badge .icon, .read-only-badge svg { width: 12px; height: 12px; }
.workspace-content { padding: 52px 56px; max-width: 1400px; margin: 0 auto; }
.heading-icon { display: grid; place-items: center; width: 48px; height: 48px; color: var(--accent); background: var(--selected); border-radius: 11px; margin-bottom: 20px; }
.heading-icon .icon, .heading-icon svg { width: 27px; height: 27px; }
.workspace-heading h1 { font-size: 30px; line-height: 1.35; letter-spacing: -.025em; font-weight: 650; }
.workspace-heading p { color: var(--muted); margin-top: 12px; font-size: 14px; }
.documents-section { margin-top: 48px; }
.section-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 17px; }
.section-heading h2 { font-size: 15px; font-weight: 600; }
.document-count { font-size: 11px; color: var(--muted); }
.document-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.document-table th { color: var(--muted); font-size: 11px; font-weight: 500; height: 38px; border-bottom: 1px solid var(--border); }
.document-table td { border-bottom: 1px solid #eff0f3; font-size: 12px; color: var(--muted); }
.document-table tbody tr:hover { background: #f9faff; }
.document-table .author-column { width: 124px; padding-left: 12px; }
.document-table .date-column { width: 132px; padding-left: 12px; font-variant-numeric: tabular-nums; }
.document-table .arrow-column { width: 28px; text-align: right; color: #8c94a0; }
.arrow-column .icon { width: 14px; }
.document-title-link { display: flex; align-items: center; gap: 14px; padding: 22px 10px 22px 4px; width: 100%; }
.document-title-link > div { min-width: 0; }
.document-title-link strong { display: block; color: var(--text); font-size: 14px; font-weight: 550; overflow-wrap: anywhere; }
.document-title-link:hover strong { color: var(--accent); }
.document-title-link p { margin-top: 5px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-icon { display: grid; place-items: center; width: 32px; height: 38px; color: var(--accent); flex: 0 0 auto; }
.file-icon .icon, .file-icon svg { width: 26px; height: 28px; }
.workspace-footnote { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-top: 26px; }
.workspace-footnote .icon, .workspace-footnote svg { width: 13px; height: 13px; }
.reading-area { padding: 54px 56px 90px; }
.document-paper { max-width: 760px; margin: 0 auto; }
.reader-file-icon { color: var(--accent); display: block; margin-bottom: 22px; }
.reader-file-icon .icon, .reader-file-icon svg { width: 34px; height: 38px; }
.document-paper h1 { font-size: 32px; line-height: 1.35; font-weight: 650; letter-spacing: -.025em; overflow-wrap: anywhere; }
.document-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 20px; }
.author-dot { height: 20px; width: 20px; display: inline-block; border-radius: 50%; background: #e0eafa; }
.meta-separator { margin: 0 2px; }
.document-body { margin-top: 38px; max-width: 72ch; }
.document-body p { font-size: 16px; line-height: 1.9; margin-bottom: 22px; white-space: pre-wrap; overflow-wrap: anywhere; }
.document-footer { display: flex; align-items: center; gap: 7px; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 44px; color: var(--muted); font-size: 11px; }
.document-footer .icon, .document-footer svg { width: 13px; height: 13px; }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 80px 24px; gap: 14px; }
.empty-state > .icon { width: 32px; height: 32px; color: #7b8ba5; }
.empty-state > .icon svg { width: 32px; height: 32px; }
.empty-state h1 { font-size: 25px; }
.empty-state h2 { font-size: 18px; }
.empty-state p { color: var(--muted); max-width: 420px; }
.failure-state { padding-top: 120px; }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 7px 14px; border-radius: 4px; }
.text-button:hover { background: var(--selected); }
.loading-page { padding: 32px; min-height: 100vh; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; height: 65vh; color: var(--muted); }
.spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid #dae3f7; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media (max-width: 1100px) {
  .login-main { gap: 65px; }
  .workspace-content { padding: 42px 32px; }
  .document-table .author-column { width: 104px; }
  .reading-area { padding: 42px 40px 70px; }
}
@media (max-width: 800px) {
  .login-header { height: 80px; padding: 0 28px; }
  .login-main { width: calc(100% - 56px); grid-template-columns: 1fr; justify-items: center; gap: 0; padding: 30px 0 40px; }
  .login-intro { display: none; }
  .login-panel { max-width: 380px; }
  .app-shell { grid-template-columns: 204px minmax(0, 1fr); }
  .sidebar { padding-left: 10px; padding-right: 10px; }
  .sidebar > .brand { margin-left: 8px; }
  .workspace-topbar { padding: 0 20px; }
  .topbar-actions { gap: 12px; }
  .read-only-badge { display: none; }
  .workspace-content { padding: 36px 24px; }
  .document-table .author-column { display: none; }
  .document-table .date-column { width: 105px; font-size: 10px; }
  .document-title-link { gap: 8px; }
  .document-title-link strong { font-size: 13px; }
  .reading-area { padding: 38px 28px 60px; }
}
@media (max-width: 600px) {
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; padding: 14px 20px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar > .brand { margin: 0; font-size: 20px; flex: 1; }
  .sidebar .brand-mark { width: 28px; height: 30px; }
  .space-identity, .sidebar nav, .preview-notice { display: none; }
  .sidebar-bottom { margin: 0; padding: 0; }
  .user-row { border: 0; padding: 0; }
  .user-info { display: none; }
  .user-avatar { width: 28px; height: 28px; }
  .workspace-topbar { height: 54px; padding: 0 20px; gap: 8px; }
  .breadcrumbs { font-size: 11px; flex: 1; }
  .breadcrumb-current { display: none; }
  .language-switch { font-size: 11px; gap: 3px; }
  .language-switch > .icon { display: none; }
  .language { min-height: 34px; }
  .workspace-content { padding: 32px 20px; }
  .heading-icon { width: 40px; height: 40px; margin-bottom: 16px; }
  .workspace-heading h1 { font-size: 27px; }
  .workspace-heading p { line-height: 1.75; font-size: 13px; }
  .documents-section { margin-top: 34px; }
  .document-table .date-column, .document-table .arrow-column { display: none; }
  .document-title-link { padding: 20px 0; gap: 12px; }
  .document-title-link strong { font-size: 14px; }
  .document-title-link p { max-width: 250px; }
  .workspace-footnote { font-size: 10px; align-items: flex-start; }
  .reading-area { padding: 32px 24px 60px; }
  .document-paper h1 { font-size: 27px; }
  .document-body { margin-top: 30px; }
  .document-body p { font-size: 16px; line-height: 1.85; }
  .login-header { padding: 0 24px; }
  .login-header .brand { font-size: 21px; }
  .login-main { width: calc(100% - 48px); padding-top: 34px; }
  .login-panel > h2 { font-size: 26px; }
  .login-footer { font-size: 10px; }
  .failure-state { padding-top: 70px; }
  .main-panel > .error-banner { margin: 16px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Operate within the existing paper: metadata, durable-save status, tools, prose. */
.document-savebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 28px; min-height: 38px; font-size: 12px; color: var(--muted); }
.document-savebar [data-save-status="error"] { color: var(--error); }
.document-savebar .text-button { flex-shrink: 0; min-height: 36px; }
.document-editing { margin-top: 12px; }
.document-editing .panel-controls { border-block: 1px solid var(--border); padding: 10px 0; }
.document-editing .format-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.document-editing .format-toolbar select { max-width: 140px; min-height: 34px; border: 1px solid var(--border); border-radius: 4px; background: var(--paper, #fff); padding: 4px 8px; color: var(--text); font: inherit; }
.document-editing .tool { min-height: 34px; padding: 5px 10px; border: 0; border-radius: 4px; background: transparent; color: var(--text); }
.document-editing .tool:hover { background: #f5f6f8; }
.document-editing .tool[aria-pressed="true"] { color: var(--accent); background: var(--selected); }
.document-editing .tool code { font-size: 12px; }
.document-editing .tool:disabled, .document-savebar button:disabled { opacity: .5; cursor: default; }
.document-editing .link-form { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; }
.document-editing .link-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.document-editing .link-form input { flex: 1 1 180px; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 12px; }
.document-editing .link-form .text-button { padding: 7px 10px; font-size: 12px; }
.document-editing .blocks-surface { padding: 28px 0 0; min-height: 360px; line-height: 1.9; }
.document-editing .blocks-surface h1 { font-size: 30px; }
.document-editing .blocks-surface:focus-visible { outline-offset: 6px; }
.document-editing .blocks-unsupported { margin-top: 24px; padding: 20px; }
.document-editing .field-error { color: var(--error); font-size: 12px; margin-top: 8px; }
@media (max-width: 600px) {
  .document-savebar { align-items: flex-start; gap: 8px; margin-top: 20px; }
  .document-savebar > span { padding-top: 8px; }
  .document-editing .blocks-surface { min-height: 320px; padding-top: 24px; }
  .document-editing .blocks-surface h1 { font-size: 27px; }
}

.document-savebar .connection-status { margin-right: auto; }
.document-savebar [data-connection-status="connected"] { color: var(--accent); }
@media (max-width: 600px) { .document-savebar { flex-wrap: wrap; } .document-savebar .connection-status { flex-basis: 100%; } }
