
        :root {
            --canvas: #ffffff;
            --surface-1: #f8fafc;
            --text-primary: #0f172a;
            --text-secondary: #475569;
            --text-muted: #94a3b8;
            --surface-2: #f1f5f9;
            --surface-3: #e2e8f0;
            --surface-4: #cbd5e1;
            --primary: #5e6ad2;
            --primary-hover: #828fff;
            --primary-subtle: rgba(94, 106, 210, 0.12);
            --ink: #0f172a;
            --ink-muted: #475569;
            --ink-subtle: #94a3b8;
            --ink-faint: #64748b;
            --hairline: #e2e8f0;
            --hairline-strong: #cbd5e1;
            --success: #27a644;
            --danger: #eb5757;
            --font: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;
            --sidebar-width: 280px;
            --topbar-height: 56px;
        }
        
        * { margin: 0; padding: 0; box-sizing: border-box; }
        
        html, body {
        /* 通用隐藏 */
        .hidden { display: none !important; }
            height: 100%;
            font-family: var(--font);
            background: #ffffff;
            color: var(--ink);
            overflow: hidden;
        }
        
        /* Login Overlay */
        .login-overlay {
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
            overflow: auto;
            padding: 20px;
        }
        .login-overlay.hidden { display: none; }
        
        .login-box {
            background: var(--surface-2);
            border: 1px solid var(--hairline);
            border-radius: 20px;
            padding: 40px 32px 36px;
            width: min(420px, 90vw);
            max-width: 90vw;
            text-align: center;
            box-shadow: 0 24px 64px rgba(0,0,0,0.4);
        }
        
        .login-logo-img {
            height: 56px;
            margin-bottom: 20px;
        }
        
        .login-box h1 {
            font-size: 24px;
            font-weight: 600;
            margin-bottom: 8px;
        }
        
        .login-box p {
            color: var(--ink-subtle);
            margin-bottom: 32px;
            font-size: 14px;
        }
        
        .login-box input {
            width: 100%;
            padding: 12px 16px;
            background: var(--surface-1);
            border: 1px solid var(--hairline);
            border-radius: 8px;
            color: var(--ink);
            font-size: 15px;
            margin-bottom: 16px;
            transition: border-color 0.15s;
        }
        
        .login-box input:focus {
            outline: none;
            border-color: var(--primary);
        }
        
        .login-btn {
            width: 100%;
            padding: 12px;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 15px;
            font-weight: 500;
            cursor: pointer;
            transition: background 0.15s;
        }
        
        .login-btn:hover { background: var(--primary-hover); }
        .login-btn:disabled { opacity: 0.6; cursor: not-allowed; }
        
        .login-error {
            color: var(--danger);
            font-size: 13px;
            margin-top: 16px;
            display: none;
        }
        
        /* App Layout */
        .app-container {
            display: flex;
            height: 100vh;
        }
        
        /* Sidebar */
        .sidebar {
            width: var(--sidebar-width);
            background: var(--surface-1);
            border-right: 1px solid var(--hairline);
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
        }
        
        .sidebar-header {
            padding: 16px 20px;
            border-bottom: 1px solid var(--hairline);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .sidebar-logo {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .sidebar-logo span {
            font-size: 16px;
            font-weight: 600;
        }
        
        .new-chat-btn {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: var(--primary);
            border: none;
            color: white;
            font-size: 18px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s;
        }
        
        .new-chat-btn:hover { background: var(--primary-hover); }
        
        .conversations-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }
        
        .conversation-item {
            padding: 12px 16px;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 4px;
            transition: background 0.15s;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .conversation-item:hover { background: var(--surface-2); }
        .conversation-item.active { background: var(--primary-subtle); }
        
        .conversation-icon {
            font-size: 16px;
            opacity: 0.7;
        }
        
        .conversation-title {
            flex: 1;
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            color: var(--ink-muted);
        }
        
        .conversation-item.active .conversation-title {
            color: var(--ink);
        }
        
        .sidebar-footer {
            padding: 16px;
            border-top: 1px solid var(--hairline);
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .user-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--primary);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 600;
            font-size: 14px;
        }
        
        .user-details { flex: 1; }
        
        .user-name {
            font-size: 14px;
            font-weight: 500;
        }
        
        .user-status {
            font-size: 12px;
            color: var(--success);
        }
        
        .logout-btn {
            padding: 8px;
            background: none;
            border: none;
            color: var(--ink-subtle);
            cursor: pointer;
            border-radius: 6px;
            transition: all 0.15s;
        }
        
        /* Model Selector */
.model-selector { position: relative; margin-right: 8px; }
.model-btn { padding: 6px 12px; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: 8px; color: var(--ink-muted); font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 6px; transition: all 0.15s; }
.model-btn:hover { background: var(--surface-4); border-color: var(--hairline-strong); }
.model-btn .arrow { font-size: 10px; opacity: 0.6; }
.model-dropdown { position: absolute; top: 100%; right: 0; margin-top: 4px; background: var(--surface-2); border: 1px solid var(--hairline-strong); border-radius: 10px; min-width: 200px; padding: 6px; z-index: 100; display: none; box-shadow: 0 8px 24px rgba(0,0,0,0.4); }
.model-dropdown.open { display: block; }
.model-option { padding: 10px 14px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: background 0.15s; color: var(--ink-muted); font-size: 14px; }
.model-option:hover { background: var(--surface-3); }
.model-option.active { background: var(--primary-subtle); color: var(--primary); }
.model-option .model-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.model-option .model-dot.vision { background: var(--success); }
.model-option .model-dot.text { background: var(--primary); }
.model-option .model-label { flex: 1; }
.model-option .model-type { font-size: 11px; color: var(--ink-faint); }

.logout-btn:hover {
            background: var(--surface-2);
            color: var(--danger);
        }
        
        /* Main Chat Area */
        .chat-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #ffffff;
        }
        
        .chat-header {
            height: var(--topbar-height);
            padding: 0 24px;
            border-bottom: 1px solid var(--hairline);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface-1);
        }
        
        .chat-header-title {
            font-size: 15px;
            font-weight: 500;
            color: var(--ink);
        }
        
        .chat-header-actions {
            display: flex;
            gap: 8px;
        }
        
        .header-btn {
            padding: 8px 12px;
            background: var(--surface-2);
            border: 1px solid var(--hairline);
            border-radius: 6px;
            color: var(--ink-muted);
            font-size: 13px;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.15s;
        }
        
        .header-btn:hover {
            background: var(--surface-3);
            color: var(--ink);
        }
        
        .header-btn.active {
            background: var(--primary-subtle);
            border-color: var(--primary);
            color: var(--primary);
        }
        
        /* Messages */
        .messages-container {
            flex: 1;
            overflow-y: auto;
            padding: 24px;
            background-color: #ffffff !important;
        }
        
        .message {
            max-width: 800px;
            margin: 0 auto 24px;
            display: flex;
            gap: 16px;
        }
        
        .message.user {
            flex-direction: row-reverse;
        }
        
        .message-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--surface-3);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 16px;
        }
        
        .message.user .message-avatar {
            background: var(--primary);
        }
        
        .message-content {
            flex: 1;
            min-width: 0;
        }
        
        .message-header {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-bottom: 6px;
        }
        
        .message.user .message-header {
            flex-direction: row-reverse;
        }
        
        .message-sender {
            font-size: 14px;
            font-weight: 500;
        }
        
        .message-time {
            font-size: 12px;
            color: var(--ink-faint);
        }
        
        .message-text {
            background: var(--surface-2);
            padding: 14px 18px;
            border-radius: 12px;
            font-size: 15px;
            line-height: 1.6;
            color: var(--ink);
            white-space: pre-wrap;
            word-break: break-word;
        }
        
        .message.user .message-text {
            background: var(--primary);
            color: white;
        }
        
        .message-text code {
            background: var(--surface-1);
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
        }
        
        .message-text pre {
            background: var(--surface-1);
            padding: 14px;
            border-radius: 8px;
            overflow-x: auto;
            margin: 10px 0;
        }
        
        .message-text pre code {
            background: none;
            padding: 0;
        }
        
        /* Tool Calls */
        .tool-calls {
            margin-top: 12px;
            background: var(--surface-1);
            border: 1px solid var(--hairline);
            border-radius: 10px;
            overflow: hidden;
        }
        
        .tool-call-header {
            padding: 10px 14px;
            background: var(--surface-2);
            font-size: 12px;
            font-weight: 500;
            color: var(--primary);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .tool-call-body {
            padding: 12px 14px;
            font-size: 13px;
        }
        
        .tool-call-item {
            padding: 8px 0;
            border-bottom: 1px solid var(--hairline);
        }
        
        .tool-call-item:last-child { border-bottom: none; }
        
        .tool-name {
            font-weight: 500;
            color: var(--primary-hover);
            margin-bottom: 4px;
        }
        
        .tool-result {
            color: var(--ink-muted);
            font-size: 12px;
            white-space: pre-wrap;
            word-break: break-word;
        }
        
        /* Empty State */
        .empty-state {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            text-align: center;
            padding: 40px;
            background-color: #ffffff !important;
            color: #f7f8f8 !important;
        }
        
        .empty-icon {
            font-size: 64px;
            margin-bottom: 24px;
            opacity: 0.5;
        }
        
        .empty-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 8px;
            color: #f7f8f8 !important;
        }
        
        .empty-desc {
            color: var(--ink-subtle);
            font-size: 14px;
            max-width: 400px;
        }
        
        /* Input Area */
        .input-area {
            padding: 16px 24px 24px;
            background: #ffffff;
        }
        
        .input-container {
            max-width: 800px;
            margin: 0 auto;
            background: var(--surface-2);
            border: 1px solid var(--hairline);
            border-radius: 16px;
            overflow: hidden;
            transition: border-color 0.15s;
        }
        
        .input-container:focus-within {
            border-color: var(--primary);
        }
        
        .input-tools {
            padding: 8px 12px;
            display: flex;
            gap: 8px;
            border-bottom: 1px solid var(--hairline);
        }
        
        .input-tool-btn {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            background: var(--surface-1);
            border: none;
            color: var(--ink-subtle);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            transition: all 0.15s;
        }
        
        .input-tool-btn:hover {
            background: var(--surface-3);
            color: var(--ink);
        }
        
        .input-tool-btn.active {
            background: var(--primary-subtle);
            color: var(--primary);
        }
        
        .input-row {
            display: flex;
            align-items: flex-end;
            padding: 12px;
            gap: 12px;
        }
        
        #message-input {
            flex: 1;
            background: none;
            border: none;
            color: var(--ink);
            font-size: 15px;
            font-family: var(--font);
            resize: none;
            min-height: 24px;
            max-height: 200px;
            line-height: 1.5;
        }
        
        #message-input:focus { outline: none; }
        #message-input::placeholder { color: var(--ink-faint); }
        
        .send-btn {
            width: 40px;
            height: 40px;
            border-radius: 10px;
            background: var(--primary);
            border: none;
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 18px;
            transition: all 0.15s;
            flex-shrink: 0;
        }
        
        .send-btn:hover { background: var(--primary-hover); }
        .send-btn:disabled {
            background: var(--surface-3);
            color: var(--ink-faint);
            cursor: not-allowed;
        }
        
        /* Image Preview */
        .image-preview {
            display: none;
            padding: 8px 12px;
            gap: 8px;
            flex-wrap: wrap;
        }
        
        .image-preview.has-images { display: flex; }
        
        .preview-item {
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 8px;
            overflow: hidden;
        }
        
        .preview-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .preview-remove {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: rgba(0,0,0,0.7);
            border: none;
            color: white;
            cursor: pointer;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        /* Loading */
        .typing-indicator {
            display: flex;
            gap: 4px;
            padding: 8px 0;
        }
        
        .typing-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--ink-faint);
            animation: typing 1.4s infinite;
        }
        
        .typing-dot:nth-child(2) { animation-delay: 0.2s; }
        .typing-dot:nth-child(3) { animation-delay: 0.4s; }
        
        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
            30% { transform: translateY(-4px); opacity: 1; }
        }
        
        /* Mobile */
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -100%;
                width: 100%;
                height: 100vh;
                z-index: 200;
                transition: left 0.3s;
            }
            
            .sidebar.open { left: 0; }
            
            .mobile-menu-btn {
                display: flex !important;
            }
            
            .messages-container {
                padding: 16px;
            }
            
            .input-area {
                padding: 12px 16px 20px;
            }
        }
        
        .mobile-menu-btn {
            display: none;
            width: 40px;
            height: 40px;
            border-radius: 8px;
            background: var(--surface-2);
            border: 1px solid var(--hairline);
            color: var(--ink);
            cursor: pointer;
            align-items: center;
            justify-content: center;
            font-size: 20px;
        }
        
        /* Overlay for mobile sidebar */
        .sidebar-overlay {
            display: none;
            position: fixed;
            top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.5);
            z-index: 150;
        }
        
        .sidebar-overlay.visible { display: block; }
    
/* === Sidebar Collapse === */
.sidebar {
    transition: width 0.25s ease, border-color 0.25s ease;
}
.sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
}
        .main-content {
            display: flex;
            flex-direction: column;
            flex: 1;
            min-height: 0;
            overflow: hidden;
            background-color: #ffffff !important;
        }

.app-container.sidebar-collapsed .main-content {
    margin-left: 0;
}
.sidebar-collapse-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    color: var(--ink-subtle);
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}
.sidebar-collapse-btn:hover {
    background: var(--surface-3);
    color: var(--ink);
}

/* === User Center Panel === */
.uc-panel {
    position: fixed;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--hairline);
    z-index: 300;
    transition: right 0.25s;
    display: flex;
    flex-direction: column;
}
.uc-panel.open { right: 0; }
.uc-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 299;
}
.uc-overlay.open { display: block; }
.uc-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--hairline);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}
.uc-close {
    background: none;
    border: none;
    color: var(--ink-subtle);
    cursor: pointer;
    font-size: 18px;
}
.uc-body { flex: 1; overflow-y: auto; padding: 20px; }
.uc-avatar-section { text-align: center; padding: 20px 0; }
.uc-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}
.uc-username { font-size: 16px; font-weight: 600; }
.uc-email { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
.uc-section { margin-top: 20px; }
.uc-section-title {
    font-size: 12px;
    color: var(--ink-faint);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}
.uc-item {
    padding: 12px 16px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
}
.uc-item:hover { background: var(--surface-2); }
.uc-value { color: var(--ink-faint); font-size: 13px; }
.uc-logout-btn {
    width: 100%;
    padding: 12px;
    margin-top: 30px;
    background: rgba(235,87,87,0.1);
    border: 1px solid rgba(235,87,87,0.2);
    border-radius: 8px;
    color: var(--danger);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
}
.uc-logout-btn:hover { background: rgba(235,87,87,0.2); }

/* === Meowvis Mascot Animation === */
.meowvis-mascot {
    animation: meowvisIdle 4s ease-in-out infinite;
}
.meowvis-mascot img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    filter: drop-shadow(0 0 20px rgba(94,106,210,0.4));
}
@keyframes meowvisIdle {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.02); }
}

/* === Meowvis Float Widget === */
.meowvis-float {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 50;
    transition: all 0.3s;
    animation: floatBounce 3s ease-in-out infinite;
    opacity: 0.6;
}
.meowvis-float:hover { opacity: 1; transform: scale(1.2); }
.meowvis-float.peek { opacity: 1; animation: floatPeek 0.5s ease; }
.meowvis-float img { width: 100%; height: 100%; border-radius: 50%; }
@keyframes floatBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
@keyframes floatPeek {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1); }
}

/* === System Status Bar === */
.sys-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    margin-bottom: 8px;
    font-size: 11px;
}
.sys-status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #666;
    transition: background 0.3s;
}
.status-dot.online { background: #34c759; box-shadow: 0 0 6px rgba(52,199,89,0.5); }
.status-dot.offline { background: #ff3b30; box-shadow: 0 0 6px rgba(255,59,48,0.5); }
.status-dot.checking { background: #ffcc00; animation: statusPulse 1s infinite; }
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
#api-status-text { color: rgba(255,255,255,0.4); font-size: 11px; }
