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

    body {
        font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
        background: #0f0f0f;
        color: #ffffff;
        height: 100vh;
        overflow: hidden;
    }

    /* ---------- Light theme ---------- */
    body.light {
        background: #ffffff;
        color: #111;
    }

    body.light .sidebar,
    body.light .chat-header,
    body.light .input-area,
    body.light .modal-content {
        background: #f5f5f5;
        border-color: #ddd;
    }

    body.light .message.assistant .message-content {
        background: #f0f0f0;
        border-color: #ccc;
    }

    body.light .chat-item.active {
        background: #e0e0e0;
    }

    body.light .credits-badge {
        background: #DABB88;
        color: #fff;
    }

    /* ---------- Light theme overrides ---------- */
    body.light .modal-content {
        background: #ffffff;
        border-color: #e0e0e0;
        color: #111;
    }

    body.light .form-group input,
    body.light .form-group select,
    body.light .message-input {
        background: #ffffff;
        border: 1px solid #ccc;
        color: #111;
    }

    body.light .btn-secondary {
        background: #e0e0e0;
        color: #111;
    }

    body.light table th,
    body.light table td {
        border-bottom: 1px solid #ddd;
        color: #111;
    }

    body.light .sortable li {
        background: #f5f5f5;
        border: 1px solid #ccc;
        color: #111;
    }

    body.light .settings-btn {
        color: #111;
        /* dark icon for light background */
    }

    .app-container {
        display: flex;
        height: 100vh;
    }

    /* Sidebar Styles */
    .sidebar {
        width: 280px;
        background: #1a1a1a;
        border-right: 1px solid #333;
        display: flex;
        flex-direction: column;
        transition: transform 0.3s ease;
    }

    .sidebar-header {
        padding: 20px;
        /* border-bottom: 1px solid #333; */
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .logo {
        font-size: 20px;
        font-weight: bold;
        color: #DABB88;
        text-align: center;
    }

    .credits-badge {
        background: #DABB88;
        color: #000;
        padding: 8px 15px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: bold;
        width: 100%;
        text-align: center;
        display: block;
    }

    .sidebar-footer {
        padding: 20px;
        border-top: 1px solid #333;
    }

    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: 10px;
    }

    .new-chat-btn {
        width: 100%;
        padding: 12px;
        background: #DABB88;
        color: #000;
        border: none;
        border-radius: 8px;
        font-size: 14px;
        cursor: pointer;
        margin-bottom: 20px;
        font-weight: bold;
    }

    .chat-groups {
        margin-bottom: 20px;
    }

    .group-title {
        font-size: 12px;
        color: #888;
        margin-bottom: 10px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .chat-item {
        padding: 10px;
        margin-bottom: 5px;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.2s;
        font-size: 14px;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .chat-item-main {
        flex: 1;
        overflow: hidden;
    }

    .delete-chat-btn {
        background: none;
        border: none;
        color: #888;
        font-size: 14px;
        cursor: pointer;
        padding: 5px;
        opacity: 0;
        transition: opacity 0.2s;
    }

    .chat-item:hover .delete-chat-btn {
        opacity: 1;
    }

    .delete-chat-btn:hover {
        color: #DABB88;
    }

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

    .chat-item.active {
        background: #2a2a2a;
        border-left: 3px solid #DABB88;
    }

    .chat-item-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .chat-item-time {
        font-size: 11px;
        color: #666;
        margin-top: 2px;
    }

    /* Main Chat Area */
    .main-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    .chat-header {
        padding: 10px;
        background: #1a1a1a;
        /* border-bottom: 1px solid #333; */
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .hero-llmsage {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: #666;
        text-align: center;
    }

    .hero-llmsage img {
        width: 220px;
        /* keep it subtle */
        height: auto;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .hero-llmsage h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }

    .hero-llmsage p {
        font-size: 15px;
    }

    .model-selector {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .model-btn {
        padding: 8px 16px;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 20px;
        color: #fff;
        cursor: pointer;
        font-size: 13px;
        transition: all 0.2s;
    }

    .model-btn.active {
        background: #DABB88;
        color: #000;
        border-color: #DABB88;
    }

    .chat-window {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        scroll-behavior: smooth;
    }

    .message {
        margin-bottom: 20px;
        animation: fadeIn 0.3s ease;
    }

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

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .message.user {
        text-align: right;
    }

    .message-content {
        display: inline-block;
        max-width: 70%;
        padding: 15px;
        border-radius: 12px;
        word-wrap: break-word;
        line-height: 1.5;
    }

    .message.user .message-content {
        background: #DABB88;
        color: #000;
    }

    .message.assistant .message-content {
        background: #2a2a2a;
        border: 1px solid #444;
    }

    .message-content pre {
        background: #1a1a1a;
        padding: 10px;
        border-radius: 5px;
        overflow-x: auto;
        margin: 10px 0;
        color: #f0f0f0;
    }

    .message-content code {
        background: #1a1a1a;
        padding: 2px 6px;
        border-radius: 3px;
        font-family: 'Courier New', monospace;
        color: #f0f0f0;
    }

    .message-content img,
    .message-content video {
        max-width: 100%;
        border-radius: 8px;
        margin: 10px 0;
    }

    .input-area {
        padding: 20px;
        background: #1a1a1a;
        /* border-top: 1px solid #333; */
    }

    .input-container {
        display: flex;
        gap: 10px;
        align-items: end;
    }

    .message-input {
        flex: 1;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 8px;
        padding: 12px 16px;
        color: #fff;
        font-size: 15px;
        resize: none;
        max-height: 120px;
        min-height: 44px;
        font-family: inherit;
    }

    .message-input:focus {
        outline: none;
        border-color: #DABB88;
    }

    /* --- Pipeline Builder --- */
    .pipeline-container {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 20px;
        background: #1e1e1e;
        border-radius: 8px;
        overflow-x: auto;
    }

    #pipelineList {
        display: flex;
        gap: 10px;
        list-style-type: none;
        padding: 0;
        margin: 0;
    }

    .pipeline-node,
    #pipelineList li {
        padding: 10px 20px;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 8px;
        white-space: nowrap;
        position: relative;
        cursor: grab;
    }

    .pipeline-node.static {
        background: #DABB88;
        color: #000;
        font-weight: bold;
        cursor: default;
    }

    #pipelineList li:active {
        cursor: grabbing;
    }

    /* Ensure pipeline steps are clearly visible */
    #pipelineList li.pipeline-step {
        background: #3a3a3a;
        border: 1px solid #777;
        color: #fff;
        font-weight: 600;
    }

    body.light #pipelineList li.pipeline-step {
        background: #f5f5f5;
        border: 1px solid #bbb;
        color: #111;
    }

    .pipeline-node:not(:last-child)::after,
    #pipelineList li:not(:last-child)::after {
        content: '→';
        position: absolute;
        right: -15px;
        top: 50%;
        transform: translateY(-50%);
        color: #888;
        font-size: 20px;
    }

    .send-btn {
        background: #DABB88;
        color: #000;
        border: none;
        border-radius: 8px;
        padding: 12px 20px;
        cursor: pointer;
        font-size: 16px;
        transition: all 0.2s;
    }

    .send-btn:hover:not(:disabled) {
        background: #00b897;
    }

    .send-btn:disabled {
        background: #444;
        cursor: not-allowed;
    }

    /* Modal Styles */
    .modal {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.8);
        z-index: 1000;
        animation: fadeIn 0.3s ease;
    }

    .modal-content {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #1a1a1a;
        border-radius: 12px;
        padding: 40px;
        width: 90%;
        max-width: 400px;
        border: 1px solid #333;
    }

    .modal-header {
        font-size: 24px;
        margin-bottom: 20px;
        text-align: center;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-group label {
        display: block;
        margin-bottom: 8px;
        font-size: 14px;
        color: #ccc;
    }

    .form-group input {
        width: 100%;
        padding: 12px;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 8px;
        color: #fff;
        font-size: 15px;
    }

    .form-group input:focus {
        outline: none;
        border-color: #DABB88;
    }

    .form-actions {
        display: flex;
        gap: 10px;
        margin-top: 30px;
    }

    .btn {
        /* flex: 1; */
        padding: 12px;
        border: none;
        border-radius: 8px;
        font-size: 15px;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-primary {
        background: #DABB88;
        color: #000;
    }

    .btn-secondary {
        background: #444;
        color: #fff;
    }

    .btn:hover {
        opacity: 0.9;
    }

    /* Inline warning text within modals */
    .warning-text {
        color: #ffb84d;
        font-size: 13px;
    }

    /* Loading Animation */
    .typing-indicator {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        padding: 15px;
        /* background: #2a2a2a; */
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .typing-indicator span {
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #888;
        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);
        }

        30% {
            transform: translateY(-10px);
        }
    }

    /* Responsive */
    .menu-toggle {
        display: none;
        background: none;
        border: none;
        color: #fff;
        font-size: 24px;
        cursor: pointer;
    }

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

        .sidebar.active {
            transform: translateX(0);
        }

        .menu-toggle {
            display: block;
        }

        .message-content {
            max-width: 90%;
        }
    }

    .settings-btn {
        background: none;
        border: none;
        color: #fff;
        font-size: 20px;
        cursor: pointer;
        padding: 5px;
    }

    /* Settings extras */
    .sortable li {
        padding: 6px 10px;
        margin: 4px 0;
        background: #2a2a2a;
        border: 1px solid #444;
        border-radius: 6px;
        cursor: grab;
    }

    .sortable li:active {
        cursor: grabbing;
    }

    table th,
    table td {
        padding: 8px;
        border-bottom: 1px solid #444;
        text-align: left;
    }

    /* --- Profile Menu --- */
    .profile-menu-container {
        position: relative;
        display: inline-block;
    }

    .profile-btn {
        background: none;
        border: none;
        cursor: pointer;
        padding: 0;
        border-radius: 50%;
    }

    .profile-btn img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 2px solid #DABB88;
    }

    .profile-dropdown {
        display: none;
        position: absolute;
        right: 0;
        top: 50px;
        background-color: #1a1a1a;
        min-width: 160px;
        box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
        z-index: 1;
        border-radius: 8px;
        border: 1px solid #333;
        overflow: hidden;
    }

    .profile-dropdown.active {
        display: block;
    }

    .profile-dropdown a {
        color: #fff;
        padding: 12px 16px;
        text-decoration: none;
        display: block;
        font-size: 14px;
    }

    .profile-dropdown a:hover {
        background-color: #2a2a2a;
    }

    /* --- Billing Modal --- */
    .billing-info {
        padding: 10px;
        background: #2a2a2a;
        border-radius: 8px;
        margin-bottom: 20px;
        text-align: center;
        font-size: 16px;
        color: #fff;
    }

    .billing-summary {
        padding: 15px;
        border: 1px solid #444;
        border-radius: 8px;
        margin-bottom: 20px;
    }

    .billing-summary p {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;
    }

    .billing-summary hr {
        border: none;
        border-top: 1px solid #444;
        margin: 10px 0;
    }

    /* --- Mode Switcher --- */
    .mode-switcher-container {
        margin-right: 15px;
    }

    .mode-switcher {
        background-color: #2a2a2a;
        color: #fff;
        border: 1px solid #444;
        border-radius: 8px;
        padding: 8px 12px;
        font-size: 14px;
        cursor: pointer;
    }

    .mode-switcher:focus {
        outline: none;
        border-color: #DABB88;
    }

    /* Override arrow glyph for pipeline flow */
    .pipeline-node:not(:last-child)::after,
    #pipelineList li:not(:last-child)::after {
        content: '→';
    }
