:root {
  --green: #00b96b;
  --green-hover: #00a35d;
  --green-soft: #e8f8f0;
  --green-border: #b7ebd4;
  --text: #262626;
  --text-2: #51565d;
  --text-3: #8f959e;
  --text-4: #b8bcc4;
  --bg: #f7f8fa;
  --surface: #fff;
  --border: #e8e9eb;
  --hover: #f2f3f5;
  --danger: #f54a45;
  --gold: #f5b301;
  --shadow: 0 6px 24px rgba(31, 35, 41, 0.08);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font-family: inherit; }
button { color: inherit; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, p { margin: 0; }
img { max-width: 100%; }
::selection { background: #b9f0d5; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d9dce1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #c4c8ce; }
::-webkit-scrollbar-track { background: transparent; }

.ic { flex-shrink: 0; display: block; }

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.boot {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: 13px;
  letter-spacing: 0.5px;
}

/* ------------------------------- topbar -------------------------------- */

.topbar {
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 30;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, #00c97a, #00a35d);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(0, 185, 107, 0.28);
}

.brand-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0.6px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(430px, 38vw);
  height: 34px;
  padding: 0 12px;
  background: #f2f3f5;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s, border-color 0.15s;
}
.search-trigger:hover { background: #eceef0; border-color: #e2e4e7; }
.search-trigger kbd {
  margin-left: auto;
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-trigger {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  transition: box-shadow 0.15s;
}
.avatar-trigger:hover { box-shadow: 0 0 0 3px #e8f8f0; }

.avatar {
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 600;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
}

/* ------------------------------- layout -------------------------------- */

.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

.main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

.page-home { max-width: 1080px; }

.page-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 20px;
}

/* ----------------------------- global sidebar -------------------------- */

.global-sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  overflow-y: auto;
}

.gs-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 12px;
  border-radius: 7px;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.14s, color 0.14s;
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: var(--green-soft); color: var(--green); font-weight: 500; }

.gs-section { margin-top: 24px; }

.gs-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 8px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, color 0.14s;
}
.icon-btn:hover { background: var(--hover); color: var(--text-2); }
.icon-btn.active { color: var(--gold); }
.icon-btn.xs { width: 22px; height: 22px; }

.gs-ws-list { display: flex; flex-direction: column; gap: 1px; }

.gs-ws {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
}
.gs-ws:hover { background: var(--hover); }
.gs-ws.active { background: var(--green-soft); color: var(--green); }

.ws-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.gs-ws-name {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-ws-count { font-size: 11px; color: var(--text-4); }
.gs-empty { padding: 8px; font-size: 12px; color: var(--text-3); }

.gs-bottom {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ----------------------------- workspace sidebar ----------------------- */

.ws-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ws-side-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 14px 10px;
}

.back-home {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.back-home:hover { background: var(--hover); color: var(--text-2); }

.ws-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ws-name-wrap { min-width: 0; flex: 1; }
.ws-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px 6px;
  font-size: 12px;
  color: var(--text-3);
}

.doc-tree {
  flex: 1;
  overflow-y: auto;
  padding: 2px 8px 12px;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-2);
  font-size: 13px;
  padding-right: 6px;
  user-select: none;
}
.tree-row:hover { background: var(--hover); }
.tree-row.active { background: var(--green-soft); color: var(--green); font-weight: 500; }
.tree-row.active .tree-icon { color: var(--green); }

.tree-toggle {
  width: 18px;
  height: 18px;
  border: none;
  background: none;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--text-4);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.15s;
}
.tree-toggle.expanded { transform: rotate(90deg); }
.tree-toggle.placeholder { visibility: hidden; }

.tree-icon { color: var(--text-4); display: flex; flex-shrink: 0; }

.tree-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tree-add {
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--text-3);
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  flex-shrink: 0;
}
.tree-row:hover .tree-add { opacity: 1; }
.tree-add:hover { background: #e4e6e9; color: var(--text); }

.tree-empty {
  padding: 22px 12px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
  line-height: 1.8;
}

.ws-side-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.ws-side-footer button {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 10px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}
.ws-side-footer button:hover { background: var(--hover); }

/* -------------------------------- buttons ------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-2);
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.btn:hover { border-color: #d4d7db; background: #fafbfc; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #e03d38; border-color: #e03d38; }
.btn-danger-ghost { color: var(--danger); border-color: #ffd4d2; background: #fff; }
.btn-danger-ghost:hover { background: #fff5f5; border-color: #ffb8b5; }

.link-btn {
  border: none;
  background: none;
  color: var(--green);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 5px;
}
.link-btn:hover { background: var(--green-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: #fff1f0; }

/* --------------------------------- home -------------------------------- */

.home-hero {
  background: linear-gradient(120deg, #e9fbf3 0%, #f4f9ff 55%, #fff 100%);
  border: 1px solid #e3f2ea;
  border-radius: 14px;
  padding: 26px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.home-hero h1 { font-size: 23px; font-weight: 600; letter-spacing: -0.2px; }
.home-hero p { color: var(--text-3); font-size: 13.5px; margin-top: 8px; }
.hero-actions { flex-shrink: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-value { font-size: 21px; font-weight: 600; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

.home-section { margin-bottom: 30px; }

/* 首页快速上手 */
.tutorial-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.tutorial-card {
  position: relative;
  overflow: hidden;
  padding: 18px 16px 16px;
  background: linear-gradient(180deg, #fff, #fbfdfc);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.tutorial-card::after {
  content: '';
  position: absolute;
  top: -28px;
  right: -28px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 185, 107, 0.1), transparent 70%);
}
.tutorial-card:hover {
  transform: translateY(-3px);
  border-color: var(--green-border);
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}
.tutorial-step {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  font-weight: 700;
  color: #c9cdd3;
  letter-spacing: 0.5px;
}
.tutorial-icon {
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--green-soft);
  color: var(--green);
}
.tutorial-card h3 { margin-bottom: 5px; font-size: 13.5px; font-weight: 600; }
.tutorial-card p { font-size: 12.5px; line-height: 1.65; color: var(--text-3); }
@media (max-width: 900px) {
  .tutorial-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tutorial-grid { grid-template-columns: 1fr; }
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 16px; font-weight: 600; }
.section-head .muted { font-size: 12px; color: var(--text-3); }

.list-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
}

.doc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  background: none;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}
.doc-row:hover { background: #f8f9fa; }

.doc-row-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f2f7ff;
  color: #3370ff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.doc-row-main { flex: 1; min-width: 0; }
.doc-row-title {
  font-size: 13.5px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-row-sub {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-row-arrow { color: var(--text-4); display: flex; }

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
}

.ws-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  cursor: pointer;
  transition: box-shadow 0.16s, transform 0.16s, border-color 0.16s;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.ws-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: #dfe2e6;
}

.ws-card-top { display: flex; gap: 11px; align-items: center; }
.ws-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ws-card-name {
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ws-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}
.ws-card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11.5px;
  color: var(--text-3);
}
.ws-card-foot .dot { color: var(--text-4); }

.badge {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #f2f3f5;
  color: var(--text-3);
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  vertical-align: middle;
}
.badge.public { background: var(--green-soft); color: var(--green); }
.badge.role { background: #eef3ff; color: #3370ff; }

.empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  line-height: 1.9;
}
.empty .empty-icon { color: var(--text-4); margin-bottom: 8px; display: flex; justify-content: center; }
.empty strong { display: block; color: var(--text-2); font-weight: 500; margin-bottom: 4px; font-size: 13.5px; }

/* ------------------------------ workspace ------------------------------ */

.ws-hero {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 26px 28px;
  margin-bottom: 26px;
}
.ws-hero-main { display: flex; gap: 18px; align-items: flex-start; }
.ws-big-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ws-hero h1 {
  font-size: 24px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ws-hero-desc {
  color: var(--text-3);
  font-size: 13.5px;
  margin-top: 8px;
  line-height: 1.65;
  max-width: 640px;
}
.ws-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.ws-meta .avatar { margin-right: -6px; border: 2px solid #fff; }
.ws-hero-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.doc-list {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
}
.doc-list-row {
  display: flex;
  gap: 14px;
  padding: 15px 16px;
  border-radius: 9px;
  cursor: pointer;
  align-items: flex-start;
  transition: background 0.12s;
}
.doc-list-row:hover { background: #f8f9fa; }
.doc-list-row + .doc-list-row { border-top: 1px solid #f3f4f6; }
.dlr-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: #f6f7f9;
  color: var(--text-3);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dlr-main { flex: 1; min-width: 0; }
.dlr-title {
  font-size: 14.5px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dlr-excerpt {
  font-size: 12.5px;
  color: var(--text-3);
  margin-top: 5px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dlr-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ------------------------------- document ------------------------------ */

.doc-layout {
  display: flex;
  gap: 36px;
  padding: 24px 36px 60px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  align-items: flex-start;
}
.doc-main { flex: 1; min-width: 0; max-width: 880px; }

.doc-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  min-height: 32px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-3);
  flex-wrap: wrap;
  min-width: 0;
}
.crumbs button {
  border: none;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12.5px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbs button:hover { color: var(--green); background: var(--green-soft); }
.crumbs .sep { color: var(--text-4); }

.doc-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.doc-article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.doc-inner { padding: 38px 48px 44px; }

.doc-title {
  font-size: 32px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.3px;
  word-break: break-word;
}
.doc-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-3);
  flex-wrap: wrap;
}
.doc-meta .divider { color: var(--text-4); }

.doc-divider {
  height: 1px;
  background: #f0f1f3;
  margin: 26px 0 28px;
}

.doc-banner {
  background: #fff7e6;
  border: 1px solid #ffe2b3;
  color: #ad6800;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.doc-toc {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 6px 0;
}
.toc-title {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  padding: 0 12px 8px;
  letter-spacing: 0.4px;
}
.toc-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-left: 2px solid transparent;
  background: none;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.5;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-item:hover { color: var(--green); background: var(--green-soft); }
.toc-item.active { color: var(--green); border-left-color: var(--green); background: var(--green-soft); }
.toc-item.lvl-2 { padding-left: 24px; font-size: 12px; }
.toc-item.lvl-3 { padding-left: 36px; font-size: 12px; color: var(--text-3); }
.toc-item.lvl-4 { padding-left: 46px; font-size: 11.5px; color: var(--text-3); }
.toc-meta {
  margin-top: 16px;
  padding: 12px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.toc-meta > div { display: flex; align-items: center; gap: 6px; }
.toc-share { color: var(--green); display: flex; gap: 6px; align-items: center; }

/* -------------------------------- markdown ----------------------------- */

.markdown { font-size: 15px; line-height: 1.85; color: #333; word-wrap: break-word; }
.markdown > *:first-child { margin-top: 0; }
.markdown h1, .markdown h2, .markdown h3,
.markdown h4, .markdown h5, .markdown h6 {
  font-weight: 600;
  color: var(--text);
  line-height: 1.45;
  margin: 34px 0 14px;
  scroll-margin-top: 24px;
}
.markdown h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin-top: 42px;
  padding-bottom: 12px;
  border-bottom: 1px solid #eef0f2;
  background: linear-gradient(90deg, var(--green), rgba(0, 185, 107, 0.06)) left bottom / 100% 2px no-repeat;
}
.markdown h2 {
  font-size: 22px;
  padding: 2px 0 2px 12px;
  border-left: 3px solid var(--green);
  border-radius: 1px;
}
.markdown h3 { font-size: 18px; color: #1f2329; }
.markdown h4 { font-size: 16px; }
.markdown h5 { font-size: 15px; }
.markdown h6 { font-size: 14px; color: var(--text-3); letter-spacing: 0.3px; }

.md-font-sans { font-family: var(--font); }
.md-font-serif { font-family: "Songti SC", "STSong", "SimSun", "宋体", serif; }
.md-font-kai { font-family: "Kaiti SC", "STKaiti", "KaiTi", "楷体", serif; }
.md-font-hei { font-family: "Heiti SC", "STHeiti", "SimHei", "黑体", sans-serif; }
.md-font-mono { font-family: var(--mono); }

.md-align { margin: 14px 0; }
.md-align-left { text-align: left; }
.md-align-center { text-align: center; }
.md-align-right { text-align: right; }
.md-align-justify { text-align: justify; }
.md-align > :first-child { margin-top: 0; }
.md-align > :last-child { margin-bottom: 0; }
.markdown p { margin: 14px 0; }
.markdown a { color: var(--green); }
.markdown a:hover { text-decoration: underline; }
.markdown strong { font-weight: 600; color: #1f2329; }
.markdown del { color: var(--text-3); }
.markdown ul, .markdown ol { margin: 14px 0; padding-left: 26px; }
.markdown li { margin: 6px 0; }
.markdown li > ul, .markdown li > ol { margin: 6px 0; }
.markdown li.task-item { list-style: none; margin-left: -22px; }
.markdown li.task-item input { margin-right: 7px; accent-color: var(--green); }
.markdown blockquote {
  margin: 18px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--green);
  background: #f7fbf9;
  color: #4e5969;
  border-radius: 0 6px 6px 0;
}
.markdown blockquote p { margin: 4px 0; }
.markdown code {
  background: #f2f3f5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
  font-family: var(--mono);
  color: #c7254e;
}
.markdown pre {
  background: #f7f8fa;
  border: 1px solid #eef0f2;
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 18px 0;
  line-height: 1.65;
}
.markdown pre code {
  background: none;
  padding: 0;
  color: #333;
  font-size: 13px;
  font-family: var(--mono);
}
.markdown hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}
.markdown img {
  max-width: min(100%, 640px);
  max-height: 440px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 22px auto;
  border-radius: 12px;
  border: 1px solid rgba(17, 24, 39, 0.05);
  background: #fafbfc;
  box-shadow: 0 6px 24px rgba(17, 24, 39, 0.09);
  cursor: zoom-in;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.markdown img:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 44px rgba(17, 24, 39, 0.16);
}
@media (max-width: 720px) {
  .markdown img { max-height: 320px; }
}

/* 视频播放器 */
.markdown .md-video { margin: 20px 0; }
.markdown .md-video video {
  display: block;
  width: 100%;
  max-height: 540px;
  border-radius: 10px;
  background: #000;
  outline: none;
  box-shadow: 0 2px 12px rgba(31, 35, 41, 0.12);
}
.markdown .md-video figcaption {
  margin-top: 8px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
}

/* 附件卡片 */
.markdown .md-file {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s, transform 0.16s;
}
.markdown .md-file:hover {
  border-color: var(--green-border);
  background: var(--green-soft);
  box-shadow: 0 4px 14px rgba(0, 185, 107, 0.1);
  transform: translateY(-1px);
  text-decoration: none;
}
.markdown .md-file-badge {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(0, 185, 107, 0.12);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.markdown .md-file-info { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.markdown .md-file-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}
.markdown .md-file-hint { font-size: 11.5px; color: var(--text-3); }

.markdown .table-wrap {
  margin: 20px 0;
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 3px 14px rgba(17, 24, 39, 0.04);
}
.markdown table { width: 100%; min-width: 420px; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.markdown th, .markdown td {
  padding: 11px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid #f1f2f4;
  word-break: break-word;
}
.markdown th {
  background: linear-gradient(180deg, #f8fafc, #eef1f4);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  border-bottom-color: #e6e8eb;
}
.markdown td { color: #3c4149; }
.markdown td:first-child { font-weight: 500; color: var(--text-2); }
.markdown tr:last-child td { border-bottom: none; }
.markdown th:last-child, .markdown td:last-child { border-right: none; }
.markdown th:first-child { border-top-left-radius: 11px; }
.markdown th:last-child { border-top-right-radius: 11px; }
.markdown tbody tr:last-child td:first-child { border-bottom-left-radius: 11px; }
.markdown tbody tr:last-child td:last-child { border-bottom-right-radius: 11px; }
.markdown tbody tr { transition: background 0.14s; }
.markdown tbody tr:nth-child(even) { background: #fbfcfd; }
.markdown tbody tr:hover { background: #f4fbf7; }
.markdown .align-left { text-align: left; }
.markdown .align-center { text-align: center; }
.markdown .align-right { text-align: right; }

.md-table-style { margin: 20px 0; }
.md-table-style > :first-child { margin-top: 0; }
.md-table-style > :last-child { margin-bottom: 0; }
.md-table-striped .markdown tbody tr:nth-child(odd),
.md-table-striped .table-wrap tbody tr:nth-child(odd) { background: #fff; }
.md-table-striped .table-wrap tbody tr:nth-child(even) { background: #f6f8fa; }
.md-table-grid .table-wrap { border-color: #dfe3e8; }
.md-table-grid .markdown th,
.md-table-grid .markdown td,
.md-table-grid .table-wrap th,
.md-table-grid .table-wrap td { border: 1px solid #e3e6ea; }
.md-table-grid .table-wrap th { background: linear-gradient(180deg, #f3f6f9, #e9eef3); }
.md-table-compact .table-wrap { margin: 14px 0; }
.md-table-compact .markdown th,
.md-table-compact .markdown td,
.md-table-compact .table-wrap th,
.md-table-compact .table-wrap td { padding: 6px 10px; font-size: 12.5px; }
.md-table-brand .table-wrap { border-color: #b7ebd4; box-shadow: 0 4px 16px rgba(0, 185, 107, 0.1); }
.md-table-brand .table-wrap th {
  background: linear-gradient(180deg, #00c97a, #00a35d);
  color: #fff;
  border-bottom-color: #00a35d;
}
.md-table-brand .table-wrap td { border-right-color: #e9f6ef; }
.md-table-brand .table-wrap tbody tr:nth-child(even) { background: #f4fbf7; }
.md-table-brand .table-wrap tbody tr:hover { background: #e8f8f0; }

/* -------------------------------- comments ----------------------------- */

.comments {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  padding-top: 26px;
}
.comments h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.comments h3 span { color: var(--text-3); font-weight: 400; font-size: 13px; }

.comment { display: flex; gap: 10px; padding: 13px 0; }
.comment + .comment { border-top: 1px solid #f5f6f7; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.comment-head .name { font-weight: 500; color: var(--text-2); }
.comment-head .time { color: var(--text-3); font-size: 11.5px; }
.comment-del {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  opacity: 0;
}
.comment:hover .comment-del { opacity: 1; }
.comment-del:hover { color: var(--danger); background: #fff1f0; }
.comment-text {
  font-size: 13.5px;
  line-height: 1.7;
  margin-top: 5px;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.comment-form { display: flex; gap: 10px; margin-top: 18px; align-items: flex-start; }
.comment-form textarea {
  flex: 1;
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13.5px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.65;
  background: #fafbfc;
  outline: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.comment-form textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 185, 107, 0.08);
}
.comment-form .btn { margin-top: 2px; }

/* --------------------------------- editor ------------------------------ */

.editor-topbar { margin-bottom: 14px; }
.editing-tag {
  margin-left: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 500;
}

.editor-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: clip;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 220px);
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.03);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.editor-card:focus-within {
  border-color: rgba(0, 185, 107, 0.3);
  box-shadow: 0 0 0 3px rgba(0, 185, 107, 0.05), 0 12px 40px rgba(31, 35, 41, 0.06);
}

.editor-titlebar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 30px 40px 10px;
}

.editor-title {
  flex: 1;
  min-width: 0;
  border: none;
  padding: 0;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.35;
  outline: none;
  font-family: inherit;
  color: var(--text);
  background: transparent;
  caret-color: var(--green);
}
.editor-title::placeholder { color: #c9cdd4; font-weight: 500; }

.title-align {
  flex-shrink: 0;
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  background: #f2f3f5;
  border-radius: 8px;
}
.title-align-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--text-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.14s, color 0.14s;
}
.title-align-btn svg { width: 14px; height: 14px; display: block; }
.title-align-btn:hover { color: var(--text-2); }
.title-align-btn.active {
  background: #fff;
  color: var(--green);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}

.editor-badge {
  flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(0, 185, 107, 0.18);
  background: var(--green-soft);
  color: var(--green);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 26px 8px 30px;
  border-top: 1px solid #f4f5f7;
  border-bottom: 1px solid #f0f1f3;
  background: rgba(252, 253, 254, 0.92);
  backdrop-filter: blur(12px);
}
.editor-tools {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1px;
}
.md-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  border-radius: 8px;
  color: #5f646b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, transform 0.12s;
}
.md-btn svg { width: 16px; height: 16px; display: block; }
.md-btn:hover { background: var(--green-soft); color: var(--green); }
.md-btn:active { transform: scale(0.92); }

.md-menu-wrap { position: relative; display: inline-flex; }
.md-menu-wrap.open > .md-btn,
.md-btn[aria-expanded="true"] { background: var(--green-soft); color: var(--green); }
.md-caret {
  width: 9px;
  height: 9px;
  margin-left: 1px;
  opacity: 0.55;
  transition: transform 0.18s;
}
.md-menu-wrap.open .md-caret { transform: rotate(180deg); }

/* 文字颜色 */
.md-color-trigger { position: relative; width: 40px; }
.md-color-letter { font-size: 14px; font-weight: 600; line-height: 1; }
.md-color-bar {
  position: absolute;
  left: 9px;
  bottom: 6px;
  width: 11px;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, #f54a45, #f2994a, #00b96b, #3370ff, #7f3bf5);
}
.md-color-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 208px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.16);
  animation: mdMenuIn 0.14s ease-out;
}
.md-color-menu[hidden] { display: none; }
.md-color-grid { display: flex; align-items: center; gap: 8px; }
.md-color-item {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #e3e5e8;
  cursor: pointer;
  transition: transform 0.14s, box-shadow 0.14s;
}
.md-color-item span { display: block; width: 100%; height: 100%; border-radius: 50%; }
.md-color-item:hover { transform: scale(1.14); box-shadow: 0 0 0 1px var(--green); }
.md-color-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid #f2f3f5;
}
.md-color-custom-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  padding: 3px 6px;
  border-radius: 6px;
  transition: background 0.14s;
}
.md-color-custom-wrap:hover { background: var(--hover); }
.md-color-custom {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #e3e5e8;
  border-radius: 6px;
  background: none;
  cursor: pointer;
}
.md-color-custom::-webkit-color-swatch-wrapper { padding: 2px; }
.md-color-custom::-webkit-color-swatch { border: none; border-radius: 4px; }
.md-color-clear {
  margin-left: auto;
  padding: 3px 6px;
  border: none;
  background: none;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
}
.md-color-clear:hover { color: var(--danger); background: #fff1f0; }

/* 标题层级 */
.md-heading-trigger {
  width: 40px;
  gap: 0;
  font-size: 14px;
  font-weight: 700;
}
.md-heading-label { line-height: 1; letter-spacing: 0.2px; }
.md-font-trigger, .md-align-trigger, .md-table-trigger { width: 40px; gap: 0; }
.md-font-label { font-size: 14px; font-weight: 600; line-height: 1; }
.md-align-trigger > svg:first-child,
.md-table-trigger > svg:first-child { width: 15px; height: 15px; }
.md-align-trigger .md-caret,
.md-table-trigger .md-caret { margin-left: 0; }
.md-h-tag svg { width: 13px; height: 13px; display: block; }

.md-table-menu { min-width: 190px; }
.md-table-item { height: auto; padding: 6px 8px; gap: 10px; }
.md-table-thumb {
  width: 42px;
  height: 26px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1px;
  padding: 2px;
  border: 1px solid #e1e5ea;
  border-radius: 4px;
  background: #fff;
  overflow: hidden;
}
.md-table-thumb b { display: block; background: #fff; border-radius: 1px; }
.md-table-thumb b:nth-child(-n + 3) { background: #e8edf2; }
.md-table-thumb-striped b:nth-child(7),
.md-table-thumb-striped b:nth-child(8),
.md-table-thumb-striped b:nth-child(9) { background: #f3f6f9; }
.md-table-thumb-grid { gap: 0; padding: 0; }
.md-table-thumb-grid b { border: 1px solid #e1e5ea; border-radius: 0; }
.md-table-thumb-compact { width: 34px; height: 20px; }
.md-table-thumb-brand { border-color: #b7ebd4; }
.md-table-thumb-brand b:nth-child(-n + 3) { background: #00b96b; }
.md-heading-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 148px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.16);
  animation: mdMenuIn 0.14s ease-out;
}
.md-heading-menu[hidden] { display: none; }
.md-heading-item {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 32px;
  padding: 0 9px;
  border: none;
  background: none;
  border-radius: 7px;
  color: var(--text-2);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.md-heading-item:hover { background: var(--green-soft); color: var(--green); }
.md-h-tag {
  width: 26px;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.2px;
}
.md-heading-item:hover .md-h-tag { color: var(--green); }

@keyframes mdMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.md-sep {
  width: 1px;
  height: 18px;
  margin: 0 7px;
  background: #e9eaec;
  flex-shrink: 0;
}

.editor-tabs {
  flex-shrink: 0;
  display: flex;
  gap: 2px;
  padding: 3px;
  background: #f1f2f4;
  border-radius: 9px;
}
.editor-tabs .tab-btn {
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 12px;
  padding: 5px 13px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.editor-tabs .tab-btn:hover { color: var(--text-2); }
.editor-tabs .tab-btn.active {
  background: #fff;
  color: var(--green);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(31, 35, 41, 0.1);
}

.editor-panes { flex: 1; display: flex; min-height: 440px; background: #fff; }
.editor-textarea {
  flex: 1;
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 26px 44px 72px;
  font-size: 14.5px;
  line-height: 1.95;
  font-family: var(--mono);
  color: #33354a;
  caret-color: var(--green);
  background: transparent;
  min-height: 440px;
  tab-size: 2;
}
.editor-textarea::placeholder { color: #c2c6cc; }
.editor-textarea::selection { background: rgba(0, 185, 107, 0.15); }
.editor-preview { flex: 1; padding: 22px 44px 64px; overflow-y: auto; width: 100%; }

.editor-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 32px;
  border-top: 1px solid #f0f1f3;
  font-size: 11.5px;
  color: var(--text-3);
  background: #fbfcfd;
}
.save-status { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 500; }
.save-status::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}
.save-status.dirty { color: #f2994a; }
.save-status.saving { color: var(--text-3); }
.save-status.error { color: var(--danger); }
.status-sep { width: 1px; height: 12px; background: #e8e9eb; }
.status-item { color: var(--text-3); white-space: nowrap; }
.editor-shortcut {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #a5a9b0;
}
.editor-shortcut kbd {
  font-family: inherit;
  font-size: 10.5px;
  padding: 1px 6px;
  border: 1px solid #e3e5e8;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: #7a7f87;
}

/* --------------------------------- modal ------------------------------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px 24px;
  z-index: 100;
  overflow-y: auto;
}
.modal {
  background: #fff;
  border-radius: 12px;
  width: 480px;
  max-width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  padding: 24px;
  animation: modalIn 0.18s ease;
}
.modal-wide { width: 680px; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.7; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 11px;
  height: 36px;
  font-size: 13.5px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { height: auto; padding: 9px 11px; resize: vertical; min-height: 74px; line-height: 1.6; }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8f959e 50%), linear-gradient(135deg, #8f959e 50%, transparent 50%); background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 185, 107, 0.08);
}
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.form-error {
  background: #fff1f0;
  color: var(--danger);
  border: 1px solid #ffd4d2;
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
  display: none;
}
.form-error.show { display: block; }

.swatches { display: flex; gap: 9px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  transition: transform 0.14s, border-color 0.14s;
}
.swatch input:checked + span { border-color: #262626; transform: scale(1.05); }

.member-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 320px;
  overflow-y: auto;
  margin-bottom: 16px;
}
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 7px; }
.member-row:hover { background: #f8f9fa; }
.member-main { flex: 1; min-width: 0; }
.member-name { font-size: 13.5px; font-weight: 500; }
.member-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.member-role { font-size: 11.5px; color: var(--text-3); flex-shrink: 0; }
.member-row .icon-btn { width: 24px; height: 24px; }
.add-member { display: flex; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; flex-wrap: wrap; }
.add-member input {
  flex: 1;
  min-width: 140px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  font-size: 13px;
  outline: none;
}
.add-member input:focus { border-color: var(--green); }
.add-member select {
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 8px;
  font-size: 13px;
  background: #fff;
  outline: none;
}

.share-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  margin: 6px 0 14px;
}
.share-row-main { flex: 1; }
.share-row-main strong { font-size: 13.5px; font-weight: 500; }
.share-row-main .muted { font-size: 12px; color: var(--text-3); margin-top: 3px; line-height: 1.6; }

.switch {
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: #d6d8db;
  border: none;
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.18s;
  padding: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }

.share-link { display: flex; gap: 8px; margin-top: 12px; }
.share-link input {
  flex: 1;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--text-2);
  background: #fafbfc;
  outline: none;
}

.version-list { display: flex; flex-direction: column; max-height: 380px; overflow-y: auto; }
.version-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 8px;
  border-bottom: 1px solid #f2f3f5;
}
.version-row:hover { background: #f8f9fa; }
.version-info { flex: 1; min-width: 0; }
.version-title { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.version-preview {
  max-height: 52vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  background: #fafbfc;
  margin-top: 8px;
}

/* --------------------------------- search ------------------------------ */

.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 22, 0.4);
  z-index: 110;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 12vh;
}
.search-dialog {
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: 66vh;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.16s ease;
}
.search-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  color: var(--text-3);
}
.search-input-row input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: transparent;
}
.search-input-row input::placeholder { color: var(--text-4); }
.search-input-row kbd {
  font-family: var(--font);
  font-size: 11px;
  color: var(--text-3);
  background: #f2f3f5;
  border-radius: 4px;
  padding: 2px 6px;
}
.search-results { overflow-y: auto; padding: 8px; flex: 1; }
.search-result {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  padding: 11px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.search-result:hover { background: #f5f7f9; }
.sr-title { font-size: 14px; font-weight: 500; color: var(--text); }
.sr-sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.sr-snippet {
  font-size: 12.5px;
  color: var(--text-2);
  margin-top: 4px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-results mark { background: #e6fbf1; color: var(--green); padding: 0 2px; border-radius: 2px; }
.search-hint { padding: 30px 24px; text-align: center; color: var(--text-3); font-size: 13px; line-height: 1.8; }

/* --------------------------------- toast ------------------------------- */

#toast-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: #262626;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: toastIn 0.2s ease;
}
.toast.error { background: var(--danger); }

/* ------------------------------- dropdown ------------------------------ */

.user-wrap { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 6px;
  min-width: 198px;
  z-index: 60;
}
.dropdown[hidden] { display: none; }
.user-menu-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 10px;
  border-bottom: 1px solid #f2f3f5;
  margin-bottom: 5px;
}
.um-name { font-size: 13.5px; font-weight: 600; }
.um-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-divider { height: 1px; background: #f2f3f5; margin: 5px 4px; }
.menu-wrap { position: relative; }
.doc-menu { top: calc(100% + 6px); }

/* ---------------------------------- auth ------------------------------- */

body.auth-mode { background: #f6fbf8; }
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: radial-gradient(1200px 600px at 20% 0%, #e6fbf1 0%, transparent 55%),
    radial-gradient(900px 500px at 90% 100%, #eef4ff 0%, transparent 60%), #fafbfc;
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-brand .brand-mark { width: 38px; height: 38px; font-size: 21px; border-radius: 11px; }
.auth-brand .brand-name { font-size: 22px; }

.auth-card {
  width: 400px;
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 12px 48px rgba(31, 35, 41, 0.07);
}
.auth-card h1 { font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.auth-sub { font-size: 13px; color: var(--text-3); margin-bottom: 22px; }
.auth-form label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.auth-form input {
  width: 100%;
  height: 38px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 185, 107, 0.08); }
.auth-form .btn { width: 100%; height: 38px; margin-top: 6px; font-size: 14px; }
.auth-switch { font-size: 13px; color: var(--text-3); text-align: center; margin-top: 18px; }
.auth-demo {
  margin-top: 18px;
  padding: 10px 12px;
  background: #f7fbf9;
  border: 1px dashed var(--green-border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.8;
}
.demo-fill {
  border: none;
  background: none;
  color: var(--green);
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  text-decoration: underline;
}

/* -------------------------------- settings ----------------------------- */

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 24px; }
.form-card h2 { font-size: 16px; font-weight: 600; margin-bottom: 18px; }
.avatar-preview-row { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.avatar-lg { width: 56px; height: 56px; font-size: 22px; }
.form-card .btn { margin-top: 6px; }

/* ------------------------------- animations ---------------------------- */

@keyframes modalIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ------------------------------- responsive ---------------------------- */

@media (max-width: 1080px) {
  .doc-toc { display: none; }
  .doc-layout { padding: 20px 22px 48px; }
}

@media (max-width: 900px) {
  .global-sidebar { display: none; }
  .ws-sidebar { width: 240px; }
  .page { padding: 20px 18px 48px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .settings-grid { grid-template-columns: 1fr; }
  .doc-inner { padding: 26px 22px 34px; }
  .doc-layout { padding: 14px 14px 40px; }
  .ws-hero-main { flex-wrap: wrap; }
  .ws-hero-actions { margin-left: 0; width: 100%; }
  .home-hero { flex-direction: column; align-items: flex-start; }
  .search-trigger { width: 200px; }
  .search-trigger kbd { display: none; }
}

@media (max-width: 720px) {
  .ws-sidebar { display: none; }
  .topbar { gap: 12px; padding: 0 12px; }
  .brand-name { display: none; }
  .search-trigger { width: auto; flex: 1; }
  .doc-title { font-size: 24px; }
  .editor-titlebar { padding: 20px 20px 6px; }
  .editor-title { font-size: 22px; }
  .editor-toolbar { padding: 6px 14px; }
  .editor-status { padding: 8px 16px; gap: 8px; }
  .editor-shortcut { display: none; }
  .editor-textarea, .editor-preview { padding-left: 20px; padding-right: 20px; }
  .stat-grid { gap: 10px; }
  .stat-card { padding: 12px 14px; }
}

/* -------------------------------- 系统管理 ------------------------------- */

.admin-page { max-width: 1160px; }

.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.admin-head .page-title { margin-bottom: 0; }
.admin-sub { font-size: 13px; color: var(--text-3); margin-top: 6px; }
.admin-head-actions { display: flex; align-items: center; gap: 10px; }

.admin-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 11px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-3);
  transition: border-color .15s, box-shadow .15s;
}
.admin-search:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.admin-search input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  width: 190px;
  color: var(--text);
}

.admin-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.admin-stats .stat-card { padding: 14px 16px; gap: 10px; }
.admin-stats .stat-value { font-size: 19px; }

.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.admin-tab {
  position: relative;
  border: none;
  background: none;
  padding: 10px 14px 12px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 6px 6px 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.admin-tab:hover { color: var(--text); background: var(--hover); }
.admin-tab.active { color: var(--green); font-weight: 500; }
.admin-tab.active::after {
  content: '';
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--green);
}
.admin-tab span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  background: #f2f3f5;
  border-radius: 9px;
  padding: 1px 7px;
}
.admin-tab.active span { color: var(--green); background: var(--green-soft); }

.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.admin-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.admin-card-head h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-count { font-size: 12px; font-weight: 400; color: var(--text-3); }

.admin-filter { display: flex; gap: 6px; }
.admin-chip {
  height: 26px;
  padding: 0 11px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 12px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .15s;
}
.admin-chip:hover { border-color: var(--green-border); color: var(--green); }
.admin-chip.active { background: var(--green-soft); border-color: transparent; color: var(--green); font-weight: 500; }

.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-3);
  padding: 10px 18px;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td { padding: 12px 18px; border-bottom: 1px solid #f1f2f3; vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafcfa; }
.admin-th-right { text-align: right; }

.admin-user { display: flex; align-items: center; gap: 10px; min-width: 160px; }
.admin-user-name { font-weight: 500; display: flex; align-items: center; gap: 6px; }
.admin-user-sub { font-size: 12px; color: var(--text-3); }
.admin-role {
  font-size: 11px;
  font-weight: 500;
  color: var(--green);
  background: var(--green-soft);
  border-radius: 4px;
  padding: 1px 6px;
}
.admin-muted { color: var(--text-3); white-space: nowrap; }
.admin-num { font-weight: 500; color: var(--text); }
.admin-actions { white-space: nowrap; text-align: right; }
.admin-actions .link-btn { margin-left: 8px; }

.admin-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 4px;
  background: #f2f3f5;
  color: var(--text-3);
  white-space: nowrap;
}
.admin-tag.public { background: var(--green-soft); color: var(--green); }
.admin-tag.deleted { background: #fdecec; color: #d93026; }

.admin-ws-link, .admin-doc-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.admin-ws-link:hover, .admin-doc-link:hover { color: var(--green); }
.admin-doc-title { font-weight: 500; }
.admin-ws-dot {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}

.admin-empty { padding: 36px 20px; text-align: center; color: var(--text-3); font-size: 13px; }
.admin-reset-tip { font-size: 13px; color: var(--text-2); margin-bottom: 14px; line-height: 1.6; }

@media (max-width: 1180px) {
  .admin-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-search input { width: 120px; }
  .admin-head { align-items: flex-start; }
  .admin-actions { text-align: left; }
}

/* --------------------------- 后台美化与卡片跳转 --------------------------- */

/* 可点击统计卡片：button 元素重置 + 悬停箭头 */
button.stat-card { font: inherit; text-align: left; width: 100%; }
.stat-card.is-link { cursor: pointer; position: relative; }
.stat-card.is-link .stat-go {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translate(-4px, -50%);
  display: inline-flex;
  color: var(--green);
  opacity: 0;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.stat-card.is-link:hover { border-color: var(--green-border); box-shadow: 0 6px 18px rgba(0, 185, 107, .10); }
.stat-card.is-link:hover .stat-go { opacity: 1; transform: translate(0, -50%); }
.stat-card.is-link:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.admin-stats .stat-card { border-radius: 12px; }
.admin-stats .stat-icon { border-radius: 10px; }

/* 标签页：分段控件风格 */
.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: none;
  background: #f2f3f5;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
  overflow-x: auto;
  width: fit-content;
  max-width: 100%;
}
.admin-tab { border-radius: 7px; padding: 7px 16px; white-space: nowrap; transition: background .15s, box-shadow .15s; }
.admin-tab:hover { background: rgba(255, 255, 255, .7); }
.admin-tab.active { background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .10); }
.admin-tab.active::after { display: none; }

/* 卡片与表格质感 */
.admin-card { border-radius: 12px; box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.admin-card-head { background: linear-gradient(180deg, #fff, #fcfdfd); }
.admin-table tbody tr { transition: background .12s; }

/* 评论内容两行截断 */
.admin-comment-text {
  max-width: 340px;
  min-width: 200px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.6;
  word-break: break-all;
}

/* 页面标题装饰 */
.admin-head .page-title {
  background: linear-gradient(120deg, var(--text), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  width: fit-content;
}

@media (prefers-reduced-motion: reduce) {
  .stat-card.is-link .stat-go { transition: none; }
  .admin-tab { transition: none; }
}

/* ---------------------------- 视觉与动效优化 ---------------------------- */

:root {
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 10px 28px rgba(17, 24, 39, 0.07);
  --shadow-lg: 0 20px 52px rgba(17, 24, 39, 0.12);
}

@keyframes zqFadeUp {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: none; }
}
@keyframes zqFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes zqMenuIn {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.page { animation: zqFadeUp 0.34s var(--ease) both; }

/* 顶栏 */
.topbar { box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02), 0 6px 18px rgba(17, 24, 39, 0.03); }
.brand-mark { transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-4deg) scale(1.04); box-shadow: 0 6px 16px rgba(0, 185, 107, 0.32); }
.search-trigger { transition: background 0.16s, border-color 0.16s, box-shadow 0.16s; }
.search-trigger:hover { box-shadow: var(--shadow-sm); }

/* 按钮与焦点 */
.btn {
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
    box-shadow 0.16s var(--ease), transform 0.12s var(--ease), color 0.16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(17, 24, 39, 0.06); }
.btn:active { transform: translateY(0) scale(0.98); box-shadow: none; }
.btn-primary { box-shadow: 0 3px 10px rgba(0, 185, 107, 0.22); }
.btn-primary:hover { box-shadow: 0 7px 18px rgba(0, 185, 107, 0.28); }
.btn:disabled { transform: none; box-shadow: none; }
.icon-btn { transition: background 0.14s var(--ease), color 0.14s var(--ease), transform 0.14s var(--ease); }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }

:focus-visible { outline: 2px solid rgba(0, 185, 107, 0.5); outline-offset: 2px; }

/* 侧栏与目录 */
.nav-item, .gs-ws, .tree-row { transition: background 0.15s var(--ease), color 0.15s var(--ease), transform 0.15s var(--ease); }
.gs-ws:hover, .tree-row:hover { transform: translateX(2px); }
.nav-item:active, .gs-ws:active, .tree-row:active { transform: scale(0.99); }

/* 卡片与列表 */
.stat-card, .card { transition: box-shadow 0.22s var(--ease), transform 0.22s var(--ease), border-color 0.22s var(--ease); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #e2e6ea; }
.stat-card { animation: zqFadeUp 0.4s var(--ease) both; }
.stat-grid .stat-card:nth-child(2) { animation-delay: 0.04s; }
.stat-grid .stat-card:nth-child(3) { animation-delay: 0.08s; }
.stat-grid .stat-card:nth-child(4) { animation-delay: 0.12s; }
.stat-grid .stat-card:nth-child(5) { animation-delay: 0.16s; }
.stat-grid .stat-card:nth-child(6) { animation-delay: 0.2s; }
.stat-grid .stat-card:nth-child(2) .stat-icon { background: #eef3ff; color: #3370ff; }
.stat-grid .stat-card:nth-child(3) .stat-icon { background: #fff7e6; color: #d48806; }
.stat-grid .stat-card:nth-child(4) .stat-icon { background: #f4edff; color: #7f3bf5; }
.stat-grid .stat-card:nth-child(5) .stat-icon { background: #e8f7fb; color: #00a2c7; }
.stat-grid .stat-card:nth-child(6) .stat-icon { background: #fdeeee; color: #d93026; }

.ws-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.ws-card:active { transform: translateY(-1px) scale(0.995); }

.doc-list-row { transition: background 0.16s var(--ease), box-shadow 0.16s var(--ease); }
.doc-list-row:hover { background: #f7faf8; box-shadow: inset 3px 0 0 var(--green); }
.doc-list-row .doc-row-arrow { opacity: 0.35; transition: transform 0.18s var(--ease), opacity 0.18s; }
.doc-list-row:hover .doc-row-arrow { opacity: 1; transform: translateX(3px); }
.doc-list-row .dlr-icon { transition: background 0.18s, color 0.18s; }
.doc-list-row:hover .dlr-icon { background: var(--green-soft); color: var(--green); }

.doc-row { transition: background 0.15s var(--ease), transform 0.15s var(--ease); }
.doc-row:hover { transform: translateX(2px); }

/* 首页与知识库头部 */
.home-hero {
  position: relative;
  overflow: hidden;
  padding: 24px 26px;
  border-radius: 16px;
  border: 1px solid #e2f5eb;
  background: linear-gradient(120deg, #eafaf1 0%, #f7fffb 48%, #ffffff 100%);
}
.home-hero::before,
.home-hero::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.home-hero::before {
  right: -50px;
  top: -90px;
  width: 230px;
  height: 230px;
  background: radial-gradient(circle at 40% 40%, rgba(0, 185, 107, 0.18), rgba(0, 185, 107, 0) 68%);
}
.home-hero::after {
  right: 120px;
  bottom: -110px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle at 50% 50%, rgba(51, 112, 255, 0.08), rgba(51, 112, 255, 0) 68%);
}
.home-hero > div { position: relative; z-index: 1; }
.home-hero h1 { letter-spacing: -0.3px; }

.ws-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff 0%, #f7fcfa 100%);
  box-shadow: var(--shadow-sm);
}
.ws-hero::after {
  content: '';
  position: absolute;
  right: -60px;
  top: -90px;
  width: 240px;
  height: 240px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 40% 40%, rgba(0, 185, 107, 0.12), rgba(0, 185, 107, 0) 68%);
}
.ws-hero-main { position: relative; z-index: 1; }
.ws-big-icon { box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14); }

.badge.shared { background: #eef3ff; color: #3370ff; }
.badge[hidden] { display: none; }

/* 弹层与菜单 */
.modal-overlay { animation: zqFade 0.18s ease both; backdrop-filter: blur(2px); }
.modal { animation: modalIn 0.22s var(--ease) both; }
.dropdown { animation: zqMenuIn 0.16s var(--ease) both; transform-origin: top right; }
.menu-item { transition: background 0.13s var(--ease), color 0.13s var(--ease); }
.toast { animation: toastIn 0.24s var(--ease) both; }

/* 后台表格 */
.admin-table tbody tr { transition: background 0.14s var(--ease); }
.admin-chip { transition: all 0.16s var(--ease); }
.admin-tab span { transition: background 0.16s, color 0.16s; }

/* 公开分享页 */
.public-article { animation: zqFadeUp 0.4s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* -------------------------------- 媒体插入 ------------------------------- */

.media-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: #f4f6f8;
  border-radius: 9px;
  margin-bottom: 16px;
}
.media-tab {
  flex: 1;
  height: 32px;
  border: none;
  background: none;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s, box-shadow 0.16s;
}
.media-tab:hover { color: var(--text); }
.media-tab.active {
  background: #fff;
  color: var(--text);
  font-weight: 500;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.08);
}
.media-pane[hidden] { display: none; }

.media-drop {
  width: 100%;
  min-height: 158px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px dashed #d9dde3;
  border-radius: 10px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.18s var(--ease), background 0.18s, transform 0.18s var(--ease);
}
.media-drop:hover {
  border-color: var(--green);
  background: #f7fdfa;
  transform: translateY(-1px);
}
.media-drop.has-file { border-color: var(--green); background: var(--green-soft); }
.media-drop-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--green);
  background: #e9f9f1;
  margin-bottom: 2px;
}
.media-drop strong { font-size: 13px; font-weight: 500; color: var(--text); }
.media-hint { font-size: 12px; color: var(--text-3); text-align: center; }
.media-file {
  max-width: 100%;
  margin-top: 4px;
  font-size: 12px;
  color: var(--green);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.media-note { margin-top: 12px; font-size: 12px; line-height: 1.65; color: var(--text-3); }
.media-pane .field + .field { margin-top: 12px; }

.media-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.media-tab .ic { color: var(--text-3); transition: color 0.16s; }
.media-tab.active .ic { color: var(--green); }

.media-url {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 12px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.16s var(--ease), box-shadow 0.16s, background 0.16s;
}
.media-url > .ic { color: var(--text-3); }
.media-url input,
.media-url input:focus {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: none;
  background: none;
  box-shadow: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
}
.media-url:focus-within {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 185, 107, 0.12);
}

.media-preview {
  min-height: 148px;
  margin-bottom: 6px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, #fbfcfd, #f5f7f9);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), background 0.18s, box-shadow 0.18s;
}
.media-preview img {
  max-width: 100%;
  max-height: 168px;
  border-radius: 6px;
  object-fit: contain;
  display: block;
  box-shadow: 0 4px 16px rgba(17, 24, 39, 0.12);
}
.media-preview video {
  width: 100%;
  max-height: 168px;
  border-radius: 6px;
  background: #000;
  object-fit: contain;
  display: block;
}
.media-preview[data-state='ok'] { border-color: var(--green-border); background: #f7fdfa; }
.media-preview[data-state='error'] { border-color: #f5c6c3; background: #fff8f7; }
.media-preview[data-state='loading'] { animation: mediaPulse 1.1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .media-preview[data-state='loading'] { animation: none; }
}

.media-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 12px;
}
.media-preview-empty .ic { color: #c2c8d0; }
.media-preview [hidden] { display: none; }

.media-preview-status {
  min-height: 18px;
  margin-bottom: 10px;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  color: var(--text-3);
}
.media-preview-status.is-ok { color: var(--green); }
.media-preview-status.is-error { color: var(--danger); }

@keyframes mediaPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.62; }
}

@media (max-width: 560px) {
  .media-preview { min-height: 118px; }
  .media-preview img,
  .media-preview video { max-height: 136px; }
}

/* ------------------------------ 首页视觉升级 ----------------------------- */

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(0, 185, 107, 0.18);
  color: var(--green);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  backdrop-filter: blur(4px);
}
.home-hero .hero-copy { max-width: 560px; }
.home-hero h1 { font-size: 27px; font-weight: 650; letter-spacing: -0.4px; }
.home-hero p { color: var(--text-2); font-size: 14px; margin-top: 9px; line-height: 1.7; }
.home-hero .hero-actions { position: relative; z-index: 1; display: flex; gap: 10px; flex-wrap: wrap; }

.section-head h2 { display: flex; align-items: center; gap: 9px; }
.section-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--green);
  background: var(--green-soft);
}
.section-icon.blue { color: #3370ff; background: #eef3ff; }
.section-icon.amber { color: #d48806; background: #fff7e6; }

.list-card { box-shadow: var(--shadow-sm); }
.list-card .doc-row-icon { transition: background 0.18s, color 0.18s, transform 0.18s var(--ease); }
.list-card .doc-row:hover .doc-row-icon { background: var(--green-soft); color: var(--green); transform: scale(1.04); }

.ws-card { position: relative; overflow: hidden; }
.ws-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--ws-color, var(--green));
  opacity: 0.85;
}
.ws-card::after {
  content: '';
  position: absolute;
  right: -46px;
  top: -56px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--ws-color, #00b96b), transparent 68%);
  opacity: 0.08;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.ws-card:hover::after { opacity: 0.16; transform: scale(1.08); }
.ws-card:hover {
  box-shadow: var(--shadow-md);
  border-color: #e2e7e4;
  transform: translateY(-3px);
}
.ws-card-icon { transition: transform 0.24s var(--ease), box-shadow 0.24s var(--ease); }
.ws-card:hover .ws-card-icon {
  transform: scale(1.06) rotate(-3deg);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.18);
}
.ws-card-arrow {
  margin-left: auto;
  display: flex;
  color: var(--text-4);
  opacity: 0;
  transform: translateX(-5px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), color 0.2s;
}
.ws-card:hover .ws-card-arrow { opacity: 1; transform: none; color: var(--green); }
.ws-card-name, .ws-card-desc, .ws-card-foot { position: relative; z-index: 1; }

/* 图片灯箱 */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(15, 20, 18, 0.84);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}
.img-lightbox.open { opacity: 1; visibility: visible; }
.img-lightbox figure {
  margin: 0;
  max-width: min(1100px, 94vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: scale(0.96);
  transition: transform 0.26s var(--ease);
}
.img-lightbox.open figure { transform: none; }
.img-lightbox img {
  max-width: 100%;
  max-height: 82vh;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.5);
}
.img-lightbox figcaption {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  text-align: center;
}
.img-lightbox-source {
  color: #8fe0b9;
  font-size: 12.5px;
  text-decoration: none;
}
.img-lightbox-source:hover { color: #c4f4d9; text-decoration: underline; }
.img-lightbox-close {
  position: absolute;
  top: 22px;
  right: 24px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s, transform 0.2s var(--ease);
}
.img-lightbox-close:hover { background: rgba(255, 255, 255, 0.26); transform: rotate(90deg); }
body.img-lightbox-open { overflow: hidden; }

@media (max-width: 720px) {
  .home-hero { padding: 20px; }
  .home-hero h1 { font-size: 23px; }
  .home-hero .hero-actions { width: 100%; }
  .home-hero .hero-actions .btn { flex: 1; justify-content: center; }
  .img-lightbox { padding: 20px; }
}
