.chat-history-toolbar, .chat-history-panel { display: none; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { position: absolute; top: 12px; left: 16px; z-index: 6; display: flex; flex-direction: column; width: min(200px, calc(100% - 32px)); gap: 6px; }
.chat-history-toolbar button { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; gap: 6px; height: 34px; padding: 6px 12px; border: 0; border-radius: 10px; font: 500 12px Inter, Arial, sans-serif; cursor: pointer; }
.chat-history-new { color: #fff; background: #16a7ed; }
.chat-history-toolbar .chat-history-new { border-radius: 14px; }
.chat-history-new:hover { background: #078bc9; }
.chat-history-new svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chat-history-toggle { justify-content: flex-start !important; color: #454b54; background: #f2f3f5; }
.chat-history-toggle svg { width: 16px; height: 16px; flex: 0 0 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.chat-history-toggle:hover, .chat-history-toggle[aria-expanded="true"] { background: #e6e8eb; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { position: absolute; top: 90px; left: 16px; z-index: 7; display: block; box-sizing: border-box; width: min(208px, calc(100% - 24px)); max-height: min(60vh, 460px); overflow-x: hidden; overflow-y: auto; padding: 0 3px 0 0; border: 0; background: transparent; box-shadow: none; }
.chat-history-panel::-webkit-scrollbar { width: 5px; }
.chat-history-panel::-webkit-scrollbar-track { background: transparent; }
.chat-history-panel::-webkit-scrollbar-thumb { border-radius: 5px; background: #b8bec6; }
.chat-history-panel::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
@supports not selector(::-webkit-scrollbar) { .chat-history-panel { scrollbar-width: thin; scrollbar-color: #b8bec6 transparent; } }
.chat-history-status { margin: 4px 6px; color: #6b7280; font: 12px/1.4 Inter, Arial, sans-serif; }
.chat-history-status:empty { display: none; }
.chat-history-list { display: grid; width: min(200px, 100%); gap: 4px; }
.chat-history-item { display: flex; align-items: center; box-sizing: border-box; width: 100%; min-width: 0; height: 34px; padding: 6px 12px; border: 0; border-radius: 10px; background: #f5f6f7; color: #454b54; font: 12px/1.35 Inter, Arial, sans-serif; text-align: left; cursor: pointer; }
.chat-history-item-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-history-item:hover, .chat-history-item:focus-visible { background: #e9f4fa; color: #176489; }
:is(.workspace.chat-only, .review-chat-history-host) .conversation { padding-top: 93px; }
@media (max-width: 600px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { top: 8px; left: 12px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { width: min(200px, calc(100% - 24px)); }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { top: 86px; left: 12px; width: min(208px, calc(100% - 16px)); }
    :is(.workspace.chat-only, .review-chat-history-host) .conversation { padding-top: 89px; }
}
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { width: min(260px, calc(100% - 80px)); padding: 10px 12px; border-radius: 10px; }
.chat-history-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.chat-history-heading { margin: 0; color: #7b8493; font-size: 12px; font-weight: 400; }
.chat-history-add { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px; color: #f35b71; background: transparent; cursor: pointer; }
.chat-history-add:hover { background: #fff0f2; }
.chat-history-add:focus-visible { outline: 2px solid #78bfea; outline-offset: 1px; }
.chat-history-add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chat-history-list { gap: 0; }
.chat-history-item { justify-content: space-between; gap: 10px; min-height: 40px; height: auto; padding: 8px 0; border-radius: 4px; background: transparent; color: #2f343c; }
.chat-history-item:hover, .chat-history-item:focus-visible { background: #f5f6f8; }
.chat-history-item-subject { flex: none; max-width: 75px; overflow: hidden; color: #8a92a0; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { width: 44px; gap: 8px; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar button { width: 44px; height: 44px; padding: 0; border-radius: 50%; justify-content: center !important; }
.chat-history-toolbar button svg { width: 20px; height: 20px; flex: none; }
.chat-history-toolbar button:focus-visible { outline: 3px solid #78bfea; outline-offset: 2px; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { top: 64px; left: 68px; width: min(280px, calc(100% - 80px)); max-height: min(60vh, 460px); padding: 14px; border: 1px solid #e2e6eb; border-radius: 12px; background: #fff; box-shadow: 0 3px 8px rgba(25, 36, 50, .12); }
.chat-history-heading { margin: 0 0 10px; color: #202630; font: 600 14px/1.3 Inter, Arial, sans-serif; }
.chat-history-list { width: 100%; }
:is(.workspace.chat-only, .review-chat-history-host) .conversation { padding-top: 24px; }
@media (max-width: 600px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { top: 8px; left: 12px; width: 44px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { top: 60px; left: 64px; width: min(280px, calc(100% - 76px)); }
    :is(.workspace.chat-only, .review-chat-history-host) .conversation { padding-top: 16px; }
    body #workspace.chat-only #conversation { padding-left: 14px; } /* was 66px, which made room for the old floating buttons and pushed the whole welcome to the right */
}
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { width: min(260px, calc(100% - 80px)); padding: 10px 12px; border-radius: 10px; }
.chat-history-header .chat-history-heading { margin: 0; color: #7b8493; font: 400 12px/1.3 Inter, Arial, sans-serif; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel { scrollbar-width: thin; scrollbar-color: #b8bec6 transparent; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar { width: 6px; background: transparent; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-track,
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-track-piece { background: transparent; border: 0; box-shadow: none; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-thumb { background: #b8bec6; border: 0; border-radius: 999px; }
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-button,
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-button:single-button,
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel::-webkit-scrollbar-button:double-button { display: none; width: 0; height: 0; background: transparent; }
.chat-history-list { width: calc(100% + 12px); margin: 0 -6px; gap: 2px; }
.chat-history-item { min-height: 32px; padding: 6px; border-radius: 9px; }
.chat-history-item:hover, .chat-history-item:focus-visible { background: #fff0f2; color: #d9445c; }
.chat-history-item:focus-visible { outline: 2px solid #f35b71; outline-offset: -2px; }
.chat-history-item:hover .chat-history-item-subject, .chat-history-item:focus-visible .chat-history-item-subject { color: #d9445c; }
.chat-history-new > span { display: none; }
.chat-history-group { display: none; }
/* Widescreen: a persistent left sidebar in the Jojo style (blue New chat pill, folder toggle, TODAY / OLDER CHATS groups). Phones keep the compact layout above. */
@media (min-width: 701px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { top: 12px; left: 12px; right: auto; width: 256px; height: 54px; box-sizing: border-box; flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 7px; border: 1px solid #e4e7ec; border-radius: 14px; background: #fff; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar:has(+ .chat-history-panel:not([hidden])) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-new { flex: 1 1 auto; width: auto; height: 40px; min-width: 0; padding: 0 14px; border-radius: 20px; background: #1a8fd6; color: #fff; font: 600 14px/1 Inter, Arial, sans-serif; justify-content: center !important; gap: 8px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-new > span { display: inline; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-new svg { width: 16px; height: 16px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-new:hover { background: #1580c2; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-toggle { flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border-radius: 12px; background: #f1f2f4; color: #5f6671; justify-content: center !important; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-toggle:hover, :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-toggle[aria-expanded="true"] { background: #e6e8eb; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-toggle svg { width: 20px; height: 20px; stroke-width: 1.7; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { top: 65px; left: 12px; right: auto; bottom: 12px; width: 256px; max-height: none; box-sizing: border-box; padding: 6px 12px 14px; overflow-y: auto; border: 1px solid #e4e7ec; border-top: 0; border-radius: 0 0 14px 14px; background: #fff; box-shadow: none; }
    .chat-history-status { margin: 10px 4px; color: #8a919c; font: 13px/1.4 Inter, Arial, sans-serif; }
    .chat-history-list { width: 100%; margin: 0; gap: 2px; }
    .chat-history-group { display: flex; align-items: center; gap: 10px; margin: 18px 6px 8px; color: #4a4f57; font: 700 12px/1 Inter, Arial, sans-serif; letter-spacing: .04em; text-transform: uppercase; }
    .chat-history-group::after { content: ''; flex: 1 1 auto; height: 1px; background: #e4e7ec; }
    .chat-history-item { height: 36px; min-height: 36px; padding: 0 10px; border-radius: 10px; background: transparent; color: #50565f; font: 500 15px/1.2 Inter, Arial, sans-serif; }
    .chat-history-item:hover, .chat-history-item:focus-visible { background: #f2f3f5; color: #50565f; }
    .chat-history-item:focus-visible { outline: 2px solid #9bd3f2; outline-offset: -2px; }
    .chat-history-item-title { font: inherit; }
    .chat-history-item-subject { display: none; }
}
/* Widescreen: the chat list is a full-height bar docked on the left; the chat and composer make room for it. */
@media (min-width: 701px) {
    :is(.workspace.chat-only .chat-panel, .review-chat-history-host):has(> .chat-history-panel:not([hidden])) { position: relative; padding-left: 272px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { top: 14px; left: 14px; width: 244px; height: 40px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar .chat-history-new { height: 40px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { top: 0; left: 0; right: auto; bottom: 0; width: 272px; height: auto; max-height: none; box-sizing: border-box; padding: 14px; border: 0; border-right: 1px solid #e4e7ec; border-radius: 0; background: #fff; box-shadow: none; }
}
:is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { z-index: 8; }
/* Widescreen: the bar slides in and out, the chat makes room for it, and the sidebar-icon toggle sits beside the bar. */
@media (min-width: 701px) {
    :is(.workspace.chat-only .chat-panel, .review-chat-history-host) { position: relative; transition: padding-left .28s cubic-bezier(.2, .8, .2, 1); }
    :is(.workspace.chat-only .chat-panel, .review-chat-history-host):has(> .chat-history-panel:not([hidden])) { padding-left: 272px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel { display: block; transform: translateX(0); opacity: 1; transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .22s ease, display .28s allow-discrete; }
    /* Keep the open bar's position and size while it slides out, so it leaves to the left instead of jumping into the page flow first. */
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel[hidden] { position: absolute; top: 0; left: 0; bottom: 0; width: 272px; box-sizing: border-box; padding: 14px; z-index: 7; border-right: 1px solid #e4e7ec; background: #fff; display: none; transform: translateX(-100%); opacity: 0; }
    @starting-style { :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel:not([hidden]) { transform: translateX(-100%); opacity: 0; } }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle { position: absolute; top: 14px; left: 12px; z-index: 9; display: grid; place-items: center; width: 36px; height: 36px; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: #5f6671; cursor: pointer; transition: left .28s cubic-bezier(.2, .8, .2, 1), color .15s ease; }
    :is(.workspace.chat-only .chat-panel, .review-chat-history-host):has(> .chat-history-panel:not([hidden])) > .chat-history-toggle { left: 284px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle:hover, :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle:focus-visible { color: #1f2328; background: transparent; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle:focus-visible { outline: 2px solid #9bd3f2; outline-offset: 2px; border-radius: 8px; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
}
/* Widescreen: the New chat button is the first item inside the chat history bar, so it scrolls with the list and goes with the bar when it collapses. */
@media (min-width: 701px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar { display: none; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-new-inline { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 40px; margin: 0 0 12px; padding: 0 14px; border: 0; border-radius: 20px; background: #17a0e3; color: #e0f2fe; font: 600 14px/1 Inter, Arial, sans-serif; cursor: pointer; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-new-inline:hover { background: #1490cc; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-new-inline svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
}
@media (max-width: 700px) {
    .chat-history-new-inline { display: none; }
}
@media (max-width: 700px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle { position: absolute; top: 60px; left: 12px; z-index: 9; display: grid; place-items: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #f2f3f5; color: #454b54; cursor: pointer; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
}

/* Loading chats: the animated mascot from the paper library banner, light grey, centred in the bar with the words below it. */
.chat-history-status:has(.chat-history-loading-icon) { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; margin: 0; padding: 24px 0; color: #b6bcc5; font: 500 14px/1.2 Inter, Arial, sans-serif; pointer-events: none; }
.chat-history-loading-icon { display: block; width: 56px; height: 56px; filter: grayscale(1); opacity: .4; }
@media (min-width: 701px) {
    .chat-history-status:has(.chat-history-loading-icon) { position: absolute; inset: 0; padding: 0; }
}

/* Phones: one button in the top-left corner of the chat screen opens the history in the slide-in list. The floating New chat button and the small
   history popup are gone: New chat is the first row of the list. */
@media (max-width: 700px) {
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toolbar, :is(.workspace.chat-only, .review-chat-history-host) .chat-history-panel { display: none !important; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle { top: 10px; left: 12px; justify-content: center !important; align-items: center; }
    :is(.workspace.chat-only, .review-chat-history-host) .chat-history-toggle svg { margin: 0; flex: none; }
}
/* The history list slides in more slowly and smoothly than the menu lists: only transform and opacity move, so it stays on the GPU. */
@keyframes history-drawer-slide { from { transform: translateX(-100%); } }
@keyframes history-drawer-slide-out { to { transform: translateX(-100%); } }
@media (max-width: 759px) {
    body .mobile-menu-drawer.is-history .mobile-menu-drawer-panel { animation: history-drawer-slide .38s cubic-bezier(.22, 1, .36, 1) both; will-change: transform; }
    body .mobile-menu-drawer.is-history .mobile-menu-drawer-scrim { animation: menu-drawer-fade .38s ease-out both; }
    body .mobile-menu-drawer.is-history.is-closing .mobile-menu-drawer-panel { animation: history-drawer-slide-out .26s cubic-bezier(.4, 0, .2, 1) both; }
    body .mobile-menu-drawer.is-history.is-closing .mobile-menu-drawer-scrim { animation: menu-drawer-fade-out .26s ease-out both; }
    /* No separate X for this list: the corner button itself travels over and becomes the X. */
    body .mobile-menu-drawer.is-history .mobile-menu-drawer-close { display: none; }
    .chat-history-toggle.is-floating { position: fixed; top: var(--top0); left: var(--left0); z-index: 150; display: grid; place-items: center; justify-content: center !important; align-content: center; width: 44px; height: 44px; margin: 0; padding: 0; border: 0; border-radius: 50%; background: #f2f3f5; color: #454b54; cursor: pointer; will-change: transform;
        transition: transform .26s cubic-bezier(.4, 0, .2, 1), background-color .26s ease, border-radius .26s ease, color .26s ease; }
    .chat-history-toggle.is-floating.is-drawer-open { transform: translate(calc(min(58vw, 270px) + 10px - var(--left0)), calc(env(safe-area-inset-top, 0px) + 14px - var(--top0))); border-radius: 14px; background: #fff; color: #8a8a8a;
        transition-duration: .38s; transition-timing-function: cubic-bezier(.22, 1, .36, 1); }
    .chat-history-toggle.is-floating svg { grid-area: 1 / 1; width: 20px; height: 20px; margin: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: opacity .22s ease, transform .38s cubic-bezier(.22, 1, .36, 1); }
    .chat-history-toggle .history-toggle-x { display: none; }
    .chat-history-toggle.is-floating .history-toggle-x { display: block; width: 22px; height: 22px; opacity: 0; transform: rotate(-90deg); }
    .chat-history-toggle.is-floating.is-drawer-open .history-toggle-x { opacity: 1; transform: none; }
    .chat-history-toggle.is-floating.is-drawer-open svg:not(.history-toggle-x) { opacity: 0; transform: rotate(90deg); }
}
.mobile-menu-drawer .drawer-note { margin: 6px 8px; color: #8a919c; font: 500 13px/1.4 var(--menu-font, Inter, Arial, sans-serif); }
.mobile-menu-drawer h3.drawer-group { margin-top: 14px; }
.mobile-menu-drawer.is-history .mobile-menu-drawer-panel { position: relative; }
.mobile-menu-drawer .drawer-loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #b6bcc5; font: 500 14px/1.2 var(--menu-font, Inter, Arial, sans-serif); pointer-events: none; }
