/* 先生工作台 V1 —— 简洁、适合翻看、手机可用 */
/* 配色统一走语义变量：浅色在 :root，暗色在 :root[data-theme="dark"]（由顶栏「主题」按钮驱动；
   默认「跟随系统」= 头部脚本按 prefers-color-scheme 落 data-theme，无闪烁） */
:root {
  color-scheme: light dark;          /* 让原生控件/滚动条跟着主题走 */
  --bg: #F4F5FA;
  --panel: #FFFFFF;
  --bg2: #EEF0F7;                    /* 次级底：hover 行/引用块/行内代码 */
  --elev: #FAFBFE;
  --hover: #F0F1F8;
  --hover3: #EAECF6;
  --chip-bg: #F1F2F8;
  --chip-bg2: #EDEFF6;
  --ink: #1E2235;
  --ink-soft: #4B5068;
  --muted: #8A90A6;
  --hint: #B3B8CB;
  --line: #E6E8F0;
  --brand: #6C4DF6;
  --brand-weak: #EFEBFF;
  --on-brand: #FFFFFF;
  --ok: #22C48A;
  --ok-bg: #E3FBF1;
  --ok-ink: #118A5F;
  --warn: #F5A524;
  --warn-bg: #FFF4DC;
  --warn-line: #F6DFAE;
  --warn-ink: #B7770D;
  --danger: #F0506E;
  --danger-bg: #FFE9EE;
  --danger-line: #FFD4DE;
  --danger-ink: #C0284A;
  --mark-bg: #FFF3BF;
  --pin-bg: #FFFCF2;
  --frozen-bg: #FFF2E7;
  --review-weak: #F1EAFF;
  --focus-ring: 0 0 0 3px rgba(108,77,246,.16);
  --mask: rgba(30,34,53,.35);
  --mask-strong: rgba(30,34,53,.42);
  --shadow-card: 0 6px 26px rgba(30,34,53,.10), 0 1px 2px rgba(30,34,53,.05);
  --shadow-drawer: -8px 0 40px rgba(30,34,53,.10);
  --shadow-modal: 0 18px 60px rgba(30,34,53,.18);
  --shadow-pop: 0 14px 44px rgba(30,34,53,.16);
  --toast-err-bg: rgba(240,80,110,.95);
  --toast-err-ink: #FFFFFF;
  --cat-l: 52%;                      /* 「成长」类目色明度：暗色下抬到 62% 才不发闷 */
  --toast-bg: rgba(30,34,53,.92);
  --toast-ink: #FFFFFF;
  /* 状态标签色 */
  --st-draft: #8A90A6;
  --st-doing: #6C4DF6;
  --st-review: #8B72FF;
  --st-done: #22C48A;
}

/* 暗色：跟随系统（先生 2026-09-11 要求「dark theme detection」）；只覆盖颜色变量，版式零变化 */
/* 暗色：由主题开关的 data-theme 驱动（先生 9/11 要「按钮」；默认跟随系统，启动脚本写在 index.html 头部防闪）
   取值只在 v2.7.1 那一份里改，这里只做映射 */
:root[data-theme="dark"] {
    --bg: #12131C;
    --panel: #1A1C28;
    --bg2: #20222F;
    --elev: #191B26;
    --hover: #252836;
    --hover3: #2B2E3E;
    --chip-bg: #252836;
    --chip-bg2: #232634;
    --ink: #EDEEF6;
    --ink-soft: #A9AFC4;
    --muted: #7E849B;
    --hint: #555B70;
    --line: #2A2D3C;
    --brand: #9A85FF;
    --brand-weak: #262044;
    --on-brand: #12131C;   /* 暗色下按钮=亮蓝底 + 深字（白字在亮蓝上只有 3.2:1，不达标） */
    --ok: #2ED3A4;
    --ok-bg: #14312A;
    --ok-ink: #6FE3C0;
    --warn: #F5A524;
    --warn-bg: #33280F;
    --warn-line: #5A4720;
    --warn-ink: #FBCB72;
    --danger: #F0506E;
    --danger-bg: #3A2029;
    --danger-line: #5E2C3A;
    --danger-ink: #FF9AAE;
    --mark-bg: #4A3F1C;
    --pin-bg: #2A2519;
    --frozen-bg: #382A1E;
    --review-weak: #2A2144;
    --focus-ring: 0 0 0 3px rgba(154,133,255,.28);
    --mask: rgba(0,0,0,.55);
    --mask-strong: rgba(0,0,0,.62);
    --shadow-card: 0 6px 26px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.35);
    --shadow-drawer: -8px 0 40px rgba(0,0,0,.5);
    --shadow-modal: 0 18px 60px rgba(0,0,0,.6);
    --shadow-pop: 0 14px 44px rgba(0,0,0,.5);
    --toast-err-bg: rgba(240,80,110,.95);
    --toast-err-ink: #12131C;
    --cat-l: 62%;
    --toast-bg: rgba(237,238,246,.95);
    --toast-ink: #12131C;
    --st-draft: #A0A6B0;
    --st-doing: #9A85FF;
    --st-review: #C0AEFF;
    --st-done: #4ED9A8;
  }

* { box-sizing: border-box; margin: 0; padding: 0; }
/* HTML hidden 属性必须优先生效：防止 display:flex 等声明覆盖它导致"关不掉的层"
   （曾致 #file-panel 白框从页面加载起恒显示） */
[hidden] { display: none !important; }
html, body { height: 100%; overflow-x: hidden; }  /* 兜底防横向滚动 */
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

/* 顶栏 */
#topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 50px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.brand h1 { font-size: 16px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* v2.25.0：页头版本角标——一眼看出线上跑的是哪一版（防「以为更新了、其实没刷到」） */
.wd-version { font-size: 11px; font-weight: 400; color: var(--ink-soft); margin-left: 6px; white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-soft); display: inline-block;
}
.status-dot.up { background: var(--ok); }
.status-dot.down { background: var(--danger); }

.ghost-btn, .primary-btn {
  border-radius: 6px; padding: 6px 12px; cursor: pointer;
  font-size: 13px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink);
}
.primary-btn {
  background: var(--brand); border-color: var(--brand); color: var(--on-brand);
  font-weight: 500;
}
.ghost-btn:hover { border-color: var(--brand); color: var(--brand); }
.primary-btn:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* 布局 */
#layout { display: flex; min-height: calc(100vh - 50px); }
#sidebar {
  width: 150px; flex-shrink: 0;
  padding: 12px 8px; border-right: 1px solid var(--line);
  background: var(--panel);
}
#sidebar .mod {
  display: flex; align-items: baseline; gap: 8px;
  width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 2px;
  border: none; background: none; cursor: pointer;
  border-radius: 8px; color: var(--ink-soft); font-size: 14px;
}
#sidebar .mod .no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
#sidebar .mod:hover { background: var(--hover); color: var(--ink); }
#sidebar .mod.active { background: var(--brand-weak); color: var(--brand); font-weight: 600; }
#sidebar .mod.active .no { color: var(--brand); }
#sidebar .mod.count::after {
  content: attr(data-count); margin-left: auto; font-size: 11px;
  background: var(--brand-weak); color: var(--brand); border-radius: 9px;
  padding: 0 7px;
}

/* 当前卡片标签栏（竖排，最多直显 5 张、多余折叠） */
#sidebar .card-tabs {
  display: flex; flex-direction: column; gap: 3px;
  margin: 4px 2px 10px; padding: 8px 4px 2px;
  border-top: 1px dashed var(--line);
  max-height: none;
}
.card-tab {
  width: 100%; max-width: none;
  text-align: left; font-size: 13px; line-height: 1.4;
  padding: 7px 10px; border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--chip-bg); color: var(--ink-soft); cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tab:hover { border-color: var(--brand); color: var(--brand); }
.card-tab.active {
  border-color: var(--brand); background: var(--brand-weak);
  color: var(--brand); font-weight: 600;
}
.tabs-empty { font-size: 11px; color: var(--muted); padding: 2px 4px; }
details.card-tabs-more { margin-top: 2px; }
details.card-tabs-more > summary {
  cursor: pointer; user-select: none;
  font-size: 12px; color: var(--brand);
  padding: 5px 10px; border-radius: 6px;
}
details.card-tabs-more > summary:hover { background: var(--brand-weak); }
.card-tabs-more-body { margin-top: 3px; display: flex; flex-direction: column; gap: 3px; }
.archive-more { margin-top: 8px; text-align: center; }

/* 文件查看头部按钮组与编辑框 */
.fp-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.fp-btns button { min-height: 30px; padding: 4px 12px; font-size: 13px; }
#fp-editor {
  flex: 1; min-height: 0; width: 100%;
  border: none; resize: none; outline: none;
  padding: 16px 20px;
  font-family: inherit; font-size: 14px; line-height: 1.75;
  color: var(--ink); background: var(--panel);
}

#main { flex: 1; padding: 18px; max-width: 960px; min-width: 0; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 8px;
}
.page-head h2 { font-size: 18px; font-weight: 600; }
.page-actions { display: flex; gap: 8px; }

/* 卡片 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; cursor: pointer;
  transition: box-shadow .15s;
}
.card:hover { box-shadow: var(--shadow-card); }
.card.done { opacity: .72; }
.card .card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.card .card-title { font-weight: 600; font-size: 15px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .note {
  color: var(--ink-soft); font-size: 13px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 1.6em; margin-bottom: 6px;
}
.card .meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.card .links-inline a {
  color: var(--brand); text-decoration: none; margin-right: 8px;
}
.card .links-inline a:hover { text-decoration: underline; }

/* 状态标签 */
.tag {
  display: inline-block; font-size: 11px; line-height: 1; padding: 3px 8px;
  border-radius: 999px; white-space: nowrap;
}
.tag.state { color: var(--on-brand); background: var(--st-draft); }
.tag.state.doing { background: var(--st-doing); }
.tag.state.review { background: var(--st-review); }
.tag.state.done { background: var(--st-done); }
.tag.archive-flag { color: var(--warn); border: 1px solid var(--warn); background: var(--panel); }

/* 输入 */
input, textarea, select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  background: var(--panel); width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: var(--focus-ring);
}
textarea { resize: vertical; }

.idea-input { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 18px; }
.idea-input textarea { flex: 1; }
.idea-input button { flex-shrink: 0; height: 38px; }

/* 灵感条目 */
.idea-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
}
.idea-item .body { flex: 1; min-width: 0; }
.idea-item .content { white-space: pre-wrap; word-break: break-word; }
.idea-item .time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.idea-item .ops { display: flex; gap: 6px; flex-shrink: 0; }
.idea-item .ops button { padding: 4px 10px; font-size: 12px; }

/* 搜索 */
.search-row { display: flex; gap: 8px; margin-bottom: 14px; }
.search-row input { flex: 1; min-width: 0; }
.search-row button { flex-shrink: 0; }

.result-list .result {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 8px;
  font-size: 13px; word-break: break-all;
}
.result .r-file { color: var(--ink-soft); font-family: Consolas, Menlo, monospace; font-size: 12px; }
.result .r-file b { color: var(--brand); font-weight: 600; }
.result .r-snippet { margin-top: 2px; color: var(--ink); }
.result .r-snippet mark { background: var(--mark-bg); padding: 0 2px; border-radius: 2px; }
.result .name-mark {
  display: inline-block; font-size: 11px; color: var(--brand);
  border: 1px solid var(--brand); border-radius: 999px; padding: 0 6px; margin-left: 6px;
}
.empty-hint { color: var(--ink-soft); text-align: center; margin: 40px 0; }
.meta-line { font-size: 13px; color: var(--ink-soft); margin-bottom: 12px; }

/* 卡片详情面板 */
#panel-mask {
  position: fixed; inset: 0; background: var(--mask); z-index: 40;
}
#card-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: 400px; max-width: 92vw; overflow-y: auto;
  background: var(--panel); padding: 18px;
  box-shadow: var(--shadow-drawer);
}
#card-panel h3 { font-size: 16px; margin-bottom: 10px; }
#card-panel label { display: block; font-size: 12px; color: var(--ink-soft); margin: 10px 0 4px; }
#card-panel .form-row { display: flex; gap: 8px; }
#card-panel .form-row input { flex: 1; }
.panel-ops { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.panel-ops .spacer { flex: 1; }
.danger-btn {
  background: var(--panel); color: var(--danger); border: 1px solid var(--danger-line); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 13px;
}
.danger-btn:hover { background: var(--danger-bg); }
.links-list { list-style: none; }
.links-list li {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0; font-size: 13px;
}
.links-list a { color: var(--brand); text-decoration: none; word-break: break-all; }
.links-list a:hover { text-decoration: underline; }
.links-list .del-link {
  border: none; background: none; color: var(--muted); cursor: pointer; font-size: 14px;
  padding: 0 4px; flex-shrink: 0;
}
.links-list .del-link:hover { color: var(--danger); }
.link-kind {
  display: inline-block; font-size: 11px; color: var(--ink-soft);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; flex-shrink: 0;
}

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--toast-bg); color: var(--toast-ink);
  padding: 8px 16px; border-radius: 8px; font-size: 13px;
  z-index: 99; opacity: 0; pointer-events: none; transition: opacity .2s;
  max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; }
#toast.err { background: var(--toast-err-bg); color: var(--toast-err-ink); }

/* ===== 目录索引（03/04 打开即浏览）——树形折叠 ===== */
.idx-file {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 13px; margin-bottom: 6px;
  font-size: 14px; color: var(--ink); cursor: pointer;
}
.idx-file:hover { border-color: var(--brand); color: var(--brand); }
.idx-file .f-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.idx-file.pinned { border-color: var(--warn-line); background: var(--pin-bg); }
.idx-file .f-time { font-size: 12px; color: var(--muted); flex-shrink: 0; }

/* 目录树节点 */
details.idx-dir-node, details.idx-group { margin: 0; }
details.idx-dir-node > summary, details.idx-group > summary {
  display: flex; align-items: baseline; gap: 6px;
  cursor: pointer; user-select: none;
  padding: 7px 6px; border-radius: 6px;
  font-size: 14px; color: var(--ink);
}
details.idx-dir-node > summary { font-weight: 600; }
details.idx-group > summary { font-weight: 500; color: var(--ink-soft); }
details.idx-dir-node > summary:hover, details.idx-group > summary:hover { background: var(--hover3); }
details.idx-dir-node > summary::before, details.idx-group > summary::before {
  content: "▸"; flex-shrink: 0; font-size: 12px; color: var(--muted);
  transition: transform .12s;
}
details[open].idx-dir-node > summary::before, details[open].idx-group > summary::before {
  transform: rotate(90deg);
}
details.idx-dir-node > summary::-webkit-details-marker,
details.idx-group > summary::-webkit-details-marker { display: none; }
details.idx-dir-node > summary .nm, details.idx-group > summary .nm {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cnt {
  margin-left: auto; flex-shrink: 0;
  font-size: 11px; font-weight: 400; color: var(--muted);
}
.idx-node-body {
  margin: 2px 0 8px 10px; padding-left: 12px;
  border-left: 1px solid var(--line);
}
.idx-more { font-size: 12px; color: var(--muted); padding: 2px 0 6px 2px; }
.back-btn { min-height: 32px; padding: 4px 12px; }

/* 文件内容查看器（v2.8：桌面=右侧停靠抽屉，非模态无遮罩，页面仍可滚可点；手机全屏见响应式段） */
#file-panel {
  position: fixed; z-index: 71;
  top: 0; right: 0; bottom: 0; height: 100%;
  width: min(760px, 62vw);
  background: var(--panel); border-left: 1px solid var(--line);
  border-radius: 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-drawer);
  overflow: hidden;
  animation: fpSlideIn .18s ease-out;
}
@keyframes fpSlideIn { from { transform: translateX(18px); opacity: .6; } to { transform: none; opacity: 1; } }
.fp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.fp-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#fp-content {
  flex: 1; overflow: auto; margin: 0;
  padding: 16px 20px;
  font-size: 14px; line-height: 1.75;
  color: var(--ink);
}
/* 原文：保留旧 <pre> 的换行行为（按行 span.fp-line 承载） */
#fp-content.raw { white-space: pre-wrap; word-break: break-word; font-family: inherit; }
#fp-content.md { font-family: inherit; word-break: break-word; }

/* v2.8 markdown 正文排版（全部用颜色变量，暗色下可读；不写死色值） */
#fp-content.md h1, #fp-content.md h2, #fp-content.md h3, #fp-content.md h4 { line-height: 1.35; margin: 1.2em 0 .5em; font-weight: 600; }
#fp-content.md h1 { font-size: 22px; }
#fp-content.md h2 { font-size: 19px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
#fp-content.md h3 { font-size: 16px; }
#fp-content.md h4 { font-size: 14px; color: var(--ink-soft); }
#fp-content.md p, #fp-content.md li { margin: .35em 0; }
#fp-content.md ul, #fp-content.md ol { padding-left: 1.5em; }
#fp-content.md code { background: var(--bg2); padding: 1px 5px; border-radius: 3px; font-size: .92em; }
#fp-content.md pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow: auto; margin: .6em 0; }
#fp-content.md pre code { background: none; padding: 0; }
#fp-content.md blockquote { border-left: 3px solid var(--line); padding-left: 10px; color: var(--ink-soft); margin: .6em 0; }
#fp-content.md table { border-collapse: collapse; font-size: 13px; }
#fp-content.md th, #fp-content.md td { border: 1px solid var(--line); padding: 4px 8px; }
#fp-content.md th { background: var(--bg2); }
.md-table-wrap { overflow-x: auto; margin: .6em 0; }
#fp-content.md hr { border: none; border-top: 1px solid var(--line); margin: 1em 0; }
#fp-content.md img { max-width: 100%; }
/* 命中高亮：渲染态标题 / 原文态行 共用 */
#fp-content.md .hl, #fp-content .fp-line.hl { background: var(--mark-bg); border-radius: 2px; }

/* v2.12 待办「进度区」面板（#50）：一任务一文件，最常用＝随手追加一行。
   z-index 70：略低于文件查看器(71)——从进度区点开的文件/原文面板要能压在它上面 */
#tp-panel {
  position: fixed; z-index: 70;
  top: 0; right: 0; bottom: 0; height: 100%;
  width: min(560px, 58vw);
  background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-drawer);
  overflow: hidden;
  animation: fpSlideIn .18s ease-out;
}
.tp-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
}
.tp-title {
  font-size: 14px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tp-btns { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.tp-btns button { min-height: 30px; padding: 4px 12px; font-size: 13px; }
#tp-body {
  flex: 1; overflow: auto; padding: 14px 18px;
  font-size: 14px; line-height: 1.75; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
#tp-body .tp-line { display: block; }
#tp-body .tp-h { font-weight: 600; }
#tp-editor {
  flex: 1; margin: 0; padding: 14px 18px;
  border: none; outline: none; resize: none;
  background: var(--bg2); color: var(--ink);
  font-size: 14px; line-height: 1.75; font-family: inherit;
}
.tp-append {
  border-bottom: 1px solid var(--line);        /* v2.13.2：追加区在正文上方，用下边线分隔 */
  padding: 10px 16px;
  display: flex; gap: 8px; align-items: center;
}
.tp-append input[type="text"] {
  flex: 1; min-height: 34px;
  font-family: inherit; font-size: 14px; padding: 6px 10px;
}
.tp-append textarea {
  flex: 1; min-height: 44px; max-height: 140px; resize: vertical;
  font-family: inherit; font-size: 14px; padding: 8px 10px;
}
.tp-append button { min-height: 34px; flex-shrink: 0; }

/* 内嵌弹窗（替代原生 prompt，夸克等浏览器不支持）
   z-index 88：必须高于文件查看面板(71)/卡片面板(41)——否则文档打开时弹窗会被压在底下看不见
   （v1.12 bug：点「移动」弹窗被 #file-panel 盖住 → 先生看不到移动界面） */
.modal-mask {
  position: fixed; inset: 0; z-index: 88;
  background: var(--mask-strong);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--panel); border-radius: 12px;
  padding: 18px 18px 0; width: 360px; max-width: 100%;
  box-shadow: var(--shadow-pop);
  max-height: 82vh; overflow-y: auto;
}
.modal h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.modal-msg { font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.modal label { display: block; font-size: 12px; color: var(--ink-soft); margin: 10px 0 4px; }
.modal input[type="password"] { letter-spacing: .06em; }
.modal-ops {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 16px;
  /* v2.25.0（先生 9/24「工作台踩坑清单」对照）：动作行常驻视口——长内容滚到底也看得见「保存」
     ① sticky 底贴 ② 自带不透明底色（否则正文从按钮行下方透出，看着像叠字）
     ③ .modal 下内边距移到本条（padding-bottom:16px），sticky bottom:0 才贴得住底
     ⚠ 勿回归：全套靠 tools/modal-sticky-assert.js 钉住（含反证：关掉 sticky 必 FAIL） */
  position: sticky; bottom: 0; z-index: 1;
  background: var(--panel);
  padding: 0 0 16px;
}
/* v2.5：弹窗条件字段（showIf 隐藏用全局 [hidden] 兜底）+ 候选 chips + 校验提示 */
.modal-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.modal-chips .chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg2); color: var(--ink);
}
.modal-chips .chip:hover { border-color: var(--brand); color: var(--brand); }
.modal-err { color: var(--danger-ink); font-size: 12px; margin-top: 10px; }

/* ===== v1.1：当前工作区 / 分区切换 / 置顶 / 待处理 ===== */
/* 「当前工作」区 */
.cw-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px 12px; margin-bottom: 14px;
}
.cw-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.cw-head h3 { font-size: 14px; font-weight: 600; flex: 1; }
.cw-ops { display: flex; gap: 6px; flex-wrap: wrap; }
.cw-ops button { padding: 3px 10px; font-size: 12px; min-height: 0; }
.cw-list { display: flex; flex-direction: column; }
.cw-item { padding: 6px 8px; border-radius: 8px; }
.cw-item:hover { background: var(--bg2); }
.cw-item.done { opacity: .6; }
/* v2.10.1：状态栏不再与标题抢宽（手机上状态一长就把正文挤扁）——标题独占一行、状态独立成行 */
.cw-line1 { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.cw-title { font-weight: 600; font-size: 13px; min-width: 0; width: 100%; }
.cw-badge {
  flex-shrink: 0; font-size: 11px; padding: 1px 8px; border-radius: 999px;
  white-space: normal; word-break: break-word; max-width: 100%;
  text-align: left; line-height: 1.45; font-weight: 500;
}
.cw-badge.done { background: var(--ok-bg); color: var(--ok-ink); }
.cw-badge.todo { background: var(--chip-bg2); color: var(--ink-soft); }
.cw-badge.frozen { background: var(--frozen-bg); color: var(--warn); }
.cw-badge.merged { background: var(--review-weak); color: var(--st-review); }
.cw-badge.running { background: var(--brand-weak); color: var(--brand); }
.cw-badge.waiting { background: var(--warn-bg); color: var(--warn-ink); }   /* v2.5 意图型状态「等待中」 */
.cw-sub { font-size: 12px; color: var(--muted); margin-top: 1px; word-break: break-all; }
.cw-progress-last { font-size: 12px; color: var(--muted); margin-top: 2px; cursor: pointer; word-break: break-all; }  /* v2.13 行内进度摘要 */
.cw-raw { font-family: inherit; font-size: 13px; white-space: pre-wrap; color: var(--ink-soft); }

/* 分区切换 segmented（信息库：资料库/待处理） */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.log-list { display: flex; flex-direction: column; gap: 6px; }
.log-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.log-row:hover { background: var(--bg2, rgba(128,128,128,.06)); }
.log-row.today { border-color: var(--brand); }
.log-date { font-size: 15px; }
.log-row.today .log-date { font-weight: 600; }
.log-badge { font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.log-badge.filled { background: var(--brand); color: var(--on-brand); }
.log-badge.empty { border: 1px solid var(--line); color: var(--muted, #888); }
.seg button {
  border: none; background: var(--panel); color: var(--ink-soft);
  padding: 6px 16px; font-size: 13px; cursor: pointer;
}
.seg button.active { background: var(--brand); color: var(--on-brand); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--line); }

/* 置顶按钮（文件行 / 卡片） */
.pin-btn {
  border: none; background: none; cursor: pointer; padding: 2px 6px;
  font-size: 14px; line-height: 1; color: var(--hint); opacity: .75;
  border-radius: 6px; flex-shrink: 0;
}
.pin-btn:hover { color: var(--warn); opacity: 1; background: var(--warn-bg); }
.pin-btn.on { color: var(--warn); opacity: 1; }
.card-top .pin-btn { font-size: 15px; padding: 0 2px; margin-left: 2px; }

/* 待处理清单（信息库·v1.13：可跳转/可勾选） */
.inbox-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap; margin-bottom: 10px;
}
.inbox-toolbar .ghost-btn { padding: 3px 10px; font-size: 12px; min-height: 0; }
.inbox-list { display: flex; flex-direction: column; gap: 8px; }
.in-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 12px;
}
.in-item.done { opacity: .6; }
.in-item.done .in-main { text-decoration: line-through; }
.in-line { display: flex; align-items: flex-start; gap: 8px; }
.in-check {
  flex-shrink: 0; cursor: pointer; font-size: 17px; line-height: 1.35;
  color: var(--ink-soft); user-select: none; padding: 0 2px;
}
.in-check:hover { color: var(--brand); }
.in-item.done .in-check { color: var(--ok); }
.in-body { flex: 1; min-width: 0; }
.in-main { font-size: 14px; word-break: break-word; }
.in-meta { font-size: 12px; color: var(--muted); margin-top: 3px; word-break: break-word; }
.in-open {
  flex-shrink: 0; border: 1px solid var(--brand); background: var(--panel);
  color: var(--brand); border-radius: 6px; padding: 2px 10px;
  font-size: 12px; cursor: pointer; margin-top: 2px;
}
.in-open:hover { background: var(--brand-weak); }
.in-tag-nolink { flex-shrink: 0; font-size: 11px; color: var(--hint); margin-top: 5px; }

/* 文件正文按行渲染（锚点定位/高亮） */
#fp-content .fp-line { display: block; }
#fp-content .fp-line.hl { background: var(--mark-bg); border-radius: 2px; }

/* 回收站 */
#sidebar { display: flex; flex-direction: column; }
#sidebar .nav-bot { margin-top: auto; border-top: 1px dashed var(--line); border-radius: 0 0 8px 8px; padding-top: 10px; }
.trash-list { display: flex; flex-direction: column; gap: 8px; }
.tr-item {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 14px;
}
.tr-item.gone { opacity: .55; }
.tr-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tr-name { font-weight: 600; font-size: 14px; word-break: break-all; }
.tr-time { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.tr-sub { font-size: 12px; color: var(--ink-soft); margin: 2px 0 8px; word-break: break-all; }
.tr-ops { display: flex; gap: 8px; }
.tr-ops .ghost-btn { padding: 4px 14px; font-size: 13px; }
.tr-ops .danger-btn { padding: 4px 14px; font-size: 13px; }

/* ===================== 响应式 ===================== */

/* 桌面：点 ☰（#nav-toggle）折叠左侧导航，单栏阅读 */
@media (min-width: 769px) {
  body.sb-collapsed #sidebar { display: none; }
  body.sb-collapsed #layout { display: block; }
}

/* v2.9 桌面端左侧导航固定：整页滚动时导航贴在顶栏下沿（不再被滚走）
   50px = 顶栏 #topbar 高度；align-self:flex-start 必须（否则 flex 行拉伸成整高 → sticky 失效）；
   height/max-height + overflow-y:auto → 导航比视口高时自身可滚，不撑破。
   手机端（≤768px）不受影响（那里 #sidebar 已是 fixed 抽屉，见下方媒体查询）。 */
@media (min-width: 769px) {
  #sidebar {
    position: sticky; top: 50px;
    align-self: flex-start;
    height: calc(100vh - 50px);
    max-height: calc(100vh - 50px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* 手机/窄屏（≤768px）：左侧导航变抽屉，默认收起，☰ 开合 */
@media (max-width: 768px) {
  body { font-size: 15px; }
  #topbar { height: 48px; padding: 0 6px 0 2px; }
  .brand h1 { font-size: 15px; }
  .nav-toggle { min-width: 44px; min-height: 44px; font-size: 20px; }

  #sidebar {
    position: fixed; z-index: 50;
    top: 48px; left: 0; bottom: 0;
    width: 232px; padding: 12px 10px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex; flex-direction: column; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .18s ease;
  }
  body:not(.sb-collapsed) #sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow-drawer);
  }
  #sidebar .mod {
    flex: 0 0 auto; min-height: 48px;
    padding: 12px 14px; margin-bottom: 4px;
    font-size: 15px; border-radius: 10px;
  }
  #sidebar .mod .no { display: none; }

  #main {
    padding: 14px 12px calc(env(safe-area-inset-bottom, 0px) + 28px);
  }

  /* 触屏友好：输入不自动缩放、主按钮/可点区 ≥ 40px */
  input, textarea, select { font-size: 16px; }
  .ghost-btn, .primary-btn {
    min-height: 40px; padding: 10px 16px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .search-row { align-items: stretch; }

  /* 卡片在手机上更舒展，标题允许换行 */
  .card { padding: 13px 14px; }
  .card .card-title { font-size: 16px; white-space: normal; }
  .card .note { -webkit-line-clamp: 3; }
  .card-grid { grid-template-columns: 1fr; }

  /* 目录树触屏可点 */
  details.idx-dir-node > summary, details.idx-group > summary {
    min-height: 44px; align-items: center; padding: 8px 6px;
  }
  .idx-node-body { margin-left: 6px; padding-left: 10px; }

  /* 灵感条目：按钮下沉一行，更好点 */
  .idea-item { flex-direction: column; gap: 6px; }
  .idea-item .ops { align-self: flex-end; }
  .idea-item .ops button { min-height: 40px; padding: 8px 16px; font-size: 13px; }

  .idea-input { flex-direction: column; align-items: stretch; }
  .idea-input button { height: auto; }

  #card-panel { width: 100%; max-width: 100%; }

  /* 内嵌弹窗按钮可点区 */
  .modal-ops button { min-height: 44px; }
  /* 文件查看器手机全屏（v2.8 桌面改抽屉后：手机仍全屏，去掉桌面那条左边框） */
  #file-panel { width: 100vw; height: 100%; max-height: none; border-radius: 0; border-left: none; }
  /* v2.12 进度区面板手机同样全屏 */
  #tp-panel { width: 100vw; border-left: none; }
  .tp-btns button { min-height: 34px; }
  #tp-body, #tp-editor { padding: 12px 14px; font-size: 15px; }
  .tp-head { padding: 8px 12px; }
  #fp-content { padding: 12px 14px; font-size: 15px; }
  .fp-head { padding: 8px 12px; }
  #toast { font-size: 14px; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); }
}

/* 超窄屏（≤420px）细节收紧 */
@media (max-width: 420px) {
  #topbar { height: 46px; }
  #sidebar { top: 46px; }
  #main { padding: 12px 10px; }
  .page-head { align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .ghost-btn, .page-actions .primary-btn { flex: 1; }
  .card .links-inline a { display: block; margin: 3px 0; }
  .meta-line, .result { word-break: break-all; }
}

/* v1.1 触屏细节：分区按钮/置顶/当前工作区操作 */
@media (max-width: 768px) {
  .cw-ops .ghost-btn { min-height: 0; padding: 8px 12px; }
  .seg { width: 100%; }
  .seg button { flex: 1; min-height: 40px; padding: 8px 0; }
  .idx-file .pin-btn { padding: 6px 8px; font-size: 16px; }
  .card-top .pin-btn { padding: 6px 4px; }
  .cw-item { padding: 8px 6px; }
  .fp-btns button { min-height: 36px; padding: 6px 12px; }
  .in-check { font-size: 22px; padding: 2px 4px; }
  .in-open { min-height: 40px; padding: 6px 12px; }
  .inbox-toolbar .ghost-btn { min-height: 40px; padding: 8px 12px; }
}

/* ===================== v2.1：左侧导航可拖排序 + 指令技能面板 ===================== */

/* 导航项拖拽手柄（⠿）：hover 显示、按住上下拖动排序 */
#sidebar .mod { position: relative; }
.nav-drag {
  margin-left: auto; flex-shrink: 0;
  cursor: grab; color: var(--hint); font-size: 13px; line-height: 1;
  padding: 4px 2px 4px 10px; user-select: none; touch-action: none;
}
.nav-drag:hover, .nav-drag:active { color: var(--brand); }
.mod.dragging { opacity: .5; outline: 1px dashed var(--brand); }

/* 指令技能面板：条目行 */
.cmd-body { display: flex; flex-direction: column; }
.cmd-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; margin-bottom: 6px;
}
.cmd-item .cmd-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmd-item .cmd-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
  font-family: Consolas, Menlo, "Courier New", monospace;
  word-break: break-all;
}
.cmd-item .cmd-desc {
  font-size: 12px; color: var(--ink-soft); word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cmd-item .cmd-usage {
  font-size: 11px; color: var(--muted); word-break: break-word;
  font-family: Consolas, Menlo, "Courier New", monospace;
}
.cmd-item .cmd-alias { font-size: 11px; color: var(--muted); }
.cmd-item .cmd-badge {
  align-self: flex-start; font-size: 10px; line-height: 1;
  color: var(--warn); border: 1px solid var(--warn-line); border-radius: 999px;
  padding: 2px 7px; flex-shrink: 0; white-space: nowrap;
}
.cp-btn {
  flex-shrink: 0; min-width: 52px;
  border: 1px solid var(--brand); background: var(--panel); color: var(--brand);
  border-radius: 6px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.cp-btn:hover { background: var(--brand-weak); }
.cp-btn:active { transform: scale(.97); }
.cmd-gloss {
  flex: 1 1 auto; min-width: 0;
  font-size: 11px; font-weight: 400; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* 指令技能面板手机适配（触屏 ≥40px 点击区 + 条目更舒展） */
@media (max-width: 768px) {
  .nav-drag { padding: 10px 6px 10px 12px; font-size: 15px; }   /* 拖拽手柄 44px 命中区 */
  #sidebar .mod .nm { min-width: 0; }
  .cmd-item { padding: 10px 12px; }
  .cp-btn { min-width: 56px; min-height: 40px; padding: 8px 12px; font-size: 13px; }
  .cmd-item .cmd-name { font-size: 15px; }
  .cmd-item .cmd-desc { font-size: 13px; }
}

/* ===================== v2.1.1/v2.1.2：当前工作条目操作区（原文件/外链/归档） ===================== */
.cw-ops { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.cw-file-btn {
  border: 1px solid var(--brand); background: var(--panel); color: var(--brand);
  border-radius: 6px; padding: 3px 12px; font-size: 12px; cursor: pointer;
  font-family: inherit;
}
.cw-file-btn:hover { background: var(--brand-weak); }
.cw-file-btn.cw-url { border-color: var(--warn); color: var(--warn); }
.cw-file-btn.cw-url:hover { background: var(--warn-bg); }
.cw-arch {
  margin-left: auto; flex-shrink: 0;
  border: 1px solid var(--ok); background: var(--panel); color: var(--ok-ink);
  border-radius: 6px; padding: 3px 12px; font-size: 12px; cursor: pointer;
  font-family: inherit; font-weight: 500;
}
.cw-arch:hover { background: var(--ok-bg); }
.cw-arch.cw-restore {
  margin-left: auto;
  border-color: var(--ink-soft); color: var(--ink-soft);
}
.cw-arch.cw-restore:hover { background: var(--hover); }
/* v2.1.2 当前工作数量徽标 + 条目序号 */
.cw-count {
  font-size: 12px; line-height: 1; color: var(--brand); font-weight: 500;
  background: var(--brand-weak); border-radius: 999px; padding: 4px 10px;
  flex-shrink: 0;
}
.cw-num {
  flex-shrink: 0; width: 22px; height: 22px; line-height: 22px;
  text-align: center; border-radius: 6px;
  background: var(--brand-weak); color: var(--brand);
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
}
/* v2.10 序号可点编辑（未完成行；button 化：去 UA 边框 + hover 提示 + 扩大命中区）
   命中区用 ::after 外扩，不改变胶囊视觉尺寸、不挤压同行标题 */
button.cw-num-edit {
  border: 0; font-family: inherit; cursor: pointer; padding: 0;
  position: relative;
}
button.cw-num-edit::after { content: ""; position: absolute; inset: -6px -4px; }
button.cw-num-edit:hover, button.cw-num-edit:focus-visible {
  outline: 1px dashed currentColor; outline-offset: 1px;
  filter: brightness(.94);
}
@media (max-width: 768px) {
  button.cw-num-edit::after { inset: -9px -6px; }   /* 命中区 ≥34×40px（手机） */
}
/* v2.4 当前工作条目「#」身份号（标题末位；与 Booton 对话引用的 #编号 对齐）
   高亮版：先生 9/10 实测反馈「淡灰看着不明显」→ 实心品牌色胶囊 + 白字加粗 */
.cw-idnum {
  margin-left: 6px; padding: 1px 8px; border-radius: 999px;
  background: var(--brand); color: var(--on-brand);
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* v2.1.3 状态徽标可点改（button 化：去 UA 边框 + hover 提示） */
button.cw-badge {
  border: 1px solid transparent; font-family: inherit; cursor: pointer;
  padding: 2px 0;
}
button.cw-badge:hover {
  outline: 1px dashed currentColor; outline-offset: 2px;
  filter: brightness(.96);
}
@media (max-width: 768px) {
  .cw-file-btn, .cw-arch { min-height: 36px; padding: 6px 12px; font-size: 13px; }
  .cw-num { width: 24px; height: 24px; line-height: 24px; }
}

/* ===================== v2.1.4：当前工作条目拖动排序（未完成行行首手柄 ⠿） ===================== */
.cw-drag {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: center; flex-shrink: 0; min-width: 20px;
  cursor: grab; color: var(--hint); font-size: 13px; line-height: 1;
  user-select: none; touch-action: none; padding: 2px 4px;
}
.cw-drag:hover, .cw-drag:active { color: var(--brand); }
.cw-item.dragging { opacity: .5; outline: 1px dashed var(--brand); }
/* 手机：手柄加宽 ≥40px 命中区（touch-action none 已在基础块，防滚动冲突） */
@media (max-width: 768px) {
  .cw-drag { min-height: 40px; min-width: 30px; font-size: 15px; padding: 0 6px; margin-left: -6px; }
}


/* ===== v2.6 成长（journey）：技能 + 记忆时间线 ===== */
.jn-body { display: flex; flex-direction: column; gap: 12px; }
.jn-stats {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  padding: 10px 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.jn-stat { color: var(--ink-soft); }
.jn-stat b { color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; }
.jn-span, .jn-top { color: var(--muted); }

.jn-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.jn-fcat {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink-soft);
  border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer;
}
.jn-fcat b { color: var(--ink); font-weight: 600; }
.jn-fcat.on { border-color: var(--brand); color: var(--brand); background: var(--brand-weak); }
.jn-fcat[style*="--h"]::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: hsl(var(--h) 65% var(--cat-l)); margin-right: 5px; vertical-align: middle;
}

.jn-timeline { display: flex; flex-direction: column; gap: 10px; }
.jn-day { display: flex; gap: 10px; align-items: flex-start; }
.jn-date {
  flex: 0 0 58px; font-size: 12px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums; padding-top: 3px;
}
.jn-date span { display: block; color: var(--muted); font-size: 11px; }
.jn-nodes { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.jn-node {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  border: 1px solid var(--line); background: var(--panel); border-radius: 7px;
  padding: 4px 9px; font-size: 13px; cursor: pointer; text-align: left; color: var(--ink);
}
.jn-node .jn-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jn-skill { border-left: 3px solid hsl(var(--h) 65% var(--cat-l)); }
.jn-skill .jn-use { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.jn-mem {
  border-left: 3px dashed var(--muted); background: var(--elev);
  color: var(--ink-soft); font-size: 12.5px;
}
.jn-node:hover { border-color: var(--brand); }
.jn-node.sel { border-color: var(--brand); background: var(--brand-weak); }

.jn-detail {
  border: 1px solid var(--brand); border-radius: 8px;
  padding: 10px 12px; background: var(--brand-weak);
}
.jn-detail-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jn-detail-meta { color: var(--ink-soft); font-size: 12px; flex: 1 1 auto; min-width: 0; }
.jn-text { white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.jn-rel { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.jn-rel-t { font-size: 12px; color: var(--ink-soft); }
.jn-relink {
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--ink);
}
.jn-relink:hover { border-color: var(--brand); color: var(--brand); }
.jn-foot { font-size: 12px; color: var(--muted); }
.jn-foot code { background: var(--hover); padding: 1px 4px; border-radius: 3px; }

@media (max-width: 768px) {
  .jn-date { flex-basis: 44px; }
  .jn-node { font-size: 12.5px; }
  .jn-stat b { font-size: 14px; }
}


/* ===== v2.7 多用户 + 留言板 ===== */
.who-line { font-size: 12px; color: var(--ink-soft); margin-right: 2px; }
body.role-ro .w-only { display: none !important; }
/* v2.9：只读角色隐藏导航拖拽手柄（与 desk.js「当前工作」只读不渲染 ⠿ 一致；拖拽本就被 bindNavDrag 的 canWrite 挡住） */
body.role-ro #sidebar .nav-drag { display: none !important; }

.bd-compose {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; margin-bottom: 14px;
}
.bd-compose textarea { width: 100%; resize: vertical; }
.bd-compose-ops { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.bd-compose-ops .bd-reply-hint { flex: 1; font-size: 12px; color: var(--ink-soft); }
.bd-reply-hint .bd-cancel-reply {
  border: 1px solid var(--line); background: var(--panel); border-radius: 4px;
  font-size: 11px; padding: 1px 6px; cursor: pointer; margin-left: 6px;
}

.bd-list { display: flex; flex-direction: column; gap: 10px; }
.bd-msg {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px;
}
.bd-msg.pinned { border-color: var(--brand); background: var(--brand-weak); }
.bd-msg.from-agent { border-left: 3px solid var(--st-review); }
.bd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bd-author { font-weight: 600; font-size: 13px; }
.bd-author.r-owner { color: var(--brand); }
.bd-author.r-guest { color: var(--st-done); }
.bd-author.r-agent { color: var(--st-review); }
.bd-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bd-pin-tag { font-size: 11px; color: var(--brand); border: 1px solid var(--brand); border-radius: 3px; padding: 0 4px; }
.bd-quote {
  font-size: 12px; color: var(--ink-soft); background: var(--bg2);
  border-left: 2px solid var(--line); padding: 3px 8px; margin: 6px 0; border-radius: 3px;
}
.bd-body { white-space: pre-wrap; word-break: break-word; margin-top: 6px; }
.bd-ops { display: flex; gap: 6px; margin-top: 8px; }
.bd-ops button { padding: 2px 8px; font-size: 12px; }

@media (max-width: 768px) {
  .bd-compose-ops { flex-wrap: wrap; }
}

/* ===== v2.11 生词库（terms）===== */
:root { --terms-sticky-top: 50px; --terms-bar-h: 34px; }
.terms-meta { font-size: 12px; color: var(--muted, #888); margin: 6px 0 10px; }
.terms-nav {
  /* 页面跟随（先生 9/14：字母索引 bar 钉在顶栏下沿；9/14 修：不能挡住正文）
     三处防挡：① 单行不换行 + 横向滚动 —— 14 个字母在窄屏换行会让 bar 变成 2~3 行高，钉住后压住大片正文
               ② 减薄上下 padding、底部贴 1px 线收边（视觉有界、占位最小）
               ③ 只在 bar 自身范围铺背景板，不额外加高
     高度不写死：`--terms-bar-h` 由 terms.js 运行时量出写入（字体加载/换行/断点都跟得上） */
  display: flex; flex-wrap: nowrap; gap: 6px;
  overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  position: sticky; top: var(--terms-sticky-top, 50px); z-index: 10;
  background: var(--bg);
  margin: 0 -18px 10px; padding: 6px 18px;
  border-bottom: 1px solid var(--line);
}
.terms-nav::-webkit-scrollbar { display: none; }
.terms-nav .terms-jump { flex: 0 0 auto; }
/* 无 JS 兜底：原生锚点跳转的避让量 = 顶栏下沿 + bar 实时高度 + 间隙（与 JS 落点同一公式） */
.terms-group { scroll-margin-top: calc(var(--terms-sticky-top, 50px) + var(--terms-bar-h, 34px) + 8px); }
/* 正在跳转的字母高亮（点字母 → 定位后标记） */
.terms-jump.active { background: var(--accent, #3d7eff); color: #fff; }
@media (max-width: 768px) {
  .terms-nav { margin: 0 -10px 10px; padding: 6px 10px; }
  :root { --terms-sticky-top: 48px; }   /* 该断点 #topbar 高 48px；scroll-margin 由变量自动跟随 */
}
.terms-jump { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 10px;
  background: var(--chip, #f0f0f2); color: inherit; text-decoration: none; font-size: 12px; font-weight: 600; }
.terms-jump span { font-weight: 400; opacity: .6; font-size: 11px; }
.terms-group { margin-bottom: 18px; }
.terms-letter { font-size: 13px; font-weight: 700; letter-spacing: 1px; opacity: .55;
  border-bottom: 1px solid var(--line, #e6e6ea); padding-bottom: 4px; margin-bottom: 8px; }
.terms-item { padding: 8px 10px; border-radius: 8px; background: var(--card, #fafafb); margin-bottom: 6px; }
.terms-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.terms-term { font-weight: 700; font-size: 14px; }
.terms-cn { font-size: 13px; opacity: .8; }
.terms-date { font-size: 11px; opacity: .5; margin-left: auto; }
.terms-lines { margin-top: 5px; font-size: 13px; line-height: 1.55; }
.terms-line { opacity: .85; }
.terms-loading { padding: 16px; text-align: center; opacity: .6; font-size: 13px; }

/* ===== v2.11.7 待处理：原文已不在的状态标记 ===== */
.in-item.stale .in-main { color: var(--muted, #888); }
.in-item.stale .in-open { opacity: .55; }
.in-tag-missing {
  flex: 0 0 auto; font-size: 11px; line-height: 1.5; padding: 1px 6px; border-radius: 4px;
  color: #b45309; border: 1px solid rgba(180, 83, 9, .45); background: rgba(245, 158, 11, .12);
}
[data-theme="dark"] .in-tag-missing {
  color: #fbbf24; border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .12);
}

/* ===== v2.14 看板（kanban）：状态统计 / 任务卡 / 事件 ===== */
.kn-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.kn-stat { font-size: 12px; padding: 3px 9px; border-radius: 10px; background: var(--chip, #f0f0f2); }
.kn-stat b { font-size: 13px; }
.kn-stat.kn-dim { opacity: .6; }
.kn-group { font-size: 13px; font-weight: 700; margin: 18px 0 8px; opacity: .75; }
.kn-card { border: 1px solid var(--line, #e6e6ea); border-left-width: 3px; border-radius: 10px;
  padding: 10px 12px; margin-bottom: 8px; background: var(--card, #fafafb); }
.kn-card.kn-run { border-left-color: #3d7eff; }
.kn-card.kn-rev { border-left-color: #a855f7; }
.kn-card.kn-ready { border-left-color: #22c55e; }
.kn-card.kn-todo, .kn-card.kn-other { border-left-color: #9ca3af; }
.kn-card.kn-blk { border-left-color: #ef4444; }
.kn-card.kn-done, .kn-card.kn-arch { border-left-color: #d1d5db; opacity: .82; }
.kn-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.kn-badge { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--chip, #eee); }
.kn-badge.kn-run { background: rgba(61, 126, 255, .15); color: #2563eb; }
.kn-badge.kn-rev { background: rgba(168, 85, 247, .15); color: #7c3aed; }
.kn-badge.kn-ready { background: rgba(34, 197, 94, .15); color: #15803d; }
.kn-badge.kn-blk { background: rgba(239, 68, 68, .15); color: #b91c1c; }
.kn-id { font-size: 11px; opacity: .45; font-family: ui-monospace, monospace; }
.kn-title { font-weight: 600; font-size: 14px; line-height: 1.45; }
.kn-meta { font-size: 12px; opacity: .7; margin-top: 4px; }
.kn-fail { color: #b91c1c; }
.kn-result { font-size: 13px; margin-top: 6px; line-height: 1.55; }
.kn-k { font-size: 11px; opacity: .55; margin-right: 4px; }
.kn-body { margin-top: 6px; }
.kn-body summary { cursor: pointer; opacity: .7; font-size: 12px; }
.kn-body pre { white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; font-size: 12px; opacity: .85; }
.kn-events { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11px; opacity: .6; }
.kn-events li { display: flex; gap: 8px; }
.kn-ev { font-family: ui-monospace, monospace; }
.kn-ev-time { margin-left: auto; }

/* ===== v2.16 视觉层（soft-deck · 浅色柔和卡片风）=====
   先生 2026-09-21 拍板接入（外部 skill soft-deck；来源与审查留痕见开发日志 D-243）。
   定调三条：结构靠阴影不靠边线；颜色是数据不是装饰；文字永远深色。
   实现原则：**只改观感，不动 DOM 与 JS**——变量层换色（见 :root/:root[data-theme]）
   ＋ 本段覆盖组件外观；故既有行为验收（jsdom）与几何断言不受影响。
   回滚＝删本段 ＋ 还原变量块。 */

/* —— 顶栏：半透明 + 背景模糊，去硬边观感 —— */
#topbar {
  background: rgba(244,245,250,.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
:root[data-theme="dark"] #topbar { background: rgba(18,19,28,.88); }

/* —— 侧栏：白底卡片式导航，激活项淡紫底 —— */
#sidebar { border-right: 1px solid var(--line); }
#sidebar .mod { border-radius: 14px; }
#sidebar .mod.active { background: var(--brand-weak); }
#sidebar .card-tabs { border-top: 1px dashed var(--line); }

/* —— 卡片：无边框、大而柔的阴影、圆角 16~18（soft-deck 核心）——
   保留 1px 透明边框占位：不动尺寸，避免任何布局度量变化 */
.card,
.cw-box, .tr-item, .idea-item, .cmd-item, .bd-msg, .bd-compose,
.in-item, .log-row, .idx-file, .jn-stats, .jn-detail, .terms-item, .kn-card {
  border-color: transparent;
  border-radius: 16px;
  box-shadow: var(--shadow-card);
}
.card { border-radius: 18px; }
.cw-box { border-radius: 18px; }
.terms-item { border-radius: 14px; }
.card:hover { box-shadow: var(--shadow-pop); }

/* —— 按钮 / 输入：圆角加大、去硬边 —— */
.ghost-btn, .primary-btn, .danger-btn, .cp-btn, .cw-file-btn,
.cw-arch, .in-open, .back-btn, .fp-btns button, .tp-btns button {
  border-radius: 12px;
}
input, textarea, select {
  border-radius: 12px;
  background: var(--bg2);
  border-color: transparent;
}
input:focus, textarea:focus, select:focus {
  background: var(--panel);
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
}

/* —— 标题与数字更挺（不动字体栈：几何断言按实测量算，换字体＝换度量）—— */
.page-head h2 { font-weight: 700; letter-spacing: -.01em; }
.card .card-title { font-weight: 700; }
.jn-stat b, .kn-stat b, .cw-count, .log-date { font-variant-numeric: tabular-nums; }

/* —— 胶囊/徽标统一全圆角 —— */
.tag, .cw-badge, .chip, .log-badge, .kn-badge, .modal-chips .chip { border-radius: 999px; }

/* —— 弹窗 / 抽屉：圆角与柔影跟上 —— */
.modal { border-radius: 20px; box-shadow: var(--shadow-pop); }
#card-panel, #file-panel, #tp-panel { box-shadow: var(--shadow-drawer); }

/* ===== v2.17 工作台首页版式（soft-deck 样板落地：统计带 + 双列 + 图标方块）=====
   先生 2026-09-21「我喜欢预览那一版，你现在就是换了个颜色嘛，你直接从工作台首页开」
   —— v2.16 只到皮肤层（色/影/圆角），本段补**结构层**三样：
     ① 统计带（一排彩色数字块）② 双列栅格（左主：当前工作＋卡片墙／右辅：今日·收件箱·快捷）
     ③ 导航图标方块。DOM 由 index.html + desk.js + app.js 提供，本段只管样子。
   数字口径＝既有只读接口（/current-work、/cards?status=active、/kanban、/terms、/inbox），
   取不到就显示「—」，**不编数**。 */

/* —— ① 统计带 —— */
.stat-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin:0 0 16px; }
.tile { border-radius:18px; padding:15px 17px; min-width:0; }
.tile .v { font-size:26px; font-weight:800; line-height:1.05; letter-spacing:-.02em; font-variant-numeric:tabular-nums; }
.tile .l { font-size:12.5px; font-weight:700; margin-top:9px; }
.tile .s { font-size:11.5px; opacity:.72; margin-top:3px; }
.tile.lavender { background:#EFEBFF; color:#5B3DF5; }
.tile.mint { background:#E3FBF1; color:#0E7C57; }
.tile.sky { background:#E3F2FF; color:#0B63B8; }
.tile.peach { background:#FFE9DF; color:#C2410C; }
:root[data-theme="dark"] .tile.lavender { background:#262044; color:#BCA9FF; }
:root[data-theme="dark"] .tile.mint { background:#14312A; color:#6FE3C0; }
:root[data-theme="dark"] .tile.sky { background:#12283F; color:#7CC0FF; }
:root[data-theme="dark"] .tile.peach { background:#3A2418; color:#FFAB7A; }

/* —— ② 双列栅格 —— */
.desk-cols { display:grid; grid-template-columns:minmax(0,1fr) 320px; gap:16px; align-items:start; }
.desk-col-side { display:flex; flex-direction:column; gap:14px; }
.side-card { padding:16px 18px; border-radius:18px; }
.side-card h3 { font-size:13.5px; font-weight:700; margin:0 0 3px; }
.side-card .sub { font-size:11.5px; color:var(--muted); margin-bottom:9px; }
.side-row { display:flex; align-items:baseline; justify-content:space-between; gap:10px; padding:9px 0; border-top:1px solid var(--line); font-size:12.5px; color:var(--ink-soft); }
.side-row:first-of-type { border-top:none; }
.side-big { font-size:21px; font-weight:800; line-height:1; color:var(--ink); font-variant-numeric:tabular-nums; }
.side-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:4px; }
.side-actions > button { flex:0 0 auto; }
@media (max-width:1180px) {
  .desk-cols { grid-template-columns:minmax(0,1fr); }
  .desk-col-side { flex-direction:row; flex-wrap:wrap; }
  .desk-col-side > .side-card { flex:1 1 240px; }
}
@media (max-width:900px) {
  .stat-row { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  .tile .v { font-size:23px; }
  .tile { padding:13px 14px; }
}

/* —— ③ 导航图标方块（彩色小块，不用图标库；颜色由 app.js 按模块给）—— */
#sidebar .mod { display:flex; align-items:center; gap:9px; }
#sidebar .mod .ico { width:26px; height:26px; border-radius:9px; display:grid; place-items:center; font-size:11.5px; font-weight:700; color:#fff; flex:none; }
#sidebar .mod .nm { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#sidebar .mod .nav-drag { margin-left: auto; }

/* ===== v2.18 布局宽度优化 =====
   先生 2026-09-21：「左侧的 tab 栏能不能左右拉长缩小，加了小图标之后把文字挡住了；
   电脑浏览器上右边空出了很多，有办法优化没」——两件事：
   ① 侧栏：默认 150 → **172px**（图标 26 + gap 9 吃掉 35px 后，文字才有地方）＋ **可拖拽调宽**
      （150–340，拖把手/. 双击复位/键盘←→，宽度存 localStorage，≤768px 抽屉模式不启用）；
   ② 主区：上限 960 → **宽屏渐进加宽 ＋ 居中**（≥1200:1120 ／ ≥1600:1320），少一半右侧空白。
   为什么加宽不伤阅读：workdesk 的正文阅读走**右侧文件面板**（固定宽），主区全是列表/仪表盘/看板。 */

@media (min-width: 769px) { #sidebar { width: 172px; } }

/* 拖拽把手：零宽度 + 伪元素热区（不占布局、不挤内容） */
.nav-resizer { flex: 0 0 0; width: 0; position: relative; cursor: col-resize; z-index: 6; touch-action: none; }
.nav-resizer::after {
  content: ""; position: absolute; left: -3px; top: 0; bottom: 0; width: 6px;
  background: transparent; transition: background .12s;
}
.nav-resizer:hover::after, .nav-resizer:focus-visible::after { background: var(--brand); }
.nav-resizer:focus-visible { outline: none; }

/* 主内容区：宽屏利用起来（居中，两侧留白对称） */
#main { max-width: 1120px; margin: 0 auto; }
@media (max-width: 1199px) { #main { max-width: 960px; } }
@media (min-width: 1600px) { #main { max-width: 1320px; } }
@media (max-width: 768px) {
  .nav-resizer { display: none !important; }
  #main { max-width: none; }
}

/* ===== v2.19 手机面板把手条（先生 9/21：「每次关闭都得点右上角的按钮」）=====
   手机上面板是全屏（100vw）⇒ 没有「点空处」的余地，桌面那套 outside-click 在手机上无空处可点；
   故顶部给一条整宽可点区（拇指可达、视线自然落点），点击＝请求关闭（脏数据先自动保存）。桌面隐藏。 */
.sheet-grip {
  display: none;
  align-items: center; justify-content: center;
  min-height: 30px; flex: none;
  font-size: 12px; color: var(--muted);
  background: var(--panel); border-bottom: 1px solid var(--line);
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.sheet-grip:active { background: var(--hover); }
@media (max-width: 768px) { .sheet-grip { display: flex; } }

/* ===== v2.20 侧卡时间 ＋「等待中」可点（先生 9/21：「日期后边加个时间，稍微大一点但不超过现有卡片，带上计秒」／「等待中那里最好能设置成点一下跳转，不然我还是看不到等待的那些 todo」）=====
   时间：比 .sub 的 11.5px 稍大（14px），等宽数字 ⇒ 每秒跳动时宽度不抖；单行不换行 ⇒ 不撑破卡片（右列固定 320px，实测量宽 ~170px，余量充足）。 */
.side-card .sub#side-date {
  font-size: 14px; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* 「等待中」整行可点（点一下只看等待中的待办），给足点击热区与悬停反馈 */
.side-row-click {
  cursor: pointer; border-radius: 10px;
  padding-left: 6px; padding-right: 6px; margin-left: -6px; margin-right: -6px;
  transition: background .15s;
}
.side-row-click:hover { background: var(--hover); }
.side-row-click:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
/* 「只看等待中」开关激活态（与既有 ghost-btn 一致的做法：底色 + 主色字） */
#cw-toggle-wait.on { background: var(--brand-weak); color: var(--brand); border-color: transparent; }

/* ===== v2.20「今日 3 件」（材料：「每天真正重要的事情最多 3 件」）=====
   取未完成项前 3 条；不新增数据、不动后端（顺序＝用户自己拖出来的优先级）。 */
.side-mini-h { font-size: 12px; font-weight: 700; color: var(--muted); margin: 13px 0 6px; }
.today-top3 { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.today-top3 li {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-soft);
  cursor: pointer; border-radius: 8px; padding: 3px 5px; margin: 0 -5px;
  transition: background .15s;
}
.today-top3 li:hover { background: var(--hover); }
.today-top3 li .n {
  flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 6px;
  background: var(--brand-weak); color: var(--brand);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.today-top3 li.wait .n { background: var(--line); color: var(--muted); }   /* 等待中的用灰底，一眼区分 */
/* 真实待办标题可能很长（如整段说明）⇒ 最多 2 行、超出省略，侧卡不被撑高 */
.today-top3 li .t {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.today-top3 li.muted { cursor: default; color: var(--muted); }
.today-top3 li.muted:hover { background: none; }

/* ===== v2.21「今日 3 件」＝先生自己挑（☆ 挑／× 撤）===== */
.today-top3 li .x {
  flex: none; margin-left: auto; padding: 0 4px; color: var(--muted);
  font-size: 15px; line-height: 1; cursor: pointer; border-radius: 6px;
}
.today-top3 li .x:hover { background: var(--line); color: var(--danger, #d9534f); }
.today-top3 li.gone .t { color: var(--muted); text-decoration: line-through; }

/* ===== v2.22（先生 9/21）：「今日 3 件」从窄侧卡挪到左列（原卡片墙的位置）=====
   容器宽了，字号/行距/内边距整体放宽一档，否则一行 12.5px 挤在 900px 宽里显得空；
   条目改成带边框的卡片行，一眼看得出这是「今天要做的三件事」。 */
.card.today-card { margin-top: 16px; padding: 16px 18px; border-radius: 18px; }
.today-card .side-mini-h { margin: 0 0 8px; }
.today-card .today-top3 { gap: 9px; }
.today-card .today-top3 li {
  font-size: 14px; line-height: 1.5; padding: 10px 12px; margin: 0;
  border-radius: 10px; border: 1px solid var(--line);
}
.today-card .today-top3 li .n { width: 22px; height: 22px; border-radius: 7px; font-size: 12px; margin-top: 0; }
.today-card .today-top3 li .t { -webkit-line-clamp: 2; }
.today-card .today-top3 li .x { font-size: 16px; padding: 0 6px; }
.today-card .today-top3 li.muted { padding: 10px 12px; }
.cw-item .cw-star { font-size: 15px; line-height: 1; padding: 2px 7px; }
.cw-item .cw-star.on { color: #E0A32E; }

/* ---- #81 游戏页（/town/ 的 iframe；只在可见时挂载，见 static/app.js showPage） ---- */
#page-town { display: flex; flex-direction: column; gap: 10px; height: calc(100vh - 150px); min-height: 520px; }
#town-frame { flex: 1 1 auto; width: 100%; min-height: 0; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
#town-open { text-decoration: none; display: inline-flex; align-items: center; }
@media (max-width: 768px) {
  #page-town { height: auto; min-height: 0; }
  #town-frame { height: 76vh; min-height: 420px; }
}

/* ---- v2.26 首页右列「免费额度」卡（.fq-*）----
   右列宽 320px（.desk-cols 第二列；≤1180px 断点会塌成单列/横排，见上面 @media 1180）；
   全用主题变量 ⇒ 暗色主题不用另写覆盖。内容由 static/freequota.js 渲染。 */
#free-quota-card .fq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
#free-quota-card .fq-head h3 { margin: 0; }
.fq-count { font-size: 11.5px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fq-row { display: flex; align-items: baseline; gap: 5px;
  padding: 6px 0; border-top: 1px solid var(--line); }
.fq-row:first-child { border-top: none; }
.fq-cat { font-size: 12px; font-weight: 700; color: var(--ink); flex: 0 0 auto; white-space: nowrap; }
.fq-sep { font-size: 11.5px; color: var(--muted); flex: 0 0 auto; }
.fq-num { font-size: 12.5px; font-weight: 800; color: var(--brand); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.fq-unit { font-size: 11px; color: var(--muted); flex: 0 0 auto; }
.fq-names { flex: 1 1 auto; min-width: 0; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fq-rest-toggle { display: block; width: 100%; margin-top: 4px; padding: 5px 8px; text-align: left;
  border: 1px dashed var(--line); border-radius: 9px; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 11px; line-height: 1.5; cursor: pointer; }
.fq-rest-toggle:hover { background: var(--hover); color: var(--ink); }
.fq-rest-toggle:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.fq-rest { padding-left: 8px; }
.fq-rest[hidden] { display: none; }
.fq-foot { margin-top: 8px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); }
.fq-src { color: var(--brand); text-decoration: none; white-space: nowrap; }
.fq-src:hover { text-decoration: underline; }
.fq-empty { margin: 0; font-size: 11.5px; line-height: 1.6; color: var(--muted); }

/* ---- v2.27 「态势」页（.st-*）----
   一屏五块 + 页顶源健康度；全用主题变量 ⇒ 暗色不用另写覆盖。内容由 static/situation.js 渲染。 */
.st-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; margin-bottom: 6px; }
.st-updated { font-size: 12.5px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.st-health { font-size: 11.5px; font-weight: 700; }
.st-health.ok { color: var(--ok-ink); }
.st-health.err { color: var(--danger-ink); }
.st-sources { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.st-src { font-size: 10.5px; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
  background: var(--chip-bg); color: var(--muted); }
.st-src.ok { color: var(--ok-ink); }
.st-src.err { background: var(--danger-bg); color: var(--danger-ink); font-weight: 700; }

.st-block { margin-bottom: 14px; }
.st-title { margin: 0 0 7px; font-size: 13px; font-weight: 700; color: var(--ink);
  padding-bottom: 5px; border-bottom: 1px solid var(--line); }
.st-title b { font-size: 11.5px; font-weight: 800; color: var(--brand);
  font-variant-numeric: tabular-nums; margin-left: 2px; }

.st-row { padding: 7px 9px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); margin-bottom: 6px; }
.st-row.red { border-color: var(--danger-line); background: var(--danger-bg); }
.st-row-h { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 3px; }
.st-ref { font-size: 11px; font-weight: 800; color: var(--brand);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.st-badge { font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  background: var(--brand-weak); color: var(--brand); font-weight: 700; white-space: nowrap; }
.st-who { font-size: 10.5px; color: var(--ink-soft); background: var(--chip-bg);
  padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.st-time { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  margin-left: auto; white-space: nowrap; }
.st-time.dim { color: var(--hint); }
.st-days { font-size: 10.5px; font-weight: 700; color: var(--muted);
  background: var(--chip-bg); padding: 1px 7px; border-radius: 999px; white-space: nowrap; }
.st-row.red .st-days { background: var(--danger-line); color: var(--danger-ink); }
.st-total { font-size: 10.5px; color: var(--muted); }
.st-row-t { font-size: 12.5px; line-height: 1.5; color: var(--ink); word-break: break-word; }
.st-row-t.err { color: var(--danger-ink); }
.st-row-d { font-size: 11px; line-height: 1.55; color: var(--muted); margin-top: 3px;
  word-break: break-word; }
.st-row-d.dim { color: var(--hint); }
.st-sub { font-size: 11px; font-weight: 700; color: var(--muted); margin: 6px 0 4px; }
.st-line { display: flex; align-items: baseline; gap: 6px; padding: 3px 0;
  font-size: 11.5px; border-top: 1px solid var(--line); }
.st-line:first-of-type { border-top: none; }
.st-line-t { flex: 1 1 auto; min-width: 0; color: var(--ink-soft); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.st-line.err .st-line-t { color: var(--danger-ink); }
.st-line .st-time { margin-left: 0; }
.st-src-err { font-size: 11.5px; line-height: 1.55; color: var(--danger-ink);
  background: var(--danger-bg); border: 1px solid var(--danger-line);
  border-radius: 9px; padding: 6px 9px; margin-bottom: 6px; word-break: break-word; }
@media (max-width: 768px) {
  .st-row-t { font-size: 12px; }
  .st-row-d { font-size: 10.5px; }
}
