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

        body {
            font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
            background-color: #1a1a1a;
            color: #e8e6e3;
            line-height: 1.6;
            font-size: 14px;
        }

        .container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 16px;
            height: 100dvh;
            display: flex;
            flex-direction: column;
        }

        /* MINIMAL HEADER */
        .minimal-header {
            margin-bottom: 16px;
            padding: 8px 16px;
            background-color: transparent;
            border-bottom: 1px solid #333;
        }

        .header-content {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .sidebar-toggle-btn {
            display: none;
            background: none;
            border: none;
            color: #e8e6e3;
            font-size: 1.5rem;
            cursor: pointer;
            padding: 4px 8px;
            line-height: 1;
            transition: color 0.2s;
        }

        .sidebar-toggle-btn:hover {
            color: #4385be;
        }

        .logo {
            font-size: 1.2rem;
            font-weight: 700;
            color: #e8e6e3;
            margin: 0;
        }

        .welcome-mobile {
            display: none;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        /* User Menu Dropdown */
        .user-menu {
            position: relative;
        }

        .user-menu-button {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 4px 10px;
            background-color: transparent;
            border: 1px solid #333;
            color: #e8e6e3;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
            font-size: 0.85rem;
        }

        .user-menu-button:hover {
            border-color: #4385be;
            background-color: #252525;
        }

        .tier-badge {
            padding: 2px 8px;
            font-size: 0.75rem;
            font-weight: 600;
            border: 1px solid;
            letter-spacing: 0.5px;
        }

        .tier-free {
            border-color: #777;
            color: #777;
        }

        .tier-basic, .tier-plus {
            border-color: #4385be;
            color: #4385be;
        }

        .dropdown-icon {
            font-size: 0.7rem;
            color: #999;
            transition: transform 0.2s;
        }

        .user-menu-button:hover .dropdown-icon {
            color: #4385be;
        }

        .user-menu-dropdown {
            position: absolute;
            top: calc(100% + 4px);
            right: 0;
            min-width: 280px;
            background-color: #252525;
            border: 1px solid #333;
            z-index: 1000;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        }

        .user-menu-dropdown.hidden {
            display: none;
        }

        .menu-section {
            padding: 8px 0;
        }

        .menu-item {
            padding: 8px 16px;
            display: block;
            width: 100%;
            text-align: left;
            background: none;
            border: none;
            color: #e8e6e3;
            font-family: inherit;
            font-size: 0.85rem;
        }

        .user-info-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            color: #999;
        }

        .user-info-item .label {
            font-weight: 600;
            color: #777;
        }

        .subscription-item {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .subscription-detail {
            font-size: 0.8rem;
            color: #999;
        }

        .menu-button {
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .menu-button:hover {
            background-color: #2a2a2a;
        }

        .menu-button.logout {
            color: #f85149;
        }

        .menu-button.logout:hover {
            background-color: #2a2a2a;
        }

        .menu-divider {
            height: 1px;
            background-color: #333;
            margin: 4px 0;
        }

        .upgrade-button, .manage-subscription-button {
            padding: 6px 12px;
            background-color: #4385be;
            color: #fff;
            border: 1px solid #5a9dd1;
            font-size: 0.8rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
            width: 100%;
            margin-top: 4px;
        }

        .upgrade-button:hover, .manage-subscription-button:hover {
            background-color: #5a9dd1;
        }

        .main-content {
            display: flex;
            gap: 16px;
            flex: 1;
            overflow: hidden;
        }

        .sidebar {
            width: 320px;
            background-color: #252525;
            border: 1px solid #333;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .sidebar-header {
            padding: 12px 16px;
            background-color: #1a1a1a;
            border-bottom: 1px solid #333;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sidebar-header h3 {
            margin: 0;
            color: #e8e6e3;
            font-size: 1rem;
            font-weight: 600;
        }

        .sidebar-header h3::before {
            content: '[ ';
            color: #333;
        }

        .sidebar-header h3::after {
            content: ' ]';
            color: #333;
        }

        .new-chat-button {
            padding: 4px 10px;
            background-color: #4385be;
            color: #ffffff;
            border: 1px solid #5a9dd1;
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.2s;
            font-family: inherit;
            font-weight: 500;
        }

        .new-chat-button:hover {
            background-color: #5a9dd1;
            border-color: #6bb0e0;
        }

        .search-container {
            padding: 12px 16px;
            background-color: #1a1a1a;
            border-bottom: 1px solid #333;
        }

        .search-container input {
            width: 100%;
            padding: 8px 12px;
            background-color: #252525;
            border: 1px solid #333;
            color: #e8e6e3;
            font-family: inherit;
            font-size: 0.85rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .search-container input::placeholder {
            color: #777;
        }

        .search-container input:focus {
            border-color: #4385be;
        }

        .conversation-list {
            flex: 1;
            overflow-y: auto;
            scrollbar-width: thin;
            scrollbar-color: #333 #252525;
        }

        .conversation-list::-webkit-scrollbar {
            width: 8px;
        }

        .conversation-list::-webkit-scrollbar-track {
            background: #252525;
        }

        .conversation-list::-webkit-scrollbar-thumb {
            background: #333;
        }

        .conversation-list::-webkit-scrollbar-thumb:hover {
            background: #444;
        }

        .conversation-item {
            padding: 12px 16px;
            border-bottom: 1px solid #333;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .conversation-item:hover {
            background-color: #2a2a2a;
        }

        .conversation-item.active {
            background-color: #2a2a2a;
            border-left: 3px solid #4385be;
        }

        .conversation-title {
            font-weight: 500;
            color: #e8e6e3;
            margin-bottom: 4px;
            font-size: 0.9rem;
        }

        .conversation-title::before {
            content: '> ';
            color: #4385be;
        }

        .conversation-preview {
            font-size: 0.8rem;
            color: #999;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            margin-left: 12px;
        }

        .conversation-date {
            font-size: 0.75rem;
            color: #777;
            margin-top: 4px;
            margin-left: 12px;
        }

        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background-color: #252525;
            border: 1px solid #333;
            overflow: hidden;
        }

        .chat-messages {
            flex: 1;
            padding: 16px;
            overflow-y: auto;
            overflow-x: hidden;
            scroll-behavior: smooth;
            scrollbar-width: thin;
            scrollbar-color: #333 #252525;
            min-height: 0; /* Critical for flex scrolling */
        }

        .chat-messages::-webkit-scrollbar {
            width: 8px;
        }

        .chat-messages::-webkit-scrollbar-track {
            background: #252525;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background: #333;
        }

        .chat-messages::-webkit-scrollbar-thumb:hover {
            background: #444;
        }

        .message {
            margin-bottom: 16px;
            max-width: 85%;
        }

        .user-message {
            margin-left: auto;
        }

        .assistant-message {
            margin-right: auto;
        }

        .message-content {
            padding: 12px 16px;
            position: relative;
            border: 1px solid #333;
        }

        .user-message .message-content {
            background-color: #2a2a2a;
            color: #e8e6e3;
            border-left: 3px solid #999;
        }

        .assistant-message .message-content {
            background-color: #1a1a1a;
            color: #e8e6e3;
            border-left: 3px solid #4385be;
        }

        .message-content p {
            margin-bottom: 8px;
        }

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

        .message-content ul, .message-content ol {
            margin: 8px 0;
            padding-left: 20px;
        }

        .message-content li {
            margin-bottom: 4px;
        }

        .message-content li::marker {
            color: #4385be;
        }

        .message-content table {
            width: 100%;
            border-collapse: collapse;
            margin: 12px 0;
            border: 1px solid #333;
        }

        .message-content th,
        .message-content td {
            padding: 8px 12px;
            text-align: left;
            border: 1px solid #333;
        }

        .message-content th {
            background-color: #333;
            font-weight: 600;
            color: #e8e6e3;
        }

        .source-citation {
            font-size: 0.85em;
            color: #999;
            font-style: italic;
            margin-top: 8px;
            padding-top: 8px;
            border-top: 1px solid #333;
        }

        .chat-input-container {
            padding: 12px 16px;
            border-top: 1px solid #333;
            background-color: #1a1a1a;
        }

        .input-wrapper {
            display: flex;
            gap: 12px;
            align-items: flex-end;
        }

        #chat-input {
            flex: 1;
            padding: 10px 12px;
            border: 1px solid #333;
            font-size: 0.9rem;
            resize: vertical;
            min-height: 44px;
            max-height: 120px;
            font-family: inherit;
            line-height: 1.5;
            background-color: #1a1a1a;
            color: #e8e6e3;
        }

        #chat-input:focus {
            outline: none;
            border-color: #4385be;
            background-color: #252525;
        }

        #chat-input::placeholder {
            color: #777;
        }

        #send-button {
            padding: 10px 20px;
            background-color: #4385be;
            color: #ffffff;
            border: 1px solid #5a9dd1;
            font-size: 0.9rem;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
            height: 44px;
            font-family: inherit;
        }

        #send-button:hover {
            background-color: #5a9dd1;
            border-color: #6bb0e0;
        }

        #send-button:disabled {
            background-color: #333;
            border-color: #333;
            color: #777;
            cursor: not-allowed;
        }

        #send-button::before {
            content: '[';
            margin-right: 4px;
        }

        #send-button::after {
            content: ']';
            margin-left: 4px;
        }

        .typing-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 12px 16px;
            background-color: #1a1a1a;
            border: 1px solid #333;
            border-left: 3px solid #4385be;
            max-width: 100px;
            margin-bottom: 16px;
        }

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

        .typing-dot {
            width: 6px;
            height: 6px;
            background: #4385be;
            border-radius: 50%;
            animation: typing 1.4s infinite ease-in-out;
        }

        .typing-dot:nth-child(1) { animation-delay: -0.32s; }
        .typing-dot:nth-child(2) { animation-delay: -0.16s; }

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

        .example-prompts {
            display: flex;
            flex-direction: column;
            gap: 10px;
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
        }

        .example-prompts.hidden {
            display: none;
        }

        .example-prompt-header {
            font-size: 0.85rem;
            color: #999;
            margin-bottom: 6px;
            text-align: center;
        }

        .example-prompt {
            padding: 12px 16px;
            background-color: #1a1a1a;
            border: 1px solid #333;
            border-left: 3px solid #4385be;
            color: #e8e6e3;
            cursor: pointer;
            transition: all 0.2s;
            font-size: 0.9rem;
            line-height: 1.5;
        }

        .example-prompt:hover {
            background-color: #2a2a2a;
            border-left-color: #5a9dd1;
            transform: translateX(4px);
        }

        .example-prompt:active {
            background-color: #252525;
        }

        @media (max-width: 768px) {
            body {
                font-size: 11px;
            }

            .container {
                padding: 6px;
            }

            .minimal-header {
                padding: 6px 8px;
                margin-bottom: 8px;
            }

            .header-left {
                gap: 8px;
            }

            .sidebar-toggle-btn {
                display: block;
            }

            .logo {
                font-size: 0.9rem;
            }

            .tier-badge {
                font-size: 0.65rem;
                padding: 2px 5px;
            }

            .user-menu-button {
                font-size: 0.7rem;
                padding: 3px 6px;
            }

            .dropdown-icon {
                font-size: 0.55rem;
            }

            .user-menu-dropdown {
                min-width: 220px;
                right: -8px;
            }

            .menu-item {
                padding: 6px 10px;
                font-size: 0.75rem;
            }

            .main-content {
                gap: 0;
            }

            .sidebar {
                position: fixed;
                top: 0;
                left: -100%;
                width: 85%;
                max-width: 320px;
                height: 100dvh;
                z-index: 999;
                transition: left 0.3s ease;
                margin-top: 0;
                box-shadow: 2px 0 8px rgba(0, 0, 0, 0.5);
            }

            .sidebar.open {
                left: 0;
            }

            .sidebar-overlay {
                display: none;
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: 100%;
                background-color: rgba(0, 0, 0, 0.6);
                z-index: 998;
            }

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

            .chat-container {
                width: 100%;
            }

            .chat-messages {
                padding: 8px;
            }

            .message {
                max-width: 100%;
                margin-bottom: 10px;
            }

            .message-content {
                padding: 7px 10px;
                font-size: 0.8rem;
            }

            .message-content p,
            .message-content li {
                font-size: 0.8rem;
                line-height: 1.4;
            }

            .message-content ul,
            .message-content ol {
                margin: 6px 0;
                padding-left: 16px;
            }

            .message-content li {
                margin-bottom: 3px;
            }

            .welcome-full {
                display: none;
            }

            .welcome-mobile {
                display: block;
            }

            .chat-input-container {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                padding: 7px;
                padding-bottom: calc(7px + env(safe-area-inset-bottom));
                background-color: #1a1a1a;
                border-top: 1px solid #333;
                z-index: 100;
            }

            .chat-messages {
                padding-bottom: calc(60px + env(safe-area-inset-bottom));
            }

            .input-wrapper {
                gap: 6px;
            }

            #chat-input {
                font-size: 0.8rem;
                padding: 7px 9px;
                min-height: 38px;
                line-height: 1.3;
            }

            #send-button {
                font-size: 0.8rem;
                padding: 7px 14px;
                height: 38px;
            }

            .sidebar-header h3 {
                font-size: 0.85rem;
            }

            .new-chat-button {
                font-size: 0.7rem;
                padding: 3px 7px;
            }

            .search-container {
                padding: 7px 10px;
            }

            .search-container input {
                font-size: 0.75rem;
                padding: 5px 8px;
            }

            .conversation-item {
                padding: 8px 10px;
            }

            .conversation-title {
                font-size: 0.8rem;
            }

            .conversation-preview {
                font-size: 0.7rem;
            }

            .conversation-date {
                font-size: 0.65rem;
            }

            .typing-indicator {
                padding: 6px 10px;
                max-width: 70px;
            }

            .example-prompts {
                padding: 12px;
                gap: 8px;
            }

            .example-prompt-header {
                font-size: 0.75rem;
            }

            .example-prompt {
                padding: 10px 12px;
                font-size: 0.8rem;
                line-height: 1.4;
            }
        }
