/* 素笺 · 界面样式 —— 仿 WinUI 3 / Fluent Design，纯手写，无框架 */

:root {
  --accent: #0f6cbd;
  --accent-hover: #115ea3;
  --accent-soft: rgba(15, 108, 189, .12);
  --bg: #f3f3f3;
  --mica-1: rgba(255, 255, 255, .78);
  --mica-2: rgba(255, 255, 255, .55);
  --card: rgba(255, 255, 255, .7);
  --card-solid: #fbfbfb;
  --layer: rgba(255, 255, 255, .5);
  --stroke: rgba(0, 0, 0, .0578);
  --stroke-strong: rgba(0, 0, 0, .11);
  --text: #1b1b1b;
  --text-2: #5c5c5c;
  --text-3: #8a8a8a;
  --hover: rgba(0, 0, 0, .037);
  --press: rgba(0, 0, 0, .07);
  --sel: rgba(0, 0, 0, .05);
  --shadow: 0 8px 28px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .06);
  --radius: 8px;
  --radius-sm: 5px;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, "SF Mono", ui-monospace, Menlo, monospace;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --dur: .12s;
}

html[data-theme="dark"] {
  --accent: #4cc2ff;
  --accent-hover: #63cbff;
  --accent-soft: rgba(76, 194, 255, .14);
  --bg: #202020;
  --mica-1: rgba(44, 44, 44, .78);
  --mica-2: rgba(30, 30, 30, .55);
  --card: rgba(44, 44, 44, .72);
  --card-solid: #272727;
  --layer: rgba(58, 58, 58, .5);
  --stroke: rgba(255, 255, 255, .0698);
  --stroke-strong: rgba(255, 255, 255, .12);
  --text: #ffffff;
  --text-2: #c8c8c8;
  --text-3: #9a9a9a;
  --hover: rgba(255, 255, 255, .06);
  --press: rgba(255, 255, 255, .09);
  --sel: rgba(255, 255, 255, .08);
  --shadow: 0 10px 32px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(1100px 700px at 8% -12%, rgba(15, 108, 189, .16), transparent 60%),
    radial-gradient(900px 620px at 105% 4%, rgba(140, 90, 220, .13), transparent 62%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
html[data-theme="dark"] body {
  background:
    radial-gradient(1100px 700px at 8% -12%, rgba(76, 194, 255, .10), transparent 60%),
    radial-gradient(900px 620px at 105% 4%, rgba(160, 110, 240, .10), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
kbd {
  font: 600 10.5px var(--mono); padding: 2px 5px; border-radius: 4px;
  background: var(--sel); border: 1px solid var(--stroke); color: var(--text-2);
}
.muted { color: var(--text-2); }
.flex { flex: 1 1 auto; }
.ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.35;
       stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--stroke-strong); border-radius: 6px;
  border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ── 外壳 ─────────────────────────────────────────── */
.shell { display: flex; flex-direction: column; height: 100%; }

.titlebar {
  position: relative; z-index: 30;   /* backdrop-filter 会新建层叠上下文，必须抬高，否则下拉菜单被正文盖住 */
  height: 44px; flex: none; display: flex; align-items: center; gap: 6px;
  padding: 0 8px 0 10px; border-bottom: 1px solid var(--stroke);
  background: var(--mica-2); backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 4px; }
.tb-right { margin-left: auto; }
.tb-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm);
  color: var(--text-2); transition: background var(--dur), color var(--dur);
}
.tb-btn:hover { background: var(--hover); color: var(--text); }
.tb-btn:active { background: var(--press); }
.brand { display: flex; align-items: center; gap: 8px; padding: 3px 6px 3px 3px; border-radius: 6px; }
.logo { width: 30px; height: 30px; flex: none; object-fit: contain; border-radius: 4px;
  display: block; filter: none; }
.brand-name { font-size: 13px; font-weight: 600; }
.tb-sep { width: 1px; height: 18px; background: var(--stroke-strong); margin: 0 6px; }
.save-state { font-size: 12px; color: var(--text-3); margin-right: 6px; }
.save-state[data-s="dirty"] { color: #b07500; }
html[data-theme="dark"] .save-state[data-s="dirty"] { color: #e0a72c; }
.save-state[data-s="saved"] { color: var(--accent); }
.save-state[data-s="saving"] { color: var(--text-3); }

.body { flex: 1 1 auto; display: flex; min-height: 0; gap: 10px; padding: 10px; }
.body.collapsed .sidebar { display: none; }
.side-collapse { margin-left: auto; }

/* ── 竖向导航栏 ───────────────────────────────────── */
.rail { flex: none; width: 46px; display: flex; flex-direction: column; gap: 3px;
  padding: 6px 4px; border: 1px solid var(--stroke); border-radius: var(--radius);
  background: var(--card); backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
.rail-btn { position: relative; display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 7px 2px 5px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-3); cursor: pointer; }
.rail-btn:hover { background: var(--hover); color: var(--text-2); }
.rail-btn.on { background: var(--accent); color: #fff; }
.rail-btn.on:hover { background: var(--accent); color: #fff; }
.rail-btn .ico { width: 17px; height: 17px; }
.rail-btn span { font-size: 9.5px; letter-spacing: .01em; }
.rail-btn .dot { position: absolute; top: 5px; right: 6px; width: 5px; height: 5px;
  border-radius: 50%; background: #e5484d; }
.rail-btn.on .dot { background: #fff; }

.panel-hint { margin: 6px 8px 0; font-size: 11px; color: var(--text-3); line-height: 1.5; }
.fav-item, .cal-item { display: block; width: 100%; text-align: left; padding: 7px 9px;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-1);
  font-size: 13px; cursor: pointer; }
.fav-item:hover, .cal-item:hover { background: var(--hover); }
.fav-item .p, .cal-item .p { display: block; font-size: 11px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 日历 ───────────────────────────────────────────── */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; padding: 2px 4px 6px; }
.cal .dow { text-align: center; font-size: 10.5px; color: var(--text-3); padding: 3px 0; }
.cal .day { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 1px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-size: 12px; cursor: pointer; }
.cal .day:hover { background: var(--hover); }
.cal .day.out { color: var(--text-3); opacity: .45; }
.cal .day.today { color: var(--accent); font-weight: 700; }
.cal .day.sel { background: var(--accent); color: #fff; font-weight: 600; }
.cal .day .mk { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.cal .day.sel .mk { background: #fff; }

/* ── 左栏 ─────────────────────────────────────────── */
.sidebar {
  width: var(--side-w, 268px); flex: none; display: flex; flex-direction: column; min-height: 0;
  position: relative;
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
}
.side-top { display: flex; gap: 6px; padding: 8px 8px 4px; position: relative; z-index: 5; }
.searchbox {
  flex: 1 1 auto; display: flex; align-items: center; gap: 8px; height: 32px;
  padding: 0 10px; border-radius: var(--radius-sm); background: var(--layer);
  border: 1px solid var(--stroke); border-bottom-color: var(--stroke-strong);
  transition: border-color var(--dur), background var(--dur);
}
.searchbox:focus-within { border-bottom: 2px solid var(--accent); background: var(--card-solid); }
.searchbox .ico { color: var(--text-3); }
.searchbox input { flex: 1; min-width: 0; background: none; border: 0; outline: none; }

.tree { flex: 1 1 auto; overflow: auto; padding: 4px 6px 10px; }
.node { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: var(--radius-sm);
        color: var(--text-2); user-select: none; position: relative; }
.node:hover { background: var(--hover); color: var(--text); }
.node.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.node.on::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px;
                   border-radius: 3px; background: var(--accent); }
.node .chev { width: 14px; height: 14px; display: grid; place-items: center; color: var(--text-3);
              transition: transform var(--dur); }
.node .chev.open { transform: rotate(90deg); }
.node .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .cnt { font-size: 11px; color: var(--text-3); }
.node.dir { font-weight: 500; }
.kids { margin-left: 12px; border-left: 1px solid var(--stroke); }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--stroke);
             font-size: 11.5px; color: var(--text-3); }
.link { color: var(--accent); display: flex; align-items: center; gap: 4px; font-size: 11.5px; }
.dot { opacity: .5; }

/* ── 内容区 ───────────────────────────────────────── */
.content { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: row;
           background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius);
           backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
           box-shadow: 0 2px 10px rgba(0, 0, 0, .05); overflow: hidden; }
.toolbar { height: 46px; flex: none; display: flex; align-items: center; gap: 2px; padding: 0 8px;
           border-bottom: 1px solid var(--stroke); flex-wrap: nowrap; overflow: hidden; }
.toolbar .tool { flex: none; white-space: nowrap; display: inline-flex; align-items: center;
  gap: 4px; padding: 0 7px; }
.toolbar .tool span { white-space: nowrap; font-size: 12.5px; }
.toolbar .tool .ico { width: 15px; height: 15px; flex: none; }
.toolbar .flex { min-width: 6px; }
/* 内容主体：工具栏/分栏/状态栏/大纲 走纵向，split 上方是主区 */
.content-col { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.seg { display: flex; padding: 2px; gap: 2px; background: var(--layer); border: 1px solid var(--stroke);
       border-radius: 7px; }
.seg button { padding: 4px 12px; border-radius: 5px; font-size: 12.5px; color: var(--text-2);
              transition: background var(--dur), color var(--dur); }
.seg button:hover { background: var(--hover); }
.seg button.on { background: var(--card-solid); color: var(--text); font-weight: 600;
                 box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.tool { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
        color: var(--text-2); font-size: 12.5px; transition: background var(--dur), color var(--dur); }
.tool:hover { background: var(--hover); color: var(--text); }
.tool:active { background: var(--press); }
.tool.danger:hover { background: rgba(196, 43, 28, .12); color: #c42b1c; }
html[data-theme="dark"] .tool.danger:hover { color: #ff99a4; }
.tool:disabled { opacity: .4; pointer-events: none; }

.split { flex: 1 1 auto; display: flex; min-height: 0; }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-edit { flex: 0 0 var(--split-pct, 50%); }
.pane-read { flex: 1 1 auto; border-left: 1px solid var(--stroke); }
.gutter { flex: none; width: 6px; cursor: col-resize; background: transparent; position: relative; }
.gutter::after { content: ""; position: absolute; inset: 0 2px; border-radius: 3px; background: transparent;
                 transition: background var(--dur); }
.gutter:hover::after { background: var(--stroke-strong); }
.gutter:active::after { background: var(--accent); opacity: .5; }
/* 拖动某一根分栏时，另外两根不做昂贵重排 */
body.dragging .tree, body.dragging .preview, body.dragging .hl-layer,
body.dragging .gutter-num, body.dragging .ol-list { contain: layout paint; }
.split[data-view="edit"] .pane-read, .split[data-view="edit"] .gutter { display: none; }
.split[data-view="edit"] .pane-edit { flex: 1 1 auto; }   /* 单栏时不留比例 */
.split[data-view="read"] .pane-edit, .split[data-view="read"] .gutter { display: none; }

#editor {
  flex: 1 1 auto; width: 100%; resize: none; border: 0; outline: none; padding: 20px 22px;
  background: transparent; color: var(--text); font-family: var(--mono); font-size: 13.5px;
  line-height: 1.75; tab-size: 2;
}
.preview { flex: 1 1 auto; overflow: auto; padding: 20px 26px 60px; }

.statusbar { height: 28px; flex: none; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 0 12px;
             border-top: 1px solid var(--stroke); font-size: 11.5px; color: var(--text-3); }
#st-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Markdown 排版（质朴：无左侧竖条）──────────────── */
.markdown { font-size: 15px; line-height: 1.78; 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; line-height: 1.35; margin: 1.5em 0 .55em; font-style: normal;
}
.markdown h1 { font-size: 27px; font-weight: 700; }
.markdown h2 { font-size: 21px; padding-bottom: .22em; border-bottom: 1px solid var(--stroke-strong); }
.markdown h3 { font-size: 17px; }
.markdown h4 { font-size: 15px; color: var(--text-2); }
.markdown p { margin: .62em 0; }
.markdown a { color: var(--accent); text-decoration: none; }
.markdown a:hover { text-decoration: underline; }
.markdown strong { font-weight: 650; }
.markdown em { font-style: normal; font-weight: 600; }   /* 中文斜体难看：强调改用加粗 */
.markdown code {
  font-family: var(--mono); font-size: .88em; padding: .12em .38em; border-radius: 4px;
  background: var(--sel); border: 1px solid var(--stroke);
}
.markdown pre {
  margin: .8em 0; padding: 12px 14px; border-radius: var(--radius); overflow: auto;
  background: var(--layer); border: 1px solid var(--stroke);
}
.markdown pre code { background: none; border: 0; padding: 0; font-size: 12.5px; line-height: 1.6; }
.markdown blockquote { margin: .7em 0; padding: 2px 0; color: var(--text-2); border: 0; }
.markdown blockquote p { margin: .3em 0; }
.markdown blockquote.callout { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--sel); }
.markdown blockquote.callout .co-title { font-weight: 600; color: var(--text); margin-right: .4em; }
.markdown ul, .markdown ol { margin: .5em 0; padding-left: 1.5em; }
.markdown li { margin: .22em 0; }
.markdown li > ul, .markdown li > ol { margin: .22em 0; }
.markdown li.task { list-style: none; margin-left: -1.2em; }
.markdown li.task input { margin-right: .5em; accent-color: var(--accent); }
.markdown hr { border: 0; border-top: 1px solid var(--stroke-strong); margin: 1.6em 0; }
.markdown img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.markdown table { border-collapse: collapse; margin: .8em 0; font-size: 13.5px; display: block;
                  overflow-x: auto; max-width: 100%; }
.markdown th, .markdown td { border: 1px solid var(--stroke-strong); padding: 6px 10px; }
.markdown th { background: var(--sel); font-weight: 600; }
.markdown .katex { font-size: 1.06em; }
.markdown .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; margin: .9em 0; }
.markdown .katex-display > .katex { font-size: 1.1em; }
.markdown mark { background: rgba(255, 214, 102, .5); color: inherit; border-radius: 3px; padding: 0 2px; }
.markdown .anchor { color: var(--text-3); text-decoration: none; margin-left: .35em; opacity: 0; font-size: .7em; }
.markdown h1:hover .anchor, .markdown h2:hover .anchor, .markdown h3:hover .anchor { opacity: 1; }

/* ── 空态 / 登录 ──────────────────────────────────── */
.empty, .gate { position: fixed; inset: 0; display: grid; place-items: center; z-index: 5;
                background: var(--mica-1); backdrop-filter: blur(18px); }
.empty-card, .gate-card {
  width: min(440px, 88vw); padding: 34px 30px; text-align: center; border-radius: 12px;
  background: var(--card); border: 1px solid var(--stroke); box-shadow: var(--shadow);
  backdrop-filter: blur(30px) saturate(150%);
}
.empty-logo { width: 76px; height: 76px; margin-bottom: 14px; display: grid; place-items: center; }
.empty-logo img { width: 100%; height: 100%; object-fit: contain; }
.empty-card h1, .gate-card h1 { font-size: 20px; margin: 0 0 6px; }
.empty-card h1 .en, .gate-card h1 .en { margin-left: 7px; font-size: 12px; font-weight: 500;
  color: var(--text-3); letter-spacing: .06em; vertical-align: middle; }
.empty-card p, .gate-card p { color: var(--text-2); font-size: 13px; line-height: 1.7; margin: 0 0 16px; }
.empty-tips { display: flex; gap: 14px; justify-content: center; font-size: 12px; color: var(--text-3); }
.gate-card input, .cmd-input input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--layer); border: 1px solid var(--stroke); border-bottom-color: var(--stroke-strong);
  outline: none; transition: border-color var(--dur);
}
.gate-card input:focus, .cmd-input input:focus { border-bottom: 2px solid var(--accent); }
.gate-card .accent, .cmd .accent, .ghost { height: 34px; padding: 0 18px; border-radius: var(--radius-sm);
  font-weight: 600; }
.accent { background: var(--accent); color: #fff; }
html[data-theme="dark"] .accent { color: #003650; }
.accent:hover { background: var(--accent-hover); }
.ghost { background: var(--layer); border: 1px solid var(--stroke); color: var(--text-2); }
.ghost:hover { background: var(--hover); color: var(--text); }
.gate-card .accent { width: 100%; margin-top: 12px; }
.err { color: #c42b1c; font-size: 12px; min-height: 16px; margin: 8px 0 0 !important; }
html[data-theme="dark"] .err { color: #ff99a4; }

/* ── 覆盖面板（搜索 / 历史 / 输入）────────────────── */
.modal { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: center;
           align-items: flex-start; padding-top: 12vh; background: rgba(0, 0, 0, .28);
           backdrop-filter: blur(3px); }
.cmd { width: min(660px, 92vw); border-radius: 10px; overflow: hidden; box-shadow: var(--shadow);
       background: var(--card-solid); border: 1px solid var(--stroke-strong); }
.cmd.narrow { width: min(420px, 92vw); }
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--stroke); }
.cmd-title { font-weight: 600; flex: 1; }
.cmd-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 14px; }
.cmd-list { max-height: 52vh; overflow: auto; }
.hit { padding: 9px 14px; border-bottom: 1px solid var(--stroke); cursor: pointer; }
.hit:hover, .hit.on { background: var(--accent-soft); }
.hit .t { font-weight: 600; font-size: 13.5px; }
.hit .p { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.hit .s { font-size: 12px; color: var(--text-2); margin-top: 3px; line-height: 1.55; }
.empty-hint { padding: 22px 14px; text-align: center; color: var(--text-3); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 30;
  padding: 9px 16px; border-radius: 20px; background: var(--card-solid); color: var(--text);
  border: 1px solid var(--stroke-strong); box-shadow: var(--shadow); font-size: 13px; }

/* ── 窄屏（手机/平板）：单栏 + 抽屉 ──────────────── */
@media (max-width: 860px) {
  .body { padding: 6px; gap: 6px; }
  /* 窄屏：竖向导航栏整个隐藏，正文拿回整屏；回收站/日历/设置从顶栏进入 */
  .rail { display: none; }
  /* 窄屏只用「预览」，编辑器整块移出（连行号一起），别挤占正文宽度 */
  .split[data-view="read"] .pane-edit,
  .split[data-view="read"] .gutter-num,
  .split[data-view="read"] .hl-layer { display: none !important; }
  .pane-read { flex: 1 1 auto !important; min-width: 0; }
  .content, .content-col { min-width: 0; }
  .sidebar { position: fixed; z-index: 25; top: 52px; bottom: 56px; left: 8px; width: min(320px, 84vw);
             box-shadow: var(--shadow); transform: translateX(-112%); transition: transform .18s ease; }
  .sidebar.open { transform: none; }
  .split { flex-direction: column; }
  .pane-edit, .pane-read { flex: 1 1 auto; }
  .pane-read { border-left: 0; border-top: 1px solid var(--stroke); }
  .gutter { display: none; }
  .split[data-view="split"] .pane-read { display: none; }
  .split[data-view="edit"] .pane-read { display: none; }
  .split[data-view="read"] .pane-edit { display: none; }
  .tool span { display: none; }
  .uname { display: none; }
  #seg-view button[data-view="split"] { display: none; }
  .brand-name { display: none; }
  .tool { padding: 0 8px; }
  #editor, .preview { padding: 14px 14px 40px; }
  .markdown { font-size: 15.5px; }
}

/* ── 账号：头像 / 菜单 / 表单 ─────────────────────── */
.user { position: relative; }
.user-chip { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 8px 0 4px;
  border-radius: 16px; color: var(--text); transition: background var(--dur); }
.user-chip:hover { background: var(--hover); }
.avatar { width: 24px; height: 24px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #6d3fc4); color: #fff; font-size: 12px; font-weight: 600; }
.uname { font-size: 12.5px; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev-d { width: 12px; height: 12px; color: var(--text-3); }
.menu { position: absolute; right: 0; top: 38px; min-width: 208px; padding: 5px; z-index: 25;
  background: var(--card-solid); border: 1px solid var(--stroke-strong); border-radius: 8px;
  box-shadow: var(--shadow); animation: pop .12s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu-head { padding: 8px 10px 7px; font-size: 11.5px; color: var(--text-3);
  border-bottom: 1px solid var(--stroke); margin-bottom: 4px; word-break: break-all; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px;
  border-radius: 5px; font-size: 13px; color: var(--text); text-align: left; }
.menu-item:hover { background: var(--hover); }
.field { display: block; text-align: left; margin-bottom: 10px; }
.field > span { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.field input { width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  background: var(--layer); border: 1px solid var(--stroke); border-bottom-color: var(--stroke-strong);
  outline: none; transition: border-color var(--dur); }
.field input:focus { border-bottom: 2px solid var(--accent); }
.cmd-body { padding: 14px 14px 4px; }
.remember { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2);
  margin: 2px 0 8px; text-align: left; }
.remember input { width: 15px; height: 15px; accent-color: var(--accent); }
.gate-card .muted { margin-bottom: 18px; }

/* ── 大纲面板（右侧固定栏，和左边同宽）───────────── */
.outline-panel { width: var(--ol-w, 268px); flex: none; display: flex; flex-direction: column;
  min-height: 0; position: relative;
  background: var(--card); border: 1px solid var(--stroke); border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05); }
/* 往右收起 */
/* 大纲现在是 main.content 的子元素（紧贴预览右侧） */
.content > .outline-panel { align-self: stretch; }
.body.no-outline .outline-panel,
.content.no-outline .outline-panel { display: none; }
.ol-head { display: flex; align-items: center; gap: 8px; padding: 9px 8px 9px 12px;
  font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--stroke); flex: none; }
.ol-n { font-weight: 400; color: var(--text-3); font-size: 11.5px; }
.ol-head .tb-btn { margin-left: auto; width: 26px; height: 26px; flex: none; }
.ol-list { overflow: auto; padding: 5px 6px 8px; flex: 1 1 auto; min-height: 0; }
.ol-grip { position: absolute; top: 0; left: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 3; }
.ol-grip:hover { background: var(--accent); opacity: .35; }
.ol-item { display: block; padding: 5px 8px; border-radius: 5px; color: var(--text-2);
  text-decoration: none; font-size: 12.5px; line-height: 1.45; border-left: 2px solid transparent; }
.ol-item:hover { background: var(--hover); color: var(--text); }
.ol-item.on { background: var(--accent-soft); color: var(--text); font-weight: 600;
  border-left-color: var(--accent); }
.ol-item.lv1 { font-weight: 600; color: var(--text); }
.ol-item.lv2 { font-size: 12.5px; }
.ol-item.lv3, .ol-item.lv4, .ol-item.lv5, .ol-item.lv6 { font-size: 12px; color: var(--text-3); }
.ol-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.content { position: relative; }
.markdown h1.flash, .markdown h2.flash, .markdown h3.flash, .markdown h4.flash {
  animation: flashbg .9s ease; }
@keyframes flashbg { from { background: var(--accent-soft); } to { background: transparent; } }
.markdown a.toc-jump { color: var(--accent); text-decoration: none; }
.markdown li:hover a.toc-jump { text-decoration: underline; }
.markdown .anchor { opacity: 0; }

/* ── 打印 / 存 PDF（复习用）──────────────────────── */
@media print {
  html, body { background: #fff !important; overflow: visible !important; }
  .titlebar, .sidebar, .toolbar, .statusbar, .outline-panel, .gutter,
  .pane-edit, .modal, .toast, .user { display: none !important; }
  .body { padding: 0 !important; gap: 0 !important; }
  .content { border: 0 !important; box-shadow: none !important; background: none !important; }
  .split { display: block !important; }
  .pane-read { display: block !important; border: 0 !important; }
  .preview { overflow: visible !important; padding: 0 !important; }
  .markdown { font-size: 11.5pt; line-height: 1.6; }
  .markdown h1, .markdown h2, .markdown h3, .markdown h4 { break-after: avoid; }
  .markdown img, .markdown table, .markdown pre, .markdown .katex-display { break-inside: avoid; }
  .markdown a { color: inherit; text-decoration: none; }
  .markdown .anchor { display: none; }
  @page { margin: 14mm 12mm; }
}

/* ── 图片灯箱 ─────────────────────────────────────── */
.lightbox { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center;
  justify-content: center; padding: 24px; background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px); cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center;
  color: #eee; font-size: 12.5px; }

/* ── 快捷键面板 ───────────────────────────────────── */
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 7px 18px;
  padding: 14px 16px 6px; font-size: 13px; align-items: center; }
.shortcuts b { font-weight: 600; color: var(--text-2); font-size: 12px; }

/* ── 手机端再收窄 ─────────────────────────────────── */
@media (max-width: 860px) {
  /* 视图切换只留图标，避免「编辑/预览」竖排换行 */
  .seg { flex: none; }
  .seg button { padding: 0 6px; white-space: nowrap; flex: none; font-size: 12px; }
  .seg button .w { display: none; }        /* 窄屏只留「编/预/分」，不换行 */
  /* 工具栏挤成一行：去掉弹性空隙与分隔条，图标收紧 */
  .toolbar .flex { display: none; }
  .toolbar .tb-sep-v { display: none; }
  .toolbar { gap: 0; padding: 0 4px; }
  .toolbar .tool { padding: 0 6px; }
  .toolbar .tool .ico { width: 15px; height: 15px; }
  .toolbar { gap: 2px; padding: 0 6px; }
  .toolbar .tool { white-space: nowrap; flex: none; padding: 6px; }
  .toolbar .tool span { display: none; }          /* 窄屏只留图标，避免换行 */
  .toolbar .tool .ico { margin: 0; }
  .save-state { font-size: 0; margin-right: 2px; }
  .save-state::before { content: "●"; font-size: 12px; color: var(--text-3); }
  .save-state[data-s="dirty"]::before { color: #b07500; }
  .save-state[data-s="saved"]::before { color: var(--accent); }
  .toolbar { overflow-x: auto; scrollbar-width: none; }
  .toolbar::-webkit-scrollbar { display: none; }
}

/* 正文里的笔记互链 */
.markdown a.note-link { color: var(--accent); border-bottom: 1px dashed currentColor;
  text-decoration: none; }
.markdown a.note-link:hover { border-bottom-style: solid; }

/* 公式占位（渲染前的样子，避免跳动） */
.katex-slot { display: inline-block; min-width: 8px; height: 1em; vertical-align: -.15em;
  background: var(--hover); border-radius: 3px; }
.katex-slot.disp { display: block; height: 2.4em; margin: 10px 0; }
.katex-block { overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.katex-block .katex-display { margin: 10px 0; }
@media print { .katex-slot { display: none; } }

/* ── 侧栏拖拽把手 ─────────────────────────────────── */
.side-grip { position: absolute; top: 0; right: -3px; width: 7px; height: 100%;
  cursor: col-resize; z-index: 3; }
.side-grip:hover { background: var(--accent); opacity: .35; }
@media (max-width: 860px) { .side-grip { display: none; } }

/* ── 灯箱翻页 ─────────────────────────────────────── */
.lightbox .lb-nav { position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 76px; display: flex; align-items: center; justify-content: center;
  font-size: 34px; line-height: 1; color: #f2f2f2; background: rgba(0,0,0,.32);
  border-radius: 10px; cursor: pointer; user-select: none; }
.lightbox .lb-nav:hover { background: rgba(0,0,0,.55); }
.lightbox .lb-prev { left: 14px; }
.lightbox .lb-next { right: 14px; }
.lightbox img { cursor: default; }

/* ── 拖拽 ─────────────────────────────────────────── */
.node.dragging { opacity: .4; }
.node.drop-in { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px;
  background: var(--hover); }
.node.drop-before { box-shadow: inset 0 2px 0 var(--accent); }

/* ── 搜索框 + 范围下拉 ──────────────────────────── */
.searchbox { position: relative; }
.scope { position: relative; flex: none; display: flex; }
.scope-btn { display: flex; align-items: center; gap: 1px; height: 24px; padding: 0 3px 0 5px;
  border: 1px solid transparent; border-radius: 5px; background: transparent;
  color: var(--text-3); font-size: 11px; cursor: pointer; white-space: nowrap; flex: none; }
.scope-btn span { max-width: 34px; overflow: hidden; }
.scope-btn:hover { background: var(--hover); color: var(--text-2); }
.scope-btn[aria-expanded="true"] { background: var(--hover); color: var(--text-1);
  border-color: var(--stroke); }
.scope-btn .ico { width: 11px; height: 11px; }
.scope-menu { position: absolute; right: 0; top: calc(100% + 5px); z-index: 40; min-width: 174px;
  padding: 4px; border-radius: 8px; background: var(--card); border: 1px solid var(--stroke);
  box-shadow: var(--shadow); backdrop-filter: blur(24px) saturate(150%); }
.scope-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px 9px;
  border: 0; border-radius: 5px; background: transparent; color: var(--text-1);
  font-size: 12.5px; text-align: left; cursor: pointer; }
.scope-menu button:hover { background: var(--hover); }
.scope-menu button[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.scope-menu kbd { margin-left: auto; color: var(--text-3); font-size: 10.5px; }

/* 搜索命中的笔记 */
.node.doc.hit .nm { color: var(--accent); }
.node.doc.hit::after { content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex: none; }
@media (max-width: 860px) { .scope-btn span { display: none; } .scope-btn { padding: 0 4px; } }

/* ── 手机端：大纲浮层、左右栏互斥 ─────────────────── */
@media (max-width: 860px) {
  /* 手机：大纲默认收起，点开才浮在正文之上 */
  /* 手机端大纲改成浮层，且默认收起：正文优先，不被盖住 */
  .content > .outline-panel { position: fixed; z-index: 16; top: 52px; bottom: 8px; right: 8px;
    width: min(300px, 86vw); box-shadow: var(--shadow); animation: pop .14s ease; }
  .ol-grip { display: none; }
  /* 侧栏展开时收起大纲，两者互斥 */
  .sidebar.open ~ .content > .outline-panel,
  .sidebar.open ~ .content > .outline-panel { display: none !important; }
}

/* 大纲开关：浮在预览窗格右上角（不再放工具栏，也不再有右侧拉出箭头） */
.pane-read { position: relative; }
.ol-toggle { position: absolute; top: 8px; right: 10px; z-index: 6;
  width: 26px; height: 26px; display: grid; place-items: center;
  border: 1px solid var(--stroke); border-radius: 7px;
  background: var(--card-solid); color: var(--text-3);
  cursor: pointer; opacity: .55; transition: opacity var(--dur), color var(--dur); }
.ol-toggle:hover { opacity: 1; color: var(--accent); background: var(--hover); }
.ol-toggle.on { opacity: 1; color: var(--accent); border-color: var(--accent); }

/* ── 用户设置弹窗 ─────────────────────────────────── */
.acct-body { display: flex; flex-direction: column; gap: 2px; }
.acct-avatar-row { display: flex; align-items: center; gap: 12px; padding: 4px 0 12px; }
.avatar.big { width: 56px; height: 56px; flex: none; border-radius: 50%;
  background: var(--layer) center/cover no-repeat; color: var(--text-3);
  display: grid; place-items: center; font-size: 22px; font-weight: 600; }
.acct-avatar-btns { display: flex; flex-direction: column; gap: 6px; }
.acct-avatar-btns .ghost.sm { padding: 4px 10px; font-size: 12.5px; }
.acct-sep { border: 0; border-top: 1px solid var(--stroke); margin: 12px 0 10px; }
.acct-body .field .hint { display: block; font-size: 11.5px; color: var(--text-3);
  margin-top: 3px; font-style: normal; }
.menu-item.danger { color: #d64545; }
.menu-item.danger:hover { background: rgba(214, 69, 69, .1); color: #d64545; }
.menu-item.danger .ico { stroke: currentColor; }

/* ── 设置面板 ─────────────────────────────────────── */
.cmd.wide { width: min(680px, 94vw); max-height: 86vh; display: flex; flex-direction: column; }
.cmd-body.settings { overflow: auto; padding: 6px 18px 14px; }
.set-group { padding: 12px 0 4px; border-bottom: 1px solid var(--stroke); }
.set-group:last-child { border-bottom: 0; }
.set-h { font-size: 11.5px; font-weight: 700; color: var(--text-3); letter-spacing: .06em;
  margin-bottom: 6px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 8px 0; }
.set-l { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-1); }
.set-l em { display: block; font-style: normal; font-size: 11.5px; color: var(--text-3);
  margin-top: 2px; line-height: 1.4; }
.set-seg { display: flex; flex: none; border: 1px solid var(--stroke); border-radius: 7px;
  overflow: hidden; }
.set-seg button { padding: 5px 11px; border: 0; background: transparent; color: var(--text-2);
  font-size: 12px; cursor: pointer; white-space: nowrap; }
.set-seg button + button { border-left: 1px solid var(--stroke); }
.set-seg button:hover { background: var(--hover); }
.set-seg button.on { background: var(--accent); color: #fff; }
@media (max-width: 620px) {
  .set-row { flex-direction: column; align-items: stretch; gap: 7px; }
  .set-seg { align-self: flex-start; }
}

/* 开关 */
.sw { flex: none; display: inline-flex; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw span { width: 40px; height: 22px; border-radius: 11px; background: var(--stroke-strong);
  position: relative; transition: background .15s; display: block; }
.sw span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { transform: translateX(18px); }
.sw input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── 编辑器行号 + 语法着色（与 textarea 的 20px 22px / 13.5px / 1.75 严格对齐）── */
.pane-edit { position: relative; display: flex; }
.gutter-num { flex: none; width: 48px; padding: 20px 9px 20px 0; text-align: right;
  align-self: stretch;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.75; color: var(--text-3);
  overflow: hidden; user-select: none; border-right: 1px solid var(--stroke);
  background: transparent; }
.gutter-num[hidden] { display: none; }
.gutter-num span { display: block; line-height: 1.75; }
.gutter-num span.cur { color: var(--accent); }

.hl-layer { position: absolute; top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden; pointer-events: none; display: none; }
.pane-edit.has-ln .hl-layer { left: 48px; }
.pane-edit.hl .hl-layer { display: block; }
.pane-edit.hl #editor { color: transparent; caret-color: var(--text); }
.hl-layer pre { margin: 0; padding: 20px 22px; font-family: var(--mono); font-size: 13.5px;
  line-height: 1.75; white-space: pre-wrap; word-break: break-word; tab-size: 2;
  color: var(--text); overflow: visible; }
.hl-layer code { font-family: inherit; font-size: inherit; }

.tk-h { color: #0a58ca; font-weight: 700; }
.tk-b { color: #7b3fa0; font-weight: 600; }
.tk-c { color: #1a7f37; }
.tk-m { color: #b45309; }
.tk-q { color: #6b7280; font-style: italic; }
.tk-l { color: #0a66c2; }
.tk-k { color: var(--text-3); }
html[data-theme="dark"] .tk-h { color: #79b8ff; }
html[data-theme="dark"] .tk-b { color: #d0a9ff; }
html[data-theme="dark"] .tk-c { color: #85e89d; }
html[data-theme="dark"] .tk-m { color: #ffab70; }
html[data-theme="dark"] .tk-q { color: #9aa4b2; }
html[data-theme="dark"] .tk-l { color: #79b8ff; }

/* 正文宽度 / 字号 */
.markdown.w-narrow { max-width: 640px; margin-left: auto; margin-right: auto; }
.markdown.w-wide { max-width: 1100px; }
html { --md-size: 15px; }
.markdown { font-size: var(--md-size); }

/* ── 大纲收起后，右边缘留一个「伸出来」的把手 ───────── */


/* 搜索框必须能被压缩，否则会把「新建 / 收起」按钮顶出侧栏 */
.side-top { overflow: hidden; }
/* 搜索框现在是侧栏的独立一行：只横向铺开，绝不纵向撑高
   （旧的 ".side-top > *" 规则让它 flex:1 1 auto，被拉成 200px 高） */
#sidebar > .searchbox { flex: none; min-width: 0; }
#sidebar > .searchbox input#filter { flex: 1 1 auto; min-width: 0; width: 100%; }

/* ══ 拖拽性能：拖动期间冻结昂贵重排 ═══════════════════════
   预览里常有上千个 KaTeX 节点，每次 mousemove 改一次宽度就要把它们
   全部重新布局 —— 这是「拖起来很卡」的根源。
   拖动时给 <html> 加 .dragging，用 content-visibility 把看不见的
   内容踢出渲染流程；松手自动移除，一切恢复正常。 */
html.dragging, html.dragging body { cursor: col-resize !important; }
html.dragging .preview,
html.dragging .tree,
html.dragging .ol-list { pointer-events: none; }
html.dragging .preview { content-visibility: auto; contain-intrinsic-size: auto 900px; }
html.dragging .katex-html { pointer-events: none; }
/* 拖动时把行号、高亮层彻底踢出布局（content-visibility 比 visibility
   更省：不只是不画，连布局都跳过），松手再恢复 */
html.dragging .hl-layer,
html.dragging .gutter-num { content-visibility: hidden; }
html.dragging .pane-edit,
html.dragging .pane-read,
html.dragging .sidebar,
html.dragging .outline-panel { contain: layout paint; }
/* 拖动时把大纲/树的滚动条与过渡关掉，避免额外合成 */
html.dragging * { transition: none !important; }

/* 平时也做 contain，减少无关区域的重排波及 */
.pane-edit { contain: layout paint; }
.pane-read { contain: layout paint; }
.outline-panel { contain: layout paint; }
.tree { contain: layout paint; }

/* ── 右键菜单 ─────────────────────────────────────── */
.ctxmenu { position: fixed; z-index: 60; min-width: 172px; padding: 5px;
  background: var(--card-solid); border: 1px solid var(--stroke-strong);
  border-radius: 8px; box-shadow: var(--shadow); animation: pop .1s ease; }
.ctxmenu[hidden] { display: none; }
.ctx-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px;
  border: 0; background: transparent; color: var(--text); font-size: 13px;
  text-align: left; border-radius: 5px; cursor: pointer; }
.ctx-item:hover { background: var(--hover); }
.ctx-item .ico { width: 14px; height: 14px; flex: none; color: var(--text-3); }
.ctx-item.star .ico { color: #e0a33a; }
.ctx-item.star.on .ico { fill: #e0a33a; }
.ctx-item.danger { color: var(--danger, #d13438); }
.ctx-item.danger .ico { color: var(--danger, #d13438); }
.ctx-sep { height: 1px; margin: 4px 8px; background: var(--stroke); }
@media (max-width: 860px) { .ctxmenu { display: none !important; } }

/* ── 左侧二级导航（文件树 / 收藏夹）────────────────────── */

/* 侧栏里两个面板互斥切换 */
.pane-inside { flex: 1 1 auto; min-height: 0; overflow: auto; }
.pane-inside[hidden] { display: none; }
.sidebar[data-pane="fav"] .side-top,
.sidebar[data-pane="fav"] .tree,
.sidebar[data-pane="fav"] .side-grip { display: none; }
.sidebar[data-pane="tree"] .pane-inside { display: none; }

/* ── 全屏页面层（顶掉 文件树 / 正文 / 大纲）──────────────── */
.page { position: absolute; inset: 0; z-index: 40; display: flex; flex-direction: column;
  background: var(--bg); animation: pagein .14s ease; }
.page[hidden] { display: none; }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } }
.page-top { height: 52px; flex: none; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; border-bottom: 1px solid var(--stroke); background: var(--card); }
.page-crumb { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; }
.page-crumb .ico { width: 15px; height: 15px; color: var(--text-3); }
.page-n { font-size: 12px; font-weight: 400; color: var(--text-3); }
.page-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 18px 22px; }
.tb-btn.danger { color: var(--danger, #d13438); }

/* 回收站卡片 */
.trash-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.trash-card { padding: 12px 14px; border: 1px solid var(--stroke); border-radius: var(--radius);
  background: var(--card); }
.trash-card .tc-t { font-size: 13.5px; font-weight: 600; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-card .tc-m { font-size: 11.5px; color: var(--text-3); margin-bottom: 9px; }
.trash-card .tc-a { display: flex; gap: 6px; }
.trash-card .tc-a button { padding: 4px 9px; border: 1px solid var(--stroke-strong);
  border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12px; cursor: pointer; }
.trash-card .tc-a button:hover { background: var(--hover); color: var(--text-1); }
.trash-card .tc-a .del { color: var(--danger, #d13438); }

/* 日历大页 */
.cal-body { display: flex; gap: 20px; }
.cal-big { flex: 1 1 auto; min-width: 0; }
.cal-side { flex: none; width: 300px; display: flex; flex-direction: column; min-height: 0; }
.cal-big .cal { font-size: 14px; }
.cal-big .cal .day { min-height: 62px; }
.cal-big .cal .day .n { font-size: 15px; }
@media (max-width: 860px) { .cal-body { flex-direction: column; } .cal-side { width: auto; } }

/* 设置页：左侧导航 + 右侧内容 */
.set-body { display: flex; gap: 0; padding: 0; overflow: hidden; }
.set-nav { flex: none; width: 168px; border-right: 1px solid var(--stroke); padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px; background: var(--card); }
.set-nav-btn { padding: 9px 12px; border: 0; border-radius: 7px; background: transparent;
  color: var(--text-2); font-size: 13.5px; text-align: left; cursor: pointer; }
.set-nav-btn:hover { background: var(--hover); color: var(--text-1); }
.set-nav-btn.on { background: var(--accent-soft, rgba(0,120,212,.12)); color: var(--accent); font-weight: 600; }
.set-main { flex: 1 1 auto; min-width: 0; overflow: auto; padding: 20px 26px 40px; }
.set-sec { display: none; max-width: 620px; }
.set-sec.on { display: block; }
@media (max-width: 720px) {
  .set-body { flex-direction: column; }
  .set-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid var(--stroke); }
}

/* 设置里的输入框 */
.set-input { flex: none; width: 230px; height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--stroke-strong); background: var(--input-bg, var(--card)); color: var(--text);
  font-size: 13px; outline: none; }
.set-input:focus { border-color: var(--accent); }
.set-input.short { width: 84px; text-align: center; font-weight: 600; }
.upload-box { flex: none; cursor: pointer; }
.upload-box > span { display: grid; place-items: center; width: 64px; height: 64px;
  border: 1px dashed var(--stroke-strong); border-radius: var(--radius); overflow: hidden;
  color: var(--text-3); font-size: 11.5px; background: var(--card); }
.upload-box > span:hover { border-color: var(--accent); color: var(--accent); }
.upload-box img { width: 100%; height: 100%; object-fit: cover; }

/* 用户头像：可以是图片，也可以是文字 */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gate .avatar, .gate-card .avatar { width: 44px; height: 44px; font-size: 17px; }

/* 访客开关：默认关且不可点 */
.sw.disabled { opacity: .5; cursor: not-allowed; }
.sw.disabled input { cursor: not-allowed; }
.set-note { margin: 6px 0 0; font-size: 11.5px; color: var(--text-3); line-height: 1.6;
  padding: 8px 10px; border-left: 2px solid var(--stroke-strong); background: var(--hover);
  border-radius: 0 6px 6px 0; }

/* 窄屏顶栏里的三个入口（回收站/日历/设置） */
.rail-mini { display: none; gap: 2px; }
@media (max-width: 860px) {
  .rail-mini { display: inline-flex; }
  .tb-btn.mini { padding: 0 5px; }
}
