/* =========================================================================
   Grok-Inspired Design System
   ========================================================================= */

/* UniversalSans — Grok's custom typeface */
@font-face {
    font-family: 'universalSans';
    src: url('/static/fonts/UniversalSans_Text_400.p.8e69d71d.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'universalSans';
    src: url('/static/fonts/UniversalSans_Text_400Italic.p.1f7b6952.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'universalSans';
    src: url('/static/fonts/UniversalSans_Text_550.p.8ed2b378.woff2') format('woff2');
    font-weight: 550;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'universalSans';
    src: url('/static/fonts/UniversalSans_Text_550Italic.p.51b28d67.woff2') format('woff2');
    font-weight: 550;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'universalSansDisplay';
    src: url('/static/fonts/UniversalSans_Display_400.p.f3921f1a.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'universalSansDisplay';
    src: url('/static/fonts/UniversalSans_Display_550.p.643f1127.woff2') format('woff2');
    font-weight: 550;
    font-style: normal;
    font-display: swap;
}

/* Ensure [hidden] always wins over component-level display rules */
[hidden] { display: none !important; }

:root {
    /* Colors — Grok Light Mode */
    --surface: #ffffff;
    --surface-container: rgba(255, 255, 255, 0.6);
    --surface-container-low: rgba(255, 255, 255, 0.4);
    --surface-container-highest: #ffffff;
    --surface-container-lowest: #ffffff;
    --surface-bright: rgba(255, 255, 255, 0.85);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-focus-bg: rgba(255, 255, 255, 0.85);
    --glass-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --glass-focus-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-focus-border: rgba(0, 0, 0, 0.15);
    --glass-blur: blur(20px) saturate(180%);

    --sakura-pink: #f9f8f7;
    --morning-white: #f9f8f7;
    --soft-lavender: #f9f8f7;

    --primary: #0a0a0a;
    --primary-dim: #6b6b6b;
    --primary-container: #ebebeb;

    --on-surface: #0a0a0a;
    --on-primary: #ffffff;

    --outline-variant: rgba(0, 0, 0, 0.06);
    --outline-variant-focus: rgba(0, 0, 0, 0.12);

    /* Spacing Tokens */
    --space-4: 1.4rem;
    --space-8: 2.75rem;
    --space-10: 3.5rem;
    --space-20: 7rem;
    --space-24: 8.5rem;

    /* Material 3 organic Radii */
    --radius-xs: 8px;
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 28px;
    --radius-sys: 32px;
    --radius-full: 9999px;

    /* Shadows & Hover Drops */
    --shadow-ambient: 0 12px 48px rgba(0, 0, 0, 0.04);
    --shadow-glass-pop: 0 16px 40px rgba(0,0,0,0.15), 0 0 0 1px rgba(255,255,255,0.05);
    --shadow-glass-pop-light: 0 16px 40px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,0,0,0.05);

    /* ── Sidebar dimensions (change here, applies everywhere) ── */
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 57px;
    --sidebar-btn-collapsed-size: 30px;

    /* ── Common overlay tints (avoids repeated rgba() literals) ── */
    --overlay-xs:       rgba(0, 0, 0, 0.03);
    --overlay-sm:       rgba(0, 0, 0, 0.06);
    --overlay-md:       rgba(0, 0, 0, 0.08);
    --overlay-lg:       rgba(0, 0, 0, 0.12);
    --overlay-white-xs: rgba(255, 255, 255, 0.04);
    --overlay-white-sm: rgba(255, 255, 255, 0.08);
    --overlay-white-md: rgba(255, 255, 255, 0.12);
}


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

body {
    background-color: var(--surface);
    color: var(--on-surface);
    font-family: 'universalSans', 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    letter-spacing: -0.01em;
    font-size: 1rem;
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1,h2,h3,h4,h5,h6 {
    font-family: 'universalSansDisplay', 'universalSans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 550;
    color: var(--on-surface);
}

/* Ambient Blobs */
.ambient-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
}

.blob-1 {
    width: 60vw;
    height: 60vh;
    background: #ffffff;
    top: -10vh;
    left: -10vw;
    animation: floatBlob1 20s infinite alternate ease-in-out;
}

.blob-2 {
    width: 50vw;
    height: 50vh;
    background: #ffffff;
    bottom: -10vh;
    right: -10vw;
    animation: floatBlob2 25s infinite alternate ease-in-out;
}


@keyframes floatBlob1 {
    100% {
        transform: translate(15vw, 15vh) scale(1.1);
    }
}

@keyframes floatBlob2 {
    100% {
        transform: translate(-15vw, -10vh) scale(1.2);
    }
}

/* ============================
   Guest (not logged in) — hide sidebar, full-width layout
   ============================ */
body.is-guest .sidebar {
    display: none !important;
}

body.is-guest .main-content {
    width: 100% !important;
    margin-left: 0 !important;
    border-radius: 0 !important;
}

/* ============================
   Page Layout
   ============================ */
.page-wrapper {
    flex: 1;
    display: flex;
    height: 100vh;
    width: 100vw;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

.page-wrapper.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

.page-wrapper.sidebar-collapsed .sidebar-top .home-link {
    width: auto;
}

.page-wrapper.sidebar-collapsed .sidebar-top .home-link img {
    transform: scale(0.7);
    margin-left: 0;
}

.page-wrapper.sidebar-collapsed .nav-text {
    opacity: 0;
    display: none;
}

.page-wrapper.sidebar-collapsed .icon-toggle-btn#sidebarCloseBtn {
    display: none;
}

.page-wrapper.sidebar-collapsed .expand-btn {
    display: flex !important;
    margin: 12px auto;
    min-width: 30px;
    height: 30x;
    border-radius: 50%;
    font-size: 0.92rem;
    background: var(--surface-container-highest);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(0, 0, 0, 0.03);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .expand-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

.page-wrapper.sidebar-collapsed .history-group-title,
.page-wrapper.sidebar-collapsed .history-item,
.page-wrapper.sidebar-collapsed .nav-divider {
    display: none !important;
}

.page-wrapper.sidebar-collapsed .sidebar-user-btn {
    display: none !important;
}

.page-wrapper.sidebar-collapsed .nav-menu-btn {
    width: var(--sidebar-btn-collapsed-size);
    height: var(--sidebar-btn-collapsed-size);
    padding: 0;
    justify-content: center;
    margin: 0 auto;
    aspect-ratio: 1;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-wrapper.sidebar-collapsed .nav-menu-btn i {
    font-size: 1.2rem;
    margin: 0;
}

/* ============================
   Sidebar (Floating Glass Pane)
   ============================ */
.sidebar {
    width: var(--sidebar-width);
    margin: 0;
    border-radius: 0;
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
    overflow: hidden;
    box-shadow: none;
    border-right: 1px solid var(--glass-border);
}

.sidebar-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 16px;
    min-height: 64px;
    flex-shrink: 0;
}

.home-link {
    position: static;
    display: inline-flex;
    text-decoration: none;
    align-items: center;
    justify-content: flex-start;
    width: 140px;
    height: 36px;
    margin: 0;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.company-logo-mask {
    height: 100%;
    width: 100%;
    /* Gradient: Monochrome Liquid Chrome */
    background: linear-gradient(90deg, #111111, #444444, #888888, #444444, #111111);
    background-size: 250% auto;
    -webkit-mask: url("/static/pepperlabs%20(1).png") no-repeat center;
    -webkit-mask-size: contain;
    mask: url("/static/pepperlabs%20(1).png") no-repeat center;
    mask-size: contain;
    animation: logoShine 4s linear infinite;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes logoShine {
    to {
        background-position: -250% center;
    }
}

.icon-toggle-btn {
    background: transparent;
    border: none;
    color: #000;
    cursor: pointer;
    font-size: 1.2rem;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    margin: 0;
    padding: 0;
    z-index: 2;
}

.icon-toggle-btn:hover {
    background: var(--outline-variant);
    color: #000;
}

.icon-toggle-btn.expand-btn {
    display: none;
    margin-bottom: 8px;
}

/* Sidebar items */
.sidebar-nav-menu {
    display: flex;
    flex-direction: column;
    padding: 0 12px;
    gap: 4px;
    margin-bottom: 1rem;
}

.nav-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-size: 0.2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    overflow: hidden;
    margin: 0 auto;
}

.nav-menu-btn:hover {
    background: var(--surface-container-low);
    color: #000;
}

.nav-menu-btn i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    color: #000;
    transition: color 0.2s;
}

.nav-menu-btn:hover i {
    color: #000;
}

.nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.06);
    font-weight: 600;
    color: #000;
}

.nav-menu-btn.requires-login {
    opacity: 0.84;
}

.nav-menu-btn.requires-login:hover {
    opacity: 1;
}

.nav-menu-btn.active i {
    color: #000;
}

.nav-divider {
    height: 1px;
    background: var(--outline-variant);
    margin: 8px 12px;
}

.history-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 12px 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-dim);
    cursor: pointer;
    transition: all 0.3s;
}

.history-dropdown-header:hover {
    color: var(--on-surface);
}

.history-dropdown-header i {
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.history-dropdown-header.collapsed i {
    transform: rotate(-90deg);
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-content::-webkit-scrollbar {
    width: 4px;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

/* History List / Grouping */
.history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    transition: max-height 0.4s cubic-bezier(0.25, 0.8, 0.25, 1), opacity 0.3s;
    overflow: hidden;
    max-height: 2000px;
    opacity: 1;
}

.history-list.collapsed {
    max-height: 0;
    opacity: 0;
}

.history-group-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-dim);
    text-transform: capitalize;
    letter-spacing: 0.02em;
    margin-top: 16px;
    margin-bottom: 8px;
    padding: 0 12px;
}

.history-group-title::after {
    content: '';
    flex: 1;
    height: 1.5px;
    background: var(--outline-variant);
    opacity: 0.9;
}

.history-item {
    padding: 0.5rem 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--on-surface);
    opacity: 0.85;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.history-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--primary);
}

.history-item.active {
    background: rgba(0, 0, 0, 0.06);
    color: var(--on-surface);
    font-weight: 600;
}

.history-item-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-weight: 500;
}

.history-del-btn {
    background: transparent;
    border: none;
    color: inherit;
    opacity: 0;
    cursor: pointer;
    padding: 6px;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: var(--radius-xs);
    display: block;
    transform: scale(0.9);
}

.history-item:hover .history-del-btn {
    opacity: 0.6;
    transform: scale(1);
}

.history-item.active .history-del-btn {
    color: var(--on-primary);
}

.history-del-btn:hover {
    color: #ff3b30 !important; /* Vivid Apple Red */
    transform: scale(1.15) !important;
    opacity: 1 !important;
}

.history-del-btn:active {
    transform: scale(0.95) !important;
}

.history-placeholder {
    font-size: 0.9rem;
    color: var(--primary-dim);
    font-style: italic;
    padding: 10px;
}

.sidebar-footer {
    padding: 12px;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-user-btn {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--on-surface);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.2s ease;
    font-family: inherit;
    overflow: hidden;
    white-space: nowrap;
}

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

.user-avatar-mimic {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #444, #111);
    flex-shrink: 0;
    box-shadow: var(--glass-shadow);
}

/* ============================
   Guest Navigation Bar (top-right)
   ============================ */
.guest-header {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 999;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
    padding: 0 6px 0 0px;
    background: transparent;
    pointer-events: none;
}

.guest-logo-link {
    pointer-events: auto;
    display: flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.92;
    transition: opacity 0.2s ease;
}

.guest-logo-link:hover {
    opacity: 1;
}

.guest-logo-img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.guest-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 1000;
    max-width: min(100%, 420px);
    pointer-events: auto;
}

/* Settings gear (Grok-style) */
.guest-nav-gear {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    border: 1px solid transparent;
    background: transparent;
    color: #636363;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.guest-nav-gear svg {
    width: 20px;
    height: 20px;
}

.guest-nav-gear:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #050505;
}

.guest-nav-gear.active {
    background: rgba(0, 0, 0, 0.04);
    color: #050505;
}

/* Ghost Button: Sign in (Grok-style) */
.guest-nav-login {
    height: 40px;
    padding: 0 16px;
    border-radius: 9999px;
    border: 1px solid rgba(0, 0, 0, 0.10);
    background: transparent;
    color: #050505;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0;
    text-decoration: none;
    transition: background-color 0.1s ease;
}

.guest-nav-login:hover {
    background: rgba(0, 0, 0, 0.04);
    text-decoration: none;
}

/* Solid Button: Sign up (Grok-style) */
.guest-nav-register {
    height: 40px;
    padding: 0 16px;
    border-radius: 9999px;
    border: none;
    background: #050505;
    color: #ffffff;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.1s ease;
}

.guest-nav-register:hover {
    background: #292929;
    text-decoration: none;
}

/* Settings Dropdown - Glassmorphism */
.settings-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 220px;
    padding: 14px;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(50px) saturate(200%);
    -webkit-backdrop-filter: blur(50px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.08),
        0 2px 8px rgba(0, 0, 0, 0.04),
        inset 0 1px 1px rgba(255, 255, 255, 0.9);
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    transform: scale(0.92) translateY(-6px);
    transform-origin: top right;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

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

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--primary-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-left: 2px;
}

.settings-divider {
    height: 1px;
    background: rgba(0, 0, 0, 0.06);
    margin: 10px 0;
}

.lang-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: var(--on-surface);
    opacity: 0.6;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.25s ease;
    white-space: nowrap;
    flex: 1;
    text-align: center;
}

.lang-btn:hover {
    opacity: 0.85;
    background: rgba(0, 0, 0, 0.04);
}

.lang-btn.active {
    opacity: 1;
    background: #ffffff;
    color: #000000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}


/* ============================
   Main Content
   ============================ */
.main-content {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: transparent;
    /* Changed from Base Layer so blobs can shine */
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--surface-container);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    z-index: 50;
}

.mobile-logo-text {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: 0px;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding-top: 92px;
    position: relative;
    width: 100%;
}

/* Centered Landing State */
.app-container.centered-landing {
    justify-content: center;
    align-items: center;
    padding-top: 64px;
    padding-bottom: 30vh;
}

.app-container.centered-landing .chat-area {
    flex: none;
    height: auto;
    padding: 0;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    max-width: 100%;
}

.app-container.centered-landing .greeting-container {
    flex: none;
    height: auto;
    text-align: center;
}

.app-container.centered-landing .messages {
    display: none;
}

.app-container.centered-landing .input-wrapper {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    margin: 0 auto;
    width: 100%;
    max-width: 802px;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.4rem 1.2rem 11.6rem;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
}

.app-container.guest-cta-visible .chat-area {
    padding-bottom: 16rem;
}

.chat-area::-webkit-scrollbar {
    width: 6px;
}

.chat-area::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

.greeting-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    transition: all 0.5s ease-in-out;
}

.greeting-container h2 {
    font-size: 2.15rem;
    font-weight: 700;
    color: var(--on-surface);
    letter-spacing: -0.02em;
    line-height: 1.2;
    text-align: center;
}

#logoContainer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.logo-icon i {
    font-size: 1.6rem;
    color: var(--on-surface);
}

.logo-text {
    font-size: 1.54rem;
    font-weight: 900;
    letter-spacing: 0.055em;
    margin: 0;
    /* Homepage wordmark: violet → deep purple → berry → orange. */
    background: linear-gradient(90deg, #4d16d6 0%, #42129d 24%, #300a58 45%, #7b1b45 63%, #d6321d 82%, #ff5718 100%);
    background-size: 100% 100%;
    color: transparent;
    -webkit-background-clip: text;
    background-clip: text;
    animation: none;
}

@keyframes textShine {
    to {
        background-position: -200% center;
    }
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 1.35rem;
    width: 100%;
}

/* ============================
   Input Bar - Glass & Gradient
   ============================ */
.input-wrapper {
    position: absolute;
    bottom: clamp(0.6rem, 2vw, 1.3rem);
    left: clamp(0.5rem, 2vw, 1rem);
    right: clamp(0.5rem, 2vw, 1rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.guest-limit-banner {
    width: 100%;
    max-width: 800px;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 12px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    position: relative;
    isolation: isolate;
    transform-origin: center bottom;
}

.guest-limit-banner[hidden] {
    display: none !important;
}

.guest-limit-banner.show {
    display: flex;
}

.guest-limit-banner.attention {
    animation: guestBannerAttention 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.guest-limit-banner.attention::before {
    content: '';
    position: absolute;
    inset: -1px;
    z-index: -1;
    background: linear-gradient(100deg, transparent 0%, rgba(0, 0, 0, 0.03) 18%, rgba(0, 0, 0, 0.14) 42%, rgba(0, 0, 0, 0.03) 66%, transparent 100%);
    transform: translateX(-115%);
    animation: guestBannerSheen 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
    pointer-events: none;
}

@keyframes guestBannerAttention {
    0% {
        transform: translateY(0) scale(0.996);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }
    42% {
        transform: translateY(-1px) scale(1.006);
        box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12), 0 14px 32px rgba(0, 0, 0, 0.12);
    }
    100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
    }
}

@keyframes guestBannerSheen {
    0% {
        transform: translateX(-115%);
    }
    100% {
        transform: translateX(115%);
    }
}

.guest-limit-banner__text {
    flex: 1;
    font-size: 0.94rem;
    font-weight: 600;
    color: var(--on-surface);
    line-height: 1.45;
}

.guest-limit-banner__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.guest-limit-banner__btn {
    height: 40px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    padding: 0 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.guest-limit-banner__btn--secondary {
    background: #ffffff;
    color: #121212;
    border-color: rgba(0, 0, 0, 0.08);
}

.guest-limit-banner__btn--secondary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.guest-limit-banner__btn--primary {
    background: #121212;
    color: #ffffff;
}

.guest-limit-banner__btn--primary:hover {
    transform: translateY(-1px);
    background: #000000;
}

.composer-input {
    width: 100%;
    max-width: 802px;
    display: flex;
    flex-direction: column;
    background: transparent;
    border-radius: 9999px;
    padding: 0;
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), max-height 0.22s ease;
    position: relative;
    z-index: 10;
    isolation: isolate;
}

.composer-input.guest-agent-locked {
    cursor: not-allowed;
}

.composer-input.guest-agent-locked::after {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.03), var(--glass-shadow);
}

.composer-input.guest-agent-locked > * {
    pointer-events: none;
}

.composer-input.guest-agent-locked .input-top-row,
.composer-input.guest-agent-locked .input-bottom-row,
.composer-input.guest-agent-locked .attachments-preview {
    opacity: 0.68;
}

.composer-input.guest-agent-locked textarea,
.composer-input.guest-agent-locked input {
    cursor: not-allowed;
    caret-color: transparent;
}

.composer-input.lock-tap {
    animation: lockedComposerTap 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.composer-input.lock-tap::after {
    border-color: rgba(0, 0, 0, 0.18);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04), var(--glass-shadow);
}

@keyframes lockedComposerTap {
    0% {
        transform: translateY(0) scale(1);
    }
    38% {
        transform: translateY(1px) scale(0.997);
    }
    100% {
        transform: translateY(0) scale(1);
    }
}

.input-wrapper.guest-input-hidden .composer-input {
    display: none;
}

.app-container.guest-input-hidden .chat-area {
    padding-bottom: 8rem;
}

.composer-input::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #f7f7f7;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-radius: inherit;
    z-index: -1;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.composer-input:focus-within::after {
    background: #f7f7f7;
    border-color: rgba(0, 0, 0, 0.10);
    box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.08);
}

.composer-input>* {
    position: relative;
    z-index: 1;
}

.input-top-row {
    display: flex;
    align-items: center;
    padding: clamp(0.4rem, 1.2vw, 0.64rem) clamp(0.4rem, 1.2vw, 0.66rem) clamp(0.4rem, 1.2vw, 0.64rem) clamp(0.5rem, 1.4vw, 0.82rem);
    gap: clamp(6px, 1.2vw, 10px);
}

.composer-main-row {
    min-height: clamp(48px, 8vw, 60px);
}

.composer-input textarea {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: #000000;
    font-size: clamp(0.875rem, 2.2vw, 1rem);
    font-weight: 500;
    font-family: inherit;
    outline: none;
    letter-spacing: 0;
    line-height: 28px;
    min-height: 28px;
    max-height: 168px;
    height: 28px;
    resize: none;
    overflow-y: hidden;
    scrollbar-width: thin;
}

.composer-input textarea::-webkit-scrollbar {
    width: 5px;
}

.composer-input textarea::-webkit-scrollbar-thumb {
    background: var(--outline-variant-focus);
    border-radius: var(--radius-full);
}

.composer-input textarea::placeholder {
    color: var(--primary-dim);
    opacity: 0.6;
}

.input-bottom-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.16rem 0.78rem 0.58rem;
    gap: 8px;
    flex-wrap: wrap;
    min-height: 0;
}

.composer-input.composer-expanded .input-top-row {
    padding-top: 0.74rem;
    padding-bottom: 0.74rem;
    align-items: flex-end;
}

.composer-input.composer-expanded {
    border-radius: 32px;
}

.composer-input:has(.attachments-preview:not(:empty)) {
    border-radius: 30px;
    min-height: 112px;
    justify-content: space-between;
}

.composer-input:has(.attachments-preview:not(:empty)) .input-top-row {
    margin-top: auto;
    padding: 0.12rem clamp(0.4rem, 1.2vw, 0.66rem) 0.01rem clamp(0.5rem, 1.4vw, 0.82rem);
}

.app-container.centered-landing .input-wrapper:has(.attachments-preview:not(:empty)) {
    height: clamp(48px, 8vw, 60px);
    overflow: visible;
}

.app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) {
    min-height: 112px;
    overflow: visible;
}

.app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 14px 22px 2px;
    margin: 0;
    flex-wrap: nowrap;
    overflow: visible;
    scrollbar-width: none;
    z-index: 5;
}

.app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview::-webkit-scrollbar {
    display: none;
}

.app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .input-top-row {
    transform: none;
}

.composer-input.composer-expanded textarea {
    overflow-y: auto;
}

/* Tertiary style buttons for icons */
.icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease-in-out;
    flex-shrink: 0;
}

.icon-btn:hover {
    color: var(--primary);
    background: var(--surface-container-low);
}

.toggles-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.upload-menu-shell {
    position: relative;
    flex-shrink: 0;
}

.img-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    color: #000000 !important;
    font-size: 0;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: background 0.16s ease, transform 0.16s ease;
    flex-shrink: 0;
}

.upload-plus-glyph {
    position: relative;
    display: inline-block;
    width: 14px;
    height: 14px;
    font-size: 0;
    transform: none;
    transition: none;
}

.upload-plus-glyph::before,
.upload-plus-glyph::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    border-radius: 999px;
    background: #000000;
    transform: translate(-50%, -50%);
    transform-origin: center;
    transition:
        width 0.18s ease,
        height 0.18s ease,
        transform 0.24s cubic-bezier(0.18, 1.08, 0.24, 1);
}

.upload-plus-glyph::before {
    width: 13px;
    height: 2px;
}

.upload-plus-glyph::after {
    width: 2px;
    height: 13px;
}

.img-upload-btn:hover {
    background: rgba(0, 0, 0, 0.052);
}

.img-upload-btn:hover .upload-plus-glyph {
    transform: none;
}

.upload-menu-shell.open .upload-plus-glyph,
.upload-menu-shell.open .img-upload-btn:hover .upload-plus-glyph {
    transform: none;
}

.upload-menu-shell.open .upload-plus-glyph::before {
    width: 13px;
    height: 2px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.upload-menu-shell.open .upload-plus-glyph::after {
    width: 13px;
    height: 2px;
    transform: translate(-50%, -50%) rotate(-45deg);
}

.upload-menu-shell.open .img-upload-btn {
    background: rgba(0, 0, 0, 0.072);
}

.upload-dropdown {
    position: absolute;
    left: -2px;
    top: calc(100% + 11px);
    width: 160px;
    padding: 6px;
    border-radius: 14px;
    background: rgba(248, 248, 248, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 6px 19px rgba(0, 0, 0, 0.09);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(0.965);
    transform-origin: top left;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 170;
}

.recent-files-dropdown {
    position: absolute;
    left: 162px;
    top: calc(100% + 52px);
    width: 160px;
    max-height: 236px;
    padding: 7px;
    border-radius: 14px;
    background: rgba(248, 248, 248, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 9px 22px rgba(0, 0, 0, 0.09);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    overflow-y: auto;
    scrollbar-width: none;
    transform: translateX(-7px) scale(0.965);
    transform-origin: top left;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 171;
}

.skills-dropdown {
    position: absolute;
    left: 162px;
    top: calc(100% + 92px);
    width: 198px;
    padding: 7px;
    border-radius: 14px;
    background: rgba(248, 248, 248, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 8px 20px rgba(0, 0, 0, 0.085);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-7px) scale(0.965);
    transform-origin: top left;
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 171;
}

.recent-files-dropdown::-webkit-scrollbar {
    display: none;
}

.upload-menu-shell.open.recent-open .recent-files-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    animation: recentFilesSpring 340ms cubic-bezier(0.18, 1.08, 0.24, 1) both;
}

.upload-menu-shell.agent-mode.open.skills-open .skills-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) scale(1);
    animation: recentFilesSpring 340ms cubic-bezier(0.18, 1.08, 0.24, 1) both;
}

.upload-menu-shell.open .upload-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: uploadDropdownSpring 380ms cubic-bezier(0.18, 1.08, 0.24, 1) both;
}

.app-container:not(.centered-landing) .upload-dropdown {
    top: auto;
    bottom: calc(100% + 11px);
    transform: translateY(8px) scale(0.965);
    transform-origin: bottom left;
}

.app-container:not(.centered-landing) .recent-files-dropdown,
.app-container:not(.centered-landing) .skills-dropdown {
    top: auto;
    bottom: calc(100% + 11px);
    transform-origin: bottom left;
}

.app-container:not(.centered-landing) .upload-menu-shell.open .upload-dropdown {
    transform: translateY(0) scale(1);
    animation: uploadDropdownSpringUp 380ms cubic-bezier(0.18, 1.08, 0.24, 1) both;
}

.upload-menu-item {
    width: 100%;
    height: 32px;
    display: grid;
    grid-template-columns: 21px minmax(0, 1fr) 10px;
    align-items: center;
    gap: 7px;
    padding: 0 7px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #202124;
    font-family: inherit;
    font-size: 14px;
    font-weight: 430;
    letter-spacing: 0;
    line-height: 1;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, transform 0.14s ease;
}

.upload-menu-item:hover {
    background: #ededed;
}

.upload-menu-item:active {
    transform: scale(0.985);
}

.upload-menu-shell.open .upload-menu-item {
    animation: uploadItemSettle 260ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}

.upload-menu-shell.open .upload-menu-item:nth-child(2) {
    animation-delay: 34ms;
}

.upload-menu-shell.open .upload-menu-item:nth-child(4) {
    animation-delay: 68ms;
}

.agent-skill-menu-section {
    display: none;
}

.upload-menu-shell.agent-mode .upload-menu-divider.agent-skill-menu-section {
    display: block;
}

.upload-menu-shell.agent-mode .upload-menu-item.agent-skill-menu-section {
    display: grid;
}

.upload-menu-divider {
    height: 1px;
    margin: 6px 4px;
    background: rgba(0, 0, 0, 0.07);
}

.upload-menu-item.recent-active,
.upload-menu-item.skills-active {
    background: #ededed;
}

.upload-menu-icon,
.upload-menu-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4f5357;
    font-size: 12px;
}

.upload-menu-svg {
    width: 15.5px;
    height: 15.5px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.upload-menu-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transform: translateY(-0.5px);
}

.upload-menu-arrow {
    font-size: 9px;
    color: #6f7377;
}

.recent-file-item {
    width: 100%;
    min-height: 32px;
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 5px 7px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #222222;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, transform 0.14s ease;
}

.recent-file-item:hover {
    background: rgba(0, 0, 0, 0.065);
}

.recent-file-item:active {
    transform: scale(0.985);
}

.recent-file-thumb {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    object-fit: cover;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.recent-file-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
}

.recent-file-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-files-state {
    padding: 8px 9px;
    color: #6f6f6f;
    font-size: 13px;
    line-height: 1.35;
}

.skill-file-item {
    width: 100%;
    min-height: 32px;
    display: grid;
    grid-template-columns: 23px minmax(0, 1fr);
    align-items: center;
    gap: 7px;
    padding: 5px 8px 5px 7px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #202124;
    font-family: inherit;
    font-size: 14px;
    font-weight: 430;
    letter-spacing: 0;
    line-height: 18px;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, transform 0.14s ease;
}

.skill-file-item:hover {
    background: rgba(0, 0, 0, 0.065);
}

.skill-file-item.is-selected {
    background: rgba(0, 0, 0, 0.075);
}

.skill-file-item:active {
    transform: scale(0.985);
}

.skill-file-icon {
    width: 21px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4a4d50;
    transform: translateY(0.1px);
}

.skill-file-svg {
    width: 16.5px;
    height: 16.5px;
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.55;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.skill-file-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.submit-group {
    display: flex;
    align-items: center;
    gap: clamp(4px, 1vw, 8px);
    flex-shrink: 0;
}

.search-mode-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.mode-select-shell {
    position: relative;
    flex-shrink: 0;
}

.mode-select-trigger {
    height: 40px;
    min-width: 76px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 12px 0 15px;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: #111111;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    transition: background 0.16s ease, transform 0.16s ease;
}

.mode-select-shell.open .mode-select-trigger {
    background: rgba(0, 0, 0, 0.072);
}

.mode-select-chevron {
    font-size: 10px;
    transform: rotate(180deg);
    transition: transform 0.18s ease;
}

.mode-select-shell.open .mode-select-chevron {
    transform: rotate(0deg);
}

.mode-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    bottom: auto;
    width: 210px;
    padding: 8px 5px 6px;
    border-radius: 17px;
    background: rgba(248, 248, 248, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 12px 28px rgba(0, 0, 0, 0.10);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-5px) scale(0.985);
    transform-origin: top right;
    transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 160;
}

.mode-select-shell.open .mode-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: modeDropdownSpring 390ms cubic-bezier(0.18, 1.12, 0.25, 1) both;
}

.app-container:not(.centered-landing) .mode-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateY(5px) scale(0.985);
    transform-origin: bottom right;
}

.app-container:not(.centered-landing) .mode-select-shell.open .mode-dropdown {
    transform: translateY(0) scale(1);
    animation: modeDropdownSpringUp 390ms cubic-bezier(0.18, 1.12, 0.25, 1) both;
}

.mode-option {
    width: 100%;
    min-height: 50px;
    display: grid;
    grid-template-columns: 30px 20px 1fr;
    align-items: center;
    gap: 2px;
    padding: 5px 10px 5px 8px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #8f8f8f;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.14s ease, color 0.14s ease;
}

.mode-option:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.045);
    color: #111111;
}

.mode-option.is-selected {
    color: #111111;
}

.mode-option-mark {
    width: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    font-size: 14px;
}

.mode-option-leading-icon {
    width: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    font-size: 13px;
}

.mode-option.is-selected .mode-option-mark {
    color: #111111;
    font-size: 13px;
}

.mode-select-shell.open .mode-option {
    animation: modeOptionSettle 280ms cubic-bezier(0.18, 0.92, 0.28, 1) both;
}

.mode-select-shell.open .mode-option:nth-child(2) {
    animation-delay: 38ms;
}

.mode-option-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mode-option-title {
    color: currentColor;
    font-size: 14px;
    font-weight: 430;
    line-height: 1.18;
    letter-spacing: 0;
}

.mode-option.is-selected .mode-option-title {
    font-weight: 730;
}

.mode-option-subtitle {
    color: #737373;
    font-size: 13px;
    font-weight: 450;
    line-height: 1.25;
    letter-spacing: 0;
}

@keyframes modeDropdownSpring {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.955);
    }
    62% {
        opacity: 1;
        transform: translateY(2px) scale(1.018);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modeDropdownSpringUp {
    0% {
        opacity: 0;
        transform: translateY(8px) scale(0.955);
    }
    62% {
        opacity: 1;
        transform: translateY(-2px) scale(1.018);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes modeOptionSettle {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes uploadDropdownSpring {
    0% {
        opacity: 0;
        transform: translateY(-9px) scale(0.955);
    }
    62% {
        opacity: 1;
        transform: translateY(2px) scale(1.018);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes uploadDropdownSpringUp {
    0% {
        opacity: 0;
        transform: translateY(9px) scale(0.955);
    }
    62% {
        opacity: 1;
        transform: translateY(-2px) scale(1.018);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes uploadItemSettle {
    0% {
        opacity: 0;
        transform: translateY(-4px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes recentFilesSpring {
    0% {
        opacity: 0;
        transform: translateX(-9px) scale(0.955);
    }
    65% {
        opacity: 1;
        transform: translateX(2px) scale(1.014);
    }
    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .mode-dropdown,
    .mode-option,
    .upload-dropdown,
    .recent-files-dropdown,
    .skills-dropdown,
    .connector-dropdown,
    .upload-menu-item,
    .recent-file-item,
    .skill-file-item,
    .upload-plus-glyph,
    .mode-select-chevron,
    .connector-trigger .fa-chevron-up {
        animation: none !important;
        transition: none !important;
    }
}

/* Mobile attachment + connector completion ---------------------------------
   Attachment previews live in normal document flow above the composer row so
   they grow the composer instead of covering its textarea. */
.mobile-connector-sheet {
    display: none;
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .input-wrapper:has(.attachments-preview:not(:empty)),
    .app-container.centered-landing .input-wrapper:has(.attachments-preview:not(:empty)) {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    .composer-input:has(.attachments-preview:not(:empty)),
    .app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) {
        min-height: 118px !important;
        height: auto !important;
        justify-content: flex-start !important;
        border-radius: 24px !important;
        overflow: visible !important;
    }

    .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview,
    .app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        min-height: 52px;
        display: flex !important;
        flex: 0 0 auto;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 9px !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        margin: 0 !important;
        padding: 10px 13px 4px !important;
        scrollbar-width: none;
        z-index: 1 !important;
    }

    .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview::-webkit-scrollbar {
        display: none;
    }

    .composer-input:has(.attachments-preview:not(:empty)) .input-top-row,
    .app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .input-top-row {
        width: 100% !important;
        min-height: 58px !important;
        margin: 0 !important;
        padding: 7px 7px 8px 12px !important;
        transform: none !important;
        z-index: 2 !important;
    }

    .file-pill.image-preview-pill {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
    }

    .file-pill-thumb {
        width: 42px !important;
        height: 42px !important;
        border-radius: 11px !important;
    }

    .file-pill-remove.image-pill-remove {
        top: -8px !important;
        right: -8px !important;
        width: 22px !important;
        min-width: 22px !important;
        height: 22px !important;
    }

    /* Agent connectors use the same top-layer sheet as upload and response
       mode. The desktop dropdown has no mobile fallback path. */
    .connector-dropdown {
        display: none !important;
    }

    .mobile-connector-sheet {
        box-sizing: border-box;
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #171717;
        overflow: visible;
    }

    .mobile-connector-sheet[open] {
        display: block;
    }

    .mobile-connector-sheet::backdrop {
        background: rgba(17, 17, 17, 0.30);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        animation: mobileActionBackdropIn 180ms ease-out both;
    }

    .mobile-connector-sheet__surface {
        box-sizing: border-box;
        width: 100%;
        max-height: min(78dvh, 620px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 10px 18px max(18px, calc(14px + env(safe-area-inset-bottom)));
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: 0;
        border-radius: 28px 28px 0 0;
        background: rgba(255, 255, 255, 0.985);
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.16);
        animation: mobileActionSheetIn 290ms cubic-bezier(0.22, 1, 0.36, 1) both;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-connector-sheet__handle {
        width: 36px;
        height: 4px;
        flex: 0 0 auto;
        margin: 0 auto 12px;
        border-radius: 999px;
        background: #d1d1d1;
    }

    .mobile-connector-sheet__header {
        min-height: 56px;
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 0 2px 10px;
    }

    .mobile-connector-sheet__header h2 {
        margin: 0 0 4px;
        color: #171717;
        font-size: 1.08rem;
        font-weight: 650;
        letter-spacing: -0.01em;
        line-height: 1.2;
    }

    .mobile-connector-sheet__header p {
        margin: 0;
        color: #6f6f6f;
        font-size: 0.86rem;
        line-height: 1.4;
    }

    .mobile-connector-sheet__close {
        width: 42px;
        min-width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: -4px -4px 0 0;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f2f2f2;
        color: #4c4c4c;
        font-size: 1rem;
        cursor: pointer;
    }

    .mobile-connector-sheet__list {
        min-height: 0;
        flex: 1 1 auto;
        display: grid;
        gap: 7px;
        overflow-y: auto;
        overscroll-behavior: contain;
        padding-bottom: 2px;
    }

    .mobile-connector-sheet__list .connector-dropdown-header {
        padding: 5px 5px 3px !important;
        color: #777777 !important;
        font-size: 0.72rem !important;
        letter-spacing: 0.08em !important;
    }

    .mobile-connector-sheet__list .connector-item {
        min-height: 60px;
        padding: 10px 13px !important;
        border: 1px solid transparent;
        border-radius: 17px !important;
        background: #f7f7f7;
        transition: background 160ms ease, transform 160ms ease;
    }

    .mobile-connector-sheet__list .connector-item:active {
        background: #eeeeee;
        transform: scale(0.99);
    }

    .mobile-connector-sheet__list .connector-icon-name {
        gap: 12px;
        color: #252525;
        font-size: 0.95rem;
        font-weight: 600;
    }

    .mobile-connector-sheet__list .liquid-glass-switch {
        width: 46px;
        height: 26px;
        border-radius: 14px;
    }

    .mobile-connector-sheet__list .liquid-glass-switch .slider {
        width: 22px;
        height: 22px;
    }

    .mobile-connector-sheet__list .liquid-glass-switch input:checked + .slider {
        transform: translateX(20px);
    }

    body.mobile-connector-sheet-open .chat-area {
        overscroll-behavior: none;
    }

    .mobile-connector-sheet__close:active {
        transform: scale(0.96);
    }

    .mobile-connector-sheet__close:focus-visible,
    .mobile-connector-sheet__list .liquid-glass-switch:focus-within {
        outline: 3px solid rgba(0, 0, 0, 0.16);
        outline-offset: 2px;
    }
}

@media (max-width: 760px) and (max-height: 500px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .mobile-connector-sheet__surface {
        max-height: min(86dvh, 350px);
        padding-top: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .mobile-connector-sheet__handle {
        margin-bottom: 6px;
    }

    .mobile-connector-sheet__header {
        min-height: 36px;
        padding-bottom: 5px;
    }

    .mobile-connector-sheet__header p {
        display: none;
    }

    .mobile-connector-sheet__list .connector-item {
        min-height: 52px;
        padding-top: 7px !important;
        padding-bottom: 7px !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-connector-sheet::backdrop,
    .mobile-connector-sheet__surface,
    .mobile-connector-sheet__list .connector-item {
        animation: none !important;
        transition: none !important;
    }
}

/* Selection Chips */
.toggle-switch {
    position: relative;
    isolation: isolate;
    width: 38px;
    height: 38px;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    color: var(--on-surface);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    border-radius: var(--radius-full);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
    z-index: 1;
}

.toggle-switch:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: transparent;
    box-shadow: none;
}

.toggle-switch span {
    display: none;
}

.toggle-switch i {
    color: currentColor !important;
}

/* =========================================
   Connectors Dropdown (Agent Mode)
   ========================================= */
.connectors-container {
    position: relative;
}

/* Lift input-wrapper when dropdowns are open so they float above chat content */
.input-wrapper:has(.connectors-container.open),
.input-wrapper:has(.mode-select-shell.open),
.input-wrapper:has(.upload-menu-shell.open) {
    z-index: 9999 !important;
}

.connector-trigger {
    position: relative;
    height: 40px;
    min-width: 134px;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #111111;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px 0 14px;
    border-radius: var(--radius-full);
    transition: background 0.16s ease, transform 0.16s ease;
    z-index: 2;
    white-space: nowrap;
}

.connector-trigger span {
    color: inherit;
}

.connector-trigger:hover {
    background: rgba(0, 0, 0, 0.052);
    box-shadow: none;
    transform: none;
}

.connectors-container.open .connector-trigger {
    background: rgba(0, 0, 0, 0.072);
}

.connector-trigger .fa-chevron-up {
    font-size: 10px;
    transform: rotate(180deg);
    transition: transform 0.18s ease;
}

.connectors-container.open .connector-trigger .fa-chevron-up {
    transform: rotate(0deg);
}

.connector-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    bottom: auto;
    right: 0;
    left: auto;
    width: 272px;
    background: rgba(248, 248, 248, 0.96);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 17px;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.08),
        0 12px 28px rgba(0, 0, 0, 0.10);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-5px) scale(0.985);
    transform-origin: top right;
    transition:
        opacity 0.16s ease,
        visibility 0.16s ease,
        transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 100;
}

.connectors-container.open .connector-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    animation: modeDropdownSpring 390ms cubic-bezier(0.18, 1.12, 0.25, 1) both;
}

.app-container:not(.centered-landing) .connector-dropdown {
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateY(5px) scale(0.985);
    transform-origin: bottom right;
}

.app-container:not(.centered-landing) .connectors-container.open .connector-dropdown {
    transform: translateY(0) scale(1);
    animation: modeDropdownSpringUp 390ms cubic-bezier(0.18, 1.12, 0.25, 1) both;
}

.connector-dropdown-header {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(0, 0, 0, 0.36);
    padding: 6px 12px 4px;
}

.connector-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 12px;
    border-radius: 14px;
    cursor: default;
    transition: background 0.15s;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--on-surface);
}

.connector-item:hover {
    background: rgba(0, 0, 0, 0.042);
}

.connector-icon-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* iOS-style Compact Toggle Switch for Connectors */
.liquid-glass-switch {
    display: inline-block;
    position: relative;
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.12);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.10);
    cursor: pointer;
    transition: background 0.25s ease;
    margin-left: auto;
    flex-shrink: 0;
    overflow: visible;
}

.liquid-glass-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    position: absolute;
}

.liquid-glass-switch .slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24), inset 0 1px 1px rgba(255, 255, 255, 0.95);
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.3, 1.2);
    pointer-events: none;
    z-index: 2;
}

.liquid-glass-switch input:checked + .slider {
    transform: translateX(20px);
}

/* iOS green when checked */
.liquid-glass-switch:has(input:checked) {
    background: #34c759;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.toggle-switch.active {
    color: #ffffff;
    border-color: transparent;
    box-shadow: none;
}

#thinkToggle.active {
    background: #5a1025;
    color: #fff7fa;
    box-shadow: inset 0 0 0 1px rgba(255, 220, 230, 0.08), 0 0 0 1px rgba(74, 12, 30, 0.28), 0 4px 12px rgba(74, 12, 30, 0.2);
}

#webToggle.active {
    background: linear-gradient(145deg, #0f2c49 0%, #12607a 55%, #19aeb2 100%);
    color: #f4ffff;
    box-shadow: inset 0 0 0 1px rgba(220, 255, 255, 0.12), 0 0 0 1px rgba(11, 80, 99, 0.26), 0 4px 12px rgba(9, 76, 102, 0.22);
}

.toggle-switch.active::before {
    display: none;
}

.toggle-switch.active::after {
    display: none;
}

@keyframes rainbowHalo {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Primary Button */
.submit-btn {
    background: #111111;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.16);
}

.submit-btn:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
}

/* States for Submit Button */
.submit-btn.thinking-state, .submit-btn.answering-state {
    background: rgba(0, 0, 0, 0.05);
    color: var(--on-surface);
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.6), 0 2px 8px rgba(0, 0, 0, 0.05);
}

.submit-btn.thinking-state:hover, .submit-btn.answering-state:hover {
    background: rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.8), 0 4px 12px rgba(0, 0, 0, 0.1);
}

.submit-btn.thinking-state {
    position: relative;
}

.submit-btn.thinking-state::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(0,0,0,0.06);
    border-top-color: #c084fc;
    border-right-color: #f472b6;
    animation: submitSpinRing 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    z-index: 0;
}

@keyframes submitSpinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.submit-btn i {
    z-index: 1;
    position: relative;
    transition: transform 0.2s;
}

.submit-btn.thinking-state:hover i, .submit-btn.answering-state:hover i {
    transform: scale(1.15);
}

.wave-icon {
    font-weight: bold;
    font-size: 0.8rem;
    transform: rotate(90deg) translateX(1px);
}

/* ============================
   Message Bubbles - Asymmetry Rule
   ============================ */
.user-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    animation: fadeSlideUp 0.4s ease-in-out;
}

.message-bubble.user {
    background: linear-gradient(135deg, rgba(82, 142, 255, 0.05), rgba(192, 132, 252, 0.05));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.82rem 1rem;
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-sm) var(--radius-xl);
    max-width: min(76%, 720px);
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--on-surface);
    word-break: break-word;
    box-shadow: 
        inset 0 1px 2px rgba(255, 255, 255, 0.8), 
        inset 0 0 0 1px rgba(255, 255, 255, 0.5),
        0 10px 30px -5px rgba(0, 0, 0, 0.05),
        0 0 30px 2px rgba(255, 255, 255, 0.2);
}

.user-msg-actions {
    display: flex;
    gap: 6px;
    padding-right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.user-msg-wrapper:hover .user-msg-actions {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    color: var(--primary);
    background: rgba(0, 0, 0, 0.05);
}

.message-bubble.assistant {
    align-self: flex-start;
    max-width: 100%;
    width: 100%;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
    color: var(--on-surface);
    font-size: 0.96rem;
    line-height: 1.72;
    word-break: break-word;
    animation: fadeSlideUp 0.4s ease-in-out;
}

/* ============================
   Message Wrappers & Action Bars
   ============================ */
.user-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    width: 100%;
    gap: 6px;
}

.assistant-msg-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    gap: 4px;
}

.answer-content {
    width: 100%;
    font-size: 0.96rem;
    line-height: 1.72;
}

.answer-content > :first-child {
    margin-top: 0;
}

.answer-content > :last-child {
    margin-bottom: 0;
}

.msg-action-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 4px;
    margin-bottom: 8px;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.user-msg-wrapper:hover .msg-action-bar,
.assistant-msg-wrapper:hover .msg-action-bar {
    opacity: 1;
}

.msg-action-btn {
    background: transparent;
    border: none;
    color: var(--on-surface);
    opacity: 0.4;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.msg-action-btn:hover {
    opacity: 1;
    background: var(--surface-container-low);
    color: var(--primary);
}

.msg-action-btn.active {
    opacity: 1;
    color: var(--primary);
    background: var(--primary-container);
}

/* ============================
   Thinking Area - The Layering Principle
   ============================ */
.think-wrapper {
    margin-bottom: 0.85rem;
    border-radius: 18px;
    overflow: hidden;
    position: relative;
    background: var(--surface-container-lowest);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    transition: all 0.4s ease-in-out;
    max-width: 100%;
    width: 100%;
}

/* Light mode pulse animation while thinking */
.think-wrapper:not(.done):not(.collapsed) {
    animation: think-pulse-light 2.5s ease-in-out infinite;
}

/* Sidebar refinement pass: lighter typography, calmer spacing, centered collapsed rail. */
.sidebar .nav-menu-btn,
.sidebar .nav-menu-btn.active,
.sidebar .nav-menu-btn .nav-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

.sidebar-content {
    padding-top: 18px !important;
}

.history-dropdown-header {
    padding-top: 4px !important;
    padding-bottom: 10px !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

@media (min-width: 761px) {
    .page-wrapper.sidebar-collapsed .sidebar-nav-menu {
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        gap: 7px !important;
        margin-top: 6px !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn,
    .page-wrapper.sidebar-collapsed .nav-menu-btn.active {
        width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
        margin: 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 14px !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn i {
        width: auto !important;
        margin: 0 !important;
        text-align: center !important;
        font-size: 1.02rem !important;
    }
}

/* Mobile guest baseline; the final mobile override lives at the end of this file. */
@media (max-width: 760px) {
    body.is-guest,
    body.is-guest .page-wrapper,
    body.is-guest .main-content,
    body.is-guest .app-container,
    body.is-guest .app-container.centered-landing,
    body.is-guest .chat-area {
        background: #ffffff !important;
        color: #111111 !important;
    }

    body.is-guest .page-wrapper::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.is-guest .mobile-header {
        height: 62px !important;
        padding: 10px 16px !important;
        background: #ffffff !important;
        color: #111111 !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
    }

    body.is-guest .mobile-logo-text {
        color: #111111 !important;
        font-size: 1.04rem !important;
        font-weight: 680 !important;
        letter-spacing: 0 !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
        color: #5f6368 !important;
        background: transparent !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn:hover,
    body.is-guest .mobile-header .icon-toggle-btn:focus-visible {
        background: #f2f2f2 !important;
    }

    body.is-guest .guest-header {
        top: 10px !important;
        right: 14px !important;
        z-index: 1002 !important;
    }

    body.is-guest .guest-nav-login {
        min-height: 40px !important;
        padding: 0 17px !important;
        border-radius: 999px !important;
        background: #111111 !important;
        color: #ffffff !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
    }

    body.is-guest .app-container.centered-landing {
        min-height: 100dvh !important;
        padding: 0 20px !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        min-height: 100dvh !important;
        margin: 0 !important;
        padding: 116px 0 132px !important;
        justify-content: center !important;
    }

    body.is-guest .greeting-container h2 {
        color: #111111 !important;
        font-size: clamp(2rem, 9.2vw, 2.55rem) !important;
        line-height: 1.12 !important;
        letter-spacing: 0 !important;
        text-align: left !important;
    }

    body.is-guest .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
        z-index: 95 !important;
    }

    body.is-guest .composer-input {
        min-height: 58px !important;
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        color: #111111 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    }

    body.is-guest .composer-input::after {
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }

    body.is-guest .composer-input textarea,
    body.is-guest .mode-select-trigger {
        color: #111111 !important;
    }

    body.is-guest .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
    }

    body.is-guest .mode-select-trigger {
        min-width: 60px !important;
        height: 36px !important;
        padding: 0 8px 0 10px !important;
        background: transparent !important;
        border-color: transparent !important;
        font-size: 0.92rem !important;
    }

    body.is-guest .mode-select-trigger:hover,
    body.is-guest .mode-select-trigger:focus-visible {
        background: #ededed !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 22px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        padding-top: 70px !important;
        padding-bottom: 128px !important;
    }

    body:not(.is-guest) .message-bubble.assistant,
    body:not(.is-guest) .answer-content {
        font-size: 0.98rem !important;
        line-height: 1.7 !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }
}
/* Mobile stability pass: real iOS viewport, centered composer text, smoother drawer. */
@media (max-width: 760px) {
    :root {
        --mobile-header-height: 56px;
        --mobile-shell-height: var(--app-height, 100svh);
        --mobile-composer-height: var(--composer-height, 58px);
        --mobile-inline-padding: 18px;
        --mobile-composer-bottom: max(12px, env(safe-area-inset-bottom));
        --mobile-ease: cubic-bezier(0.22, 1, 0.36, 1);
    }

    html,
    body {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
        background: #ffffff !important;
        overscroll-behavior: none !important;
    }

    .page-wrapper,
    .main-content,
    .app-container {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .main-content,
    body.mobile-sidebar-open .main-content {
        margin-left: 0 !important;
        transform: none !important;
        transition: none !important;
    }

    .mobile-header,
    body.is-guest .mobile-header,
    body:not(.is-guest) .mobile-header {
        position: fixed !important;
        top: var(--vv-offset-top, 0) !important;
        left: 0 !important;
        right: 0 !important;
        height: var(--mobile-header-height) !important;
        padding: 8px 16px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        color: #111111 !important;
        border: 0 !important;
        box-shadow: none !important;
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        z-index: 120 !important;
        transform: translateZ(0);
    }

    .mobile-logo-text,
    body.is-guest .mobile-logo-text,
    body:not(.is-guest) .mobile-logo-text {
        color: #111111 !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        letter-spacing: 0 !important;
    }

    .mobile-header .icon-toggle-btn,
    body.is-guest .mobile-header .icon-toggle-btn,
    body:not(.is-guest) .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        border-radius: 12px !important;
        background: transparent !important;
        color: #5f6368 !important;
        border: 0 !important;
        transition: background-color 150ms ease, transform 150ms ease !important;
    }

    .mobile-header .icon-toggle-btn:active {
        transform: scale(0.96) !important;
    }

    .app-container.centered-landing,
    body.is-guest .app-container.centered-landing {
        display: grid !important;
        grid-template-rows: 1fr !important;
        padding: 0 var(--mobile-inline-padding) !important;
    }

    .app-container.centered-landing .chat-area,
    body.is-guest .app-container.centered-landing .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 18px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 72px) !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    body.is-guest .greeting-container {
        width: min(100%, 430px) !important;
        margin: 0 auto !important;
        text-align: center !important;
    }

    body.is-guest .greeting-container .logo-text,
    body.is-guest .greeting-container h2 br {
        display: none !important;
    }

    body.is-guest .greeting-container h2 {
        color: #111111 !important;
        font-size: clamp(1.95rem, 8vw, 2.32rem) !important;
        line-height: 1.12 !important;
        font-weight: 520 !important;
        letter-spacing: 0 !important;
        text-align: center !important;
        text-wrap: balance;
    }

    .app-container:not(.centered-landing) .chat-area,
    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 20px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 34px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        scroll-padding-bottom: calc(var(--mobile-composer-height) + 42px);
        background: #ffffff !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 20px !important;
    }

    .input-wrapper,
    body.is-guest .input-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: var(--mobile-composer-bottom) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: translateZ(0) !important;
        z-index: 130 !important;
    }

    .composer-input,
    body.is-guest .composer-input,
    body:not(.is-guest) .composer-input {
        min-height: 58px !important;
        border-radius: 31px !important;
        background: #f7f7f7 !important;
        color: #111111 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
        overflow: visible !important;
        transition: box-shadow 150ms ease, background-color 150ms ease, transform 150ms ease !important;
    }

    .composer-input::after,
    body.is-guest .composer-input::after,
    body:not(.is-guest) .composer-input::after {
        border-radius: 31px !important;
        background: #f7f7f7 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .composer-input:focus-within {
        background: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.11) !important;
    }

    .input-top-row,
    body.is-guest .input-top-row,
    body:not(.is-guest) .input-top-row {
        min-height: 58px !important;
        height: auto !important;
        padding: 7px 7px 7px 12px !important;
        gap: 8px !important;
        display: flex !important;
        align-items: center !important;
    }

    .toggles-container,
    .submit-group {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
    }

    .submit-group {
        gap: 7px !important;
    }

    .composer-input textarea,
    body.is-guest .composer-input textarea,
    body:not(.is-guest) .composer-input textarea {
        height: 24px !important;
        min-height: 24px !important;
        max-height: 136px !important;
        line-height: 24px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-self: center !important;
        font-size: 1rem !important;
        font-weight: 400 !important;
        color: #111111 !important;
        overflow-y: hidden;
    }

    .composer-input textarea::placeholder,
    body.is-guest .composer-input textarea::placeholder,
    body:not(.is-guest) .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
        line-height: 24px !important;
    }

    .img-upload-btn,
    .toggle-switch,
    .icon-btn,
    body:not(.is-guest) .img-upload-btn,
    body:not(.is-guest) .toggle-switch,
    body:not(.is-guest) .icon-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        border-radius: 50% !important;
        align-self: center !important;
    }

    .mode-select-trigger,
    body.is-guest .mode-select-trigger,
    body:not(.is-guest) .mode-select-trigger {
        min-width: 62px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 8px 0 10px !important;
        border-radius: 19px !important;
        background: transparent !important;
        border-color: transparent !important;
        color: #44474a !important;
        font-size: 0.95rem !important;
        align-self: center !important;
        transition: background-color 150ms ease !important;
    }

    .mode-select-trigger:hover,
    .mode-select-trigger:focus-visible,
    .mode-select-shell.open .mode-select-trigger {
        background: #ededed !important;
        box-shadow: none !important;
    }

    .submit-btn,
    .submit-btn:hover,
    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover,
    body:not(.is-guest) .submit-btn,
    body:not(.is-guest) .submit-btn:hover {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
        align-self: center !important;
        transition: transform 150ms ease, background-color 150ms ease !important;
    }

    .submit-btn:active {
        transform: scale(0.94) !important;
    }

    body:not(.is-guest) .page-wrapper::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 118;
        background: rgba(0, 0, 0, 0.24);
        opacity: 1;
        pointer-events: auto;
        transition: opacity 220ms var(--mobile-ease);
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed::after {
        opacity: 0;
        pointer-events: none;
    }

    body:not(.is-guest) .sidebar {
        top: 0 !important;
        left: 0 !important;
        width: min(84vw, 320px) !important;
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        border-right: 1px solid #ececec !important;
        box-shadow: 18px 0 44px rgba(0, 0, 0, 0.14) !important;
        transform: translate3d(0, 0, 0) !important;
        opacity: 1 !important;
        overflow: hidden !important;
        will-change: transform;
        transition: transform 260ms var(--mobile-ease), box-shadow 260ms var(--mobile-ease) !important;
        z-index: 140 !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        transform: translate3d(-104%, 0, 0) !important;
        box-shadow: none !important;
    }

    body.mobile-sidebar-open .mobile-header,
    body.mobile-sidebar-open .input-wrapper {
        pointer-events: none !important;
    }
}

/* Mobile stability pass: real iOS viewport, centered composer text, smoother drawer. */
@media (max-width: 760px) {
    :root {
        --mobile-header-height: 56px;
        --mobile-shell-height: var(--app-height, 100svh);
        --mobile-composer-height: var(--composer-height, 58px);
        --mobile-inline-padding: 18px;
        --mobile-composer-bottom: max(12px, env(safe-area-inset-bottom));
        --mobile-ease: cubic-bezier(0.22, 1, 0.36, 1);
    }

    html,
    body {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
        background: #ffffff !important;
        overscroll-behavior: none !important;
    }

    body {
        color: #111111 !important;
        -webkit-text-size-adjust: 100%;
        touch-action: manipulation;
    }

    .page-wrapper,
    .main-content,
    .app-container {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .main-content {
        margin-left: 0 !important;
        transform: translateZ(0);
    }

    .mobile-header,
    body.is-guest .mobile-header,
    body:not(.is-guest) .mobile-header {
        position: fixed !important;
        top: var(--vv-offset-top, 0) !important;
        left: 0 !important;
        right: 0 !important;
        height: var(--mobile-header-height) !important;
        padding: 8px 16px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        color: #111111 !important;
        border: 0 !important;
        box-shadow: none !important;
        backdrop-filter: saturate(180%) blur(16px);
        -webkit-backdrop-filter: saturate(180%) blur(16px);
        z-index: 120 !important;
        transform: translateZ(0);
    }

    .mobile-logo-text,
    body.is-guest .mobile-logo-text,
    body:not(.is-guest) .mobile-logo-text {
        color: #111111 !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        letter-spacing: 0 !important;
    }

    .mobile-header .icon-toggle-btn,
    body.is-guest .mobile-header .icon-toggle-btn,
    body:not(.is-guest) .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
        min-height: 40px !important;
        border-radius: 12px !important;
        background: transparent !important;
        color: #5f6368 !important;
        border: 0 !important;
        transition: background-color 150ms ease, transform 150ms ease !important;
    }

    .mobile-header .icon-toggle-btn:active {
        transform: scale(0.96) !important;
    }

    .app-container.centered-landing,
    body.is-guest .app-container.centered-landing {
        display: grid !important;
        grid-template-rows: 1fr !important;
        padding: 0 var(--mobile-inline-padding) !important;
    }

    .app-container.centered-landing .chat-area,
    body.is-guest .app-container.centered-landing .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 18px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 72px) !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    body.is-guest .greeting-container {
        width: min(100%, 430px) !important;
        margin: 0 auto !important;
        text-align: center !important;
    }

    body.is-guest .greeting-container .logo-text,
    body.is-guest .greeting-container h2 br {
        display: none !important;
    }

    body.is-guest .greeting-container h2 {
        color: #111111 !important;
        font-size: clamp(2rem, 8.2vw, 2.35rem) !important;
        line-height: 1.12 !important;
        font-weight: 520 !important;
        letter-spacing: 0 !important;
        text-align: center !important;
        text-wrap: balance;
    }

    .app-container:not(.centered-landing) .chat-area,
    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 20px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 34px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        scroll-padding-bottom: calc(var(--mobile-composer-height) + 42px);
        background: #ffffff !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 20px !important;
    }

    .input-wrapper,
    body.is-guest .input-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: var(--mobile-composer-bottom) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: translateZ(0) !important;
        z-index: 130 !important;
    }

    .composer-input,
    body.is-guest .composer-input,
    body:not(.is-guest) .composer-input {
        min-height: 58px !important;
        border-radius: 31px !important;
        background: #f7f7f7 !important;
        color: #111111 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
        overflow: visible !important;
        transition: box-shadow 150ms ease, background-color 150ms ease, transform 150ms ease !important;
    }

    .composer-input::after,
    body.is-guest .composer-input::after,
    body:not(.is-guest) .composer-input::after {
        border-radius: 31px !important;
        background: #f7f7f7 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .composer-input:focus-within {
        background: #ffffff !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.11) !important;
    }

    .input-top-row,
    body.is-guest .input-top-row,
    body:not(.is-guest) .input-top-row {
        min-height: 58px !important;
        height: auto !important;
        padding: 7px 7px 7px 12px !important;
        gap: 8px !important;
        display: flex !important;
        align-items: center !important;
    }

    .toggles-container {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
    }

    .composer-input textarea,
    body.is-guest .composer-input textarea,
    body:not(.is-guest) .composer-input textarea {
        height: 24px !important;
        min-height: 24px !important;
        max-height: 136px !important;
        line-height: 24px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-self: center !important;
        font-size: 1rem !important;
        font-weight: 400 !important;
        color: #111111 !important;
        overflow-y: hidden;
    }

    .composer-input textarea::placeholder,
    body.is-guest .composer-input textarea::placeholder,
    body:not(.is-guest) .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
        line-height: 24px !important;
    }

    .img-upload-btn,
    .toggle-switch,
    .icon-btn,
    body:not(.is-guest) .img-upload-btn,
    body:not(.is-guest) .toggle-switch,
    body:not(.is-guest) .icon-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        border-radius: 50% !important;
        align-self: center !important;
    }

    .submit-group {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
        gap: 7px !important;
    }

    .mode-select-trigger,
    body.is-guest .mode-select-trigger,
    body:not(.is-guest) .mode-select-trigger {
        min-width: 62px !important;
        height: 38px !important;
        min-height: 38px !important;
        padding: 0 8px 0 10px !important;
        border-radius: 19px !important;
        background: transparent !important;
        border-color: transparent !important;
        color: #44474a !important;
        font-size: 0.95rem !important;
        align-self: center !important;
        transition: background-color 150ms ease !important;
    }

    .mode-select-trigger:hover,
    .mode-select-trigger:focus-visible,
    .mode-select-shell.open .mode-select-trigger {
        background: #ededed !important;
        box-shadow: none !important;
    }

    .submit-btn,
    .submit-btn:hover,
    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover,
    body:not(.is-guest) .submit-btn,
    body:not(.is-guest) .submit-btn:hover {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
        align-self: center !important;
        transition: transform 150ms ease, background-color 150ms ease !important;
    }

    .submit-btn:active {
        transform: scale(0.94) !important;
    }

    body:not(.is-guest) .page-wrapper::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 118;
        background: rgba(0, 0, 0, 0.24);
        opacity: 1;
        pointer-events: auto;
        transition: opacity 220ms var(--mobile-ease);
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed::after {
        opacity: 0;
        pointer-events: none;
    }

    body:not(.is-guest) .sidebar {
        top: 0 !important;
        left: 0 !important;
        width: min(84vw, 320px) !important;
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        border-right: 1px solid #ececec !important;
        box-shadow: 18px 0 44px rgba(0, 0, 0, 0.14) !important;
        transform: translate3d(0, 0, 0) !important;
        opacity: 1 !important;
        overflow: hidden !important;
        will-change: transform;
        transition: transform 260ms var(--mobile-ease), box-shadow 260ms var(--mobile-ease) !important;
        z-index: 140 !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        transform: translate3d(-104%, 0, 0) !important;
        box-shadow: none !important;
    }

    body.mobile-sidebar-open .mobile-header,
    body.mobile-sidebar-open .input-wrapper {
        pointer-events: none !important;
    }

    body.mobile-sidebar-open .main-content {
        transform: none !important;
        transition: none !important;
    }
}

/* Mobile-only finish: keep the phone layout light, compact, and thumb-friendly. */
@media (max-width: 760px) {
    body.is-guest,
    body.is-guest .page-wrapper,
    body.is-guest .main-content,
    body.is-guest .app-container.centered-landing,
    body.is-guest .chat-area {
        background: #ffffff !important;
        color: #111111 !important;
    }

    body.is-guest .page-wrapper::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.is-guest .mobile-header {
        height: 62px !important;
        padding: 10px 16px !important;
        background: #ffffff !important;
        color: #111111 !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
    }

    body.is-guest .mobile-logo-text {
        color: #111111 !important;
        font-size: 1.04rem !important;
        font-weight: 680 !important;
        letter-spacing: 0 !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
        color: #5f6368 !important;
        background: transparent !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn:hover,
    body.is-guest .mobile-header .icon-toggle-btn:focus-visible {
        background: #f2f2f2 !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn svg,
    body.is-guest .mobile-header .icon-toggle-btn path {
        stroke: currentColor !important;
    }

    body.is-guest .guest-header {
        top: 10px !important;
        right: 14px !important;
        z-index: 1002 !important;
    }

    body.is-guest .guest-nav-login {
        min-height: 40px !important;
        padding: 0 17px !important;
        border-radius: 999px !important;
        background: #111111 !important;
        color: #ffffff !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
    }

    body.is-guest .app-container.centered-landing {
        min-height: 100dvh !important;
        padding: 0 20px !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        min-height: 100dvh !important;
        margin: 0 !important;
        padding: 116px 0 132px !important;
        justify-content: center !important;
    }

    body.is-guest .greeting-container h2 {
        color: #111111 !important;
        font-size: clamp(2rem, 9.2vw, 2.55rem) !important;
        line-height: 1.12 !important;
        letter-spacing: 0 !important;
        text-align: left !important;
    }

    body.is-guest .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
        z-index: 95 !important;
    }

    body.is-guest .composer-input {
        min-height: 58px !important;
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        color: #111111 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    }

    body.is-guest .composer-input::after {
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }

    body.is-guest .composer-input textarea {
        color: #111111 !important;
    }

    body.is-guest .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
    }

    body.is-guest .mode-select-trigger {
        min-width: 60px !important;
        height: 36px !important;
        padding: 0 8px 0 10px !important;
        color: #111111 !important;
        background: transparent !important;
        border-color: transparent !important;
        font-size: 0.92rem !important;
    }

    body.is-guest .mode-select-trigger:hover,
    body.is-guest .mode-select-trigger:focus-visible {
        background: #ededed !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 22px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        padding-top: 70px !important;
        padding-bottom: 128px !important;
    }

    body:not(.is-guest) .message-bubble.assistant,
    body:not(.is-guest) .answer-content {
        font-size: 0.98rem !important;
        line-height: 1.7 !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }
}

@media (max-width: 760px) {
    body.is-guest .nav-menu-btn,
    body.is-guest .nav-menu-btn.active,
    body.is-guest .nav-menu-btn .nav-text {
        font-weight: 400 !important;
    }
}

/* =====================================================
   2026 Polish: Compact Sidebar, Rich Answers, Mobile Guest
   ===================================================== */
.sidebar-nav-menu {
    gap: 1px !important;
    padding: 0 10px !important;
    margin: 2px 0 0.42rem !important;
}

.nav-menu-btn,
.nav-menu-btn.active {
    min-height: 36px !important;
    margin: 0 !important;
    padding: 7px 10px !important;
    gap: 12px !important;
    border-radius: var(--sidebar-hover-radius) !important;
    font-size: 0.94rem !important;
    font-weight: 560 !important;
    letter-spacing: 0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.nav-menu-btn i {
    width: 24px !important;
    font-size: 1.05rem !important;
    color: currentColor !important;
}

.nav-menu-btn:hover {
    background: rgba(0, 0, 0, 0.055) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.08) !important;
    color: var(--on-surface) !important;
}

.markdown-content a.md-link,
.markdown-content a {
    display: inline;
    color: #0b57d0;
    border-bottom: 0;
    background: rgba(11, 87, 208, 0.075);
    border-radius: 7px;
    padding: 1px 6px 2px;
    font-weight: 650;
    line-height: 1.72;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.markdown-content a.md-link::after,
.markdown-content a::after {
    content: "↗";
    font-size: 0.72em;
    margin-left: 3px;
    opacity: 0.72;
}

.markdown-content a.md-link:hover,
.markdown-content a:hover {
    color: #063f9e;
    background: rgba(11, 87, 208, 0.13);
    border-bottom: 0;
    padding: 1px 6px 2px;
}

.price-badge {
    background: #111111 !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.72) !important;
    border-radius: var(--radius-full) !important;
    box-shadow: none !important;
    padding: 2px 8px 3px !important;
    font-weight: 760 !important;
    font-size: 0.88em !important;
}

/* Responsive composer sizing: keep the original desktop length, shrink only on narrow viewports. */
@media (max-width: 860px) {
    .app-container.centered-landing .input-wrapper,
    .input-wrapper {
        max-width: calc(100vw - 32px);
    }

    .composer-input,
    .guest-limit-banner {
        max-width: 100%;
    }
}

@media (min-width: 861px) {
    .composer-input {
        width: 100%;
        max-width: 802px;
    }
}

@media (max-width: 760px) {
    body.is-guest {
        background: #000000;
    }

    body.is-guest .page-wrapper,
    body.is-guest .main-content,
    body.is-guest .app-container,
    body.is-guest .chat-area {
        background: #000000 !important;
        color: #ffffff;
    }

    body.is-guest .mobile-header {
        height: 86px;
        padding: 28px 24px 12px;
        background: #000000 !important;
        color: #ffffff;
        border: 0;
        box-shadow: none;
    }

    body.is-guest .mobile-header .icon-toggle-btn {
        width: 36px;
        height: 36px;
        color: #ffffff;
        font-size: 1.34rem;
        background: transparent;
    }

    body.is-guest .mobile-logo-text {
        color: #ffffff;
        font-size: 1.34rem;
        font-weight: 700;
    }

    body.is-guest .guest-header {
        top: 26px;
        right: 22px;
        z-index: 1100;
    }

    body.is-guest .guest-logo-link {
        display: none;
    }

    body.is-guest .guest-nav-login {
        min-height: 52px;
        padding: 0 22px;
        border-radius: var(--radius-full);
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #ffffff !important;
        font-size: 1rem;
        font-weight: 700;
    }

    body.is-guest .guest-nav-register,
    body.is-guest .guest-nav-gear {
        display: none !important;
    }

    body.is-guest .app-container,
    body.is-guest .app-container.centered-landing {
        padding: 96px 20px 0 !important;
        min-height: 100%;
    }

    body.is-guest .app-container.centered-landing {
        justify-content: center;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        margin-bottom: clamp(150px, 27vh, 230px);
    }

    body.is-guest .greeting-container h2 {
        color: #ffffff;
        font-size: clamp(2.02rem, 8.8vw, 2.7rem);
        line-height: 1.18;
        font-weight: 400;
        letter-spacing: 0;
    }

    body.is-guest .greeting-container .logo-text,
    body.is-guest .greeting-container h2 br {
        display: none;
    }

    body.is-guest .input-wrapper {
        left: 20px;
        right: 20px;
        bottom: max(22px, env(safe-area-inset-bottom));
    }

    body.is-guest .composer-input {
        min-height: 62px;
        border-radius: 32px;
        background: #262626 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.is-guest .composer-input::after {
        display: none !important;
    }

    body.is-guest .input-top-row {
        min-height: 62px;
        padding: 0 8px 0 14px !important;
        gap: 10px;
    }

    body.is-guest .composer-input textarea {
        color: #ffffff;
        min-height: 34px;
        height: 34px;
        line-height: 34px;
        padding: 0;
        font-size: 1rem;
        font-weight: 500;
    }

    body.is-guest .composer-input textarea::placeholder {
        color: rgba(255, 255, 255, 0.62);
        opacity: 1;
    }

    /* Hide web/think toggles on mobile guest — cleaner like ChatGPT */
    body.is-guest .toggles-container {
        display: none !important;
    }

    body.is-guest .connector-trigger {
        width: 42px !important;
        height: 42px !important;
        border: 0 !important;
        background: #2c2c2e !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        color: rgba(255, 255, 255, 0.80) !important;
        box-shadow: none !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    body.is-guest .connector-trigger span {
        display: none !important;
    }

    body.is-guest .submit-btn {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        background: #ffffff !important;
        color: #000000 !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 1.1rem !important;
    }

    body.is-guest .guest-limit-banner {
        background: #111111;
        color: #ffffff;
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: none;
    }

    body.is-guest .guest-limit-banner__text {
        color: rgba(255, 255, 255, 0.82);
    }

    body.is-guest .sidebar {
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 340px);
        border-radius: 0;
        background: #000000;
        box-shadow: none;
        padding-top: 18px;
    }

    body.is-guest .sidebar-top {
        min-height: 112px;
        padding: 22px 26px 20px;
        justify-content: space-between;
    }

    body.is-guest .sidebar-top .home-link {
        position: static;
        transform: none;
        width: 74px;
        height: 54px;
    }

    body.is-guest .main-logo-img {
        height: 54px;
        max-width: 96px;
    }

    body.is-guest .sidebar-top .icon-toggle-btn {
        color: rgba(255, 255, 255, 0.76);
        font-size: 1.7rem;
    }

    body.is-guest .sidebar-nav-menu {
        padding: 0 18px !important;
        gap: 6px !important;
    }

    body.is-guest .nav-menu-btn,
    body.is-guest .nav-menu-btn.active {
        min-height: 58px !important;
        padding: 10px 24px !important;
        border-radius: 16px !important;
        color: #ffffff !important;
        font-size: 1.36rem !important;
        font-weight: 500 !important;
    }

    body.is-guest .nav-menu-btn i {
        width: 36px !important;
        font-size: 1.52rem !important;
    }

    body.is-guest .nav-menu-btn.active,
    body.is-guest .nav-menu-btn:hover {
        background: #303030 !important;
    }

    body.is-guest .sidebar-content,
    body.is-guest .sidebar-footer {
        display: none;
    }
}

/* Final clean controls layer: quieter, ChatGPT-like icon buttons. */
:root {
    --clean-control-size: 36px;
    --clean-icon-size: 18px;
    --clean-radius: 10px;
    --clean-pill-radius: 999px;
    --clean-hover-bg: #f1f1f1;
    --clean-active-bg: #eeeeee;
    --clean-control-fg: #5f6368;
    --clean-strong-fg: #202124;
    --clean-border: rgba(0, 0, 0, 0.10);
}

body:not(.is-guest) .sidebar-top {
    min-height: 64px !important;
    padding: 0 14px !important;
    align-items: center !important;
    justify-content: flex-end !important;
}

#sidebarCloseBtn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--clean-control-fg) !important;
    box-shadow: none !important;
    transform: none !important;
}

#sidebarCloseBtn:hover,
#sidebarCloseBtn:focus-visible {
    background: var(--clean-hover-bg) !important;
    color: var(--clean-strong-fg) !important;
    box-shadow: none !important;
    transform: none !important;
}

#sidebarCloseBtn .sidebar-action-svg {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2 !important;
    transform: none !important;
}

#sidebarCloseBtn:hover .sidebar-action-svg,
#sidebarCloseBtn:focus-visible .sidebar-action-svg {
    transform: none !important;
}

body:not(.is-guest) .sidebar-nav-menu {
    padding: 0 8px !important;
    gap: 2px !important;
    margin: -2px 0 0.5rem !important;
}

body:not(.is-guest) .nav-menu-btn,
body:not(.is-guest) .nav-menu-btn.active {
    min-height: 40px !important;
    height: 40px !important;
    grid-template-columns: 24px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: var(--clean-radius) !important;
    color: var(--clean-strong-fg) !important;
    background: transparent !important;
    box-shadow: none !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transform: none !important;
}

body:not(.is-guest) .nav-menu-btn::before {
    inset: 0 !important;
    border-radius: var(--clean-radius) !important;
    background: var(--clean-hover-bg) !important;
}

body:not(.is-guest) .nav-menu-btn:hover,
body:not(.is-guest) .nav-menu-btn.active {
    background: transparent !important;
    color: #111111 !important;
}

body:not(.is-guest) .nav-menu-btn.active::before {
    background: var(--clean-active-bg) !important;
    opacity: 1 !important;
}

body:not(.is-guest) .nav-menu-btn:hover::before {
    opacity: 1 !important;
}

body:not(.is-guest) .nav-menu-btn .sidebar-nav-svg {
    width: var(--clean-icon-size) !important;
    height: var(--clean-icon-size) !important;
    stroke-width: 2.2 !important;
    opacity: 0.92 !important;
    transform: none !important;
}

body:not(.is-guest) .nav-menu-btn:hover .sidebar-nav-svg,
body:not(.is-guest) .nav-menu-btn.active .sidebar-nav-svg,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-chat,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-search,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-agent {
    opacity: 1 !important;
    stroke-width: 2.2 !important;
    transform: none !important;
}

body:not(.is-guest) .sidebar .nav-menu-btn .nav-text {
    transform: none !important;
    font-size: 14px !important;
    font-weight: 550 !important;
}

@media (min-width: 761px) {
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn.active {
        width: 32px !important;
        min-width: 32px !important;
        max-width: 32px !important;
        height: 32px !important;
        min-height: 32px !important;
        border-radius: 9px !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn::before {
        inset: 0 !important;
        border-radius: 9px !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn .sidebar-nav-svg {
        width: 18px !important;
        height: 18px !important;
        transform: none !important;
    }
}

body:not(.is-guest) .history-dropdown-header,
body:not(.is-guest) #historyList .history-item,
body:not(.is-guest) .sidebar-user-btn,
body:not(.is-guest) .ctx-menu-item {
    border-radius: var(--clean-radius) !important;
    box-shadow: none !important;
    transition: background 150ms ease, color 150ms ease !important;
}

body:not(.is-guest) .history-dropdown-header:hover,
body:not(.is-guest) #historyList .history-item:hover,
body:not(.is-guest) #historyList .history-item.active,
body:not(.is-guest) .sidebar-user-btn:hover,
body:not(.is-guest) .ctx-menu-item:hover {
    background: var(--clean-hover-bg) !important;
    color: #111111 !important;
}

body:not(.is-guest) .composer-input {
    border-radius: 28px !important;
    box-shadow: none !important;
}

body:not(.is-guest) .composer-input::after {
    background: #f7f7f7 !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    box-shadow: none !important;
}

body:not(.is-guest) .composer-input:focus-within::after {
    background: #ffffff !important;
    border-color: rgba(0, 0, 0, 0.12) !important;
    box-shadow: none !important;
}

body:not(.is-guest) .input-top-row {
    min-height: 56px !important;
    padding: 10px 10px 10px 12px !important;
    gap: 6px !important;
}

body:not(.is-guest) .composer-input textarea {
    font-weight: 400 !important;
    color: #111111 !important;
}

body:not(.is-guest) .composer-input textarea::placeholder {
    color: #7a7a7a !important;
    opacity: 1 !important;
}

body:not(.is-guest) .img-upload-btn,
body:not(.is-guest) .toggle-switch,
body:not(.is-guest) .icon-btn {
    width: var(--clean-control-size) !important;
    min-width: var(--clean-control-size) !important;
    height: var(--clean-control-size) !important;
    min-height: var(--clean-control-size) !important;
    border: 0 !important;
    border-radius: var(--clean-pill-radius) !important;
    background: transparent !important;
    color: var(--clean-control-fg) !important;
    box-shadow: none !important;
    transform: none !important;
    padding: 0 !important;
}

body:not(.is-guest) .img-upload-btn:hover,
body:not(.is-guest) .toggle-switch:hover,
body:not(.is-guest) .icon-btn:hover {
    background: var(--clean-hover-bg) !important;
    color: var(--clean-strong-fg) !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .upload-plus-glyph {
    width: 15px !important;
    height: 15px !important;
    transform: none !important;
}

body:not(.is-guest) .upload-plus-glyph::before,
body:not(.is-guest) .upload-plus-glyph::after {
    background: currentColor !important;
    transition: transform 160ms ease !important;
}

body:not(.is-guest) .upload-plus-glyph::before {
    width: 14px !important;
    height: 1.8px !important;
}

body:not(.is-guest) .upload-plus-glyph::after {
    width: 1.8px !important;
    height: 14px !important;
}

body:not(.is-guest) .mode-select-trigger,
body:not(.is-guest) .connector-trigger {
    height: 36px !important;
    min-height: 36px !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: transparent !important;
    color: var(--clean-control-fg) !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transform: none !important;
}

body:not(.is-guest) .mode-select-trigger {
    min-width: 68px !important;
    padding: 0 11px !important;
}

body:not(.is-guest) .connector-trigger {
    min-width: 0 !important;
    padding: 0 12px !important;
    gap: 6px !important;
}

body:not(.is-guest) .connector-trigger > i:first-child {
    color: currentColor !important;
}

body:not(.is-guest) .mode-select-trigger:hover,
body:not(.is-guest) .mode-select-shell.open .mode-select-trigger,
body:not(.is-guest) .connector-trigger:hover,
body:not(.is-guest) .connectors-container.open .connector-trigger {
    background: var(--clean-hover-bg) !important;
    color: var(--clean-strong-fg) !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .submit-btn {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    flex: 0 0 34px !important;
    border: 0 !important;
    border-radius: var(--clean-pill-radius) !important;
    background: #111111 !important;
    color: #ffffff !important;
    box-shadow: none !important;
    transform: none !important;
    font-size: 0.95rem !important;
}

body:not(.is-guest) .submit-btn:hover {
    background: #2f2f2f !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .submit-btn.thinking-state,
body:not(.is-guest) .submit-btn.answering-state,
body:not(.is-guest) .submit-btn.paused-state {
    background: var(--clean-hover-bg) !important;
    color: var(--clean-strong-fg) !important;
    border: 0 !important;
    box-shadow: none !important;
}

body:not(.is-guest) .submit-btn.thinking-state:hover i,
body:not(.is-guest) .submit-btn.answering-state:hover i,
body:not(.is-guest) .submit-btn:hover i {
    transform: none !important;
}

body:not(.is-guest) .toggle-switch.active,
body:not(.is-guest) #thinkToggle.active,
body:not(.is-guest) #webToggle.active {
    background: var(--clean-active-bg) !important;
    color: var(--clean-strong-fg) !important;
    border: 0 !important;
    box-shadow: none !important;
}

body:not(.is-guest) .upload-dropdown,
body:not(.is-guest) .mode-dropdown,
body:not(.is-guest) .connector-dropdown {
    background: rgba(255, 255, 255, 0.98) !important;
    border: 1px solid var(--clean-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.10) !important;
}

body:not(.is-guest) .upload-menu-item,
body:not(.is-guest) .skill-file-item,
body:not(.is-guest) .mode-option,
body:not(.is-guest) .connector-item {
    border-radius: 10px !important;
    box-shadow: none !important;
    transition: background 150ms ease, color 150ms ease !important;
}

body:not(.is-guest) .upload-menu-item:hover,
body:not(.is-guest) .skill-file-item:hover,
body:not(.is-guest) .mode-option:hover,
body:not(.is-guest) .mode-option.is-selected,
body:not(.is-guest) .connector-item:hover {
    background: var(--clean-hover-bg) !important;
    color: var(--clean-strong-fg) !important;
}

@media (max-width: 760px) {
    body:not(.is-guest) .input-top-row {
        min-height: 58px !important;
        padding: 10px 10px 10px 12px !important;
    }

    body:not(.is-guest) .img-upload-btn,
    body:not(.is-guest) .toggle-switch,
    body:not(.is-guest) .icon-btn,
    body:not(.is-guest) .mode-select-trigger,
    body:not(.is-guest) .connector-trigger {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
    }

    body:not(.is-guest) .submit-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        flex-basis: 38px !important;
    }
}

/* Final message polish: user bubbles and their hover actions. */
.sidebar-top {
    align-items: center !important;
    justify-content: flex-end !important;
    padding: 0 12px 0 14px !important;
}

.user-msg-wrapper {
    align-items: flex-end !important;
    gap: 4px !important;
}

.user-message-shell {
    align-self: flex-end;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: min(70%, 680px);
}

.user-msg-wrapper.user-msg-editing .user-message-shell {
    width: min(70%, 680px);
    max-width: min(70%, 680px);
    align-items: stretch;
}

.message-bubble.user {
    align-self: center !important;
    max-width: 100% !important;
    width: fit-content;
    background: #f4f4f4 !important;
    color: #0d0d0d !important;
    border: 0 !important;
    border-radius: 24px !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 10px 18px !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
    word-break: break-word;
}

.message-bubble.user .markdown-content {
    color: inherit !important;
}

.message-bubble.user .markdown-content > :first-child {
    margin-top: 0 !important;
}

.message-bubble.user .markdown-content > :last-child {
    margin-bottom: 0 !important;
}

.message-bubble.user .markdown-content p {
    margin: 0 !important;
}

.message-bubble.user .markdown-content p + p {
    margin-top: 0.55rem !important;
}

.user-msg-action-bar {
    align-self: center !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    margin: 4px 0 0 !important;
    padding: 0 !important;
    opacity: 0 !important;
    transform: translateY(-2px) !important;
    pointer-events: none;
    transition: opacity 160ms ease, transform 160ms ease !important;
}

.user-msg-wrapper:hover .user-msg-action-bar,
.user-msg-wrapper.user-msg-editing .user-msg-action-bar,
.user-msg-action-bar:focus-within {
    opacity: 1 !important;
    transform: translateY(0) !important;
    pointer-events: auto;
}

.user-msg-action-bar .msg-action-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #5f6368 !important;
    opacity: 1 !important;
    border: 0 !important;
    box-shadow: none !important;
    font-size: 1.12rem !important;
}

.user-msg-action-bar .msg-action-btn:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: #202124 !important;
}

.user-edit-input {
    align-self: stretch !important;
    width: min(70vw, 680px) !important;
    max-width: 100% !important;
    min-height: 46px !important;
    margin: 0 !important;
    padding: 11px 18px !important;
    resize: none !important;
    overflow-y: auto !important;
    background: #f4f4f4 !important;
    color: #0d0d0d !important;
    border: 0 !important;
    border-radius: 24px !important;
    box-shadow: none !important;
    line-height: 1.5 !important;
}

.user-edit-input:focus {
    border: 0 !important;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.10) !important;
}

@media (max-width: 760px) {
    .user-message-shell {
        max-width: 88%;
    }

    .user-msg-wrapper.user-msg-editing .user-message-shell {
        width: 88%;
        max-width: 88%;
    }

    .message-bubble.user {
        font-size: 0.96rem !important;
    }

    .user-edit-input {
        width: 100% !important;
    }
}

/* Sidebar final adjustment for lighter text and centered collapsed icons. */
.sidebar .nav-menu-btn,
.sidebar .nav-menu-btn.active,
.sidebar .nav-menu-btn .nav-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

.sidebar-content {
    padding-top: 18px !important;
}

.history-dropdown-header {
    padding-top: 4px !important;
    padding-bottom: 10px !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

@media (min-width: 761px) {
    .page-wrapper.sidebar-collapsed .sidebar-nav-menu {
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 !important;
        gap: 7px !important;
        margin-top: 6px !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn,
    .page-wrapper.sidebar-collapsed .nav-menu-btn.active {
        width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        aspect-ratio: 1 / 1 !important;
        padding: 0 !important;
        margin: 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: 14px !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn i {
        width: auto !important;
        margin: 0 !important;
        text-align: center !important;
        font-size: 1.02rem !important;
    }
}

@media (max-width: 760px) {
    body.is-guest .nav-menu-btn,
    body.is-guest .nav-menu-btn.active,
    body.is-guest .nav-menu-btn .nav-text {
        font-weight: 400 !important;
    }
}

.think-wrapper.in-progress {
    border-color: rgba(15, 23, 42, 0.08);
}

.think-wrapper.in-progress::after {
    content: "";
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 0;
    height: 2px;
    border-radius: var(--radius-full);
    background: linear-gradient(90deg, transparent, rgba(17, 17, 17, 0.78), transparent);
    transform-origin: left center;
    animation: progress-scan 1.55s cubic-bezier(0.45, 0, 0.2, 1) infinite;
    opacity: 0.62;
}

.think-wrapper.passive-progress {
    margin-bottom: 0.7rem;
}

.think-wrapper.passive-progress .think-content,
.think-wrapper.passive-progress .think-sources-bar,
.think-wrapper.passive-progress .think-toggle-arrow {
    display: none;
}

.think-wrapper.passive-progress .think-header {
    cursor: default;
}

@keyframes progress-scan {
    0% { transform: scaleX(0.08) translateX(-8%); opacity: 0.15; }
    45% { transform: scaleX(0.72) translateX(14%); opacity: 0.68; }
    100% { transform: scaleX(0.08) translateX(108%); opacity: 0.1; }
}
@keyframes think-pulse-light {
    0%, 100% { box-shadow: 0 12px 48px rgba(0, 0, 0, 0.04), inset 0 0 0 1px rgba(255, 255, 255, 0.8); }
    50% { box-shadow: 0 12px 48px rgba(100, 80, 220, 0.08), inset 0 0 0 1px rgba(100, 80, 220, 0.2); }
}

.think-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.88rem 1.05rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease-in-out;
}

.think-header:hover {
    background: var(--surface-container-low);
}

.think-icon {
    color: var(--primary);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-container);
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.think-label {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05rem;
}

.think-duration {
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    color: var(--primary-dim);
    margin-left: 4px;
    font-variant-numeric: tabular-nums;
}

.think-toggle-arrow {
    margin-left: auto;
    color: var(--primary-dim);
    font-size: 0.9rem;
    transition: transform 0.4s ease-in-out;
    display: flex;
    width: 32px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.think-header:hover .think-toggle-arrow {
    background: var(--outline-variant);
    color: var(--primary);
}

.think-content {
    padding: 0 1.05rem 1rem;
    max-height: 800px;
    overflow-y: auto;
    font-size: 0.92rem;
    line-height: 1.7;
    color: var(--primary-dim);
    transition: max-height 0.5s ease-in-out, padding 0.5s ease-in-out, opacity 0.4s ease-in-out;
    font-style: italic;
}

.think-content::-webkit-scrollbar {
    width: 4px;
}

.think-content::-webkit-scrollbar-thumb {
    background: var(--outline-variant);
    border-radius: var(--radius-sm);
}

.think-wrapper.collapsed .think-content {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.think-wrapper.collapsed .think-sources-bar {
    max-height: 0;
    padding: 0 var(--space-4);
    opacity: 0;
}

.think-wrapper.collapsed .think-toggle-arrow {
    transform: rotate(-90deg);
}

.think-wrapper.done {
    box-shadow: none;
    background: transparent;
    border: 1px solid var(--outline-variant);
}

.think-wrapper.done .think-icon {
    background: var(--surface-container);
    color: var(--on-surface);
}

.think-wrapper.done .think-label {
    color: var(--on-surface);
}

/* ============================
   Sources Bar
   ============================ */
.think-sources-bar {
    display: none;
    padding: 1rem var(--space-4);
    border-top: 1px solid var(--outline-variant);
    transition: max-height 0.5s, padding 0.5s, opacity 0.4s;
}

.sources-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--primary-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.sources-header i {
    color: var(--primary);
}

.sources-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.sources-scroll::-webkit-scrollbar {
    display: none;
}

.source-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    background: transparent;
    box-shadow: 0 4px 15px rgba(135, 79, 91, 0.05);
    border: 1px solid var(--outline-variant);
    z-index: 1;
    color: var(--on-surface);
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    cursor: pointer;
    max-width: 260px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.source-card::before {
    content: '';
    position: absolute;
    top: -150%;
    left: -50%;
    width: 200%;
    height: 400%;
    background: conic-gradient(from 0deg, transparent 0%, rgba(135, 79, 91, 0.25) 30%, transparent 60%);
    opacity: 0;
    z-index: -1;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.source-card:hover::before {
    opacity: 1;
    animation: spinGlow 4s linear infinite;
}

@keyframes spinGlow {
    100% {
        transform: rotate(360deg);
    }
}

.source-card::after {
    content: '';
    position: absolute;
    inset: 1px;
    background: var(--surface-container-highest);
    border-radius: var(--radius-sm);
    z-index: -1;
    transition: background 0.3s ease;
}

.source-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 35px rgba(135, 79, 91, 0.15);
    border-color: transparent;
}

.source-card-favicon {
    width: 22px;
    height: 22px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    z-index: 2;
}

.source-card-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    gap: 2px;
    z-index: 2;
}

.source-card-title {
    font-weight: 600;
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.source-card-domain {
    font-size: 0.75rem;
    color: var(--primary-dim);
    opacity: 0.85;
}

/* ============================
   Edit Box Styling
   ============================ */
.edit-input {
    width: 100%;
    margin-bottom: var(--space-4);
    background: var(--surface-container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-xl);
    padding: var(--space-4) 1.8rem;
    color: var(--on-surface);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease-in-out;
    box-shadow: var(--shadow-ambient);
}

.edit-input:focus {
    border-color: var(--outline-variant-focus);
    box-shadow: 0 10px 40px rgba(135, 79, 91, 0.08);
}

/* ============================
   Markdown Formatting
   ============================ */
.markdown-content p {
    margin-bottom: 0.88rem;
}

.markdown-content code {
    background: var(--surface-container);
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    font-family: 'Fira Code', monospace;
    font-size: 0.9em;
    color: var(--primary);
}

.markdown-content pre {
    margin-bottom: 1.5rem;
}

.markdown-content pre code {
    display: block;
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    background: var(--surface-container-lowest);
    box-shadow: var(--shadow-ambient);
    color: var(--on-surface);
    overflow-x: auto;
    line-height: 1.7;
}

.markdown-content h1 {
    margin: 1.45rem 0 0.85rem;
    font-size: 1.72rem;
}

.markdown-content h2 {
    margin: 1.2rem 0 0.7rem;
    font-size: 1.4rem;
}

.markdown-content h3 {
    margin: 1rem 0 0.45rem;
    font-size: 1.15rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.markdown-content li {
    margin-bottom: 0.35rem;
    line-height: 1.62;
}

.markdown-content a {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: transparent;
    transition: text-decoration-color 0.3s ease-in-out;
    font-weight: 500;
}

.markdown-content a:hover {
    text-decoration-color: var(--primary);
}

.markdown-content blockquote {
    border-left: 3px solid var(--primary);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--primary-dim);
    font-style: italic;
    background: var(--primary-container);
    padding: 1.5rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.95rem;
}

.markdown-content th {
    text-align: left;
    padding: 1rem;
    background: var(--primary-container);
    color: var(--primary);
    border-bottom: 1px solid var(--outline-variant);
}

.markdown-content td {
    padding: 1rem;
    border-bottom: 1px solid var(--outline-variant);
    color: var(--on-surface);
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================
   Auth Modal - Ethereal Floating Tier
   ============================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(253, 248, 249, 0.7);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: 0.4s ease-in-out;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.liquid-glass-panel {
    background: var(--surface-container-lowest);
    box-shadow: 0 30px 60px rgba(135, 79, 91, 0.1);
    border-radius: var(--radius-xl);
    padding: var(--space-10) var(--space-8) var(--space-8);
    width: 100%;
    max-width: 420px;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: 0.4s ease-in-out;
}

.modal-overlay.show .liquid-glass-panel {
    transform: translateY(0) scale(1);
}

.guest-auth-modal {
    max-width: 400px;
    padding: 34px 30px 30px;
    text-align: center;
}

.guest-auth-modal__icon {
    width: 54px;
    height: 54px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
    border-radius: 18px;
    background: #f1f1ef;
    color: #171717;
    font-size: 1.45rem;
}

.guest-auth-modal h2 {
    margin: 0;
    color: #111111;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.guest-auth-modal p {
    max-width: 310px;
    margin: 11px auto 24px;
    color: #656565;
    font-size: 0.96rem;
    line-height: 1.5;
}

.guest-auth-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.guest-auth-modal__actions a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 650;
    transition: transform 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.guest-auth-modal__actions a:hover,
.guest-auth-modal__actions a:focus-visible {
    transform: translateY(-1px);
}

.guest-auth-modal__login {
    border: 1px solid rgba(0, 0, 0, 0.12);
    background: #ffffff;
    color: #191919;
}

.guest-auth-modal__register {
    background: #171717;
    color: #ffffff;
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.12);
}

@media (max-width: 520px) {
    .guest-auth-modal {
        width: min(400px, calc(100vw - 32px));
        padding: 30px 22px 22px;
    }
}

.modal-close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--primary-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.modal-close:hover {
    color: var(--primary);
    background: var(--surface-container-low);
}

.auth-tabs {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}

.auth-tab {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    font-size: 1.1rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 700;
    cursor: pointer;
    position: relative;
    transition: color 0.3s ease-in-out;
    padding-bottom: 0.5rem;
}

.auth-tab.active {
    color: var(--primary);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
    border-radius: var(--radius-xs);
}

.auth-form {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-form.active {
    display: flex;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.85rem;
    color: var(--primary-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05rem;
}

.input-group input {
    background: var(--surface-container);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 1rem 1.2rem;
    color: var(--on-surface);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease-in-out;
    font-family: 'Manrope', sans-serif;
}

.input-group input:focus {
    background: var(--surface-container-lowest);
    border-color: var(--outline-variant-focus);
    box-shadow: var(--shadow-ambient);
}

.auth-error {
    color: #d9465a;
    font-size: 0.9rem;
    min-height: 20px;
    font-weight: 500;
}

.auth-submitBtn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dim));
    color: var(--on-primary);
    border: none;
    padding: 1.2rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
    transition: all 0.3s ease-in-out;
    font-family: 'Plus Jakarta Sans', sans-serif;
    box-shadow: 0 4px 15px rgba(135, 79, 91, 0.2);
}

.auth-submitBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(135, 79, 91, 0.3);
}

/* ============ Global Submit Button Paused State ============ */
.submit-btn.paused-state {
    background: linear-gradient(135deg, rgba(30, 215, 96, 0.4), rgba(4, 150, 255, 0.6));
    border: 1px solid rgba(30, 215, 96, 0.5);
    box-shadow: 0 4px 15px rgba(30, 215, 96, 0.3),
                inset 0 0 10px rgba(4, 150, 255, 0.3);
    color: #fff;
    animation: paused-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    transform: scale(1.05);
}

.submit-btn.paused-state i {
    animation: soft-bounce 2s ease-in-out infinite;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
    font-size: 1.1em;
}

@keyframes paused-pulse {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(30, 215, 96, 0.3), inset 0 0 10px rgba(4, 150, 255, 0.3);
    }
    50% {
        box-shadow: 0 8px 25px rgba(30, 215, 96, 0.6), inset 0 0 15px rgba(4, 150, 255, 0.6);
        border-color: rgba(30, 215, 96, 0.8);
    }
}

@keyframes soft-bounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ============================
   Token Slider
   ============================ */
.token-slider-group {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.82rem;
    color: var(--primary-dim);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
}

.token-slider-group:hover {
    background: rgba(0,0,0,0.07);
}

#tokenSlider {
    -webkit-appearance: none;
    appearance: none;
    width: 90px;
    height: 4px;
    border-radius: var(--radius-xs);
    background: var(--primary-container);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

#tokenSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

#tokenSlider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

#tokenSliderLabel {
    min-width: 34px;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface);
    font-size: 0.8rem;
}

/* =====================================================
   Rich Content: Code Blocks
   ===================================================== */
.code-block-wrapper {
    margin: 1em 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: #1e1e2e;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.code-lang-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-family: "SF Mono", "Fira Code", monospace;
}

.code-copy-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-xs);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: rgba(255, 255, 255, 0.9);
}

.code-copy-btn.copied {
    background: rgba(52, 199, 89, 0.25);
    border-color: rgba(52, 199, 89, 0.4);
    color: #34c759;
}

.code-block-wrapper pre {
    margin: 0;
    border-radius: 0;
    background: #1e1e2e !important;
    padding: 1rem 1.2rem !important;
    overflow-x: auto;
    font-size: 0.875rem;
    line-height: 1.65;
}

.code-block-wrapper pre code {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
}

/* Inline code (non-block) */
.markdown-content code:not(pre code) {
    background: rgba(0, 0, 0, 0.06);
    color: #c0392b;
    padding: 2px 6px;
    border-radius: var(--radius-xs);
    font-size: 0.88em;
    font-family: "SF Mono", "Fira Code", monospace;
    border: 1px solid rgba(0, 0, 0, 0.07);
}

/* =====================================================
   Rich Content: Links
   ===================================================== */
.markdown-content a.md-link,
.markdown-content a {
    color: #0071e3;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1.5px solid rgba(0, 113, 227, 0.25);
    transition: all 0.2s ease;
    padding-bottom: 1px;
}

.markdown-content a.md-link:hover,
.markdown-content a:hover {
    color: #0058b8;
    border-bottom-color: #0071e3;
    background: rgba(0, 113, 227, 0.06);
    border-radius: var(--radius-xs);
    padding: 0 3px 1px;
}

/* =====================================================
   Rich Content: Price Badges
   ===================================================== */
.price-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #fff3cd, #ffe083);
    color: #7d5a00;
    font-weight: 700;
    font-size: 0.9em;
    padding: 1px 7px 2px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(200, 150, 0, 0.25);
    box-shadow: 0 1px 4px rgba(200, 150, 0, 0.15);
    letter-spacing: -0.01em;
    white-space: nowrap;
}

/* =====================================================
   Rich Content: KaTeX Math
   ===================================================== */
.katex-display {
    margin: 1em 0;
    overflow-x: auto;
    padding: 0.5em 0;
}

.katex {
    font-size: 1.05em;
}

/* =====================================================
   Rich Content: Tables — Premium Financial Grade
   ===================================================== */
.markdown-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1.2em 0;
    font-size: 0.88rem;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    font-variant-numeric: tabular-nums;
}

.markdown-content th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid rgba(0, 0, 0, 0.12);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.markdown-content td {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    transition: background 0.15s ease;
    line-height: 1.5;
}

.markdown-content tr:last-child td {
    border-bottom: none;
}

.markdown-content tr:nth-child(even) td {
    background: rgba(0, 0, 0, 0.02);
}

.markdown-content tr:hover td {
    background: rgba(0, 0, 0, 0.04);
}

/* Bold rows (e.g., totals) get subtle highlight */
.markdown-content td strong {
    font-weight: 700;
    color: inherit;
}

.markdown-content .table-scroll-wrap {
    width: 100%;
    margin: 1.2em 0 1.35em;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.markdown-content .table-scroll-wrap table {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    table-layout: auto;
}

.markdown-content .table-scroll-wrap th,
.markdown-content .table-scroll-wrap td {
    white-space: nowrap;
    vertical-align: middle;
}

.markdown-content .table-scroll-wrap th:first-child,
.markdown-content .table-scroll-wrap td:first-child {
    min-width: 180px;
    white-space: normal;
}

.markdown-content .table-scroll-wrap th:not(:first-child),
.markdown-content .table-scroll-wrap td:not(:first-child) {
    min-width: 132px;
}

.markdown-content .table-scroll-wrap td:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   Search History Modal Styling
   ===================================================== */

.large-modal {
    width: 90vw !important;
    max-width: 1400px !important;
    height: 85vh;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.search-modal-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.search-sidebar {
    width: 340px;
    background: rgba(255, 255, 255, 0.4);
    border-right: 1px solid var(--outline-variant);
    display: flex;
    flex-direction: column;
}

.search-modal-top-bar {
    padding: 20px;
    border-bottom: 1px solid var(--outline-variant);
    position: relative;
    background: var(--surface-container-highest);
    display: flex;
    align-items: center;
}

.search-modal-top-bar .search-icon {
    position: absolute;
    left: 36px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-dim);
    z-index: 2;
}

#historySearchInput {
    width: 100%;
    height: 42px;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    background: var(--overlay-xs);
    padding: 0 20px 0 44px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--on-surface);
    letter-spacing: 0;
    transition: all 0.3s ease;
}

#historySearchInput:focus {
    outline: none;
    border-color: var(--overlay-lg);
    box-shadow: none;
}

.history-search-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.history-search-list .history-item {
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: var(--surface-container-lowest);
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.search-preview-pane {
    flex: 1;
    background: var(--surface);
    overflow-y: auto;
    padding: 40px;
    position: relative;
}

.preview-empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary-dim);
    font-size: 1.1rem;
    pointer-events: none;
}

.preview-content {
    max-width: 800px;
    margin: 0 auto;
}

.preview-title {
    font-size: 1.8rem;
    margin-bottom: 30px;
    color: var(--on-surface);
    border-bottom: 2px solid var(--outline-variant);
    padding-bottom: 10px;
}

.preview-messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.preview-msg {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    line-height: 1.6;
}

.preview-msg.user {
    background: var(--surface-container-highest);
    align-self: flex-end;
    box-shadow: var(--shadow-ambient);
    border-bottom-right-radius: 4px;
}

.preview-msg.assistant {
    background: transparent;
    align-self: flex-start;
}
/* Modal Action Buttons inside History Item */
.history-item-actions .modal-action-btn {
    background: transparent;
    border: none;
    color: var(--primary-dim);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    opacity: 0;
    transform: translateX(10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: 2px;
}

.history-item:hover .modal-action-btn {
    opacity: 1;
    transform: translateX(0);
}

.history-item-actions .modal-action-btn:hover {
    color: var(--on-surface);
    background: var(--surface-container-highest);
}

.history-item-actions .delete-btn:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.hidden { display: none !important; }

/* =====================================================
   Button Premium Interactivity Overrides Request
   ===================================================== */

/* Sidebar Buttons matching background + 3D Texture */
.nav-menu-btn {
    background: rgba(0, 0, 0, 0.03) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,0.5) !important;
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-menu-btn:hover, .nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05), inset 0 1px 0 rgba(255,255,255,0.8) !important;
    transform: translateY(-1px) !important;
}

.nav-menu-btn:active {
    transform: translateY(1px) scale(0.97) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03), inset 0 2px 4px rgba(0,0,0,0.06) !important;
}

.nav-menu-btn i {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s;
}

.nav-menu-btn:hover i {
    transform: scale(1.1);
}

.nav-menu-btn:active i {
    transform: scale(0.85);
}

/* History Modal items 3D Texture matching Sidebar Buttons */
.history-search-list .history-item {
    background: rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    box-shadow: 0 2px 4px rgba(0,0,0,0.015), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(0);
    cursor: pointer;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.06);
    box-shadow: 0 4px 8px rgba(0,0,0,0.04), inset 0 1px 0 rgba(255,255,255,0.7);
    transform: translateY(-1px);
}

.history-search-list .history-item:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.02), inset 0 2px 4px rgba(0,0,0,0.05);
}

/* Fix action btn hovering inside active history item so it doesn't sink */
.history-search-list .history-item .modal-action-btn:active {
    transform: scale(0.9);
}

/* =====================================================
   Sidebar Alignment & Button Uniformity + Padding fixes
   ===================================================== */
.nav-menu-btn, .nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.035) !important;
    border-radius: var(--radius-md) !important;
    margin-bottom: 10px !important;
}

.nav-menu-btn:hover {
    background: rgba(0, 0, 0, 0.07) !important;
}

/* Space out the buttons completely from the sidebar edges */
.sidebar-top {
    padding-bottom: 6px;
}

/* Right preview spacing to avoid hugging border */
.search-preview-pane {
    padding-left: 30px !important;
    padding-right: 30px !important;
    background: var(--surface-light); /* just ensure smooth bg */
}

.preview-messages {
    padding: 0 40px 40px 40px !important;
    max-width: 900px;
    margin: 0 auto;
}

.preview-title {
    padding: 30px 40px 10px 40px !important;
    max-width: 900px;
    margin: 0 auto;
}


.nav-menu-btn {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.nav-menu-btn.active {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.nav-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* History Items background purely transparent by default */
.history-search-list .history-item {
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    border: 1px solid rgba(0, 0, 0, 0.05) !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.02), inset 0 1px 0 rgba(255,255,255,1) !important;
}

/* =====================================================
   Search Modal: private, quiet, scan-friendly
   ===================================================== */
.large-modal {
    max-width: 1120px !important;
    height: min(78vh, 760px);
    border-radius: 18px !important;
    background: var(--surface-container-lowest) !important;
}

.search-modal-top-bar {
    padding: 18px 20px !important;
    background: var(--surface-container-lowest) !important;
}

.search-modal-layout {
    min-height: 0;
}

.search-sidebar {
    width: 360px;
    background: var(--surface-container-lowest) !important;
    border-right: 1px solid var(--outline-variant);
}


#historySearchInput:focus {
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: none;
}

#historySearchInput:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.history-search-list {
    padding: 14px !important;
}

.search-empty-state {
    list-style: none;
    margin: 36px 16px;
    color: var(--primary-dim);
    font-size: 0.92rem;
    line-height: 1.55;
    text-align: center;
}

.history-search-list .history-group-title {
    margin: 18px 8px 8px;
    padding: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary-dim);
}

.history-search-list .history-item {
    min-height: 62px;
    padding: 11px 10px 11px 14px !important;
    margin-bottom: 6px;
    border-radius: 12px !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease !important;
}

.history-search-list .history-item.active-preview,
.history-search-list .history-item:hover {
    background: rgba(0, 0, 0, 0.045) !important;
    border-color: rgba(0, 0, 0, 0.06) !important;
    box-shadow: none !important;
    transform: translateY(-1px);
}

.history-item-main {
    min-width: 0;
    flex: 1;
}

.history-search-list .history-item-text {
    font-size: 0.95rem;
    font-weight: 650;
    line-height: 1.3;
    color: var(--on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0;
}

.history-item-meta {
    margin-top: 5px;
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--primary-dim);
    letter-spacing: 0;
}

.history-item-actions {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.history-item-actions .modal-action-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    opacity: 0;
    transform: translateX(4px);
}

.history-search-list .history-item:hover .modal-action-btn,
.history-search-list .history-item.active-preview .modal-action-btn {
    opacity: 1;
    transform: translateX(0);
}

.search-preview-pane {
    padding: 0 !important;
    background: var(--surface) !important;
}

.preview-empty-state {
    width: min(360px, 70%);
    text-align: center;
    font-size: 0.96rem;
    line-height: 1.6;
}

.preview-content {
    max-width: 820px;
    padding: 42px 48px;
}

.preview-title {
    padding: 0 0 18px !important;
    margin: 0 0 24px !important;
    max-width: none;
    border-bottom: 1px solid var(--outline-variant);
    font-size: 1.45rem;
    line-height: 1.25;
    font-weight: 750;
    letter-spacing: 0;
}

.preview-messages {
    padding: 0 0 42px !important;
    max-width: none;
    gap: 14px;
}

.preview-msg {
    width: 100%;
    padding: 16px 18px;
    border-radius: 12px;
    border: 1px solid var(--outline-variant);
    background: var(--surface-container-lowest);
    line-height: 1.65;
}

.preview-msg.user {
    align-self: stretch;
    box-shadow: none;
    border-bottom-right-radius: 12px;
}

.preview-msg.assistant {
    background: transparent;
    border-color: transparent;
    padding-left: 0;
    padding-right: 0;
}

.preview-msg-role {
    margin-bottom: 8px;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--primary-dim);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.preview-msg-body {
    font-size: 0.94rem;
    color: var(--on-surface);
}

.preview-think-note,
.search-status {
    color: var(--primary-dim);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* =========================================================
   ATTACHMENTS PREVIEW (PLATINUM LIQUID GLASS)
   ========================================================= */
.attachments-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 22px 2px;
    margin-bottom: 0;
    align-items: center;
}

.attachments-preview:empty {
    display: none;
}

.file-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    font-size: 0.85rem;
    color: var(--text-color);
    animation: fadeIn 0.3s ease;
    transition: all 0.2s ease;
}

.file-pill:hover {
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.file-pill i.fa-file-pdf { color: #e2574c; }
.file-pill i.fa-file-image { color: #4c8de2; }
.file-pill i.fa-file-lines { color: #8e8e8e; }

.file-pill-name {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.file-pill-size {
    color: var(--primary-dim);
    font-size: 0.75rem;
}

.file-pill-remove {
    cursor: pointer;
    background: none;
    border: none;
    color: var(--primary-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.file-pill-remove:hover {
    color: #e2574c;
    background: rgba(226, 87, 76, 0.1);
}

.file-pill.image-preview-pill {
    width: 36px;
    height: 36px;
    padding: 0;
    gap: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    box-shadow: none;
    overflow: visible;
    position: relative;
}

.file-pill.image-preview-pill:hover {
    background: transparent;
    box-shadow: none;
    transform: none;
}

.file-pill-thumb {
    width: 36px;
    height: 36px;
    display: block;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid rgba(0, 0, 0, 0.12);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.16);
    background: #ffffff;
}

.file-pill-remove.image-pill-remove {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    color: #70757d;
    background: #f3f4f6;
    opacity: 1 !important;
    border: 1px solid #d5d8de;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    font-size: 0.78rem;
    z-index: 30;
    transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.file-pill-remove.image-pill-remove i {
    font-size: 0.78rem;
    line-height: 1;
}

.file-pill-tooltip {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    min-width: 86px;
    max-width: 180px;
    transform: translateX(-50%) translateY(-2px);
    padding: 9px 12px;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    color: #2a2a2a;
    font-size: 0.86rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 40;
    transition: opacity 0.16s ease, visibility 0.16s ease, transform 0.16s ease;
}

.file-pill.image-preview-pill:hover .file-pill-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.file-pill-remove.image-pill-remove:hover {
    color: #2f3338;
    background: #ffffff;
    border-color: #c3c7ce;
    transform: scale(1.06);
}

.attachments-container-msg {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.file-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
    text-decoration: none;
    color: var(--text-color);
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.file-attachment-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.file-attachment-card i {
    font-size: 1.2rem;
}

/* =====================================================
   PDF Download Card (Agent Mode)
   ===================================================== */
.pdf-download-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin-top: 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(226, 87, 76, 0.07), rgba(226, 87, 76, 0.02));
    border: 1px solid rgba(226, 87, 76, 0.22);
    box-shadow: 0 4px 20px rgba(226, 87, 76, 0.06), inset 0 1px 0 rgba(255,255,255,0.7);
    animation: fadeSlideUp 0.4s ease-in-out;
}

.pdf-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(226, 87, 76, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pdf-card-icon i {
    font-size: 1.6rem;
    color: #e2574c;
}

.pdf-card-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pdf-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--on-surface);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.pdf-card-sub {
    font-size: 0.8rem;
    color: var(--primary-dim);
}

.pdf-dl-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 22px;
    background: #e2574c;
    color: #ffffff;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(226, 87, 76, 0.3);
}

.pdf-dl-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(226, 87, 76, 0.4);
    color: #ffffff;
}

.pdf-dl-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(226, 87, 76, 0.3);
}


/* =====================================================
   Gmail Confirmation Card (Agent Mode)
   ===================================================== */
.gmail-confirm-card {
    margin-top: 14px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.07), rgba(99, 102, 241, 0.02));
    border: 1px solid rgba(99, 102, 241, 0.22);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.06), inset 0 1px 0 rgba(255,255,255,0.7);
    animation: fadeSlideUp 0.4s ease-in-out;
    overflow: hidden;
}

.gmail-card-actions {
    display: flex;
    gap: 10px;
    padding: 14px 22px;
    justify-content: flex-start;
}

.gmail-confirm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: #6366f1;
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.gmail-confirm-btn:hover {
    background: #4f46e5;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(99, 102, 241, 0.4);
}

.gmail-confirm-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.gmail-confirm-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.gmail-cancel-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    background: transparent;
    color: var(--primary-dim);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
    white-space: nowrap;
}

.gmail-cancel-btn:hover {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.3);
    color: #dc2626;
    transform: translateY(-1px);
}

.gmail-cancel-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}


/* --- Sidemenu & User Context Additions --- */
.sidebar-user-container {
    position: relative;
    width: 100%;
}

.sidebar-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 1px 7px;
    border-radius: 12px;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    color: var(--on-surface);
    font-family: inherit;
    transition: background 0.16s ease;
}

.sidebar-user-btn:hover {
    background: var(--sidebar-hover-bg, rgba(0, 0, 0, 0.052));
}

.user-avatar-mimic {
    border-radius: 999px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
    color: #ffffff;
    line-height: 1;
    aspect-ratio: 1 / 1;
    box-shadow: none;
    transform: translateX(-2.8px);
}

.user-avatar-mimic img {
    border-radius: 999px;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-info-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding-left: 1px;
    overflow: hidden;
    text-align: left;
    line-height: 1.15;
    font-family: inherit;
}

#userDisplayName {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.87rem;
    font-weight: 450;
    color: #111111;
    letter-spacing: 0;
}

#userEmailDisplay {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.74rem;
    font-weight: 400;
    color: #5f6368;
    letter-spacing: 0.05em;
    transform: translateY(1.5px);
}

.user-context-menu {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    width: 224px;
    background: #f7f7f7;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.97);
    transform-origin: bottom left;
    transition:
        opacity 0.16s ease,
        transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 1000;
}

.user-context-menu {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.user-context-menu.show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.ctx-menu-item {
    min-height: 33px;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 7px;
    padding: 0 7px;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: #202124;
    font-size: 0.91rem;
    font-family: inherit;
    font-weight: 520;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 0.14s ease, transform 0.14s ease;
    text-align: left;
}

.ctx-menu-item:hover {
    background: #ededed;
}

.ctx-menu-item.is-open {
    background: #ededed;
}

.ctx-menu-item:active {
    transform: scale(0.99);
}

.ctx-menu-label {
    line-height: 1;
}

.ctx-menu-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4f5459;
}

.ctx-menu-svg,
.ctx-menu-chevron {
    display: block;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
}

.ctx-menu-svg {
    width: 16px;
    height: 16px;
}

.ctx-menu-chevron {
    width: 15px;
    height: 15px;
    justify-self: end;
    color: #6f7478;
}

.ctx-menu-item span:not(.ctx-menu-icon) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-wrapper.sidebar-collapsed .sidebar-user-btn {
    padding: 8px;
    justify-content: center;
}
.page-wrapper.sidebar-collapsed .user-info-text {
    display: none;
}
.page-wrapper.sidebar-collapsed .user-context-menu {
    left: calc(100% + 12px);
    bottom: 0px;
    transform-origin: left bottom;
    transform: translateX(-12px) scale(0.96);
}
.page-wrapper.sidebar-collapsed .user-context-menu.show {
    transform: translateX(0) scale(1);
}

/* Nested settings in user context */
.ctx-settings-block {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.76));
    border: 1px solid rgba(0, 0, 0, 0.055);
    border-radius: 14px;
    margin: 4px 2px 7px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.92),
        0 8px 22px rgba(0, 0, 0, 0.045);
    backdrop-filter: blur(14px) saturate(145%);
    -webkit-backdrop-filter: blur(14px) saturate(145%);
}

.ctx-settings-block.show {
    display: flex;
    animation: ctxSettingsReveal 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes ctxSettingsReveal {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ctx-settings-header {
    font-size: 0.76rem;
    color: #565f69;
    font-weight: 550;
    line-height: 1.1;
    margin: 0 0 -2px;
    letter-spacing: 0;
}

.ctx-lang-header {
    margin-top: 2px;
}

.ctx-settings-block .lang-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
}

.ctx-settings-block .lang-btn {
    min-width: 0;
    height: 32px;
    padding: 0 8px;
    border-radius: 11px;
    color: #626a73;
    font-size: 0.78rem;
    font-weight: 620;
    opacity: 0.82;
    transition:
        opacity 0.16s ease,
        background 0.18s ease,
        color 0.18s ease,
        transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
        box-shadow 0.18s ease;
}

.ctx-settings-block .lang-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.58);
    transform: translateY(-1px);
}

.ctx-settings-block .lang-btn:active {
    transform: scale(0.97);
}

.ctx-settings-block .lang-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.98);
    color: #050505;
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.055),
        0 5px 14px rgba(0, 0, 0, 0.065),
        inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

/* =====================================================
   User Message: Stacked Attachment + Text Layout
   ===================================================== */
.user-msg-attachment-block {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    width: 100%;
}

.user-msg-attachment-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface-container-highest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.25s ease;
    max-width: 340px;
    text-decoration: none;
    color: var(--on-surface);
    font-size: 0.88rem;
    font-weight: 500;
}
.user-msg-attachment-card:hover {
    background: var(--surface-bright);
    transform: translateY(-1px);
}
.user-msg-attachment-card .att-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: rgba(226, 87, 76, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
    color: #e2574c;
}
.user-msg-attachment-card .att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 220px;
}
.user-msg-attachment-card .att-size {
    color: var(--primary-dim);
    font-size: 0.78rem;
    margin-left: auto;
    white-space: nowrap;
}

.user-msg-attachment-card.image-attachment-card {
    padding: 6px 10px 6px 6px;
}

.user-msg-attachment-card .att-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #ffffff;
}

/* =====================================================
   Image Generation Loading State
   ===================================================== */
.image-generation-loader {
    position: relative;
    width: min(770px, 100%);
    aspect-ratio: 1.54 / 1;
    min-height: 300px;
    margin-top: 14px;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background:
        radial-gradient(circle at 18% 16%, rgba(0, 0, 0, 0.045), transparent 17%),
        radial-gradient(circle at 78% 15%, rgba(0, 0, 0, 0.04), transparent 16%),
        radial-gradient(circle at 57% 45%, rgba(0, 0, 0, 0.035), transparent 18%),
        linear-gradient(180deg, rgba(249, 249, 249, 0.98), rgba(244, 244, 244, 0.98));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.9),
        0 10px 34px rgba(15, 23, 42, 0.05);
    animation: fadeSlideUp 0.35s ease;
}

.image-generation-loader::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.34), transparent 28%, rgba(255, 255, 255, 0.24) 55%, transparent 80%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.34), transparent 34%);
    pointer-events: none;
    animation: neuronFieldWash 6.5s ease-in-out infinite;
}

.image-neuron-grid {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(38, 1fr);
    grid-template-rows: repeat(22, 1fr);
    padding: 10px 12px;
    pointer-events: none;
    -webkit-mask-image: radial-gradient(circle at center, #000 62%, rgba(0, 0, 0, 0.72) 100%);
    mask-image: radial-gradient(circle at center, #000 62%, rgba(0, 0, 0, 0.72) 100%);
}

.image-neuron-dot {
    width: var(--dot-size);
    height: var(--dot-size);
    justify-self: center;
    align-self: center;
    border-radius: 999px;
    background: #101114;
    opacity: 0.08;
    transform: scale(0.55);
    animation: neuronDotPulse 4.8s ease-in-out infinite;
    animation-delay: var(--delay);
    will-change: opacity, transform;
}

.image-generation-label {
    position: absolute;
    left: 50%;
    top: 50%;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 20px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.84);
    color: #111827;
    font-size: 0.92rem;
    font-weight: 750;
    box-shadow:
        0 10px 26px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transform: translate(-50%, -50%);
    backdrop-filter: blur(8px);
}

@keyframes neuronDotPulse {
    0%,
    100% {
        opacity: 0.07;
        transform: scale(0.55);
    }
    18% {
        opacity: 0.18;
        transform: scale(0.76);
    }
    32% {
        opacity: var(--peak);
        transform: scale(1.12);
    }
    52% {
        opacity: 0.13;
        transform: scale(0.7);
    }
    72% {
        opacity: 0.09;
        transform: scale(0.58);
    }
}

@keyframes neuronFieldWash {
    0%,
    100% {
        opacity: 0.38;
        transform: translateX(-3%);
    }
    50% {
        opacity: 0.72;
        transform: translateX(3%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .image-generation-loader,
    .image-generation-loader::after,
    .image-neuron-dot {
        animation: none;
    }

    .image-neuron-dot {
        opacity: 0.22;
        transform: scale(0.86);
    }
}

@media (max-width: 560px) {
    .image-generation-loader {
        min-height: 240px;
        border-radius: 14px;
    }

    .image-neuron-grid {
        padding: 8px;
    }

    .image-generation-label {
        min-height: 36px;
        padding: 0 16px;
        font-size: 0.86rem;
    }
}

/* =====================================================
   Generated Image Card (Normal Mode)
   ===================================================== */
.generated-image-card {
    margin-top: 14px;
    max-width: min(520px, 100%);
    border: 1px solid rgba(76, 141, 226, 0.24);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(76, 141, 226, 0.08), rgba(22, 163, 74, 0.035));
    box-shadow: 0 4px 20px rgba(76, 141, 226, 0.07), inset 0 1px 0 rgba(255,255,255,0.72);
    overflow: hidden;
    animation: fadeSlideUp 0.4s ease-in-out;
}

.generated-image-preview {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(76, 141, 226, 0.16);
}

.generated-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.generated-image-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
}

.generated-image-title-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.generated-image-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: rgba(76, 141, 226, 0.12);
    color: #2563eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.generated-image-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.generated-image-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--on-surface);
}

.generated-image-sub {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--primary-dim);
}

.generated-image-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.generated-image-open,
.generated-image-download {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 36px;
    padding: 0 13px;
    border-radius: var(--radius-md);
    font-size: 0.84rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    border: 0;
    cursor: pointer;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.generated-image-open {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.09);
}

.generated-image-download {
    color: #ffffff;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.26);
}

.generated-image-open:hover,
.generated-image-download:hover {
    transform: translateY(-1px);
}

.generated-image-download:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.generated-file-card {
    margin-top: 14px;
    max-width: min(560px, 100%);
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 15px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.07), rgba(255, 255, 255, 0.7));
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.06), inset 0 1px 0 rgba(255,255,255,0.75);
    animation: fadeSlideUp 0.4s ease-in-out;
}

.generated-file-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: rgba(37, 99, 235, 0.09);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

.generated-file-copy {
    min-width: 0;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 3px;
}

.generated-file-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--on-surface);
}

.generated-file-sub {
    max-width: 270px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--primary-dim);
}

.generated-file-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.generated-file-open,
.generated-file-download {
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 13px;
    border: 0;
    border-radius: var(--radius-md);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease;
}

.generated-file-open {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.09);
}

.generated-file-download {
    color: #ffffff;
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.24);
}

.generated-file-open:hover,
.generated-file-download:hover {
    transform: translateY(-1px);
}

.generated-file-download:disabled {
    cursor: not-allowed;
    opacity: 0.75;
    transform: none;
}

@media (max-width: 560px) {
    .generated-image-meta {
        align-items: stretch;
        flex-direction: column;
    }

    .generated-image-sub {
        max-width: 100%;
    }

    .generated-image-actions {
        width: 100%;
    }

    .generated-image-open,
    .generated-image-download,
    .generated-file-open,
    .generated-file-download {
        flex: 1;
        justify-content: center;
    }

    .generated-file-card {
        align-items: stretch;
        flex-direction: column;
    }

    .generated-file-actions {
        width: 100%;
    }

    .generated-file-sub {
        max-width: 100%;
    }
}

/* =====================================================
   PDF Preview Modal
   ===================================================== */
.pdf-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.pdf-preview-overlay.show {
    display: flex;
}

.pdf-preview-container {
    width: 90vw;
    max-width: 900px;
    height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--surface-container-highest);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    animation: fadeSlideUp 0.3s ease;
}

.pdf-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--surface-container-highest);
    border-bottom: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.pdf-preview-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--on-surface);
    overflow: hidden;
}
.pdf-preview-filename {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
}

.pdf-preview-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--primary-dim);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.pdf-preview-close:hover {
    background: var(--surface-container-low);
    color: var(--on-surface);
}

.pdf-preview-body {
    flex: 1;
    overflow: hidden;
    background: #525659;
}

.pdf-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-preview-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 10px 20px;
    background: var(--surface-container-highest);
    border-top: 1px solid var(--outline-variant);
    flex-shrink: 0;
}

.pdf-toolbar-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--primary-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}
.pdf-toolbar-btn:hover {
    background: var(--surface-container-low);
    color: var(--on-surface);
}

.pdf-toolbar-page-info {
    font-size: 0.88rem;
    color: var(--primary-dim);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    min-width: 60px;
    text-align: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* Gmail Email Confirmation Preview Component */
.gmail-preview-container {
    position: relative;
    background: var(--surface-container-low);
    border-radius: var(--radius-sm);
    margin-top: 12px;
    border: 1px solid var(--outline-variant);
    overflow: hidden;
    transition: all 0.3s ease;
}

.gmail-preview-content {
    padding: 16px;
    white-space: pre-wrap;
    font-size: 0.95em;
    color: var(--on-surface);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    max-height: 400px;
}

/* Scrollbar styling for preview content */
.gmail-preview-content::-webkit-scrollbar {
    width: 6px;
}
.gmail-preview-content::-webkit-scrollbar-track {
    background: transparent;
}
.gmail-preview-content::-webkit-scrollbar-thumb {
    background-color: var(--outline-variant-focus);
    border-radius: 10px;
}

.gmail-preview-content.collapsed {
    max-height: 140px;
    overflow: hidden;
    /* Soft gradient fade out effect at the bottom */
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

.gmail-preview-toggle {
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85em;
    font-weight: 500;
    color: #6366f1;
    cursor: pointer;
    user-select: none;
    border-top: 1px solid var(--outline-variant);
    background: var(--surface-container);
    transition: background 0.2s ease, color 0.2s ease;
}

.gmail-preview-toggle:hover {
    background: var(--outline-variant);
}

.gmail-preview-card {
    margin: 14px 0 0;
    border: 1px solid rgba(17, 17, 17, 0.1);
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

.gmail-preview-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid #eceff3;
    background: linear-gradient(180deg, #ffffff, #f8f9fb);
}

.gmail-preview-mark {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #111;
    color: #fff;
    font-size: 0.95rem;
}

.gmail-preview-kicker {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #7a7f87;
    font-weight: 800;
}

.gmail-preview-title {
    margin-top: 2px;
    color: #111;
    font-size: 1.02rem;
    font-weight: 800;
}

.gmail-preview-meta {
    display: grid;
    gap: 0;
    padding: 0 20px;
    background: #fff;
}

.gmail-preview-meta > div {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid #f0f1f3;
    align-items: start;
}

.gmail-preview-meta span {
    color: #747b86;
    font-size: 0.86rem;
    font-weight: 700;
}

.gmail-preview-meta strong {
    min-width: 0;
    color: #111;
    font-size: 0.92rem;
    font-weight: 700;
    word-break: break-word;
}

.gmail-preview-body-label {
    padding: 17px 20px 0;
    color: #747b86;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gmail-preview-body {
    padding: 10px 20px 20px;
    color: #202124;
    font-size: 0.96rem;
    line-height: 1.75;
    white-space: normal;
    transition: max-height 0.35s ease, opacity 0.35s ease;
}

.gmail-preview-body.collapsed {
    max-height: 190px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 58%, transparent 100%);
}

.gmail-preview-card .gmail-preview-toggle {
    width: calc(100% - 40px);
    margin: 0 20px 18px;
    border: 1px solid #d8dce2;
    border-radius: var(--radius-full);
    background: #f7f8fa;
    color: #111;
    padding: 10px 14px;
    font-weight: 800;
}

.gmail-preview-card + .gmail-confirm-card {
    border-radius: 14px;
    background: #111;
    border-color: #111;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

.gmail-preview-card + .gmail-confirm-card .gmail-card-actions {
    padding: 16px;
}

.gmail-preview-card + .gmail-confirm-card .gmail-confirm-btn {
    background: #fff;
    color: #111;
    box-shadow: none;
}

.gmail-preview-card + .gmail-confirm-card .gmail-cancel-btn {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
}

/* =========================================
   Responsive: prevent toggle icon overlay
   ========================================= */
.toggles-container {
    flex-wrap: wrap;
    min-width: 0;
}

/* Fullscreen account page */
body.account-page-open {
    overflow: hidden;
}

.account-page-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    display: none;
    background: #080808;
    color: #f7f7f7;
    font-family: inherit;
    letter-spacing: 0;
}

.account-page-overlay {
    background: #f7f7f5;
    color: #111111;
}

.account-page-overlay.show {
    display: block;
}

.account-brand {
    position: absolute;
    top: 28px;
    left: 34px;
    width: 84px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-brand img {
    width: auto;
    height: 34px;
    object-fit: contain;
    border-radius: 4px;
    filter: none;
}

.account-top-actions {
    position: absolute;
    top: 20px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 26px;
}

.account-lang-switch,
.account-top-icon-btn {
    border: 0;
    color: #f6f6f6;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
}

.account-lang-switch {
    height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 0 18px 0 16px;
    border-radius: var(--radius-full);
    background: #111111;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
    font-size: 14px;
    font-weight: 650;
    color: #d9d9d9;
}

.account-lang-switch i {
    font-size: 17px;
    color: #b8b8b8;
}

.account-top-icon-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #f5f5f5;
}

.account-top-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #303030, #101010);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
}

.account-top-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.account-left-panel {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(37vw, 390px);
    min-width: 292px;
    padding: 148px 0 26px 36px;
}

.account-welcome {
    font-size: 28.4px;
    line-height: 1.18;
    font-weight: 760;
    color: #ffffff;
    margin-left: -13px;
    margin-top: -6px;
}

.account-welcome-muted {
    color: #9a9a9a;
    font-weight: 400;
}

.account-nav-list {
    margin-top: 50px;
    width: 222px;
    margin-left: -34px;
    display: flex;
    flex-direction: column;
    gap: 13px;
}

.account-nav-item {
    position: relative;
    width: 222px;
    height: 51px;
    border: 0;
    border-radius: 4px;
    padding: 0 16px 0 22px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: transparent;
    color: #9a9a9a;
    font-family: inherit;
    font-size: 17px;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.account-nav-item i {
    width: 18px;
    color: currentColor;
    text-align: center;
    font-size: 18px;
}

.account-nav-item.active {
    color: #ffffff;
    border: 0;
}

.account-nav-bullet {
    position: absolute;
    left: 7px;
    width: 7px;
    height: 7px;
    background: #f5f5f5;
}

.account-bottom-actions {
    position: absolute;
    left: 34px;
    bottom: 32px;
}

.account-back-main {
    height: 50px;
    min-width: 164px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: var(--radius-full);
    border: 1px solid #262626;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
}

.account-main-panel {
    position: absolute;
    top: 148px;
    left: clamp(210px, 42.5vw, 820px);
    right: clamp(48px, 10vw, 200px);
    max-width: 760px;
    max-height: calc(100vh - 148px);
    overflow-y: auto;
    padding-bottom: 40px;
}

.account-section-header h1 {
    margin: 0;
    color: #ffffff;
    font-size: 27px;
    line-height: 1.15;
    font-weight: 780;
}

.account-section-header p {
    margin: 12px 0 0;
    color: #a3a3a3;
    font-size: 15px;
    line-height: 1.45;
    font-weight: 400;
}

.account-data-list {
    margin-top: 54px;
    border-top: 1px solid #292929;
}

.account-data-row {
    min-height: 138px;
    padding: 38px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 34px;
    border-bottom: 1px solid #292929;
}

.account-data-copy {
    max-width: 560px;
}

.account-data-copy h2 {
    margin: 0;
    color: #ffffff;
    font-size: 17px;
    line-height: 1.25;
    font-weight: 760;
}

.account-data-copy p {
    margin: 10px 0 0;
    color: #aaa;
    font-size: 14px;
    line-height: 1.5;
    font-weight: 400;
}

.account-row-btn {
    min-width: 100px;
    height: 38px;
    padding: 0 16px;
    border-radius: var(--radius-full);
    border: 1px solid #2c2c2c;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.account-row-btn-danger {
    border-color: rgba(165, 52, 44, 0.28);
    background: #a4332c;
}

.account-lang-switch {
    background: #ffffff;
    color: #1a1a1a;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.16);
}

.account-lang-switch i,
.account-top-icon-btn,
.account-nav-item,
.account-data-copy p,
.account-section-header p,
.account-welcome-muted {
    color: #666666;
}

.account-welcome,
.account-section-header h1,
.account-data-copy h2,
.account-nav-item.active,
.account-back-main,
.account-row-btn {
    color: #111111;
}

.account-nav-item.active {
    border: 0;
}

.account-nav-bullet {
    background: #111111;
}

.account-data-list,
.account-data-row {
    border-color: #d8d8d8;
}

.account-back-main,
.account-row-btn {
    border-color: #d1d1d1;
}

.account-row-btn-danger {
    color: #ffffff;
}

.account-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 5050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.42);
}

.account-dialog-backdrop[hidden] {
    display: none;
}

.account-download-dialog {
    width: min(430px, calc(100vw - 42px));
    border-radius: 20px;
    border: 1px solid #343434;
    background: #1a1a1a;
    padding: 26px 26px 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
}

.account-dialog-check {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #49d06b;
    color: #49d06b;
    font-size: 16px;
    margin-bottom: 22px;
}

.account-download-dialog h2 {
    margin: 0;
    color: #ffffff;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 760;
}

.account-download-dialog p {
    margin: 16px 0 24px;
    color: #a8a8a8;
    font-size: 13.5px;
    line-height: 1.5;
    font-weight: 400;
}

.account-dialog-close {
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    border: 2px solid #f4f4f4;
    background: #282828;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.account-download-dialog {
    background: #ffffff;
    border-color: #d8d8d8;
}

.account-download-dialog h2 {
    color: #111111;
}

.account-download-dialog p {
    color: #666666;
}

.account-dialog-close {
    color: #111111;
    background: #eeeeee;
    border-color: #111111;
}

.account-delete-dialog {
    width: min(480px, calc(100vw - 42px));
    border-radius: 22px;
    border: 1px solid #303030;
    background: #1a1a1a;
    padding: 28px 28px 26px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.38);
}

.account-dialog-warning {
    align-self: center;
    color: #ff4f4f;
    font-size: 32px;
    line-height: 1;
    margin-bottom: 22px;
}

.account-delete-dialog h2 {
    margin: 0;
    color: #ffffff;
    text-align: center;
    font-size: 20px;
    line-height: 1.2;
    font-weight: 760;
}

.account-delete-dialog p {
    margin: 18px auto 26px;
    max-width: 390px;
    color: #aaa;
    text-align: center;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 400;
}

.account-delete-label {
    color: #aaa;
    font-size: 14px;
    line-height: 1.45;
    font-weight: 650;
    margin-bottom: 14px;
}

.account-delete-label strong {
    color: #f5f5f5;
    font-weight: 760;
}

.account-delete-input {
    width: 100%;
    height: 44px;
    border-radius: 8px;
    border: 1.5px solid #eeeeee;
    background: transparent;
    color: #ffffff;
    padding: 0 16px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 650;
    outline: none;
}

.account-delete-input::placeholder {
    color: #777777;
}

.account-delete-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 24px;
}

.account-delete-cancel,
.account-delete-confirm {
    height: 44px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 730;
    cursor: pointer;
}

.account-delete-cancel {
    border: 1px solid #333333;
    background: transparent;
    color: #ffffff;
}

.account-delete-confirm {
    border: 0;
    background: #82302b;
    color: #ffffff;
}

.account-delete-confirm:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.account-delete-dialog {
    background: #ffffff;
    border-color: #d7d7d7;
}

.account-delete-dialog h2,
.account-delete-label strong,
.account-delete-input,
.account-delete-cancel {
    color: #111111;
}

.account-delete-dialog p,
.account-delete-label {
    color: #666666;
}

.account-delete-input {
    border-color: #111111;
}

.account-delete-cancel {
    border-color: #d1d1d1;
}

@media (max-width: 600px) {
    .guest-header {
        padding: 12px 14px 0;
    }
    .guest-nav {
        width: 100%;
        max-width: none;
        justify-content: flex-end;
        gap: 8px;
    }
    .guest-nav-gear {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
    }
    .guest-nav-login,
    .guest-nav-register {
        min-height: 38px;
        padding: 8px 16px;
        font-size: 0.84rem;
        white-space: nowrap;
    }
    .settings-dropdown {
        max-width: calc(100vw - 28px);
    }
    .app-container {
        padding-top: 96px;
    }
    .app-container.centered-landing {
        justify-content: flex-start;
        padding-top: 112px;
    }
    .guest-limit-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px;
        border-radius: 20px;
    }
    .guest-limit-banner__actions {
        width: 100%;
    }
    .guest-limit-banner__btn {
        flex: 1;
    }
    .toggle-switch span,
    .connector-trigger span {
        display: none;
    }
    .toggle-switch,
    .connector-trigger {
        padding: 0.5rem 0.7rem;
    }
    .input-bottom-row {
        padding: 0.12rem 0.72rem 0.62rem;
    }
    .input-top-row {
        padding: 0.72rem 0.9rem 0.16rem;
    }
    .composer-input textarea {
        font-size: 0.96rem;
    }
    .chat-area {
        padding: 1rem 0.95rem 10.6rem;
    }
    .app-container.guest-cta-visible .chat-area {
        padding-bottom: 14.5rem;
    }
    .app-container.guest-input-hidden .chat-area {
        padding-bottom: 6.5rem;
    }
    .message-bubble.user {
        max-width: 88%;
    }
}

@media (max-width: 760px) {
    body {
        overflow: hidden;
    }

    .page-wrapper {
        width: 100vw;
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 58px;
        padding: 10px 16px;
        background: color-mix(in srgb, var(--surface) 86%, transparent);
        border-bottom: 1px solid var(--outline-variant);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.04);
    }

    .sidebar {
        position: fixed;
        top: 10px;
        left: 10px;
        bottom: 10px;
        width: min(82vw, 300px);
        margin: 0;
        z-index: 1200;
        transform: translateX(0);
        transition: transform 0.28s ease, opacity 0.28s ease;
        box-shadow: 0 24px 70px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(255,255,255,0.7);
    }

    .page-wrapper.sidebar-collapsed .sidebar {
        width: min(82vw, 300px);
        transform: translateX(calc(-100% - 24px));
        opacity: 0;
        pointer-events: none;
    }

    .page-wrapper.sidebar-collapsed .sidebar-top .home-link,
    .page-wrapper.sidebar-collapsed .nav-text,
    .page-wrapper.sidebar-collapsed .history-group-title,
    .page-wrapper.sidebar-collapsed .history-item,
    .page-wrapper.sidebar-collapsed .nav-divider,
    .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        display: initial;
        opacity: 1;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn {
        width: 100%;
        height: auto;
        padding: 8px 14px;
        justify-content: flex-start;
        aspect-ratio: auto;
    }

    .main-content {
        width: 100vw;
        min-width: 0;
    }

    .guest-header {
        top: 58px;
        padding: 10px 14px 0;
    }

    .guest-nav {
        gap: 6px;
    }

    .guest-nav-login,
    .guest-nav-register {
        min-height: 36px;
        padding: 7px 13px;
        font-size: 0.82rem;
    }

    .app-container,
    .app-container.centered-landing {
        max-width: 100%;
        padding: 104px 14px 0;
    }

    .app-container.centered-landing .chat-area {
        margin-bottom: 1.2rem;
    }

    .greeting-container h2 {
        font-size: clamp(1.55rem, 8vw, 2.05rem);
        line-height: 1.16;
    }

    .logo-text {
        font-size: clamp(1rem, 4.5vw, 1.28rem);
    }

    .input-wrapper {
        bottom: max(10px, env(safe-area-inset-bottom));
    }

    .composer-input {
        border-radius: 26px;
    }

    .messages {
        gap: 1rem;
    }
}

@media (max-width: 900px) {
    .account-page-overlay {
        overflow-y: auto;
    }
    .account-top-actions {
        right: 18px;
        gap: 14px;
    }
    .account-left-panel,
    .account-main-panel {
        position: relative;
        inset: auto;
        width: auto;
        min-width: 0;
        max-width: none;
    }
    .account-left-panel {
        padding: 96px 22px 18px;
    }
    .account-welcome {
        font-size: 28px;
    }
    .account-nav-list,
    .account-nav-item {
        width: 100%;
    }
    .account-nav-list {
        margin-left: 0;
    }
    .account-bottom-actions {
        position: fixed;
        left: 18px;
        bottom: 18px;
        z-index: 1;
    }
    .account-main-panel {
        padding: 22px 22px 118px;
    }
    .account-data-row {
        align-items: flex-start;
        min-height: 0;
        padding: 34px 0;
    }
}

/* =========================================================================
   Account Page — Global Font Fix
   ========================================================================= */
.account-page-overlay,
.account-download-dialog,
.account-delete-dialog,
.account-confirm-dialog,
.account-edit-dialog {
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

/* =========================================================================
   Account Page — Profile Section
   ========================================================================= */
.account-profile-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.account-profile-avatar-large {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(135deg, #303030, #101010);
    color: #ffffff;
    font-size: 26px;
    font-weight: 700;
    flex-shrink: 0;
}

.account-profile-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.account-profile-info-card {
    margin-top: 40px;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
}

.account-profile-info-card {
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.account-profile-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    border-bottom: 1px solid #2a2a2a;
    min-height: 80px;
}

.account-profile-info-row--no-border {
    border-bottom: none;
}

.account-profile-info-row {
    border-color: #e0e0e0;
}

.account-profile-label {
    font-size: 13px;
    color: #8a8a8a;
    font-weight: 400;
    margin-bottom: 4px;
}

.account-profile-label {
    color: #666666;
}

.account-profile-value {
    font-size: 16px;
    color: #f0f0f0;
    font-weight: 400;
}

.account-profile-value {
    color: #111111;
}

.account-row-btn-link {
    white-space: nowrap;
}

.account-login-methods-title {
    margin: 52px 0 8px;
    font-size: 24px;
    font-weight: 760;
    color: #ffffff;
}

.account-login-methods-title {
    color: #111111;
}

.account-login-methods-subtitle {
    font-size: 14px;
    color: #8a8a8a;
    margin-bottom: 28px;
    line-height: 1.5;
    font-weight: 400;
}

.account-login-methods-card {
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    overflow: hidden;
}

.account-login-methods-card {
    border-color: #e0e0e0;
    background: #f9f9f9;
}

.account-login-method-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 24px;
    border-bottom: 1px solid #2a2a2a;
    min-height: 78px;
}

.account-login-method-row--last {
    border-bottom: none;
}

.account-login-method-row {
    border-color: #e0e0e0;
}

.account-login-method-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-login-method-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1e1e1e;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #d0d0d0;
    flex-shrink: 0;
}

.account-login-method-icon {
    background: #f0f0f0;
    border-color: #ddd;
    color: #333;
}

.account-login-method-name {
    font-size: 15px;
    font-weight: 600;
    color: #f0f0f0;
}

.account-login-method-name {
    color: #111111;
}

.account-login-method-sub {
    font-size: 13px;
    color: #7a7a7a;
    margin-top: 2px;
    font-weight: 400;
}

.account-login-method-btn {
    height: 36px;
    min-width: 80px;
    padding: 0 18px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid #3a3a3a;
    background: transparent;
    color: #ffffff;
    white-space: nowrap;
    flex-shrink: 0;
}

.account-login-method-btn--enabled {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
    font-weight: 700;
}

.account-login-method-btn--disabled {
    background: transparent;
    color: #a0a0a0;
    border-color: #3a3a3a;
}

.account-login-method-btn--connect {
    background: #ffffff;
    color: #111111;
    border-color: #ffffff;
    font-weight: 700;
}

.account-login-method-btn {
    border-color: #d0d0d0;
    color: #333333;
}

.account-login-method-btn--enabled,
.account-login-method-btn--connect {
    background: #111111;
    color: #ffffff;
    border-color: #111111;
}

/* =========================================================================
   Google Unlink / Generic Confirm Dialog
   ========================================================================= */
.account-confirm-dialog {
    width: min(370px, calc(100vw - 48px));
    border-radius: 22px;
    background: #1a1a1a;
    border: 1px solid #2e2e2e;
    padding: 30px 28px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
    box-shadow: 0 20px 54px rgba(0,0,0,0.48);
}

.account-confirm-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.account-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #252525;
    border: 1px solid #3a3a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 19px;
    color: #f0f0f0;
    margin-bottom: 18px;
    flex-shrink: 0;
}

.account-confirm-icon {
    background: #f0f0f0;
    border-color: #ddd;
    color: #444;
}

.account-confirm-dialog h2 {
    font-size: 18px;
    font-weight: 760;
    color: #f0f0f0;
    margin: 0 0 12px;
    line-height: 1.3;
    font-family: inherit;
}

.account-confirm-dialog h2 {
    color: #111111;
}

.account-confirm-dialog p {
    font-size: 13.5px;
    color: #8a8a8a;
    font-weight: 400;
    margin: 0 0 24px;
    line-height: 1.55;
    font-family: inherit;
}

.account-confirm-actions {
    display: flex;
    gap: 10px;
    width: 100%;
}

.account-confirm-cancel,
.account-confirm-proceed {
    flex: 1;
    height: 42px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    border: 1px solid transparent;
    transition: opacity 0.15s;
}

.account-confirm-cancel {
    background: #202020;
    border-color: #3a3a3a;
    color: #f0f0f0;
}

.account-confirm-proceed {
    background: #f0f0f0;
    border-color: #f0f0f0;
    color: #111111;
}

.account-confirm-cancel {
    background: #111111;
    border-color: #111111;
    color: #ffffff;
}

.account-confirm-proceed {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #111111;
}

.account-confirm-cancel:hover,
.account-confirm-proceed:hover {
    opacity: 0.82;
}

/* =========================================================================
   Security Section — Breadcrumb & Password Sub-view
   ========================================================================= */
.account-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 28px;
    font-size: 14px;
    color: #8a8a8a;
    font-weight: 400;
}

.account-breadcrumb-link {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    font-weight: inherit;
    text-decoration: none;
}

.account-breadcrumb-link:hover {
    text-decoration: underline;
    color: #cccccc;
}

.account-breadcrumb-link:hover {
    color: #333333;
}

.account-breadcrumb-sep {
    color: #555;
}

.account-subview-title {
    font-size: 28px;
    font-weight: 760;
    color: #ffffff;
    margin: 0 0 10px;
}

.account-subview-title {
    color: #111111;
}

.account-subview-subtitle {
    font-size: 14px;
    color: #8a8a8a;
    margin: 0;
    font-weight: 400;
    line-height: 1.5;
}

.account-password-divider {
    border: none;
    border-top: 1px solid #292929;
    margin: 28px 0;
}

.account-password-divider {
    border-color: #e0e0e0;
}

.account-password-field {
    margin-bottom: 8px;
}

.account-password-field label {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #8a8a8a;
    margin-bottom: 10px;
}

.account-password-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #333;
    border-radius: 10px;
    background: #1a1a1a;
    overflow: hidden;
}

.account-password-input-wrap {
    border-color: #d0d0d0;
    background: #f5f5f5;
}

.account-password-input-wrap input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 13px 16px;
    font-size: 15px;
    color: #f0f0f0;
    font-family: inherit;
}

.account-password-input-wrap input {
    color: #111111;
}

.account-password-icon-btn {
    background: none;
    border: none;
    padding: 10px 14px;
    cursor: pointer;
    color: #6a6a6a;
    font-size: 15px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.account-password-icon-btn:hover {
    color: #cccccc;
}

.account-password-icon-btn:hover {
    color: #333333;
}

.account-edit-desc {
    font-size: 13px;
    color: #8a8a8a;
    font-weight: 400;
    margin: 4px 0 16px;
    line-height: 1.5;
}

.account-data-row--no-btn {
    min-height: 100px;
}

/* =========================================================================
   Cookie Preference Dialog
   ========================================================================= */
.cookie-prefs-dialog {
    position: relative;
    width: min(560px, calc(100vw - 32px));
    max-height: calc(100vh - 52px);
    overflow-y: auto;
    border-radius: 18px;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    padding: 24px 24px 22px;
    box-shadow: 0 22px 56px rgba(0, 0, 0, 0.48);
    display: flex;
    flex-direction: column;
    gap: 0;
    font-family: 'Inter', 'Poppins', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.cookie-prefs-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
}

.cookie-prefs-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    background: #2a2a2a;
    color: #aaa;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.cookie-prefs-close:hover {
    background: #3a3a3a;
    color: #fff;
}

.cookie-prefs-close {
    background: #f0f0f0;
    border-color: #d8d8d8;
    color: #555;
}

.cookie-prefs-close:hover {
    background: #e0e0e0;
    color: #111;
}

.cookie-prefs-logo {
    margin-bottom: 16px;
}

.cookie-prefs-title {
    font-size: 19px;
    font-weight: 760;
    color: #f0f0f0;
    margin: 0 0 14px;
    line-height: 1.2;
}

.cookie-prefs-title {
    color: #111111;
}

.cookie-prefs-desc {
    font-size: 13px;
    color: #999;
    line-height: 1.56;
    margin: 0 0 18px;
    font-weight: 400;
}

.cookie-prefs-desc {
    color: #555555;
}

.cookie-allow-all-btn {
    display: block;
    width: 100%;
    height: 44px;
    border-radius: var(--radius-full);
    border: 0;
    background: #1a1a1a;
    color: #f0f0f0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 24px;
    transition: background 0.2s;
}

.cookie-allow-all-btn:hover {
    background: #252525;
}

.cookie-allow-all-btn {
    background: #111111;
    color: #ffffff;
}

.cookie-allow-all-btn:hover {
    background: #333333;
}

.cookie-manage-title {
    font-size: 15px;
    font-weight: 700;
    color: #c0c0c0;
    margin: 0 0 12px;
}

.cookie-manage-title {
    color: #333333;
}

.cookie-categories {
    display: flex;
    flex-direction: column;
    border: 1px solid #2e2e2e;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
}

.cookie-categories {
    border-color: #e0e0e0;
}

.cookie-category {
    border-bottom: 1px solid #2e2e2e;
}

.cookie-category:last-child {
    border-bottom: none;
}

.cookie-category {
    border-color: #e0e0e0;
}

.cookie-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    min-height: 54px;
}

.cookie-expand-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #3a3a3a;
    background: #2a2a2a;
    color: #aaa;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.cookie-expand-btn {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #444;
}

.cookie-category-name {
    font-size: 14px;
    font-weight: 650;
    color: #e0e0e0;
    flex: 1;
}

.cookie-category-name {
    color: #1a1a1a;
}

.cookie-always-active {
    font-size: 13px;
    font-weight: 600;
    color: #5b9cf6;
    white-space: nowrap;
}

/* Cookie toggle switch */
.cookie-toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
    flex-shrink: 0;
}

.cookie-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.cookie-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: var(--radius-full);
    background: #3a3a3a;
    transition: background 0.25s;
    border: 1px solid #4a4a4a;
}

.cookie-toggle-switch input:checked + .cookie-toggle-track {
    background: #4a9eff;
    border-color: #4a9eff;
}

.cookie-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #888;
    transition: transform 0.25s, background 0.25s;
}

.cookie-toggle-switch input:checked + .cookie-toggle-track .cookie-toggle-thumb {
    transform: translateX(24px);
    background: #ffffff;
}

.cookie-toggle-track {
    background: #d0d0d0;
    border-color: #c0c0c0;
}

.cookie-toggle-switch input:checked + .cookie-toggle-track {
    background: #4a9eff;
    border-color: #4a9eff;
}

.cookie-toggle-thumb {
    background: #ffffff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Cookie bottom action buttons */
.cookie-prefs-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.cookie-reject-all-btn,
.cookie-confirm-btn {
    height: 44px;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.mof-toast-stack {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 7000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.mof-toast {
    max-width: min(360px, calc(100vw - 44px));
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(30, 30, 30, 0.94);
    color: #f5f5f5;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.25;
    font-weight: 520;
    letter-spacing: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16);
    opacity: 0;
    transform: translateY(8px) scale(0.985);
    transition:
        opacity 0.18s ease,
        transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mof-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.mof-toast.error {
    color: #8b1d16;
    border-color: rgba(165, 52, 44, 0.20);
    background: #fff6f5;
}

.mof-toast {
    background: #f7f7f7;
    color: #151515;
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.cookie-reject-all-btn {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
}

.cookie-reject-all-btn:hover {
    background: #353535;
}

.cookie-confirm-btn {
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
}

.cookie-confirm-btn:hover {
    background: #353535;
}

.cookie-reject-all-btn,
.cookie-confirm-btn {
    background: #f0f0f0;
    border-color: #d0d0d0;
    color: #111111;
}

.cookie-reject-all-btn:hover,
.cookie-confirm-btn:hover {
    background: #e4e4e4;
}

@media (max-width: 480px) {
    .cookie-prefs-dialog {
        padding: 22px 18px 18px;
        border-radius: 16px;
    }
    .cookie-prefs-actions {
        grid-template-columns: 1fr;
    }
}

/* =========================================================================
   Account Profile — Layout fix & Edit Dialogs
   ========================================================================= */
.account-profile-section,
.account-data-section,
.account-security-section {
    padding-right: 24px;
    max-width: 720px;
}

.account-profile-info-card,
.account-login-methods-card {
    max-width: 100%;
}

.account-edit-dialog {
    width: min(460px, calc(100vw - 32px));
    border-radius: 20px;
    background: #1c1c1c;
    border: 1px solid #2e2e2e;
    padding: 28px 28px 24px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.55);
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

.account-edit-dialog {
    background: #ffffff;
    border-color: #e0e0e0;
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

.account-edit-dialog h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #f0f0f0;
}

.account-edit-dialog h3 {
    color: #111111;
}

.account-edit-dialog label {
    font-size: 13px;
    color: #888;
    font-weight: 500;
}

.account-edit-dialog label {
    color: #555;
}

.account-edit-dialog input[type="text"],
.account-edit-dialog input[type="email"] {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    border: 1.5px solid #3a3a3a;
    background: #111111;
    color: #f0f0f0;
    padding: 0 14px;
    font-family: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.account-edit-dialog input[type="text"]:focus,
.account-edit-dialog input[type="email"]:focus {
    border-color: #5a9fff;
}

.account-edit-dialog input[type="text"],
.account-edit-dialog input[type="email"] {
    background: #f5f5f5;
    border-color: #d0d0d0;
    color: #111111;
}

.account-edit-dialog input:focus {
    border-color: #5a9fff;
}

.account-edit-dialog .account-edit-error {
    font-size: 13px;
    color: #ff6b6b;
    min-height: 16px;
    margin: 0;
}

.account-edit-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}

.account-edit-cancel {
    height: 46px;
    border-radius: var(--radius-full);
    border: 1px solid #3a3a3a;
    background: transparent;
    color: #d0d0d0;
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}

.account-edit-save {
    height: 46px;
    border-radius: var(--radius-full);
    border: 0;
    background: #ffffff;
    color: #111111;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.account-edit-save:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.account-edit-cancel {
    border-color: #d0d0d0;
    color: #555;
}

.account-edit-save {
    background: #111111;
    color: #ffffff;
}

/* =========================================================================
   bisnes.ai Brand + Refined Chat Surface
   ========================================================================= */
.main-logo-img {
    display: block;
    width: auto;
    max-width: 158px;
    height: 52px;
    object-fit: contain;
}

.sidebar-top .home-link {
    width: 138px;
    height: 46px;
}

.account-brand img {
    width: auto;
    height: 52px;
    max-width: 168px;
    object-fit: contain;
}

.logo-container img {
    height: 52px;
    width: auto;
    object-fit: contain;
}

.sidebar-nav-menu {
    gap: 2px;
    margin-bottom: 0.55rem;
}

.nav-menu-btn {
    min-height: 38px;
    padding-top: 7px;
    padding-bottom: 7px;
}

@media (max-width: 760px) {
    .main-logo-img {
        height: 40px;
        max-width: 126px;
    }

    .mobile-header {
        height: 60px;
        padding: 12px 18px;
        background: var(--surface);
        border-bottom: 0;
        box-shadow: none;
    }

    .mobile-logo-text {
        font-size: 1.02rem;
        font-weight: 700;
    }

    .guest-header {
        top: 8px;
        left: auto;
        right: 10px;
        padding: 0;
        width: auto;
        z-index: 1050;
    }

    .guest-logo-link {
        display: none;
    }

    .guest-nav {
        width: auto;
        gap: 7px;
    }

    .guest-nav-gear {
        display: none;
    }

    .guest-nav-login,
    .guest-nav-register {
        min-height: 40px;
        padding: 8px 16px;
        font-size: 0.86rem;
        border-radius: var(--radius-full);
    }

    .guest-nav-register {
        display: none;
    }

    .app-container {
        padding: 76px 16px 0;
    }

    .app-container.centered-landing {
        padding: 76px 16px 0;
        justify-content: center;
        min-height: 100%;
    }

    .app-container.centered-landing .chat-area {
        margin-bottom: clamp(7rem, 23vh, 13rem);
    }

    .greeting-container h2 {
        font-size: clamp(1.7rem, 7.6vw, 2.15rem);
        font-weight: 500;
        letter-spacing: 0;
    }

    .logo-text {
        font-size: clamp(0.98rem, 4.4vw, 1.22rem);
    }

    .input-wrapper {
        bottom: max(18px, env(safe-area-inset-bottom));
    }

    .composer-input {
        min-height: 58px;
        border-radius: 30px;
    }

    .input-top-row {
        min-height: 56px;
        padding: 0.66rem 0.78rem;
        align-items: center;
    }

    .input-bottom-row {
        padding: 0 0.72rem 0.68rem;
    }

    .toggles-container {
        gap: 6px;
    }

    .toggle-switch,
    .connector-trigger {
        width: 38px;
        height: 38px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .submit-btn {
        width: 42px;
        height: 42px;
        flex: 0 0 42px;
    }

    .composer-input textarea {
        min-height: 34px;
        padding-top: 5px;
        font-size: 1rem;
    }
}

/* Final frontend overrides: keep these last so older experiments cannot win. */
.sidebar {
    --sidebar-motion-duration: 260ms;
    --sidebar-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --sidebar-btn-collapsed-size: 30px;
    --sidebar-nav-btn-height: 36px;
    --sidebar-nav-icon-box: 24px;
    --sidebar-nav-icon-size: 0.95rem;
    --sidebar-nav-label-weight: 600;
    --sidebar-nav-label-size: 0.88rem;
    --sidebar-nav-label-offset-x: -8px;
    --sidebar-history-title-size: 0.83rem;
    --sidebar-history-group-size: 0.72rem;
    --sidebar-history-item-size: 0.9rem;
    --sidebar-hover-radius: 10px;
    --sidebar-hover-bg: rgba(0, 0, 0, 0.052);
    --sidebar-nav-hover-y-inset: 0.6px;
    --sidebar-nav-collapsed-hover-inset: -2px;
    --sidebar-nav-collapsed-radius: 10px;
    --sidebar-expand-btn-size: 18px;
    --sidebar-expand-icon-size: 0.79rem;
    --sidebar-expand-offset-y: -11.3px;
    --sidebar-expand-color: #777777;
    min-height: 0 !important;
    transition:
        width var(--sidebar-motion-duration) var(--sidebar-motion-ease),
        background-color 180ms ease,
        border-color 180ms ease !important;
    will-change: width;
}

.page-wrapper {
    transition: none !important;
}

.sidebar-top,
.sidebar-nav-menu,
.sidebar-content,
.sidebar-footer {
    transition:
        opacity 180ms ease,
        transform var(--sidebar-motion-duration) var(--sidebar-motion-ease) !important;
    will-change: opacity, transform;
}

.page-wrapper:not(.sidebar-collapsed) .sidebar-top,
.page-wrapper:not(.sidebar-collapsed) .sidebar-nav-menu,
.page-wrapper:not(.sidebar-collapsed) .sidebar-content,
.page-wrapper:not(.sidebar-collapsed) .sidebar-footer {
    animation: sidebarSectionReveal 360ms var(--sidebar-motion-ease) both;
}

.page-wrapper:not(.sidebar-collapsed) .sidebar-nav-menu {
    animation-delay: 18ms;
}

.page-wrapper:not(.sidebar-collapsed) .sidebar-content {
    animation-delay: 42ms;
}

.page-wrapper:not(.sidebar-collapsed) .sidebar-footer {
    animation-delay: 64ms;
}

.page-wrapper:not(.sidebar-collapsed) .sidebar .nav-text {
    animation: sidebarTextReveal 320ms var(--sidebar-motion-ease) both;
}

@keyframes sidebarSectionReveal {
    from {
        opacity: 0;
        transform: translateX(-6px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes sidebarTextReveal {
    from {
        opacity: 0;
        transform: translateX(-4px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (max-width: 760px) {
    .sidebar {
        transition:
            transform 360ms var(--sidebar-motion-ease),
            opacity 220ms ease,
            background-color 180ms ease,
            border-color 180ms ease !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-top,
    .sidebar-nav-menu,
    .sidebar-content,
    .sidebar-footer,
    .sidebar .nav-text {
        animation: none !important;
        transition-duration: 1ms !important;
        transform: none !important;
    }
}

.sidebar-nav-menu {
    gap: 1px !important;
    padding: 0px 10px !important;
    margin: -5px 0 0.42rem !important;
    align-items: stretch !important;
}

.sidebar-content {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.20) transparent;
}

.sidebar-content.history-collapsed {
    overflow-y: hidden !important;
    scrollbar-gutter: auto !important;
    scrollbar-width: none;
}

.sidebar-content.history-collapsed::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

.page-wrapper.sidebar-collapsed .sidebar-content {
    opacity: 0 !important;
    transform: translateX(-8px) !important;
    overflow: hidden !important;
    scrollbar-gutter: auto !important;
    scrollbar-width: none !important;
}

.page-wrapper.sidebar-collapsed .sidebar-content::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

#historyList:not(.collapsed) {
    max-height: none !important;
    overflow: visible !important;
}

#historyList.collapsed {
    max-height: 0 !important;
    overflow: hidden !important;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px !important;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent !important;
}

.sidebar-content::-webkit-scrollbar-thumb {
    min-height: 38px;
    border: 2px solid transparent;
    border-radius: 999px !important;
    background: rgba(0, 0, 0, 0.18) !important;
    background-clip: padding-box !important;
}

.sidebar-content:hover::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.28) !important;
    background-clip: padding-box !important;
}

.nav-menu-btn,
.nav-menu-btn.active {
    display: grid !important;
    grid-template-columns: var(--sidebar-nav-icon-box) minmax(0, 1fr) !important;
    align-items: center !important;
    min-height: var(--sidebar-nav-btn-height) !important;
    height: var(--sidebar-nav-btn-height) !important;
    margin: 0 !important;
    padding: 0 10px !important;
    gap: 12px !important;
    border-radius: 15px !important;
    font-size: 0.94rem !important;
    font-weight: var(--sidebar-nav-label-weight) !important;
    letter-spacing: 0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.nav-menu-btn i {
    width: var(--sidebar-nav-icon-box) !important;
    font-size: var(--sidebar-nav-icon-size) !important;
    line-height: 1 !important;
    color: currentColor !important;
    text-align: center !important;
    opacity: 0.82;
}

.nav-menu-btn .sidebar-nav-svg {
    width: 19px !important;
    height: 19px !important;
    justify-self: center !important;
    color: currentColor !important;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
    opacity: 0.86;
    transform: translateX(-3.2px) translateZ(0);
    transition:
        opacity 0.16s ease,
        transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1),
        stroke-width 0.16s ease;
}

.nav-menu-btn:hover .sidebar-nav-svg,
.nav-menu-btn.active .sidebar-nav-svg {
    opacity: 1;
    stroke-width: 2.1;
}

@media (prefers-reduced-motion: no-preference) {
    .nav-menu-btn:hover .nav-icon-chat {
        transform: translateX(-2px) translateY(-1px) rotate(-5deg) scale(1.045);
    }

    .nav-menu-btn:hover .nav-icon-search {
        transform: translateX(-2px) translateY(-1px) rotate(-4deg) scale(1.055);
    }

    .nav-menu-btn:hover .nav-icon-agent {
        transform: translateX(-2px) translateY(-1px) rotate(6deg) scale(1.06);
    }
}

.nav-menu-btn .nav-text {
    justify-self: start !important;
    text-align: left !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-family: inherit !important;
    font-weight: var(--sidebar-nav-label-weight) !important;
    font-size: var(--sidebar-nav-label-size) !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
    text-shadow: none !important;
}

.sidebar .nav-menu-btn .nav-text {
    font-weight: var(--sidebar-nav-label-weight) !important;
    transform: translateX(var(--sidebar-nav-label-offset-x)) !important;
}

.nav-menu-btn:hover,
.nav-menu-btn.active {
    background: rgba(0, 0, 0, 0.075) !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

/* Sidebar hover plate: adjust this inset to change only the grey background height. */
.nav-menu-btn,
.nav-menu-btn.active {
    position: relative !important;
    overflow: hidden !important;
    background: transparent !important;
}

.sidebar .icon-toggle-btn,
.mobile-header .icon-toggle-btn,
.history-dropdown-header,
.history-item,
.history-group-title {
    font-family: inherit !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

#sidebarCloseBtn {
    width: 42px !important;
    min-width: 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    border-radius: 12px !important;
    color: #70757a !important;
    background: transparent !important;
}

#sidebarCloseBtn:hover {
    background: #f1f1f1 !important;
    color: #202124 !important;
}

.page-wrapper.sidebar-collapsed #sidebarCloseBtn {
    display: flex !important;
    opacity: 0 !important;
    transform: translateX(-4px) scale(0.96) !important;
    pointer-events: none !important;
}

.sidebar-action-svg {
    width: 17px;
    height: 17px;
    color: currentColor;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
    transform: translateZ(0);
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.16s ease;
}

.icon-toggle-btn:hover .sidebar-action-svg {
    transform: translateY(-1px) scale(1.04);
}

#sidebarCloseBtn .sidebar-action-svg {
    width: 19px !important;
    height: 19px !important;
    transform: translateZ(0) !important;
}

#sidebarCloseBtn:hover .sidebar-action-svg {
    transform: translateZ(0) !important;
}

.sidebar .nav-text {
    display: inline-block !important;
    max-width: 180px;
    overflow: hidden !important;
    opacity: 1;
    transform: translateX(0);
    transition:
        max-width var(--sidebar-motion-duration) var(--sidebar-motion-ease),
        opacity 150ms ease,
        transform var(--sidebar-motion-duration) var(--sidebar-motion-ease) !important;
}

.page-wrapper.sidebar-collapsed .sidebar .nav-text {
    display: none !important;
    max-width: 0 !important;
    width: 0 !important;
    opacity: 0 !important;
    margin: 0 !important;
    transform: none !important;
    pointer-events: none !important;
}

.history-dropdown-header {
    justify-content: flex-start !important;
    gap: 4px !important;
    font-weight: 700 !important;
    color: #111111 !important;
    letter-spacing: 0 !important;
    min-height: 32px !important;
    padding: 0 10px !important;
    border-radius: var(--sidebar-hover-radius) !important;
    transition: background 0.18s ease, color 0.16s ease !important;
}

.history-dropdown-header:hover {
    background: var(--sidebar-hover-bg) !important;
    color: #111111 !important;
}

.history-dropdown-header .history-title-text {
    font-family: inherit !important;
    font-size: var(--sidebar-history-title-size) !important;
    font-weight: 700 !important;
    color: inherit !important;
    letter-spacing: 0 !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

.history-chevron-svg {
    width: 14px;
    height: 14px;
    margin-left: 0;
    color: #000000;
    fill: none;
    stroke: #000000;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    shape-rendering: geometricPrecision;
    opacity: 0.76;
    transition: transform 0.2s ease, opacity 0.16s ease;
}

.history-dropdown-header:hover .history-chevron-svg {
    opacity: 1;
    transform: none;
}

.history-dropdown-header.collapsed .history-chevron-svg {
    transform: rotate(-90deg);
}

#historyList .history-group-title {
    gap: 8px !important;
    margin-top: 15px !important;
    margin-bottom: 6px !important;
    padding: 0 10px !important;
    font-size: var(--sidebar-history-group-size) !important;
    font-weight: 450 !important;
    line-height: 1.2 !important;
    color: #777777 !important;
    letter-spacing: 0 !important;
}

#historyList .history-group-title::after {
    height: 1px !important;
    background: rgba(0, 0, 0, 0.08) !important;
    opacity: 1 !important;
}

#historyList .history-item {
    padding: 0.42rem 10px !important;
    border-radius: var(--sidebar-hover-radius) !important;
    font-size: var(--sidebar-history-item-size) !important;
    color: #202124 !important;
    opacity: 1 !important;
    transition: background 0.18s ease, color 0.16s ease !important;
}

#historyList .history-item:hover {
    background: var(--sidebar-hover-bg) !important;
    color: #202124 !important;
}

#historyList .history-item.active {
    background: var(--sidebar-hover-bg) !important;
    color: #202124 !important;
}

#historyList .history-item-text {
    font-weight: 450 !important;
}

.sidebar-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
    padding: 8px 10px 10px !important;
}

.nav-menu-btn > * {
    position: relative;
    z-index: 1;
}

.nav-menu-btn::before {
    content: '';
    position: absolute;
    inset: var(--sidebar-nav-hover-y-inset) 0;
    border-radius: var(--sidebar-hover-radius);
    background: var(--sidebar-hover-bg);
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 0;
    pointer-events: none;
}

.nav-menu-btn:hover,
.nav-menu-btn.active {
    background: transparent !important;
}

.nav-menu-btn:hover::before,
.nav-menu-btn.active::before {
    opacity: 1;
}

@media (min-width: 761px) {
    .page-wrapper.sidebar-collapsed .sidebar-nav-menu {
        align-items: center !important;
        padding: 0 !important;
        gap: 7px !important;
        margin-top: 6px !important;
        width: 100% !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn,
    .page-wrapper.sidebar-collapsed .nav-menu-btn.active {
        display: flex !important;
        width: var(--sidebar-btn-collapsed-size) !important;
        min-width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        max-width: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        aspect-ratio: 1 / 1 !important;
        grid-template-columns: none !important;
        gap: 0 !important;
        padding: 0 !important;
        margin: 0 auto !important;
        justify-content: center !important;
        align-items: center !important;
        border-radius: var(--sidebar-nav-collapsed-radius) !important;
        overflow: hidden !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn::before {
        inset: 0 !important;
        border-radius: var(--sidebar-nav-collapsed-radius) !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn i {
        width: auto !important;
        margin: 0 !important;
        font-size: var(--sidebar-nav-icon-size) !important;
        text-align: center !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn .sidebar-nav-svg {
        width: 18px !important;
        height: 18px !important;
        margin: 0 !important;
        flex: 0 0 auto !important;
        transform: translateZ(0) !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn .nav-text {
        display: none !important;
        max-width: 0 !important;
        width: 0 !important;
        opacity: 0 !important;
        margin: 0 !important;
        transform: none !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-footer {
        align-items: center !important;
        gap: 14px !important;
        padding: 0 0 14px !important;
        border-top: 0 !important;
    }

    .page-wrapper.sidebar-collapsed .expand-btn {
        display: flex !important;
        order: 1;
        width: var(--sidebar-expand-btn-size) !important;
        min-width: var(--sidebar-expand-btn-size) !important;
        height: var(--sidebar-expand-btn-size) !important;
        min-height: var(--sidebar-expand-btn-size) !important;
        margin: 0 auto !important;
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        border: 0 !important;
        border-radius: 8px !important;
        background: transparent !important;
        box-shadow: none !important;
        color: var(--sidebar-expand-color) !important;
        font-size: var(--sidebar-expand-icon-size) !important;
        transform: translateY(var(--sidebar-expand-offset-y)) !important;
    }

    .page-wrapper.sidebar-collapsed .expand-btn i {
        font-size: var(--sidebar-expand-icon-size) !important;
        line-height: 1 !important;
    }

    .page-wrapper.sidebar-collapsed .expand-btn:hover {
        background: transparent !important;
        box-shadow: none !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-user-container {
        order: 2;
        width: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        display: flex !important;
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 50% !important;
        background: transparent !important;
        overflow: visible !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-user-btn:hover {
        background: transparent !important;
    }

    .page-wrapper.sidebar-collapsed .user-avatar-mimic,
    .page-wrapper.sidebar-collapsed .user-avatar-mimic img {
        width: 34px !important;
        height: 34px !important;
        border-radius: 50% !important;
    }
}

.markdown-content a.md-link,
.markdown-content a {
    display: inline;
    color: #0b57d0;
    border-bottom: 0;
    background: rgba(11, 87, 208, 0.075);
    border-radius: 7px;
    padding: 1px 6px 2px;
    font-weight: 650;
    line-height: 1.72;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.markdown-content a.md-link::after,
.markdown-content a::after {
    content: "↗";
    font-size: 0.72em;
    margin-left: 3px;
    opacity: 0.72;
}

.markdown-content a.md-link:hover,
.markdown-content a:hover {
    color: #063f9e;
    background: rgba(11, 87, 208, 0.13);
    border-bottom: 0;
    padding: 1px 6px 2px;
}

.price-badge {
    background: #111111 !important;
    color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.72) !important;
    border-radius: var(--radius-full) !important;
    box-shadow: none !important;
    padding: 2px 8px 3px !important;
    font-weight: 760 !important;
    font-size: 0.88em !important;
}

@media (max-width: 760px) {
    body.is-guest {
        background: #000000;
    }

    body.is-guest .page-wrapper,
    body.is-guest .main-content,
    body.is-guest .app-container,
    body.is-guest .chat-area {
        background: #000000 !important;
        color: #ffffff;
    }

    body.is-guest .mobile-header {
        height: 86px;
        padding: 28px 24px 12px;
        background: #000000 !important;
        color: #ffffff;
        border: 0;
        box-shadow: none;
    }

    body.is-guest .mobile-header .icon-toggle-btn {
        width: 36px;
        height: 36px;
        color: #ffffff;
        font-size: 1.34rem;
        background: transparent;
    }

    body.is-guest .mobile-logo-text {
        color: #ffffff;
        font-size: 1.34rem;
        font-weight: 700;
    }

    body.is-guest .guest-header {
        top: 26px;
        right: 22px;
        z-index: 1100;
    }

    body.is-guest .guest-logo-link {
        display: none;
    }

    body.is-guest .guest-nav-login {
        min-height: 52px;
        padding: 0 22px;
        border-radius: var(--radius-full);
        background: #ffffff !important;
        color: #000000 !important;
        border-color: #ffffff !important;
        font-size: 1rem;
        font-weight: 700;
    }

    body.is-guest .guest-nav-register,
    body.is-guest .guest-nav-gear {
        display: none !important;
    }

    body.is-guest .app-container,
    body.is-guest .app-container.centered-landing {
        padding: 96px 20px 0 !important;
        min-height: 100%;
    }

    body.is-guest .app-container.centered-landing {
        justify-content: center;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        margin-bottom: clamp(150px, 27vh, 230px);
    }

    body.is-guest .greeting-container h2 {
        color: #ffffff;
        font-size: clamp(2.02rem, 8.8vw, 2.7rem);
        line-height: 1.18;
        font-weight: 400;
        letter-spacing: 0;
    }

    body.is-guest .greeting-container .logo-text,
    body.is-guest .greeting-container h2 br {
        display: none;
    }

    body.is-guest .input-wrapper {
        left: 20px;
        right: 20px;
        bottom: max(22px, env(safe-area-inset-bottom));
    }

    body.is-guest .composer-input {
        min-height: 62px;
        border-radius: 32px;
        background: #262626 !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    body.is-guest .composer-input::after {
        display: none !important;
    }

    body.is-guest .input-top-row {
        min-height: 62px;
        padding: 0 8px 0 14px !important;
        gap: 10px;
    }

    body.is-guest .composer-input textarea {
        color: #ffffff;
        min-height: 34px;
        height: 34px;
        line-height: 34px;
        padding: 0;
        font-size: 1rem;
        font-weight: 500;
    }

    body.is-guest .composer-input textarea::placeholder {
        color: rgba(255, 255, 255, 0.62);
        opacity: 1;
    }

    /* Hide web/think toggles on mobile guest — cleaner like ChatGPT */
    body.is-guest .toggles-container {
        display: none !important;
    }

    body.is-guest .connector-trigger {
        width: 42px !important;
        height: 42px !important;
        border: 0 !important;
        background: #2c2c2e !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        color: rgba(255, 255, 255, 0.80) !important;
        box-shadow: none !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    body.is-guest .connector-trigger span {
        display: none !important;
    }

    body.is-guest .submit-btn {
        width: 46px;
        height: 46px;
        flex-basis: 46px;
        background: #ffffff !important;
        color: #000000 !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 1.1rem !important;
    }

    body.is-guest .guest-limit-banner {
        background: #111111;
        color: #ffffff;
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: none;
    }

    body.is-guest .guest-limit-banner__text {
        color: rgba(255, 255, 255, 0.82);
    }

    body.is-guest .sidebar {
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 340px);
        border-radius: 0;
        background: #000000;
        box-shadow: none;
        padding-top: 18px;
    }

    body.is-guest .sidebar-top {
        min-height: 112px;
        padding: 22px 26px 20px;
        justify-content: space-between;
    }

    body.is-guest .sidebar-top .home-link {
        position: static;
        transform: none;
        width: 74px;
        height: 54px;
    }

    body.is-guest .main-logo-img {
        height: 54px;
        max-width: 96px;
    }

    body.is-guest .sidebar-top .icon-toggle-btn {
        color: rgba(255, 255, 255, 0.76);
        font-size: 1.7rem;
    }

    body.is-guest .sidebar-nav-menu {
        padding: 0 18px !important;
        gap: 6px !important;
    }

    body.is-guest .nav-menu-btn,
    body.is-guest .nav-menu-btn.active {
        min-height: 58px !important;
        padding: 10px 24px !important;
        border-radius: 16px !important;
        color: #ffffff !important;
        font-size: 1.36rem !important;
        font-weight: 500 !important;
    }

    body.is-guest .nav-menu-btn i {
        width: 36px !important;
        font-size: 1.52rem !important;
    }

    body.is-guest .nav-menu-btn.active,
    body.is-guest .nav-menu-btn:hover {
        background: #303030 !important;
    }

    body.is-guest .sidebar-content,
    body.is-guest .sidebar-footer {
        display: none;
    }
}
/* EOF clean controls correction: must stay last. */
#sidebarCloseBtn {
    width: 32px !important;
    min-width: 32px !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--clean-control-fg, #5f6368) !important;
    box-shadow: none !important;
    transform: none !important;
}

#sidebarCloseBtn:hover,
#sidebarCloseBtn:focus-visible {
    background: var(--clean-hover-bg, #f1f1f1) !important;
    color: var(--clean-strong-fg, #202124) !important;
    box-shadow: none !important;
    transform: none !important;
}

#sidebarCloseBtn .sidebar-action-svg,
#sidebarCloseBtn:hover .sidebar-action-svg,
#sidebarCloseBtn:focus-visible .sidebar-action-svg {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2 !important;
    transform: none !important;
}

body:not(.is-guest) .nav-menu-btn,
body:not(.is-guest) .nav-menu-btn.active {
    min-height: 40px !important;
    height: 40px !important;
    grid-template-columns: 24px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 10px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--clean-strong-fg, #202124) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transform: none !important;
}

body:not(.is-guest) .nav-menu-btn::before {
    inset: 0 !important;
    border-radius: 10px !important;
    background: var(--clean-hover-bg, #f1f1f1) !important;
}

body:not(.is-guest) .nav-menu-btn:hover,
body:not(.is-guest) .nav-menu-btn.active {
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .nav-menu-btn.active::before {
    background: var(--clean-active-bg, #eeeeee) !important;
    opacity: 1 !important;
}

body:not(.is-guest) .nav-menu-btn .sidebar-nav-svg,
body:not(.is-guest) .nav-menu-btn:hover .sidebar-nav-svg,
body:not(.is-guest) .nav-menu-btn.active .sidebar-nav-svg,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-chat,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-search,
body:not(.is-guest) .nav-menu-btn:hover .nav-icon-agent {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 2.2 !important;
    transform: none !important;
}

body:not(.is-guest) .sidebar .nav-menu-btn .nav-text {
    transform: none !important;
    font-weight: 550 !important;
}

body:not(.is-guest) .img-upload-btn,
body:not(.is-guest) .toggle-switch,
body:not(.is-guest) .icon-btn {
    width: 36px !important;
    min-width: 36px !important;
    height: 36px !important;
    min-height: 36px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: var(--clean-control-fg, #5f6368) !important;
    box-shadow: none !important;
    transform: none !important;
    padding: 0 !important;
}

body:not(.is-guest) .img-upload-btn:hover,
body:not(.is-guest) .toggle-switch:hover,
body:not(.is-guest) .icon-btn:hover {
    background: var(--clean-hover-bg, #f1f1f1) !important;
    color: var(--clean-strong-fg, #202124) !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .mode-select-trigger,
body:not(.is-guest) .connector-trigger {
    height: 36px !important;
    min-height: 36px !important;
    border: 0 !important;
    border-radius: 18px !important;
    background: transparent !important;
    color: var(--clean-control-fg, #5f6368) !important;
    box-shadow: none !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    transform: none !important;
}

body:not(.is-guest) .mode-select-trigger:hover,
body:not(.is-guest) .mode-select-shell.open .mode-select-trigger,
body:not(.is-guest) .connector-trigger:hover,
body:not(.is-guest) .connectors-container.open .connector-trigger {
    background: var(--clean-hover-bg, #f1f1f1) !important;
    color: var(--clean-strong-fg, #202124) !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .submit-btn,
body:not(.is-guest) .submit-btn:hover {
    width: 34px !important;
    min-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    flex: 0 0 34px !important;
    border: 0 !important;
    border-radius: 999px !important;
    box-shadow: none !important;
    transform: none !important;
}

body:not(.is-guest) .composer-input::after,
body:not(.is-guest) .composer-input:focus-within::after {
    box-shadow: none !important;
}


/* Final ChatGPT-like message actions and sidebar close button. */
.user-message-shell--short .user-msg-action-bar {
    align-self: center !important;
    justify-content: center !important;
}

.user-message-shell--long .user-msg-action-bar {
    align-self: flex-end !important;
    justify-content: flex-end !important;
}

.user-msg-action-bar {
    gap: 4px !important;
    min-height: 36px !important;
    margin: 6px 0 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.user-msg-action-bar .msg-action-btn {
    position: relative !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 10px !important;
    background: transparent !important;
    color: #6b6f76 !important;
    opacity: 1 !important;
    border: 0 !important;
    box-shadow: none !important;
    font-size: 20px !important;
    line-height: 1 !important;
    transition: background 120ms ease, color 120ms ease !important;
}

.user-msg-action-bar .msg-action-btn:hover,
.user-msg-action-bar .msg-action-btn:focus-visible {
    background: #ececec !important;
    color: #4f5359 !important;
    outline: none !important;
}

.user-msg-action-bar .msg-action-btn i {
    line-height: 1 !important;
}

.user-msg-action-bar .msg-action-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    z-index: 50;
    padding: 8px 10px;
    border-radius: 8px;
    background: #171717;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-2px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.user-msg-action-bar .msg-action-btn[data-tooltip]:hover::after,
.user-msg-action-bar .msg-action-btn[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.sidebar,
.sidebar-top {
    overflow: visible !important;
}

#sidebarCloseBtn {
    position: relative !important;
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: #6f7378 !important;
    border: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

#sidebarCloseBtn:hover,
#sidebarCloseBtn:focus-visible {
    background: #ececec !important;
    color: #5f6368 !important;
    outline: none !important;
    box-shadow: none !important;
}

#sidebarCloseBtn .sidebar-action-svg,
#sidebarCloseBtn:hover .sidebar-action-svg,
#sidebarCloseBtn:focus-visible .sidebar-action-svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 1.8 !important;
    transform: none !important;
}

#sidebarCloseBtn::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    z-index: 200;
    padding: 8px 11px;
    border-radius: 8px;
    background: #171717;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(-2px);
    transition: opacity 120ms ease, transform 120ms ease;
}

#sidebarCloseBtn:hover::after,
#sidebarCloseBtn:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* Final refinement: ChatGPT-style thin user message action icons. */
.user-message-shell--short .user-msg-action-bar {
    align-self: center !important;
    justify-content: center !important;
}

.user-message-shell--long .user-msg-action-bar {
    align-self: flex-end !important;
    justify-content: flex-end !important;
}

.user-msg-action-bar {
    gap: 11px !important;
    min-height: 30px !important;
    margin: 9px 2px 0 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.user-msg-action-bar .msg-action-btn {
    position: relative !important;
    width: 30px !important;
    height: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    color: #6f7378 !important;
    opacity: 1 !important;
    border: 0 !important;
    box-shadow: none !important;
    line-height: 1 !important;
    transition: background 120ms ease, color 120ms ease !important;
}

.user-msg-action-bar .msg-action-btn:hover,
.user-msg-action-bar .msg-action-btn:focus-visible {
    background: #f2f2f2 !important;
    color: #5f6368 !important;
    outline: none !important;
}

.user-msg-action-bar .msg-action-btn .user-action-svg {
    width: 24px !important;
    height: 24px !important;
    display: block !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 2.05 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    vector-effect: non-scaling-stroke !important;
}

.user-msg-action-bar .msg-action-btn i {
    font-size: 18px !important;
    line-height: 1 !important;
}


/* Final chat layout refinement: browser-level scroll and ChatGPT-like reading width. */
html {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    scrollbar-gutter: stable;
}

body:not(.is-guest) {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body:not(.is-guest) .page-wrapper {
    height: auto !important;
    min-height: 100vh !important;
    width: 100% !important;
    overflow: visible !important;
    align-items: stretch !important;
}

body:not(.is-guest) .sidebar {
    position: sticky !important;
    top: 0 !important;
    height: 100vh !important;
    align-self: flex-start !important;
}

body:not(.is-guest) .main-content,
body:not(.is-guest) .app-container,
body:not(.is-guest) .app-container:not(.centered-landing) {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) {
    max-width: 100% !important;
    padding: 0 24px !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
    flex: none !important;
    width: min(100%, 760px) !important;
    max-width: 760px !important;
    min-height: 100vh !important;
    margin: 0 auto !important;
    padding: 72px 0 174px !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .messages {
    width: 100% !important;
    max-width: 760px !important;
    margin: 0 auto !important;
    gap: 1.18rem !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .assistant-msg-wrapper,
body:not(.is-guest) .app-container:not(.centered-landing) .message-bubble.assistant,
body:not(.is-guest) .app-container:not(.centered-landing) .answer-content {
    width: 100% !important;
    max-width: 760px !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .answer-content,
body:not(.is-guest) .app-container:not(.centered-landing) .message-bubble.assistant {
    font-size: 1rem !important;
    line-height: 1.76 !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .user-message-shell {
    max-width: min(74%, 680px) !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper {
    position: fixed !important;
    left: calc(var(--sidebar-width) + ((100vw - var(--sidebar-width)) - min(820px, calc(100vw - var(--sidebar-width) - 48px))) / 2) !important;
    right: auto !important;
    bottom: max(18px, env(safe-area-inset-bottom)) !important;
    width: min(820px, calc(100vw - var(--sidebar-width) - 48px)) !important;
    max-width: 820px !important;
    margin: 0 !important;
    z-index: 60 !important;
}

body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
    left: calc(var(--sidebar-collapsed-width) + ((100vw - var(--sidebar-collapsed-width)) - min(820px, calc(100vw - var(--sidebar-collapsed-width) - 48px))) / 2) !important;
    width: min(820px, calc(100vw - var(--sidebar-collapsed-width) - 48px)) !important;
}

body:not(.is-guest) .app-container:not(.centered-landing) .composer-input,
body:not(.is-guest) .app-container:not(.centered-landing) .guest-limit-banner {
    width: 100% !important;
    max-width: 820px !important;
}

body:not(.is-guest) .chat-area::-webkit-scrollbar {
    display: none !important;
}

/* Final icon tuning: smaller hit area, lighter strokes, cleaner pencil/copy shapes. */
.user-msg-action-bar {
    gap: 10px !important;
    min-height: 28px !important;
    margin: 8px 1px 0 0 !important;
}

.user-msg-action-bar .msg-action-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 8px !important;
    color: #666a70 !important;
}

.user-msg-action-bar .msg-action-btn:hover,
.user-msg-action-bar .msg-action-btn:focus-visible {
    background: #f4f4f4 !important;
    color: #3f4246 !important;
}

.user-msg-action-bar .msg-action-btn .user-action-svg {
    width: 22px !important;
    height: 22px !important;
    stroke-width: 1.78 !important;
    shape-rendering: geometricPrecision !important;
}

@media (max-width: 760px) {
    body:not(.is-guest) {
        overflow-y: auto !important;
    }

    body:not(.is-guest) .sidebar {
        position: fixed !important;
        height: auto !important;
        top: 10px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 16px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: 100% !important;
        max-width: 100% !important;
        padding: 76px 0 154px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .messages,
    body:not(.is-guest) .app-container:not(.centered-landing) .assistant-msg-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .message-bubble.assistant,
    body:not(.is-guest) .app-container:not(.centered-landing) .answer-content {
        max-width: 100% !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .user-message-shell {
        max-width: min(86%, 680px) !important;
    }
}

/* Keep the desktop sidebar controls pinned while the chat page scrolls. */
@media (min-width: 761px) {
    body:not(.is-guest) .page-wrapper {
        display: block !important;
    }

    body:not(.is-guest) .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        align-self: auto !important;
    }

    body:not(.is-guest) .main-content {
        margin-left: var(--sidebar-width) !important;
        width: calc(100% - var(--sidebar-width)) !important;
        min-height: 100vh !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .main-content {
        margin-left: var(--sidebar-collapsed-width) !important;
        width: calc(100% - var(--sidebar-collapsed-width)) !important;
    }
}

/* Final overlap fix: keep sidebar/user action controls quiet and unclipped. */
.sidebar-content {
    overflow-y: auto !important;
    scrollbar-gutter: auto !important;
}

#sidebarCloseBtn::after,
#sidebarCloseBtn:hover::after,
#sidebarCloseBtn:focus-visible::after {
    content: none !important;
    display: none !important;
}

.user-message-shell--short .user-msg-action-bar,
.user-message-shell--long .user-msg-action-bar,
.user-msg-action-bar {
    align-self: flex-end !important;
    justify-content: flex-end !important;
}

.user-msg-action-bar .msg-action-btn[data-tooltip]::after,
.user-msg-action-bar .msg-action-btn[data-tooltip]:hover::after,
.user-msg-action-bar .msg-action-btn[data-tooltip]:focus-visible::after {
    content: none !important;
    display: none !important;
}

/* Final interface polish: one clean line-button system for sidebar and message actions. */
:root {
    --sidebar-collapsed-width: 58px;
    --sidebar-btn-collapsed-size: 38px;
    --sidebar-nav-btn-height: 44px;
    --sidebar-nav-icon-box: 28px;
    --sidebar-nav-icon-size: 20px;
    --sidebar-hover-bg: #f3f3f3;
    --sidebar-active-bg: #eeeeee;
    --sidebar-icon-color: #5f6368;
    --sidebar-text-color: #202124;
    --line-action-size: 30px;
    --line-action-icon-size: 20px;
    --line-action-stroke: 1.82;
}

.sidebar {
    border-right: 1px solid #ececec !important;
    box-shadow: none !important;
}

.sidebar-top {
    min-height: 72px !important;
    padding: 14px 14px 8px !important;
    align-items: center !important;
}

.sidebar-nav-menu {
    padding: 0 12px !important;
    margin: 4px 0 20px !important;
    gap: 6px !important;
}

.nav-menu-btn,
.nav-menu-btn.active {
    display: grid !important;
    grid-template-columns: var(--sidebar-nav-icon-box) minmax(0, 1fr) !important;
    min-height: var(--sidebar-nav-btn-height) !important;
    height: var(--sidebar-nav-btn-height) !important;
    padding: 0 12px !important;
    gap: 10px !important;
    border-radius: 14px !important;
    border: 0 !important;
    color: var(--sidebar-text-color) !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

.nav-menu-btn::before {
    inset: 0 !important;
    border-radius: 14px !important;
    background: var(--sidebar-hover-bg) !important;
}

.nav-menu-btn:hover::before {
    opacity: 1 !important;
}

.nav-menu-btn.active::before {
    background: var(--sidebar-active-bg) !important;
    opacity: 1 !important;
}

.nav-menu-btn .sidebar-nav-svg,
.nav-menu-btn:hover .sidebar-nav-svg,
.nav-menu-btn.active .sidebar-nav-svg,
.nav-menu-btn:hover .nav-icon-chat,
.nav-menu-btn:hover .nav-icon-search,
.nav-menu-btn:hover .nav-icon-agent {
    width: var(--sidebar-nav-icon-size) !important;
    height: var(--sidebar-nav-icon-size) !important;
    color: var(--sidebar-icon-color) !important;
    stroke: currentColor !important;
    stroke-width: 1.85 !important;
    transform: none !important;
    opacity: 1 !important;
}

.nav-menu-btn .nav-text,
.sidebar .nav-menu-btn .nav-text {
    transform: none !important;
    font-size: 0.95rem !important;
    font-weight: 560 !important;
    letter-spacing: 0 !important;
    color: var(--sidebar-text-color) !important;
}

#sidebarCloseBtn,
.mobile-header .icon-toggle-btn {
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    min-height: 38px !important;
    border-radius: 10px !important;
    color: var(--sidebar-icon-color) !important;
    background: transparent !important;
}

#sidebarCloseBtn:hover,
#sidebarCloseBtn:focus-visible,
.mobile-header .icon-toggle-btn:hover,
.mobile-header .icon-toggle-btn:focus-visible {
    background: var(--sidebar-hover-bg) !important;
    color: #202124 !important;
}

.sidebar-action-svg,
#sidebarCloseBtn .sidebar-action-svg,
#sidebarCloseBtn:hover .sidebar-action-svg,
#sidebarCloseBtn:focus-visible .sidebar-action-svg {
    width: 20px !important;
    height: 20px !important;
    stroke-width: 1.82 !important;
    transform: none !important;
}

.sidebar-content {
    padding: 0 12px !important;
}

.history-dropdown-header {
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 12px !important;
    gap: 7px !important;
    border-radius: 12px !important;
    color: var(--sidebar-text-color) !important;
    font-weight: 560 !important;
}

.history-dropdown-header:hover {
    background: var(--sidebar-hover-bg) !important;
}

.history-chevron-svg {
    width: 15px !important;
    height: 15px !important;
    stroke-width: 1.85 !important;
    color: var(--sidebar-icon-color) !important;
    stroke: currentColor !important;
}

#historyList .history-group-title {
    margin: 18px 0 7px !important;
    padding: 0 12px !important;
    color: #747775 !important;
    font-size: 0.82rem !important;
    font-weight: 470 !important;
}

#historyList .history-item {
    min-height: 38px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 12px !important;
    border-radius: 12px !important;
    font-size: 0.92rem !important;
    line-height: 1.2 !important;
    font-weight: 470 !important;
    color: var(--sidebar-text-color) !important;
}

#historyList .history-item:hover,
#historyList .history-item.active {
    background: var(--sidebar-hover-bg) !important;
}

.sidebar-footer {
    gap: 8px !important;
    padding: 10px 12px 12px !important;
    border-top: 1px solid #ececec !important;
}

.sidebar-user-btn {
    min-height: 46px !important;
    height: 46px !important;
    padding: 0 9px !important;
    gap: 10px !important;
    border: 0 !important;
    border-radius: 14px !important;
    background: transparent !important;
    outline: none !important;
}

.sidebar-user-btn:hover,
.sidebar-user-btn:focus-visible {
    background: var(--sidebar-hover-bg) !important;
}

.user-avatar-mimic,
.user-avatar-mimic img {
    width: 34px !important;
    height: 34px !important;
    transform: none !important;
}

#userDisplayName {
    font-size: 0.91rem !important;
    font-weight: 520 !important;
}

#userEmailDisplay {
    font-size: 0.78rem !important;
    font-weight: 420 !important;
    letter-spacing: 0 !important;
    color: #6f7378 !important;
}

.user-context-menu {
    width: 222px !important;
    padding: 7px !important;
    border-radius: 14px !important;
    background: #ffffff !important;
    border: 1px solid #e8e8e8 !important;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.10) !important;
}

.ctx-menu-item {
    min-height: 40px !important;
    grid-template-columns: 26px minmax(0, 1fr) 16px !important;
    gap: 8px !important;
    padding: 0 9px !important;
    border-radius: 11px !important;
    font-size: 0.94rem !important;
    font-weight: 520 !important;
}

.ctx-menu-item:hover,
.ctx-menu-item.is-open {
    background: var(--sidebar-hover-bg) !important;
}

.ctx-menu-icon {
    width: 26px !important;
    height: 26px !important;
    color: var(--sidebar-icon-color) !important;
}

.ctx-menu-svg,
.ctx-menu-chevron {
    width: 18px !important;
    height: 18px !important;
    stroke-width: 1.82 !important;
}

@media (min-width: 761px) {
    .page-wrapper.sidebar-collapsed .sidebar-top {
        min-height: 72px !important;
        padding: 14px 0 8px !important;
        justify-content: center !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-nav-menu {
        padding: 0 10px !important;
        gap: 8px !important;
        margin-top: 6px !important;
        align-items: center !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn,
    .page-wrapper.sidebar-collapsed .nav-menu-btn.active {
        width: var(--sidebar-btn-collapsed-size) !important;
        min-width: var(--sidebar-btn-collapsed-size) !important;
        max-width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        padding: 0 !important;
        border-radius: 11px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn::before {
        border-radius: 11px !important;
    }

    .page-wrapper.sidebar-collapsed .nav-menu-btn .sidebar-nav-svg {
        width: 20px !important;
        height: 20px !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-footer {
        width: 100% !important;
        align-items: center !important;
        gap: 16px !important;
        padding: 0 0 18px !important;
        border-top: 0 !important;
    }

    .page-wrapper.sidebar-collapsed .expand-btn {
        width: var(--sidebar-btn-collapsed-size) !important;
        min-width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        border-radius: 11px !important;
        background: transparent !important;
        color: var(--sidebar-icon-color) !important;
        transform: none !important;
    }

    .page-wrapper.sidebar-collapsed .expand-btn:hover,
    .page-wrapper.sidebar-collapsed .expand-btn:focus-visible {
        background: var(--sidebar-hover-bg) !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-user-container,
    .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        width: var(--sidebar-btn-collapsed-size) !important;
        min-width: var(--sidebar-btn-collapsed-size) !important;
        height: var(--sidebar-btn-collapsed-size) !important;
        min-height: var(--sidebar-btn-collapsed-size) !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        padding: 0 !important;
        border-radius: 50% !important;
    }
}

.msg-action-bar.assistant-msg-action-bar {
    align-self: flex-start !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    min-height: var(--line-action-size) !important;
    margin: 8px 0 0 -3px !important;
    padding: 0 !important;
    opacity: 1 !important;
}

.assistant-msg-action-bar .msg-action-btn,
.user-msg-action-bar .msg-action-btn {
    width: var(--line-action-size) !important;
    min-width: var(--line-action-size) !important;
    height: var(--line-action-size) !important;
    min-height: var(--line-action-size) !important;
    border-radius: 8px !important;
    color: #6f7378 !important;
    background: transparent !important;
    opacity: 1 !important;
    border: 0 !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.assistant-msg-action-bar .msg-action-btn:hover,
.assistant-msg-action-bar .msg-action-btn:focus-visible,
.user-msg-action-bar .msg-action-btn:hover,
.user-msg-action-bar .msg-action-btn:focus-visible {
    background: #f3f3f3 !important;
    color: #202124 !important;
    outline: none !important;
}

.assistant-msg-action-bar .msg-action-btn.active,
.user-msg-action-bar .msg-action-btn.active {
    background: #f1f1f1 !important;
    color: #202124 !important;
}

.message-action-svg,
.user-msg-action-bar .msg-action-btn .message-action-svg,
.assistant-msg-action-bar .msg-action-btn .message-action-svg {
    width: var(--line-action-icon-size) !important;
    height: var(--line-action-icon-size) !important;
    display: block !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: var(--line-action-stroke) !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    vector-effect: non-scaling-stroke !important;
    shape-rendering: geometricPrecision !important;
}

/* Final mode picker polish: softer ChatGPT-like hover states. */
body:not(.is-guest) .mode-select-trigger {
    min-width: 72px !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 12px 0 14px !important;
    border: 1px solid transparent !important;
    border-radius: 999px !important;
    background: transparent !important;
    color: #4f5359 !important;
    box-shadow: none !important;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease !important;
}

body:not(.is-guest) .mode-select-trigger:hover,
body:not(.is-guest) .mode-select-trigger:focus-visible,
body:not(.is-guest) .mode-select-shell.open .mode-select-trigger {
    background: #f4f4f4 !important;
    border-color: transparent !important;
    color: #202124 !important;
    outline: none !important;
}

body:not(.is-guest) .mode-dropdown {
    width: 232px !important;
    padding: 6px !important;
    border-radius: 16px !important;
    background: #ffffff !important;
    border: 1px solid #e8e8e8 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12) !important;
}

body:not(.is-guest) .mode-option {
    min-height: 54px !important;
    grid-template-columns: 26px 24px minmax(0, 1fr) !important;
    gap: 8px !important;
    padding: 7px 10px !important;
    border-radius: 12px !important;
    background: transparent !important;
    color: #5f6368 !important;
    box-shadow: none !important;
    transform: none !important;
    transition: background 110ms ease, color 110ms ease !important;
}

body:not(.is-guest) .mode-option.is-selected {
    background: transparent !important;
    color: #202124 !important;
}

body:not(.is-guest) .mode-option:hover,
body:not(.is-guest) .mode-option:focus-visible {
    background: #f5f5f5 !important;
    color: #202124 !important;
    outline: none !important;
}

body:not(.is-guest) .mode-option-mark,
body:not(.is-guest) .mode-option-leading-icon {
    width: 24px !important;
    height: 24px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #202124 !important;
    font-size: 14px !important;
}

body:not(.is-guest) .mode-option-leading-icon {
    color: #5f6368 !important;
}

body:not(.is-guest) .mode-option:hover .mode-option-leading-icon,
body:not(.is-guest) .mode-option:focus-visible .mode-option-leading-icon,
body:not(.is-guest) .mode-option.is-selected .mode-option-leading-icon {
    color: #202124 !important;
}

body:not(.is-guest) .mode-option-title {
    font-size: 14px !important;
    font-weight: 560 !important;
    line-height: 1.2 !important;
    color: #202124 !important;
}

body:not(.is-guest) .mode-option-subtitle {
    margin-top: 2px !important;
    font-size: 13px !important;
    font-weight: 420 !important;
    line-height: 1.2 !important;
    color: #6f7378 !important;
}

body:not(.is-guest) .mode-option:hover .mode-option-subtitle,
body:not(.is-guest) .mode-option:focus-visible .mode-option-subtitle {
    color: #5f6368 !important;
}

body:not(.is-guest) .mode-select-shell.open .mode-option,
body:not(.is-guest) .mode-select-shell.open .mode-option:nth-child(2) {
    animation: none !important;
}

/* Final mobile UI polish: compact composer, safe chat column, proper drawer. */
@media (max-width: 760px) {
    body {
        width: 100% !important;
        min-height: 100dvh !important;
        overflow-x: hidden !important;
    }

    body:not(.is-guest) .guest-header {
        display: none !important;
    }

    body:not(.is-guest) .mobile-header {
        height: 56px !important;
        padding: 8px 16px !important;
        background: rgba(255, 255, 255, 0.94) !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body:not(.is-guest) .mobile-logo-text {
        font-size: 1.10rem !important;
        font-weight: 680 !important;
        letter-spacing: 0 !important;
    }

    body:not(.is-guest) .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        border-radius: 10px !important;
    }

    body:not(.is-guest) .page-wrapper::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 1190;
        background: rgba(0, 0, 0, 0.20);
        opacity: 1;
        pointer-events: auto;
        transition: opacity 180ms ease;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed::after {
        opacity: 0;
        pointer-events: none;
    }

    body:not(.is-guest) .sidebar {
        top: 0 !important;
        left: 0 !important;
        bottom: auto !important;
        width: min(84vw, 320px) !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border-right: 1px solid #ececec !important;
        box-shadow: 18px 0 40px rgba(0, 0, 0, 0.10) !important;
        background: #ffffff !important;
        transform: translateX(0) !important;
        overflow: hidden !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        transform: translateX(-104%) !important;
        opacity: 1 !important;
    }

    body:not(.is-guest) .sidebar-top {
        min-height: 60px !important;
        padding: 10px 14px 6px !important;
    }

    body:not(.is-guest) .sidebar-nav-menu {
        padding: 0 12px !important;
        margin: 8px 0 16px !important;
        gap: 6px !important;
    }

    body:not(.is-guest) .sidebar-content {
        padding: 0 12px !important;
        overflow-y: auto !important;
    }

    body:not(.is-guest) .sidebar-footer {
        padding: 10px 12px max(14px, env(safe-area-inset-bottom)) !important;
    }

    body:not(.is-guest) .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 20px !important;
        width: 100% !important;
        max-width: none !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100dvh !important;
        padding: 74px 0 136px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .messages {
        gap: 1.1rem !important;
    }

    body:not(.is-guest) .assistant-msg-wrapper,
    body:not(.is-guest) .message-bubble.assistant,
    body:not(.is-guest) .answer-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    body:not(.is-guest) .message-bubble.assistant,
    body:not(.is-guest) .answer-content {
        font-size: 1rem !important;
        line-height: 1.68 !important;
    }

    body:not(.is-guest) .markdown-content ul,
    body:not(.is-guest) .markdown-content ol,
    body:not(.is-guest) .answer-content ul,
    body:not(.is-guest) .answer-content ol {
        padding-left: 1.3rem !important;
        margin-left: 0 !important;
    }

    body:not(.is-guest) .markdown-content li,
    body:not(.is-guest) .answer-content li {
        padding-left: 0.1rem !important;
    }

    body:not(.is-guest) .user-message-shell {
        max-width: min(86%, 680px) !important;
    }

    body:not(.is-guest) .message-bubble.user {
        border-radius: 21px !important;
        padding: 9px 15px !important;
        font-size: 0.98rem !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        z-index: 90 !important;
    }

    body:not(.is-guest) .composer-input {
        min-height: 58px !important;
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    }

    body:not(.is-guest) .composer-input::after {
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }

    body:not(.is-guest) .input-top-row {
        min-height: 58px !important;
        padding: 8px 8px 8px 12px !important;
        gap: 7px !important;
    }

    body:not(.is-guest) .composer-input textarea {
        height: 28px !important;
        min-height: 28px !important;
        line-height: 28px !important;
        font-size: 0.98rem !important;
        padding: 0 !important;
    }

    body:not(.is-guest) .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
    }

    body:not(.is-guest) .img-upload-btn,
    body:not(.is-guest) .toggle-switch,
    body:not(.is-guest) .icon-btn {
        width: 36px !important;
        min-width: 36px !important;
        height: 36px !important;
        min-height: 36px !important;
    }

    body:not(.is-guest) .mode-select-trigger {
        min-width: 60px !important;
        height: 36px !important;
        min-height: 36px !important;
        padding: 0 8px 0 10px !important;
        font-size: 0.92rem !important;
    }

    body:not(.is-guest) .submit-btn,
    body:not(.is-guest) .submit-btn:hover {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 50% !important;
        font-size: 1rem !important;
    }

    body:not(.is-guest) .mode-dropdown {
        right: 0 !important;
        width: min(236px, calc(100vw - 32px)) !important;
        bottom: calc(100% + 10px) !important;
    }

    body.is-guest .guest-header {
        top: 22px !important;
        right: 20px !important;
        left: auto !important;
        height: auto !important;
        padding: 0 !important;
    }

    body.is-guest .guest-nav-login {
        min-height: 44px !important;
        padding: 0 18px !important;
        font-size: 0.95rem !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        margin-bottom: clamp(118px, 20vh, 180px) !important;
    }

    body.is-guest .greeting-container h2 {
        font-size: clamp(1.95rem, 10vw, 2.48rem) !important;
        line-height: 1.12 !important;
    }

    body.is-guest .input-wrapper {
        left: 14px !important;
        right: 14px !important;
        bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }

    body.is-guest .composer-input {
        min-height: 58px !important;
        border-radius: 30px !important;
    }

    body.is-guest .input-top-row {
        min-height: 58px !important;
        padding: 8px 8px 8px 12px !important;
        gap: 7px !important;
    }

    body.is-guest .composer-input textarea {
        height: 28px !important;
        min-height: 28px !important;
        line-height: 28px !important;
        font-size: 0.98rem !important;
    }

    body.is-guest .submit-btn {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
    }
}

/* Specificity lock: older sidebar rules define local variables on .sidebar. */
body:not(.is-guest) .sidebar {
    --sidebar-btn-collapsed-size: 38px;
    --sidebar-nav-btn-height: 44px;
    --sidebar-nav-icon-size: 20px;
    --sidebar-expand-btn-size: 38px;
    --sidebar-expand-offset-y: 0;
    --sidebar-expand-icon-size: 20px;
}

body:not(.is-guest) .sidebar .nav-menu-btn,
body:not(.is-guest) .sidebar .nav-menu-btn.active {
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 12px !important;
    border-radius: 14px !important;
}

body:not(.is-guest) .sidebar .nav-menu-btn .sidebar-nav-svg,
body:not(.is-guest) .sidebar .nav-menu-btn:hover .sidebar-nav-svg,
body:not(.is-guest) .sidebar .nav-menu-btn.active .sidebar-nav-svg,
body:not(.is-guest) .sidebar .nav-menu-btn:hover .nav-icon-chat,
body:not(.is-guest) .sidebar .nav-menu-btn:hover .nav-icon-search,
body:not(.is-guest) .sidebar .nav-menu-btn:hover .nav-icon-agent {
    width: 20px !important;
    height: 20px !important;
    stroke-width: 1.85 !important;
    transform: none !important;
}

@media (min-width: 761px) {
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        width: 58px !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .nav-menu-btn.active,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .expand-btn,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar-user-container,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        width: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .expand-btn {
        transform: none !important;
        margin: 0 auto !important;
        border-radius: 11px !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar-user-container,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar-user-btn {
        margin: 0 auto !important;
    }
}

/* Final mobile override: this must stay last because older guest-mobile blocks set black backgrounds. */
@media (max-width: 760px) {
    body.is-guest,
    body.is-guest .page-wrapper,
    body.is-guest .main-content,
    body.is-guest .app-container,
    body.is-guest .app-container.centered-landing,
    body.is-guest .chat-area {
        background: #ffffff !important;
        color: #111111 !important;
    }

    body.is-guest .page-wrapper::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.is-guest .mobile-header {
        height: 62px !important;
        padding: 10px 16px !important;
        background: #ffffff !important;
        color: #111111 !important;
        border-bottom: 0 !important;
        box-shadow: none !important;
    }

    body.is-guest .mobile-logo-text {
        color: #111111 !important;
        font-size: 1.12rem !important;
        font-weight: 680 !important;
        letter-spacing: 0 !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn {
        width: 40px !important;
        height: 40px !important;
        border-radius: 12px !important;
        color: #5f6368 !important;
        background: transparent !important;
    }

    body.is-guest .mobile-header .icon-toggle-btn:hover,
    body.is-guest .mobile-header .icon-toggle-btn:focus-visible {
        background: #f2f2f2 !important;
    }

    body.is-guest .guest-header {
        top: 10px !important;
        right: 14px !important;
        z-index: 1002 !important;
    }

    body.is-guest .guest-nav-login {
        min-height: 40px !important;
        padding: 0 17px !important;
        border-radius: 999px !important;
        background: #111111 !important;
        color: #ffffff !important;
        border: 0 !important;
        box-shadow: none !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
    }

    body.is-guest .app-container.centered-landing {
        min-height: 100dvh !important;
        padding: 0 20px !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        min-height: 100dvh !important;
        margin: 0 !important;
        padding: 116px 0 132px !important;
        justify-content: center !important;
    }

    body.is-guest .greeting-container h2 {
        color: #111111 !important;
        font-size: clamp(2rem, 9.2vw, 2.55rem) !important;
        line-height: 1.12 !important;
        letter-spacing: 0 !important;
        text-align: left !important;
    }

    body.is-guest .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: none !important;
        z-index: 95 !important;
    }

    body.is-guest .composer-input {
        min-height: 58px !important;
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        color: #111111 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06) !important;
    }

    body.is-guest .composer-input::after {
        border-radius: 30px !important;
        background: #f7f7f7 !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }

    body.is-guest .composer-input textarea,
    body.is-guest .mode-select-trigger {
        color: #111111 !important;
    }

    body.is-guest .composer-input textarea::placeholder {
        color: #7a7d80 !important;
        opacity: 1 !important;
    }

    body.is-guest .mode-select-trigger {
        min-width: 60px !important;
        height: 36px !important;
        padding: 0 8px 0 10px !important;
        background: transparent !important;
        border-color: transparent !important;
        font-size: 0.92rem !important;
    }

    body.is-guest .mode-select-trigger:hover,
    body.is-guest .mode-select-trigger:focus-visible {
        background: #ededed !important;
        border-color: transparent !important;
        box-shadow: none !important;
    }

    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover {
        width: 42px !important;
        min-width: 42px !important;
        height: 42px !important;
        min-height: 42px !important;
        flex-basis: 42px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 22px !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        padding-top: 70px !important;
        padding-bottom: 128px !important;
    }

    body:not(.is-guest) .message-bubble.assistant,
    body:not(.is-guest) .answer-content {
        font-size: 0.98rem !important;
        line-height: 1.7 !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        left: 12px !important;
        right: 12px !important;
        bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }
}

/* Truly final mobile stability override. Keep this block at EOF. */
@media (max-width: 760px) {
    :root {
        --mobile-header-height: 56px;
        --mobile-shell-height: var(--app-height, 100svh);
        --mobile-composer-height: var(--composer-height, 58px);
        --mobile-composer-bottom: max(12px, env(safe-area-inset-bottom));
        --mobile-ease: cubic-bezier(0.22, 1, 0.36, 1);
    }

    html,
    body,
    .page-wrapper,
    .main-content,
    .app-container {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
        background: #ffffff !important;
    }

    .main-content,
    body.mobile-sidebar-open .main-content {
        margin-left: 0 !important;
        transform: none !important;
        transition: none !important;
    }

    .mobile-header,
    body.is-guest .mobile-header,
    body:not(.is-guest) .mobile-header {
        position: fixed !important;
        top: var(--vv-offset-top, 0) !important;
        left: 0 !important;
        right: 0 !important;
        height: var(--mobile-header-height) !important;
        padding: 8px 16px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        border: 0 !important;
        box-shadow: none !important;
        z-index: 120 !important;
    }

    body.is-guest .greeting-container {
        width: min(100%, 430px) !important;
        margin: 0 auto !important;
        text-align: center !important;
    }

    body.is-guest .greeting-container .logo-text,
    body.is-guest .greeting-container h2 br {
        display: none !important;
    }

    body.is-guest .greeting-container h2 {
        font-size: clamp(1.95rem, 8vw, 2.32rem) !important;
        line-height: 1.12 !important;
        font-weight: 520 !important;
        letter-spacing: 0 !important;
        text-align: center !important;
        text-wrap: balance;
    }

    .app-container.centered-landing .chat-area,
    body.is-guest .app-container.centered-landing .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 18px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 72px) !important;
        margin: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        overflow: hidden !important;
    }

    .app-container:not(.centered-landing) .chat-area,
    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 20px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 34px) !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }

    .input-wrapper,
    body.is-guest .input-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        bottom: var(--mobile-composer-bottom) !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: translateZ(0) !important;
        z-index: 130 !important;
    }

    .composer-input,
    body.is-guest .composer-input,
    body:not(.is-guest) .composer-input {
        min-height: 58px !important;
        border-radius: 31px !important;
        background: #f7f7f7 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
        overflow: visible !important;
    }

    .input-top-row,
    body.is-guest .input-top-row,
    body:not(.is-guest) .input-top-row {
        min-height: 58px !important;
        height: auto !important;
        padding: 7px 7px 7px 12px !important;
        gap: 8px !important;
        display: flex !important;
        align-items: center !important;
    }

    .composer-input textarea,
    body.is-guest .composer-input textarea,
    body:not(.is-guest) .composer-input textarea {
        height: 24px !important;
        min-height: 24px !important;
        line-height: 24px !important;
        padding: 0 !important;
        margin: 0 !important;
        align-self: center !important;
        font-size: 1rem !important;
    }

    .toggles-container,
    .submit-group {
        display: flex !important;
        align-items: center !important;
        align-self: center !important;
    }

    .img-upload-btn,
    .toggle-switch,
    .icon-btn {
        width: 38px !important;
        min-width: 38px !important;
        height: 38px !important;
        min-height: 38px !important;
        align-self: center !important;
    }

    .mode-select-trigger,
    body.is-guest .mode-select-trigger,
    body:not(.is-guest) .mode-select-trigger {
        height: 38px !important;
        min-height: 38px !important;
        border-radius: 19px !important;
        background: transparent !important;
        border-color: transparent !important;
    }

    .submit-btn,
    .submit-btn:hover,
    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover,
    body:not(.is-guest) .submit-btn,
    body:not(.is-guest) .submit-btn:hover {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
        border-radius: 50% !important;
        background: #111111 !important;
        color: #ffffff !important;
        box-shadow: none !important;
        align-self: center !important;
    }

    body:not(.is-guest) .sidebar {
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        transform: translate3d(0, 0, 0) !important;
        transition: transform 260ms var(--mobile-ease), box-shadow 260ms var(--mobile-ease) !important;
        z-index: 140 !important;
        will-change: transform;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        transform: translate3d(-104%, 0, 0) !important;
        box-shadow: none !important;
    }

    #searchHistoryModal .large-modal {
        position: relative !important;
    }

    #searchHistoryModal .search-modal-top-bar {
        padding-right: 66px !important;
    }

    #closeSearchModalBtn {
        z-index: 40 !important;
        pointer-events: auto !important;
        background: #ffffff !important;
        box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08) !important;
    }

    body:not(.is-guest) .page-wrapper::after {
        z-index: 110 !important;
        pointer-events: auto !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed::after {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.is-guest.mobile-sidebar-open .mobile-header,
    body.is-guest.mobile-sidebar-open .input-wrapper,
    body.is-guest.mobile-sidebar-open .main-content {
        pointer-events: auto !important;
    }

    body.is-guest.mobile-sidebar-open .page-wrapper::after {
        content: none !important;
        display: none !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* History delete motion */
#historyList .history-item.is-pending-delete,
.history-search-list .history-item.is-pending-delete {
    opacity: 0.48 !important;
    pointer-events: none !important;
}

#historyList .history-item.is-deleting,
.history-search-list .history-item.is-deleting {
    pointer-events: none !important;
    overflow: hidden !important;
    animation: historyItemDelete 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

@keyframes historyItemDelete {
    from {
        opacity: 0.48;
        transform: translateX(0) scale(1);
        max-height: 72px;
        margin-top: 0;
    }
    to {
        opacity: 0;
        transform: translateX(-8px) scale(0.98);
        max-height: 0;
        margin-top: 0;
        margin-bottom: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    #historyList .history-item.is-deleting,
    .history-search-list .history-item.is-deleting {
        animation-duration: 1ms !important;
    }
}

/* Mobile response-mode sheet -------------------------------------------------
   The desktop picker remains a compact anchored menu. On touch layouts the
   native dialog enters the browser's top layer, so it cannot be clipped by the
   fixed composer, keyboard, safe-area, or an ancestor transform. */
.mobile-mode-sheet {
    display: none;
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* The old, down-facing desktop menu must never become a fallback on touch
       screens. The dialog below is the single mobile interaction model. */
    .mode-dropdown {
        display: none !important;
    }

    .mobile-mode-sheet {
        box-sizing: border-box;
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #171717;
        overflow: visible;
    }

    .mobile-mode-sheet[open] {
        display: block;
    }

    .mobile-mode-sheet::backdrop {
        background: rgba(17, 17, 17, 0.28);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        animation: mobileModeBackdropIn 180ms ease-out both;
    }

    .mobile-mode-sheet__surface {
        box-sizing: border-box;
        width: 100%;
        max-height: min(68dvh, 420px);
        overflow: auto;
        overscroll-behavior: contain;
        padding: 10px 18px max(18px, calc(14px + env(safe-area-inset-bottom)));
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: 0;
        border-radius: 28px 28px 0 0;
        background: rgba(255, 255, 255, 0.98);
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.16);
        animation: mobileModeSheetIn 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-mode-sheet__handle {
        width: 36px;
        height: 4px;
        margin: 0 auto 12px;
        border-radius: 999px;
        background: #d1d1d1;
    }

    .mobile-mode-sheet__header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        min-height: 42px;
        padding: 0 2px;
    }

    .mobile-mode-sheet__header h2 {
        margin: 0;
        color: #171717;
        font-size: 1.08rem;
        font-weight: 650;
        letter-spacing: -0.01em;
        line-height: 1.2;
    }

    .mobile-mode-sheet__close {
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: -4px -4px -4px 12px;
        border: 0;
        border-radius: 50%;
        background: #f2f2f2;
        color: #4c4c4c;
        font-size: 1rem;
        cursor: pointer;
    }

    .mobile-mode-sheet__close:active {
        background: #e8e8e8;
        transform: scale(0.96);
    }

    .mobile-mode-sheet__intro {
        margin: 5px 2px 16px;
        color: #6f6f6f;
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .mobile-mode-sheet__options {
        display: grid;
        gap: 8px;
    }

    .mobile-mode-sheet__option {
        width: 100%;
        min-height: 68px;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 28px;
        align-items: center;
        gap: 10px;
        padding: 10px 14px 10px 10px;
        border: 1px solid transparent;
        border-radius: 18px;
        background: #f7f7f7;
        color: #232323;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
    }

    .mobile-mode-sheet__option.is-selected {
        border-color: rgba(0, 0, 0, 0.18);
        background: #ffffff;
    }

    .mobile-mode-sheet__option:active {
        transform: scale(0.985);
        background: #eeeeee;
    }

    .mobile-mode-sheet__option:focus-visible,
    .mobile-mode-sheet__close:focus-visible {
        outline: 3px solid rgba(0, 0, 0, 0.16);
        outline-offset: 2px;
    }

    .mobile-mode-sheet__icon {
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 14px;
        background: #ececec;
        color: #242424;
        font-size: 1rem;
    }

    .mobile-mode-sheet__option.is-selected .mobile-mode-sheet__icon {
        background: #151515;
        color: #ffffff;
    }

    .mobile-mode-sheet__copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .mobile-mode-sheet__title {
        color: #1b1b1b;
        font-size: 0.98rem;
        font-weight: 650;
        line-height: 1.15;
    }

    .mobile-mode-sheet__subtitle {
        color: #707070;
        font-size: 0.82rem;
        font-weight: 450;
        line-height: 1.25;
    }

    .mobile-mode-sheet__check {
        width: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: transparent;
        font-size: 0.92rem;
    }

    .mobile-mode-sheet__option.is-selected .mobile-mode-sheet__check {
        color: #151515;
    }

    body.mobile-mode-sheet-open .chat-area {
        overscroll-behavior: none;
    }

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

    @keyframes mobileModeBackdropIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-mode-sheet::backdrop,
    .mobile-mode-sheet__surface,
    .mobile-mode-sheet__option {
        animation: none !important;
        transition: none !important;
    }
}

/* Keep both choices immediately reachable in short landscape viewports. */
@media (max-width: 760px) and (max-height: 500px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .mobile-mode-sheet__surface {
        max-height: min(78dvh, 300px);
        padding-top: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .mobile-mode-sheet__handle {
        margin-bottom: 6px;
    }

    .mobile-mode-sheet__header {
        min-height: 36px;
    }

    .mobile-mode-sheet__intro {
        display: none;
    }

    .mobile-mode-sheet__options {
        gap: 6px;
    }

    .mobile-mode-sheet__option {
        min-height: 56px;
    }

    .mobile-mode-sheet__icon {
        width: 38px;
        height: 38px;
        border-radius: 12px;
    }
}

/* Mobile interaction completion --------------------------------------------
   These rules intentionally sit after legacy dropdown/drawer styles. They
   establish one top-layer action-sheet pattern and one motion system for the
   phone interface. */
.mobile-upload-sheet {
    display: none;
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    /* Desktop popovers can never escape the fixed composer reliably on a
       phone. The native dialog below is the only mobile upload affordance. */
    .upload-dropdown,
    .recent-files-dropdown,
    .skills-dropdown {
        display: none !important;
    }

    .mobile-upload-sheet {
        box-sizing: border-box;
        position: fixed;
        inset: auto 0 0;
        width: 100%;
        max-width: none;
        max-height: none;
        margin: 0;
        padding: 0;
        border: 0;
        background: transparent;
        color: #171717;
        overflow: visible;
    }

    .mobile-upload-sheet[open] {
        display: block;
    }

    .mobile-upload-sheet::backdrop {
        background: rgba(17, 17, 17, 0.30);
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
        animation: mobileActionBackdropIn 180ms ease-out both;
    }

    .mobile-upload-sheet__surface {
        box-sizing: border-box;
        width: 100%;
        max-height: min(76dvh, 540px);
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding: 10px 18px max(18px, calc(14px + env(safe-area-inset-bottom)));
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-bottom: 0;
        border-radius: 28px 28px 0 0;
        background: rgba(255, 255, 255, 0.985);
        box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.16);
        animation: mobileActionSheetIn 290ms cubic-bezier(0.22, 1, 0.36, 1) both;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-upload-sheet__handle {
        width: 36px;
        height: 4px;
        flex: 0 0 auto;
        margin: 0 auto 12px;
        border-radius: 999px;
        background: #d1d1d1;
    }

    .mobile-upload-sheet__header {
        min-height: 42px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 2px;
    }

    .mobile-upload-sheet__header h2 {
        margin: 0;
        color: #171717;
        font-size: 1.08rem;
        font-weight: 650;
        letter-spacing: -0.01em;
        line-height: 1.2;
    }

    .mobile-upload-sheet__close {
        width: 42px;
        height: 42px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin: -4px -4px -4px 12px;
        padding: 0;
        border: 0;
        border-radius: 50%;
        background: #f2f2f2;
        color: #4c4c4c;
        font-size: 1rem;
        cursor: pointer;
    }

    .mobile-upload-sheet__close:active,
    .mobile-upload-sheet__action:active,
    .mobile-upload-sheet__recent-item:active,
    .mobile-upload-sheet__skill:active {
        transform: scale(0.985);
    }

    .mobile-upload-sheet__intro {
        margin: 5px 2px 16px;
        color: #6f6f6f;
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .mobile-upload-sheet__view {
        flex: 1 1 auto;
        min-height: 0;
        overflow: auto;
        overscroll-behavior: contain;
    }

    .mobile-upload-sheet__view.hidden {
        display: none;
    }

    .mobile-upload-sheet__actions {
        display: grid;
        gap: 8px;
    }

    .mobile-upload-sheet__action,
    .mobile-upload-sheet__recent-item {
        width: 100%;
        min-height: 68px;
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 24px;
        align-items: center;
        gap: 10px;
        padding: 10px 14px 10px 10px;
        border: 1px solid transparent;
        border-radius: 18px;
        background: #f7f7f7;
        color: #232323;
        font-family: inherit;
        text-align: left;
        cursor: pointer;
        transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-upload-sheet__action:focus-visible,
    .mobile-upload-sheet__recent-item:focus-visible,
    .mobile-upload-sheet__skill:focus-visible,
    .mobile-upload-sheet__back:focus-visible,
    .mobile-upload-sheet__close:focus-visible {
        outline: 3px solid rgba(0, 0, 0, 0.16);
        outline-offset: 2px;
    }

    .mobile-upload-sheet__action:active,
    .mobile-upload-sheet__recent-item:active {
        background: #eeeeee;
    }

    .mobile-upload-sheet__icon,
    .mobile-upload-sheet__recent-icon {
        width: 44px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 14px;
        background: #e9e9e9;
        color: #242424;
        font-size: 1rem;
    }

    .mobile-upload-sheet__copy {
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 3px;
    }

    .mobile-upload-sheet__title {
        color: #1b1b1b;
        font-size: 0.98rem;
        font-weight: 650;
        line-height: 1.15;
    }

    .mobile-upload-sheet__subtitle {
        color: #707070;
        font-size: 0.82rem;
        font-weight: 450;
        line-height: 1.25;
    }

    .mobile-upload-sheet__chevron {
        color: #777777;
        font-size: 0.78rem;
        text-align: right;
    }

    .mobile-upload-sheet__agent-only {
        display: none;
    }

    .mobile-upload-sheet.is-agent-mode .mobile-upload-sheet__agent-only {
        display: grid;
    }

    .mobile-upload-sheet__back {
        min-height: 42px;
        display: inline-flex;
        align-items: center;
        gap: 9px;
        margin: 0 0 10px -4px;
        padding: 0 8px;
        border: 0;
        border-radius: 10px;
        background: transparent;
        color: #383838;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-upload-sheet__back:active {
        background: #f2f2f2;
    }

    .mobile-upload-sheet__recent-list {
        display: grid;
        gap: 8px;
        padding-bottom: 2px;
    }

    .mobile-upload-sheet__recent-item {
        grid-template-columns: 44px minmax(0, 1fr);
    }

    .mobile-upload-sheet__recent-name {
        overflow: hidden;
        color: #202020;
        font-size: 0.94rem;
        font-weight: 560;
        line-height: 1.3;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-upload-sheet__state {
        min-height: 82px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #737373;
        font-size: 0.9rem;
        text-align: center;
    }

    .mobile-upload-sheet__skills-grid {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .mobile-upload-sheet__skill {
        min-height: 58px;
        border: 1px solid transparent;
        border-radius: 16px;
        background: #f5f5f5;
        color: #252525;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: 650;
        cursor: pointer;
        transition: background 160ms ease, transform 160ms ease;
    }

    .mobile-upload-sheet__skill:active {
        background: #eaeaea;
    }

    body.mobile-upload-sheet-open .chat-area {
        overscroll-behavior: none;
    }

    /* A drawer should move as a single surface, then reveal its layers in a
       short cascade. This makes opening and closing feel intentional rather
       than like a visibility toggle. */
    body:not(.is-guest) .sidebar {
        transition: transform 340ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 340ms cubic-bezier(0.22, 1, 0.36, 1) !important;
        backface-visibility: hidden;
    }

    body:not(.is-guest) .page-wrapper::after {
        background: rgba(17, 17, 17, 0.26) !important;
        transition: opacity 280ms ease !important;
    }

    body.mobile-sidebar-open .sidebar-top,
    body.mobile-sidebar-open .sidebar-nav-menu,
    body.mobile-sidebar-open .sidebar-content,
    body.mobile-sidebar-open .sidebar-footer {
        animation: mobileSidebarSectionIn 360ms cubic-bezier(0.22, 1, 0.36, 1) both !important;
    }

    body.mobile-sidebar-open .sidebar-nav-menu {
        animation-delay: 34ms !important;
    }

    body.mobile-sidebar-open .sidebar-content {
        animation-delay: 68ms !important;
    }

    body.mobile-sidebar-open .sidebar-footer {
        animation-delay: 92ms !important;
    }

    body.mobile-sidebar-open #historyList:not(.collapsed) {
        display: block !important;
        max-height: none !important;
        opacity: 1 !important;
    }

    .mobile-header,
    body.is-guest .mobile-header,
    body:not(.is-guest) .mobile-header {
        transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), opacity 180ms ease !important;
        will-change: transform, opacity;
    }

    body.mobile-header-hidden .mobile-header {
        transform: translate3d(0, calc(-100% - 8px), 0) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.mobile-sidebar-open .mobile-header {
        transform: translate3d(0, calc(-100% - 8px), 0) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .history-chat-loading,
    .history-chat-load-error {
        min-height: 130px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        color: #6e6e6e;
        font-size: 0.9rem;
    }

    .history-chat-loading__dot {
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: #8b8b8b;
        animation: historyLoadingDot 900ms ease-in-out infinite;
    }

    .history-chat-loading__dot:nth-child(2) { animation-delay: 120ms; }
    .history-chat-loading__dot:nth-child(3) { animation-delay: 240ms; }

    .history-chat-loading__label {
        margin-left: 5px;
    }

    .history-chat-load-error {
        padding: 0 20px;
        color: #8b3030;
        text-align: center;
        line-height: 1.5;
    }

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

    @keyframes mobileActionBackdropIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    @keyframes mobileSidebarSectionIn {
        from { opacity: 0; transform: translate3d(-12px, 0, 0); }
        to { opacity: 1; transform: translate3d(0, 0, 0); }
    }

    @keyframes historyLoadingDot {
        0%, 80%, 100% { opacity: 0.38; transform: translateY(0); }
        40% { opacity: 1; transform: translateY(-3px); }
    }
}

@media (max-width: 760px) and (max-height: 500px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    .mobile-upload-sheet__surface {
        max-height: min(82dvh, 330px);
        padding-top: 8px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .mobile-upload-sheet__handle {
        margin-bottom: 6px;
    }

    .mobile-upload-sheet__header {
        min-height: 36px;
    }

    .mobile-upload-sheet__intro {
        display: none;
    }

    .mobile-upload-sheet__action,
    .mobile-upload-sheet__recent-item {
        min-height: 56px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mobile-upload-sheet::backdrop,
    .mobile-upload-sheet__surface,
    .mobile-upload-sheet__action,
    .mobile-upload-sheet__recent-item,
    .mobile-upload-sheet__skill,
    body.mobile-sidebar-open .sidebar-top,
    body.mobile-sidebar-open .sidebar-nav-menu,
    body.mobile-sidebar-open .sidebar-content,
    body.mobile-sidebar-open .sidebar-footer,
    .history-chat-loading__dot {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}

/* ==========================================================================
   Mobile remediation — single authoritative shell (2026-07)
   --------------------------------------------------------------------------
   Keep this block at EOF. Earlier responsive experiments intentionally remain
   in the file for desktop compatibility; these rules are the final contract
   for phone widths and short coarse-pointer landscape viewports.
   ========================================================================== */

/* An invisible history delete button must never remain clickable. */
#historyList .history-del-btn,
.history-search-list .history-del-btn {
    pointer-events: none !important;
}

#historyList .history-item:is(:hover, :focus-within) .history-del-btn,
.history-search-list .history-item:is(:hover, :focus-within) .history-del-btn {
    pointer-events: auto !important;
}

/* Destructive history confirmation uses the browser top layer. */
.history-delete-dialog {
    width: min(420px, calc(100vw - 32px));
    max-width: 420px;
    margin: auto;
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: 22px;
    background: transparent;
    color: #171717;
}

.history-delete-dialog[open] {
    display: block;
}

.history-delete-dialog::backdrop {
    background: rgba(17, 17, 17, 0.34);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: mobileRemediationFadeIn 180ms ease-out both;
}

.history-delete-dialog__surface,
.history-delete-dialog__panel {
    width: 100%;
    padding: 24px;
    border: 1px solid rgba(0, 0, 0, 0.09);
    border-radius: inherit;
    background: #ffffff;
    box-shadow: 0 22px 64px rgba(0, 0, 0, 0.20);
    animation: mobileRemediationDialogIn 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.history-delete-dialog__icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border-radius: 50%;
    background: #fff1f0;
    color: #b42318;
}

.history-delete-dialog h2,
.history-delete-dialog__title {
    margin: 0 0 9px;
    color: #171717;
    font-size: 1.12rem;
    font-weight: 680;
    line-height: 1.3;
}

.history-delete-dialog p,
.history-delete-dialog__copy,
.history-delete-dialog__message {
    margin: 0;
    color: #666666;
    font-size: 0.92rem;
    line-height: 1.55;
}

.history-delete-dialog__actions,
.history-delete-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 22px;
}

.history-delete-dialog__cancel,
.history-delete-dialog__confirm,
.history-delete-cancel,
.history-delete-confirm {
    min-width: 0;
    min-height: 46px;
    padding: 0 16px;
    border-radius: 999px;
    font: 650 0.92rem/1 inherit;
    cursor: pointer;
}

.history-delete-dialog__cancel,
.history-delete-cancel {
    border: 1px solid #d7d7d7;
    background: #ffffff;
    color: #222222;
}

.history-delete-dialog__confirm,
.history-delete-confirm {
    border: 1px solid #a62b23;
    background: #a62b23;
    color: #ffffff;
}

@keyframes mobileRemediationFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes mobileRemediationDialogIn {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    :root {
        --mobile-header-height: calc(56px + env(safe-area-inset-top));
        --mobile-shell-height: var(--app-height, 100dvh);
        --mobile-composer-bottom: max(10px, env(safe-area-inset-bottom));
        --mobile-composer-height: var(--composer-height, 58px);
        --composer-textarea-height: 24px;
        --mobile-inline-start: max(12px, env(safe-area-inset-left));
        --mobile-inline-end: max(12px, env(safe-area-inset-right));
        --mobile-remediation-ease: cubic-bezier(0.22, 1, 0.36, 1);
    }

    html,
    body,
    .page-wrapper,
    .main-content,
    .app-container {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        overflow: hidden !important;
    }

    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
        background: #ffffff !important;
        overscroll-behavior: none;
    }

    .main-content,
    body.mobile-sidebar-open .main-content {
        width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        transform: none !important;
    }

    /* The same phone shell is used in short landscape; avoid the old hybrid
       state where a desktop header sat above mobile bottom sheets. */
    .mobile-header,
    body.is-guest .mobile-header,
    body:not(.is-guest) .mobile-header {
        position: fixed !important;
        top: var(--vv-offset-top, 0) !important;
        right: env(safe-area-inset-right) !important;
        left: env(safe-area-inset-left) !important;
        z-index: 120 !important;
        height: var(--mobile-header-height) !important;
        display: flex !important;
        padding: max(8px, env(safe-area-inset-top)) 16px 8px !important;
        background: rgba(255, 255, 255, 0.96) !important;
        border: 0 !important;
        box-shadow: none !important;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    body.is-guest #sidebarOpenBtn,
    body.is-guest .mobile-header > :last-child {
        display: none !important;
    }

    body.is-guest .mobile-header {
        justify-content: center !important;
        pointer-events: none;
    }

    body.is-guest .mobile-logo-container {
        pointer-events: auto;
    }

    .app-container,
    .app-container.centered-landing,
    body:not(.is-guest) .app-container:not(.centered-landing) {
        width: 100% !important;
        max-width: none !important;
        padding-right: max(16px, env(safe-area-inset-right)) !important;
        padding-left: max(16px, env(safe-area-inset-left)) !important;
    }

    .app-container.centered-landing .chat-area,
    body.is-guest .app-container.centered-landing .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        margin: 0 !important;
        padding: calc(var(--mobile-header-height) + 18px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 56px) !important;
        overflow: hidden !important;
    }

    .app-container:not(.centered-landing) .chat-area,
    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: calc(var(--mobile-header-height) + 18px) 0 calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 28px) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scroll-padding-top: calc(var(--mobile-header-height) + 12px);
        scroll-padding-bottom: calc(var(--mobile-composer-height) + var(--mobile-composer-bottom) + 28px);
        overscroll-behavior-y: contain;
        -webkit-overflow-scrolling: touch;
    }

    .input-wrapper,
    body.is-guest .input-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper,
    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        position: fixed !important;
        right: var(--mobile-inline-end) !important;
        bottom: var(--mobile-composer-bottom) !important;
        left: var(--mobile-inline-start) !important;
        z-index: 130 !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        transform: translate3d(0, 0, 0) !important;
        transition: opacity 150ms ease, visibility 150ms ease, transform 220ms var(--mobile-remediation-ease) !important;
    }

    .composer-input,
    body.is-guest .composer-input,
    body:not(.is-guest) .composer-input {
        min-height: max(58px, calc(var(--composer-textarea-height, 24px) + 20px)) !important;
        height: auto !important;
        max-height: min(72dvh, 300px) !important;
        border-radius: 30px !important;
        overflow: visible !important;
        background: #f7f7f7 !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.08) !important;
    }

    .composer-input.composer-expanded,
    .composer-input:has(.attachments-preview:not(:empty)) {
        border-radius: 24px !important;
    }

    .input-top-row,
    .composer-main-row,
    body.is-guest .input-top-row,
    body:not(.is-guest) .input-top-row {
        width: 100% !important;
        min-height: max(58px, calc(var(--composer-textarea-height, 24px) + 20px)) !important;
        height: auto !important;
        padding: 7px 7px 7px 12px !important;
        gap: 7px !important;
        align-items: flex-end !important;
    }

    .composer-input textarea,
    body.is-guest .composer-input textarea,
    body:not(.is-guest) .composer-input textarea {
        width: 100% !important;
        min-width: 0 !important;
        height: clamp(24px, var(--composer-textarea-height, 24px), 168px) !important;
        min-height: 24px !important;
        max-height: 168px !important;
        margin: 0 !important;
        padding: 0 !important;
        align-self: flex-end !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        font-size: 1rem !important;
        line-height: 24px !important;
        resize: none !important;
        -webkit-overflow-scrolling: touch;
    }

    .toggles-container,
    .connectors-container,
    .submit-group {
        min-width: 0;
        align-self: flex-end !important;
    }

    .img-upload-btn,
    .toggle-switch,
    .icon-btn,
    .connector-trigger,
    .mode-select-trigger,
    .submit-btn {
        min-height: 44px !important;
    }

    .img-upload-btn,
    .toggle-switch,
    .icon-btn,
    .connector-trigger {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        justify-content: center !important;
    }

    .mode-select-trigger,
    body.is-guest .mode-select-trigger,
    body:not(.is-guest) .mode-select-trigger {
        height: 44px !important;
        min-height: 44px !important;
    }

    .submit-btn,
    .submit-btn:hover,
    body.is-guest .submit-btn,
    body.is-guest .submit-btn:hover,
    body:not(.is-guest) .submit-btn,
    body:not(.is-guest) .submit-btn:hover {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        flex-basis: 44px !important;
    }

    .composer-input:has(.attachments-preview:not(:empty)),
    .app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) {
        min-height: 0 !important;
        max-height: min(72dvh, 360px) !important;
    }

    .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview,
    .app-container.centered-landing .composer-input:has(.attachments-preview:not(:empty)) .attachments-preview {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 56px !important;
        max-height: 92px !important;
        padding: 10px 13px 4px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        overscroll-behavior-x: contain;
    }

    /* The actual measured composer height is written to --composer-height by
       script, so image previews and multiline text always reserve enough chat
       space instead of covering the final message. */
    .app-container:has(.attachments-preview:not(:empty)) .chat-area,
    .app-container:has(.composer-input.composer-expanded) .chat-area {
        padding-bottom: calc(var(--composer-height, 118px) + var(--mobile-composer-bottom) + 28px) !important;
        scroll-padding-bottom: calc(var(--composer-height, 118px) + var(--mobile-composer-bottom) + 28px) !important;
    }

    /* Sidebar moves as one composited surface. Hide the composer while the
       backdrop is active so controls never shine through the drawer. */
    body:not(.is-guest) .sidebar {
        top: 0 !important;
        right: auto !important;
        bottom: auto !important;
        left: 0 !important;
        z-index: 140 !important;
        width: min(86vw, 340px) !important;
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding-left: env(safe-area-inset-left);
        overflow: hidden !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        box-shadow: 18px 0 44px rgba(0, 0, 0, 0.14) !important;
        opacity: 1 !important;
        transform: translate3d(0, 0, 0) !important;
        transition: transform 320ms var(--mobile-remediation-ease), box-shadow 260ms ease !important;
        will-change: transform;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .sidebar {
        opacity: 1 !important;
        pointer-events: none !important;
        transform: translate3d(-104%, 0, 0) !important;
        box-shadow: none !important;
    }

    body:not(.is-guest) .sidebar-top {
        min-height: calc(56px + env(safe-area-inset-top)) !important;
        padding: max(8px, env(safe-area-inset-top)) 14px 6px !important;
    }

    body:not(.is-guest) .sidebar-footer {
        padding-bottom: max(14px, env(safe-area-inset-bottom)) !important;
    }

    body.mobile-sidebar-open .sidebar-top,
    body.mobile-sidebar-open .sidebar-nav-menu,
    body.mobile-sidebar-open .sidebar-content,
    body.mobile-sidebar-open .sidebar-footer {
        animation: none !important;
        transform: none !important;
    }

    body.mobile-sidebar-open .input-wrapper {
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        transform: translate3d(-8px, 0, 0) !important;
    }

    body:not(.is-guest) .page-wrapper::after {
        position: fixed !important;
        inset: 0 !important;
        z-index: 135 !important;
        background: rgba(17, 17, 17, 0.30) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transition: opacity 240ms ease !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed::after {
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* History actions on touch must be both visible and safely tappable. */
    #historyList .history-item {
        min-height: 48px !important;
        padding: 2px 2px 2px 12px !important;
        gap: 4px !important;
    }

    #historyList .history-del-btn,
    .history-search-list .history-del-btn {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0 !important;
        opacity: 0.64 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    /* Search is a true phone page, not a desktop split pane floating over the
       fixed composer. Tapping an item opens it; hover-only preview is omitted. */
    #searchHistoryModal {
        z-index: 6200 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        background: #ffffff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    #searchHistoryModal .large-modal,
    #searchHistoryModal .modal-content {
        width: 100% !important;
        max-width: none !important;
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        border: 0 !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        box-shadow: none !important;
        transform: none !important;
    }

    #searchHistoryModal .search-modal-top-bar {
        min-height: var(--mobile-header-height) !important;
        padding: max(8px, env(safe-area-inset-top)) max(66px, calc(54px + env(safe-area-inset-right))) 8px max(16px, env(safe-area-inset-left)) !important;
        background: #ffffff !important;
    }

    #searchHistoryModal .search-modal-top-bar .search-icon {
        left: max(30px, calc(16px + env(safe-area-inset-left))) !important;
    }

    #historySearchInput {
        height: 44px !important;
        padding-left: 42px !important;
        font-size: 16px !important;
    }

    #closeSearchModalBtn {
        top: max(8px, env(safe-area-inset-top)) !important;
        right: max(10px, env(safe-area-inset-right)) !important;
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        border-radius: 50% !important;
    }

    #searchHistoryModal .search-modal-layout,
    #searchHistoryModal .search-sidebar {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        border: 0 !important;
        background: #ffffff !important;
    }

    #searchHistoryModal .search-preview-pane {
        display: none !important;
    }

    #searchHistoryModal .history-search-list {
        padding: 10px max(10px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #searchHistoryModal .history-search-list .history-item {
        min-height: 58px !important;
        padding: 7px 4px 7px 14px !important;
    }

    #searchHistoryModal .history-item-actions {
        display: flex !important;
        align-items: center !important;
        flex: 0 0 auto !important;
    }

    #searchHistoryModal .history-item-actions .modal-action-btn {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        opacity: 0.68 !important;
        transform: none !important;
        pointer-events: auto !important;
    }

    body:has(#searchHistoryModal.show) .input-wrapper {
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Toasts occupy the safe area below the header, never the composer. */
    .mof-toast-stack {
        top: calc(var(--mobile-header-height) + 8px) !important;
        right: max(12px, env(safe-area-inset-right)) !important;
        bottom: auto !important;
        left: max(12px, env(safe-area-inset-left)) !important;
        width: auto !important;
        align-items: stretch !important;
    }

    .mof-toast {
        width: 100% !important;
        max-width: 520px !important;
        min-height: 48px !important;
        margin: 0 auto !important;
        padding: 10px 14px !important;
        text-align: center;
    }

    /* Message actions stay discoverable on touch without adding an empty
       hover-only gutter. Each visible control still meets the 44px target. */
    .msg-action-bar,
    .msg-action-bar.assistant-msg-action-bar,
    .user-msg-action-bar,
    .assistant-msg-action-bar {
        min-height: 44px !important;
        gap: 0 !important;
        margin-top: 2px !important;
        margin-bottom: 0 !important;
        opacity: 0.68 !important;
    }

    .msg-action-btn,
    .assistant-msg-action-bar .msg-action-btn,
    .user-msg-action-bar .msg-action-btn {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
        border-radius: 12px !important;
    }

    /* Account becomes a compact native-feeling settings page: a safe-area
       toolbar, sticky horizontal tabs, then one scrollable content column. */
    .account-page-overlay,
    .account-page-overlay.show {
        width: 100% !important;
        height: var(--mobile-shell-height) !important;
        min-height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        padding: 0 !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        overscroll-behavior-y: contain;
        background: #f7f7f5 !important;
        -webkit-overflow-scrolling: touch;
    }

    .account-brand {
        position: fixed !important;
        top: max(10px, env(safe-area-inset-top)) !important;
        left: 50% !important;
        z-index: 5020 !important;
        width: 98px !important;
        height: 42px !important;
        transform: translateX(-50%) !important;
        pointer-events: none;
    }

    .account-brand img {
        width: auto !important;
        max-width: 98px !important;
        height: 38px !important;
    }

    .account-top-actions {
        position: fixed !important;
        top: max(8px, env(safe-area-inset-top)) !important;
        right: max(10px, env(safe-area-inset-right)) !important;
        z-index: 5025 !important;
        gap: 6px !important;
    }

    .account-top-avatar {
        display: none !important;
    }

    .account-lang-switch {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        justify-content: center !important;
        border-radius: 50% !important;
    }

    .account-lang-switch span {
        display: none !important;
    }

    .account-left-panel {
        position: sticky !important;
        top: 0 !important;
        z-index: 5010 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: auto !important;
        padding: calc(58px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)) !important;
        background: rgba(247, 247, 245, 0.97) !important;
        border-bottom: 1px solid #dfdfdc;
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
    }

    .account-welcome {
        display: none !important;
    }

    .account-nav-list {
        width: 100% !important;
        height: 46px !important;
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 4px !important;
        margin: 0 !important;
        padding: 3px !important;
        overflow: visible !important;
        border-radius: 14px;
        background: #ececea;
    }

    .account-nav-item {
        width: auto !important;
        min-width: 0 !important;
        height: 40px !important;
        min-height: 40px !important;
        padding: 0 8px !important;
        justify-content: center !important;
        gap: 7px !important;
        border-radius: 11px !important;
        color: #666666 !important;
        font-size: 0.88rem !important;
        font-weight: 620 !important;
        white-space: nowrap;
    }

    .account-nav-item.active {
        background: #ffffff !important;
        color: #151515 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }

    .account-nav-item i {
        width: 16px !important;
        font-size: 0.9rem !important;
    }

    .account-nav-bullet {
        display: none !important;
    }

    .account-bottom-actions {
        position: fixed !important;
        top: max(8px, env(safe-area-inset-top)) !important;
        bottom: auto !important;
        left: max(10px, env(safe-area-inset-left)) !important;
        z-index: 5025 !important;
    }

    .account-back-main {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        padding: 0 !important;
        border: 0 !important;
        border-radius: 50% !important;
        background: #ececea !important;
    }

    .account-back-main span {
        position: absolute !important;
        width: 1px !important;
        height: 1px !important;
        padding: 0 !important;
        overflow: hidden !important;
        clip: rect(0, 0, 0, 0) !important;
        white-space: nowrap !important;
        border: 0 !important;
    }

    .account-main-panel {
        position: relative !important;
        inset: auto !important;
        width: 100% !important;
        max-width: 760px !important;
        min-width: 0 !important;
        margin: 0 auto !important;
        padding: 20px max(16px, env(safe-area-inset-right)) max(42px, calc(24px + env(safe-area-inset-bottom))) max(16px, env(safe-area-inset-left)) !important;
    }

    .account-profile-section,
    .account-data-section,
    .account-security-section {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0 !important;
    }

    .account-section-header h1,
    .account-subview-title {
        font-size: clamp(1.45rem, 7vw, 1.85rem) !important;
    }

    .account-profile-header-row {
        gap: 14px !important;
    }

    .account-profile-avatar-large {
        width: 54px !important;
        min-width: 54px !important;
        height: 54px !important;
        font-size: 1.15rem !important;
    }

    .account-profile-info-card {
        margin-top: 24px !important;
    }

    .account-profile-info-row {
        min-height: 76px !important;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto !important;
        gap: 12px !important;
        padding: 16px !important;
    }

    .account-profile-info-row > :first-child,
    .account-login-method-info,
    .account-login-method-info > :last-child {
        min-width: 0 !important;
    }

    .account-profile-value,
    .account-login-method-sub {
        max-width: 100% !important;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .account-row-btn,
    .account-login-method-btn {
        min-width: 88px !important;
        min-height: 44px !important;
        height: 44px !important;
        max-width: 44vw;
        padding: 0 13px !important;
    }

    .account-login-methods-title {
        margin-top: 34px !important;
        font-size: 1.35rem !important;
    }

    .account-login-methods-subtitle {
        margin-bottom: 18px !important;
    }

    .account-login-method-row {
        min-height: 78px !important;
        gap: 10px !important;
        padding: 14px !important;
    }

    .account-login-method-info {
        gap: 10px !important;
    }

    .account-login-method-icon {
        width: 40px !important;
        min-width: 40px !important;
        height: 40px !important;
    }

    .account-data-list {
        margin-top: 24px !important;
    }

    .account-data-row {
        min-height: 0 !important;
        padding: 22px 0 !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }

    .account-data-row .account-row-btn {
        width: 100% !important;
        max-width: none !important;
        align-self: stretch !important;
    }

    .account-breadcrumb {
        margin-bottom: 18px !important;
    }

    .account-password-divider {
        margin: 20px 0 !important;
    }

    .account-password-input-wrap,
    .account-password-input-wrap input,
    .account-edit-dialog input[type="text"],
    .account-edit-dialog input[type="email"],
    .account-delete-input,
    #editEmailOTPInput {
        min-height: 48px !important;
        font-size: 16px !important;
    }

    .account-password-icon-btn,
    .cookie-prefs-close,
    .cookie-expand-btn {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .account-dialog-backdrop {
        z-index: 7100 !important;
        align-items: flex-end !important;
        justify-content: center !important;
        padding: max(8px, env(safe-area-inset-top)) env(safe-area-inset-right) 0 env(safe-area-inset-left) !important;
        overflow: hidden !important;
    }

    .account-edit-dialog,
    .account-confirm-dialog,
    .account-delete-dialog,
    .account-download-dialog,
    .cookie-prefs-dialog {
        width: 100% !important;
        max-width: 620px !important;
        max-height: calc(var(--mobile-shell-height) - max(8px, env(safe-area-inset-top))) !important;
        margin: 0 !important;
        padding: 22px max(18px, env(safe-area-inset-right)) max(22px, calc(16px + env(safe-area-inset-bottom))) max(18px, env(safe-area-inset-left)) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        border-radius: 24px 24px 0 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    .account-edit-actions,
    .account-confirm-actions,
    .account-delete-actions,
    .cookie-prefs-actions {
        gap: 10px !important;
    }

    .account-edit-cancel,
    .account-edit-save,
    .account-confirm-cancel,
    .account-confirm-proceed,
    .account-delete-cancel,
    .account-delete-confirm,
    .account-dialog-close,
    .cookie-reject-all-btn,
    .cookie-confirm-btn,
    .cookie-allow-all-btn {
        min-height: 48px !important;
        height: auto !important;
    }

    /* Only working PDF controls are exposed on phone. The document and close
       control remain; non-functional search/zoom/page chrome is removed. */
    .pdf-preview-overlay {
        z-index: 7200 !important;
        padding: 0 !important;
        background: #525659 !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .pdf-preview-container {
        width: 100% !important;
        max-width: none !important;
        height: var(--mobile-shell-height) !important;
        max-height: var(--mobile-shell-height) !important;
        margin: 0 !important;
        border-radius: 0 !important;
    }

    .pdf-preview-header {
        min-height: var(--mobile-header-height) !important;
        padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left)) !important;
    }

    .pdf-preview-filename {
        max-width: calc(100vw - 112px - env(safe-area-inset-left) - env(safe-area-inset-right)) !important;
    }

    .pdf-preview-close {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    .pdf-preview-toolbar {
        display: none !important;
    }

    .pdf-preview-body,
    .pdf-preview-iframe {
        min-height: 0 !important;
    }

    /* All top-layer action sheets respect notches in either orientation. */
    .mobile-mode-sheet__surface,
    .mobile-upload-sheet__surface,
    .mobile-connector-sheet__surface {
        padding-right: max(18px, env(safe-area-inset-right)) !important;
        padding-bottom: max(18px, calc(14px + env(safe-area-inset-bottom))) !important;
        padding-left: max(18px, env(safe-area-inset-left)) !important;
    }

    .history-delete-dialog {
        width: min(420px, calc(100vw - max(24px, env(safe-area-inset-left)) - max(24px, env(safe-area-inset-right)))) !important;
    }

    .history-delete-dialog__surface,
    .history-delete-dialog__panel {
        max-height: calc(var(--mobile-shell-height) - max(24px, env(safe-area-inset-top)) - max(24px, env(safe-area-inset-bottom))) !important;
        padding: 22px !important;
        overflow-y: auto !important;
    }
}

/* The four Agent controls get their own row on narrow phones. This preserves
   a useful full-width editor instead of squeezing it to roughly 70px. */
@media (max-width: 430px) {
    body.agent-mode .composer-main-row,
    body:has(#uploadMenuShell.agent-mode) .composer-main-row {
        display: grid !important;
        grid-template-columns: 44px 44px minmax(0, 1fr) !important;
        grid-template-areas:
            "agent-editor agent-editor agent-editor"
            "agent-upload agent-connector agent-actions" !important;
        align-items: end !important;
        column-gap: 7px !important;
        row-gap: 6px !important;
        min-height: 108px !important;
        padding: 9px !important;
    }

    body.agent-mode .composer-main-row > textarea,
    body:has(#uploadMenuShell.agent-mode) .composer-main-row > textarea {
        grid-area: agent-editor !important;
        width: 100% !important;
        padding: 2px 4px !important;
    }

    body.agent-mode .composer-main-row > .toggles-container,
    body:has(#uploadMenuShell.agent-mode) .composer-main-row > .toggles-container {
        grid-area: agent-upload !important;
        width: 44px !important;
    }

    body.agent-mode .composer-main-row > .connectors-container,
    body:has(#uploadMenuShell.agent-mode) .composer-main-row > .connectors-container {
        grid-area: agent-connector !important;
        width: 44px !important;
        min-width: 44px !important;
        justify-self: start !important;
    }

    body.agent-mode .composer-main-row > .submit-group,
    body:has(#uploadMenuShell.agent-mode) .composer-main-row > .submit-group {
        grid-area: agent-actions !important;
        width: auto !important;
        min-width: 0 !important;
        display: flex !important;
        justify-content: flex-end !important;
        gap: 4px !important;
    }

    body.agent-mode .connector-trigger,
    body:has(#uploadMenuShell.agent-mode) .connector-trigger {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        border-radius: 50% !important;
    }

    body.agent-mode .connector-trigger span,
    body.agent-mode .connector-trigger > i:last-child,
    body:has(#uploadMenuShell.agent-mode) .connector-trigger span,
    body:has(#uploadMenuShell.agent-mode) .connector-trigger > i:last-child {
        display: none !important;
    }

    body.agent-mode .mode-select-trigger,
    body:has(#uploadMenuShell.agent-mode) .mode-select-trigger {
        min-width: 62px !important;
        padding: 0 9px !important;
    }

    body.agent-mode .composer-input,
    body:has(#uploadMenuShell.agent-mode) .composer-input {
        border-radius: 24px !important;
    }

    .account-nav-item {
        gap: 5px !important;
        padding: 0 5px !important;
        font-size: 0.82rem !important;
    }

}

@media (max-width: 360px) {
    .account-brand {
        display: none !important;
    }

    .history-delete-dialog__actions,
    .history-delete-actions {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .history-delete-dialog::backdrop,
    .history-delete-dialog__surface,
    .history-delete-dialog__panel,
    body:not(.is-guest) .sidebar,
    .input-wrapper {
        animation: none !important;
        transition-duration: 1ms !important;
    }
}

/* Specificity locks for older authenticated-composer rules. */
@media (max-width: 760px), (hover: none) and (pointer: coarse) and (max-height: 500px) {
    body:not(.is-guest) .img-upload-btn,
    body:not(.is-guest) .toggle-switch,
    body:not(.is-guest) .icon-btn,
    body:not(.is-guest) .connector-trigger {
        width: 44px !important;
        min-width: 44px !important;
        height: 44px !important;
        min-height: 44px !important;
    }

    body:not(.is-guest) .mode-select-trigger {
        height: 44px !important;
        min-height: 44px !important;
    }

    .history-delete-dialog button:focus-visible {
        outline: 3px solid rgba(0, 0, 0, 0.18) !important;
        outline-offset: 2px !important;
    }

    body:not(.is-guest) .guest-header {
        display: none !important;
    }

    body.is-guest .guest-header {
        position: fixed !important;
        top: max(8px, env(safe-area-inset-top)) !important;
        right: max(12px, env(safe-area-inset-right)) !important;
        left: auto !important;
        z-index: 125 !important;
        width: auto !important;
        height: 44px !important;
        padding: 0 !important;
    }

    body.is-guest .guest-logo-link,
    body.is-guest .guest-nav-gear,
    body.is-guest .guest-nav-register {
        display: none !important;
    }

    body.is-guest .guest-nav-login {
        min-height: 44px !important;
        padding: 0 18px !important;
        border: 0 !important;
        border-radius: 999px !important;
        background: #111111 !important;
        color: #ffffff !important;
        font-size: 0.92rem !important;
        font-weight: 620 !important;
    }
}

/* Once ordinary text wraps, give it a full row too. Agent mode has its own
   three-column lower toolbar above and is deliberately excluded here. */
@media (max-width: 430px) {
    body:not(.agent-mode):not(:has(#uploadMenuShell.agent-mode)) .composer-input.composer-expanded .composer-main-row {
        display: grid !important;
        grid-template-columns: 44px minmax(0, 1fr) !important;
        grid-template-areas:
            "expanded-editor expanded-editor"
            "expanded-upload expanded-actions" !important;
        column-gap: 7px !important;
        row-gap: 6px !important;
        min-height: 108px !important;
        padding: 9px !important;
    }

    body:not(.agent-mode):not(:has(#uploadMenuShell.agent-mode)) .composer-input.composer-expanded .composer-main-row > textarea {
        grid-area: expanded-editor !important;
        width: 100% !important;
        padding: 2px 4px !important;
    }

    body:not(.agent-mode):not(:has(#uploadMenuShell.agent-mode)) .composer-input.composer-expanded .composer-main-row > .toggles-container {
        grid-area: expanded-upload !important;
        width: 44px !important;
    }

    body:not(.agent-mode):not(:has(#uploadMenuShell.agent-mode)) .composer-input.composer-expanded .composer-main-row > .submit-group {
        grid-area: expanded-actions !important;
        justify-self: end !important;
    }
}

/* Desktop adaptive layout ---------------------------------------------------
   Scale individual regions with the available viewport instead of applying a
   browser zoom. Reading measure stays comfortable, while the landing composer
   and navigation gain presence on wide displays. Mobile owns its own layout
   above and is deliberately excluded. */
@media (min-width: 761px) {
    :root {
        --desktop-main-gutter: clamp(24px, 3vw, 64px);
        --desktop-reading-width: clamp(720px, 48vw, 940px);
        --desktop-composer-width: clamp(800px, 55vw, 1120px);
        --desktop-sidebar-width: clamp(232px, 15vw, 288px);
    }

    body:not(.is-guest) {
        --sidebar-width: var(--desktop-sidebar-width);
        --sidebar-collapsed-width: clamp(58px, 4vw, 68px);
    }

    body:not(.is-guest) .sidebar-top {
        min-height: clamp(68px, 5vw, 80px) !important;
        padding: clamp(10px, 1.2vw, 18px) clamp(12px, 1.2vw, 18px) 8px !important;
    }

    body:not(.is-guest) .sidebar-nav-menu,
    body:not(.is-guest) .sidebar-content,
    body:not(.is-guest) .sidebar-footer {
        padding-right: clamp(10px, 1vw, 16px) !important;
        padding-left: clamp(10px, 1vw, 16px) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) {
        padding: 0 var(--desktop-main-gutter) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .chat-area {
        width: min(100%, var(--desktop-reading-width)) !important;
        max-width: var(--desktop-reading-width) !important;
        padding-top: clamp(72px, 8vh, 112px) !important;
        padding-bottom: clamp(148px, 18vh, 226px) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .messages,
    body:not(.is-guest) .app-container:not(.centered-landing) .assistant-msg-wrapper,
    body:not(.is-guest) .app-container:not(.centered-landing) .message-bubble.assistant,
    body:not(.is-guest) .app-container:not(.centered-landing) .answer-content {
        max-width: var(--desktop-reading-width) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .answer-content,
    body:not(.is-guest) .app-container:not(.centered-landing) .message-bubble.assistant {
        font-size: clamp(1rem, 0.9vw, 1.08rem) !important;
        line-height: 1.76 !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .user-message-shell {
        max-width: min(78%, 820px) !important;
    }

    /* The fixed composer spans the main pane, then centres its contents. This
       keeps it aligned with the conversation at every desktop width. */
    body:not(.is-guest) .app-container:not(.centered-landing) .input-wrapper {
        left: var(--sidebar-width) !important;
        right: 0 !important;
        width: auto !important;
        max-width: none !important;
        padding: 0 var(--desktop-main-gutter) !important;
        bottom: clamp(16px, 2.2vh, 28px) !important;
        transform: none !important;
    }

    body:not(.is-guest) .page-wrapper.sidebar-collapsed .app-container:not(.centered-landing) .input-wrapper {
        left: var(--sidebar-collapsed-width) !important;
    }

    body:not(.is-guest) .app-container:not(.centered-landing) .composer-input,
    body:not(.is-guest) .app-container:not(.centered-landing) .guest-limit-banner {
        max-width: var(--desktop-composer-width) !important;
    }

    body.is-guest .guest-header {
        height: clamp(64px, 5vw, 82px) !important;
        padding: 0 clamp(16px, 2.2vw, 48px) !important;
    }

    body.is-guest .guest-logo-img {
        height: clamp(60px, 4vw, 76px) !important;
    }

    body.is-guest .guest-nav {
        gap: clamp(8px, 0.7vw, 14px) !important;
    }

    body.is-guest .guest-nav-gear,
    body.is-guest .guest-nav-login,
    body.is-guest .guest-nav-register {
        height: clamp(40px, 2.4vw, 48px) !important;
        font-size: clamp(0.875rem, 0.72vw, 1rem) !important;
    }

    body.is-guest .guest-nav-login,
    body.is-guest .guest-nav-register {
        padding-right: clamp(16px, 1.25vw, 24px) !important;
        padding-left: clamp(16px, 1.25vw, 24px) !important;
    }

    body.is-guest .app-container.centered-landing {
        width: 100% !important;
        max-width: min(100%, 1320px) !important;
        padding-top: clamp(54px, 6vh, 96px) !important;
        padding-bottom: clamp(120px, 15vh, 240px) !important;
        padding-right: var(--desktop-main-gutter) !important;
        padding-left: var(--desktop-main-gutter) !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        margin-bottom: clamp(1.5rem, 3vh, 3.25rem) !important;
    }

    body.is-guest .greeting-container h2 {
        font-size: clamp(2.15rem, 2.1vw, 3.25rem) !important;
        line-height: 1.1 !important;
    }

    body.is-guest .greeting-container .logo-text {
        font-size: clamp(1.54rem, 1.45vw, 2.25rem) !important;
    }

    body.is-guest .app-container.centered-landing .input-wrapper {
        width: 100% !important;
        max-width: var(--desktop-composer-width) !important;
    }

    body.is-guest .app-container.centered-landing .composer-input {
        width: 100% !important;
        max-width: var(--desktop-composer-width) !important;
    }

    body.is-guest .composer-input {
        min-height: clamp(60px, 4vw, 68px) !important;
    }

    body.is-guest .composer-input textarea {
        font-size: clamp(0.98rem, 0.85vw, 1.08rem) !important;
    }

    .guest-auth-modal {
        width: min(calc(100% - 48px), clamp(400px, 24vw, 520px));
        max-width: 520px;
    }
}

@media (min-width: 761px) and (max-height: 760px) {
    body.is-guest .app-container.centered-landing {
        padding-top: 44px !important;
        padding-bottom: 104px !important;
    }

    body.is-guest .app-container.centered-landing .chat-area {
        margin-bottom: 1.25rem !important;
    }
}

/* Account profile polish: business details and quieter, consistent motion. */
.account-edit-desc {
    margin: -6px 0 2px;
    color: #666666;
    font-size: 0.88rem;
    line-height: 1.5;
}

.account-edit-select {
    width: 100%;
    min-height: 48px;
    margin-top: 7px;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    background-color: #f7f7f7;
    background-image: linear-gradient(45deg, transparent 50%, #555 50%), linear-gradient(135deg, #555 50%, transparent 50%);
    background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px;
    background-repeat: no-repeat;
    background-size: 5px 5px, 5px 5px;
    color: #111111;
    padding: 0 42px 0 14px;
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.2;
    outline: none;
    cursor: pointer;
    transition: border-color 180ms ease, box-shadow 220ms ease, background-color 180ms ease;
}

.account-edit-select:hover {
    border-color: #a8a8a8;
    background-color: #ffffff;
}

.account-edit-select:focus {
    border-color: #111111;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.07), 0 10px 28px rgba(0, 0, 0, 0.07);
}

.account-business-dialog {
    gap: 18px;
}

.account-profile-info-card {
    transition: box-shadow 220ms ease, border-color 220ms ease;
}

.account-profile-info-card:hover {
    border-color: #d4d4d4;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.045);
}

.account-profile-info-row {
    transition: background-color 180ms ease;
}

.account-profile-info-row:hover {
    background: rgba(255, 255, 255, 0.72);
}

.account-section-enter {
    animation: account-section-enter 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.account-dialog-backdrop:not([hidden]) {
    animation: account-backdrop-enter 220ms ease-out both;
}

.account-dialog-backdrop:not([hidden]) > * {
    animation: account-dialog-enter 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes account-section-enter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes account-backdrop-enter {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes account-dialog-enter {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
    .account-edit-select {
        min-height: 50px;
        font-size: 16px;
    }

    .account-dialog-backdrop:not([hidden]) > * {
        animation-name: account-sheet-enter;
    }

    @keyframes account-sheet-enter {
        from { opacity: 0; transform: translateY(28px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (prefers-reduced-motion: reduce) {
    .account-section-enter,
    .account-dialog-backdrop:not([hidden]),
    .account-dialog-backdrop:not([hidden]) > * {
        animation: none !important;
    }
}
