        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 20px;
        }


        .app-layout {
            display: flex;
            height: 90vh;
            width: 100%;
            max-width: 1100px;
        }

        .sidebar {
            width: 240px;
            background: #2d2d3a;
            color: #ccc;
            display: flex;
            flex-direction: column;
            border-radius: 20px 0 0 20px;
            overflow: hidden;
        }

        .sidebar-header {
            padding: 16px;
            border-bottom: 1px solid #3d3d4a;
        }

        .new-chat-btn {
            width: 100%;
            padding: 10px;
            background: #667eea;
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 14px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .new-chat-btn:hover {
            background: #5a6fd6;
        }

        .sidebar-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
        }

        .sidebar-item {
            padding: 10px 12px;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 4px;
            font-size: 13px;
            transition: background 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .sidebar-item:hover {
            background: #3d3d4a;
        }

        .sidebar-item.active {
            background: #4d4d5a;
            color: white;
        }

        .sidebar-item .item-title {
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .sidebar-item .item-actions {
            display: flex;
            align-items: center;
            gap: 4px;
            flex-shrink: 0;
        }

        .sidebar-item .delete-session,
        .sidebar-item .export-session {
            cursor: pointer;
            color: #888;
            display: none;
            font-size: 13px;
            line-height: 1;
            padding: 0 2px;
        }

        .sidebar-item.active .delete-session,
        .sidebar-item:hover .delete-session,
        .sidebar-item.active .export-session,
        .sidebar-item:hover .export-session {
            display: inline;
        }

        .sidebar-item .export-session:hover {
            color: #5a6fd6;
        }

        .sidebar-item .delete-session:hover {
            color: #ff6b6b;
        }

        .chat-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #fff;
            border-radius: 0 20px 20px 0;
            overflow: hidden;
        }

        .chat-container {
            width: 100%;
            max-width: 800px;
            height: 90vh;
            background: #fff;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            text-align: center;
        }

        .chat-header h1 {
            font-size: 24px;
            margin-bottom: 5px;
        }

        .chat-header p {
            font-size: 14px;
            opacity: 0.9;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            background: #f8f9fa;
        }

        /* Chat message layout & components are now in common.css:
           .chat-msg, .chat-msg.user, .chat-msg.asst,
           .chat-msg-label, .chat-bubble-user, .chat-asst-card,
           .chat-think, .chat-think-dot, .chat-think-body,
           .chat-tool-match, .chat-tool-match-title, .chat-tool-match-item,
           .chat-tool-match-name, .chat-tool-match-desc, .chat-tool-match-args,
           .chat-tool-calls, .chat-tool-calls-label,
           .chat-tool-badge, .chat-tool-badge-args,
           .chat-answer, .chat-answer-title
        */

        /* Chatbot-specific overrides for .chat-answer (markdown HTML, not pre-wrap) */
        .chat-answer {
            white-space: normal;
        }

        .tool-call {
            background: #fff3cd;
            border: 1px solid #ffc107;
            border-radius: 8px;
            padding: 8px 12px;
            margin: 8px 0;
            font-size: 13px;
            color: #856404;
        }

        .answer-content {
            line-height: 1.5;
            word-break: break-word;
        }

        .answer-content h1,
        .answer-content h2,
        .answer-content h3 {
            margin: 12px 0 8px;
            line-height: 1.25;
        }

        .answer-content h1 {
            font-size: 22px;
        }

        .answer-content h2 {
            font-size: 19px;
        }

        .answer-content h3 {
            font-size: 16px;
        }

        .answer-content p {
            margin: 8px 0;
        }

        .answer-content ul,
        .answer-content ol {
            margin: 8px 0 8px 22px;
        }

        .answer-content li {
            margin: 4px 0;
        }

        .answer-content blockquote {
            margin: 10px 0;
            padding: 8px 12px;
            border-left: 4px solid #667eea;
            background: #f4f6ff;
            color: #555;
        }

        .answer-content code {
            padding: 2px 5px;
            background: #f1f3f5;
            border-radius: 4px;
            font-family: "SFMono-Regular", Consolas, monospace;
            font-size: 0.92em;
        }

        .answer-content pre {
            margin: 10px 0;
            padding: 12px;
            background: #1f2937;
            color: #f8fafc;
            border-radius: 8px;
            overflow-x: auto;
        }

        .answer-content pre code {
            padding: 0;
            background: transparent;
            color: inherit;
        }

        .answer-content a {
            color: #5b63d6;
            text-decoration: none;
        }

        .answer-content a:hover {
            text-decoration: underline;
        }

        .message-feedback {
            display: flex;
            gap: 8px;
            padding: 4px 16px 14px;
            justify-content: flex-end;
            opacity: 0;
            visibility: hidden;
            transition: opacity 0.2s, visibility 0.2s;
        }

        .message-feedback.hidden {
            display: none;
        }

        .chat-asst-card:hover .message-feedback {
            opacity: 1;
            visibility: visible;
        }

        /* Always show feedback if a vote is already cast */
        .message-feedback[data-feedback] {
            opacity: 1;
            visibility: visible;
        }

        .feedback-btn {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            border: none;
            background: #f3f4f6;
            color: #6b7280;
            cursor: pointer;
            font-size: 15px;
            line-height: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
        }

        .feedback-btn:hover {
            background: #e5e7eb;
            transform: scale(1.08);
        }

        .feedback-btn.active.feedback-up {
            background: #dcfce7;
            color: #16a34a;
            box-shadow: 0 0 0 2px #bbf7d0;
        }

        .feedback-btn.active.feedback-down {
            background: #fee2e2;
            color: #dc2626;
            box-shadow: 0 0 0 2px #fecaca;
        }

        .feedback-btn:disabled {
            cursor: wait;
            opacity: 0.5;
        }

        .chat-input-container {
            padding: 20px;
            background: white;
            border-top: 1px solid #eee;
        }

        .chat-input-wrapper {
            display: flex;
            gap: 12px;
        }

        .chat-input {
            flex: 1;
            padding: 14px 18px;
            border: 2px solid #e0e0e0;
            border-radius: 25px;
            font-size: 16px;
            outline: none;
            transition: border-color 0.3s;
        }

        .chat-input:focus {
            border-color: #667eea;
        }

        .chat-input:disabled {
            background: #f5f5f5;
        }

        .send-button {
            padding: 14px 28px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 25px;
            font-size: 16px;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
        }

        .send-button:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .send-button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .typing-indicator {
            display: flex;
            gap: 4px;
            padding: 12px 16px;
        }

        .typing-indicator span {
            width: 8px;
            height: 8px;
            background: #667eea;
            border-radius: 50%;
            animation: typing 1.4s infinite ease-in-out;
        }

        .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);
            }
            30% {
                transform: translateY(-10px);
            }
        }



        .error-message {
            background: #f8d7da;
            border: 1px solid #f5c6cb;
            color: #721c24;
            padding: 10px 16px;
            border-radius: 8px;
            margin: 8px 0;
        }

        .welcome-message {
            text-align: center;
            padding: 40px 20px;
            color: #666;
        }

        .welcome-message h2 {
            color: #333;
            margin-bottom: 10px;
        }

        .welcome-message p {
            margin-bottom: 20px;
        }

        .example-questions {
            display: flex;
            flex-wrap: wrap;
            gap: 10px;
            justify-content: center;
        }

        .example-question {
            padding: 8px 16px;
            background: white;
            border: 1px solid #ddd;
            border-radius: 20px;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 14px;
        }

        .example-question:hover {
            border-color: #667eea;
            color: #667eea;
        }

        /* ---- Auth overlay ---- */
        .auth-overlay {
            position: fixed;
            inset: 0;
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background:
                radial-gradient(1200px 600px at 15% 10%, rgba(255,255,255,.18), transparent 60%),
                linear-gradient(135deg, #5b6fe0 0%, #6f4aa0 100%);
        }
        .auth-overlay.hidden { display: none; }
        .auth-card {
            width: 100%;
            max-width: 380px;
            background: #fff;
            border-radius: 18px;
            padding: 32px 28px;
            box-shadow: 0 24px 60px rgba(40, 30, 90, .35);
        }
        .auth-brand { text-align: center; margin-bottom: 22px; }
        .auth-brand h2 { font-size: 26px; color: #2d2d3a; letter-spacing: 2px; }
        .auth-brand p { color: #8a8aa0; font-size: 13px; margin-top: 6px; }
        .auth-tabs { display: flex; gap: 4px; background: #f1f2f8; border-radius: 10px; padding: 4px; margin-bottom: 20px; }
        .auth-tab {
            flex: 1; text-align: center; padding: 9px 0; border-radius: 8px;
            cursor: pointer; font-size: 14px; color: #6b7280; border: none; background: transparent;
            transition: all .18s;
        }
        .auth-tab.active { background: #fff; color: #4f46e5; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
        .auth-field { margin-bottom: 14px; }
        .auth-field label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 6px; }
        .auth-field input {
            width: 100%; padding: 11px 13px; border: 1px solid #e2e3ee; border-radius: 10px;
            font-size: 14px; transition: border-color .15s, box-shadow .15s; outline: none;
        }
        .auth-field input:focus { border-color: #667eea; box-shadow: 0 0 0 3px rgba(102,126,234,.15); }
        .auth-submit {
            width: 100%; padding: 12px; margin-top: 6px; border: none; border-radius: 10px;
            background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; font-size: 15px;
            font-weight: 600; cursor: pointer; transition: filter .15s, transform .05s;
        }
        .auth-submit:hover { filter: brightness(1.05); }
        .auth-submit:active { transform: translateY(1px); }
        .auth-submit:disabled { opacity: .6; cursor: not-allowed; }
        .auth-error { color: #dc2626; font-size: 13px; min-height: 18px; margin-top: 12px; text-align: center; }
        .auth-hint { color: #9ca3af; font-size: 12px; text-align: center; margin-top: 14px; }

        .user-bar {
            display: flex; align-items: center; justify-content: space-between;
            gap: 8px; padding: 12px 16px; border-top: 1px solid #3d3d4a; font-size: 13px;
        }
        .user-bar .uname { color: #e4e4ec; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .user-bar .logout-btn {
            background: transparent; color: #9b9bb0; border: 1px solid #4d4d5a;
            border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 12px; transition: all .15s;
        }
        .user-bar .logout-btn:hover { color: #fff; border-color: #667eea; }
