.login-section {
    margin-bottom: 15px;
}

.login-section input {
    width: 100%;
    padding: 6px;
    margin-bottom: 5px;
}

.login-section button {
    width: 100%;
    padding: 6px;
    background: #2563eb;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 4px;
}

.user-info {
    margin-top: 5px;
    font-size: 12px;
    color: #ccc;
}
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #fff;
}

/* Softer taps, consistent micro-interactions */
button,
a,
input,
textarea,
select,
.sidebar-toggle,
[role="button"] {
    -webkit-tap-highlight-color: transparent;
}

.layout {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 260px;
    background: #1f2937;
    color: white;
    padding: 20px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.sidebar h2 {
    margin-bottom: 15px;
}

.sidebar button {
    padding: 10px 14px;
    margin-bottom: 10px;
    border: none;
    background: #2563eb;
    color: white;
    cursor: pointer;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.22s ease, transform 0.12s ease, box-shadow 0.22s ease;
}

.sidebar button:active {
    transform: scale(0.98);
}

.section {
    margin-top: 15px;
}

.section h4 {
    margin-bottom: 5px;
    font-size: 14px;
}

.section ul {
    list-style: none;
    padding: 0;
    font-size: 13px;
}

.section li {
    background: #374151;
    padding: 5px;
    margin-bottom: 5px;
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section li button {
    font-size: 10px;
    padding: 2px 5px;
}

/* Chat list item: name + 3-dot menu (visible on hover) */
.chat-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

.section li.chat-list-item-active,
.chat-list-item.chat-list-item-active {
    background: rgba(37, 99, 235, 0.4);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.chat-name-wrap {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-name-text {
    cursor: pointer;
}

.chat-item-actions {
    flex-shrink: 0;
    position: relative;
}

.chat-menu-btn {
    opacity: 0;
    padding: 2px 6px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

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

.chat-menu-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.chat-menu-dropdown {
    display: block;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 2px;
    min-width: 100px;
    padding: 4px 0;
    background: #1f2937;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.chat-menu-dropdown.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.chat-menu-rename {
    display: block;
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: transparent;
    color: white;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}

.chat-menu-rename:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chat-name-edit {
    width: 100%;
    padding: 2px 4px;
    font-size: inherit;
    color: #1f2937;
    background: #fff;
    border: 1px solid #2563eb;
    border-radius: 4px;
    outline: none;
}

/* Document list items: name + remove cross (below upload) */
.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.doc-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-remove-btn {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 4px;
    background: rgba(220, 38, 38, 0.2);
    color: #fca5a5;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.doc-remove-btn:hover {
    background: #dc2626;
    color: #fff;
}

.sidebar .doc-remove-btn {
    background: rgba(220, 38, 38, 0.25);
    color: #fca5a5;
}

.sidebar .doc-remove-btn:hover {
    background: #dc2626;
    color: #fff;
}

/* Documents uploaded N - single toggle, expand to show list */
.documents-block {
    margin-top: 8px;
}

.company-doc-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.75);
    margin: 8px 0 0;
    line-height: 1.4;
}

.company-show-count-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
}

.company-show-count-wrap input[type="checkbox"] {
    cursor: pointer;
}

.company-doc-count-employee {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
}

.documents-toggle {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: inherit;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.documents-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.chat-docs-panel .documents-toggle {
    background: #fff;
    color: #334155;
    border-color: #e2e8f0;
}

.chat-docs-panel .documents-toggle:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.doc-list {
    list-style: none;
    padding: 0;
    margin: 4px 0 0 0;
    font-size: 13px;
    max-height: 180px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    transition: max-height 0.2s ease-out;
}

.doc-list-collapsed {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.doc-link {
    cursor: pointer;
    text-decoration: none;
    color: #93c5fd;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-link:hover {
    text-decoration: underline;
    color: #bfdbfe;
}

.chat-docs-list .doc-link {
    color: #2563eb;
}

.chat-docs-list .doc-link:hover {
    color: #1d4ed8;
}

.footer {
    margin-top: auto;
    font-size: 12px;
    padding-top: 10px;
    border-top: 1px solid #444;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* ----- Mobile: sidebar overlay and toggle ----- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-mobile-top {
    display: block;
}

.sidebar-mobile-auth {
    display: block;
}

.sidebar-close {
    display: none;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 300;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0 8px 0 0;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.12s ease;
}

.sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.04);
}

.sidebar-toggle:active {
    transform: scale(0.96);
}

.sidebar-toggle-icon {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 5px;
    width: 22px;
    height: 18px;
}

.sidebar-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    background: #64748b;
    border-radius: 1px;
}

.sidebar-toggle-dot {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    background: #2563eb;
    border-radius: 50%;
}

.sidebar-toggle:hover .sidebar-toggle-line {
    background: #475569;
}

@media (max-width: 768px) {
    .main {
        min-width: 0;
        overflow-x: hidden;
    }

    #mainChatPanel {
        min-width: 0;
        overflow-x: hidden;
    }

    .chat-container {
        min-width: 0;
    }

    .sidebar-overlay {
        display: block;
        pointer-events: none;
    }

    .layout.sidebar-open .sidebar-overlay {
        pointer-events: auto;
        opacity: 1;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        max-width: 85vw;
        z-index: 101;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: none;
    }

    .layout.sidebar-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.2);
    }

    .sidebar-toggle {
        display: flex !important;
    }

    .sidebar-mobile-top {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .sidebar-mobile-auth {
        flex: 1;
        min-width: 0;
    }

    .profile-section .login-btn {
        width: auto;
        max-width: 110px;
        padding: 8px 12px;
        min-height: 38px;
        font-size: 13px;
    }

    .sidebar-close {
        display: flex !important;
        flex-shrink: 0;
    }

    .layout.sidebar-open .sidebar-close {
        display: flex !important;
    }

    /* Mobile: always show 3-dot menu (hover doesn't work on touch) */
    .chat-list-item .chat-menu-btn {
        opacity: 1;
    }

    /* Mobile: chatbox always at bottom (same as after first message) */
    .chat-container:not(.has-messages) .input-box {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        align-self: stretch !important;
        max-width: none !important;
    }

    .chat-container:not(.has-messages) .start-prompt {
        margin-bottom: 8px;
    }

    /* Mobile: chatbox responsive – no overflow, Send button always visible */
    .chat-container-inner {
        padding-left: 10px;
        padding-right: 10px;
        min-width: 0;
    }

    .chat-container .input-box {
        padding: 12px 10px;
        gap: 8px;
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .chat-container .input-box input {
        min-width: 0;
        flex: 1;
    }

    .chat-container .input-box button {
        flex-shrink: 0;
        padding: 12px 14px;
        white-space: nowrap;
    }

    .chat-container.has-messages .input-box {
        padding: 12px 10px;
    }

    .chat-container .chat-header {
        padding: 6px 8px 6px;
        gap: 6px;
        min-width: 0;
        align-items: center;
        flex-wrap: nowrap;
    }

    .chat-container .chat-header .sidebar-toggle {
        align-self: center;
        flex-shrink: 0;
    }

    .chat-container .chat-header h3 {
        font-size: 0.7rem;
        font-weight: 600;
        min-width: 0;
        flex: 1;
        align-self: center;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        word-break: break-word;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    /* Chat Documents panel: small, right of DocuMind in same row */
    .chat-docs-panel {
        width: 65px;
        min-width: 65px;
        flex-shrink: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .chat-docs-panel-title {
        display: block !important;
        margin: 0 0 2px 0;
        font-size: 8px;
        font-weight: 600;
        color: #334155;
        line-height: 1.1;
    }

    .chat-docs-upload {
        display: block !important;
        width: 100%;
        font-size: 8px;
        margin-bottom: 2px;
        padding: 3px 4px;
        box-sizing: border-box;
        border-radius: 2px;
        border: 1px solid #e2e8f0;
        min-height: 22px;
    }

    .chat-docs-panel .chat-docs-toggle {
        display: block !important;
        width: 100%;
        font-size: 8px;
        padding: 3px 4px;
        text-align: center;
        border-radius: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 22px;
    }

    .chat-docs-panel .chat-docs-list {
        display: block;
        max-height: 80px;
        margin-top: 2px;
        font-size: 8px;
        border-radius: 4px;
        border: 1px solid #e2e8f0;
        background: #fff;
    }

    .chat-docs-panel .chat-docs-list.doc-list-collapsed {
        max-height: 0;
        overflow: hidden;
        margin: 0;
        padding: 0;
        border: none;
    }

    .chat-docs-panel .chat-docs-list li {
        padding: 4px 6px;
        font-size: 8px;
    }

    .chat-docs-mobile {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        position: relative;
        flex-shrink: 0;
    }

    .chat-docs-mobile-plus {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid #e2e8f0;
        background: #fff;
        color: #2563eb;
        font-size: 1.4rem;
        font-weight: 300;
        line-height: 1;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
        transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    }

    .chat-docs-mobile-plus:hover {
        background: #f8fafc;
        border-color: #2563eb;
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
    }

    .chat-docs-mobile-count {
        font-size: 11px;
        color: #64748b;
        margin-top: 4px;
        font-weight: 500;
    }

    .chat-docs-mobile-dropdown {
        display: block;
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        min-width: 160px;
        padding: 6px 0;
        background: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
        z-index: 50;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(-6px);
        transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    }

    .chat-docs-mobile-dropdown.open {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
    }

    .chat-docs-mobile-upload-btn {
        display: block;
        width: 100%;
        padding: 10px 14px;
        border: none;
        background: transparent;
        color: #334155;
        font-size: 13px;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
        transition: background 0.15s;
    }

    .chat-docs-mobile-upload-btn:hover {
        background: #f1f5f9;
    }
}

/* Desktop: hide mobile doc UI */
.chat-docs-mobile {
    display: none;
}

/* Same full-width layout at start and after 1st message */
#mainChatPanel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 0;
    padding: 0;
}

.chat-container {
    width: 100%;
    max-width: 100%;
    flex: 1;
    align-self: stretch;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    border: none;
    overflow: hidden;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-container-inner {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 28px 24px;
    transition: padding 0.35s ease;
}

/* Start view: header at top, empty area, input at bottom (same width as after message) */
.chat-container:not(.has-messages) .chat-header {
    flex-shrink: 0;
}
.chat-container:not(.has-messages) .chat-area {
    flex: 1;
    min-height: 0;
}
.chat-container:not(.has-messages) .start-spacer {
    display: none;
}
.chat-container.has-messages .start-spacer {
    display: none;
}

/* Hint text above chatbox: show only before first message (before + after login) */
.start-prompt {
    display: none;
    margin: 0 0 -30px 0;
    font: apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-align: center;
    font-size: 18px;
    color: #060707;
    max-width: 420px;
    align-self: center;
}
.chat-container:not(.has-messages) .start-prompt {
    display: block;
}
.chat-container.has-messages .start-prompt {
    display: none;
}

.chat-container-inner {
    padding: 0;
    justify-content: flex-start;
}

/* Start branding hidden so start screen matches chat layout (header + empty area + input) */
.start-branding {
    display: none;
}

.start-branding-title {
    margin: 0 0 8px 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #1e293b;
    letter-spacing: -0.02em;
}

.start-branding-tagline {
    margin: 0;
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.4;
}

/* Header: same at start and after — chat name left, Chat Documents right (like 2nd SS) */
.chat-container .chat-header {
    display: flex;
    /* align-items: flex-start; */
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px;
    background: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

/* Start view: input bar centered in mid screen with small width */
.chat-container:not(.has-messages) .chat-area {
    border: none;
    border-top: none;
}
.chat-container:not(.has-messages) .input-box {
    padding: 16px 20px;
    background: #fff;
    border-top: none;
    max-width: 680px;
    width: 100%;
    align-self: center;
    margin-top: 60px;
    margin-bottom: 220px;
    transition: max-width 0.4s cubic-bezier(0.4, 0, 0.2, 1), margin 0.35s ease, align-self 0.35s ease;
}
.chat-container:not(.has-messages) .input-box input {
    padding: 12px 16px;
    font-size: 0.9375rem;
    border-radius: 12px;
}
.chat-container:not(.has-messages) .input-box button {
    padding: 12px 20px;
    font-size: inherit;
    border-radius: 12px;
}

/* Input: same bar in both states, sits at bottom when has messages */
.input-box {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0 0 0;
    background: transparent;
    border: none;
    border-top: none;
    transition: padding 0.35s ease, border 0.35s ease, background 0.35s ease;
}

.chat-container .input-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9375rem;
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-container .input-box input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.chat-container .input-box input::placeholder {
    color: #94a3b8;
}

.chat-container .input-box button {
    padding: 12px 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-container .input-box button:hover {
    background: #1d4ed8;
}

.chat-container.has-messages .input-box {
    padding: 16px 20px;
    background: #fff;
    border-top: 1px solid #eee;
    max-width: none;
    align-self: stretch;
    margin-top: 0;
    margin-bottom: 0;
}

/* Chat area: no height at start, grows when has messages */
.chat-container .chat-area {
    flex: 0 0 0;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    transition: flex 0.35s ease, padding 0.35s ease;
}

.chat-container.has-messages .chat-area {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
}

.chat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 15px;
    background: white;
    border-bottom: 1px solid #ddd;
}

.chat-header h3 {
    margin: 0;
    flex: 1;
    min-width: 0;
    font-size: 1rem;
    font-weight: 600;
}

/* Chat Documents panel - upper right, plain (no box lines) */
.chat-docs-panel {
    flex-shrink: 0;
    width: 200px;
    padding: 12px;
    background: transparent;
    border: none;
    border-radius: 0;
}

.chat-docs-panel-title {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
}

.chat-docs-upload {
    width: 100%;
    font-size: 12px;
    margin-bottom: 8px;
}

.chat-docs-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 12px;
    max-height: 120px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    transition: max-height 0.2s ease-out;
}

.chat-docs-list.doc-list-collapsed {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.chat-docs-list li {
    padding: 4px 8px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    color: #475569;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.chat-docs-list .doc-remove-btn {
    background: #fee2e2;
    color: #dc2626;
}

.chat-docs-list .doc-remove-btn:hover {
    background: #dc2626;
    color: #fff;
}

.chat-area {
    flex: 1;
    min-height: 0;
    padding: 20px;
    overflow-y: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.message-row {
    animation: messageRowIn 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message {
    max-width: 60%;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.user {
    background: #dbeafe;
    align-self: flex-end;
}

.bot {
    background: white;
    border: 1px solid #ccc;
}

.message.typing-indicator {
    font-style: italic;
    color: #6b7280;
}

.input-box {
    display: flex;
    padding: 15px;
    background: white;
    border-top: 1px solid #ddd;
}

.input-box input {
    flex: 1;
    padding: 10px;
}

.input-box button {
    padding: 10px;
    background: #2563eb;
    color: white;
    border: none;
}
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
}

.login-btn {
    padding: 8px;
    background: #2563eb;
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 5px;
    width: 100%;
}

.popup {
    position: fixed;
    inset: 0;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    background: rgba(0, 0, 0, 0.45);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.28s;
}
.popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.popup .popup-box {
    transform: scale(0.94) translateY(16px);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.34, 1.15, 0.64, 1), opacity 0.28s ease;
}
.popup.is-open .popup-box {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.popup-box {
    position: relative;
    background: #fff;
    border-radius: 8px;
    width: 100%;
    max-width: 320px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Login modal — simple professional layout */
.login-popup-box {
    padding: 0;
    max-width: 320px;
}

.login-popup-icon-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.12s ease;
}

.login-popup-icon-close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.login-popup-icon-close:active {
    transform: scale(0.96);
}

.login-popup-hero {
    padding: 20px 20px 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    text-align: center;
}

.login-popup-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 auto 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #fff;
    background: #2563eb;
}

.login-popup-brand-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: #212529;
}

.login-popup-brand-line {
    margin: 4px 0 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #6c757d;
}

.login-popup-body {
    padding: 16px 20px 20px;
}

.login-popup-step-label {
    margin: 0 0 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.login-popup-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.login-choice-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    text-align: left;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.login-choice-card:hover {
    border-color: #2563eb;
    background: #f8f9fa;
}

.login-choice-card:active {
    background: #e9ecef;
}

.login-choice-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: #2563eb;
    background: #e7f3ff;
}

.login-choice-icon--company {
    color: #0d9488;
    background: #e6fffa;
}

.login-choice-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.login-choice-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #212529;
}

.login-choice-desc {
    font-size: 0.75rem;
    line-height: 1.3;
    color: #6c757d;
}

.login-choice-chevron {
    flex-shrink: 0;
    font-size: 1.25rem;
    font-weight: 300;
    color: #94a3b8;
    line-height: 1;
}

.login-step2-heading {
    margin: 0 0 6px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: #212529;
}

.login-step2-hint {
    margin: 0 0 16px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #6c757d;
}

.login-field-label {
    display: block;
    margin: 0 0 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

#loginStep1,
#loginStep2 {
    animation: loginStepFade 0.28s ease;
}
@keyframes loginStepFade {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popup-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 16px;
    padding: 6px 10px 6px 4px;
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    color: #64748b;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.popup-back-icon {
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.85;
}

.popup-back-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.login-popup-input {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 0.875rem;
    color: #212529;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: #fff;
    transition: border-color 0.2s ease;
}

.login-popup-input::placeholder {
    color: #adb5bd;
}

.login-popup-input:hover {
    border-color: #ced4da;
}

.login-popup-input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.login-popup-input--otp {
    letter-spacing: 0.35em;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.popup-email-login-btn {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.2s ease;
}

.popup-email-login-btn:hover:not(:disabled) {
    background: #1d4ed8;
}

.popup-email-login-btn:active:not(:disabled) {
    background: #0d4ed8;
}

.popup-email-login-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    box-shadow: none;
}

.login-popup-or {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
}
.login-popup-or-line {
    flex: 1;
    height: 1px;
    background: #dee2e6;
}
.login-popup-or-text {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
}

.popup-google-btn,
.profile-section .google-login-btn {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.popup-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    background: #fff;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.popup-google-btn:hover {
    background: #f8f9fa;
    border-color: #ced4da;
}

.popup-google-btn:active {
    background: #e9ecef;
}

.popup-google-icon {
    display: inline-flex;
    flex-shrink: 0;
}
.popup-google-icon svg {
    display: block;
}

.login-otp-section {
    margin-top: 16px;
    padding: 14px;
    border-radius: 6px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.login-otp-msg {
    margin: 0 0 12px;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #495057;
}

.login-otp-section .login-field-label {
    margin-top: 4px;
}

.login-otp-section .login-popup-input {
    margin-bottom: 12px;
    background: #fff;
}

@media (max-width: 420px) {
    .login-popup-hero {
        padding: 24px 44px 20px 20px;
    }

    .login-popup-body {
        padding: 18px 16px 22px;
    }

    .login-choice-card {
        padding: 12px 14px;
    }

    .login-choice-icon {
        width: 40px;
        height: 40px;
    }
}

.user-info {
    font-size: 12px;
    margin-top: 5px;
    color: #ccc;
}
/* ---------- PROFILE SECTION ---------- */
.profile-section {
    position: relative;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Login button: same slot and style as profile trigger (after login) */
.profile-section .login-btn {
    width: 100%;
    padding: 10px 14px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 10px;
    background: #2563eb;
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-section .login-btn:hover {
    background: #1d4ed8;
}

.profile-section .login-btn:active {
    transform: scale(0.98);
}

.profile-section .google-login-btn {
    margin-top: 8px;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
}
.profile-section .google-login-btn:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.profile-box {
    position: relative;
    display: block;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    cursor: pointer;
    color: inherit;
    font: inherit;
    text-align: left;
    transition: background 0.2s, border-color 0.2s;
}

.profile-trigger:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

.profile-img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.profile-info {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.profile-name {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #e5e7eb;
}

.profile-chevron {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.profile-box.open .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown {
    display: block;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    color: #111827;
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    border: 1px solid #e5e7eb;
    z-index: 100;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-6px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
}

.profile-box.open .profile-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
    background: transparent;
    color: #374151;
}

.profile-dropdown-item:last-child {
    margin-bottom: 0;
}

.profile-dropdown-item:hover {
    background: #f3f4f6;
}

.upload-label {
    cursor: pointer;
    font-weight: 500;
    box-sizing: border-box;
}

.upload-label input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

.profile-logout {
    color: #dc2626;
    font-weight: 500;
}

.profile-logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.profile-user-id-line {
    padding: 8px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 12px;
    color: #374151;
}
.profile-user-id-label {
    margin-right: 6px;
    color: #6b7280;
}
.profile-user-id-value {
    font-weight: 600;
    font-family: monospace;
}

/* ---------- ADMIN DATABASE VIEW ---------- */
.admin-db-btn {
    width: 100%;
    padding: 8px;
    margin-bottom: 5px;
    background: #374151;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
}
.admin-db-btn:hover {
    background: #4b5563;
}
.admin-db-btn:active {
    transform: scale(0.98);
}

.database-view {
    flex: 1;
    min-height: 0;
    padding: 20px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: databaseViewIn 0.32s ease;
}
@keyframes databaseViewIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.database-view-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.database-view-header h3 {
    margin: 0;
}
.back-to-chat-btn {
    padding: 8px 14px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.12s ease;
}
.back-to-chat-btn:hover {
    background: #1d4ed8;
}
.back-to-chat-btn:active {
    transform: scale(0.98);
}
.admin-add-admin {
    flex-shrink: 0;
    margin-bottom: 20px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 8px;
}
.admin-add-admin h4 {
    margin-top: 0;
    margin-bottom: 10px;
}
.admin-add-admin input {
    padding: 6px 10px;
    margin-right: 8px;
    width: 220px;
}
.admin-add-admin button {
    padding: 6px 12px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.admin-list-label {
    margin: 10px 0 0;
    font-size: 13px;
    color: #4b5563;
}
.admin-list-toggle {
    display: block;
    width: 10%;
    margin-top: 10px;
    padding: 8px 10px;
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: #e5e7eb;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.admin-list-toggle:hover {
    background: #d1d5db;
    border-color: #9ca3af;
}
.admin-list-with-remove .admin-list-ul.admin-list-dropdown {
    list-style: none;
    padding: 8px 0 0;
    margin: 4px 0 0;
}
.admin-list-with-remove .admin-list-ul.admin-list-dropdown .admin-list-li {
    margin-bottom: 8px;
}
.admin-list-empty {
    color: #6b7280;
    font-size: 13px;
}
.admin-list-li {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.admin-remove-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.admin-remove-btn:hover {
    background: #b91c1c;
}
.db-search-wrap {
    flex-shrink: 0;
    margin-bottom: 10px;
}
.db-search-input {
    width: 100%;
    max-width: 320px;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}
.database-tables {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.db-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.db-tab {
    padding: 8px 14px;
    background: #e5e7eb;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease, transform 0.1s ease;
}
.db-tab:hover {
    background: #d1d5db;
}
.db-tab:active {
    transform: scale(0.98);
}
.db-tab.active {
    background: #2563eb;
    color: white;
}
.db-table-content {
    overflow: auto;
    flex: 1;
    min-height: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}
.db-doc-link {
    color: #2563eb;
    text-decoration: none;
}
.db-doc-link:hover {
    text-decoration: underline;
}
.db-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.db-table th,
.db-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}
.db-table th {
    background: #f3f4f6;
    font-weight: 600;
}
.db-empty {
    padding: 20px;
    color: #6b7280;
}


/* Chat list loader */
.chat-list-loading {
    display: flex;
    gap: 6px;
    padding: 12px 8px;
    align-items: center;
    justify-content: center;
    list-style: none;
}

/* Chat area loader */
.chat-area-loading {
    display: flex;
    gap: 8px;
    padding: 40px;
    align-items: center;
    justify-content: center;
}

/* Loader dots */
.chat-loader-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4f8ef7;
    display: inline-block;
    animation: chatLoaderBounce 1.2s infinite ease-in-out;
}
.chat-loader-dot:nth-child(1) { animation-delay: 0s; }
.chat-loader-dot:nth-child(2) { animation-delay: 0.2s; }
.chat-loader-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatLoaderBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---------- In-app toasts (replaces browser alert) ---------- */
.toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
    left: auto;
    bottom: auto;
    z-index: 10050;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: calc(100vw - 32px);
    width: min(400px, 100%);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    box-sizing: border-box;
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font-size: 0.9375rem;
    line-height: 1.45;
    box-shadow:
        0 10px 40px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(15, 23, 42, 0.06);
    pointer-events: auto;
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 0.28s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.toast--visible {
    opacity: 1;
    transform: translateX(0);
}

.toast.toast--out {
    opacity: 0;
    transform: translateX(8px);
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    display: block;
    width: 22px;
    height: 22px;
}

.toast-message {
    flex: 1;
    min-width: 0;
}

.toast-dismiss {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    margin: -4px -6px -4px 0;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.toast-dismiss:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #475569;
}

.toast--success {
    border-left: 4px solid #10b981;
}

.toast--success .toast-icon {
    color: #059669;
}

.toast--error {
    border-left: 4px solid #ef4444;
}

.toast--error .toast-icon {
    color: #dc2626;
}

.toast--warning {
    border-left: 4px solid #f59e0b;
}

.toast--warning .toast-icon {
    color: #d97706;
}

.toast--info {
    border-left: 4px solid #3b82f6;
}

.toast--info .toast-icon {
    color: #2563eb;
}

/* ---------- Custom confirm (replaces browser confirm) ---------- */
.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 10040;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
}

.confirm-dialog.hidden {
    display: none;
}

.confirm-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.confirm-dialog-box {
    position: relative;
    width: 100%;
    max-width: 400px;
    padding: 24px;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.confirm-dialog-message {
    margin: 0 0 20px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #334155;
}

.confirm-dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.confirm-dialog-btn {
    padding: 10px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s, transform 0.12s;
}

.confirm-dialog-btn:active {
    transform: scale(0.98);
}

.confirm-dialog-cancel {
    background: #f1f5f9;
    color: #475569;
    border-color: #e2e8f0;
}

.confirm-dialog-cancel:hover {
    background: #e2e8f0;
}

.confirm-dialog-btn--primary {
    background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

.confirm-dialog-btn--primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}

.confirm-dialog-btn--danger {
    background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, 0.35);
}

.confirm-dialog-btn--danger:hover:not(:disabled) {
    background: linear-gradient(180deg, #dc2626 0%, #b91c1c 100%);
}

@media (max-width: 480px) {
    .toast-container {
        left: max(16px, env(safe-area-inset-left));
        right: max(16px, env(safe-area-inset-right));
        width: auto;
        align-items: stretch;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .chat-area,
    .sidebar,
    .doc-list,
    .chat-docs-list,
    .db-table-content {
        scroll-behavior: auto;
    }
    .message-row {
        animation: none;
    }
    #loginStep1,
    #loginStep2 {
        animation: none;
    }
    .database-view {
        animation: none;
    }
    .popup {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
    .popup,
    .popup .popup-box {
        transition: none;
    }
    .profile-dropdown,
    .chat-menu-dropdown {
        transition: none;
    }
    .chat-docs-mobile-dropdown {
        transition: none;
    }
    .toast {
        transition: none;
    }
    .toast.toast--visible,
    .toast.toast--out {
        transform: none;
    }
    .confirm-dialog-backdrop {
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
    }
}
