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

        .dashboard-container {
            width: 100%;
            height: 100vh;
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        .auth-container {
            max-width: 400px;
            margin: 4rem auto;
            padding: 2rem;
            background: var(--bg-secondary);
            border-radius: 12px;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
            border: 1px solid var(--border);
        }

        .auth-tabs {
            display: flex;
            gap: 1rem;
            margin-bottom: 2rem;
            border-bottom: 2px solid var(--border);
        }

        .auth-tab {
            padding: 0.75rem 1.5rem;
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1rem;
            font-weight: 500;
            border-bottom: 2px solid transparent;
            margin-bottom: -2px;
            transition: all 0.3s;
        }

        .auth-tab.active {
            color: var(--primary);
            border-bottom-color: var(--primary);
        }

        .auth-form {
            display: none;
        }

        .auth-form.active {
            display: block;
        }

        .form-group {
            margin-bottom: 1.5rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
            color: var(--text-primary);
        }

        .form-group input {
            width: 100%;
            padding: 0.75rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            box-sizing: border-box;
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .form-group input:focus {
            outline: none;
            border-color: var(--primary);
        }

        .btn-submit {
            width: 100%;
            padding: 0.75rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }

        .btn-submit:hover {
            background: var(--primary-dark);
        }

        .btn-submit:disabled {
            background: var(--text-muted);
            cursor: not-allowed;
        }

        .error-message {
            padding: 0.75rem;
            background: rgba(239, 68, 68, 0.1);
            border: 1px solid var(--error);
            border-radius: 8px;
            color: #fca5a5;
            margin-bottom: 1rem;
            display: none;
        }

        .success-message {
            padding: 0.75rem;
            background: rgba(16, 185, 129, 0.1);
            border: 1px solid var(--success);
            border-radius: 8px;
            color: #6ee7b7;
            margin-bottom: 1rem;
            display: none;
        }

        .trial-divider {
            display: flex;
            align-items: center;
            margin: 1.5rem 0;
            color: var(--text-muted);
        }

        .trial-divider::before,
        .trial-divider::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border);
        }

        .trial-divider span {
            padding: 0 1rem;
            font-size: 0.875rem;
        }

        .btn-trial {
            width: 100%;
            padding: 0.875rem;
            background: transparent;
            color: var(--primary);
            border: 2px solid var(--primary);
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
        }

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

        .trial-info {
            text-align: center;
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 0.75rem;
            margin-bottom: 0;
        }

        .chat-container {
            display: none;
            height: calc(100vh - 73px);  /* Account for navbar */
            width: 100%;
            margin: 0;
            padding: 0;
            position: relative;
        }

        .chat-container.active {
            display: flex;
            flex-direction: row;
        }

        /* Resizable pane system */
        .resizable-pane {
            height: 100%;  /* Fill parent container */
            overflow: hidden;
            position: relative;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
        }

        /* Companions sidebar needs minimum width for model selector and avatar cards */
        #companionsPane {
            min-width: 220px;
            max-width: 280px;
        }

        /* Chat pane needs to be flexible */
        #chatPane {
            flex-shrink: 1;
            flex-grow: 1;
            min-width: 400px;
        }

        .resize-handle {
            position: absolute;
            top: 0;
            right: 0;
            width: 4px;
            height: 100%;
            background: transparent;
            cursor: col-resize;
            z-index: 100;
            transition: background 0.2s;
        }

        .resize-handle:hover,
        .resize-handle.dragging {
            background: var(--primary);
        }

        .resize-handle::before {
            content: '';
            position: absolute;
            top: 0;
            left: -2px;
            right: -2px;
            bottom: 0;
        }

        .pane-collapse-btn {
            position: absolute;
            top: 50%;
            right: -10px;
            transform: translateY(-50%);
            width: 20px;
            height: 60px;
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 101;
            transition: all 0.2s;
            opacity: 0;
        }

        .resizable-pane:hover .pane-collapse-btn,
        .pane-collapse-btn:hover {
            opacity: 1;
        }

        .pane-collapse-btn:hover {
            background: var(--primary);
            color: white;
        }

        /* Collapsed pane - 0 width but tab button visible */
        .collapsed {
            width: 0 !important;
            min-width: 0 !important;
            padding: 0 !important;
            overflow: visible !important;  /* Allow button to overflow */
            background: transparent !important;
        }

        .collapsed .sidebar,
        .collapsed .conversations-sidebar {
            display: none;
        }

        .collapsed .resize-handle {
            display: none;
        }

        .collapsed .pane-collapse-btn {
            opacity: 1;
            pointer-events: auto;
            right: -20px;  /* Move button outside the 0-width pane */
        }

        .sidebar {
            background: var(--bg-secondary);
            border-radius: 0;
            padding: 0.75rem;
            box-shadow: none;
            border-right: 1px solid var(--border);
            height: 100%;
            width: 100%;
            overflow-y: auto;
            overflow-x: hidden;
            box-sizing: border-box;
        }

        .user-info {
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border);
            margin-bottom: 1rem;
        }

        .user-email {
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .btn-logout {
            padding: 0.5rem 1rem;
            background: var(--secondary);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
        }

        .btn-clear-session {
            padding: 0.5rem 1rem;
            background: #ff6b6b;
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            margin-top: 0.5rem;
        }

        .btn-clear-session:hover {
            background: #ff5252;
        }

        .model-selector {
            margin-bottom: 1.5rem;
            max-width: 100%;
            overflow: hidden;
        }

        .model-selector > label {
            display: block;
            margin-bottom: 0.5rem;
            font-weight: 500;
            color: var(--text-primary);
        }

        .model-selector select {
            width: 100%;
            padding: 0.5rem 0.25rem;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 0.8rem;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            box-sizing: border-box;
        }

        /* Provider filter UI now integrated into dropdown via SharedModelSelector */

        .companion-section {
            margin-top: 1.5rem;
            overflow-x: hidden;
            max-width: 100%;
        }

        .companion-section h3 {
            margin-bottom: 1rem;
            font-size: 1rem;
            color: var(--text-primary);
        }

        .btn-create-companion {
            width: 100%;
            padding: 0.75rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
        }

        /* Explorer Navigation Button */
        .explorer-nav-section {
            border-top: 1px solid var(--border);
            padding-top: 1rem;
        }

        .btn-explorer {
            width: 100%;
            padding: 0.75rem;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border: 1px solid var(--border);
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.2s;
        }

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

        /* Agent Terminal Navigation Button */
        .btn-agent-terminal {
            width: 100%;
            padding: 0.75rem;
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(59, 130, 246, 0.2));
            color: var(--text-primary);
            border: 1px solid rgba(139, 92, 246, 0.3);
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            transition: all 0.2s;
        }

        .btn-agent-terminal:hover {
            background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(59, 130, 246, 0.3));
            border-color: rgba(139, 92, 246, 0.5);
            transform: translateY(-1px);
        }

        /* Note: .agent-terminal-tab styles removed - Kestrel Sovereign Console now opens in separate window */

        .agent-terminal-nav-section {
            border-top: 1px solid var(--border);
            padding-top: 1rem;
            margin-top: 1rem;
        }

        .explorer-hint {
            font-size: 0.75rem;
            color: var(--text-muted);
            margin-top: 0.5rem;
        }

        /* Explorer Header Top */
        .explorer-header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .explorer-header-top h2 {
            margin: 0;
            font-size: 1.25rem;
            color: var(--text-primary);
        }

        .btn-close-explorer {
            padding: 0.25rem 0.75rem;
            background: transparent;
            border: 1px solid var(--border);
            border-radius: 4px;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.85rem;
        }

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

        .companion-list {
            margin-top: 1rem;
            overflow-x: hidden;
            width: 100%;
        }

        .companion-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem;
            background: var(--bg-tertiary);
            border-radius: 12px;
            margin-bottom: 0.75rem;
            cursor: pointer;
            transition: all 0.3s;
            color: var(--text-primary);
            width: 100%;
            box-sizing: border-box;
        }

        /* Create Companion button styling */
        .companion-item.create-new {
            flex-direction: row;
            justify-content: center;
            padding: 0.75rem 1rem;
            font-size: 0.9rem;
        }

        .companion-item.create-new .plus-icon {
            font-size: 1.2rem;
            margin-right: 0.5rem;
        }

        .companion-avatar {
            width: 140px;
            height: 140px;
            min-width: 140px;
            min-height: 140px;
            border-radius: 12px;
            object-fit: cover;
            flex-shrink: 0;
        }

        .companion-info {
            text-align: center;
            width: 100%;
        }

        .companion-name {
            font-weight: 500;
            font-size: 0.95rem;
        }

        .companion-item:hover {
            background: var(--border);
        }

        .companion-item.active {
            background: var(--primary);
            color: white;
        }

        .companion-item .companion-edit-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 0.25rem 0.5rem;
            font-size: 0.9rem;
            opacity: 0;
            transition: opacity 0.2s;
            margin-left: 0.5rem;
        }

        .companion-item:hover .companion-edit-btn {
            opacity: 0.7;
        }

        .companion-item .companion-edit-btn:hover {
            opacity: 1;
        }

        .companion-item.active .companion-edit-btn {
            color: white;
        }

        /* Conversations Sidebar */
        .conversations-sidebar {
            background: var(--bg-secondary);
            border-radius: 0;
            padding: 1.5rem;
            box-shadow: none;
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            height: 100%;
            width: 100%;
            overflow-y: auto;
        }

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

        .conversations-header h3 {
            margin: 0;
            font-size: 1rem;
            color: var(--text-primary);
        }

        .btn-new-conversation {
            padding: 0.5rem 0.75rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
            white-space: nowrap;
        }

        .conversations-list {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .conversation-item {
            padding: 0.75rem;
            background: var(--bg-tertiary);
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.3s;
            border: 1px solid transparent;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
        }

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

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

        .conversation-delete {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            font-size: 1.2rem;
            cursor: pointer;
            padding: 0.25rem 0.5rem;
            border-radius: 4px;
            opacity: 0;
            transition: all 0.2s;
        }

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

        .conversation-delete:hover {
            background: rgba(255, 0, 0, 0.1);
            color: #ff4444;
        }

        .conversation-item.active .conversation-delete {
            color: rgba(255, 255, 255, 0.7);
        }

        .conversation-item.active .conversation-delete:hover {
            background: rgba(255, 255, 255, 0.2);
            color: white;
        }

        .conversation-item.active {
            background: var(--primary);
            color: white;
            border-color: var(--primary);
        }

        .conversation-title {
            font-weight: 500;
            margin-bottom: 0.25rem;
            color: var(--text-primary);
        }

        .conversation-item.active .conversation-title {
            color: white;
        }

        .conversation-meta {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .conversation-item.active .conversation-meta {
            color: rgba(255, 255, 255, 0.8);
        }

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

        .chat-main {
            background: var(--bg-secondary);
            border-radius: 0;
            padding: 1.5rem;
            box-shadow: none;
            border: none;
            display: flex;
            flex-direction: column;
            height: 100%;
            width: 100%;
            max-height: none;
        }

        .chat-header {
            padding-bottom: 1rem;
            border-bottom: 1px solid var(--border);
            margin-bottom: 1rem;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            text-align: center;
        }

        .chat-header .chat-avatar {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            object-fit: cover;
        }

        .chat-header h2 {
            margin: 0;
            color: var(--text-primary);
            font-size: 1.1rem;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 0 !important;
            min-height: 0;
            display: flex;
            flex-direction: column;
            gap: 0.125rem !important;
        }

        .message {
            margin-bottom: 0 !important;
            padding: 0.25rem 0.5rem !important;
            border-radius: 8px;
            max-width: 80%;
            white-space: pre-wrap;
            word-wrap: break-word;
        }

        .message.user {
            background: var(--primary);
            color: white;
            margin-left: auto;
        }

        .message.assistant {
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        /* Markdown styling inside messages */
        .message pre {
            background: #1e1e1e;
            padding: 1rem;
            border-radius: 6px;
            overflow-x: auto;
            margin: 0.5rem 0;
        }

        .message code {
            font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
            font-size: 0.9em;
        }

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

        .message :not(pre) > code {
            background: rgba(255, 255, 255, 0.1);
            padding: 0.2em 0.4em;
            border-radius: 3px;
        }

        .message h1, .message h2, .message h3 {
            margin-top: 1rem;
            margin-bottom: 0.5rem;
        }

        .message h1 { font-size: 1.5em; }
        .message h2 { font-size: 1.3em; }
        .message h3 { font-size: 1.1em; }

        .message ul, .message ol {
            margin: 0.5rem 0;
            padding-left: 1.5rem;
        }

        .message li {
            margin: 0.25rem 0;
        }

        .message blockquote {
            border-left: 3px solid var(--primary);
            padding-left: 1rem;
            margin: 0.5rem 0;
            font-style: italic;
            opacity: 0.9;
        }

        .message a {
            color: var(--primary);
            text-decoration: underline;
        }

        .typing-indicator {
            opacity: 0.9;
        }

        .typing-content {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            background: var(--bg-tertiary);
            border-radius: 12px;
        }

        .typing-dots {
            display: flex;
            gap: 4px;
            align-items: center;
        }

        .typing-dots span {
            width: 8px;
            height: 8px;
            background: var(--primary);
            border-radius: 50%;
            animation: typing-bounce 1.4s infinite ease-in-out both;
        }

        .typing-dots span:nth-child(1) {
            animation-delay: -0.32s;
        }

        .typing-dots span:nth-child(2) {
            animation-delay: -0.16s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: 0s;
        }

        .typing-text {
            color: var(--text-secondary);
            font-size: 0.875rem;
            font-style: italic;
        }

        @keyframes typing-bounce {
            0%, 80%, 100% {
                transform: scale(0.6);
                opacity: 0.5;
            }
            40% {
                transform: scale(1);
                opacity: 1;
            }
        }

        .message-meta {
            font-size: 0.8rem;
            margin-top: 0.5rem;
            opacity: 0.7;
        }

        .chat-input-container {
            display: flex;
            gap: 1rem;
            padding: 1rem;
            padding-bottom: 1.5rem;
            border-top: 1px solid var(--border);
            flex-shrink: 0;
            background: var(--bg-secondary);
        }

        .chat-input {
            flex: 1;
            padding: 0.75rem;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            resize: none;
            font-family: inherit;
            background: var(--bg-tertiary);
            color: var(--text-primary);
        }

        .btn-send {
            padding: 0.75rem 1.5rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
        }

        .btn-send:disabled {
            background: var(--text-muted);
            cursor: not-allowed;
        }

        .welcome-message {
            text-align: center;
            padding: 3rem;
            color: var(--text-muted);
        }

        .privacy-selector {
            margin-bottom: 0.5rem;
        }

        .privacy-selector select {
            width: 100%;
            padding: 0.5rem 0.75rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.85rem;
            color: var(--text-primary);
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 0.75rem center;
            padding-right: 2rem;
        }

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

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

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: var(--bg-secondary);
            padding: 2rem;
            border-radius: 12px;
            max-width: 800px;  /* Wider for better slider layout */
            width: 90%;
            max-height: 90vh;  /* Don't exceed viewport height */
            overflow-y: auto;  /* Enable scrolling for tall content */
            border: 1px solid var(--border);
            position: relative;  /* For absolute positioned close button */
        }

        /* Custom scrollbar for modal */
        .modal-content::-webkit-scrollbar {
            width: 8px;
        }

        .modal-content::-webkit-scrollbar-track {
            background: var(--bg-tertiary);
            border-radius: 4px;
        }

        .modal-content::-webkit-scrollbar-thumb {
            background: var(--primary);
            border-radius: 4px;
        }

        .modal-content::-webkit-scrollbar-thumb:hover {
            background: var(--primary-dark);
        }

        .modal-header {
            margin-bottom: 1.5rem;
        }

        .modal-header h3 {
            margin: 0;
            color: var(--text-primary);
        }

        .btn-close {
            float: right;
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: var(--text-muted);
        }

        /* ========================================================================
           Interactive Message Buttons
           ======================================================================== */

        /* Inline action buttons - warm gradient */
        .inline-action-btn {
            padding: 0.5rem 1rem;
            background: var(--gradient-glow);
            border: 1px solid rgba(255, 107, 107, 0.3);
            border-radius: 12px;
            color: var(--primary);
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            white-space: nowrap;
            margin: 0.25rem;
        }

        .inline-action-btn:hover {
            background: linear-gradient(135deg, rgba(240, 147, 251, 0.3), rgba(245, 87, 108, 0.3));
            border-color: var(--primary);
            transform: translateY(-1px);
            box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
        }

        .inline-action-btn:active {
            transform: translateY(0);
            box-shadow: none;
        }

        /* Expandable button indicator */
        .expandable-btn .expand-icon {
            font-size: 0.8em;
            margin-left: 0.25rem;
            transition: transform 0.2s ease;
        }

        .expandable-btn[aria-expanded="true"] .expand-icon {
            transform: rotate(180deg);
        }

        /* Custom input panel */
        .custom-input-panel {
            margin-top: 0.75rem;
            padding: 1rem;
            background: rgba(99, 102, 241, 0.05);
            border: 1px solid rgba(99, 102, 241, 0.2);
            border-radius: 12px;
            animation: slideDown 0.2s ease;
        }

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

        .custom-input-header label {
            display: block;
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--text-secondary);
            margin-bottom: 0.5rem;
        }

        .custom-input-body {
            display: flex;
            gap: 0.5rem;
            align-items: flex-end;
        }

        .custom-textarea {
            flex: 1;
            padding: 0.75rem;
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            background: rgba(0, 0, 0, 0.2);
            color: var(--text-primary);
            font-family: inherit;
            font-size: 0.9rem;
            resize: vertical;
            min-height: 60px;
        }

        .custom-textarea:focus {
            outline: none;
            border-color: var(--primary);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

        .custom-send-btn {
            padding: 0.75rem 1.5rem;
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            border: none;
            border-radius: 8px;
            color: white;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

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

        .custom-send-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* ========================================================================
           MODAL STYLING - Clean, Warm, Beautiful UI
           ======================================================================== */

        /* Friend Type Selection Cards */
        .friend-types-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1rem;
            margin: 1.5rem 0;
        }

        .friend-type-card {
            background: var(--bg-tertiary);
            border: 2px solid transparent;
            border-radius: 12px;
            padding: 1.5rem 1rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .friend-type-card:hover {
            border-color: var(--primary);
            transform: translateY(-4px);
            box-shadow: 0 8px 16px rgba(255, 107, 107, 0.2);
        }

        .friend-type-card.selected {
            border-color: var(--primary);
            background: var(--gradient-glow);
        }

        .friend-type-icon {
            font-size: 3rem;
            margin-bottom: 0.5rem;
        }

        .friend-type-card h3 {
            font-size: 1rem;
            margin: 0.5rem 0;
            color: var(--text-primary);
        }

        .friend-type-card p {
            font-size: 0.85rem;
            color: var(--text-muted);
            line-height: 1.4;
        }

        .continue-btn {
            width: 100%;
            padding: 1rem;
            background: var(--gradient-warm);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 1.5rem;
        }

        .continue-btn:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
        }

        .continue-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Friend Preview Section */
        .friend-preview {
            background: linear-gradient(135deg, rgba(255, 147, 123, 0.15) 0%, rgba(255, 107, 107, 0.1) 100%);
            border-radius: 12px;
            padding: 1.5rem;
            margin-bottom: 1.5rem;
            border: 1px solid rgba(255, 107, 107, 0.2);
        }

        .friend-image {
            width: 200px;
            height: 200px;
            margin: 0 auto 1rem;
            background: var(--bg-tertiary);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 4rem;
            border: 2px solid rgba(255, 107, 107, 0.3);
        }

        .friend-description {
            color: var(--text-secondary);
        }

        .description-item {
            padding: 0.5rem;
            margin: 0.25rem 0;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
            font-size: 0.9rem;
        }

        /* Slider Sections */
        .slider-section {
            margin: 1.5rem 0;
        }

        .slider-section h3 {
            color: var(--primary);
            font-size: 1.1rem;
            margin-bottom: 1rem;
            padding-bottom: 0.5rem;
            border-bottom: 2px solid var(--primary);
        }

        .slider-group {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        .slider-item {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
        }

        .slider-label {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.9rem;
        }

        .slider-label span:first-child {
            color: var(--text-secondary);
            font-weight: 500;
        }

        .slider-value {
            color: var(--primary);
            font-weight: 600;
            font-size: 0.95rem;
        }

        /* Range Slider Styling - Warm Coral Theme */
        input[type="range"].slider {
            -webkit-appearance: none;
            width: 100%;
            height: 6px;
            border-radius: 3px;
            background: var(--bg-tertiary);
            outline: none;
            transition: background 0.3s;
        }

        input[type="range"].slider:hover {
            background: var(--bg-card);
        }

        input[type="range"].slider::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--gradient-warm);
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
            transition: all 0.2s;
        }

        input[type="range"].slider::-webkit-slider-thumb:hover {
            transform: scale(1.2);
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
        }

        input[type="range"].slider::-moz-range-thumb {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            background: var(--gradient-warm);
            cursor: pointer;
            border: 2px solid white;
            box-shadow: 0 2px 8px rgba(255, 107, 107, 0.4);
            transition: all 0.2s;
        }

        input[type="range"].slider::-moz-range-thumb:hover {
            transform: scale(1.2);
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.6);
        }

        /* Generate Button */
        .generate-btn {
            width: 100%;
            padding: 1rem;
            background: var(--gradient-sunset);
            border: none;
            border-radius: 8px;
            color: white;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s;
            margin-top: 1rem;
        }

        .generate-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
        }

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

        /* Modal Close Button */
        .close-btn {
            position: absolute;
            top: 1rem;
            right: 1rem;
            background: none;
            border: none;
            font-size: 2rem;
            color: var(--text-muted);
            cursor: pointer;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s;
        }

        .close-btn:hover {
            background: rgba(255, 107, 107, 0.1);
            color: var(--primary);
            transform: rotate(90deg);
        }

        /* Modal Section Titles */
        .modal-section-title {
            color: var(--text-muted);
            font-size: 0.95rem;
            margin-bottom: 1rem;
            text-align: center;
        }

        /* ========================================
           CONVERSATION TREE WIZARD STYLES
           ======================================== */

        #tree-wizard-container {
            min-height: 300px;
            padding: 1rem;
        }

        /* Tree Message */
        .tree-message {
            text-align: center;
            padding: 2rem;
        }

        .tree-message p {
            margin-bottom: 1.5rem;
            line-height: 1.6;
        }

        /* Tree Input */
        .tree-input {
            padding: 1.5rem;
        }

        .tree-input label {
            display: block;
            margin-bottom: 1rem;
            font-weight: 600;
            color: var(--text-primary);
        }

        .tree-input input[type="text"] {
            width: 100%;
            padding: 0.75rem;
            border: 2px solid var(--border);
            border-radius: 8px;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            font-size: 1rem;
            margin-bottom: 1.5rem;
            transition: border-color 0.3s;
        }

        .tree-input input[type="text"]:focus {
            outline: none;
            border-color: var(--primary);
        }

        /* Tree Choice */
        .tree-choice {
            padding: 1.5rem;
        }

        .tree-choice-text {
            margin-bottom: 2rem;
            text-align: center;
            line-height: 1.6;
        }

        .tree-choice-buttons {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 1rem;
        }

        .tree-choice-btn {
            padding: 1rem 1.5rem;
            background: var(--bg-tertiary);
            border: 2px solid var(--border);
            border-radius: 12px;
            color: var(--text-primary);
            font-size: 1rem;
            cursor: pointer;
            transition: all 0.3s;
            text-align: center;
        }

        .tree-choice-btn:hover {
            border-color: var(--primary);
            background: linear-gradient(135deg, rgba(255, 107, 107, 0.1) 0%, rgba(240, 147, 251, 0.1) 100%);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(255, 107, 107, 0.2);
        }

        /* Tree Group (Sliders) */
        .tree-group {
            padding: 1rem 0;
            max-height: 60vh;
            overflow-y: auto;
        }

        .tree-group h3 {
            margin-bottom: 1.5rem;
            text-align: center;
            color: var(--primary);
        }

        /* Tree Action (Loading) */
        .tree-action {
            text-align: center;
            padding: 3rem;
        }

        .loading-spinner {
            width: 80px;
            height: 80px;
            border: 6px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin: 0 auto 1.5rem;
        }

        .loading-message {
            font-size: 1.3rem;
            font-weight: 600;
            color: var(--primary);
            margin-bottom: 0.5rem;
        }

        .loading-subtext {
            font-size: 0.95rem;
            color: var(--text-secondary);
            max-width: 400px;
            margin: 0 auto;
            line-height: 1.5;
        }

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

        /* Button Loading State */
        .btn-loading {
            position: relative;
            cursor: wait !important;
            opacity: 0.8;
        }

        .btn-loading:disabled {
            background: var(--primary);
            color: white;
        }

        .btn-spinner {
            display: inline-block;
            width: 14px;
            height: 14px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            vertical-align: middle;
            margin-right: 6px;
        }

        /* Tree Success */
        .tree-success {
            text-align: center;
            padding: 3rem 2rem;
        }

        .tree-success h2 {
            color: var(--primary);
            margin-bottom: 1rem;
        }

        .tree-success p {
            font-size: 1.1rem;
            margin-bottom: 2rem;
            line-height: 1.6;
        }

        /* Tree Error */
        .tree-error {
            color: var(--error);
            padding: 1rem;
            margin-top: 1rem;
            background: rgba(239, 68, 68, 0.1);
            border-radius: 8px;
            border: 1px solid var(--error);
        }

        /* Avatar Selection */
        .tree-avatar-selection {
            padding: 1.5rem;
        }

        .avatar-text {
            text-align: center;
            margin-bottom: 1.5rem;
            line-height: 1.6;
        }

        .avatar-gallery {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        .avatar-option {
            position: relative;
            border-radius: 12px;
            overflow: hidden;
            border: 3px solid transparent;
            cursor: pointer;
            transition: all 0.3s;
            aspect-ratio: 3/4;
        }

        .avatar-option img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .avatar-option:hover {
            border-color: var(--border);
            transform: translateY(-2px);
        }

        .avatar-option.selected {
            border-color: var(--primary);
            box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
        }

        .avatar-option .select-btn {
            position: absolute;
            bottom: 8px;
            left: 50%;
            transform: translateX(-50%);
            padding: 0.4rem 1rem;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: 6px;
            font-size: 0.85rem;
            cursor: pointer;
            opacity: 0.9;
            transition: opacity 0.3s;
        }

        .avatar-option:hover .select-btn {
            opacity: 1;
        }

        .feedback-section {
            margin-bottom: 1.5rem;
            padding: 1rem;
            background: var(--bg-tertiary);
            border-radius: 8px;
        }

        .feedback-section label {
            display: block;
            font-size: 0.9rem;
            margin-bottom: 0.5rem;
            color: var(--text-secondary);
        }

        .feedback-section input {
            width: 100%;
            padding: 0.6rem;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: var(--bg-secondary);
            color: var(--text-primary);
            margin-bottom: 0.75rem;
        }

        .avatar-actions {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
        }

        .tree-buttons {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 1rem;
            margin-top: 1.5rem;
        }

        .tree-buttons .btn-primary {
            flex: 1;
        }

        .btn-back {
            flex: 0 0 auto;
        }

        .btn-secondary {
            padding: 0.6rem 1.2rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.3s;
        }

        .btn-secondary:hover {
            background: var(--bg-secondary);
            border-color: var(--primary);
        }
