/* ==========================================================================
   AI Workspace - Borderless Pure-Tone (无边框纯色块极简设计系统)
   Seamless Tonal Layering / Zero Stroke Noise / Light & Dark Unified
   ========================================================================== */

:root {
    /* 默认深色模式 (Obsidian Pure Dark) */
    --bg-canvas: #0f0f12;          /* 最底层深黑画布 */
    --bg-panel: #17171c;           /* 侧边栏与顶部导航面板 */
    --bg-card: #202028;            /* 卡片、输入框、消息气泡容器 */
    --bg-hover: #292934;           /* 悬浮实色 */
    --bg-active: #2f2f3d;          /* 选中激活实色 */
    --bg-input-focus: #242430;      /* 输入框聚焦底色 */

    --text-primary: #f0f0f5;       /* 主文本 */
    --text-secondary: #9898ad;     /* 次级文本 */
    --text-muted: #606075;         /* 弱化文本 */

    --accent-primary: #6366f1;     /* 电光靛紫 */
    --accent-hover: #7b7eff;       /* 强调悬浮 */
    --accent-container: #282842;   /* 弱强调底色 */

    --thinking-bg: #1a1a26;
    --thinking-content: #111118;
    --thinking-text: #c8c8dc;
    --thinking-title: #a5b4fc;

    --code-bg: #0d0d10;
    --code-header-bg: #17171d;
    --code-text: #e2e8f0;
    --code-btn-bg: #22222a;
    --code-btn-text: #9898ad;

    --shadow-popover: 0 16px 36px rgba(0, 0, 0, 0.45);
    --shadow-drawer: 10px 0 30px rgba(0, 0, 0, 0.4);

    /* 灵感卡片徽标色阶 */
    --badge-code-bg: #282842;
    --badge-code-color: #a5b4fc;
    --badge-search-bg: #1a3328;
    --badge-search-color: #6ee7b7;
    --badge-art-bg: #3b1e2c;
    --badge-art-color: #f472b6;
    --badge-think-bg: #382c16;
    --badge-think-color: #fcd34d;

    --sidebar-width: 260px;
    --artifacts-width: 520px;
    --top-nav-height: 56px;
    
    --radius-sm: 6px;              /* 按钮与输入框微圆角 */
    --radius-md: 10px;             /* 卡片与容器 */
    --radius-lg: 14px;             /* 悬浮与大弹层 */

    --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "Fira Code", Consolas, monospace;
}

[data-theme="light"] {
    /* 极致通透浅色模式 (Calm Architectural Slate & Deep Charcoal Light) */
    --bg-canvas: #f4f5f8;          /* 底层极浅画布 */
    --bg-panel: #eaecee;           /* 侧边栏与顶栏纯净浅灰 */
    --bg-card: #ffffff;            /* 卡片与输入框纯白 */
    --bg-hover: #e2e4ea;           /* 悬浮柔灰 */
    --bg-active: #d8dbe5;          /* 激活高亮浅蓝灰 */
    --bg-input-focus: #ffffff;      /* 输入框聚焦纯白 */

    --text-primary: #18181b;       /* 主文本深炭灰 */
    --text-secondary: #52525b;     /* 次级中炭灰 */
    --text-muted: #71717a;         /* 弱化柔灰 */

    --accent-primary: #18181b;     /* 极简高级深黑炭，彻底告别刺眼蓝紫 */
    --accent-hover: #27272a;
    --accent-container: #f4f4f5;   /* 柔和低饱和灰底色 */

    --thinking-bg: #f4f4f5;
    --thinking-content: #fafafa;
    --thinking-text: #27272a;
    --thinking-title: #3f3f46;

    --code-bg: #f8fafc;
    --code-header-bg: #f1f5f9;
    --code-text: #1e293b;
    --code-btn-bg: #e2e8f0;
    --code-btn-text: #475569;

    --shadow-popover: 0 12px 30px rgba(0, 0, 0, 0.08);
    --shadow-drawer: 10px 0 25px rgba(0, 0, 0, 0.06);

    /* 浅色通透低饱和徽标体系 */
    --badge-code-bg: #f4f4f5;
    --badge-code-color: #27272a;
    --badge-search-bg: #ecfdf5;
    --badge-search-color: #047857;
    --badge-art-bg: #fdf2f8;
    --badge-art-color: #be185d;
    --badge-think-bg: #fffbeb;
    --badge-think-color: #b45309;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--bg-hover) transparent;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-canvas);
    color: var(--text-primary);
    line-height: 1.6;
    /* 手机浏览器的 100vh 按地址栏收起后的高度算，地址栏显示时底部会被裁掉一截（正好是输入框）；
       dvh 跟随实际可视高度，不支持 dvh 的旧浏览器退回 vh */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    transition: background-color 0.2s ease, color 0.2s ease;
}

/* ==========================================================================
   全局布局 (App Layout)
   ========================================================================== */
.app-layout {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    position: relative;
    background-color: var(--bg-canvas);
}

/* 按钮与通用组件 (无边框纯色) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.btn-icon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.icon {
    width: 18px;
    height: 18px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--accent-primary);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.12s ease;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

[data-theme="light"] .btn-primary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: none;
    box-shadow: none;
}

[data-theme="light"] .btn-primary:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    background-color: var(--bg-card);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.btn-pill:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-pill.active {
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 600;
}

.btn-pill.disabled,
.btn-pill[disabled] {
    opacity: 0.38;
    cursor: not-allowed;
    filter: grayscale(0.8);
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   1. 左侧会话侧边栏 (Sidebar - 纯色色块，无右边框)
   ========================================================================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-panel);
    border: none;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.25s, background-color 0.2s ease;
    z-index: 20;
    overflow: hidden;
    white-space: nowrap;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

#btn-open-sidebar {
    display: none;
}

.sidebar.collapsed ~ .main-content #btn-open-sidebar {
    display: inline-flex !important;
}

/* 品牌头部 (极简灯泡 logo - 你的灯亮着吗？) */
.sidebar-brand {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-panel);
}

.brand-icon.lightbulb-brand {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.16) 100%);
    color: #f59e0b;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    cursor: default;
}

[data-theme="light"] .brand-icon.lightbulb-brand {
    background: #fef3c7;
    color: #d97706;
}

.brand-icon.lightbulb-brand:hover {
    transform: scale(1.06);
    box-shadow: 0 0 14px rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}

.lightbulb-icon {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.6));
    transition: filter 0.2s ease, transform 0.2s ease;
}

.brand-icon.lightbulb-brand:hover .lightbulb-icon {
    filter: drop-shadow(0 0 10px rgba(251, 191, 36, 0.95));
}

.sidebar-header-actions {
    padding: 10px 12px 4px 12px;
}

.btn-new-chat {
    width: 100%;
    justify-content: center;
}

.sidebar-search {
    padding: 7px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    margin: 8px 12px 6px 12px;
    border-radius: var(--radius-sm);
    border: none;
    transition: background-color 0.12s ease;
}

.sidebar-search .search-icon {
    color: var(--text-muted);
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.sidebar-search input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12.5px;
    width: 100%;
}

.sidebar-section-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    padding: 10px 16px 4px 16px;
}

.session-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
}

.session-item {
    display: flex;
    align-items: center;
    padding: 8px 36px 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 2px;
    transition: none !important;
    position: relative;
    user-select: none;
    height: 36px;
    box-sizing: border-box;
    border: none;
}

.session-item:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    transition: none !important;
}

.session-item.active {
    background-color: var(--bg-active);
    color: var(--text-primary);
    border: none !important;
    border-radius: var(--radius-sm);
    transition: none !important;
}

.session-title-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    display: block;
}

.session-actions {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.1s ease;
}

.session-item:hover .session-actions {
    opacity: 1;
    pointer-events: auto;
}

.session-actions .btn-icon {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    padding: 3px;
    color: var(--text-muted);
}

.session-actions .btn-icon:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.session-actions .btn-delete:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.15);
}

.session-actions .btn-pin.active {
    color: #f59e0b;
}

.session-actions .icon {
    width: 14px;
    height: 14px;
}

.btn-load-more-sessions {
    width: 100%;
    margin: 6px 0 2px;
    padding: 7px 8px;
    border: 1px dashed var(--text-muted);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
}
.btn-load-more-sessions:hover:not(:disabled) {
    color: var(--text-secondary);
    border-style: solid;
}
.btn-load-more-sessions:disabled {
    cursor: default;
    opacity: 0.6;
}

.session-group-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    padding: 8px 8px 3px 8px;
    margin-top: 4px;
    user-select: none;
}

.session-pin-indicator {
    font-size: 11px;
    margin-right: 5px;
    flex-shrink: 0;
    opacity: 0.85;
}

/* 顶部栏会话导出快捷下拉 */
.export-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.export-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 260px;
    background-color: var(--bg-panel);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    padding: 6px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: none;
}

[data-theme="light"] .export-dropdown-menu {
    background-color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.export-option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    transition: background-color 0.12s ease;
}

.export-option-item:hover {
    background-color: var(--bg-hover);
}

.export-option-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.export-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-option-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.export-option-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.sidebar-footer {
    padding: 12px 14px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-panel);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--accent-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.username {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.status-indicator {
    font-size: 11px;
    color: #10b981;
    display: flex;
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    margin-right: 5px;
}

.footer-actions {
    display: flex;
    gap: 4px;
}

/* ==========================================================================
   2. 中间主对话流与工作区 (Main Content)
   ========================================================================== */
.main-content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-canvas);
    overflow: hidden;
}

/* 顶部导航条 */
.top-nav {
    height: var(--top-nav-height);
    min-height: var(--top-nav-height);
    flex-shrink: 0;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background-color: var(--bg-panel);
    z-index: 10;
    transition: background-color 0.2s ease;
}

.nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==========================================================================
   自定义手风琴分层模型选择器 (Accordion Layered Model Selector)
   ========================================================================== */
.model-selector-wrapper {
    position: relative;
    user-select: none;
}

.model-select-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.model-select-btn:hover {
    background-color: var(--bg-hover);
}

.model-btn-badge {
    font-size: 13px;
}

.model-btn-text {
    font-weight: 600;
    color: var(--text-primary);
}

.model-select-btn .chevron-icon {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.model-select-btn.active .chevron-icon {
    transform: rotate(180deg);
}

/* 下拉手风琴面板 */
.model-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 330px;
    max-height: 480px;
    overflow-y: auto;
    background-color: var(--bg-panel);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    padding: 6px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.model-option-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* 模型行内嵌联网微按钮 */
.btn-model-search-addon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .btn-model-search-addon {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    border: none;
}

.btn-model-search-addon:hover {
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-model-search-addon.active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .btn-model-search-addon.active {
    background: #eff6ff;
    color: #2563eb;
    border: none;
    box-shadow: none;
}

[data-theme="light"] .btn-model-search-addon:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: none;
}

.model-accordion-group {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background-color: var(--bg-card);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    background-color: var(--bg-card);
    transition: background-color 0.12s ease;
}

.accordion-header:hover {
    background-color: var(--bg-hover);
}

.accordion-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.model-accordion-group.open .accordion-title {
    color: var(--text-primary);
}

.acc-chevron {
    width: 13px;
    height: 13px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}

.model-accordion-group.open .acc-chevron {
    transform: rotate(180deg);
}

.accordion-body {
    display: none;
    padding: 4px 6px 6px 6px;
    flex-direction: column;
    gap: 3px;
    background-color: var(--bg-panel);
}

.model-accordion-group.open .accordion-body {
    display: flex;
}

.model-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background-color: transparent;
    transition: background-color 0.12s ease;
}

.model-option:hover {
    background-color: var(--bg-hover);
}

.model-option.selected {
    background-color: var(--bg-active);
}

.model-option-main {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.model-option .model-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.model-option .model-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.model-option.selected .model-desc {
    color: var(--text-secondary);
}

.model-option .check-icon {
    display: none;
    width: 15px;
    height: 15px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.model-option.selected .check-icon {
    display: block;
}

select, .quality-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 0 !important;
    border-style: none !important;
    outline: none !important;
    box-shadow: none !important;
    border-radius: var(--radius-sm);
    padding: 7px 30px 7px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239898ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: background-color 0.12s ease;
}

select:hover, select:focus,
.quality-select:hover, .quality-select:focus {
    background-color: var(--bg-hover);
    border: 0 !important;
    outline: none !important;
    box-shadow: none !important;
}

select option, select optgroup {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    border: 0 !important;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
    display: flex;
    justify-content: center;
}

.messages-feed {
    width: 100%;
    max-width: 820px;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* 空状态欢迎页 (无边框纯色块灵感卡片) */
.empty-state {
    text-align: center;
    margin: auto 0;
    padding: 40px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-badge {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16) 0%, rgba(217, 119, 6, 0.16) 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    cursor: default;
}

[data-theme="light"] .empty-badge {
    background: #fef3c7;
    border: none;
}

.empty-badge:hover {
    transform: scale(1.08) rotate(3deg);
    box-shadow: 0 8px 30px rgba(245, 158, 11, 0.45);
}

.empty-badge .lightbulb-icon {
    width: 32px;
    height: 32px;
    filter: drop-shadow(0 0 8px rgba(251, 191, 36, 0.75));
}

.empty-headline {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto 30px auto;
    line-height: 1.5;
}

.suggestion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 680px;
}

.stitch-card {
    background-color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stitch-card:hover {
    background-color: var(--bg-hover);
}

.stitch-card-header {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.card-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.02em;
    border: none;
}

.badge-code {
    background-color: var(--badge-code-bg);
    color: var(--badge-code-color);
}

.badge-search {
    background-color: var(--badge-search-bg);
    color: var(--badge-search-color);
}

.badge-art {
    background-color: var(--badge-art-bg);
    color: var(--badge-art-color);
}

.badge-think {
    background-color: var(--badge-think-bg);
    color: var(--badge-think-color);
}

.stitch-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.stitch-card-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* 对话消息体 (Message Items) */
.message-row {
    display: flex;
    gap: 12px;
    width: 100%;
}

.message-row.user {
    justify-content: flex-end;
}

.message-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    position: relative;
}

.message-row.user .message-wrapper {
    align-items: flex-end;
}

.message-row.assistant .message-wrapper {
    max-width: 100%;
    width: 100%;
    align-items: flex-start;
}

.message-bubble {
    width: 100%;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14.5px;
    line-height: 1.65;
    word-break: break-word;
}

.message-row.user .message-bubble {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: none;
}

.message-row.assistant .message-bubble {
    background: transparent;
    padding: 0;
    max-width: 100%;
    flex: 1;
    color: var(--text-primary);
}

/* 消息操作工具栏 (Hover 时显现) */
.message-actions-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.message-row:hover .message-actions-bar,
.message-row:focus-within .message-actions-bar {
    opacity: 1;
    pointer-events: auto;
}

.btn-msg-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background-color: var(--bg-panel);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.btn-msg-action:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-msg-action .icon {
    width: 13px;
    height: 13px;
}

/* 树状多版本分支切换器 (Branch Switcher) */
.branch-switcher {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background-color: var(--bg-panel);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    user-select: none;
    margin-right: 4px;
}

.btn-branch-nav {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 2px 5px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.12s ease, opacity 0.12s ease;
}

.btn-branch-nav:hover:not(:disabled) {
    background-color: var(--bg-hover);
    color: var(--accent-primary);
}

.btn-branch-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.branch-indicator {
    font-size: 11px;
    font-weight: 600;
    min-width: 32px;
    text-align: center;
    color: var(--text-secondary);
}

/* 用户消息行内编辑容器 */
.msg-edit-container {
    width: 100%;
    min-width: 300px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.msg-edit-textarea {
    width: 100%;
    min-height: 60px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.msg-edit-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.btn-sm-primary {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background-color: var(--accent-primary);
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-sm-primary:hover {
    background-color: var(--accent-hover);
}

.btn-sm-cancel {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background-color: transparent;
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
}

.btn-sm-cancel:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

/* 用户消息内附件预览 */
.user-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.user-msg-attachment-img {
    max-width: 220px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}

.user-msg-attachment-doc {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: var(--bg-hover);
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* 联网搜索来源卡片 (Citations) */
.citations-container {
    margin-top: 14px;
    padding-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.citations-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.citations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.citation-card {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-primary);
    transition: background-color 0.12s ease, transform 0.1s ease;
    overflow: hidden;
}

.citation-card:hover {
    background-color: var(--bg-hover);
    transform: translateY(-1px);
}

.citation-favicon {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
    background-color: #ffffff;
}

.citation-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
    line-height: 1.3;
}

.citation-title {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.citation-domain {
    font-size: 10.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.citation-arrow {
    width: 12px;
    height: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* 全局 Toast 通知 */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast-item {
    background-color: var(--bg-panel);
    color: var(--text-primary);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-popover);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transform: translateY(12px);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.toast-item.show {
    transform: translateY(0);
    opacity: 1;
}

/* 快捷键速查卡片 */
.shortcuts-card {
    position: relative;
    width: 440px;
    max-width: 90vw;
    background-color: var(--bg-panel);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    padding: 20px;
    z-index: 101;
}

.shortcuts-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.shortcuts-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.shortcuts-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    background-color: var(--bg-card);
    border-radius: var(--radius-sm);
}

.shortcut-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.kbd-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

kbd {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
}

/* ==========================================================================
   特色组件 1: 深度折叠思维链 (Thinking Drawer - 无边框纯色)
   ========================================================================== */
.thinking-drawer {
    margin-bottom: 16px;
    border: none;
    background-color: var(--thinking-bg);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.thinking-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    cursor: pointer;
    user-select: none;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--thinking-title);
    list-style: none;
}

.thinking-summary::-webkit-details-marker {
    display: none;
}

.thinking-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.thinking-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    background-color: var(--accent-container);
    color: var(--accent-primary);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 600;
}

.thinking-content {
    padding: 12px 14px;
    border: none;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--thinking-text);
    white-space: pre-wrap;
    background-color: var(--thinking-content);
    max-height: 380px;
    overflow-y: auto;
}

/* Markdown 代码块与 Artifacts 触发按钮 */
.code-block-wrapper {
    position: relative;
    margin: 16px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: none;
    background-color: var(--code-bg);
    color: var(--code-text);
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background-color: var(--code-header-bg);
    border: none;
    font-size: 12px;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.code-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-code-action {
    background-color: var(--code-btn-bg);
    border: none;
    color: var(--code-btn-text);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: background-color 0.12s ease, color 0.12s ease;
}

.btn-code-action:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.btn-code-artifact {
    background-color: var(--accent-primary);
    color: #ffffff;
    font-weight: 500;
    border: none;
}

.btn-code-artifact:hover {
    background-color: var(--accent-hover);
}

[data-theme="light"] .btn-code-artifact {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: none;
}

[data-theme="light"] .btn-code-artifact:hover {
    background-color: var(--bg-active);
    color: var(--text-primary);
}

.code-block-wrapper pre {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background-color: var(--code-bg);
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 4;
}

.code-block-wrapper pre code.hljs {
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    white-space: inherit;
    word-break: inherit;
}

/* 生成的图片卡片展示 */
.generated-image-card {
    margin: 16px 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: none;
    background-color: var(--bg-card);
    display: inline-block;
    max-width: 500px;
    box-shadow: var(--shadow-popover);
}

.generated-image-card img {
    width: 100%;
    height: auto;
    display: block;
    cursor: zoom-in;
}

/* ==========================================================================
   输入区域 (Input Card - 无边框纯色块)
   ========================================================================== */
.input-container-wrapper {
    padding: 0 20px 20px 20px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-canvas);
}

.input-card {
    width: 100%;
    max-width: 820px;
    background-color: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.input-card:focus-within {
    background-color: var(--bg-input-focus);
    box-shadow: var(--shadow-popover);
}

.input-card.drag-over {
    box-shadow: 0 0 0 2px var(--accent-primary), var(--shadow-popover);
    background-color: var(--bg-hover);
}

/* 附件预览栏 */
.attachment-preview-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 8px;
    margin-bottom: 6px;
}

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-panel);
    padding: 4px 8px 4px 6px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-primary);
    position: relative;
    max-width: 240px;
}

.attachment-chip-img {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
}

.attachment-chip-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    background-color: var(--accent-container);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

.attachment-chip-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    line-height: 1.2;
    flex: 1;
}

.attachment-chip-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.attachment-chip-size {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.btn-remove-attachment {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.12s ease;
}

.btn-remove-attachment:hover {
    color: #ef4444;
}

.btn-upload {
    color: var(--text-muted);
    flex-shrink: 0;
}

.btn-upload:hover {
    color: var(--text-primary);
}

.image-config-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border: none;
    font-size: 12px;
    flex-wrap: wrap;
}

.config-label {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ratio-selectors {
    display: flex;
    gap: 4px;
    background: var(--bg-panel);
    padding: 2px;
    border-radius: var(--radius-sm);
    border: none;
}

.ratio-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 11px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.ratio-btn.active {
    background-color: var(--bg-card);
    color: var(--accent-primary);
    font-weight: 600;
}

.quality-select {
    background-color: var(--bg-panel);
    border: none;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 11.5px;
}

.textarea-wrapper {
    width: 100%;
    display: flex;
    align-items: flex-end;
    gap: 10px;
}

.btn-upload-clip {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    margin-bottom: 2px;
    transition: all 0.15s ease;
}

.btn-upload-clip:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

#prompt-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14.5px;
    line-height: 1.55;
    resize: none;
    max-height: 180px;
    min-height: 36px;
    padding: 6px 0;
}

#prompt-input::placeholder {
    color: var(--text-muted);
    font-size: 13.5px;
}

.input-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 2px;
}

.btn-send, .btn-stop {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.btn-send {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

[data-theme="light"] .btn-send {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: none;
    box-shadow: none;
}

.btn-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.5);
}

[data-theme="light"] .btn-send:hover {
    background: var(--bg-active);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-send:active {
    transform: translateY(0);
}

.btn-stop {
    background-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* ==========================================================================
   3. 右侧独立成果物工作区 (Artifacts Panel - 无边框纯色面板)
   ========================================================================== */
.artifacts-panel {
    width: var(--artifacts-width);
    height: 100%;
    background-color: var(--bg-panel);
    border: none;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), width 0.25s ease;
    z-index: 15;
}

.artifacts-panel.hidden {
    display: none !important;
}

.artifacts-header {
    height: var(--top-nav-height);
    padding: 0 16px;
    border: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-panel);
}

.artifact-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.artifact-badge {
    background-color: var(--accent-container);
    color: var(--accent-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    border: none;
    letter-spacing: 0.05em;
}

.artifact-title {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.artifact-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 标签页指示器 (Flat Pill) */
.tab-group {
    display: flex;
    gap: 8px;
}

.tab-btn {
    border: none !important;
    background: transparent;
    padding: 4px 8px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background-color 0.12s ease, color 0.12s ease;
}

.tab-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.tab-btn.active {
    background-color: var(--accent-container);
    color: var(--accent-primary);
    font-weight: 600;
}

[data-theme="light"] .tab-btn.active {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: none;
    box-shadow: none;
}

.artifacts-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background-color: var(--code-bg);
}

.artifact-view {
    width: 100%;
    height: 100%;
    position: relative;
}

.sandbox-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background-color: #ffffff;
}

#artifact-code-view {
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: var(--code-bg);
}

#artifact-code-view pre {
    margin: 0;
    padding: 16px 20px;
    min-height: 100%;
    box-sizing: border-box;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background-color: var(--code-bg);
    white-space: pre-wrap;
    word-break: break-word;
    tab-size: 4;
}

#artifact-code-view code.hljs,
.code-content {
    padding: 0;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    color: var(--code-text);
    white-space: inherit;
    word-break: inherit;
}

/* 大图预览模态框 */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
}

.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    z-index: 101;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-md);
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.modal-close {
    position: absolute;
    top: -36px;
    right: -36px;
    color: #fff;
    font-size: 20px;
}

/* ==========================================================================
   4. 移动端自适应响应式 (Mobile Responsive - Pixel 6a 实测优化)
   ========================================================================== */
@media (max-width: 768px) {
    #btn-open-sidebar {
        display: inline-flex !important;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px !important;
        min-width: 280px !important;
        z-index: 50;
        margin-left: 0 !important;
        transform: translateX(-100%) !important;
        visibility: hidden !important;
        opacity: 0;
        transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, visibility 0.25s;
        box-shadow: var(--shadow-drawer);
    }

    .sidebar.open {
        transform: translateX(0) !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    .sidebar.collapsed {
        transform: translateX(-100%) !important;
        visibility: hidden !important;
        opacity: 0 !important;
    }

    .main-content {
        width: 100vw;
    }

    .top-nav {
        padding: 0 12px;
    }

    .model-select-btn {
        padding: 5px 8px;
        font-size: 12px;
        max-width: 170px;
    }

    .model-btn-text {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .model-dropdown-menu {
        position: fixed;
        top: calc(var(--top-nav-height) + 4px);
        left: 12px;
        right: 12px;
        width: auto;
        max-width: 360px;
        margin: 0 auto;
        max-height: 60vh;
    }

    .btn-pill {
        padding: 4px 8px;
        font-size: 11.5px;
    }

    .btn-pill span {
        display: none;
    }

    .messages-feed {
        padding: 0 12px;
    }

    .empty-headline {
        font-size: 20px;
    }

    .empty-subtitle {
        font-size: 13px;
        margin-bottom: 20px;
    }

    .suggestion-grid {
        grid-template-columns: 1fr;
    }

    .artifacts-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        z-index: 60;
    }

    .input-container-wrapper {
        padding: 0 12px 12px 12px;
    }

    .message-actions-bar {
        opacity: 0.9;
        pointer-events: auto;
    }

    .modal-close {
        top: -30px;
        right: 0;
    }
}

/* =========================================================================
   会话智能压缩 (Context Compaction) 节点卡片
   ========================================================================= */
.message-row.compaction {
    justify-content: center;
    margin: 16px 0;
}

.compaction-node-card {
    width: 100%;
    max-width: 820px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    border: 1px dashed rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.compaction-node-card:hover {
    border-color: var(--accent-primary);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.12);
}

.compaction-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    cursor: pointer;
    background-color: rgba(99, 102, 241, 0.04);
    user-select: none;
}

.compaction-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-primary);
}

.compaction-icon {
    font-size: 15px;
}

.compaction-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 7px;
    border-radius: 12px;
    background-color: rgba(99, 102, 241, 0.15);
    color: var(--accent-primary);
}

.compaction-toggle-hint {
    font-size: 11.5px;
    color: var(--text-muted);
}

.compaction-body {
    display: none;
    padding: 14px 18px;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 13px;
    line-height: 1.6;
    background-color: var(--bg-surface);
}

.compaction-node-card.expanded .compaction-body {
    display: block;
}

/* ==========================================================================
   用户登录与认证模态框 (Auth Modal - 禅意纯色实色设计，告别透明模糊)
   ========================================================================== */
#login-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

#login-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(5, 5, 8, 0.88);
}

.auth-card {
    position: relative;
    z-index: 100000;
    width: 100%;
    max-width: 420px;
    background-color: #17171c; /* 实色不透明背景 */
    border: 1px solid #282834;
    border-radius: var(--radius-lg);
    padding: 38px 32px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    animation: modalScaleUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .auth-card {
    background-color: #ffffff; /* 浅色模式纯白实色 */
    border: 1px solid #d8dbe5;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 26px;
}

.auth-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 14px auto;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.auth-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px 0;
    letter-spacing: -0.3px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-form label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.auth-form input {
    background-color: #202028; /* 实色输入框 */
    border: 1px solid #2f2f3e;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: #f0f0f5;
    font-size: 14px;
    outline: none;
    transition: all 0.15s ease;
}

[data-theme="light"] .auth-form input {
    background-color: #f4f5f8;
    border-color: #d8dbe5;
    color: #121216;
}

.auth-form input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
    background-color: #252530;
}

[data-theme="light"] .auth-form input:focus {
    background-color: #ffffff;
}

.auth-error {
    background-color: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}

.btn-auth-submit {
    margin-top: 6px;
    height: 44px;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    border: none;
}

[data-theme="light"] .btn-auth-submit {
    background: #3f3f46;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .btn-auth-submit:hover {
    background: #27272a;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.btn-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(99, 102, 241, 0.5);
}

.btn-auth-submit:active {
    transform: translateY(0);
}

