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

body {
    background-color: #212121;
    color: #ececec;
    font-family: 'Söhne', 'ui-sans-serif', 'system-ui', -apple-system, sans-serif;
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

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

/* ── Sidebar ── */
.sidebar {
    width: 260px;
    background-color: #171717;
    display: flex;
    flex-direction: column;
    padding: 8px;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    z-index: 100;
}

/* ── Sidebar top ── */
.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    margin-bottom: 4px;
}

.sidebar-logo {
    font-size: 16px;
    font-weight: 700;
    color: #ff4444;
    letter-spacing: -0.3px;
}

.icon-btn {
    background: none;
    border: none;
    color: #8e8ea0;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.icon-btn:hover {
    background-color: #2a2a2a;
    color: #ececec;
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    color: #ececec;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    text-align: left;
    transition: background 0.15s;
}

.new-chat-btn:hover {
    background-color: #2a2a2a;
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #8e8ea0;
    padding: 12px 12px 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-footer:hover {
    background-color: #2a2a2a;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: #ff4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-name {
    font-size: 14px;
    color: #ececec;
}

/* ── Main area ── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    min-width: 0;
}

/* ── Mobile top bar ── */
.mobile-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

.mobile-topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: #ff4444;
}

/* ── Welcome screen ── */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    padding: 24px;
}

.welcome-screen h1 {
    font-size: 26px;
    font-weight: 700;
    color: #ececec;
    text-align: center;
}

.suggestion-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
    max-width: 600px;
}

.chip {
    background-color: #2f2f2f;
    border: 1px solid #3a3a3a;
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.chip:hover {
    background-color: #3a3a3a;
}

.chip-title {
    font-size: 14px;
    font-weight: 500;
    color: #ececec;
    margin-bottom: 3px;
}

.chip-sub {
    font-size: 12px;
    color: #8e8ea0;
}

/* ── Chat window ── */
.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0 8px;
    display: none;
    flex-direction: column;
}

.chat-window.active {
    display: flex;
}

.message-row {
    padding: 8px 0;
    display: flex;
    justify-content: center;
}

.message-inner {
    width: 100%;
    max-width: 680px;
    padding: 0 24px;
}

.message-row.user .message-inner {
    display: flex;
    justify-content: flex-end;
}

.message-row.user .bubble {
    background-color: #2f2f2f;
    padding: 12px 18px;
    border-radius: 18px 18px 4px 18px;
    max-width: 75%;
    font-size: 15px;
    line-height: 1.6;
}

.message-row.assistant .message-inner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.avatar {
    width: 28px;
    height: 28px;
    background-color: #ff4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    margin-top: 2px;
}

.message-row.assistant .bubble {
    font-size: 15px;
    line-height: 1.75;
    color: #ececec;
}

.message-row.assistant .bubble p {
    margin-bottom: 12px;
}

.message-row.assistant .bubble p:last-child {
    margin-bottom: 0;
}

.bubble.typing {
    color: #8e8ea0;
    font-style: italic;
}

/* ── Input area ── */
.input-area {
    padding: 12px 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.main.welcome-mode {
    justify-content: flex-start;
}

.main.welcome-mode .welcome-screen {
    flex: 1;
    justify-content: center;
}

.main.welcome-mode .input-area {
    padding-bottom: 24px;
}

.input-box {
    width: 100%;
    max-width: 680px;
    background-color: #2f2f2f;
    border: 1px solid #3a3a3a;
    border-radius: 16px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: border-color 0.2s;
}

.input-box:focus-within {
    border-color: #666;
}

#userInput {
    background: none;
    border: none;
    outline: none;
    color: #ececec;
    font-size: 15px;
    resize: none;
    width: 100%;
    max-height: 180px;
    line-height: 1.6;
    font-family: inherit;
    padding: 4px 4px 0;
}

#userInput::placeholder {
    color: #8e8ea0;
}

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

.input-left-actions {
    display: flex;
    gap: 4px;
}

.action-btn {
    background: none;
    border: 1px solid #3a3a3a;
    border-radius: 20px;
    color: #8e8ea0;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s, color 0.15s;
}

.action-btn:hover {
    background-color: #3a3a3a;
    color: #ececec;
}

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

#sendBtn {
    background-color: #ececec;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

#sendBtn:hover {
    background-color: #ccc;
}

#sendBtn:disabled {
    background-color: #444;
    cursor: not-allowed;
}

#sendBtn svg {
    width: 15px;
    height: 15px;
    fill: #212121;
}

#sendBtn:disabled svg {
    fill: #666;
}

.input-footer {
    font-size: 12px;
    color: #555;
    text-align: center;
}

/* ── Typing cursor ── */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 16px;
    background-color: #ececec;
    margin-left: 2px;
    vertical-align: middle;
    animation: blink 0.7s step-end infinite;
}

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

/* ── Scrollbar ── */
.chat-window::-webkit-scrollbar { width: 6px; }
.chat-window::-webkit-scrollbar-track { background: transparent; }
.chat-window::-webkit-scrollbar-thumb { background: #3a3a3a; border-radius: 3px; }

/* ── Mobile styles ── */
@media (max-width: 768px) {

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
    }

    .main.welcome-mode .input-area {
        margin-top: -20px;
    }

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

    .mobile-topbar {
        display: flex;
    }

     .welcome-screen {
        padding: 16px 28px;
        gap: 16px;
    }

    .welcome-screen h1 {
        font-size: 20px;
    }

    .suggestion-chips {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chip {
        padding: 12px 14px;
    }

    .chip-sub {
        display: none;
    }

    .input-area {
        padding: 0px 30px 30px;
    }

    .message-inner {
        padding: 0 30px;
    }

    .message-row.user .bubble {
        max-width: 88%;
        font-size: 14px;
    }

    .message-row.assistant .bubble {
        font-size: 14px;
    }

    .action-btn span {
        display: none;
    }

    .main.welcome-mode {
        justify-content: flex-start;
        padding-top: 0;
    }

    .main.welcome-mode .welcome-screen {
        flex: 1;
        justify-content: center;
    }

    .sidebar-logo-img {
        height: 40px;
        width: auto;
        display: block;
    }

    .mobile-topbar-logo {
        height: 40px;
        width: auto;
        display: block;
    }
}

/* ── Conversation top bar ── */
.conv-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 12px 20px;
    flex-shrink: 0;
    justify-content: flex-start;
}

.conv-title {
    font-size: 15px;
    font-weight: 600;
    color: #ececec;
}

.upgrade-btn {
    background: none;
    border: 1px solid #3a3a3a;
    color: #ececec;
    font-size: 13px;
    padding: 6px 18px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.upgrade-btn:hover {
    background-color: #2a2a2a;
    border-color: #666;
}

/* ── Upgrade banner ── */
.upgrade-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background-color: #ff4444;
    color: white;
    font-size: 14px;
    padding: 12px 20px;
}

.upgrade-banner.active {
    display: flex;
    animation: slideDown 0.25s ease;
}

.upgrade-banner-close {
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
    flex-shrink: 0;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.upgrade-banner-close:hover {
    opacity: 1;
}

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

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

/* ── Conversation list ── */
.conversation-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
    flex: 1;
}

.conv-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    color: #ececec;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.15s;
    margin-left: 20px;
}

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

.conv-item.active {
    background-color: #2f2f2f;
}

@media (min-width: 769px) {
    .conv-item {
        margin-left: 40px;
        font-size: 11px;
    }
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #2f2f2f;
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #3a3a3a;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: #ececec;
}

.modal-close {
    background: none;
    border: none;
    color: #8e8ea0;
    font-size: 18px;
    cursor: pointer;
    transition: color 0.15s;
}

.modal-close:hover {
    color: #ececec;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    color: #8e8ea0;
}

.form-group input,
.form-group textarea {
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 10px 14px;
    color: #ececec;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    resize: none;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: #666;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #555;
}

.contact-submit-btn {
    background-color: #ff4444;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.contact-submit-btn:hover {
    background-color: #cc3333;
}

#contactStatus {
    font-size: 13px;
    min-height: 18px;
}

/* ── Share buttons ── */
.share-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.share-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid #3a3a3a;
    border-radius: 20px;
    color: #8e8ea0;
    font-size: 12px;
    padding: 4px 12px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.share-btn:hover {
    background-color: #2a2a2a;
    color: #ececec;
    border-color: #666;
}

.message-row.assistant .message-inner {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.bubble-wrap {
    display: flex;
    flex-direction: column;
    flex: 1;
}