/* 个人笔记 · 柔和纸感手账 */
:root {
  --bg: #f7f1e5;
  --card: rgba(255, 251, 242, .92);
  --line: rgba(150, 130, 100, .20);
  --text: #40382e;
  --muted: #8b7f6d;
  --accent: #e8877f;
  --accent-deep: #d97068;
  --accent2: #93b09a;
  --accent3: #8aa7c0;
  --danger: #d96a5a;
  --green: #7fa68a;
  --red: #d96a5a;
  --amber: #e2a65e;
  --radius: 18px;
  --shadow: 0 14px 34px rgba(150, 120, 80, .12);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    linear-gradient(rgba(247, 241, 229, .86), rgba(247, 241, 229, .90)),
    url("/static/img/bg-paper.jpg") center / cover fixed no-repeat;
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent-deep); text-decoration: none; }
::selection { background: rgba(232, 135, 127, .25); }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 22px;
  padding: 12px 28px;
  background: rgba(255, 251, 242, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 18px;
}
.brand-icon { color: var(--accent); font-size: 20px; }
.brand-text {
  background: linear-gradient(120deg, #e8877f, #93b09a);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar nav { display: flex; gap: 6px; flex: 1; }
.topbar nav a {
  padding: 7px 15px; border-radius: 12px; color: var(--muted); font-size: 14px;
  transition: .15s;
}
.topbar nav a:hover { color: var(--text); background: rgba(150, 130, 100, .10); }
.topbar nav a.active {
  color: #fff; background: linear-gradient(120deg, #e8877f, #d97068);
  box-shadow: 0 6px 16px rgba(217, 112, 104, .30); font-weight: 600;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user { color: var(--muted); font-size: 14px; }

/* 主容器 */
.page { max-width: 1000px; margin: 0 auto; padding: 34px 22px 72px; }

/* 首页 hero */
.hero { margin-bottom: 26px; }
.hero h1 { margin: 0 0 8px; font-size: 30px; letter-spacing: -.02em; }
.hero h1 span { background: linear-gradient(120deg, #e8877f, #93b09a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  position: relative; overflow: hidden;
  background: var(--card); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #e8877f, #e2a65e); }
.stat-card:nth-child(2)::before { background: linear-gradient(180deg, #93b09a, #7fa68a); }
.stat-card:nth-child(3)::before { background: linear-gradient(180deg, #e2a65e, #e8877f); }
.stat-card:nth-child(4)::before { background: linear-gradient(180deg, #8aa7c0, #93b09a); }
.stat-card span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.stat-card strong { font-size: 22px; letter-spacing: -.01em; }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* 模块卡 */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.module-card {
  position: relative; overflow: hidden;
  background: var(--card); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px 22px; color: var(--text); box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.module-card::after { content: ""; position: absolute; inset: 0; background: radial-gradient(360px 180px at 100% 0%, rgba(232, 135, 127, .14), transparent 60%); pointer-events: none; }
.module-card:nth-child(2)::after { background: radial-gradient(360px 180px at 100% 0%, rgba(147, 176, 154, .18), transparent 60%); }
.module-card:nth-child(3)::after { background: radial-gradient(360px 180px at 100% 0%, rgba(138, 167, 192, .16), transparent 60%); }
.module-card:hover { transform: translateY(-4px); box-shadow: 0 24px 48px rgba(150, 120, 80, .18); }
.module-card h2 { margin: 0 0 8px; font-size: 19px; }
.module-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255, 251, 242, .9); color: var(--text); cursor: pointer; font-size: 14px;
  transition: .15s;
}
.btn:hover { border-color: rgba(232, 135, 127, .5); }
.btn-primary { background: linear-gradient(120deg, #e8877f, #d97068); border-color: transparent; color: #fff; box-shadow: 0 8px 18px rgba(217, 112, 104, .30); }
.btn-primary:hover { filter: brightness(1.04); }
.btn-ghost { background: transparent; }
.btn-danger { color: #fff; background: var(--danger); border-color: transparent; }

/* 输入 */
input, select, textarea {
  font: inherit; color: var(--text); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 251, 242, .9);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 135, 127, .18); }
textarea { width: 100%; resize: vertical; }
.form-card { background: var(--card); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 22px; box-shadow: var(--shadow); }
.form-card h2 { margin: 0 0 10px; font-size: 16px; }
.form-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.form-card input, .form-card textarea { width: 100%; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.filter-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.filter-bar input { flex: 1; }
.ledger-form { display: flex; flex-wrap: wrap; gap: 10px; }
.ledger-form input[name="amount"] { width: 120px; }
.ledger-form input[name="note"] { flex: 1; min-width: 140px; }
.month-picker { display: flex; gap: 8px; }

/* 页面头部 */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.head-actions { display: flex; gap: 8px; align-items: center; }

/* 记事列表 */
.memo-list, .tree, .child-list ul { list-style: none; margin: 0; padding: 0; }
.memo-item {
  display: flex; justify-content: space-between; gap: 16px;
  background: var(--card); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  transition: transform .15s ease;
}
.memo-item:hover { transform: translateY(-2px); }
.memo-main { min-width: 0; }
.memo-main h3 { margin: 0 0 6px; font-size: 16px; }
.memo-preview { margin: 0 0 8px; color: var(--muted); white-space: pre-wrap; overflow: hidden; }
.memo-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.tag { background: rgba(232, 135, 127, .14); color: var(--accent-deep); border-radius: 99px; padding: 2px 10px; }
.memo-actions { display: flex; align-items: center; gap: 8px; }

/* 学习树（旧版兼容） */
.tree-node { list-style: none; padding: 8px 0 8px calc(var(--depth, 0) * 20px); }
.tree-title { font-weight: 600; color: var(--text); }
.tree-actions { margin-left: 10px; }
.tree-actions a { margin-left: 8px; font-size: 12px; }
.crumbs { margin-bottom: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.child-list h2 { font-size: 15px; margin: 0 0 10px; }
.child-list li { padding: 9px 0; border-bottom: 1px dashed var(--line); display: flex; justify-content: space-between; }
.doc {
  background: var(--card); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; line-height: 1.8; box-shadow: var(--shadow);
}
.doc pre { background: #f3ecdd; padding: 12px; border-radius: 10px; overflow: auto; }
.doc code { background: #f3ecdd; padding: 1px 5px; border-radius: 5px; }
.doc pre code { padding: 0; background: transparent; }
.doc table { border-collapse: collapse; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; }
.doc img { max-width: 100%; }

/* 记账列表 */
.day-group h3 { font-size: 14px; color: var(--muted); margin: 18px 0 8px; }
.ledger-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--card); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px; margin-bottom: 8px;
}
.ledger-cat { min-width: 60px; }
.ledger-note { flex: 1; color: var(--muted); }
.ledger-amount { font-weight: 600; }

/* 登录页 */
.login-body { display: grid; place-items: center; min-height: 100vh; }
.login-card {
  width: min(380px, 92vw);
  background: rgba(255, 251, 242, .92); backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 22px; padding: 34px 30px;
  box-shadow: 0 30px 70px rgba(150, 120, 80, .22);
}
.login-card h1 { margin: 0 0 6px; font-size: 24px; background: linear-gradient(120deg, #e8877f, #93b09a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-card form { margin-top: 18px; }
.login-card label { display: block; margin: 12px 0 6px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; }
.login-card .btn { width: 100%; margin-top: 18px; }

/* 其它 */
.empty { color: var(--muted); text-align: center; padding: 46px 0; }
.error { color: var(--danger); }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; }

@media (max-width: 720px) {
  .stat-grid, .module-grid { grid-template-columns: 1fr 1fr; }
  .topbar { flex-wrap: wrap; }
}

/* ================= 学习记录 · 三栏（纸感手账） ================= */
.page.study-full { max-width: none; padding: 0; margin: 0; }
.page.study-full + .footer { display: none; }

.study-layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 280px;
  height: calc(100vh - 58px);
  background: rgba(247, 241, 229, .55);
}
.study-layout-list { grid-template-columns: 300px minmax(0, 1fr); }

.study-side, .study-editor, .study-panel {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.study-side { border-right: 1px solid var(--line); background: rgba(239, 230, 214, .65); }
.study-panel { border-left: 1px solid var(--line); background: rgba(255, 251, 242, .55); }

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.side-title { font-weight: 700; font-size: 13px; letter-spacing: .03em; color: var(--muted); }
.icon-btn {
  border: 1px solid var(--line); background: rgba(255, 251, 242, .9); color: var(--accent-deep);
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1;
}
.icon-btn:hover { background: var(--accent); color: #fff; }

.doc-new { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.doc-new input { flex: 1; padding: 8px 10px; font-size: 13px; }

.side-scroll { flex: 1; overflow: auto; padding: 8px 6px 20px; }
.side-empty { color: var(--muted); font-size: 13px; padding: 18px 12px; }

/* 文档树 */
.tree { font-size: 14px; }
.tree-node { margin: 1px 0; }
.tree-row {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 4px 4px; border-radius: 10px; color: var(--text);
}
.tree-row:hover { background: rgba(232, 135, 127, .10); }
.tree-row.active { background: rgba(232, 135, 127, .16); }
.tree-row.active .tree-title { color: var(--accent-deep); font-weight: 700; }
.tree-toggle { border: 0; background: transparent; color: var(--muted); width: 20px; cursor: pointer; font-size: 12px; padding: 0; flex: none; }
.tree-title { flex: 1; min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-count { color: var(--muted); font-size: 11px; background: rgba(150, 130, 100, .16); border-radius: 99px; padding: 0 7px; }
.tree-children { margin-left: 16px; border-left: 1px dashed var(--line); padding-left: 4px; }
.tree-children.collapsed { display: none; }

/* 编辑器 */
.study-editor { background: rgba(255, 251, 242, .5); }
.editor-top {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: rgba(255, 251, 242, .62); backdrop-filter: blur(8px);
}
.editor-title { flex: 1; min-width: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; outline: none; border-radius: 10px; padding: 4px 8px; margin-left: -8px; }
.editor-title:focus { background: rgba(232, 135, 127, .08); }
.editor-tools { display: flex; gap: 8px; align-items: center; flex: none; }
.editor-tools .select { padding: 6px 8px; font-size: 13px; max-width: 150px; }

.editor-blocks { flex: 1; overflow: auto; padding: 22px 30px 30px; }

.block { display: flex; gap: 8px; align-items: flex-start; padding: 3px 6px; margin: 0 -6px; border-radius: 12px; position: relative; }
.block:hover { background: rgba(232, 135, 127, .07); }
.block-gutter { display: flex; align-items: center; gap: 4px; flex: none; padding-top: 4px; opacity: 0; transition: opacity .12s; min-height: 26px; }
.block:hover .block-gutter, .block-gutter:focus-within { opacity: 1; }
.block-type { border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 12px; border-radius: 6px; padding: 2px 4px; cursor: pointer; }
.block-type:hover, .block-type:focus { border-color: var(--line); background: rgba(255, 251, 242, .9); }
.block-done { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.block-del { border: 0; background: transparent; color: #d8cbb4; cursor: pointer; font-size: 12px; border-radius: 6px; padding: 2px 5px; }
.block-del:hover { background: rgba(217, 106, 90, .14); color: var(--danger); }

.block-content { flex: 1; min-width: 0; outline: none; line-height: 1.75; font-size: 15px; padding: 3px 6px; border-radius: 10px; min-height: 28px; }
.block-content:focus { background: rgba(232, 135, 127, .07); }
.block-content:empty::before { content: "输入内容…"; color: #cfc3ae; }

/* 块类型样式 */
.blk-h1 .block-content { font-size: 26px; font-weight: 800; line-height: 1.35; margin-top: .4em; }
.blk-h2 .block-content { font-size: 22px; font-weight: 750; line-height: 1.4; margin-top: .3em; }
.blk-h3 .block-content { font-size: 19px; font-weight: 700; line-height: 1.45; }
.blk-h4 .block-content { font-size: 17px; font-weight: 650; }
.blk-h5 .block-content { font-size: 15px; font-weight: 650; }
.blk-h6 .block-content { font-size: 14px; font-weight: 650; color: var(--muted); }
.blk-li .block-content::before { content: "•"; color: var(--accent-deep); display: inline-block; width: 1.2em; margin-left: -1.2em; }
.blk-li .block-content { padding-left: 1.4em; }
.blk-quote .block-content { border-left: 3px solid var(--accent); background: rgba(232, 135, 127, .08); color: #6b6150; padding: 6px 12px; border-radius: 0 10px 10px 0; }
.blk-code .block-content { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 13px; background: #3a332c; color: #f5e9d6; border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; word-break: break-word; }
.block.is-done .block-content { text-decoration: line-through; color: var(--muted); }

/* 引用链接 */
.ref-link { color: var(--accent-deep); background: rgba(232, 135, 127, .16); border-radius: 6px; padding: 0 4px; font-weight: 600; }
.ref-link:hover { background: rgba(232, 135, 127, .26); }
.ref-link.missing { color: var(--danger); background: rgba(217, 106, 90, .12); }

/* 编辑器底部 */
.editor-footer { display: flex; align-items: center; gap: 10px; padding: 10px 22px; border-top: 1px solid var(--line); background: rgba(255, 251, 242, .62); }
.ref-picker { position: relative; }
.ref-dropdown { display: none; position: absolute; bottom: 110%; left: 0; width: 260px; background: rgba(255, 251, 242, .98); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 45px rgba(150, 120, 80, .22); overflow: hidden; z-index: 30; }
.ref-dropdown.open { display: block; }
.ref-dropdown input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 12px; background: transparent; }
.ref-dropdown ul { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow: auto; }
.ref-dropdown li { padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.ref-dropdown li:hover { background: rgba(232, 135, 127, .12); }

/* 右侧面板 */
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
.panel-tabs button { flex: 1; border: 0; background: transparent; cursor: pointer; padding: 11px 0; font-size: 13px; color: var(--muted); }
.panel-tabs button.active { color: var(--accent-deep); font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }
.panel-body { flex: 1; overflow: auto; padding: 12px; }
.panel-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0; }
.outline-item { display: block; color: var(--text); font-size: 13px; padding: 5px 8px; border-radius: 8px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline-item:hover { background: rgba(232, 135, 127, .10); }
.outline-item.ol-h1 { font-weight: 700; }
.outline-item.ol-h2 { font-weight: 650; padding-left: 18px; }
.outline-item.ol-h3 { padding-left: 30px; }
.outline-item.ol-h4 { padding-left: 42px; }
.outline-item.ol-h5 { padding-left: 54px; }
.outline-item.ol-h6 { padding-left: 66px; }
.backlink-item { display: block; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: rgba(255, 251, 242, .8); }
.backlink-item:hover { border-color: var(--accent); }
.bl-doc { display: block; font-weight: 700; font-size: 13px; color: var(--text); margin-bottom: 4px; }
.bl-preview { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 列表页空状态 */
.study-empty { padding: 80px 40px; max-width: 520px; margin: 0 auto; text-align: center; }
.study-empty-logo { font-size: 44px; }
.study-empty h2 { margin: 12px 0 6px; }
.study-empty p { color: var(--muted); }
.study-tips { text-align: left; margin: 24px auto 0; color: var(--muted); font-size: 14px; line-height: 2; }
.study-tips code { background: rgba(232, 135, 127, .14); color: var(--accent-deep); padding: 1px 6px; border-radius: 6px; }

/* 全文搜索 */
.study-search { position: relative; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.study-search input { width: 100%; padding: 8px 10px; font-size: 13px; }
.study-search-results { position: absolute; top: calc(100% + 4px); left: 10px; right: 10px; z-index: 40; background: rgba(255, 251, 242, .98); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 45px rgba(150, 120, 80, .22); max-height: 320px; overflow: auto; padding: 4px; }
.study-search-results[hidden] { display: none; }
.search-item { display: block; padding: 8px 10px; border-radius: 8px; }
.search-item:hover { background: rgba(232, 135, 127, .10); }
.search-doc { display: block; font-weight: 700; font-size: 13px; color: var(--text); }
.search-doc em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 4px; }
.search-snippet { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.search-item mark { background: rgba(226, 166, 94, .4); color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { color: var(--muted); font-size: 13px; padding: 12px; margin: 0; }

/* 导出下拉 */
.export-picker { position: relative; }
.export-dropdown { display: none; position: absolute; top: calc(100% + 6px); right: 0; min-width: 170px; background: rgba(255, 251, 242, .98); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 45px rgba(150, 120, 80, .22); padding: 4px; z-index: 40; }
.export-dropdown.open { display: block; }
.export-dropdown a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); font-size: 13px; }
.export-dropdown a:hover { background: rgba(232, 135, 127, .10); }

/* AI 面板 */
.btn-block { display: block; width: 100%; }
.ai-box { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.ai-box textarea { width: 100%; resize: vertical; font: inherit; font-size: 13px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 251, 242, .9); }
.ai-box textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232, 135, 127, .18); }
.ai-result { margin-top: 14px; font-size: 13px; }
.ai-mindmap { overflow: auto; }
.ai-mindmap svg { max-width: 100%; height: auto; }
.ai-code-box { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 251, 242, .85); overflow: hidden; }
.ai-code-box summary { cursor: pointer; padding: 8px 10px; font-size: 12px; color: var(--muted); user-select: none; }
.ai-code { margin: 0; padding: 10px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; color: #f5e9d6; background: #3a332c; }
.ai-copy { margin: 8px 10px; }
.ai-text { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: inherit; font-size: 13px; line-height: 1.7; background: rgba(255, 251, 242, .8); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.ai-error { color: var(--danger); background: rgba(217, 106, 90, .1); border-radius: 10px; padding: 10px 12px; }

@media (max-width: 900px) {
  .study-layout { grid-template-columns: 220px minmax(0, 1fr); }
  .study-panel { display: none; }
}
@media (max-width: 680px) {
  .study-layout, .study-layout-list { grid-template-columns: 1fr; height: auto; }
  .study-side { max-height: 220px; }
}


/* MingCute 图标库适配 */
.mgc { display: inline-block; font-size: 1em; vertical-align: -.08em; }
.topbar nav a .mgc, .topbar-right .btn .mgc { font-size: 15px; }
.topbar nav a { display: inline-flex; align-items: center; gap: 7px; }
.user { display: inline-flex; align-items: center; gap: 6px; }
.user .mgc { font-size: 14px; }
.stat-card span .mgc { font-size: 14px; margin-right: 4px; }
.module-icon { font-size: 26px; color: var(--accent); margin-bottom: 10px; display: block; }
.module-card:nth-child(2) .module-icon { color: var(--accent2); }
.module-card:nth-child(3) .module-icon { color: var(--accent3); }
.page-head h1 .mgc { font-size: 22px; margin-right: 8px; color: var(--accent); }
.memo-doc { color: var(--accent2); margin-right: 8px; font-size: 16px; }
.icon-btn .mgc { font-size: 14px; }

/* 文档树折叠箭头 */
.tree-toggle .mgc { font-size: 14px; pointer-events: none; }
.tree-toggle:hover .mgc { color: var(--accent-deep); }

/* 块级图标 */
.block-icon {
  border: 1px solid transparent; background: transparent; color: var(--muted);
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer; flex: none;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
}
.block-icon:hover { border-color: var(--line); background: rgba(255, 251, 242, .9); color: var(--accent-deep); }
.block-icon .mgc { font-size: 15px; pointer-events: none; }
.block-del { display: inline-flex; align-items: center; justify-content: center; }
.block-del .mgc { font-size: 13px; pointer-events: none; }

/* 图标选择器弹层 */
.icon-picker {
  position: fixed; z-index: 120; width: 320px;
  background: rgba(255, 251, 242, .99); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 60px rgba(150, 120, 80, .28);
  padding: 10px;
}
.icon-picker-head { display: flex; gap: 8px; margin-bottom: 8px; }
.icon-picker-search { flex: 1; padding: 8px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 251, 242, .9); }
.icon-picker-remove { border: 1px solid var(--line); background: transparent; color: var(--danger); border-radius: 10px; padding: 0 10px; font-size: 12px; cursor: pointer; }
.icon-picker-remove:hover { background: rgba(217, 106, 90, .1); }
.icon-picker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 300px; overflow: auto; }
.icon-picker-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px solid transparent; background: transparent; border-radius: 10px;
  padding: 7px 2px; cursor: pointer; color: var(--text);
}
.icon-picker-item:hover { border-color: var(--line); background: rgba(232, 135, 127, .10); }
.icon-picker-item .mgc { font-size: 20px; color: var(--accent-deep); pointer-events: none; }
.icon-picker-item span { font-size: 11px; color: var(--muted); line-height: 1.1; pointer-events: none; }
.icon-picker-empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; margin: 0; }

/* 学习空状态 logo */
.study-empty-logo .mgc { font-size: 44px; color: var(--accent); }


/* 记账类别图标 */
.category-field { position: relative; display: inline-flex; align-items: center; }
.category-field .cat-icon {
  position: absolute; left: 10px; z-index: 1; font-size: 15px; color: var(--accent-deep);
  pointer-events: none;
}
.category-field select { padding-left: 32px; }
.ledger-cat { display: inline-flex; align-items: center; gap: 7px; }
.ledger-cat .cat-icon { font-size: 15px; color: var(--accent-deep); }

