/* ============================================================
   NewCode 扩展样式（DESIGN.md §9 扩展规范）
   仅包含新增组件：历史列表 / 模型菜单 / 附件预览 / 思考折叠 /
   Markdown 渲染。全部延续原版黑白极简设计令牌，Logo 与原有组件不变。
   ============================================================ */

/* ---------- 历史对话列表 ---------- */
.history-section {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    max-height: 34vh;
    margin: 0 14px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
    animation: riseIn .45s var(--ease-out-expo) both;
}
.history-section.collapsed .history-list { display: none; }
.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 14px;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
}
.history-header:hover { background: rgba(0, 0, 0, .03); }
html.dark .history-header:hover { background: rgba(255, 255, 255, .04); }
.history-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .8px;
    text-transform: uppercase;
}
.history-toggle-btn {
    width: 24px; height: 24px;
    border: none; background: transparent;
    border-radius: 7px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); padding: 0;
}
.history-toggle-btn:hover { background: var(--bg-input); color: var(--text-secondary); }
.history-toggle-btn svg { width: 13px; height: 13px; stroke: currentColor; transition: transform var(--transition); }
.history-section.collapsed .history-toggle-btn svg { transform: rotate(0deg) !important; }
.history-list {
    overflow-y: auto;
    padding: 0 8px 8px;
}
.history-list::-webkit-scrollbar { width: 3px; }
.history-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.history-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
    position: relative;
}
.history-item:hover { background: rgba(0, 0, 0, .045); color: var(--text-primary); }
html.dark .history-item:hover { background: rgba(255, 255, 255, .05); }
.history-item.active {
    background: var(--accent-soft);
    color: var(--text-primary);
    font-weight: 600;
}
.history-item .history-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item .history-del {
    width: 20px; height: 20px;
    border: none; background: transparent;
    border-radius: 6px; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    color: var(--text-muted); padding: 0; flex-shrink: 0;
}
.history-item:hover .history-del { display: flex; }
.history-item .history-del:hover { background: rgba(0, 0, 0, .08); color: var(--text-primary); }
html.dark .history-item .history-del:hover { background: rgba(255, 255, 255, .1); }
.history-item .history-del svg { width: 12px; height: 12px; stroke: currentColor; }
.history-empty {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0 6px;
}
.sidebar.collapsed .history-section { display: none; }

/* ---------- 模型下拉菜单 ---------- */
.model-menu {
    position: absolute;
    top: 52px;
    left: 22px;
    width: 300px;
    max-height: 60vh;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: menuIn .22s var(--ease-out-expo) both;
}
@keyframes menuIn {
    from { opacity: 0; transform: translateY(-6px) scale(.985); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.model-menu-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 12px 14px 8px;
    flex-shrink: 0;
}
.model-menu-list {
    overflow-y: auto;
    padding: 0 8px 8px;
}
.model-menu-list::-webkit-scrollbar { width: 3px; }
.model-menu-list::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}
.model-item:hover { background: var(--bg-input); color: var(--text-primary); }
.model-item.active { background: var(--accent-soft); color: var(--text-primary); font-weight: 600; }
.model-item .model-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.model-item .model-name {
    font-size: 13px; font-weight: inherit;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-item .model-provider {
    font-size: 11px; color: var(--text-muted); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.model-item .model-check { width: 15px; height: 15px; flex-shrink: 0; color: var(--text-primary); opacity: 0; }
.model-item.active .model-check { opacity: 1; }
.model-item .model-check svg { width: 15px; height: 15px; stroke: currentColor; }
.model-item .model-caps {
    display: flex; gap: 4px; flex-shrink: 0;
}
.model-cap {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .3px;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
    padding: 1.5px 6px;
    border-radius: 8px;
}
.model-menu-empty { font-size: 12.5px; color: var(--text-muted); padding: 8px 12px 10px; }

/* ---------- 附件预览条 ---------- */
.attach-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 10px 2px;
}
.attach-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 30px 7px 9px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 220px;
    animation: riseIn .3s var(--ease-out-expo) both;
}
.attach-item .attach-thumb {
    width: 30px; height: 30px;
    border-radius: 7px;
    overflow: hidden;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}
.attach-item .attach-thumb img { width: 100%; height: 100%; object-fit: cover; }
.attach-item .attach-thumb svg { width: 15px; height: 15px; stroke: currentColor; }
.attach-item .attach-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.attach-item .attach-name {
    font-size: 12px; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attach-item .attach-size { font-size: 10.5px; color: var(--text-muted); }
.attach-item .attach-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    border: none; background: transparent;
    border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted); padding: 0;
}
.attach-item .attach-del:hover { background: rgba(0, 0, 0, .08); color: var(--text-primary); }
html.dark .attach-item .attach-del:hover { background: rgba(255, 255, 255, .1); }
.attach-item .attach-del svg { width: 11px; height: 11px; stroke: currentColor; }

/* ---------- 深度思考折叠块 ---------- */
.msg-thinking {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-input);
    overflow: hidden;
}
.msg-thinking-header {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}
.msg-thinking-header:hover { background: rgba(0, 0, 0, .03); }
html.dark .msg-thinking-header:hover { background: rgba(255, 255, 255, .04); }
.msg-thinking-header svg { width: 13px; height: 13px; stroke: currentColor; flex-shrink: 0; }
.msg-thinking-header .thinking-chevron { margin-left: auto; opacity: .5; transition: transform var(--transition); }
.msg-thinking.open .thinking-chevron { transform: rotate(180deg); }
.msg-thinking-header .thinking-status { font-weight: 500; color: var(--text-muted); }
.msg-thinking-body {
    display: none;
    padding: 4px 14px 12px;
    font-family: var(--font-sans);
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 320px;
    overflow-y: auto;
}
.msg-thinking-body::-webkit-scrollbar { width: 3px; }
.msg-thinking-body::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.msg-thinking.open .msg-thinking-body { display: block; animation: riseIn .3s var(--ease-out-expo) both; }

/* ---------- Markdown 渲染 ---------- */
.msg-content p { margin: 0 0 10px; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
    font-family: var(--font-sans);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.4;
    margin: 16px 0 8px;
}
.msg-content h1 { font-size: 19px; }
.msg-content h2 { font-size: 17px; }
.msg-content h3 { font-size: 15.5px; }
.msg-content h4 { font-size: 14.5px; }
.msg-content h1:first-child, .msg-content h2:first-child, .msg-content h3:first-child { margin-top: 0; }
.msg-content ul, .msg-content ol { padding-left: 22px; margin: 0 0 10px; }
.msg-content li { margin-bottom: 4px; }
.msg-content li::marker { color: var(--text-muted); }
.msg-content a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 2px;
}
.msg-content a:hover { text-decoration-color: var(--text-primary); }
.msg-content blockquote {
    border-left: 3px solid var(--border-strong);
    padding: 2px 0 2px 12px;
    margin: 0 0 10px;
    color: var(--text-secondary);
}
.msg-content code {
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
    font-size: 12.5px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    padding: 1px 5px;
}
.msg-content pre {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 10px;
    overflow-x: auto;
    position: relative;
}

/* ---------- 代码卡片（DeepSeek 风格：文件名 + 操作按钮） ---------- */
.msg-content .code-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin: 0 0 10px;
    overflow: hidden;
    background: var(--bg-input);
}
.msg-content .code-card pre {
    border: none;
    border-radius: 0;
    margin: 0;
    background: transparent;
}
.msg-content .code-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px 6px 14px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}
.msg-content .code-lang {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
}
.msg-content .code-file {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11.5px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.msg-content .code-acts {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.msg-content .code-acts button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 9px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    transition: all .16s;
}
.msg-content .code-acts button svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
}
.msg-content .code-acts button:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}
.msg-content .code-acts button.done {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* ---------- 长代码文件条（豆包文档风，点击右侧展开） ---------- */
.msg-content .code-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin: 0 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color .16s, transform .16s;
    user-select: none;
}
.msg-content .code-strip:hover {
    border-color: var(--text-primary);
}
.msg-content .code-strip .cs-ico {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.msg-content .code-strip .cs-ico svg {
    width: 16px;
    height: 16px;
    stroke: var(--text-primary);
}
.msg-content .code-strip .cs-name {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.msg-content .code-strip .cs-meta {
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: auto;
}
.msg-content .code-strip .cs-hint {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.msg-content .code-strip .cs-hint svg {
    width: 12px;
    height: 12px;
    stroke: currentColor;
    transform: rotate(-90deg);
}

/* ---------- 代码查看抽屉（TRAE 风格右侧面板） ---------- */
.code-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    z-index: 240;
}
.code-drawer-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}
.code-drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: min(620px, 92vw);
    background: var(--bg-body, #fff);
    border-left: 1px solid var(--border-color, #e6e6e6);
    z-index: 241;
    transform: translateX(102%);
    transition: transform .28s cubic-bezier(.16, 1, .3, 1);
    display: flex;
    flex-direction: column;
}
html.dark .code-drawer {
    box-shadow: -18px 0 48px rgba(0, 0, 0, .4);
}
.code-drawer.open {
    transform: translateX(0);
}
.cd-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.cd-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.cd-ico {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--bg-input, #f0f0f0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.cd-ico svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}
.cd-name-wrap {
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.cd-name {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cd-meta {
    font-size: 11px;
    color: var(--text-muted, #8a8a8a);
}
.cd-acts {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}
.cd-acts button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #e6e6e6);
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary, #525252);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all .16s;
}
.cd-acts button svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
}
.cd-acts button:hover {
    border-color: var(--text-primary, #1a1a1a);
    color: var(--text-primary, #1a1a1a);
}
.cd-acts .cd-close {
    padding: 6px;
}
.cd-body {
    flex: 1;
    overflow: auto;
    padding: 12px 0;
    counter-reset: cdline;
}
.cd-code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12.5px;
    line-height: 1.65;
}
.cd-line {
    display: flex;
    align-items: flex-start;
    padding: 0 16px 0 0;
    white-space: pre;
}
.cd-line:hover {
    background: var(--bg-input, #f0f0f0);
}
.cd-ln {
    flex-shrink: 0;
    width: 52px;
    text-align: right;
    padding-right: 14px;
    color: var(--text-muted, #8a8a8a);
    user-select: none;
    font-variant-numeric: tabular-nums;
}
.cd-tx {
    color: var(--text-primary, #1a1a1a);
    min-width: 0;
}

/* ---------- 任务计划（Todo）面板 ---------- */
.todo-drawer {
    width: min(420px, 92vw);
}
.todo-add {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.todo-add input {
    flex: 1;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color .16s;
}
.todo-add input:focus {
    border-color: var(--text-primary);
}
.todo-add button {
    width: 38px;
    flex-shrink: 0;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .16s;
}
.todo-add button svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
}
.todo-add button:hover {
    border-color: var(--text-primary);
}
.todo-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
}
.todo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .14s;
}
.todo-row:hover {
    background: var(--bg-input);
}
.todo-check {
    width: 20px;
    height: 20px;
    border: 1.5px solid var(--border-strong, #d6d6d6);
    border-radius: 6px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .16s;
}
.todo-check svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    opacity: 0;
}
.todo-row.done .todo-check {
    background: var(--text-primary, #1a1a1a);
    border-color: var(--text-primary, #1a1a1a);
}
html.dark .todo-row.done .todo-check svg { stroke: #0a0a0a; }
.todo-row.done .todo-check svg {
    opacity: 1;
}
.todo-text {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text-primary);
    word-break: break-all;
}
.todo-row.done .todo-text {
    color: var(--text-muted);
    text-decoration: line-through;
}
.todo-del {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}
.todo-del svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
}
.todo-row:hover .todo-del {
    display: flex;
}
.todo-del:hover {
    color: var(--text-primary);
    background: var(--bg-input);
}
.todo-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12.5px;
    padding: 30px 0;
}
.todo-empty svg {
    width: 30px;
    height: 30px;
    stroke: currentColor;
    opacity: .5;
}

/* ---------- Agent 工具运行状态 ---------- */
.tool-runs {
    margin: 4px 0 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.tool-run {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-input);
}
.tool-run svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    flex-shrink: 0;
}
.tool-run.ok {
    border-style: solid;
    color: var(--text-primary);
}
.msg-content pre::-webkit-scrollbar { height: 3px; }
.msg-content pre::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
.msg-content pre code {
    background: none;
    border: none;
    padding: 0;
    font-size: 12.5px;
    line-height: 1.7;
    color: var(--text-primary);
}
.msg-content table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-sans);
    font-size: 13px;
    margin: 0 0 10px;
}
.msg-content th, .msg-content td {
    border: 1px solid var(--border-color);
    padding: 7px 10px;
    text-align: left;
}
.msg-content th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-input);
}
.msg-content hr { border: none; border-top: 1px solid var(--border-color); margin: 14px 0; }
.msg-content img { max-width: 100%; border-radius: 10px; }

/* ---------- 消息内附件展示 ---------- */
.msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.msg-attachment {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    max-width: 240px;
}
.msg-attachment img { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; }
.msg-attachment svg { width: 15px; height: 15px; stroke: var(--text-muted); flex-shrink: 0; }
.msg-attachment .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 消息操作条扩展（停止生成） ---------- */
.msg-action-btn.stop-btn { color: var(--text-primary); font-weight: 600; }

/* ---------- 搜索来源列表 ---------- */
.search-sources {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-muted);
}
.search-sources .src-title { font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.search-sources a {
    display: block;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 3px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-sources a:hover { color: var(--text-primary); text-decoration: underline; }

/* ---------- 模型菜单响应式 ---------- */
@media (max-width: 768px) {
    .model-menu { left: 16px; right: 16px; width: auto; }
    .history-section { max-height: 26vh; }
}

@media (prefers-reduced-motion: reduce) {
    .model-menu, .history-section, .attach-item, .msg-thinking-body { animation-duration: .01ms !important; }
}

/* ============================================================
   VIP / 积分体系（延续设计令牌）
   ============================================================ */

/* ---------- 输入框余额胶囊 ---------- */
.points-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 9px;
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    font-variant-numeric: tabular-nums;
    margin-right: 2px;
}
.points-chip:hover { color: var(--text-primary); border-color: var(--border-strong); }
.points-chip svg { width: 12px; height: 12px; stroke: currentColor; }
.points-chip.low { color: var(--text-primary); border-color: var(--text-primary); }

/* ---------- 模型锁定态 ---------- */
.model-item.locked { opacity: .62; }
.model-item.locked .model-name { color: var(--text-muted); }
.model-item.locked:hover { color: var(--text-secondary); }
.model-lock-tag {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .3px;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    padding: 1.5px 6px;
    border-radius: 8px;
    white-space: nowrap;
}
.model-lock-tag svg { width: 9px; height: 9px; stroke: currentColor; vertical-align: -1px; margin-right: 2px; }

/* ---------- 升级引导卡（积分不足 / 模型锁定） ---------- */
.msg-upgrade {
    margin-top: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-input);
    font-family: var(--font-sans);
    animation: riseIn .45s var(--ease-out-expo) both;
}
.msg-upgrade .up-title {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}
.msg-upgrade .up-title svg { width: 15px; height: 15px; stroke: currentColor; }
.msg-upgrade .up-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 11px; }
.msg-upgrade .up-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    padding: 7px 15px;
    border-radius: 10px;
    text-decoration: none;
    background: var(--text-primary);
    color: var(--bg-card);
    transition: transform .28s var(--ease-out-expo), opacity .2s;
}
.msg-upgrade .up-btn:hover { transform: translateY(-1px); opacity: .92; }
.msg-upgrade .up-btn svg { width: 13px; height: 13px; stroke: currentColor; }

/* ============================================================
   退出登录按钮（侧边栏底部）
   ============================================================ */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 4px;
}
.sidebar-user .user-info { flex: 1; min-width: 0; }
.user-logout {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border: 1px solid var(--border-color);
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}
.user-logout svg { width: 14px; height: 14px; stroke: currentColor; }
.user-logout:hover {
    color: var(--text-primary);
    border-color: var(--text-primary);
}
.sidebar.collapsed .user-logout { display: none; }
html.dark .msg-upgrade .up-btn { color: #f2f2f2; }
