﻿.gpt-chat,
.gpt-chat * {
    box-sizing: border-box;
}

/* Code block styling with copy button */
.code-block {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #f8fafc;
    margin: 12px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.code-block pre {
    margin: 0;
    padding: 12px 14px;
    overflow: auto;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #eef2f7;
    color: #475569;
    font-size: 12px;
    padding: 6px 10px;
    border-bottom: 1px solid #e5e7eb;
}

.code-lang {
    font-weight: 600;
    letter-spacing: .02em;
}

.code-copy {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.code-copy:hover { background: #f1f5f9; }
.code-copy.copied { background: #dcfce7; border-color: #86efac; color: #166534; }

.chat-app,
.chat-embed {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.chat-app {
    display: flex;
    height: 100vh;
    background-color: #ffffff;
    color: #343541;
}

.chat-embed {
    position: relative;
    width: 100%;
    height: 100%;
    background-color: #ffffff;
    display: flex;
    flex-direction: column;
}

.sidebar {
    width: 260px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e5e5e5;
    flex-shrink: 0;
    transition: width 0.3s ease, transform 0.3s ease;
    overflow: hidden;
}

.sidebar .offcanvas-body {
    min-width: 260px;
}

@media (min-width: 768px) {
    .sidebar.offcanvas-md {
        width: 260px !important;
    }
    
    .chat-app.sidebar-collapsed .sidebar {
        width: 52px !important;
        border-right: 1px solid #e5e5e5;
        overflow: hidden;
    }

    .chat-app.sidebar-collapsed .sidebar .offcanvas-body {
        min-width: 52px;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .chat-app.sidebar-collapsed .sidebar-label,
    .chat-app.sidebar-collapsed .sidebar-section-title,
    .chat-app.sidebar-collapsed .history-title,
    .chat-app.sidebar-collapsed .history-delete,
    .chat-app.sidebar-collapsed .application-app-text,
    .chat-app.sidebar-collapsed .user-info .details {
        display: none !important;
    }

    .chat-app.sidebar-collapsed .sidebar .btn-new,
    .chat-app.sidebar-collapsed .application-app-item,
    .chat-app.sidebar-collapsed .sidebar-nav-btn,
    .chat-app.sidebar-collapsed .history-item {
        width: 36px;
        height: 36px;
        justify-content: center !important;
        padding: 0 !important;
        border-radius: 8px;
    }

    .chat-app.sidebar-collapsed .sidebar .btn-new i {
        margin: 0 !important;
    }

    .chat-app.sidebar-collapsed .quota-container {
        left: 44px;
        bottom: 0;
    }
}

    .sidebar .btn-new {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px 12px;
        border: 1px solid #e5e5e5;
        border-radius: 6px;
        background: #ffffff;
        color: #343541;
        text-align: left;
        cursor: pointer;
        font-size: 14px;
        transition: background 0.2s;
        margin-bottom: 10px;
    }

        .sidebar .btn-new:hover {
            background-color: #ececf1;
        }

    .sidebar .history {
        flex: 1;
        overflow-y: auto;
        margin-top: 10px;
    }

    .sidebar-section {
        margin-top: 12px;
    }

    .history-section {
        display: flex;
        flex: 1;
        min-height: 0;
        flex-direction: column;
    }

    .sidebar-section-title {
        padding: 6px 8px;
        color: #6b7280;
        font-size: 12px;
        font-weight: 700;
    }

    .sidebar-nav-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        border: none;
        background: transparent;
        color: #343541;
        text-align: left;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 14px;
        cursor: pointer;
    }

    .sidebar-nav-btn:hover,
    .sidebar-nav-btn.active {
        background: #ececf1;
    }

    .sidebar-nav-btn i {
        width: 20px;
        text-align: center;
        color: #4b5563;
    }

    .application-apps {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .application-app-empty {
        padding: 8px;
        color: #9ca3af;
        font-size: 12px;
    }

    .application-app-item {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        border: none;
        background: transparent;
        color: #343541;
        text-align: left;
        border-radius: 8px;
        padding: 8px 10px;
        font-size: 14px;
        cursor: pointer;
    }

    .application-app-item:hover,
    .application-app-item.is-enabled {
        background: #ececf1;
    }

    .application-app-item .application-app-icon {
        width: 20px;
        text-align: center;
        color: #4b5563;
    }

    .history-item {
        border-radius: 8px;
        border-bottom: none !important;
    }

    .history-item:hover,
    .history-item.active {
        background: #ececf1;
    }

    .history-item.active .history-title {
        font-weight: 600;
        color: #111827;
    }

    .sidebar .user-info {
        border-top: 1px solid #e5e5e5;
        padding-top: 10px;
        margin-top: 10px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 14px;
        font-weight: 500;
        position: relative;
    }

        .sidebar .user-info .avatar {
            width: 32px;
            height: 32px;
            background: #8e8ea0;
            color: #fff;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
}

.gpt-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.gpt-model-hint {
    position: relative;
    z-index: 8;
    display: none;
    align-items: center;
    margin-right: 2px;
    vertical-align: middle;
}

.gpt-model-hint-btn {
    border: none;
    background: transparent;
    color: inherit;
    width: 14px;
    height: 14px;
    padding: 0;
    font-size: 9px;
    line-height: 14px;
    text-align: center;
    border-radius: 50%;
    cursor: pointer;
}

.gpt-model-hint-btn i {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    font-size: 11px;
    text-align: center;
}

.gpt-model-hint-btn:hover,
.gpt-model-hint-btn:focus-visible {
    color: inherit;
    outline: none;
}

.gpt-model-hint-panel {
    display: none;
    position: absolute;
    bottom: 16px;
    left: -6px;
    min-width: 185px;
    max-width: 220px;
    padding: 6px 8px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    font-size: 11px;
    color: #4b5563;
}

.gpt-model-hint-panel.is-open {
    display: block;
}

.gpt-model-hint-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 2px;
}

.gpt-model-hint-label {
    color: #6b7280;
    white-space: nowrap;
}

.gpt-model-hint-value {
    color: #111827;
    text-align: right;
    word-break: break-word;
}

.gpt-messages {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 240px;
    scroll-behavior: smooth;
}

.gpt-messages.is-loading {
    position: relative;
}

.gpt-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    z-index: 2;
}

.gpt-loading-inner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    color: #6b7280;
    font-size: 14px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.gpt-thread {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px;
}

.gpt-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #343541;
    text-align: center;
    padding-bottom: 100px;
}

    .gpt-welcome h1 {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
        line-height: 1.2;
        font-weight: 600;
        margin-bottom: 40px;
    }

.gpt-row {
    display: flex;
    gap: 20px;
    margin-bottom: 48px;
    padding: 0 10px;
    border-bottom: 1px solid transparent;
}

    .gpt-row.is-ai {
        background: transparent;
    }

    .gpt-row.is-user {
        flex-direction: row-reverse;
    }

.gpt-avatar {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 12px;
}

    .gpt-avatar.user {
        background: #8e8ea0;
        color: white;
    }

.gpt-bubble {
    flex: 1;
    max-width: 100%;
    font-size: 16px;
    line-height: 1.6;
    color: #343541;
}

.gpt-row.is-user .gpt-bubble {
    background: #f7f7f8;
    padding: 10px 16px;
    border-radius: 12px;
    max-width: 80%;
}

.gpt-row.is-ai .gpt-bubble {
    padding: 0;
}

.gpt-time {
    font-size: 10px;
    color: #999;
    margin-top: 4px;
    display: block;
}

.gpt-composer {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(180deg, rgba(255,255,255,0) 0%, #ffffff 20%);
    padding: 20px 0 30px;
}

.gpt-composer-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
}

.gpt-input-box {
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    border-radius: 999px;
    display: flex;
    flex-direction: column;
    padding: 8px 12px;
    position: relative;
}

    .gpt-input-box.has-quota-alert {
        border-color: #dc2626;
        border-radius: 18px;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12), 0 8px 24px rgba(127, 29, 29, 0.12);
    }

    .gpt-input-box:focus-within {
        box-shadow: 0 0 20px rgba(0,0,0,0.15);
        border-color: rgba(0,0,0,0.2);
    }

    .gpt-input-box.has-quota-alert:focus-within {
        border-color: #dc2626;
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16), 0 8px 24px rgba(127, 29, 29, 0.14);
    }

    .gpt-input-box.has-selection-chip,
    .gpt-input-box:has(.gpt-previews:not(:empty)) {
        border-radius: 18px;
    }

.gpt-input-alert {
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.gpt-input-alert::before {
    content: "!";
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 18px;
    font-size: 12px;
    font-weight: 800;
}

.gpt-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 8px;
}

    .gpt-toolbar.hidden {
        display: none;
    }

.gpt-mode-btn {
    background: transparent;
    border: 1px solid #e5e5e5;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    color: #666;
}

    .gpt-mode-btn.active {
        background: #10a37f;
        color: white;
        border-color: #10a37f;
    }

.gpt-addon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gpt-popover-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 240px;
    background: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 6px;
    margin-bottom: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: visible;
}

.gpt-popover-menu.hidden {
        display: none;
    }

.gpt-popover-submenu {
    position: absolute;
    left: calc(100% + 8px);
    width: 240px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gpt-popover-submenu.is-left {
    left: auto;
    right: calc(100% + 8px);
}

.gpt-popover-submenu.hidden {
    display: none;
}

.gpt-command-menu {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 110;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
    padding: 6px;
}

.gpt-command-menu.hidden {
    display: none;
}

.gpt-command-item {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    text-align: left;
}

.gpt-command-item:hover,
.gpt-command-item.is-active {
    background: #eef2ff;
}

.gpt-command-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #f3f4f6;
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.application-icon-img {
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
    display: block;
}

.gpt-command-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gpt-command-text small {
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-item {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #343541;
    transition: background 0.2s;
}

    .menu-item:hover,
    .menu-item.is-open {
        background-color: #f7f7f8;
    }

    .menu-item .icon {
        width: 20px;
        height: 20px;
        border-radius: 6px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
    }

    .menu-item.hidden {
        display: none;
    }

    .menu-item .menu-label {
        min-width: 0;
        flex: 1;
    }

    .menu-item .menu-chevron {
        margin-left: auto;
        color: #6b7280;
        font-size: 12px;
        display: inline-flex;
        align-items: center;
    }

.menu-separator {
    height: 1px;
    background: #e5e5e5;
    margin: 4px 0;
}

.menu-separator.hidden {
    display: none;
}

.mode-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    max-width: 220px;
    border: 1px solid #dbeafe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0 8px 0 10px;
    font-size: 14px;
    white-space: nowrap;
    flex-shrink: 0;
}

.mode-indicator.hidden {
    display: none;
}

.mode-indicator-icon {
    position: relative;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    flex-shrink: 0;
    isolation: isolate;
    border-radius: 50%;
}

.mode-indicator-icon > .application-icon-img {
    position: relative;
    z-index: 1;
    border-radius: 50%;
}

.mode-indicator-icon > i {
    position: relative;
    z-index: 1;
    font-size: 14px;
    line-height: 1;
}

.mode-indicator .text {
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
}

.mode-indicator-remove {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #bfdbfe;
    border-radius: 50%;
    background: #ffffff;
    color: #1d4ed8;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.92);
    z-index: 3;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.18);
    transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}

.mode-indicator-remove i {
    display: none;
}

.mode-indicator-remove::before {
    content: "X";
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
}

.mode-indicator-icon:hover .mode-indicator-remove,
.mode-indicator:focus-within .mode-indicator-remove {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.mode-indicator-remove:hover {
    background: #eff6ff;
}

.sidebar .user-info {
    position: relative;
}

.sidebar .user-info .user-role-inline {
    display: none;
    margin-left: 0.35rem;
    color: #64748b;
    font-size: 0.76rem;
    font-weight: 600;
}

.sidebar .user-info.is-open .user-role-inline {
    display: inline;
}

.quota-container {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 250px;
    background: #ffffff;
    border: 1px solid #d9d9e3;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 8px;
    margin-bottom: 10px;
    z-index: 1000;
}

    .quota-container .quota-summary-panel {
        border: 1px solid #e5e7eb;
        border-radius: 10px;
        background: #f8fafc;
        padding: 8px 10px;
        margin: 0 0 6px;
        cursor: default;
    }

    .quota-container .quota-summary-title {
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .quota-container .quota-summary-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 26px;
    }

    .quota-container .quota-summary-label {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        color: #475569;
        font-size: 13px;
        font-weight: 600;
    }

        .quota-container .quota-summary-label i {
            width: 18px;
            text-align: center;
            color: #0f172a;
        }

    .quota-container .quota-summary-value {
        color: #111827;
        font-size: 13px;
        font-weight: 800;
        white-space: nowrap;
    }

    .quota-container .menu-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 6px;
        cursor: pointer;
        color: #343541;
        font-size: 14px;
        transition: background 0.2s;
    }

        .quota-container .menu-item:hover {
            background: #ececf1;
        }

        .quota-container .menu-item i {
            width: 20px;
            text-align: center;
            color: #343541;
        }

    .quota-container .menu-separator {
        height: 1px;
        background: #e5e5e5;
        margin: 4px 0;
    }

.gpt-avatar.ai {
    background: transparent;
    overflow: hidden;
}

    .gpt-avatar.ai img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.gpt-previews {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 8px 12px;
}

.preview-item {
    position: relative;
    display: flex;
    align-items: center;
}

.preview-image {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.06);
}

    .preview-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

.preview-file {
    display: flex;
    align-items: center;
    background: #fff;
    border-radius: 18px;
    padding: 6px 10px;
    min-height: 40px;
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: 0 1px 0 rgba(0,0,0,0.04);
}

.file-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #d32f2f;
    margin-right: 8px;
    font-size: 11px;
}

.file-pill {
    display: flex;
    align-items: center;
    gap: 8px;
}

.file-name {
    max-width: 240px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.file-sub {
    font-size: 11px;
    color: #666;
}

.preview-item .remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #111;
    color: #fff;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

    .preview-item .remove:focus {
        outline: none;
    }

.gpt-input-box .gpt-previews {
    margin-bottom: 8px;
}

.gpt-input-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
}

.input-wrapper {
    position: relative;
    min-width: 0;
    justify-content: center;
}

.btn-plus {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e5e5e5;
    background: #fff;
    color: #343541;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.btn-plus i,
.gpt-send i {
    display: block;
    line-height: 1;
}

    .btn-plus:hover {
        background: #f7f7f8;
    }

.chat-input {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    max-height: 200px;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.5;
    padding: 4px 0;
    background: transparent;
}

.gpt-send {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: #ccc;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
    line-height: 1;
    padding: 0;
    transition: color 0.2s, background 0.2s;
}

.gpt-input-box.has-selection-chip .gpt-input-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    row-gap: 8px;
}

.gpt-input-box.has-selection-chip .input-wrapper {
    grid-column: 1 / -1;
    grid-row: 1;
    width: 100%;
}

.gpt-input-box.has-selection-chip .gpt-addon-wrapper {
    grid-column: 1 / 3;
    grid-row: 2;
    min-width: 0;
    align-self: center;
}

.gpt-input-box.has-selection-chip .gpt-send {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
}

.gpt-input-box.has-selection-chip .chat-input {
    width: 100%;
    min-height: 24px;
    padding: 0;
}

.gpt-disclaimer-usage {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-right: 4px;
    vertical-align: middle;
}

.gpt-disclaimer .quota-warning,
.gpt-disclaimer .image-quota-notice {
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 11px;
    line-height: 1.4;
    white-space: nowrap;
}

@media (max-width: 1024px) and (orientation: portrait) {
    .gpt-disclaimer .gpt-model-hint,
    .gpt-disclaimer .gpt-disclaimer-text {
        display: none !important;
    }

    .gpt-disclaimer-usage {
        margin-right: 0;
        flex-wrap: wrap;
    }
}

.composer-alerts {
    display: none;
}

.quota-warning {
    color: #854d0e;
}

.quota-warning.strong {
    color: #9a3412;
}

.quota-warning.blocked {
    color: #991b1b;
}

.image-quota-notice {
    color: #1d4ed8;
}

.gpt-chat.is-applications-page .gpt-composer {
    display: none;
}

.gpt-apps-page {
    width: min(920px, calc(100% - 32px));
    margin: 80px auto 48px;
}

.gpt-apps-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
}

.gpt-apps-page-title {
    font-size: 28px;
    font-weight: 650;
    color: #111827;
}

.gpt-apps-page-subtitle {
    margin-top: 4px;
    color: #6b7280;
    font-size: 15px;
}

.gpt-apps-search {
    width: min(260px, 100%);
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 9px 14px;
    outline: none;
}

.gpt-apps-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.gpt-app-row {
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: start;
    gap: 12px;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: left;
    width: 100%;
}

.gpt-app-row:hover {
    background: #f7f7f8;
}

.gpt-app-icon {
    width: 42px;
    height: 42px;
    border-radius: 999px;
    background: #f3f4f6;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.gpt-app-name {
    color: #111827;
    font-size: 15px;
    font-weight: 600;
}

.gpt-app-text {
    min-width: 0;
}

.gpt-app-description {
    color: #8e8ea0;
    font-size: 13px;
    line-height: 1.5;
}

.gpt-app-inline-meta {
    color: #6b7280;
    font-size: 12px;
    white-space: nowrap;
}

.gpt-app-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 12px;
    color: #6b7280;
}

.gpt-app-meta span {
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 2px 8px;
    background: #f9fafb;
}

.gpt-app-detail {
    margin-top: 6px;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}

.gpt-app-empty-state {
    color: #6b7280;
    font-size: 14px;
    padding: 6px 2px;
}

.gpt-app-toggle {
    min-width: 72px;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    padding: 6px 12px;
    font-size: 13px;
}

.gpt-app-toggle.is-enabled {
    border-color: #111827;
    background: #111827;
    color: #ffffff;
}

@media (max-width: 768px) {
    .gpt-popover-menu {
        width: min(240px, calc(100vw - 40px));
        max-height: min(420px, calc(100vh - 170px));
        overflow-y: auto;
    }

    .gpt-popover-submenu,
    .gpt-popover-submenu.is-left {
        position: static;
        left: auto;
        right: auto;
        top: auto;
        width: 100%;
        max-height: 180px;
        margin-top: 4px;
        border-radius: 8px;
        box-shadow: none;
    }

    .gpt-apps-page {
        width: calc(100% - 24px);
        margin-top: 64px;
    }

    .gpt-apps-page-header {
        flex-direction: column;
    }

    .gpt-apps-search {
        width: 100%;
    }

    .gpt-apps-list {
        grid-template-columns: 1fr;
    }
}

    .gpt-send.active {
        background: #19c37d;
        color: white;
    }

    .gpt-send svg {
        width: 16px;
        height: 16px;
        fill: currentColor;
    }

.chat-embed .sidebar {
    display: none;
}

.chat-embed .gpt-composer {
    position: absolute;
    padding: 6px 0 10px;
}

.chat-embed .gpt-welcome h1 {
    font-size: clamp(1.05rem, 3.6vw, 1.6rem);
    line-height: 1.2;
    margin-bottom: 18px;
}

.chat-embed .gpt-welcome {
    padding-bottom: 28px;
}

.chat-embed .gpt-input-box {
    padding: 6px 8px;
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

.chat-embed .chat-input {
    font-size: 13px;
    line-height: 1.4;
    max-height: 90px;
}

.chat-embed .gpt-composer-inner {
    padding: 0 10px;
}

.chat-embed .gpt-messages {
    padding-bottom: 140px;
}

.chat-embed .gpt-input-row {
    gap: 8px;
}

.chat-embed .btn-plus,
.chat-embed .gpt-send {
    width: 28px;
    height: 28px;
}

.chat-embed .quota-row .label,
.chat-embed .quota-row .percent,
.chat-embed .quota-row .image-quota,
.chat-embed .quota-row .count {
    font-size: 11px;
}

.chat-embed .quota-row {
    gap: 8px;
}

.embed-toolbar {
    display: none;
}

.chat-embed .embed-toolbar {
    display: block;
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 6;
}

.chat-embed .embed-new {
    border: 1px solid #e5e5e5;
    background: #fff;
    color: #343541;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.08);
}

/* Attachments */
.gpt-attachments {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.gpt-attachment {
    cursor: pointer;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
    background: #fff;
}

    .gpt-attachment:hover {
        transform: scale(1.02);
    }

    .gpt-attachment.image {
        max-width: 200px;
        max-height: 200px;
    }

        .gpt-attachment.image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }

    .gpt-attachment.file {
        display: flex;
        align-items: center;
        padding: 10px;
        background: #fff;
        width: 240px;
        border: 1px solid #e5e5e5;
    }

        .gpt-attachment.file .icon {
            width: 40px;
            height: 40px;
            background: #ff4444;
            color: white;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-right: 10px;
            font-size: 12px;
        }

            .gpt-attachment.file .icon i {
                font-size: 20px;
            }

        .gpt-attachment.file .name {
            font-size: 14px;
            color: #333;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            flex: 1;
        }

/* Modal */
.gpt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

    .gpt-modal.show {
        opacity: 1;
        pointer-events: auto;
    }

.gpt-feedback-modal {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

    .gpt-feedback-modal.show {
        opacity: 1;
        pointer-events: auto;
    }

.gpt-feedback-panel {
    width: min(560px, 100%);
    max-height: calc(100vh - 32px);
    overflow: auto;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 24px 72px rgba(15, 23, 42, 0.22);
    padding: 18px 16px 16px;
}

.gpt-feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

    .gpt-feedback-header h2 {
        margin: 0;
        color: #111827;
        font-size: 16px;
        font-weight: 600;
        line-height: 1.4;
    }

.gpt-feedback-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

    .gpt-feedback-close:hover,
    .gpt-feedback-close:focus {
        background: #f3f4f6;
        outline: none;
    }

.gpt-feedback-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 8px;
    margin-bottom: 22px;
}

.gpt-feedback-reason {
    border: 1px solid #d9dce3;
    border-radius: 999px;
    background: #ffffff;
    color: #111827;
    padding: 8px 14px;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

    .gpt-feedback-reason:hover,
    .gpt-feedback-reason:focus {
        border-color: #9ca3af;
        background: #f9fafb;
        outline: none;
    }

    .gpt-feedback-reason.selected {
        border-color: #111827;
        background: #111827;
        color: #ffffff;
    }

.gpt-feedback-text {
    width: 100%;
    min-height: 80px;
    max-height: 180px;
    resize: vertical;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    color: #111827;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

    .gpt-feedback-text:focus {
        border-color: #9ca3af;
        outline: none;
        box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.18);
    }

.gpt-feedback-notice {
    margin-top: 22px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #f0f0f0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.gpt-feedback-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
}

.gpt-feedback-message {
    display: none;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: #ecfdf5;
    color: #047857;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

    .gpt-feedback-message.show {
        display: block;
    }

.gpt-feedback-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    z-index: 2300;
    max-width: min(460px, calc(100vw - 32px));
    padding: 12px 16px;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    background: #ecfdf5;
    color: #065f46;
    box-shadow: 0 18px 46px rgba(15, 23, 42, 0.18);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -12px);
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.18s ease;
}

    .gpt-feedback-toast.show {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, 0);
    }

.gpt-feedback-submit {
    min-width: 56px;
    border: 0;
    border-radius: 999px;
    background: #0f766e;
    color: #ffffff;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 118, 110, 0.24);
    transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

    .gpt-feedback-submit:hover,
    .gpt-feedback-submit:focus {
        background: #0d9488;
        box-shadow: 0 10px 22px rgba(13, 148, 136, 0.3);
        outline: none;
    }

    .gpt-feedback-submit:active {
        transform: translateY(1px);
    }

    .gpt-feedback-submit:disabled {
        cursor: default;
        background: #94a3b8;
        box-shadow: none;
        opacity: 0.82;
    }

.gpt-modal-content {
    background: #fff;
    width: 90%;
    height: 90%;
    max-width: 1000px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.gpt-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gpt-modal-title {
    font-weight: 600;
    font-size: 16px;
}

.gpt-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.gpt-modal-body {
    flex: 1;
    overflow: hidden;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    position: relative;
}

    .gpt-modal-body.has-gallery-nav {
        padding: 0 68px;
    }

    .gpt-modal-body img {
        width: 95%;
        height: 95%;
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        transform-origin: center center;
        transition: transform 0.08s ease-out;
        user-select: none;
        touch-action: none;
    }

    .gpt-modal-body.has-gallery-nav img {
        width: 100%;
        height: 100%;
    }

    .gpt-modal-body.is-zoomed .gpt-modal-image {
        cursor: grab;
    }

    .gpt-modal-body.is-panning .gpt-modal-image {
        cursor: grabbing;
        transition: none;
    }

    .gpt-modal-body iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

.gpt-modal-nav {
    position: absolute !important;
    top: 50% !important;
    bottom: auto !important;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%) !important;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    z-index: 2;
    margin: 0 !important;
    padding: 0 !important;
}

    .gpt-modal-nav:hover,
    .gpt-modal-nav:focus {
        background: rgba(17, 24, 39, 0.9);
        transform: translateY(-50%) scale(1.04) !important;
        outline: none;
    }

    .gpt-modal-nav i {
        font-size: 18px;
    }

.gpt-modal-prev {
    left: 18px !important;
    right: auto !important;
}

.gpt-modal-next {
    right: 18px !important;
    left: auto !important;
}

.gpt-modal-counter {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(17, 24, 39, 0.72);
    color: #fff;
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 13px;
    line-height: 1.4;
    z-index: 2;
}

@media (max-width: 640px) {
    .gpt-modal-body.has-gallery-nav {
        padding: 0 48px;
    }

    .gpt-modal-nav {
        width: 38px;
        height: 38px;
    }

    .gpt-modal-prev {
        left: 10px !important;
    }

    .gpt-modal-next {
        right: 10px !important;
    }
}

.gpt-typing {
    display: flex;
    align-items: center;
    height: 24px;
}

.gpt-typing .dot {
    width: 8px;
    height: 8px;
    background-color: #8e8ea0;
    border-radius: 50%;
    margin: 0 3px;
    animation: typing 1.4s infinite ease-in-out both;
}

.gpt-typing .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.gpt-typing .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Fix for long links overflowing on mobile */
.gpt-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.gpt-content a {
    word-break: break-all;
}

.gpt-content p {
    margin: 0 0 0.65em;
}

.gpt-content p:last-child {
    margin-bottom: 0;
}

.gpt-content ul,
.gpt-content ol {
    margin: 0 0 0.65em 1.25em;
    padding-left: 1em;
}

.gpt-content li {
    margin: 0.2em 0;
}

.gpt-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    margin: 0.8em 0 1em;
}

.gpt-content table {
    width: 100%;
    min-width: 520px;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 14px;
    line-height: 1.45;
    color: #111827;
}

.gpt-content th,
.gpt-content td {
    border: 1px solid #dbe3ef;
    padding: 8px 10px;
    vertical-align: top;
    background: #ffffff;
}

.gpt-content th {
    background: #f8fafc;
    font-weight: 700;
    color: #0f172a;
}

.gpt-content tbody tr:nth-child(even) td {
    background: #fbfdff;
}

.gpt-content .gpt-table-align-left {
    text-align: left;
}

.gpt-content .gpt-table-align-center {
    text-align: center;
}

.gpt-content .gpt-table-align-right {
    text-align: right;
}

/* 聊天室 UI 微調 */
.gpt-previews:empty {
    display: none;
    padding: 0;
}

.gpt-input-box .gpt-previews:empty {
    margin-bottom: 0;
}

.gpt-input-box.has-selection-chip .input-wrapper {
    justify-content: flex-start;
}

.gpt-input-box.has-selection-chip .chat-input {
    padding-top: 0;
}

.gpt-send.is-stopping {
    background: #111827;
    color: #ffffff;
}

.gpt-send.is-stopping i {
    font-size: 17px;
}

.chat-app button[data-tooltip]:not(.mode-indicator-remove),
.gpt-chat button[data-tooltip]:not(.mode-indicator-remove) {
    position: relative;
}

@media (hover: hover) and (pointer: fine) {
    .chat-app button[data-tooltip]:not(.mode-indicator-remove)::after,
    .gpt-chat button[data-tooltip]:not(.mode-indicator-remove)::after {
        content: attr(data-tooltip);
        position: absolute;
        z-index: 3000;
        pointer-events: none;
        opacity: 0;
        visibility: hidden;
        background: #000000;
        color: #ffffff;
        border-radius: 6px;
        padding: 6px 8px;
        font-size: 12px;
        line-height: 1.2;
        font-weight: 600;
        white-space: nowrap;
        box-shadow: 0 6px 16px rgba(15, 23, 42, 0.22);
        transition: opacity 0.12s ease, visibility 0.12s ease;
    }

    .chat-app button[data-tooltip]:not(.mode-indicator-remove):hover::after,
    .gpt-chat button[data-tooltip]:not(.mode-indicator-remove):hover::after {
        opacity: 1;
        visibility: visible;
    }

    .sidebar button[data-tooltip]::after {
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
    }

    .sidebar:not(.show) .sidebar-collapse-toggle[data-tooltip]::after {
        right: calc(100% + 8px);
        left: auto;
    }

    .chat-app.sidebar-collapsed .sidebar-collapse-toggle[data-tooltip]::after {
        left: calc(100% + 8px);
        right: auto;
    }

    .gpt-input-box button[data-tooltip]::after,
    .mobile-sidebar-toggle[data-tooltip]::after {
        left: 50%;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
    }

    .gpt-feedback-btn[data-tooltip]::after {
        left: 50%;
        bottom: calc(100% + 8px);
        transform: translateX(-50%);
    }

    .chat-app .gpt-modal .gpt-modal-nav[data-tooltip]::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
    }
}

.chat-app .mode-indicator .mode-indicator-icon > .mode-indicator-remove,
.gpt-chat .mode-indicator .mode-indicator-icon > .mode-indicator-remove {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    min-width: 22px;
    height: 22px;
    min-height: 22px;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%) scale(0.92);
    flex: 0 0 22px;
    font-size: 0;
    line-height: 1;
}

.chat-app .mode-indicator .mode-indicator-icon > .mode-indicator-remove::after,
.gpt-chat .mode-indicator .mode-indicator-icon > .mode-indicator-remove::after {
    content: none;
    display: none;
}

.chat-app .mode-indicator .mode-indicator-icon:hover > .mode-indicator-remove,
.chat-app .mode-indicator:focus-within .mode-indicator-icon > .mode-indicator-remove,
.gpt-chat .mode-indicator .mode-indicator-icon:hover > .mode-indicator-remove,
.gpt-chat .mode-indicator:focus-within .mode-indicator-icon > .mode-indicator-remove {
    transform: translate(-50%, -50%) scale(1);
}

.sidebar {
    background: #ffffff;
    overflow: visible;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.sidebar .offcanvas-body {
    gap: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    overflow-x: hidden !important;
}

.sidebar::-webkit-scrollbar,
.sidebar .offcanvas-body::-webkit-scrollbar,
.sidebar .history::-webkit-scrollbar,
.sidebar-history-popover::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 36px;
    margin-bottom: 10px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 800;
}

.sidebar-brand-logo {
    display: none;
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.sidebar-brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-collapse-toggle,
.sidebar-history-toggle {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #111827;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    cursor: pointer;
}

.sidebar-collapse-toggle:hover,
.sidebar-history-toggle:hover {
    background: #f3f4f6;
}

.sidebar-history-toggle {
    display: none;
}

.sidebar .btn-new,
.sidebar .sidebar-nav-btn {
    border: 0;
    background: transparent;
    border-radius: 8px;
    margin-bottom: 0;
    min-height: 36px;
    padding: 8px 10px;
}

.sidebar .btn-new:hover,
.sidebar .btn-new.active,
.sidebar .sidebar-nav-btn:hover,
.sidebar .sidebar-nav-btn.active {
    background: #f3f3f3;
}

.application-app-count {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #111827;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.application-app-count:empty {
    display: none;
}

.sidebar-section {
    margin-top: 6px;
}

.history-section {
    margin-top: 12px;
}

.sidebar-history-popover {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
}

.sidebar .history {
    margin-top: 2px;
    overflow-x: hidden !important;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.history-item {
    min-height: 32px;
    padding: 6px 8px !important;
    max-width: 100%;
    overflow: hidden;
}

.history-icon {
    margin-right: 6px !important;
}

.history-title {
    font-size: 13px !important;
    min-width: 0;
    max-width: 100%;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.quota-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 6px;
}

.quota-profile .avatar {
    width: 32px;
    height: 32px;
    background: #8e8ea0;
    color: #ffffff;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 700;
}

.quota-profile-details {
    min-width: 0;
}

.quota-profile-name {
    color: #111827;
    font-size: 13px;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.quota-profile-name span,
.quota-profile-account {
    color: #64748b;
    font-size: 11px;
    font-weight: 600;
}

@media (min-width: 768px) {
    .chat-app.sidebar-collapsed .sidebar {
        overflow: visible;
    }

    .chat-app.sidebar-collapsed .sidebar .offcanvas-body {
        align-items: center;
        overflow: visible !important;
    }

    .chat-app.sidebar-collapsed .sidebar-header {
        position: relative;
        width: 36px;
        height: 36px;
        min-height: 36px;
        flex: 0 0 36px;
        justify-content: center;
        align-items: center;
        margin-bottom: 12px;
        overflow: hidden;
    }

    .chat-app.sidebar-collapsed .sidebar-brand {
        position: absolute;
        inset: 0;
        justify-content: center;
        align-items: center;
        width: 36px;
        height: 36px;
        gap: 0;
        flex: 0 0 36px;
    }

    .chat-app.sidebar-collapsed .sidebar-brand-logo {
        display: block;
        position: absolute;
        top: 50%;
        left: 50%;
        width: 24px !important;
        height: 24px !important;
        max-width: 24px;
        max-height: 24px;
        flex: 0 0 24px;
        margin: 0;
        object-fit: contain;
        object-position: center;
        transform: translate(-50%, -50%);
    }

    .chat-app.sidebar-collapsed .sidebar-brand-name {
        display: none;
    }

    .chat-app.sidebar-collapsed .sidebar-collapse-toggle {
        position: absolute;
        inset: 0;
        opacity: 0;
        visibility: hidden;
        background: #ffffff;
        z-index: 1;
    }

    .chat-app.sidebar-collapsed .sidebar-header:hover .sidebar-brand-logo {
        opacity: 0;
    }

    .chat-app.sidebar-collapsed .sidebar-header:hover .sidebar-collapse-toggle {
        opacity: 1;
        visibility: visible;
    }

    .chat-app.sidebar-collapsed .sidebar-top-actions,
    .chat-app.sidebar-collapsed .application-app-section,
    .chat-app.sidebar-collapsed .history-section {
        width: 36px;
        flex: 0 0 auto;
    }

    .chat-app.sidebar-collapsed .history-section {
        position: relative;
    }

    .chat-app.sidebar-collapsed .sidebar .btn-new,
    .chat-app.sidebar-collapsed .sidebar-nav-btn,
    .chat-app.sidebar-collapsed .sidebar-history-toggle {
        width: 36px;
        height: 36px;
        min-height: 36px;
        border: 0;
        box-shadow: none;
        background: transparent;
        padding: 0 !important;
        justify-content: center !important;
    }

    .chat-app.sidebar-collapsed .sidebar .btn-new:hover,
    .chat-app.sidebar-collapsed .sidebar-nav-btn:hover,
    .chat-app.sidebar-collapsed .sidebar-history-toggle:hover,
    .chat-app.sidebar-collapsed .sidebar .btn-new.active,
    .chat-app.sidebar-collapsed .sidebar-nav-btn.active {
        background: #f3f4f6;
    }

    .chat-app.sidebar-collapsed .application-app-count {
        display: none;
    }

    .chat-app.sidebar-collapsed .sidebar-history-toggle {
        display: inline-flex;
    }

    .chat-app.sidebar-collapsed .sidebar-history-popover {
        display: none;
    }

    .chat-app.sidebar-collapsed .history-section.is-popover-open .sidebar-history-popover {
        position: absolute;
        left: 44px;
        top: 0;
        display: flex;
        width: 250px;
        max-height: min(420px, calc(100vh - 160px));
        padding: 14px;
        border: 1px solid #d9d9e3;
        border-radius: 0 16px 16px 16px;
        background: #ffffff;
        box-shadow: 0 12px 32px rgba(15, 23, 42, 0.16);
        z-index: 1200;
    }

    .chat-app.sidebar-collapsed .history-section.is-popover-open .sidebar-section-title,
    .chat-app.sidebar-collapsed .history-section.is-popover-open .history-title {
        display: block !important;
    }

    .chat-app.sidebar-collapsed .history-section.is-popover-open .history-delete {
        display: inline-flex !important;
    }

    .chat-app.sidebar-collapsed .history-section.is-popover-open .history-item {
        width: 100%;
        height: auto;
        justify-content: space-between !important;
        padding: 6px 8px !important;
    }

    .chat-app.sidebar-collapsed .history-section.is-popover-open .history-icon {
        display: none;
    }

    .chat-app.sidebar-collapsed .sidebar .user-info {
        width: 36px;
        justify-content: center;
        overflow: visible;
        margin-top: auto;
    }

    .chat-app.sidebar-collapsed .user-info .quota-container {
        left: 44px;
        right: auto;
        bottom: 0;
        width: 260px;
    }

    .chat-app.sidebar-collapsed .quota-profile .avatar {
        display: flex;
    }
}

@media (max-width: 1024px) and (orientation: portrait) {
    .mobile-sidebar-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .sidebar.offcanvas-md {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        z-index: 1045 !important;
        width: min(86vw, 320px) !important;
        max-width: 320px;
        transform: translateX(-100%) !important;
        visibility: hidden !important;
        border-right: 1px solid #e5e5e5 !important;
        background: #ffffff !important;
        transition: transform 0.28s ease, visibility 0.28s ease !important;
    }

    .sidebar.offcanvas-md.show,
    .sidebar.offcanvas-md.showing {
        transform: translateX(0) !important;
        visibility: visible !important;
    }

    .sidebar.offcanvas-md.hiding {
        transform: translateX(-100%) !important;
        visibility: visible !important;
    }

    .sidebar.offcanvas-md .offcanvas-body {
        width: 100%;
        min-width: 0;
    }

    .sidebar-brand-logo {
        display: block;
    }

    .sidebar-collapse-toggle {
        display: none;
    }
}

@media (max-width: 767.98px) {
    .sidebar-brand-logo {
        display: block;
    }
}
