:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --primary: #2563eb;
    --primary-d: #1d4ed8;
    --primary-soft: #eff4ff;
    --text: #0f172a;
    --text-2: #475569;
    --muted: #94a3b8;
    --border: #e9edf2;
    --border-soft: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow: 0 6px 20px rgba(15, 23, 42, .06);
    --radius: 16px;
    --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ============ 布局 ============ */
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 10;
}

.brand {
    display: flex; align-items: center; gap: 12px;
    padding: 6px 10px 22px;
    font-size: 19px; font-weight: 700; letter-spacing: .3px;
}
.brand .logo-badge {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
.brand .logo-badge svg { width: 22px; height: 22px; color: #fff; }

.menu {
    display: flex; flex-direction: column; gap: 4px;
    flex: 1 1 auto;      /* 占据品牌与底部用户卡之间的剩余高度 */
    min-height: 0;       /* 允许 flex 子项收缩，否则 overflow 不生效 */
    overflow-y: auto;    /* 菜单过多时侧边栏内滚动，底部不再被裁掉 */
    padding-bottom: 8px;
    scrollbar-width: thin;                 /* Firefox 细滚动条 */
    scrollbar-color: #cbd5e1 transparent;
}
.menu::-webkit-scrollbar { width: 5px; }
.menu::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.menu::-webkit-scrollbar-track { background: transparent; }
.menu a {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 11px;
    font-size: 14px; color: var(--text-2); font-weight: 500;
    transition: background .15s, color .15s;
}
.menu a:hover { background: var(--border-soft); color: var(--primary); }
.menu a.active {
    background: var(--primary-soft); color: var(--primary); font-weight: 600;
}
.menu a.active::before {
    content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%);
    width: 4px; height: 22px; border-radius: 0 4px 4px 0;
    background: linear-gradient(180deg, var(--primary), var(--primary-d));
}
.menu .icon { width: 20px; text-align: center; font-size: 16px; }
.menu .icon svg { vertical-align: middle; }
.menu .caret { display: inline-block; width: 12px; text-align: center; font-size: 11px; color: var(--text-3, #94a3b8); transition: transform .15s; }
.menu-row.collapsed .caret { transform: rotate(-90deg); }
.menu-row[data-type="1"] { font-weight: 600; }
.menu .spacer { height: 1px; background: var(--border); margin: 14px 10px; }

.menu-footer { margin-top: auto; }
.user-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 12px; background: var(--border-soft);
}
.user-card .avatar-sm {
    width: 34px; height: 34px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff; font-weight: 600; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
}
.user-card .u-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-card .u-role { font-size: 11px; color: var(--muted); }

/* 主区域 */
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }

.topbar {
    height: 66px; background: rgba(255,255,255,.8);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .profile { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.top-link {
    font-size: 13px; color: var(--text-2); font-weight: 500;
    padding: 8px 12px; border-radius: 9px; transition: background .15s, color .15s;
}
.top-link:hover { background: var(--border-soft); color: var(--primary); }
.top-link.logout { color: #64748b; }
.top-link.logout:hover { background: #fef2f2; color: #dc2626; }
.icon-svg { width: 18px; height: 18px; vertical-align: middle; }
.top-link .icon-svg { margin-right: 6px; }
.btn-primary .icon-svg { margin-right: 6px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff; font-weight: 600;
    display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.nickname { font-weight: 600; font-size: 14px; }
.role {
    font-size: 12px; color: var(--primary); background: var(--primary-soft);
    padding: 3px 10px; border-radius: 999px; font-weight: 500;
}

.content { padding: 32px; width: 100%; }

/* Hero 区 */
.hero {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.hero h2 { font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.hero p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.hero .hero-actions { display: flex; align-items: center; gap: 10px; }
.hero .hero-actions .submit { width: auto; margin-top: 0; padding: 10px 22px; font-size: 15px; font-weight: 600; border-radius: 12px; box-shadow: none; }
.btn-primary {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 11px; border: none; cursor: pointer;
    color: #fff; font-size: 14px; font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    box-shadow: 0 6px 16px rgba(37, 99, 235, .3);
    transition: transform .12s, box-shadow .12s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, .38); }
.btn-ghost {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 11px; cursor: pointer;
    color: var(--text-2); font-size: 14px; font-weight: 500;
    background: var(--surface); border: 1px solid var(--border);
    transition: background .15s, border-color .15s;
}
.btn-ghost:hover { background: var(--border-soft); }

/* 统计卡片：紧凑胶囊，嵌入 hero 右侧与按钮同行 */
.stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.stat-card {
    position: relative; overflow: hidden;
    display: flex; align-items: center; gap: 8px;
    background: var(--surface); border-radius: 999px;
    padding: 7px 14px 7px 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-card .stat-icon {
    width: 26px; height: 26px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.stat-card .stat-icon svg { width: 15px; height: 15px; }
.stat-card.primary .stat-icon,
.stat-card.private .stat-icon,
.stat-card.total .stat-icon { background: #1f2937; color: #fff; }
.stat-card .label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat-card .value { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.2; }

/* 面板 */
.panel {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 24px; border-bottom: 1px solid var(--border-soft); gap: 12px; flex-wrap: wrap;
}
.panel-title { font-size: 16px; font-weight: 600; }
.tabs { display: inline-flex; background: var(--border-soft); border-radius: 11px; padding: 3px; gap: 2px; }
.tab {
    font-size: 13px; padding: 7px 16px; border-radius: 9px;
    color: var(--text-2); font-weight: 500; transition: .15s; border: none; cursor: pointer;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); background: var(--surface); font-weight: 600; box-shadow: var(--shadow-sm); }

.record-list { padding: 4px 0; }
.record {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 24px; border-bottom: 1px solid var(--border-soft);
    transition: background .15s;
}
.record:last-child { border-bottom: none; }
.record:hover { background: #fbfcfe; }
.record-main { flex: 1; min-width: 0; }
.record-title {
    display: block;
    font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none;
    margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    cursor: pointer;
}
.record-title:hover { color: var(--primary); text-decoration: underline; }
.record-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.chip {
    font-size: 12px; padding: 3px 10px; border-radius: 7px; font-weight: 500;
}
.chip.public { color: var(--primary); background: var(--primary-soft); }
.chip.private { color: #64748b; background: #f1f5f9; }
.chip.folder { color: #7c3aed; background: #f3e8ff; }
/* 向量状态标记：已生成（绿）/ 未生成（灰） */
.chip.vec-ok { color: #047857; background: #d1fae5; }
.chip.vec-none { color: #92400e; background: #fef3c7; }

/* 面板右上角图标按钮（批量生成向量，仅管理员） */
.panel-icon-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 12px; border-radius: 9px; cursor: pointer;
    font-size: 13px; font-weight: 500; color: var(--text-2);
    background: var(--surface); border: 1px solid var(--border);
    transition: background .15s, border-color .15s, color .15s;
}
.panel-icon-btn:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.panel-icon-btn svg { width: 15px; height: 15px; }
.dot { color: #cbd5e1; }
.record-action {
    font-size: 13px; color: var(--primary); font-weight: 600;
    padding: 8px 14px; border-radius: 9px; white-space: nowrap; transition: background .15s;
}
.record-action:hover { background: var(--primary-soft); }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); font-size: 14px; }
.empty a { color: var(--primary); font-weight: 600; }

.add-fab {
    position: fixed; right: 28px; bottom: 28px;
    width: 56px; height: 56px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff; font-size: 28px; font-weight: 300;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 10px 26px rgba(37, 99, 235, .4); transition: transform .15s;
}
.add-fab:hover { transform: translateY(-2px); }

/* ============ 表单（写经历） ============ */
.form-card { background: var(--surface); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-soft); width: 100%; }
.form-card .page-title { font-size: 22px; font-weight: 700; letter-spacing: -.2px; }
.form-card .sub { color: var(--muted); font-size: 13px; margin: 6px 0 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; margin-bottom: 7px; color: var(--text-2); font-weight: 500; }
.field input, .field textarea, .field select {
    width: 100%; padding: 12px 14px; font-size: 15px; color: var(--text);
    border: 1px solid var(--border); border-radius: 12px;
    outline: none; background: #fbfcfe; transition: .15s; font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
    border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.field textarea { resize: vertical; min-height: 130px; }
.row { display: flex; gap: 16px; }
.row .field { flex: 1; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 6px; }
.form-actions .submit { flex: 1 1 auto; min-width: 0; margin-top: 0; }
.form-actions .btn-ghost {
    flex: 0 0 auto; white-space: nowrap;
    padding: 14px 22px; font-size: 15px; font-weight: 600; border-radius: 12px;
}
.form-actions .pv-hint { flex: 0 0 auto; margin-left: 0; font-size: 12px; color: var(--muted); }
.autosave-hint { font-size: 12px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.inline { display: inline; }

/* ============ 写经历：编辑 / 预览 Tab ============ */
.pv-tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 20px;
           border-bottom: 1px solid var(--border-soft); padding-bottom: 12px; }
.pv-tab { padding: 8px 18px; font-size: 14px; font-family: inherit; color: var(--text-2);
          background: #f3f4f6; border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: .15s; }
.pv-tab:hover { background: #eaecf0; }
.pv-tab.active { background: var(--primary); color: #fff; }
.pv-hint { font-size: 12px; color: var(--muted); margin-left: auto; }

/* ============ 写经历：六 Tab 结构 ============ */
.form-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
             border-bottom: 1px solid var(--border-soft); padding-bottom: 12px; }
.ftab { padding: 8px 14px; font-size: 14px; font-family: inherit; color: var(--text-2);
        background: #f3f4f6; border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: .15s; }
.ftab:hover { background: #eaecf0; }
.ftab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tab-pane[hidden] { display: none; }
.rt-hidden { display: none; }

/* ============ 富文本编辑器 ============ */
.rt { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #fbfcfe; }
.rt:focus-within { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.rt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 8px; background: #f7f8fa; border-bottom: 1px solid var(--border-soft); }
.rt-btn { min-width: 30px; height: 28px; padding: 0 8px; font-size: 13px; font-family: inherit; color: var(--text-2);
          background: #fff; border: 1px solid var(--border); border-radius: 7px; cursor: pointer; }
.rt-btn:hover { border-color: var(--primary); color: var(--primary); }
.rt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.rt-body { min-height: 320px; max-height: 640px; overflow: auto; padding: 14px 16px; font-size: 15px;
           line-height: 1.8; color: var(--text); outline: none; background: #fff; }
.rt-body:empty:before { content: attr(data-placeholder); color: var(--muted); }
.rt-body h2 { font-size: 19px; margin: 14px 0 8px; }
.rt-body h3 { font-size: 16px; margin: 12px 0 6px; }
.rt-body p { margin: 0 0 8px; }
.rt-body ul, .rt-body ol { margin: 0 0 10px; padding-left: 24px; }
.rt-body blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--primary);
                      background: #f5f8ff; color: var(--text-2); }
.rt-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; display: block; }
.rt-body a { color: var(--primary); }
/* ============ 代码块（编辑器 / 详情 / 预览 统一样式 + 语法高亮配色） ============ */
.rt-body pre, .pd-content pre, .content pre, .pv-content pre {
  font-family: "Cascadia Code", "JetBrains Mono", ui-monospace, SFMono-Regular,
               Menlo, Consolas, "Courier New", monospace;
  font-size: 13px; line-height: 1.7; color: #1f2328;
  background: #f6f8fa; border: 1px solid #e8ecf1;
  padding: 12px 14px; border-radius: 10px;
  overflow: auto; tab-size: 4; margin: 10px 0;
}
.tok-kw  { color: #cf222e; font-weight: 600; }   /* 关键字 */
.tok-str { color: #0a3069; }                     /* 字符串 */
.tok-num { color: #0550ae; }                     /* 数字 */
.tok-com { color: #8b949e; font-style: italic; } /* 注释 */

/* ============ 写经历：预览面板 ============ */
.pv-box { min-height: 320px; }
.pv-card { border: 1px solid var(--border-soft); border-radius: 12px; padding: 22px; background: #fff; }
.pv-title { font-size: 22px; font-weight: 700; line-height: 1.4; margin-bottom: 12px; }
.pv-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pv-tag { font-size: 12px; color: var(--primary); background: #e6f4ff; padding: 3px 10px; border-radius: 6px; }
.pv-sec { margin-bottom: 18px; }
.pv-sec-t { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px;
            padding-left: 8px; border-left: 3px solid var(--primary); }
.pv-sec-c { font-size: 14px; line-height: 1.8; color: var(--text); white-space: pre-wrap; }
.pv-sec.pv-brief { background: #f0f7ff; border-radius: 10px; padding: 12px 14px; }
.pv-sec.pv-brief .pv-sec-t { color: #1d4ed8; border-left-color: #2563eb; }
.pv-sec.pv-pitfall { background: #fff2f2; border-radius: 10px; padding: 12px 14px; }
.pv-sec.pv-pitfall .pv-sec-t { color: #b91c1c; border-left-color: #dc2626; }
.pv-sec.pv-precautions { background: #f0fdf4; border-radius: 10px; padding: 12px 14px; }
.pv-sec.pv-precautions .pv-sec-t { color: #15803d; border-left-color: #16a34a; }
.pv-content { font-size: 15px; line-height: 1.9; word-break: break-word; }
.pv-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; }
.pv-content h2 { font-size: 19px; margin: 14px 0 8px; }
.pv-content h3 { font-size: 16px; margin: 12px 0 6px; }
.pv-content ul, .pv-content ol { margin: 0 0 10px; padding-left: 24px; }
.pv-content blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: #f5f8ff; }
.pv-muted { color: var(--muted); }

.field textarea.sm { min-height: 76px; }

/* 侧边栏分组标题 */
.menu .group-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
    color: var(--muted); padding: 14px 14px 4px; cursor: default;
}
.menu .group-label:hover { background: none; color: var(--muted); }

/* 提示条 */
.alert { padding: 12px 16px; border-radius: 11px; margin-bottom: 18px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-ok { background: #edfaf1; color: #15803d; border: 1px solid #bbf7d0; }
.muted { color: var(--muted); font-size: 13px; }

/* ============ 菜单管理页 ============ */
.page-hero {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-hero-title { font-size: 26px; font-weight: 700; letter-spacing: -.3px; }
.page-hero-sub { color: var(--muted); font-size: 14px; margin-top: 4px; }

.tree-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tree-table th, .tree-table td {
    text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--border-soft); color: var(--text-2);
}
.tree-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fbfcfe; }
.tree-table tbody tr:hover { background: #fbfcfe; }
.tree-table .ops { display: flex; gap: 8px; flex-wrap: wrap; }
.tree-name { display: flex; align-items: center; gap: 10px; color: var(--text); }
.tree-name .ti { width: 22px; text-align: center; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.tree-name .ti svg { width: 18px; height: 18px; display: block; }
.tree-name .lv-badge { font-size: 11px; color: var(--muted); background: var(--border-soft); border-radius: 6px; padding: 1px 7px; }
.tree-guide { color: #cbd5e1; font-size: 13px; }

/* 角色管理：编码徽标与说明列 */
.tree-table .code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; color: var(--text-2); background: var(--border-soft); border-radius: 6px; padding: 2px 8px; }
.tree-table td.desc { max-width: 360px; color: var(--text-2); }

/* 角色管理：分配菜单树（树形勾选） */
.menu-tree { max-height: 360px; overflow: auto; border: 1px solid var(--border); border-radius: 12px; padding: 8px 6px; background: #fbfcfe; }
.tree-node { display: block; }
.tree-node .ti { width: 20px; text-align: center; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.tree-node .ti svg { width: 18px; height: 18px; display: block; }

.ck { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px; border-radius: 8px; }
.ck:hover { background: #fff; }
.ck input { width: 16px; height: 16px; accent-color: var(--primary); }

/* 列表内联编辑单元格 */
.tree-table .cell-edit {
    width: 100%; border: 1px solid transparent; background: transparent;
    border-radius: 8px; padding: 6px 8px; font: inherit; color: var(--text);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.tree-table .cell-edit:hover { border-color: var(--border); background: #fff; }
.tree-table .cell-edit:focus {
    outline: none; border-color: var(--primary); background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.tree-table .cell-edit.cell-num { max-width: 96px; }


/* 图标选择器 */
.icon-grid {
    display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px;
    max-height: 196px; overflow: auto; padding: 8px;
    border: 1px solid var(--border); border-radius: 12px; background: #fbfcfe;
}
.icon-cell {
    width: 100%; aspect-ratio: 1 / 1; border: 1px solid var(--border); border-radius: 10px;
    background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
    color: var(--text-2); transition: .15s; padding: 0;
}
.icon-cell svg { width: 20px; height: 20px; }
.icon-cell:hover { border-color: var(--primary); color: var(--primary); }
.icon-cell.sel { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }

/* 弹窗 */
.modal-mask {
    position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
    display: none; align-items: center; justify-content: center; z-index: 1000;
    backdrop-filter: blur(2px);
}
.modal {
    position: fixed; width: 600px; max-width: calc(100vw - 32px);
    background: var(--surface); border-radius: 16px; overflow: hidden;
    box-shadow: 0 24px 60px rgba(15, 23, 42, .3); display: flex; flex-direction: column;
}
.modal.maximized { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100vh !important; max-width: none; border-radius: 0; }
.modal.minimized .modal-body, .modal.minimized .modal-foot { display: none; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; background: linear-gradient(135deg, var(--primary), var(--primary-d));
    color: #fff; cursor: move; user-select: none;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-tools { display: flex; gap: 6px; }
.mt-btn {
    width: 30px; height: 30px; border: none; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,.18); color: #fff; font-size: 15px; line-height: 1;
    display: flex; align-items: center; justify-content: center; transition: .15s;
}
.mt-btn:hover { background: rgba(255,255,255,.34); }
.modal-body { padding: 22px 24px; overflow: auto; }
.modal.maximized .modal-body { flex: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border-soft); }
.modal .field { margin-bottom: 16px; }
.modal .field label { display: block; font-size: 14px; margin-bottom: 7px; color: var(--text-2); font-weight: 500; }
.modal .field input, .modal .field select {
    width: 100%; padding: 11px 14px; font-size: 15px; color: var(--text);
    border: 1px solid var(--border); border-radius: 12px; outline: none; background: #fbfcfe; transition: .15s; font-family: inherit;
}
.modal .field input:focus, .modal .field select:focus {
    border-color: var(--primary); background: #fff; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

/* ============ 文章详情窗口（Pit.modal 内展示） ============ */
.pd { font-size: 14px; color: var(--text); }
.pd-meta-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.pd-meta-chip { font-size: 12px; color: var(--text-2); background: #f8fafc; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border-soft); }
.pd-meta-chip i { color: var(--muted); font-style: normal; margin-right: 5px; }
.pd-meta-chip.pub { color: #16a34a; background: #edfaf1; border-color: #bbf7d0; }
.pd-meta-chip.priv { color: #64748b; background: #f1f5f9; border-color: #e2e8f0; }
.pd-meta-chip.wait { color: #d46b08; background: #fff7e6; border-color: #ffe7ba; }
.pd-audit { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; font-size: 13px;
            color: #cf1322; background: #fff1f0; border: 1px solid #ffccc7; }

/* 列表行内的状态操作按钮 */
.record-ops { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 审核页 */
.au-info { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.au-form label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.au-form textarea {
    width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
    font-size: 14px; line-height: 1.6; resize: vertical; outline: none;
}
.au-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
.pd-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pd-tag { font-size: 12px; color: var(--primary); background: #e6f4ff; padding: 3px 10px; border-radius: 6px; }
.pd-tag.money { color: #cf1322; background: #fff1f0; }
.pd-tag.year { color: #d46b08; background: #fff7e6; }
.pd-tag.src { color: #7c3aed; background: #f3e8ff; }
.pd-tag.pub { color: #16a34a; background: #edfaf1; }
.pd-tag.priv { color: #64748b; background: #f1f5f9; }
.pd-sec { margin-bottom: 16px; }
.pd-sec-t { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px;
            padding-left: 8px; border-left: 3px solid var(--primary); }
.pd-sec-c { font-size: 14px; line-height: 1.8; white-space: pre-wrap; }
.pd-sec.pd-brief { background: #f0f7ff; border-radius: 10px; padding: 12px 14px; }
.pd-sec.pd-brief .pd-sec-t { color: #1d4ed8; border-left-color: #2563eb; }
.pd-sec.pd-pitfall { background: #fff2f2; border-radius: 10px; padding: 12px 14px; }
.pd-sec.pd-pitfall .pd-sec-t { color: #b91c1c; border-left-color: #dc2626; }
.pd-sec.pd-precautions { background: #f0fdf4; border-radius: 10px; padding: 12px 14px; }
.pd-sec.pd-precautions .pd-sec-t { color: #15803d; border-left-color: #16a34a; }
.pd-content { font-size: 15px; line-height: 1.9; word-break: break-word; }
.pd-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 8px 0; display: block; }
.pd-content h2 { font-size: 19px; margin: 14px 0 8px; }
.pd-content h3 { font-size: 16px; margin: 12px 0 6px; }
.pd-content p { margin: 0 0 8px; }
.pd-content ul, .pd-content ol { margin: 0 0 10px; padding-left: 24px; }
.pd-content blockquote { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--primary); background: #f5f8ff; }
.pd-content a { color: var(--primary); }
.pd-meta { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-soft);
           color: var(--muted); font-size: 13px; display: flex; gap: 18px; flex-wrap: wrap; }
.pd-muted { color: var(--muted); }
.pd-disclaimer { margin-top: 18px; padding: 10px 14px; border-radius: 10px;
                 background: #fff5f5; border: 1px solid #ffccc7; color: #cf1322;
                 font-size: 13px; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }
.pd-loading { padding: 30px 0; text-align: center; color: var(--muted); font-size: 14px; }

/* ============ 向量切片查看弹窗 ============ */
.vec-chip { cursor: pointer; }
.vec-chip:hover { filter: brightness(.95); }
.vc-item { border: 1px solid var(--border-soft, #eef1f5); border-radius: 10px;
           padding: 10px 12px; margin-bottom: 10px; }
.vc-idx { font-size: 12px; font-weight: 600; color: var(--primary, #2563eb); margin-bottom: 6px; }
.vc-content { font-size: 13px; line-height: 1.8; white-space: pre-wrap;
              word-break: break-word; color: var(--text-2, #334155); }

/* ============ 在线会话：明细弹窗 ============ */
.tk { font-size: 14px; color: var(--text); }
.tk-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.tk-head-u { font-size: 15px; font-weight: 600; color: var(--text); }
.tk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.tk-d { display: flex; gap: 10px; font-size: 14px; line-height: 1.7; }
.tk-d-k { flex: 0 0 118px; color: var(--muted); }
.tk-d-v { flex: 1; word-break: break-all; }
.tk-sec { margin-top: 16px; }
.tk-sec-t { font-size: 13px; font-weight: 600; margin-bottom: 6px;
            padding-left: 8px; border-left: 3px solid var(--primary); }
.tk-ua { font-size: 12px; line-height: 1.7; color: var(--text-2); background: #f6f8fa;
         border-radius: 8px; padding: 10px 12px; word-break: break-all; }

/* 统计 / 会话列表 分页 */
.tk-pane { display: block; }
#tkTabs { margin-bottom: 16px; }

/* 统计卡片 */
.stat-row {
    display: grid; gap: 14px; margin-bottom: 18px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-row .stat-card {
    position: relative; overflow: hidden;
    background: #fff; border: 1px solid var(--border-soft); border-radius: 14px;
    padding: 16px 18px; box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.stat-row .stat-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary);
}
.stat-row .stat-card.accent::before { background: #f59e0b; }
.stat-row .stat-card.green::before { background: #16a34a; }
.stat-row .stat-card.priv::before { background: #94a3b8; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 30px; font-weight: 700; line-height: 1.3; letter-spacing: -.5px; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* 当天在线统计曲线 */
.tk-chart { padding: 10px 18px 12px; }
.tk-svg { display: block; width: 100%; height: auto; }
.tk-legend { margin-top: 2px; font-size: 12px; color: var(--muted); text-align: center; }
.tk-legend-inline { display: inline-flex; align-items: center; gap: 14px;
                     font-size: 13px; color: var(--text-2); }
.tk-legend-inline .lg { display: inline-flex; align-items: center; gap: 6px; }
.tk-legend-inline .lg::before { content: ''; width: 18px; height: 3px; border-radius: 2px; }
.lg-online::before { background: #2563eb; }
.lg-login::before { background: #f59e0b; }

/* 可点击查看明细的行 */
.tree-table tbody tr.tk-row { cursor: pointer; }

/* 说明 / 帮助按钮与内容 */
.page-hero .hero-actions { display: flex; align-items: center; gap: 10px; }
.help-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border-radius: 11px; cursor: pointer;
    border: 1px solid var(--border); background: #fff; color: var(--primary);
    font-size: 14px; font-weight: 600; transition: .15s;
}
.help-btn svg { width: 18px; height: 18px; }
.help-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.hp { font-size: 14px; color: var(--text); }
.hp-sec { margin-bottom: 18px; }
.hp-t { font-size: 14px; font-weight: 700; margin-bottom: 8px;
        padding-left: 9px; border-left: 3px solid var(--primary); }
.hp-ul { margin: 0; padding-left: 20px; }
.hp-ul li { margin-bottom: 7px; line-height: 1.8; }
.hp-ul b { color: var(--text); }
.modal .row { display: flex; gap: 14px; }
.modal .row .field { flex: 1; margin-bottom: 16px; }


/* 管理表格 */
.mgmt-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mgmt-table th, .mgmt-table td {
    text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--border-soft);
    color: var(--text-2); white-space: nowrap;
}
.mgmt-table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fbfcfe; }
.mgmt-table tbody tr:hover { background: #fbfcfe; }
.mgmt-table td { color: var(--text); }
.mgmt-table .ops { display: flex; align-items: center; gap: 8px; }
.btn-sm {
    font-size: 13px; padding: 6px 12px; border-radius: 8px; cursor: pointer;
    color: var(--primary); background: var(--primary-soft); border: none; font-weight: 500;
    transition: .15s;
}
.btn-sm:hover { background: #dbe7ff; }
.btn-sm.danger { color: #dc2626; background: #fef2f2; }
.btn-sm.danger:hover { background: #fee2e2; }
.btn-sm.warning { color: #b45309; background: #fffbeb; }
.btn-sm.warning:hover { background: #fef3c7; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.submit {
    width: 100%; margin-top: 10px; padding: 14px; border: none; border-radius: 12px;
    color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-d));
    box-shadow: 0 6px 16px rgba(37, 99, 235, .3); transition: transform .12s, box-shadow .12s;
}
.submit:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(37, 99, 235, .38); }
.submit:active { transform: translateY(0); }

/* ===================== AI 生成经历 ===================== */
.ai-gen-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: 11px; border: 1px solid transparent; cursor: pointer;
    color: #fff; font-size: 14px; font-weight: 600;
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    box-shadow: 0 6px 16px rgba(99, 102, 241, .32);
    transition: transform .12s, box-shadow .12s;
}
.ai-gen-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(99, 102, 241, .4); }
.ai-gen-btn:active { transform: translateY(0); }
.ai-spark { width: 17px; height: 17px; }
.hero-actions .ai-gen-btn { margin-bottom: 6px; }

.ai-gen-box { display: flex; flex-direction: column; gap: 14px; height: 100%; }
.ai-gen-tip { font-size: 13px; line-height: 1.6; color: var(--muted); }
.ai-gen-textarea {
    flex: 1; width: 100%; min-height: 220px; resize: vertical;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px;
    font-size: 14px; line-height: 1.7; color: var(--text); background: var(--surface);
    font-family: inherit; outline: none; transition: border-color .15s, box-shadow .15s;
}
.ai-gen-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }

/* 页脚备案号链接：与页脚文字同色，悬停显示下划线 */
footer a { color: inherit; text-decoration: none; }
footer a:hover { text-decoration: underline; }
/* 公安网安备案图标 */
footer .ba-icon { height: 14px; width: auto; vertical-align: -2px; margin-right: 3px; }

/* YNOTE 展示页 */
.ynote-feat { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 4px 2px; }
.ynote-feat-item { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.ynote-feat-ic { font-size: 22px; line-height: 1; flex: none; }
.ynote-feat-t { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.ynote-feat-d { font-size: 13px; color: var(--muted); line-height: 1.6; }
.ynote-note { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 0; }
@media (max-width: 860px) { .ynote-feat { grid-template-columns: 1fr; } }

/* ===================== 平板 / 手机 自适应（仅作用于窄屏，PC 显示不变） ===================== */

/* 平板（含竖屏）：收窄侧边栏，给内容区更多横向空间 */
@media (max-width: 1024px) and (min-width: 861px) {
    :root { --sidebar-w: 216px; }
    .sidebar { width: var(--sidebar-w); padding: 20px 14px; }
    .content { padding: 24px; }
}

/* 手机 / 平板竖屏（≤860px）：侧边栏改为顶部横向导航，主区域整宽 */
@media (max-width: 860px) {
    .layout { flex-direction: column; }
    .sidebar {
        position: static; width: 100%; border-right: none;
        border-bottom: 1px solid var(--border); padding: 10px 14px;
        flex-direction: column; gap: 6px;
    }
    .sidebar .brand { display: none; }            /* 避免与首页 LOGO 重复 */
    .menu {
        flex-direction: row; flex-wrap: nowrap; overflow-x: auto;
        gap: 6px; padding-bottom: 2px; -webkit-overflow-scrolling: touch;
    }
    .menu a { white-space: nowrap; padding: 9px 12px; flex: 0 0 auto; }
    .menu .spacer { display: none; }
    .menu-footer { display: none; }
    .main { margin-left: 0; }
    .content { padding: 16px; }
    .topbar { padding: 0 16px; height: 56px; }
    .stats { width: 100%; margin-top: 10px; }
    .row { flex-direction: column; gap: 0; }
    /* 编辑/详情页标题与按钮：纵向堆叠，按钮占满宽度、触控区域更大 */
    .hero { flex-direction: column; align-items: stretch; }
    .hero-actions { width: 100%; }
    .hero-actions .submit,
    .hero-actions .btn-ghost { flex: 1 1 auto; justify-content: center; min-height: 44px; }
    /* 表单提交/AI 按钮加大，便于手指点按 */
    .form-actions .submit,
    .form-actions .btn-ghost { min-height: 46px; }
}
