/* History conversations: compact dropdown anchored below the top action. */
body.chat-shell .history-dropdown-chevron {
    margin-left: 1px;
    opacity: 0.55;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

body.chat-shell #consoleHistoryBtn[aria-expanded="true"] {
    color: #f8f7ff;
    border-color: rgba(143, 127, 255, 0.3);
    background: rgba(37, 35, 54, 0.97);
}

body.chat-shell #consoleHistoryBtn[aria-expanded="true"] .history-dropdown-chevron {
    opacity: 0.9;
    transform: rotate(180deg);
}

body.chat-shell .history-drawer {
    top: 60px;
    right: 72px;
    left: auto;
    width: 360px;
    height: auto;
    max-height: min(440px, calc(100vh - 82px));
    border: 1px solid rgba(255, 255, 255, 0.095);
    border-radius: 13px;
    display: flex;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    background:
        radial-gradient(circle at 78% -18%, rgba(126, 108, 255, 0.14), transparent 38%),
        rgba(16, 17, 25, 0.965);
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    backdrop-filter: blur(28px) saturate(140%);
    -webkit-backdrop-filter: blur(28px) saturate(140%);
    transform: translateY(-8px) scale(0.985);
    transform-origin: top right;
    transition: opacity 0.18s ease, visibility 0.18s ease, transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99;
}

body.chat-shell .history-drawer::before {
    content: "";
    position: absolute;
    top: -5px;
    right: 48px;
    width: 9px;
    height: 9px;
    border-top: 1px solid rgba(255, 255, 255, 0.095);
    border-left: 1px solid rgba(255, 255, 255, 0.095);
    background: #171822;
    transform: rotate(45deg);
}

body.chat-shell .history-drawer.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

body.chat-shell .history-drawer-header {
    min-height: 56px;
    box-sizing: border-box;
    padding: 11px 12px 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.065);
    background: rgba(255, 255, 255, 0.015);
}

body.chat-shell .history-drawer-header h3 {
    color: rgba(249, 248, 255, 0.92);
    font-size: 13px;
    font-weight: 650;
    letter-spacing: 0.01em;
}

body.chat-shell .history-delete-all-btn {
    height: 28px;
    padding: 0 9px;
    border: 1px solid rgba(239, 94, 102, 0.12);
    border-radius: 7px;
    color: rgba(245, 156, 162, 0.68);
    font-size: 10px;
    background: rgba(239, 68, 68, 0.045);
}

body.chat-shell .history-delete-all-btn:hover {
    color: #ff9da4;
    border-color: rgba(239, 94, 102, 0.24);
    background: rgba(239, 68, 68, 0.1);
}

body.chat-shell .history-drawer-close {
    width: 28px;
    height: 28px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 7px;
}

body.chat-shell .history-drawer-content {
    flex: 0 1 auto;
    min-height: 82px;
    max-height: 372px;
    padding: 8px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(146, 132, 230, 0.24) transparent;
}

body.chat-shell .history-drawer-content::-webkit-scrollbar {
    display: block;
    width: 4px;
}

body.chat-shell .history-drawer-content::-webkit-scrollbar-track {
    background: transparent;
}

body.chat-shell .history-drawer-content::-webkit-scrollbar-thumb {
    border-radius: 99px;
    background: rgba(146, 132, 230, 0.24);
}

body.chat-shell .history-drawer .history-item {
    min-height: 52px;
    box-sizing: border-box;
    margin: 0 0 5px !important;
    padding: 9px 9px 9px 11px !important;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: 9px !important;
    background: rgba(255, 255, 255, 0.018) !important;
}

body.chat-shell .history-drawer .history-item:last-child {
    margin-bottom: 0 !important;
}

body.chat-shell .history-drawer .history-item:hover {
    border-color: rgba(255, 255, 255, 0.065);
    background: rgba(255, 255, 255, 0.045) !important;
}

body.chat-shell .history-drawer .history-item.active {
    border-color: rgba(137, 121, 255, 0.22);
    background: linear-gradient(105deg, rgba(126, 108, 255, 0.13), rgba(93, 105, 193, 0.055)) !important;
}

body.chat-shell .history-drawer .history-item-title {
    color: rgba(241, 239, 251, 0.82);
    font-size: 12px;
    font-weight: 560;
}

body.chat-shell .history-drawer .history-item.active .history-item-title {
    color: #bdb4ff;
}

body.chat-shell .history-drawer .history-item-time {
    color: rgba(197, 193, 218, 0.37) !important;
    font-size: 9px !important;
}

body.chat-shell .history-drawer .history-delete-btn {
    width: 28px;
    height: 28px;
    padding: 0 !important;
    border: 1px solid transparent !important;
    border-radius: 7px !important;
    display: grid;
    place-items: center;
    color: rgba(205, 200, 225, 0.35) !important;
    background: transparent !important;
}

body.chat-shell .history-drawer .history-delete-btn:hover {
    color: #ff8f98 !important;
    border-color: rgba(239, 68, 68, 0.16) !important;
    background: rgba(239, 68, 68, 0.09) !important;
}

body.chat-shell .history-drawer .conv-empty {
    padding: 27px 14px !important;
    color: rgba(197, 193, 218, 0.42) !important;
    font-size: 11px !important;
}

body.chat-shell.theme-light #consoleHistoryBtn[aria-expanded="true"] {
    color: #493c93;
    border-color: rgba(103, 87, 210, 0.2);
    background: #ffffff;
}

body.chat-shell.theme-light .history-drawer {
    border-color: rgba(48, 42, 79, 0.1);
    background:
        radial-gradient(circle at 78% -18%, rgba(111, 94, 220, 0.08), transparent 38%),
        rgba(252, 252, 254, 0.975);
    box-shadow: 0 20px 48px rgba(47, 38, 92, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

body.chat-shell.theme-light .history-drawer::before {
    border-color: rgba(48, 42, 79, 0.1);
    background: #fafafe;
}

body.chat-shell.theme-light .history-drawer-header {
    border-bottom-color: rgba(48, 42, 79, 0.075);
    background: rgba(99, 83, 205, 0.018);
}

body.chat-shell.theme-light .history-drawer-header h3 {
    color: #28243d;
}

body.chat-shell.theme-light .history-delete-all-btn {
    color: rgba(190, 57, 70, 0.7);
    border-color: rgba(218, 62, 77, 0.12);
    background: rgba(225, 69, 82, 0.035);
}

body.chat-shell.theme-light .history-drawer .history-item {
    background: rgba(69, 61, 105, 0.018) !important;
}

body.chat-shell.theme-light .history-drawer .history-item:hover {
    border-color: rgba(51, 44, 87, 0.07);
    background: rgba(76, 65, 132, 0.045) !important;
}

body.chat-shell.theme-light .history-drawer .history-item.active {
    border-color: rgba(103, 87, 210, 0.17);
    background: linear-gradient(105deg, rgba(108, 91, 219, 0.09), rgba(83, 110, 180, 0.03)) !important;
}

body.chat-shell.theme-light .history-drawer .history-item-title {
    color: rgba(39, 35, 58, 0.82);
}

body.chat-shell.theme-light .history-drawer .history-item.active .history-item-title {
    color: #5948b3;
}

body.chat-shell.theme-light .history-drawer .history-item-time {
    color: rgba(47, 42, 70, 0.4) !important;
}

body.chat-shell.theme-light .history-drawer .history-delete-btn {
    color: rgba(48, 43, 72, 0.34) !important;
}

body.chat-shell.theme-light .history-drawer .conv-empty {
    color: rgba(47, 42, 70, 0.43) !important;
}

@media (max-width: 720px) {
    body.chat-shell .history-drawer {
        position: fixed;
        top: 58px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: min(430px, calc(100vh - 76px));
        z-index: 10001;
    }

    body.chat-shell .history-drawer::before {
        right: auto;
        left: 86px;
    }

    body.chat-shell .history-drawer-content {
        max-height: calc(100vh - 144px);
    }
}
