 
        /* === Variables CSS para temas === */
        :root {
            --bg-main: #0f172a;
            --bg-panel: #1e293b;
            --bg-input: #334155;
            --border: #475569;
            --text-main: #f1f5f9;
            --text-muted: #94a3b8;
            --message-bot-bg: #1e293b;
            --message-bot-border: #334155;
            --avatar-bg: #334155;
            --avatar-border: #475569;
            --code-bg: #0a0a0a;
            --code-border: #334155;
            --scroll-track: #1e293b;
            --scroll-thumb: #475569;
            --scroll-thumb-hover: #64748b;
        }
        
        html.light {
            --bg-main: #f8fafc;
            --bg-panel: #ffffff;
            --bg-input: #f1f5f9;
            --border: #e2e8f0;
            --text-main: #0f172a;
            --text-muted: #64748b;
            --message-bot-bg: #f1f5f9;
            --message-bot-border: #e2e8f0;
            --avatar-bg: #e2e8f0;
            --avatar-border: #cbd5e1;
            --code-bg: #1e293b;
            --code-border: #475569;
            --scroll-track: #f1f5f9;
            --scroll-thumb: #cbd5e1;
            --scroll-thumb-hover: #94a3b8;
        }

        /* === Base Styles === */
        body {
            background: var(--bg-main);
            color: var(--text-main);
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            margin: 0;
            padding: 0;
            overflow-x: hidden;
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        
        /* Scrollbar */
        ::-webkit-scrollbar { width: 6px; }
        ::-webkit-scrollbar-track { background: var(--scroll-track); }
        ::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 3px; transition: background 0.2s; }
        ::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }
        
        /* Mensajes */
        .message {
            display: flex;
            margin-bottom: 1rem;
            animation: fade-in 0.3s ease-out;
            gap: 0.75rem;
        }
        .message.user { justify-content: flex-end; }
        
        .message-content {
            max-width: 85%;
            padding: 0.875rem 1.125rem;
            border-radius: 1rem;
            font-size: 0.95rem;
            line-height: 1.5;
            word-break: break-word;
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
        }
        
        .message.user .message-content {
            background: linear-gradient(135deg, #3b82f6, #60a5fa);
            color: white;
            border-bottom-right-radius: 0.25rem;
        }
        
        .message.bot .message-content {
            background: var(--message-bot-bg);
            color: var(--text-main);
            border: 1px solid var(--message-bot-border);
            border-bottom-left-radius: 0.25rem;
        }
        
        /* Avatar */
        .avatar {
            width: 2.25rem;
            height: 2.25rem;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            flex-shrink: 0;
            background: var(--avatar-bg);
            border: 2px solid var(--avatar-border);
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }
        
        /* Código */
        .code-block {
            background: var(--code-bg);
            border: 1px solid var(--code-border);
            border-radius: 0.5rem;
            margin: 0.75rem 0;
            overflow: hidden;
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }
        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--bg-panel);
            padding: 0.5rem 1rem;
            border-bottom: 1px solid var(--border);
            font-size: 0.8rem;
            transition: background-color 0.3s ease, border-color 0.3s ease;
        }
        .code-language { color: #f472b6; font-weight: 500; }
        .copy-code-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            transition: all 0.2s;
        }
        .copy-code-btn:hover {
            background: var(--bg-input);
            color: var(--text-main);
        }
        .code-block pre {
            margin: 0;
            padding: 1rem;
            overflow-x: auto;
            font-family: 'Fira Code', 'Courier New', monospace;
            font-size: 0.875rem;
            line-height: 1.4;
            color: #a5f3fc;
        }
        html.light .code-block pre { color: #0ea5e9; }
        
        .inline-code {
            background: rgba(139, 92, 246, 0.2);
            color: #c4b5fd;
            padding: 0.125rem 0.375rem;
            border-radius: 0.25rem;
            font-family: monospace;
            font-size: 0.9em;
            transition: background-color 0.3s ease, color 0.3s ease;
        }
        html.light .inline-code {
            background: rgba(14, 165, 233, 0.15);
            color: #0284c7;
        }
        
        /* Inputs y botones */
        #user-input {
            background: var(--bg-input);
            border: 1px solid var(--border);
            color: var(--text-main);
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
        }
        #user-input::placeholder { color: var(--text-muted); }
        #user-input:focus {
            outline: none;
            border-color: #0ea5e9;
            box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
        }
        
        .model-btn {
            padding: 0.625rem 1rem;
            background: var(--bg-input);
            border: 1px solid var(--border);
            color: var(--text-main);
            border-radius: 0.5rem;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9rem;
            text-align: left;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .model-btn:hover:not(:disabled) {
            background: #0ea5e9;
            border-color: #0ea5e9;
            color: white;
            transform: translateY(-1px);
        }
        .model-btn.active {
            background: #0ea5e9;
            border-color: #0ea5e9;
            color: white;
        }
        .model-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }
        
        /* Barra de estado */
        .status-bar {
            background: var(--bg-panel);
            border: 1px solid var(--border);
            padding: 0.75rem 1rem;
            border-radius: 0.75rem;
            margin-top: 1rem;
            font-size: 0.875rem;
            color: var(--text-muted);
            transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
        }
        
        /* Loading bar */
        .loading-bar {
            height: 3px;
            background: linear-gradient(90deg, #0ea5e9, #8b5cf6, #10b981);
            border-radius: 2px;
            position: relative;
            overflow: hidden;
        }
        .loading-bar::after {
            content: '';
            position: absolute;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
            animation: loading 1.5s infinite;
        }
        @keyframes loading {
            0% { transform: translateX(-100%); }
            100% { transform: translateX(100%); }
        }
        
        /* Toggle Theme Button */
        .theme-toggle {
            background: var(--bg-input);
            border: 1px solid var(--border);
            color: var(--text-main);
            width: 2.5rem;
            height: 2.5rem;
            border-radius: 0.75rem;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s;
        }
        .theme-toggle:hover {
            background: var(--border);
            transform: scale(1.05);
        }
        
        /* Responsive */
        @media (max-width: 768px) {
            .message-content { max-width: 90%; }
            .chat-container { height: 55vh !important; }
        }
        
        /* Mensajes de error */
        .error-message {
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.4);
            color: #fca5a5;
            padding: 1rem;
            border-radius: 0.75rem;
            margin: 1rem 0;
            animation: fade-in 0.3s ease-out;
        }
        html.light .error-message {
            background: rgba(239, 68, 68, 0.1);
            color: #dc2626;
        }
        .retry-btn {
            background: #ef4444;
            color: white;
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            cursor: pointer;
            margin-top: 0.5rem;
            transition: all 0.2s;
            font-size: 0.875rem;
        }
        .retry-btn:hover {
            background: #dc2626;
            transform: translateY(-1px);
        }
        
        /* Badge de tema actual */
        .theme-badge {
            font-size: 0.7rem;
            padding: 0.125rem 0.5rem;
            border-radius: 999px;
            background: var(--bg-input);
            color: var(--text-muted);
            border: 1px solid var(--border);
        }
    