/* 拾记 · 样式表
   结构：设计变量 → 基础 → 布局 → 组件 → 内容排版 → 响应式 */
:root {
  --bg: #f5f6f9;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #eff1f5;
  --border: #e6e9ef;
  --border-strong: #d7dce5;
  --text: #1c222c;
  --text-2: #5c6675;
  --text-3: #8b95a5;
  --accent: #4f6bed;
  --accent-soft: #edf1ff;
  --accent-text: #3c57c9;
  --amber: #dc9a2c;
  --rose: #d9566e;
  --green: #279668;
  --danger: #d24b4b;
  --mark: #fff0a8;
  --shadow: 0 1px 2px rgba(24, 34, 54, .05), 0 10px 30px rgba(24, 34, 54, .08);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
html[data-theme="dark"] {
  --bg: #11141a;
  --surface: #191e26;
  --surface-2: #1d232c;
  --surface-3: #272e39;
  --border: #2a313c;
  --border-strong: #3a4351;
  --text: #e7ebf2;
  --text-2: #a6afbe;
  --text-3: #788393;
  --accent: #6d86f5;
  --accent-soft: #232c48;
  --accent-text: #a8b8ff;
  --amber: #e5ab4b;
  --rose: #ef7288;
  --green: #47bf89;
  --danger: #ef6b6b;
  --mark: #5c4d1b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; }
button { -webkit-tap-highlight-color: transparent; }
::selection { background: var(--accent-soft); }
.hidden { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ------------------------------- 基础组件 ------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, filter .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--danger); border-color: var(--border); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.sm { height: 29px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; height: 40px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent; color: var(--text-2); border-radius: 8px; cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.tiny { width: 24px; height: 24px; }
.icon-btn.tiny .ico { width: 14px; height: 14px; }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.icon-btn.amber.on { color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.icon-btn.rose.on { color: var(--rose); background: color-mix(in srgb, var(--rose) 13%, transparent); }
.text-btn { border: 0; background: none; color: var(--accent-text); font-size: 11.5px; cursor: pointer; padding: 0; }
.text-btn:hover { text-decoration: underline; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge.soft { background: var(--surface-3); color: var(--text-2); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 21px; padding: 0 8px;
  border-radius: 6px; background: var(--surface-3); color: var(--text-2);
  font-size: 11.5px; line-height: 1; white-space: nowrap;
}
.chip.accent { background: var(--accent-soft); color: var(--accent-text); }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.field input, .field select, .plain-input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong);
  border-radius: 9px; background: var(--surface-2); color: var(--text); font-size: 14px; outline: none;
}
.field input:focus, .plain-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-error { color: var(--danger); font-size: 12.5px; margin: 0 0 12px; line-height: 1.5; }
.hint { color: var(--text-3); font-size: 12px; line-height: 1.6; }
.kbd {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-3);
  border: 1px solid var(--border); border-radius: 5px; padding: 2px 5px; background: var(--surface-2);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; font-family: Georgia, "Songti SC", serif; flex: none;
}
.brand-mark.lg { width: 46px; height: 46px; border-radius: 13px; font-size: 24px; }

/* -------------------------------- 启动 / 认证 ------------------------------- */
.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-3); }
.boot p { margin: 0; font-size: 13px; }
.auth-screen {
  min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(900px 500px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.auth-card {
  width: min(404px, 100%); padding: 30px 30px 24px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand .brand-mark { margin: 0 auto 12px; }
.auth-brand h1 { margin: 0; font-size: 23px; letter-spacing: .06em; }
.auth-brand p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-3); }
.auth-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 10px; margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; height: 32px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer;
}
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.auth-hint { margin: -2px 0 14px; font-size: 12px; line-height: 1.6; color: var(--text-3); }
.auth-hint strong { color: var(--accent-text); font-weight: 600; }
.auth-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 20px 0 0; font-size: 11.5px; color: var(--text-3); }
.auth-foot .ico { width: 14px; height: 14px; }

/* --------------------------------- 主布局 --------------------------------- */
.shell { height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  height: 58px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--border); z-index: 20;
}
.brand { display: flex; align-items: center; gap: 9px; flex: none; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: .05em; }
.menu-btn { display: none; }
.search-wrap {
  flex: 1 1 0; min-width: 0; max-width: 520px; margin-left: 10px; height: 36px; display: flex; align-items: center; gap: 8px;
  padding: 0 10px 0 12px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text-3);
}
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-wrap .ico { width: 16px; height: 16px; }
.search-wrap input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 13px;
}
.search-wrap input::placeholder { color: var(--text-3); }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.user-wrap { position: relative; }
.avatar-btn {
  width: 33px; height: 33px; border-radius: 50%; border: 1px solid var(--border-strong);
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 13px;
  cursor: pointer; text-transform: uppercase;
}
.dropdown {
  position: absolute; right: 0; top: 42px; width: 200px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); z-index: 60;
}
.dropdown-head { padding: 9px 10px 11px; border-bottom: 1px solid var(--border); margin-bottom: 5px; }
.dropdown-head strong { display: block; font-size: 13px; }
.dropdown-head small { color: var(--text-3); font-size: 11px; }
.dropdown button {
  width: 100%; display: flex; align-items: center; gap: 9px; height: 34px; padding: 0 10px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text); font-size: 12.5px;
  cursor: pointer; text-align: left;
}
.dropdown button:hover { background: var(--surface-3); }
.dropdown button.danger { color: var(--danger); }

.workspace {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 224px minmax(300px, 372px) minmax(0, 1fr);
}
.sidebar { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 14px 10px; display: flex; flex-direction: column; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  width: 100%; height: 35px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font-size: 13px; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: var(--accent-text); }
.side-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.side-title {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 10px 9px; font-size: 11px; font-weight: 650; letter-spacing: .08em; color: var(--text-3);
}
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
.tag-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2);
  color: var(--text-2); font-size: 11.5px; cursor: pointer;
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent-text); }
.tag-pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.tag-pill em { font-style: normal; color: var(--text-3); font-size: 10.5px; }
.side-foot { margin-top: auto; padding: 18px 10px 4px; display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.side-foot .ico { width: 13px; height: 13px; }

.listpane { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--border); }
.list-head {
  flex: none; padding: 16px 14px 12px; border-bottom: 1px solid var(--border); background: var(--bg);
}
.list-head-title h2 { margin: 0; font-size: 16px; font-weight: 680; }
.list-head-title p { margin: 4px 0 0; font-size: 11.5px; color: var(--text-3); }
.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.list-tools select {
  height: 29px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface); color: var(--text-2); font-size: 11.5px; outline: none; cursor: pointer;
}
.seg { display: flex; gap: 2px; padding: 2px; background: var(--surface-3); border-radius: 8px; }
.seg button {
  width: 30px; height: 25px; display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-3); cursor: pointer;
}
.seg button .ico { width: 15px; height: 15px; }
.seg button.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.list-body { flex: 1; overflow-y: auto; padding: 12px; }

/* -------------------------------- 笔记卡片 -------------------------------- */
.note-card {
  position: relative; padding: 13px 13px 11px; margin-bottom: 9px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.note-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.note-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.note-card h3 {
  margin: 0 0 6px; font-size: 14px; font-weight: 650; line-height: 1.45;
  display: flex; align-items: center; gap: 6px; padding-right: 62px;
}
.note-card h3 .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-card .excerpt {
  font-size: 12px; line-height: 1.65; color: var(--text-2); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 20px;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.card-meta { display: flex; align-items: center; gap: 9px; margin-top: 10px; font-size: 11px; color: var(--text-3); }
.card-meta .flags { display: flex; align-items: center; gap: 5px; }
.card-meta .flags .ico { width: 13px; height: 13px; }
.flag-pin { color: var(--accent); }
.flag-star { color: var(--amber); }
.flag-key { color: var(--rose); }
.flag-archive { color: var(--text-3); }
.card-actions {
  position: absolute; right: 8px; top: 8px; display: flex; gap: 1px;
  opacity: 0; transition: opacity .15s;
}
.note-card:hover .card-actions, .note-card:focus-within .card-actions { opacity: 1; }
.card-actions .icon-btn { width: 25px; height: 25px; background: var(--surface); }
.card-actions .icon-btn .ico { width: 14px; height: 14px; }
.card-actions .icon-btn.on { background: transparent; }
mark.search-hit { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 1px; }
.tl-group { position: relative; padding-left: 18px; margin: 4px 0 18px; }
.tl-group::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 4px; width: 1px; background: var(--border-strong); }
.tl-date { position: relative; font-size: 11.5px; font-weight: 650; color: var(--text-3); margin: 0 0 9px; }
.tl-date::before {
  content: ""; position: absolute; left: -17px; top: 5px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 46px 24px; color: var(--text-3); gap: 8px;
}
.empty .empty-icon {
  width: 48px; height: 48px; border-radius: 14px; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; margin-bottom: 6px; color: var(--text-3);
}
.empty .empty-icon .ico { width: 23px; height: 23px; }
.empty h3 { margin: 0; font-size: 14px; font-weight: 650; color: var(--text-2); }
.empty p { margin: 0; font-size: 12px; line-height: 1.7; max-width: 260px; }
.empty .btn { margin-top: 10px; }

/* -------------------------------- 详情面板 -------------------------------- */
.detailpane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }
#detailBody { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.detail-head { flex: none; padding: 20px 28px 15px; border-bottom: 1px solid var(--border); }
.detail-top { display: flex; align-items: flex-start; gap: 12px; justify-content: space-between; }
.detail-top h1 { margin: 0; font-size: 23px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.detail-actions { display: flex; gap: 3px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.detail-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; font-size: 11.5px; color: var(--text-3); }
.detail-meta .chips { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-scroll { flex: 1; overflow-y: auto; padding: 24px 30px 80px; }
.back-btn { display: none; }
.detail-section { margin-top: 34px; padding-top: 18px; border-top: 1px solid var(--border); }
.detail-section h3 { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.detail-section h3 .ico { width: 15px; height: 15px; }
.related-list { display: flex; flex-wrap: wrap; gap: 7px; }
.related-item {
  display: inline-flex; align-items: center; gap: 7px; max-width: 260px; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2);
  font-size: 12px; color: var(--text-2); cursor: pointer;
}
.related-item:hover { border-color: var(--accent); color: var(--accent-text); }
.related-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.related-item .del { color: var(--text-3); font-size: 14px; line-height: 1; }
.related-item .del:hover { color: var(--danger); }
.suggest-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.suggest-chip {
  border: 1px dashed var(--border-strong); border-radius: 7px; padding: 5px 9px;
  background: transparent; color: var(--text-2); font-size: 11.5px; cursor: pointer;
}
.suggest-chip:hover { border-style: solid; border-color: var(--accent); color: var(--accent-text); }
.key-snippet {
  display: flex; gap: 9px; padding: 9px 12px; margin-bottom: 7px; border-radius: 8px;
  background: color-mix(in srgb, var(--rose) 7%, var(--surface-2)); font-size: 12.5px; line-height: 1.6;
}
.key-snippet .dot { color: var(--rose); flex: none; }

/* ------------------------------- Markdown 排版 ------------------------------ */
.md { font-size: 14.5px; line-height: 1.85; color: var(--text); word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { line-height: 1.4; font-weight: 680; margin: 1.5em 0 .6em; }
.md h1 { font-size: 1.55em; } .md h2 { font-size: 1.3em; } .md h3 { font-size: 1.12em; } .md h4 { font-size: 1em; }
.md p { margin: 0 0 1em; }
.md ul, .md ol { margin: 0 0 1em; padding-left: 1.6em; }
.md li { margin: .25em 0; }
.md li > p { margin: 0; }
.md blockquote { margin: 0 0 1em; padding: 2px 0 2px 14px; border-left: 3px solid var(--accent); color: var(--text-2); }
.md blockquote p:last-child { margin-bottom: 0; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.8em 0; }
.md a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.md a:hover { border-bottom-color: var(--accent); }
.md code {
  font-family: var(--mono); font-size: .88em; padding: 2px 5px; border-radius: 5px;
  background: var(--surface-3); color: var(--rose);
}
.md pre {
  margin: 0 0 1em; padding: 14px 16px; border-radius: 10px; overflow-x: auto;
  background: var(--surface-2); border: 1px solid var(--border); line-height: 1.65;
}
.md pre code { padding: 0; background: none; color: var(--text); font-size: .86em; }
.md mark { background: var(--mark); color: inherit; padding: 1px 3px; border-radius: 3px; }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: .93em; }
.md th, .md td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 650; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 8px 0; margin: .8em 0; }
.md .katex { font-size: 1.03em; }
.md .math-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, transparent); padding: 0 4px; border-radius: 3px; }
.md .wikilink { color: var(--accent-text); border-bottom: 1px dashed var(--accent); cursor: pointer; }
.md .wikilink.missing { color: var(--text-3); border-bottom-style: dotted; }
.md .task { list-style: none; margin-left: -1.3em; }
.md .task input { margin-right: 6px; }

/* --------------------------------- 编辑器 --------------------------------- */
.editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.editor-head { flex: none; padding: 18px 26px 12px; border-bottom: 1px solid var(--border); }
.editor-head-row { display: flex; align-items: center; gap: 10px; }
.edit-title {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text);
  font-size: 22px; font-weight: 680; padding: 2px 0;
}
.edit-title::placeholder { color: var(--text-3); }
.save-status { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.save-status.busy { color: var(--amber); }
.save-status.error { color: var(--danger); }
.tag-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; position: relative; }
.tag-editor .chip { cursor: default; }
.tag-editor .chip button { border: 0; background: none; color: var(--text-3); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.tag-editor input { flex: 1; min-width: 120px; height: 24px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12px; }
.tag-suggest {
  position: absolute; left: 0; top: 32px; z-index: 12; display: flex; flex-wrap: wrap; gap: 5px;
  padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow);
}
.tag-suggest button { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 6px; padding: 3px 8px; font-size: 11.5px; cursor: pointer; }
.tag-suggest button:hover { border-color: var(--accent); color: var(--accent-text); }
.editor-toolbar {
  flex: none; display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 7px 20px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.editor-toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 5px; }
.editor-toolbar .spacer { flex: 1; }
.editor-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.editor-body[data-mode="edit"], .editor-body[data-mode="preview"] { grid-template-columns: 1fr; }
.editor-body[data-mode="preview"] #editContent { display: none; }
.editor-body[data-mode="edit"] .preview-pane { display: none; }
#editContent {
  width: 100%; height: 100%; min-height: 0; resize: none; border: 0; outline: 0;
  padding: 20px 24px 60px; background: var(--surface); color: var(--text);
  font-family: var(--mono); font-size: 13.5px; line-height: 1.85; tab-size: 2;
}
.preview-pane { min-width: 0; overflow-y: auto; padding: 20px 24px 60px; border-left: 1px solid var(--border); background: var(--surface-2); }
.editor-body[data-mode="edit"] .preview-pane { border-left: 0; }

/* -------------------------------- 弹窗 / 提示 ------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(14, 19, 30, .48); backdrop-filter: blur(2px);
}
.modal {
  width: min(520px, 100%); max-height: 86dvh; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  animation: pop .16s ease-out;
}
.modal.wide { width: min(720px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.99); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 15px; font-weight: 680; }
.modal-head .sub { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.75; color: var(--text-2); }
.confirm-text strong { color: var(--text); }
.invite-new {
  display: flex; align-items: center; gap: 10px; padding: 14px; margin-bottom: 16px;
  border: 1px dashed var(--accent); border-radius: 10px; background: var(--accent-soft);
}
.invite-new .code { flex: 1; font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: .06em; color: var(--accent-text); }
.invite-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.invite-table th { text-align: left; color: var(--text-3); font-weight: 600; padding: 7px 8px; border-bottom: 1px solid var(--border); }
.invite-table td { padding: 9px 8px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.invite-table td code { font-family: var(--mono); color: var(--text); }
.status { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-2); }
.status.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.status.off { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.picker-search { width: 100%; margin-bottom: 12px; }
.picker-list { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.picker-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.picker-item:hover { background: var(--surface-3); }
.picker-item .ico { width: 14px; height: 14px; color: var(--text-3); }
.review-card { min-height: 260px; }
.review-card h2 { margin: 0 0 14px; font-size: 20px; }
.review-card .md { font-size: 14px; }
.review-progress { height: 4px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin: 0 20px; }
.review-progress i { display: block; height: 100%; background: var(--accent); transition: width .25s; }
.review-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); }
.review-actions .left { font-size: 11.5px; color: var(--text-3); }
.review-summary { text-align: center; padding: 26px 10px; }
.review-summary .big { font-size: 34px; font-weight: 700; color: var(--accent); }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; align-items: flex-end; }
.toast {
  display: flex; align-items: center; gap: 12px; min-width: 250px; max-width: 420px;
  padding: 11px 13px; border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
  font-size: 12.5px; color: var(--text); animation: pop .16s ease-out;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--green); }
.toast .msg { flex: 1; line-height: 1.5; }
.toast button { border: 0; background: none; color: var(--accent-text); font-size: 12.5px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.toast button:hover { text-decoration: underline; }

/* --------------------------------- 响应式 --------------------------------- */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 200px minmax(270px, 330px) minmax(0, 1fr); }
  .detail-head { padding: 18px 20px 14px; }
  .detail-scroll { padding: 20px 22px 70px; }
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: minmax(270px, 340px) minmax(0, 1fr); }
  .menu-btn { display: inline-flex; }
  .sidebar {
    position: fixed; left: 0; top: 58px; bottom: 0; width: 240px; z-index: 50;
    transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow);
  }
  .sidebar.open { transform: none; }
  .review-btn span:not(.badge) { display: none; }
  .review-btn { padding: 0 9px; }
}
@media (max-width: 720px) {
  .topbar { gap: 6px; padding: 0 8px; height: 54px; }
  .brand-name { display: none; }
  .search-wrap { margin-left: 0; gap: 5px; padding: 0 8px; height: 34px; }
  .search-wrap .kbd { display: none; }
  .topbar-actions { gap: 4px; }
  .btn.primary span { display: none; }
  .btn.primary { padding: 0 8px; height: 32px; }
  .review-btn { padding: 0 7px; height: 32px; }
  .avatar-btn { width: 30px; height: 30px; }
  .workspace { grid-template-columns: 1fr; }
  .sidebar { top: 54px; }
  .detailpane { display: none; }
  .listpane { border-right: 0; }
  body[data-pane="detail"] .listpane { display: none; }
  body[data-pane="detail"] .detailpane { display: flex; }
  .back-btn { display: inline-flex; }
  .detail-head { padding: 14px 16px 12px; }
  .detail-top h1 { font-size: 19px; }
  .detail-scroll { padding: 18px 16px 70px; }
  .editor-head { padding: 14px 16px 10px; }
  .editor-toolbar { padding: 6px 12px; }
  #editContent, .preview-pane { padding: 16px 16px 60px; }
  .editor-body { grid-template-columns: 1fr !important; }
  .editor-body[data-mode="split"] .preview-pane { display: none; }
  .editor-body[data-mode="preview"] #editContent { display: none; }
  .editor-body[data-mode="preview"] .preview-pane { display: block; }
  .card-actions { opacity: 1; }
  .toasts { left: 12px; right: 12px; align-items: stretch; }
  .toast { min-width: 0; max-width: none; }
}
@media (max-width: 480px) {
  .brand { display: none; }
  .search-wrap input { font-size: 12px; }
}
@media (hover: none) { .card-actions { opacity: 1; } }
