/* ==========================================================================
   My.Doc 文档协作平台 - 全局样式
   ========================================================================== */

:root {
  --brand: #3b6ef6;
  --brand-hover: #2f5ee0;
  --brand-light: #eef3ff;
  --brand-gradient: linear-gradient(135deg, #4f7cff 0%, #7a5cff 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;

  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel-soft: #fafbfe;
  --text: #1f2329;
  --text-2: #5c6370;
  --text-3: #9096a3;
  --border: #e8eaf0;
  --border-strong: #d8dce6;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 2px 8px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .12);
  --sidebar-w: 240px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cfd4e0; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #b6bdcb; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }

/* ------------------------------ 通用元件 ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all .16s ease;
  white-space: nowrap;
  user-select: none;
}

.btn:hover { border-color: #c3cad8; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary {
  background: var(--brand-gradient);
  border-color: transparent;
  color: #fff;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(59, 110, 246, .28);
}
.btn-primary:hover { filter: brightness(1.05); background: var(--brand-gradient); }

.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(59, 110, 246, .08); border-color: transparent; }

.btn-danger { color: var(--danger); border-color: #fbc9c9; }
.btn-danger:hover { background: #fff5f5; border-color: #f5a3a3; }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

.input, .textarea, .select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color .16s, box-shadow .16s;
  outline: none;
}

.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.7; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59, 110, 246, .12); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }

.form-item { margin-bottom: 18px; }
.form-item label { display: block; margin-bottom: 7px; font-size: 13px; color: var(--text-2); font-weight: 500; }
.form-tip { margin-top: 6px; font-size: 12px; color: var(--text-3); }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 26px; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 20px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  background: #f1f3f9;
  color: var(--text-2);
  font-size: 11px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty .empty-icon { font-size: 34px; opacity: .5; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 13px; }

.skeleton {
  background: linear-gradient(90deg, #f2f4f8 25%, #e9ecf3 37%, #f2f4f8 63%);
  background-size: 400% 100%;
  animation: skeleton 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------ 登录页 ------------------------------ */

.login-page {
  display: flex;
  min-height: 100vh;
  background: #fff;
}

.login-visual {
  position: relative;
  flex: 1;
  min-width: 480px;
  padding: 64px 72px;
  background: linear-gradient(150deg, #2f44c9 0%, #3b6ef6 45%, #7a5cff 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .18) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .6;
}

.login-visual::after {
  content: "";
  position: absolute;
  width: 460px;
  height: 460px;
  right: -160px;
  bottom: -180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
}

.login-visual > * { position: relative; z-index: 1; }

.brand-line { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 600; letter-spacing: .5px; }

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  font-size: 18px;
  font-weight: 700;
}

.login-headline { max-width: 460px; }
.login-headline h1 { margin: 0 0 16px; font-size: 40px; line-height: 1.28; font-weight: 700; letter-spacing: -.5px; }
.login-headline p { margin: 0; font-size: 15px; line-height: 1.9; color: rgba(255, 255, 255, .82); }

.login-features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; max-width: 520px; }
.login-feature { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: rgba(255, 255, 255, .92); }
.login-feature span.f-icon { font-size: 17px; line-height: 1.4; }

.login-panel {
  width: 520px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-box { width: 100%; max-width: 360px; }
.login-box h2 { margin: 0 0 6px; font-size: 24px; font-weight: 600; }
.login-box .sub { margin: 0 0 26px; color: var(--text-3); font-size: 13px; }

.login-tabs { display: flex; gap: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--border); }
.login-tab {
  padding: 0 0 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-2);
  cursor: pointer;
  margin-bottom: -1px;
  transition: all .16s;
}
.login-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }

.demo-tip {
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
  border: 1px dashed var(--border-strong);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.8;
}
.demo-tip b { color: var(--brand); }

/* ------------------------------ 应用框架 ------------------------------ */

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  z-index: 30;
}

.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; color: var(--text); }
.topbar .brand .brand-logo {color:white; width: 32px; height: 32px; border-radius: 9px; background: var(--brand-gradient); border: none; font-size: 15px; }

.topbar-link {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  transition: all .16s;
}
.topbar-link:hover { background: var(--brand-light); color: var(--brand); }
.topbar-link.active {color: var(--brand);background: var(--brand-light);font-weight: 600;}
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}
.topbar-search input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 38px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: all .16s;
}
.topbar-search input:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(59, 110, 246, .1); }
.topbar-search .s-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 14px; }

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 16px 12px;
  background: #fff;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.side-title {
  padding: 0 10px;
  margin: 18px 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .8px;
  color: var(--text-3);
  text-transform: uppercase;
}
.side-title:first-child { margin-top: 0; }

.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .14s, color .14s;
}
.side-item:hover { background: var(--panel-soft); color: var(--text); }
.side-item.active { background: var(--brand-light); color: var(--brand); font-weight: 500; }
.side-item .dot { width: 7px; height: 7px; border-radius: 3px; background: var(--brand); flex-shrink: 0; }
.side-item .s-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-item .s-count { font-size: 11px; color: var(--text-3); }

.main { flex: 1; min-width: 0; overflow-y: auto; padding: 24px 28px 48px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.page-head .desc { margin: 4px 0 0; font-size: 13px; color: var(--text-3); }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 14px; }
.stat-card .s-ico {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 19px;
  background: var(--brand-light); color: var(--brand);
}
.stat-card .s-val { font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat-card .s-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 文档库卡片 */
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 16px; }

.ws-card {
  position: relative;
  padding: 18px;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 148px;
}
.ws-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: #d5e0ff; }
.ws-card .ws-head { display: flex; gap: 12px; align-items: flex-start; }
.ws-card .ws-logo {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-gradient); color: #fff; font-size: 17px; font-weight: 600;
}
.ws-card .ws-name {
  font-size: 15px; font-weight: 600; margin: 0 0 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ws-card .ws-owner { font-size: 12px; color: var(--text-3); }
.ws-card .ws-desc {
  margin: 0; font-size: 12.5px; color: var(--text-2); line-height: 1.7;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ws-card .ws-foot { margin-top: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-3); }
.ws-card .ws-settings {
  background: transparent; border: 1px solid var(--border); color: var(--text-3);
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s;
  flex-shrink: 0;
}
.ws-card .ws-settings:hover {
  background: var(--brand-light); border-color: var(--brand); color: var(--brand);
}
.ws-import-export {
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border);
}
.ws-ie-title { font-size: 13px; color: var(--text-2); margin-bottom: 10px; font-weight: 600; }
.ws-ie-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.ws-ie-upload { cursor: pointer; }
.ws-ie-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.6; }
.ws-import-export .btn.is-disabled { opacity: .45; cursor: not-allowed; }
.ws-card.add-card {
  align-items: center; justify-content: center; border-style: dashed;
  color: var(--text-3); gap: 8px; font-size: 13px;
}
.ws-card.add-card:hover { color: var(--brand); border-color: var(--brand); background: #fbfcff; }

/* 列表 */
.list { display: flex; flex-direction: column; }
.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .14s;
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--panel-soft); }
.list-row .r-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.list-row .r-meta { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.section { margin-bottom: 26px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* 下拉菜单 */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 190px; padding: 6px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 60; display: none;
}
.dropdown-menu.open { display: block; animation: fadeIn .14s ease; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-2); cursor: pointer;
}
.dropdown-item:hover { background: var(--panel-soft); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: 5px 0; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* 模态框 */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(23, 28, 40, .45);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; animation: fadeIn .16s ease;
}
.modal {
  width: 100%; max-width: 480px; max-height: 86vh;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { border: none; background: none; font-size: 18px; color: var(--text-3); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--border); }

/* 提示 */
.toast-wrap { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 22px;
  background: #fff; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  font-size: 13px; animation: toastIn .22s ease;
}
.toast.success { color: #067a55; border-color: #b9ecd8; background: #f0fdf7; }
.toast.error { color: #b42318; border-color: #f8c8c8; background: #fff5f5; }
.toast.info { color: var(--brand); border-color: #cddcff; background: #f5f8ff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }

/* 加载 */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-3); font-size: 13px; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border-strong);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================ 文档页 ============================ */

.doc-app { display: flex; height: 100vh; overflow: hidden; }

.doc-side {
  width: 268px; flex-shrink: 0; display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--border);
}
.doc-side-head { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.doc-side-head .back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); cursor: pointer; margin-bottom: 8px; }
.doc-side-head .back:hover { color: var(--brand); }
.doc-side-head .ws-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.doc-side-tools { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.doc-side-tools .input { height: 32px; font-size: 13px; }
.doc-side-tools .btn { height: 32px; }

.doc-tree { flex: 1; overflow-y: auto; padding: 8px 8px 24px; }
.tree-node { user-select: none; }
.tree-row {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-2); cursor: pointer; position: relative;
}
.tree-row:hover { background: var(--panel-soft); color: var(--text); }
.tree-row.active { background: var(--brand-light); color: var(--brand); font-weight: 500; }
.tree-row .caret { width: 14px; text-align: center; font-size: 10px; color: var(--text-3); transition: transform .16s; flex-shrink: 0; }
.tree-row .caret.open { transform: rotate(90deg); }
.tree-row .t-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .t-more { opacity: 0; font-size: 14px; color: var(--text-3); padding: 0 4px; }
.tree-row:hover .t-more { opacity: 1; }
.tree-children { padding-left: 14px; }

.doc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.doc-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 22px; height: 60px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.doc-head .crumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); min-width: 0; overflow: hidden; }
.doc-head .crumb span.c { white-space: nowrap; cursor: pointer; }
.doc-head .crumb span.c:hover { color: var(--brand); }
.doc-head .doc-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.doc-body { flex: 1; min-height: 0; display: flex; }
.doc-content { flex: 1; min-width: 0; overflow-y: auto; padding: 30px 40px 80px; }
.doc-content-inner { max-width: 860px; margin: 0 auto; }

.doc-title {
  width: 100%; border: none; outline: none; padding: 0;
  font-size: 30px; font-weight: 700; line-height: 1.4;
  font-family: inherit; color: var(--text); background: transparent;
  margin-bottom: 10px;
}
.doc-title::placeholder { color: #c6cbd8; }

.doc-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 22px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
.doc-meta .m-user { display: flex; align-items: center; gap: 7px; }

.doc-aside {
  width: 280px; flex-shrink: 0; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; background: var(--panel-soft);
}
.aside-tabs { display: flex; border-bottom: 1px solid var(--border); background: #fff; }
.aside-tab {
  flex: 1; padding: 12px 0; text-align: center; font-size: 13px;
  color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent;
}
.aside-tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 500; }
.aside-body { flex: 1; overflow-y: auto; padding: 14px; }

.toc-item { display: block; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.toc-item:hover { background: #fff; color: var(--brand); }
.toc-item.lv-1 { font-weight: 500; color: var(--text); }
.toc-item.lv-3 { padding-left: 20px; font-size: 12px; }

/* 评论 */
.comment { display: flex; gap: 10px; margin-bottom: 16px; }
.comment .c-main { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.comment .c-name { font-weight: 500; color: var(--text); }
.comment .c-time { color: var(--text-3); font-size: 11.5px; }
.comment .c-text { margin: 5px 0 0; font-size: 13px; color: var(--text-2); white-space: pre-wrap; word-break: break-word; }
.comment .c-ops { display: flex; gap: 12px; margin-top: 5px; font-size: 12px; color: var(--text-3); }
.comment .c-ops span { cursor: pointer; }
.comment .c-ops span:hover { color: var(--brand); }
.comment-children { margin-top: 12px; padding-left: 14px; border-left: 2px solid var(--border); }
.comment-box { display: flex; gap: 10px; }

/* 编辑器 */
.editor-wrap { display: flex; flex-direction: column; height: 100%; }
.editor-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel-soft);
}
.editor-toolbar button {
  height: 30px; min-width: 30px; padding: 0 8px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; font-family: inherit; font-size: 13px; color: var(--text-2); cursor: pointer;
}
.editor-toolbar button:hover { background: #fff; border-color: var(--border); color: var(--brand); }
.editor-toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }

/* ------------------------------ 首页（公开文档） ------------------------------ */

.home { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }

.home-topbar {
  height: 64px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 40px;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.home-brand .brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-gradient);
  border: none;
  color: #fff;
  font-size: 16px;
}

.home-nav { display: flex; gap: 4px; }
.home-nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-2);
  transition: all .16s;
}
.home-nav-link:hover { background: var(--panel-soft); color: var(--text); }
.home-nav-link.active { color: var(--brand); background: var(--brand-light); font-weight: 600; }

.home-user { margin-left: auto; display: flex; align-items: center; }

.home-hero {
  padding: 72px 40px 56px;
  text-align: center;
  background:
    radial-gradient(900px 300px at 50% -60px, rgba(79, 124, 255, .16), transparent),
    linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}
.home-hero h1 {
  margin: 0 0 14px;
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -.6px;
  color: var(--text);
}
.home-hero p { margin: 0 0 30px; font-size: 15px; color: var(--text-2); }

.home-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}
.home-search .s-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--text-3);
  pointer-events: none;
}
.home-search input {
  flex: 1;
  height: 50px;
  padding: 0 18px 0 46px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  box-shadow: var(--shadow);
  outline: none;
  transition: all .16s;
}
.home-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(59, 110, 246, .12); }
.home-search .btn { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 12px; }

.home-body { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 40px; }

.home-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 22px;
}
.home-section-head h2 { margin: 0; font-size: 20px; font-weight: 600; }
.home-count { font-size: 13px; color: var(--text-3); }

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.doc-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform .18s, box-shadow .18s, border-color .18s;
  min-height: 156px;
}
.doc-card:hover {
  transform: translateY(-3px);
  border-color: #cdd9ff;
  box-shadow: var(--shadow-lg);
  color: var(--text);
}
.doc-card-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-card-icon { font-size: 17px; line-height: 1.5; flex-shrink: 0; }
.doc-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-card-excerpt {
  flex: 1;
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-3);
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.doc-card-ws { color: var(--brand); font-weight: 500; }

.doc-card.skeleton { pointer-events: none; }
.doc-grid-empty { grid-column: 1 / -1; padding: 40px 0; }
.sk-line { height: 12px; border-radius: 6px; background: #eef1f6; }
.sk-line.sk-title { height: 16px; width: 65%; }
.sk-line.short { width: 45%; }

.tag-public, .tag-shared, .tag-private {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-public { color: #0f9d58; background: #e8f7ef; border: 1px solid #c7ecd8; }
.tag-shared { color: #3b6ef6; background: #eef3ff; border: 1px solid #d3e0ff; }
.tag-private { color: #8a94a6; background: #f3f5f9; border: 1px solid #e3e8f0; }

.dropdown-label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .4px;
  color: var(--text-3);
}

/* 菜单内的对照说明：提示文档级与文档库级可见范围不一致 */
.dropdown-hint {
  padding: 6px 10px 8px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-3);
  background: var(--bg-2, #f7f8fa);
  border-top: 1px dashed var(--border);
  margin-top: 4px;
  cursor: default;
}

/* 文件库 / 账号管理：表格与工具栏 */
.file-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.file-search { max-width: 320px; }
.file-cats { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 500;
}

.file-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.file-table thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  background: var(--panel-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.file-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: middle;
}
.file-table tbody tr:hover { background: var(--panel-soft); }
.file-table tbody tr:last-child td { border-bottom: none; }

.file-id { color: var(--text-3); font-variant-numeric: tabular-nums; }
.file-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.file-icon { font-size: 16px; flex-shrink: 0; }
.file-title {
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}
.file-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.file-ops .btn[disabled] { opacity: .45; cursor: not-allowed; }

.file-upload-btn { cursor: pointer; }
.file-upload-btn input { display: none; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 0 4px;
}
.pager-text { font-size: 13px; color: var(--text-3); }

/* 页面右上角操作区 */
.page-actions { display: flex; gap: 8px; align-items: center; }

.admin-only.hidden { display: none; }

.home-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 36px;
  flex-wrap: wrap;
}
.pager-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .16s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.pager-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pager-btn:disabled { opacity: .45; cursor: not-allowed; }
.pager-ellipsis { color: var(--text-3); padding: 0 4px; }

.home-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 40px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
  background: #fff;
}

/* 版本号显示 */
.app-version { font-size: 12.5px; color: var(--text-3); }

.side-version {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-3);
  opacity: .75;
}

@media (max-width: 860px) {
  .home-topbar { padding: 0 20px; gap: 16px; }
  .home-hero { padding: 48px 20px 40px; }
  .home-hero h1 { font-size: 28px; }
  .home-body { padding: 24px 20px; }
  .home-footer { padding: 20px; }
  .login-visual { display: none; }
  .login-panel { width: 100%; }
}
.editor-split { flex: 1; min-height: 0; display: flex; }
.editor-split textarea {
  flex: 1; min-width: 0; padding: 24px 28px; border: none; outline: none; resize: none;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.9; color: #1f2329; background: #fff;
}
.editor-split .preview {
  flex: 1; min-width: 0; overflow-y: auto; padding: 24px 28px;
  border-left: 1px solid var(--border); background: var(--panel-soft);
}
.editor-foot {
  display: flex; align-items: center; gap: 14px;
  padding: 8px 18px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3); background: #fff;
}
.editor-foot .dot-saving { color: var(--warning); }
.editor-foot .dot-saved { color: var(--success); }

/* Markdown 渲染 */
.markdown-body { font-size: 15px; line-height: 1.85; color: #24292f; word-wrap: break-word; }
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  margin: 1.6em 0 .6em; font-weight: 600; line-height: 1.4;
}
.markdown-body h1 { font-size: 26px; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 21px; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 17px; }
.markdown-body h4 { font-size: 15px; }
.markdown-body p { margin: 0 0 1em; }
.markdown-body ul, .markdown-body ol { margin: 0 0 1em; padding-left: 1.6em; }
.markdown-body li { margin: .3em 0; }
.markdown-body blockquote {
  margin: 0 0 1em; padding: 10px 16px;
  border-left: 3px solid var(--brand); border-radius: 0 6px 6px 0;
  background: #f7f9ff; color: var(--text-2);
}
.markdown-body code {
  padding: .18em .42em; border-radius: 4px; background: #f1f3f9;
  font-family: var(--mono); font-size: .88em; color: #d6336c;
}
.markdown-body pre {
  margin: 0 0 1em; padding: 16px 18px; overflow: auto;
  background: #1f2430; border-radius: var(--radius); line-height: 1.7;
}
.markdown-body pre code { padding: 0; background: transparent; color: #e6e8ef; font-size: 13px; }
.markdown-body table { width: 100%; margin: 0 0 1em; border-collapse: collapse; font-size: 13.5px; }
.markdown-body th, .markdown-body td { padding: 9px 13px; border: 1px solid var(--border); text-align: left; }
.markdown-body th { background: var(--panel-soft); font-weight: 600; }
.markdown-body img { max-width: 100%; border-radius: var(--radius); }
.markdown-body hr { height: 1px; margin: 1.8em 0; border: none; background: var(--border); }
.markdown-body a { border-bottom: 1px solid rgba(59, 110, 246, .35); }

/* 搜索结果 */
.search-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 70; max-height: 420px; overflow-y: auto; }
.search-item { padding: 11px 15px; border-bottom: 1px solid var(--border); cursor: pointer; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--panel-soft); }
.search-item .si-title { font-size: 13.5px; font-weight: 500; }
.search-item .si-sum { font-size: 12px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .si-path { font-size: 11.5px; color: var(--brand); margin-top: 4px; }

/* 标签视图：标签云与筛选 */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; }

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.tag-chip:hover { border-color: var(--brand); }
.tag-chip.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}
.tag-chip .chip-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tag-chip .chip-count {
  font-size: 11px;
  color: var(--text-3);
  background: var(--panel-soft);
  border-radius: 10px;
  padding: 0 6px;
}
.tag-chip.active .chip-count { background: #fff; color: var(--brand); }
.tag-chip .chip-acts { display: none; gap: 2px; margin-left: 2px; }
.tag-chip:hover .chip-acts { display: inline-flex; }
.tag-chip .chip-acts button {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-3);
  padding: 0 3px;
  line-height: 1;
}
.tag-chip .chip-acts button:hover { color: var(--brand); }

.row-tags { display: inline-flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; }
.doc-tag-link { cursor: pointer; }

/* 公开首页标签栏 */
.home-tags:empty { display: none; }
.home-tags { margin-bottom: 18px; }
.home-tags .tag-cloud {
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.doc-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 2px 0 10px; }

/* 公开文档库卡片（首页） */
.pub-ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.pub-ws-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: box-shadow .18s, transform .18s, border-color .18s;
  display: flex;
  flex-direction: column;
}
.pub-ws-card:hover {
  box-shadow: 0 6px 20px rgba(15, 23, 42, .08);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.pub-ws-card.skeleton { cursor: default; transform: none; }

.pub-ws-head { display: flex; align-items: center; gap: 10px; }
.pub-ws-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pub-ws-head-main { min-width: 0; }
.pub-ws-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pub-ws-count { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.pub-ws-desc {
  margin: 10px 0;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.pub-ws-docs {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: auto;
}
.pub-ws-doc {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.pub-ws-doc:hover { background: var(--panel-soft); }
.pub-ws-doc-ico { font-size: 13px; flex-shrink: 0; }
.pub-ws-doc-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pub-ws-doc-date { font-size: 12px; color: var(--text-3); flex-shrink: 0; }
.pub-ws-nodoc { padding: 8px 4px; font-size: 12.5px; color: var(--text-3); }

/* 拖拽提示 */
.drop-target { outline: 2px dashed var(--brand); outline-offset: -2px; background: #f5f8ff; }

/* 同级排序插入位置指示 */
.drop-above { box-shadow: inset 0 2px 0 0 var(--brand); background: #f5f8ff; }
.drop-below { box-shadow: inset 0 -2px 0 0 var(--brand); background: #f5f8ff; }
.tree-row.dragging { opacity: .45; }

@media (max-width: 1180px) {
  .doc-aside { display: none; }
}
@media (max-width: 980px) {
  .login-visual { display: none; }
  .login-panel { width: 100%; }
  .sidebar { display: none; }
  .doc-side { width: 220px; }
}

