:root {
            --navy: #1a1f3a;
            --navy-light: #252b4a;
            --navy-dark: #12162b;
            --gold: #c9a962;
            --gold-light: #d4bc7d;
            --gold-dim: rgba(201, 169, 98, 0.15);
            --cream: #f8f6f1;
            --cream-dark: #e8e4db;
            --text-light: #9ca3af;
            --text-muted: #6b7280;
            --success: #10b981;
            --error: #ef4444;
            --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }

        html, body {
            height: 100%;
            overflow: hidden;
        }

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
            color: var(--cream);
            display: flex;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
        }

        /* Header */
        .header {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--gold-dim);
            display: flex;
            align-items: center;
            justify-content: space-between;
            backdrop-filter: blur(10px);
            background: rgba(26, 31, 58, 0.95);
            flex-shrink: 0;
            z-index: 100;
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
        }

        .logo-icon {
            width: 40px;
            height: 40px;
            border: 2px solid var(--gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--gold);
        }

        .logo-text h1 {
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.1rem;
            font-weight: 500;
            color: var(--cream);
            letter-spacing: 0.01em;
        }

        .logo-text span {
            font-size: 0.65rem;
            color: var(--gold);
            text-transform: uppercase;
            letter-spacing: 0.15em;
            font-weight: 500;
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .status {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.7rem;
            color: var(--text-light);
        }

        .status-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--success);
            animation: pulse 2s infinite;
        }

        .status-dot.offline {
            background: var(--error);
            animation: none;
        }

        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .menu-btn {
            background: none;
            border: none;
            color: var(--cream);
            padding: 0.5rem;
            cursor: pointer;
            display: none;
        }

        /* Main Chat Area */
        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            max-width: 900px;
            width: 100%;
            margin: 0 auto;
            padding: 0 1rem;
            overflow: hidden;
        }

        .messages {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 1rem 0;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: stretch;
            gap: 1rem;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
        }

        .message {
            display: flex;
            gap: 0.75rem;
            animation: fadeIn 0.3s ease;
            max-width: 100%;
            align-items: flex-start;
        }

        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* Claude Desktop style: all messages left-aligned, user and assistant stacked vertically */
        .message.user {
            /* No row-reverse - keep left aligned like Claude Desktop */
        }

        .message-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            font-size: 0.85rem;
            font-weight: 500;
        }

        .message.assistant .message-avatar {
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            color: var(--navy-dark);
            font-family: 'Cormorant Garamond', serif;
            font-size: 1rem;
            font-weight: 600;
        }

        .message.user .message-avatar {
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            color: var(--cream);
        }

        .message-content {
            max-width: calc(100% - 50px);
            padding: 0.875rem 1rem;
            border-radius: 1rem;
            line-height: 1.5;
            font-size: 0.9rem;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        .message.assistant .message-content {
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            border-radius: 1rem;
        }

        .message.user .message-content {
            background: transparent;
            color: var(--cream);
            border: 1px solid var(--gold-dim);
            border-radius: 1rem;
        }

        .message-content p {
            margin-bottom: 0.5rem;
        }

        .message-content p:last-child {
            margin-bottom: 0;
        }

        .message-content code {
            background: rgba(0,0,0,0.2);
            padding: 0.1rem 0.35rem;
            border-radius: 0.25rem;
            font-family: 'SF Mono', Monaco, monospace;
            font-size: 0.8em;
        }

        .message-content pre {
            background: var(--navy-dark);
            padding: 0.75rem;
            border-radius: 0.5rem;
            overflow-x: auto;
            margin: 0.5rem 0;
            font-size: 0.8rem;
        }

        .message-content pre code {
            background: none;
            padding: 0;
        }

        /* Image in message */
        .message-image {
            max-width: 100%;
            max-height: 300px;
            border-radius: 0.5rem;
            margin-bottom: 0.5rem;
            object-fit: contain;
        }

        /* Tool Usage Indicator */
        .tool-indicator {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.7rem;
            color: var(--gold);
            margin-bottom: 0.4rem;
            opacity: 0.9;
            flex-wrap: wrap;
        }

        .tool-indicator svg {
            width: 12px;
            height: 12px;
            flex-shrink: 0;
        }

        .tool-chip {
            background: var(--gold-dim);
            padding: 0.15rem 0.5rem;
            border-radius: 1rem;
            font-size: 0.65rem;
        }

        /* Message Actions (Copy, Download) */
        .message-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
            padding-top: 0.5rem;
            border-top: 1px solid var(--gold-dim);
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .message:hover .message-actions,
        .message-actions.visible {
            opacity: 1;
        }

        .message-action-btn {
            display: flex;
            align-items: center;
            gap: 0.35rem;
            background: transparent;
            border: 1px solid var(--gold-dim);
            color: var(--text-light);
            padding: 0.35rem 0.65rem;
            border-radius: 0.5rem;
            font-size: 0.7rem;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .message-action-btn:hover {
            background: var(--gold-dim);
            color: var(--gold);
            border-color: var(--gold);
        }

        .message-action-btn.copied,
        .message-action-btn.saved {
            background: var(--success);
            border-color: var(--success);
            color: white;
        }

        .message-action-btn svg {
            width: 14px;
            height: 14px;
        }

        .message-action-btn svg.spin {
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .message-action-btn.memory-btn {
            border-color: var(--gold);
            color: var(--gold);
        }

        .message-action-btn.memory-btn:hover {
            background: var(--gold);
            color: var(--dark);
        }

        /* Links in messages */
        .message-content a {
            color: var(--gold);
            text-decoration: underline;
            text-underline-offset: 2px;
            transition: color 0.2s ease;
        }

        .message-content a:hover {
            color: var(--gold-light);
        }

        /* File download links */
        .file-download {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            background: var(--gold-dim);
            padding: 0.4rem 0.75rem;
            border-radius: 0.5rem;
            color: var(--gold);
            text-decoration: none;
            font-size: 0.85rem;
            margin: 0.25rem 0;
            transition: all 0.2s ease;
        }

        .file-download:hover {
            background: var(--gold);
            color: var(--navy-dark);
        }

        .file-download svg {
            width: 16px;
            height: 16px;
        }

        /* Typing Indicator */
        .typing-indicator {
            display: flex;
            gap: 0.25rem;
            padding: 0.875rem 1rem;
        }

        .typing-indicator span {
            width: 6px;
            height: 6px;
            background: var(--gold);
            border-radius: 50%;
            animation: typing 1.4s infinite;
        }

        .typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
        .typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

        @keyframes typing {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
            30% { transform: translateY(-4px); opacity: 1; }
        }

        /* Input Area */
        .input-container {
            padding: 0.75rem 0;
            padding-bottom: calc(0.75rem + var(--safe-area-inset-bottom));
            border-top: 1px solid var(--gold-dim);
            background: rgba(26, 31, 58, 0.95);
            flex-shrink: 0;
        }

        .input-wrapper {
            display: flex;
            gap: 0.5rem;
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            border-radius: 1.5rem;
            padding: 0.35rem 0.5rem;
            align-items: flex-end;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;
        }

        .input-wrapper:focus-within {
            border-color: var(--gold);
            box-shadow: 0 0 0 2px var(--gold-dim);
        }

        .input-actions {
            display: flex;
            gap: 0.25rem;
            flex-shrink: 0;
        }

        .action-btn {
            background: transparent;
            border: none;
            color: var(--text-light);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s ease;
        }

        .action-btn:hover {
            background: var(--gold-dim);
            color: var(--gold);
        }

        .action-btn svg {
            width: 20px;
            height: 20px;
        }

        .input-wrapper textarea {
            flex: 1;
            background: transparent;
            border: none;
            color: var(--cream);
            font-family: inherit;
            font-size: 0.9rem;
            padding: 0.5rem 0.25rem;
            resize: none;
            min-height: 24px;
            max-height: 150px;
            line-height: 1.4;
        }

        .input-wrapper textarea:focus {
            outline: none;
        }

        .input-wrapper textarea::placeholder {
            color: var(--text-muted);
        }

        .send-button {
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s ease, opacity 0.2s ease;
            flex-shrink: 0;
        }

        .send-button:hover {
            transform: scale(1.05);
        }

        .send-button:active {
            transform: scale(0.95);
        }

        .send-button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .send-button svg {
            width: 18px;
            height: 18px;
            color: var(--navy-dark);
        }

        /* Image Preview */
        .image-preview-container {
            display: none;
            padding: 0.5rem;
            background: var(--navy-dark);
            border-radius: 0.5rem;
            margin-bottom: 0.5rem;
            position: relative;
        }

        .image-preview-container.active {
            display: block;
        }

        .image-preview {
            max-height: 120px;
            max-width: 100%;
            border-radius: 0.25rem;
            object-fit: contain;
        }

        .remove-image {
            position: absolute;
            top: 0.25rem;
            right: 0.25rem;
            background: var(--error);
            color: white;
            border: none;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            line-height: 1;
        }

        /* Welcome Screen */
        .welcome {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 1.5rem;
        }

        .welcome-icon {
            width: 70px;
            height: 70px;
            border: 2px solid var(--gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Cormorant Garamond', serif;
            font-size: 2rem;
            font-weight: 600;
            color: var(--gold);
            margin-bottom: 1.25rem;
        }

        .welcome h2 {
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.75rem;
            font-weight: 500;
            margin-bottom: 0.5rem;
            color: var(--cream);
        }

        .welcome p {
            color: var(--text-light);
            font-size: 0.9rem;
            max-width: 350px;
            line-height: 1.5;
        }

        .welcome-suggestions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            justify-content: center;
            margin-top: 1.5rem;
            max-width: 400px;
        }

        .suggestion-chip {
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            color: var(--cream);
            padding: 0.5rem 1rem;
            border-radius: 1.5rem;
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .suggestion-chip:hover {
            border-color: var(--gold);
            background: var(--gold-dim);
        }

        /* Scrollbar */
        .messages::-webkit-scrollbar {
            width: 4px;
        }

        .messages::-webkit-scrollbar-track {
            background: transparent;
        }

        .messages::-webkit-scrollbar-thumb {
            background: var(--gold-dim);
            border-radius: 2px;
        }

        .messages::-webkit-scrollbar-thumb:hover {
            background: var(--gold);
        }

        /* Hidden file inputs */
        #fileInput, #fileInputDocument, #fileInputText, #fileInputImage, #fileInputCamera, #fileInputVideo {
            display: none;
        }

        /* File type dropdown menu */
        .file-type-dropdown {
            position: relative;
        }

        .file-type-menu {
            display: none;
            position: absolute;
            bottom: 100%;
            left: 0;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 0.5rem;
            margin-bottom: 0.5rem;
            min-width: 200px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
            z-index: 100;
        }

        .file-type-menu.active {
            display: block;
        }

        .file-type-option {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            width: 100%;
            padding: 0.75rem 1rem;
            background: transparent;
            border: none;
            border-radius: 8px;
            color: var(--text);
            cursor: pointer;
            text-align: left;
            transition: background 0.2s;
        }

        .file-type-option:hover {
            background: rgba(212, 175, 55, 0.1);
        }

        .file-type-icon {
            font-size: 1.25rem;
        }

        .file-type-hint {
            margin-left: auto;
            font-size: 0.7rem;
            color: var(--text-muted);
            opacity: 0.7;
        }

        /* Multi-file preview container */
        .files-preview-container {
            display: none;
            flex-wrap: wrap;
            gap: 0.5rem;
            padding: 0.75rem;
            background: var(--bg-secondary);
            border-radius: 12px;
            margin-bottom: 0.5rem;
        }

        .files-preview-container.active {
            display: flex;
        }

        .file-preview-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.75rem;
            background: var(--bg-primary);
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 0.85rem;
            color: var(--text);
        }

        .file-preview-item .file-icon {
            font-size: 1.25rem;
        }

        .file-preview-item .file-name {
            max-width: 120px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .file-preview-item .remove-file {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            padding: 0 0.25rem;
            font-size: 1rem;
            line-height: 1;
        }

        .file-preview-item .remove-file:hover {
            color: #ff6b6b;
        }

        .file-preview-item.uploading {
            opacity: 0.7;
        }

        .file-preview-item.uploading .file-name::after {
            content: '...';
            animation: dots 1.5s infinite;
        }

        @keyframes dots {
            0%, 20% { content: '.'; }
            40% { content: '..'; }
            60%, 100% { content: '...'; }
        }

        /* Responsive */
        @media (max-width: 640px) {
            .header {
                padding: 0.5rem 0.75rem;
            }

            .logo-icon {
                width: 36px;
                height: 36px;
                font-size: 1.1rem;
            }

            .logo-text h1 {
                font-size: 0.95rem;
            }

            .logo-text span {
                font-size: 0.55rem;
            }

            .status span {
                display: none;
            }

            .chat-container {
                padding: 0 0.75rem;
            }

            .message-content {
                max-width: calc(100% - 44px);
                padding: 0.75rem;
                font-size: 0.85rem;
            }

            .message-avatar {
                width: 32px;
                height: 32px;
                font-size: 0.8rem;
            }

            .welcome-icon {
                width: 60px;
                height: 60px;
                font-size: 1.75rem;
            }

            .welcome h2 {
                font-size: 1.5rem;
            }

            .welcome p {
                font-size: 0.85rem;
            }

            .suggestion-chip {
                font-size: 0.75rem;
                padding: 0.4rem 0.8rem;
            }
        }

        /* Streaming cursor */
        .streaming::after {
            content: '|';
            animation: blink 1s infinite;
            color: var(--gold);
        }

        @keyframes blink {
            0%, 50% { opacity: 1; }
            51%, 100% { opacity: 0; }
        }

        /* Tool execution indicator */
        .tool-executing {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.75rem;
            background: var(--gold-dim);
            border-radius: 0.5rem;
            font-size: 0.75rem;
            color: var(--gold);
            margin: 0.25rem 0;
        }

        .tool-executing .spinner {
            width: 12px;
            height: 12px;
            border: 2px solid var(--gold-dim);
            border-top-color: var(--gold);
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Voice Recording */
        .action-btn.recording {
            background: var(--error);
            color: white;
            animation: pulse-recording 1s infinite;
        }

        @keyframes pulse-recording {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.1); }
        }

        .voice-indicator {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem 1rem;
            background: var(--gold-dim);
            border-radius: 0.5rem;
            font-size: 0.8rem;
            color: var(--gold);
            margin: 0.5rem 0;
        }

        .voice-indicator .wave {
            display: flex;
            gap: 2px;
            align-items: center;
        }

        .voice-indicator .wave span {
            width: 3px;
            height: 12px;
            background: var(--gold);
            border-radius: 1px;
            animation: wave 0.5s ease-in-out infinite;
        }

        .voice-indicator .wave span:nth-child(2) { animation-delay: 0.1s; }
        .voice-indicator .wave span:nth-child(3) { animation-delay: 0.2s; }
        .voice-indicator .wave span:nth-child(4) { animation-delay: 0.3s; }

        @keyframes wave {
            0%, 100% { height: 4px; }
            50% { height: 16px; }
        }

        /* Audio Player */
        .audio-player {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.5rem;
            padding: 0.5rem;
            background: var(--navy-dark);
            border-radius: 0.5rem;
        }

        .audio-player button {
            background: var(--gold);
            border: none;
            border-radius: 50%;
            width: 32px;
            height: 32px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--navy-dark);
        }

        .audio-player button svg {
            width: 16px;
            height: 16px;
        }

        .audio-player span {
            font-size: 0.75rem;
            color: var(--text-light);
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 1000;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(4px);
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: var(--navy);
            border: 1px solid var(--gold-dim);
            border-radius: 1rem;
            width: 90%;
            max-width: 400px;
            max-height: 80vh;
            overflow: auto;
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--gold-dim);
        }

        .modal-header h3 {
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.25rem;
            color: var(--cream);
            margin: 0;
        }

        .modal-close {
            background: none;
            border: none;
            color: var(--text-light);
            font-size: 1.5rem;
            cursor: pointer;
            padding: 0;
            line-height: 1;
        }

        .modal-body {
            padding: 1.25rem;
        }

        .setting-section {
            margin-bottom: 1.5rem;
        }

        .setting-section:last-child {
            margin-bottom: 0;
        }

        .setting-section h4 {
            font-size: 0.9rem;
            color: var(--cream);
            margin-bottom: 0.5rem;
        }

        .setting-desc {
            font-size: 0.8rem;
            color: var(--text-light);
            margin-bottom: 1rem;
        }

        .passkey-status {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem;
            background: var(--navy-dark);
            border-radius: 0.5rem;
            margin-bottom: 1rem;
        }

        .passkey-icon {
            font-size: 1.25rem;
        }

        .passkey-status.configured .passkey-icon::before {
            content: '';
        }

        .passkey-status.not-configured .passkey-icon::before {
            content: '';
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            color: var(--navy-dark);
            border: none;
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            width: 100%;
            transition: transform 0.2s, opacity 0.2s;
        }

        .btn-primary:hover {
            transform: scale(1.02);
        }

        .btn-primary:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
        }

        .btn-secondary {
            background: transparent;
            color: var(--text-light);
            border: 1px solid var(--gold-dim);
            padding: 0.75rem 1.5rem;
            border-radius: 0.5rem;
            font-size: 0.9rem;
            cursor: pointer;
            width: 100%;
            margin-top: 0.5rem;
        }

        .btn-secondary:hover {
            border-color: var(--gold);
            color: var(--cream);
        }

        /* LLM Selection Styles */
        .llm-selector {
            margin-bottom: 1rem;
        }

        .llm-selector label {
            display: block;
            font-size: 0.8rem;
            color: var(--text-light);
            margin-bottom: 0.5rem;
        }

        .llm-selector select {
            width: 100%;
            padding: 0.75rem 1rem;
            background: var(--navy-dark);
            border: 1px solid var(--gold-dim);
            border-radius: 0.5rem;
            color: var(--cream);
            font-size: 0.9rem;
            font-family: inherit;
            cursor: pointer;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 1rem center;
        }

        .llm-selector select:focus {
            outline: none;
            border-color: var(--gold);
        }

        .llm-selector select option {
            background: var(--navy-dark);
            color: var(--cream);
            padding: 0.5rem;
        }

        .llm-current {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.75rem;
            background: var(--navy-dark);
            border-radius: 0.5rem;
            margin-bottom: 1rem;
        }

        .llm-current-icon {
            font-size: 1.25rem;
        }

        .llm-current-info {
            flex: 1;
        }

        .llm-current-provider {
            font-size: 0.9rem;
            color: var(--cream);
            font-weight: 500;
        }

        .llm-current-model {
            font-size: 0.75rem;
            color: var(--text-light);
        }

        .llm-status {
            font-size: 0.75rem;
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
            background: var(--success);
            color: white;
        }

        .llm-status.loading {
            background: var(--gold);
            color: var(--navy-dark);
        }

        .setting-divider {
            height: 1px;
            background: var(--gold-dim);
            margin: 1.5rem 0;
        }

        /* Video Call UI */
        .video-call-container {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: var(--navy-dark);
            z-index: 2000;
            flex-direction: column;
        }

        .video-call-container.active {
            display: flex;
        }

        .video-call-header {
            padding: 1rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: rgba(0, 0, 0, 0.3);
        }

        .video-call-title {
            font-family: 'Cormorant Garamond', serif;
            font-size: 1.25rem;
            color: var(--cream);
        }

        .video-call-status {
            font-size: 0.8rem;
            color: var(--gold);
        }

        .video-grid {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            padding: 1rem;
            align-items: center;
            justify-content: center;
        }

        .video-tile {
            position: relative;
            background: var(--navy);
            border-radius: 1rem;
            overflow: hidden;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .video-tile.remote {
            width: 100%;
            max-width: 600px;
            aspect-ratio: 16/9;
        }

        .video-tile.local {
            position: absolute;
            bottom: 6rem;
            right: 1rem;
            width: 120px;
            aspect-ratio: 4/3;
            border: 2px solid var(--gold-dim);
        }

        .video-tile video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .video-tile .avatar-placeholder {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Cormorant Garamond', serif;
            font-size: 2rem;
            font-weight: 600;
            color: var(--navy-dark);
        }

        /* Victoria Animated Avatar */
        .victoria-avatar-container {
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 1rem;
        }

        .victoria-avatar {
            width: 180px;
            height: 180px;
            border-radius: 50%;
            overflow: hidden;
            position: relative;
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 0 30px rgba(201, 169, 98, 0.3);
            transition: all 0.3s ease;
        }

        .victoria-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
        }

        .victoria-avatar .avatar-fallback {
            font-family: 'Cormorant Garamond', serif;
            font-size: 4rem;
            font-weight: 600;
            color: var(--navy-dark);
        }

        /* Glow ring that pulses when speaking */
        .victoria-avatar::before {
            content: '';
            position: absolute;
            inset: -4px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            z-index: -1;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .victoria-avatar.speaking::before {
            opacity: 1;
            animation: avatarGlow 1.5s ease-in-out infinite;
        }

        @keyframes avatarGlow {
            0%, 100% { 
                box-shadow: 0 0 20px var(--gold), 0 0 40px rgba(201, 169, 98, 0.5);
                transform: scale(1);
            }
            50% { 
                box-shadow: 0 0 40px var(--gold), 0 0 80px rgba(201, 169, 98, 0.7);
                transform: scale(1.02);
            }
        }

        .victoria-avatar.speaking {
            animation: avatarPulse 0.8s ease-in-out infinite;
            box-shadow: 0 0 40px rgba(201, 169, 98, 0.6);
        }

        @keyframes avatarPulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.03); }
        }

        /* Audio waveform indicator */
        .audio-waveform {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
            height: 24px;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .audio-waveform.active {
            opacity: 1;
        }

        .audio-waveform .bar {
            width: 4px;
            height: 8px;
            background: var(--gold);
            border-radius: 2px;
            animation: none;
        }

        .audio-waveform.active .bar {
            animation: waveform 0.6s ease-in-out infinite;
        }

        .audio-waveform .bar:nth-child(1) { animation-delay: 0s; }
        .audio-waveform .bar:nth-child(2) { animation-delay: 0.1s; }
        .audio-waveform .bar:nth-child(3) { animation-delay: 0.2s; }
        .audio-waveform .bar:nth-child(4) { animation-delay: 0.3s; }
        .audio-waveform .bar:nth-child(5) { animation-delay: 0.4s; }

        @keyframes waveform {
            0%, 100% { height: 8px; }
            50% { height: 24px; }
        }

        /* Status text under avatar */
        .avatar-status {
            font-size: 0.85rem;
            color: var(--gold);
            text-align: center;
            min-height: 1.2em;
        }

        .video-tile .name-label {
            position: absolute;
            bottom: 0.5rem;
            left: 0.5rem;
            font-size: 0.75rem;
            color: var(--cream);
            background: rgba(0, 0, 0, 0.5);
            padding: 0.25rem 0.5rem;
            border-radius: 0.25rem;
        }

        .video-call-controls {
            padding: 1rem;
            display: flex;
            justify-content: center;
            gap: 1rem;
            background: rgba(0, 0, 0, 0.3);
            padding-bottom: calc(1rem + var(--safe-area-inset-bottom));
        }

        .call-btn {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.2s, opacity 0.2s;
        }

        .call-btn:hover {
            transform: scale(1.1);
        }

        .call-btn svg {
            width: 24px;
            height: 24px;
        }

        .call-btn.mute {
            background: var(--navy-light);
            color: var(--cream);
        }

        .call-btn.mute.active {
            background: var(--error);
        }

        .call-btn.video-toggle {
            background: var(--navy-light);
            color: var(--cream);
        }

        .call-btn.video-toggle.active {
            background: var(--error);
        }

        .call-btn.end-call {
            background: var(--error);
            color: white;
        }

        .call-btn.upload {
            background: var(--gold-dim);
            color: var(--gold);
        }

        .call-btn.upload:hover {
            background: var(--gold);
            color: var(--navy-dark);
        }

        /* Upload menu for video call */
        .call-upload-menu {
            display: none;
            position: absolute;
            bottom: 90px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--navy-dark);
            border: 1px solid var(--gold-dim);
            border-radius: 12px;
            padding: 0.5rem;
            gap: 0.5rem;
            flex-direction: row;
            z-index: 1001;
        }

        .call-upload-menu.active {
            display: flex;
        }

        .call-upload-menu button {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.25rem;
            padding: 0.75rem 1rem;
            background: transparent;
            border: 1px solid var(--gold-dim);
            border-radius: 8px;
            color: var(--cream);
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .call-upload-menu button:hover {
            background: var(--gold-dim);
            border-color: var(--gold);
        }

        .call-upload-menu button svg {
            width: 24px;
            height: 24px;
        }

        /* Upload preview for video call */
        .call-upload-preview {
            display: none;
            position: absolute;
            bottom: 160px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--navy-dark);
            border: 1px solid var(--gold-dim);
            border-radius: 12px;
            padding: 0.75rem;
            max-width: 90%;
            z-index: 1001;
        }

        .call-upload-preview.active {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            align-items: center;
        }

        .call-upload-preview .preview-item {
            position: relative;
            width: 60px;
            height: 60px;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid var(--gold-dim);
        }

        .call-upload-preview .preview-item img,
        .call-upload-preview .preview-item video {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .call-upload-preview .preview-item .file-icon {
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--navy);
            color: var(--gold);
        }

        .call-upload-preview .preview-item .remove-btn {
            position: absolute;
            top: 2px;
            right: 2px;
            width: 18px;
            height: 18px;
            border-radius: 50%;
            background: var(--error);
            color: white;
            border: none;
            cursor: pointer;
            font-size: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .call-upload-preview .send-files-btn {
            padding: 0.5rem 1rem;
            background: var(--gold);
            color: var(--navy-dark);
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.85rem;
        }

        .call-upload-preview .send-files-btn:hover {
            background: var(--gold-light);
        }

        /* Video call button in header */
        .action-btn.video-call {
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            color: var(--navy-dark);
        }

        .action-btn.video-call:hover {
            transform: scale(1.05);
        }

        .action-btn.in-call {
            background: var(--success);
            animation: pulse 2s infinite;
        }

        /* Chat History Sidebar */
        .app-container {
            display: flex;
            flex: 1;
            overflow: hidden;
        }

        .sidebar {
            width: 280px;
            background: var(--navy-dark);
            border-right: 1px solid var(--gold-dim);
            display: flex;
            flex-direction: column;
            transition: transform 0.3s ease, width 0.3s ease;
            z-index: 50;
        }

        .sidebar.collapsed {
            width: 0;
            border-right: none;
            overflow: hidden;
        }

        .sidebar-header {
            padding: 1rem;
            border-bottom: 1px solid var(--gold-dim);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sidebar-header h3 {
            font-family: "Cormorant Garamond", serif;
            font-size: 1rem;
            color: var(--cream);
            margin: 0;
        }

        .new-chat-btn {
            background: linear-gradient(135deg, var(--gold) 0%, var(--gold-light) 100%);
            color: var(--navy-dark);
            border: none;
            padding: 0.5rem 1rem;
            border-radius: 0.5rem;
            font-size: 0.75rem;
            font-weight: 500;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.35rem;
            transition: transform 0.2s;
        }

        .new-chat-btn:hover {
            transform: scale(1.02);
        }

        .new-chat-btn svg {
            width: 14px;
            height: 14px;
        }

        .sidebar-search {
            padding: 0.75rem 1rem;
            border-bottom: 1px solid var(--gold-dim);
        }

        .sidebar-search input {
            width: 100%;
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            border-radius: 0.5rem;
            padding: 0.5rem 0.75rem;
            color: var(--cream);
            font-size: 0.8rem;
        }

        .sidebar-search input:focus {
            outline: none;
            border-color: var(--gold);
        }

        .sidebar-search input::placeholder {
            color: var(--text-muted);
        }

        .conversation-list {
            flex: 1;
            overflow-y: auto;
            padding: 0.5rem;
        }

        .conversation-item {
            padding: 0.75rem;
            border-radius: 0.5rem;
            cursor: pointer;
            margin-bottom: 0.25rem;
            transition: background 0.2s;
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
        }

        .conversation-item:hover {
            background: var(--navy-light);
        }

        .conversation-item.active {
            background: var(--gold-dim);
            border: 1px solid var(--gold);
        }

        .conversation-info {
            flex: 1;
            min-width: 0;
        }

        .conversation-title {
            font-size: 0.85rem;
            color: var(--cream);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            margin-bottom: 0.25rem;
        }

        .conversation-meta {
            font-size: 0.7rem;
            color: var(--text-muted);
            display: flex;
            gap: 0.5rem;
        }

        .conversation-delete {
            opacity: 0;
            background: none;
            border: none;
            color: var(--error);
            cursor: pointer;
            padding: 0.25rem;
            border-radius: 0.25rem;
            transition: opacity 0.2s;
        }

        .conversation-item:hover .conversation-delete {
            opacity: 1;
        }

        .conversation-delete:hover {
            background: rgba(239, 68, 68, 0.2);
        }

        .conversation-delete svg {
            width: 14px;
            height: 14px;
        }

        .sidebar-empty {
            text-align: center;
            padding: 2rem 1rem;
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        .sidebar-toggle {
            position: fixed;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            background: var(--navy-light);
            border: 1px solid var(--gold-dim);
            border-left: none;
            border-radius: 0 0.5rem 0.5rem 0;
            padding: 0.75rem 0.35rem;
            cursor: pointer;
            color: var(--gold);
            z-index: 60;
            transition: left 0.3s ease;
        }

        .sidebar-toggle.sidebar-open {
            left: 280px;
        }

        .sidebar-toggle svg {
            width: 16px;
            height: 16px;
            transition: transform 0.3s ease;
        }

        .sidebar-toggle.sidebar-open svg {
            transform: rotate(180deg);
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-width: 0;
        }

        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: 0;
                top: 0;
                bottom: 0;
                width: 280px;
                transform: translateX(0);
                z-index: 200;
            }

            .sidebar.collapsed {
                transform: translateX(-100%);
                width: 280px;
            }

            .sidebar-overlay {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                background: rgba(0, 0, 0, 0.5);
                z-index: 199;
            }

            .sidebar-overlay.active {
                display: block;
            }
        }

@media (min-width: 769px) {
    .sidebar-toggle {
        display: none;
    }
}
