/* ============================================================
   XiaoHan 工作助手 — 主样式（浅色清新主题）
   ============================================================ */
:root {
    --bg: #f0f7ff;
    --panel: #ffffff;
    --panel-alt: #f8fafc;
    --line: #e2e8f0;
    --text: #1e293b;
    --muted: #64748b;
    --accent: #0ea5e9;
    --accent-deep: #0284c7;
    --accent-soft: #e0f2fe;
    --ok: #10b981;
    --warn: #f59e0b;
    --danger: #ef4444;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow: hidden;
}

/* ---------- 顶栏 ---------- */
.topbar {
    height: 54px;
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    background: linear-gradient(90deg, #ffffff 0%, #f0f9ff 100%);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--text); }
.brand i { color: var(--accent-deep); }
.brand .brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 6px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-row { display: flex; align-items: center; gap: 8px; }
.user-dd { position: relative; }
.dd-menu {
    display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    min-width: 170px; z-index: 60; box-shadow: 0 10px 30px rgba(15,23,42,.12); overflow: hidden;
}
.dd-menu a { display: block; padding: 10px 14px; color: var(--text); font-size: 13px; }
.dd-menu a:hover { background: var(--accent-soft); }
.user-dd.open .dd-menu { display: block; }

/* ---------- 状态条 ---------- */
.status-strip {
    font-size: 12px; color: var(--muted);
    background: #ecfeff; border-bottom: 1px solid #bae6fd;
    padding: 5px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.status-strip b { color: var(--accent-deep); font-weight: 600; }
.status-strip a { color: #0369a1; margin-left: 4px; }

/* ---------- 主布局 ---------- */
.fcursor-main {
    display: flex; flex-direction: row;
    height: calc(100vh - 54px - 28px);
    min-height: 0; width: 100%; overflow: hidden; background: var(--bg);
}
.fcursor-col {
    display: flex; flex-direction: column; min-width: 0; min-height: 0;
    background: var(--panel); border-right: 1px solid var(--line);
}
.fcursor-col:last-child { border-right: none; }
.fcursor-col-history { flex: 0 0 210px; }
.fcursor-col-chat { flex: 1 1 0; min-width: 200px; background: #fafcff; }
.fcursor-col-workspace { flex: 0 0 280px; }
.xh-ws-empty { padding: 18px 14px; text-align: center; color: var(--muted, #64748b); line-height: 1.65; font-size: 13px; }
.xh-ws-empty-title { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 8px; }
.xh-ws-empty p { margin: 0 0 12px; }
.xh-ws-empty-tip { font-size: 12px; color: #94a3b8; margin-top: 10px !important; }
.xh-ws-empty-tip a { color: #0369a1; }
.fcursor-col-editor { flex: 0 0 360px; display: flex; flex-direction: column; }
.fcursor-col-head {
    font-size: 12px; color: var(--muted); padding: 10px 12px;
    border-bottom: 1px solid var(--line); flex-shrink: 0; font-weight: 600;
}
.fcursor-col-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.fcursor-resizer { flex: 0 0 5px; max-width: 5px; cursor: col-resize; background: var(--line); position: relative; z-index: 3; }
.fcursor-resizer::after { content: ''; position: absolute; top: 0; left: -3px; right: -3px; bottom: 0; }
.fcursor-resizer:hover, .fcursor-resizer.fcursor-resizer-active { background: var(--accent); }
body.fcursor-resizing, body.fcursor-resizing * { cursor: col-resize !important; user-select: none !important; }

/* 非编程场景：隐藏文件/工作区两栏，聊天占满 */
body.fcursor-mode-focus .fcursor-col-editor,
body.fcursor-mode-focus .fcursor-col-workspace,
body.fcursor-mode-focus #resizer-2,
body.fcursor-mode-focus #resizer-3 { display: none !important; }
body.fcursor-mode-focus .fcursor-col-chat { flex: 1 1 auto !important; }

@media (max-width: 1024px) {
    .fcursor-main { overflow-x: auto; }
    .fcursor-col-history { flex: 0 0 170px; }
    .fcursor-col-editor, .fcursor-col-workspace, #resizer-2, #resizer-3 { display: none !important; }
    .fcursor-col-chat { flex: 1 1 auto !important; }
}
@media (max-width: 640px) {
    .fcursor-col-history, #resizer-1 { display: none !important; }
    .brand .brand-sub { display: none; }
}

/* ---------- 场景切换 ---------- */
.xh-mode-wrap { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); background: var(--panel-alt); flex-shrink: 0; }
.xh-mode-wrap .xh-mode-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 8px; letter-spacing: .04em; }
.xh-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.xh-mode-btn {
    border: 1px solid var(--line); background: #fff; border-radius: 10px;
    padding: 8px 6px; cursor: pointer; text-align: center; transition: .15s;
    font-size: 11px; color: var(--text); line-height: 1.35;
}
.xh-mode-btn i { display: block; font-size: 16px; margin-bottom: 4px; color: var(--accent); }
.xh-mode-btn:hover { border-color: #7dd3fc; background: var(--accent-soft); }
.xh-mode-btn.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px rgba(14,165,233,.15); font-weight: 600; }

.xh-mode-panels-host { flex-shrink: 0; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.xh-mode-panel { display: none; background: #fff; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text); }
.xh-mode-panel.on { display: block; }
.xh-mode-panel-head {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 14px; border: none; background: #f0f9ff; cursor: pointer; text-align: left;
    font-size: 12px; color: #0369a1;
}
.xh-mode-panel-head:hover { background: var(--accent-soft); }
.xh-mode-panel-title { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.xh-mode-panel-actions { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.xh-mode-panel-chevron { transition: transform .15s ease; font-size: 11px; color: var(--muted); }
.xh-mode-panel.collapsed .xh-mode-panel-chevron { transform: rotate(-90deg); }
.xh-mode-panel-body { padding: 10px 14px 12px; border-top: 1px solid var(--line); }
.xh-mode-panel.collapsed .xh-mode-panel-body { display: none; }
.xh-mode-panel label { display: block; font-size: 11px; color: var(--muted); margin: 8px 0 4px; }
.xh-mode-panel input, .xh-mode-panel select, .xh-mode-panel textarea {
    width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px;
}
.xh-mode-panel .xh-hint { font-size: 11px; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.xh-mode-panel .xh-warn { background: #fff7ed; border: 1px solid #fed7aa; border-radius: 6px; padding: 8px; color: #9a3412; margin-top: 8px; }

/* ---------- 话题列表 ---------- */
.fcursor-history-empty { font-size: 12px; color: var(--muted); padding: 12px; line-height: 1.5; }
.fcursor-topic-item {
    position: relative; padding: 9px 30px 9px 12px; margin: 0 6px 4px; border-radius: 8px;
    cursor: pointer; border: 1px solid transparent;
}
.fcursor-topic-item:hover { background: var(--accent-soft); border-color: #bae6fd; }
.fcursor-topic-item.is-active { background: var(--accent-soft); border-color: #7dd3fc; }
.fcursor-topic-item .t-title {
    font-size: 13px; color: var(--text); line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; word-break: break-word;
}
.fcursor-topic-item .t-meta { font-size: 10px; color: var(--muted); margin-top: 4px; }
.fcursor-topic-item .t-more {
    display: none; position: absolute; right: 6px; top: 8px;
    width: 22px; height: 22px; border: none; border-radius: 6px;
    background: rgba(14,165,233,.12); color: #0369a1; cursor: pointer; font-size: 13px; line-height: 1;
}
.fcursor-topic-item:hover .t-more, .fcursor-topic-item.is-active .t-more { display: block; }
.fcursor-topic-item .t-more:hover { background: rgba(14,165,233,.25); }

/* ---------- 聊天区 ---------- */
.fcursor-chat-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; height: 100%; }
.chat-wrap { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head {
    padding: 9px 16px; font-size: 13px; color: var(--muted);
    border-bottom: 1px solid var(--line); background: var(--panel-alt); flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.messages { flex: 1; min-height: 0; overflow-y: auto; padding: 18px 16px; background: #f8fafc; -webkit-overflow-scrolling: touch; }
.msg { margin-bottom: 16px; max-width: 96%; }
.msg.user { margin-left: auto; max-width: 88%; }
.msg .who {
    font-size: 11px; color: var(--muted); margin-bottom: 4px;
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.msg .who .msg-tools { display: flex; gap: 6px; opacity: 0; transition: opacity .15s; }
.msg:hover .who .msg-tools { opacity: 1; }
.msg .who .msg-tools button {
    border: 1px solid var(--line); background: #fff; color: var(--muted);
    border-radius: 6px; font-size: 11px; padding: 2px 8px; cursor: pointer;
}
.msg .who .msg-tools button:hover { color: #0369a1; border-color: #7dd3fc; background: var(--accent-soft); }
.msg .body {
    background: #fff; border: 1px solid var(--line); border-radius: 12px;
    padding: 12px 14px; word-break: break-word; line-height: 1.6; font-size: 14px; color: var(--text);
    box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.msg.user .body {
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff; border: none; white-space: pre-wrap;
}
.msg-user-txt { white-space: pre-wrap; word-break: break-word; }
.msg.msg-xh-pending .body { box-shadow: 0 0 0 1px rgba(14,165,233,.3); }

/* Markdown 内容 */
.xh-md { white-space: normal; }
.xh-md > :first-child { margin-top: 0; }
.xh-md > :last-child { margin-bottom: 0; }
.xh-md h1, .xh-md h2, .xh-md h3, .xh-md h4 { margin: 14px 0 8px; line-height: 1.4; color: #0f172a; }
.xh-md h1 { font-size: 18px; } .xh-md h2 { font-size: 16px; } .xh-md h3 { font-size: 15px; } .xh-md h4 { font-size: 14px; }
.xh-md p { margin: 8px 0; }
.xh-md ul, .xh-md ol { margin: 8px 0; padding-left: 22px; }
.xh-md li { margin: 3px 0; }
.xh-md blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid #bae6fd; background: #f0f9ff; color: #475569; border-radius: 0 6px 6px 0; }
.xh-md table { border-collapse: collapse; margin: 10px 0; font-size: 13px; max-width: 100%; display: block; overflow-x: auto; }
.xh-md th, .xh-md td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.xh-md th { background: var(--panel-alt); font-weight: 600; }
.xh-md code { background: #eef2f7; border: 1px solid #e2e8f0; border-radius: 4px; padding: 1px 5px; font-size: 12.5px; font-family: Consolas, "JetBrains Mono", ui-monospace, monospace; color: #be185d; }
.xh-md pre { position: relative; margin: 10px 0; background: #f6f8fa; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.xh-md pre code {
    display: block; background: transparent; border: none; color: #24292e;
    padding: 30px 12px 12px; overflow-x: auto; font-size: 12.5px; line-height: 1.55; white-space: pre;
}
.xh-md pre .xh-code-head {
    position: absolute; top: 0; left: 0; right: 0; height: 24px;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 8px 0 12px; background: #eef2f7; border-bottom: 1px solid var(--line);
    font-size: 11px; color: var(--muted);
}
.xh-md pre .xh-code-copy { border: none; background: transparent; color: #0369a1; cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.xh-md pre .xh-code-copy:hover { background: rgba(14,165,233,.12); }
.xh-md a { color: #0369a1; }
.xh-md hr { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.xh-plain { white-space: pre-wrap; word-break: break-word; }

/* 思考过程 / 工具时间线（折叠） */
.fcursor-think { margin-top: 8px; font-size: 12px; color: var(--muted); }
.fcursor-think summary { cursor: pointer; color: #0369a1; user-select: none; }
.fcursor-think pre {
    margin: 8px 0 0; padding: 10px; background: var(--panel-alt); border: 1px solid var(--line);
    border-radius: 8px; max-height: 320px; overflow: auto; white-space: pre-wrap; word-break: break-word;
    font-size: 12px; color: #475569;
}
.fcursor-live-reason {
    border-left: 3px solid var(--accent); padding: 8px 10px; margin: 0 0 10px;
    background: #f0f9ff; font-size: 13px; line-height: 1.55; color: #475569;
    white-space: pre-wrap; word-break: break-word; max-height: min(40vh, 360px); overflow-y: auto;
    border-radius: 0 8px 8px 0;
}
.fcursor-live-reason .fcursor-live-who { font-size: 11px; color: #0369a1; margin-bottom: 4px; font-weight: 600; }

/* 回合结果卡片（写入文件等） */
.fcursor-summary {
    background: #ecfdf5; border: 1px solid #a7f3d0; border-left: 4px solid var(--ok);
    padding: 10px 12px; margin-bottom: 10px; border-radius: 8px; font-size: 13px; line-height: 1.6; color: #065f46;
}
.fcursor-summary ul { margin: 4px 0 0 18px; padding: 0; }
.fcursor-summary .hint { color: #92400e; margin-top: 6px; font-size: 12px; }
.fcursor-summary .xh-act-btns { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.fcursor-summary .xh-act-btns button {
    border: 1px solid #6ee7b7; background: #fff; color: #047857; border-radius: 6px;
    font-size: 12px; padding: 3px 10px; cursor: pointer;
}
.fcursor-summary .xh-act-btns button:hover { background: #d1fae5; }
.fcursor-closure-hint { margin-top: 8px; font-size: 12px; color: var(--muted); }

/* 回合状态（仅在停止/失败时展示） */
.fcursor-turn-done { margin-top: 10px; padding: 6px 10px; font-size: 12px; border-radius: 6px; line-height: 1.4; }
.fcursor-turn-stopped { border-left: 3px solid #f97316; background: #fff7ed; color: #9a3412; }
.fcursor-turn-err { border-left: 3px solid var(--danger); background: #fef2f2; color: #991b1b; }

/* 生成中动效 */
.xh-activity { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.xh-act-shimmer {
    height: 3px; border-radius: 2px;
    background: linear-gradient(90deg, #e0f2fe, #0ea5e9, #7dd3fc, #0ea5e9, #e0f2fe);
    background-size: 200% 100%; animation: xhShim 1.1s ease-in-out infinite;
}
@keyframes xhShim { 0% { background-position: 200% 0; } 100% { background-position: 0% 0; } }
.xh-act-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--accent-deep); margin-top: 6px; }
.xh-act-time { font-family: ui-monospace, monospace; color: var(--muted); }
.fcursor-stall-hint { color: var(--muted); }
.xh-tool-line { font-size: 12px; color: #0369a1; margin: 4px 0; }

/* 工具回执条 */
.xh-xh-tool-strip { font-size: 12px; margin: 6px 0; padding: 6px 10px; background: #f0f9ff; border-left: 3px solid #7dd3fc; border-radius: 0 6px 6px 0; }
.xh-xh-tool-strip .xh-tlabel { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.xh-xh-tool-strip .xh-tbody { color: #475569; white-space: pre-wrap; word-break: break-word; }
.xh-xh-asst-sect { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.xh-xh-asst-sect:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

/* 用户消息附件 chips */
.xh-user-attach-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.xh-user-chip {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 8px;
    border-radius: 6px; background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.4);
    color: #fff; max-width: 100%;
}
.xh-user-chip .xh-chipt { color: rgba(255,255,255,.8); }
.msg:not(.user) .xh-user-chip { background: var(--accent-soft); border-color: #bae6fd; color: #0369a1; }
.xh-user-imgwrap { margin-top: 6px; }
.xh-user-imgwrap img { max-width: min(100%, 420px); max-height: 200px; border-radius: 8px; border: 1px solid rgba(255,255,255,.4); }

/* ---------- 输入区 ---------- */
.composer { padding: 12px; border-top: 1px solid var(--line); background: var(--panel-alt); flex-shrink: 0; }
.composer.xh-drag-over { outline: 2px dashed var(--accent); outline-offset: -4px; background: var(--accent-soft) !important; }
.composer.xh-drag-over::after { content: '松开鼠标即可添加附件'; display: block; font-size: 12px; color: #0369a1; margin-bottom: 6px; font-weight: 600; }
.composer .layui-textarea, #chat-input {
    min-height: 68px; max-height: 40vh;
    background: #fff !important; color: var(--text) !important;
    border: 1px solid #cbd5e1 !important; border-radius: 10px !important;
    box-shadow: inset 0 1px 2px rgba(15,23,42,.04);
}
#chat-input:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(14,165,233,.12); }
#chat-input::placeholder { color: #94a3b8 !important; opacity: 1; }
.composer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.composer-tools .layui-btn-primary { background: #fff !important; color: #0369a1 !important; border-color: #bae6fd !important; }
.fcursor-attach-preview { font-size: 11px; color: var(--muted); }
.fcursor-composer-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
#btn-stop-compose { display: none; min-width: 92px; font-weight: 600; }
#btn-stop-compose .fas { margin-right: 4px; }
#xh-branch-hint { display: none; font-size: 12px; color: #0369a1; margin-top: 6px; padding: 0 2px; }

/* 附件预览 */
.image-preview-wrap { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; min-height: 0; }
.image-preview-item { position: relative; width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; flex-shrink: 0; }
.image-preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-preview-del {
    position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border: none; border-radius: 4px;
    background: rgba(15,23,42,.55); color: #fff; font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.image-preview-del:hover { background: var(--danger); }
.attach-file-item {
    position: relative; min-width: 100px; max-width: 200px; height: 64px; border-radius: 8px;
    border: 1px solid var(--line); background: #fff; flex-shrink: 0;
    display: flex; align-items: center; gap: 6px; padding: 6px 24px 6px 8px;
}
.attach-file-item .ficon { color: var(--accent); font-size: 20px; flex-shrink: 0; }
.attach-file-item .fmeta { min-width: 0; flex: 1; }
.attach-file-item .fmeta .fn { font-size: 11px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-file-item .fmeta .ft { font-size: 10px; color: var(--muted); }

/* ---------- 文件编辑列 ---------- */
.editor-head {
    padding: 8px 12px; display: flex; align-items: center; justify-content: space-between;
    background: var(--panel-alt); border-bottom: 1px solid var(--line); font-size: 13px; flex-shrink: 0; gap: 8px;
}
.path-label { color: var(--accent-deep); font-family: ui-monospace, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.editor-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.editor-body textarea {
    flex: 1; min-height: 0; width: 100%; border: none; background: #fff; color: #334155;
    padding: 12px; font-family: Consolas, "JetBrains Mono", ui-monospace, monospace; font-size: 13px;
    resize: none; overflow-y: auto; outline: none;
}

/* ---------- 工作区文件树 ---------- */
.side-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.tree { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 8px; font-size: 13px; -webkit-overflow-scrolling: touch; }
.tree-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tree-item:hover { background: var(--accent-soft); color: var(--text); }
.tree-item i { width: 16px; }
.tree-item.tree-item-up { color: #0369a1; font-weight: 500; }
.tree-item.tree-item-up i { color: #0369a1 !important; }
.fcursor-tree-nav {
    padding: 6px 8px 4px; border-bottom: 1px solid var(--line); flex-shrink: 0;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; background: var(--panel-alt);
}
.fcursor-tree-nav .fcursor-tree-up { border: none; background: transparent; color: #0369a1; cursor: pointer; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.fcursor-tree-nav .fcursor-tree-up:hover:not(:disabled) { background: var(--accent-soft); }
.fcursor-tree-nav .fcursor-tree-up:disabled { color: var(--muted); cursor: default; opacity: .5; }
.fcursor-tree-crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; min-width: 0; flex: 1; }
.fcursor-tree-crumb a { color: #0369a1; text-decoration: none; padding: 2px 4px; border-radius: 4px; word-break: break-all; }
.fcursor-tree-crumb a:hover { background: var(--accent-soft); text-decoration: underline; }
.fcursor-tree-crumb .sep { color: var(--muted); user-select: none; }
.fcursor-tree-crumb .cur { color: var(--text); font-weight: 600; padding: 2px 4px; word-break: break-all; }

/* ---------- 右键 / 悬浮菜单 ---------- */
#tree-ctx, #topic-ctx {
    display: none; position: fixed; z-index: 99999;
    background: #fff; border: 1px solid var(--line); border-radius: 10px;
    min-width: 160px; box-shadow: 0 10px 30px rgba(15,23,42,.16); overflow: hidden;
}
#tree-ctx a, #topic-ctx a {
    display: block; padding: 10px 14px; color: var(--text) !important;
    font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
#tree-ctx a:hover, #topic-ctx a:hover { background: var(--accent-soft); }
#topic-ctx a.danger { color: var(--danger) !important; }

/* ---------- diff 弹窗 ---------- */
.xh-diff-wrap { padding: 10px 14px; max-height: 62vh; overflow: auto; background: #fff; }
.xh-diff-path { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: #0369a1; margin-bottom: 8px; }
.xh-diff { font-family: Consolas, "JetBrains Mono", ui-monospace, monospace; font-size: 12px; line-height: 1.5; }
.xh-diff .dl { display: block; padding: 0 8px; white-space: pre-wrap; word-break: break-all; }
.xh-diff .dl.add { background: #ecfdf5; color: #065f46; }
.xh-diff .dl.del { background: #fef2f2; color: #991b1b; text-decoration: line-through; text-decoration-color: rgba(153,27,27,.35); }
.xh-diff .dl.ctx { color: #64748b; }
.xh-diff .dl.skip { color: #94a3b8; background: #f8fafc; text-align: center; }

/* ---------- layui 弹层适配 ---------- */
.layui-layer-xh .layui-layer-content { color: var(--text) !important; background: #fff !important; line-height: 1.6 !important; font-size: 14px !important; }
.layui-layer-xh .layui-layer-title { background: var(--accent) !important; color: #fff !important; border: none !important; }
.layui-layer-msg, .layui-layer-dialog .layui-layer-content { color: var(--text) !important; }
.layui-hui { color: var(--text) !important; }

/* 设置弹窗 */
.xh-settings-help { font-size: 12px; color: var(--muted); margin: 0 0 12px; line-height: 1.6; }
.xh-settings-help a { color: #0369a1; }
.xh-ws-mode-bar { padding: 6px 10px 4px; font-size: 12px; line-height: 1.5; border-bottom: 1px solid var(--border, #e2e8f0); }
.xh-ws-mode-bar a { color: #0369a1; margin-left: 6px; }
.xh-ws-idb-warn {
    margin: 0 0 6px; padding: 8px 10px; border-radius: 8px;
    background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; font-size: 11px; line-height: 1.55;
}
.xh-ws-idb-warn i { margin-right: 4px; }
.xh-ws-native-ok {
    margin: 0 0 6px; padding: 6px 10px; border-radius: 8px;
    background: #ecfdf5; border: 1px solid #6ee7b7; color: #047857; font-size: 11px;
}
.xh-ws-tip { color: var(--muted, #64748b); }
.xh-ws-tip.ok { color: #047857; }
.xh-adv-toggle { font-size: 12px; color: #0369a1; cursor: pointer; user-select: none; display: inline-block; margin: 4px 0 8px; }
.xh-vision-tip { font-size: 12px; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; padding: 6px 10px; margin-top: 6px; line-height: 1.5; }
