/* 2026-04-08 — extracted from ai.ejs inline <style> blocks */

/* ═══════════════════════════════════════════
   MAIN CHAT CORE — from primary <style> block
═══════════════════════════════════════════ */

            /* Core improvements */
            :root {
                --primary-color: var(--primary);
                --primary-hover: var(--accent);
                --background-primary: var(--background);
                --background-secondary: var(--secondary);
                --text-color: var(--foreground);
                --navbar-height: 60px;
                --chat-sidebar-width: clamp(220px, 22vw, 280px);
                --chat-shell-gutter: clamp(16px, 2.2vw, 32px);
                --chat-content-max: clamp(540px, 64vw, 860px);
            }


            /* Improved code highlighting */
            .hljs {
                color: #e9e9f4;
                background: var(--muted);
                border-radius: var(--border-radius);
                border: 1px solid var(--border);
                font-size: 15px;
            }

            /* Improved textarea */
            #message-input {
                margin-right: 50px;
                min-height: 38px;
                max-height: 160px;
                padding: 10px 14px;
                background: linear-gradient(180deg, rgba(9, 16, 32, 0.98), rgba(12, 22, 42, 0.94));
                border: 1px solid rgba(251, 146, 60, 0.2);
                border-radius: 18px;
                color: var(--foreground);
                font-size: 15px;
                outline: none;
                transition: border-color 0.2s ease, box-shadow 0.2s ease;
                resize: none;
                line-height: 1.55;
                overflow-y: hidden;
                box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
            }

            #message-input:focus {
                border-color: rgba(251, 146, 60, 0.55);
                box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1), 0 4px 20px rgba(0, 0, 0, 0.3);
            }

            #message-input::-webkit-scrollbar {
                width: 5px;
            }

            #message-input::-webkit-scrollbar-track {
                background: var(--input);
            }
            
            #message-input::-webkit-scrollbar-thumb {
                background: var(--primary);
                border-radius: 5px;
            }

            #message-input::-webkit-scrollbar-thumb:hover {
                background: var(--accent);
            }

            /* Sidebar box branding — warm ember dark */
            .box.conversations {
                border-right: 1px solid rgba(251, 146, 60, 0.12) !important;
                background: linear-gradient(175deg, rgba(22, 11, 4, 0.99) 0%, rgba(14, 7, 2, 0.99) 100%) !important;
            }

            /* Conversation title accent */
            .conversations .title {
                color: var(--muted-foreground);
                text-transform: uppercase;
                font-size: 11px;
                letter-spacing: 0.08em;
            }

            /* Improved theme toggle */
            .theme-toggle {
                position: relative;
                width: 40px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: transparent;
                border: none;
                border-radius: 50%;
                color: var(--text-color);
                cursor: pointer;
                transition: background-color 0.2s ease;
                margin-left: auto;
            }

            .theme-toggle:hover {
                background-color: var(--secondary);
            }

            /* Improved mobile sidebar */
            .mobile-sidebar {
                position: fixed;
                bottom: 20px;
                right: 20px;
                width: 50px;
                height: 50px;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: var(--primary);
                color: white;
                border-radius: 50%;
                cursor: pointer;
                z-index: 1000;
                box-shadow: var(--shadow-md);
                transition: background-color 0.2s ease, transform 0.2s ease;
            }

            .mobile-sidebar:hover {
                background-color: var(--accent);
            }

            .mobile-sidebar:active {
                transform: scale(0.95);
            }

            /* Improved layout */
            body {
                overflow: hidden;
                height: 100vh;
                padding: 0;
                margin: 0;
                --chat-sidebar-offset: 0px;
                --chat-content-width: min(
                    var(--chat-content-max),
                    calc(100vw - var(--chat-sidebar-offset) - (var(--chat-shell-gutter) * 2) - 24px)
                );
                --welcome-content-width: min(
                    780px,
                    calc(100vw - var(--chat-sidebar-offset) - (var(--chat-shell-gutter) * 2) - 24px)
                );
            }

            .row {
                height: calc(100vh - var(--navbar-height));
                margin-top: var(--navbar-height) !important;
                padding: 0;
                gap: 0;
                overflow-x: hidden;
            }

            /* IMPROVED NAVBAR - SINGLE NAVBAR FOR BOTH MOBILE AND DESKTOP */
            .navbar {
                position: fixed;
                top: 0;
                left: 0;
                width: 100%;
                height: var(--navbar-height);
                padding: 0 20px;
                display: flex;
                justify-content: space-between;
                align-items: center;
                background: rgba(8, 13, 26, 0.95);
                border-bottom: 1px solid rgba(251, 146, 60, 0.15);
                z-index: 1000;
                backdrop-filter: blur(20px);
                -webkit-backdrop-filter: blur(20px);
                box-shadow: 0 1px 20px rgba(0, 0, 0, 0.4);
            }

            /* Left side with action buttons and logo */
            .navbar-left {
                display: flex;
                align-items: center;
                gap: 15px;
            }

            /* Action buttons styling */
            .navbar-actions {
                display: flex;
                align-items: center;
                gap: 8px;
            }

            .navbar-action-btn {
                background: none;
                border: none;
                padding: 8px;
                cursor: pointer;
                color: var(--text-color);
                display: flex;
                align-items: center;
                justify-content: center;
                border-radius: 4px;
                transition: background-color 0.2s ease;
            }

            .navbar-action-btn:hover {
                background-color: var(--secondary);
            }

            .navbar-action-btn svg {
                width: 20px;
                height: 20px;
            }

            .navbar-action-btn.action-press,
            .new_convo.action-press,
            .composer-icon-btn.action-press {
                animation: actionPress 0.46s cubic-bezier(0.22, 1, 0.36, 1);
            }

            .navbar-action-btn.trash-press,
            .trash-icon.trash-press {
                animation: trashPress 0.5s cubic-bezier(0.22, 1, 0.36, 1);
            }

            @keyframes actionPress {
                0% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 146, 60, 0); }
                35% { transform: scale(0.92); box-shadow: 0 0 0 rgba(251, 146, 60, 0); }
                70% { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(251, 146, 60, 0.08); }
                100% { transform: scale(1); box-shadow: 0 0 0 rgba(251, 146, 60, 0); }
            }

            @keyframes trashPress {
                0% { transform: rotate(0deg) scale(1); }
                25% { transform: rotate(-12deg) scale(0.92); }
                55% { transform: rotate(10deg) scale(1.04); }
                100% { transform: rotate(0deg) scale(1); }
            }

            /* Logo styling */
            .logo {
                display: flex;
                align-items: center;
            }

            .logo a {
                text-decoration: none;
                color: var(--text-color);
                transition: color 0.2s ease;
            }

            .logo a:hover {
                color: var(--primary);
            }

            .logo h1 {
                margin: 0;
                font-size: 1.25rem;
                font-weight: 700;
                background: linear-gradient(135deg, #f9fafb 30%, #fb923c 100%);
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
                letter-spacing: -0.02em;
            }

            .logo-img {
                width: 28px;
                height: 28px;
                border-radius: 6px;
                object-fit: cover;
                border: 1px solid rgba(251, 146, 60, 0.3);
                margin-right: 8px;
                flex-shrink: 0;
            }

            /* Right side with hamburger menu */
            .navbar-right {
                display: flex;
                align-items: center;
            }

            .hamburger-menu {
                background: none;
                border: none;
                cursor: pointer;
                padding: 8px;
                display: flex;
                flex-direction: column;
                gap: 3px;
                z-index: 1001;
            }

            .hamburger-menu span {
                display: block;
                width: 25px;
                height: 3px;
                background-color: var(--text-color);
                transition: transform 0.3s ease, opacity 0.3s ease;
            }

            /* Hamburger animation - MOBILE ONLY */
            @media (max-width: 768px) {
                body.mobile-nav-open .hamburger-menu span:nth-child(1) {
                    transform: translateY(6px) rotate(45deg);
                }

                body.mobile-nav-open .hamburger-menu span:nth-child(2) {
                    opacity: 0;
                }

                body.mobile-nav-open .hamburger-menu span:nth-child(3) {
                    transform: translateY(-6px) rotate(-45deg);
                }
            }

            /* Improved conversation sidebar + hide scrollbar globally */
            .conversations-list {
                scrollbar-width: none;
                -ms-overflow-style: none;
            }
            .conversations-list::-webkit-scrollbar { display: none; }

            .box.conversations {
                position: fixed;
                top: var(--navbar-height);
                left: 0;
                width: var(--chat-sidebar-width);
                height: calc(100vh - var(--navbar-height));
                z-index: 999999;
                background-color: var(--background);
                transform: translateX(-100%);
                transition: transform 0.3s ease;
            }

            /* Improved conversation area */
            .conversation {
                flex: 1;
                height: 100%;
                min-height: 0;
                min-width: 0;
                overflow-x: clip;
                border-radius: 0;
                box-shadow: none;
            }

            .conversation #messages {
                padding: 20px;
                flex: 1 1 auto;
                min-height: 0;
                height: auto;
            }

            /* 2026-04-28 — Single-composer dock. Always visible at the bottom; the welcome screen flows above it
               via natural flex order. No display swap, no cross-fade between two composers. */
            .user-input {
                padding: 10px 16px 14px;
                border-top: 1px solid var(--chat-md-border);
                background: linear-gradient(to top, rgba(7, 11, 20, 0.96), rgba(7, 11, 20, 0.86));
                backdrop-filter: blur(24px);
                -webkit-backdrop-filter: blur(24px);
                transition: border-color var(--chat-md-transition);
            }

            .box.input-box {
                position: relative;
                border-radius: 24px;
                background-color: transparent;
                border: none;
                box-shadow: none;
                transition: background var(--chat-md-transition), border-color var(--chat-md-transition), box-shadow var(--chat-md-transition);
            }

            .composer-shell {
                display: flex;
                flex-direction: column;
                gap: 0;
            }

            /* 2026-04-28 — Material Dark composer surface */
            .composer-surface {
                position: relative;
                display: flex;
                flex-direction: column;
                gap: 6px;
                padding: 12px 14px 10px;
                border-radius: 24px;
                border: 1px solid var(--chat-md-border);
                background: var(--chat-md-elevated);
                box-shadow: var(--chat-md-shadow-soft);
                transition: border-color var(--chat-md-transition), box-shadow var(--chat-md-transition);
                max-width: 760px;
                margin: 0 auto;
                width: 100%;
            }

            .composer-surface:focus-within {
                border-color: var(--chat-md-border-strong);
                box-shadow: 0 0 0 3px var(--chat-md-focus), var(--chat-md-shadow-soft);
            }

            .user-input.composer-has-text .composer-surface {
                border-color: rgba(251, 146, 60, 0.22);
            }

            .composer-shell #message-input {
                margin-right: 0;
                min-height: 24px;
                max-height: 160px;
                padding: 2px 0;
                background: transparent;
                border: none;
                border-radius: 0;
                box-shadow: none;
                outline: none;
                resize: none;
                line-height: 1.6;
                font-size: clamp(0.9rem, calc(0.82rem + 0.22vw), 1.05rem);
                color: #f1f5f9;
                letter-spacing: 0.01em;
            }

            .composer-shell #message-input:focus {
                border: none;
                box-shadow: none;
                outline: none;
            }

            .composer-controls {
                display: flex;
                align-items: center;
                gap: 6px;
            }

            .composer-left {
                position: relative;
                display: flex;
                align-items: center;
                flex: 1;
            }

            .composer-icon-btn,
            .composer-controls #send-button {
                width: clamp(26px, 2vw, 32px);
                height: clamp(26px, 2vw, 32px);
                border-radius: 999px;
                border: 1px solid rgba(255,255,255,0.08);
                background: rgba(255,255,255,0.04);
                color: #d6d3d1;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                flex-shrink: 0;
                transition: transform 0.24s ease, background 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
            }

            .composer-icon-btn:hover,
            .composer-controls #send-button:hover {
                transform: translateY(-1px) scale(1.04);
                background: rgba(255,255,255,0.08);
                border-color: rgba(255,255,255,0.14);
            }

            .composer-controls #send-button {
                position: static;
                right: auto;
                bottom: auto;
                flex-shrink: 0;
                background: linear-gradient(135deg, #fb923c, #f97316);
                color: white;
                box-shadow: 0 8px 22px rgba(249, 115, 22, 0.28);
                border-color: rgba(255,255,255,0.16);
            }

            .composer-controls #send-button:hover {
                box-shadow: 0 12px 26px rgba(249, 115, 22, 0.34);
            }

            #think-toggle-btn {
                display: none !important;
            }

            .composer-model-wrap {
                flex: 1;
                min-width: 0;
                display: flex;
                justify-content: center;
            }

            .composer-model-wrap #model {
                max-width: 100%;
                min-width: 0;
                padding: 0 20px 0 8px;
                height: 28px;
                border-radius: 999px;
                border: 1px solid rgba(255,255,255,0.08);
                background: rgba(255,255,255,0.04);
                color: #d6d3d1;
                font-size: 0.78rem;
                box-shadow: none;
                outline: none;
                appearance: none;
                text-overflow: ellipsis;
                white-space: nowrap;
                overflow: hidden;
            }

            .composer-model-wrap::after {
                content: '';
                position: relative;
                right: 22px;
                align-self: center;
                width: 8px;
                height: 8px;
                border-right: 1.5px solid rgba(214, 211, 209, 0.9);
                border-bottom: 1.5px solid rgba(214, 211, 209, 0.9);
                transform: rotate(45deg);
                pointer-events: none;
                margin-left: -12px;
            }

            .voice-button.is-listening {
                background: rgba(251, 146, 60, 0.14);
                border-color: rgba(251, 146, 60, 0.34);
                color: #fb923c;
                box-shadow: 0 0 0 6px rgba(251, 146, 60, 0.08);
            }

            /* 2026-04-07 — Allow the menu to escape the box's overflow:hidden clip */
            .input-box,
            .composer-surface,
            .composer-left {
                overflow: visible !important;
            }

            .composer-actions-menu {
                position: absolute;
                left: 0;
                bottom: calc(100% + 12px);
                display: flex;
                flex-direction: column;
                gap: 6px;
                min-width: 152px;
                padding: 8px;
                border-radius: 16px;
                border: 1px solid rgba(255,255,255,0.08);
                background: rgba(20, 18, 16, 0.98);
                box-shadow: 0 18px 40px rgba(0,0,0,0.34);
                opacity: 0;
                transform: translateY(10px) scale(0.96);
                pointer-events: none;
                transition: opacity 0.22s ease, transform 0.22s ease;
                z-index: 99999;
            }

            .composer-actions-menu.menu-open {
                opacity: 1;
                transform: translateY(0) scale(1);
                pointer-events: auto;
            }

            .composer-actions-menu button {
                width: 100%;
                padding: 10px 12px;
                border: none;
                border-radius: 12px;
                background: transparent;
                color: #e7e5e4;
                text-align: left;
                cursor: pointer;
                transition: background 0.18s ease, color 0.18s ease;
            }

            .composer-actions-menu button:hover {
                background: rgba(255,255,255,0.06);
                color: #fb923c;
            }

            .composer-disclaimer {
                margin: 0;
                text-align: center;
                font-size: 0.68rem;
                color: rgba(214, 211, 209, 0.6);
            }

            /* 2026-04-07 — Compact floating followup pill */
            .composer-followup {
                display: flex;
                align-items: center;
                justify-content: flex-end;
                margin: 0 0 4px;
                padding: 0 2px;
            }

            .composer-followup[hidden] {
                display: none !important;
            }

            /* Hide the label text entirely */
            .composer-followup-label {
                display: none;
            }

            .composer-followup-chip {
                display: inline-flex;
                align-items: center;
                gap: 5px;
                padding: 4px 10px 4px 8px;
                border-radius: 999px;
                border: 1px solid rgba(251, 146, 60, 0.2);
                background: rgba(251, 146, 60, 0.06);
                color: rgba(251, 146, 60, 0.75);
                font-size: 0.68rem;
                font-family: 'Inter', sans-serif;
                font-weight: 500;
                cursor: pointer;
                white-space: nowrap;
                transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
                animation: followupIn 0.3s cubic-bezier(0.34, 1.4, 0.64, 1) both;
            }

            .composer-followup-chip::before {
                content: "↑";
                font-size: 0.7rem;
                opacity: 0.7;
            }

            .composer-followup-chip:hover {
                background: rgba(251, 146, 60, 0.14);
                border-color: rgba(251, 146, 60, 0.4);
                color: #fb923c;
                transform: translateY(-1px);
            }

            @keyframes followupIn {
                from { opacity: 0; transform: translateY(6px) scale(0.95); }
                to   { opacity: 1; transform: translateY(0) scale(1); }
            }

            .buttons {
                display: none !important;
            }

            /* 2026-04-07 — send-button lives inside composer-controls (static position) */
            #send-button {
                position: static !important;
                right: auto !important;
                bottom: auto !important;
                width: clamp(28px, 2vw, 34px);
                height: clamp(28px, 2vw, 34px);
                display: flex;
                align-items: center;
                justify-content: center;
                background: linear-gradient(135deg, #fb923c, #f97316);
                color: white;
                border-radius: 999px;
                cursor: pointer;
                flex-shrink: 0;
                transition: transform 0.2s ease, box-shadow 0.2s ease;
                box-shadow: 0 2px 12px rgba(251, 146, 60, 0.35);
            }

            #send-button:hover {
                transform: scale(1.07);
                box-shadow: 0 4px 20px rgba(251, 146, 60, 0.52);
            }

            #send-button svg {
                width: 16px;
                height: 16px;
            }

            /* Improved stop generating button */
            .stop_generating {
                position: absolute;
                bottom: 100px;
                left: 50%;
                transform: translateX(-50%);
                z-index: 1000;
            }

            .stop_generating button {
                display: flex;
                align-items: center;
                justify-content: center;
                gap: 10px;
                padding: 10px 20px;
                background-color: var(--background);
                border: 1px solid var(--border);
                border-radius: var(--border-radius);
                color: var(--text-color);
                font-weight: 500;
                cursor: pointer;
                box-shadow: var(--shadow-md);
                transition: background-color 0.2s ease;
            }

            .stop_generating button:hover {
                background-color: var(--secondary);
            }

            /* Improved conversation items */
            .conversations-list .conversation-item {
                padding: 12px;
                border-radius: 8px;
                margin-bottom: 8px;
                transition: background-color 0.2s ease;
                cursor: pointer;
            }

            .conversations-list .conversation-item:hover {
                background-color: var(--secondary);
            }

            .conversations .convo.active {
                background: rgba(251, 146, 60, 0.08);
                border-color: rgba(251, 146, 60, 0.18);
                box-shadow: 0 10px 24px rgba(2, 6, 23, 0.2);
            }

            .conversations .convo.active .convo-title {
                color: #f8fafc;
            }

            /* Fix the mobile close button visibility on desktop */
            .mobile-close-button {
                display: none; /* Hidden by default */
                position: absolute;
                top: 10px;
                right: 10px;
                width: 40px;
                height: 40px;
                align-items: center;
                justify-content: center;
                background-color: var(--secondary);
                border-radius: 50%;
                cursor: pointer;
                z-index: 1002;
            }

            /* Responsive styles */
            @media (max-width: 768px) {
                /* Mobile navbar layout: [actions] [logo] [hamburger] */
                .navbar-left {
                    display: flex;
                    align-items: center;
                    gap: 8px;
                    position: absolute;
                    left: 10px;
                    width: auto;
                    z-index: 1001;
                }
                
                .navbar-actions {
                    display: flex !important;
                    visibility: visible !important;
                    opacity: 1 !important;
                    position: static !important;
                    gap: 8px;
                }
                
                .navbar-action-btn {
                    display: flex !important;
                    visibility: visible !important;
                    opacity: 1 !important;
                    background: none;
                    border: none;
                    padding: 8px;
                    cursor: pointer;
                    color: var(--text-color);
                    border-radius: 4px;
                    transition: background-color 0.2s ease;
                }
                
                .navbar-action-btn:hover {
                    background-color: var(--secondary);
                }
                
                .logo {
                    margin-left: 80px; /* Space for the action buttons */
                    position: relative;
                    left: auto;
                    transform: none;
                }
                
                .navbar-right {
                    position: absolute;
                    right: 10px;
                    z-index: 1001;
                }
                
                /* Ensure hamburger menu is visible and clickable */
                .hamburger-menu {
                    display: flex !important;
                    background: none;
                    border: none;
                    cursor: pointer;
                    padding: 8px;
                    flex-direction: column;
                    gap: 3px;
                    z-index: 1002;
                }
                
                .hamburger-menu span {
                    display: block;
                    width: 25px;
                    height: 3px;
                    background-color: var(--text-color);
                    transition: transform 0.3s ease, opacity 0.3s ease;
                }
                
                /* Remove any overlapping elements */
                .mobile-sidebar {
                    display: none !important;
                }

                /* Tap-outside backdrop */
                #sidebar-backdrop {
                    display: none;
                    position: fixed;
                    inset: 0;
                    z-index: 1000;
                    background: rgba(0, 0, 0, 0.45);
                    backdrop-filter: blur(2px);
                    -webkit-backdrop-filter: blur(2px);
                }
                body.mobile-nav-open #sidebar-backdrop {
                    display: block;
                }

                /* Mobile sidebar behavior — warm ember dark to match desktop */
                .box.conversations {
                    display: flex !important;
                    flex-direction: column;
                    position: fixed;
                    top: 0;
                    left: 0;
                    width: var(--chat-sidebar-width);
                    height: 100vh;
                    z-index: 1001;
                    background: linear-gradient(175deg, rgba(22, 11, 4, 0.99) 0%, rgba(14, 7, 2, 0.99) 100%);
                    border-right: 1px solid rgba(251, 146, 60, 0.12);
                    transform: translateX(-100%);
                    transition: transform 0.3s ease;
                    padding-top: 60px;
                }

                body.mobile-nav-open .box.conversations {
                    transform: translateX(0) !important;
                    box-shadow: var(--shadow-lg);
                }
                
                /* Hamburger animation when open */
                body.mobile-nav-open .hamburger-menu span:nth-child(1) {
                    transform: translateY(6px) rotate(45deg);
                }

                body.mobile-nav-open .hamburger-menu span:nth-child(2) {
                    opacity: 0;
                }

                body.mobile-nav-open .hamburger-menu span:nth-child(3) {
                    transform: translateY(-6px) rotate(-45deg);
                }
            }

            @media (min-width: 769px) {
                body {
                    --chat-sidebar-offset: var(--chat-sidebar-width);
                }

                body.desktop-nav-closed {
                    --chat-sidebar-offset: 0px;
                }

                /* Desktop sidebar toggle — open by default, closed when body has desktop-nav-closed */
                body:not(.desktop-nav-closed) .box.conversations {
                    transform: translateX(0);
                }
                body.desktop-nav-closed .box.conversations {
                    transform: translateX(-100%) !important;
                    box-shadow: none !important;
                }
                
                /* Show hamburger on desktop */
                .hamburger-menu {
                    display: flex !important;
                }

                /* Desktop: Show action buttons in navbar */
                .navbar-actions {
                    display: flex;
                    margin-left: auto;
                    margin-right: 20px;
                }

                /* Desktop: Position logo */
                .logo {
                    margin-left: 20px;
                }

                /* Desktop: Show hamburger menu on right */
                .hamburger-menu {
                    display: flex !important;
                    position: absolute;
                    right: 20px;
                }

                /* Desktop: Sidebar open by default — warm ember dark background */
                .box.conversations {
                    display: flex !important;
                    flex-direction: column;
                    position: fixed;
                    top: var(--navbar-height);
                    left: 0;
                    width: var(--chat-sidebar-width);
                    height: calc(100vh - var(--navbar-height));
                    z-index: 999999;
                    background: linear-gradient(175deg, rgba(22, 11, 4, 0.99) 0%, rgba(14, 7, 2, 0.99) 100%);
                    border-right: 1px solid rgba(251, 146, 60, 0.12);
                    transition: transform 0.3s ease;
                }

                /* Desktop: Conversation area offset for open sidebar */
                .conversation {
                    width: calc(100% - var(--chat-sidebar-offset));
                    max-width: 100%;
                    margin-left: var(--chat-sidebar-offset);
                    padding-left: 0;
                    transition: width 0.3s ease, margin-left 0.3s ease;
                }
                body.desktop-nav-closed .conversation {
                    width: 100%;
                    margin-left: 0;
                }

                /* 2026-04-07 — Center messages and chatbox, fluid responsive width */
                .conversation #messages {
                    padding:
                        clamp(16px, 2vw, 32px)
                        max(var(--chat-shell-gutter), calc((100% - var(--chat-content-width)) / 2));
                    height: auto;
                }

                /* Center and oval-shape the chatbox */
                .conversation .user-input {
                    padding:
                        clamp(6px, 0.8vh, 12px)
                        max(var(--chat-shell-gutter), calc((100% - var(--chat-content-width)) / 2))
                        clamp(8px, 1vh, 14px);
                }

                /* Fluid message text scaling */
                .message .content p,
                .message .content li {
                    font-size: clamp(0.9rem, calc(0.78rem + 0.25vw), 1.25rem);
                    line-height: 1.7;
                }

                /* Fluid heading in messages */
                .message .content h1,
                .message .content h2,
                .message .content h3 {
                    font-size: clamp(1rem, calc(0.9rem + 0.3vw), 1.45rem);
                }

                .mobile-sidebar {
                    display: none;
                }

                .buttons {
                    display: none !important;
                }

                .theme-toggle-container {
                    display: flex;
                    align-items: center;
                }
                
                .bottom_buttons {
                    display: flex;
                    flex-direction: column;
                    gap: 12px;
                    padding: 15px;
                    border-top: 1px solid rgba(255, 255, 255, 0.06);
                    background: linear-gradient(180deg, rgba(8, 13, 26, 0), rgba(8, 13, 26, 0.94));
                }

                /* Hide the desktop theme toggle completely */
                #theme-toggle {
                    display: none;
                }
            }

            /* 2026-04-07 — Profile strip + sidebar clear button: global (mobile + desktop) */
            .chat-profile-strip {
                display: flex;
                align-items: center;
                gap: 10px;
                padding: 9px 12px;
                border-radius: 12px;
                border: 1px solid rgba(251, 146, 60, 0.12);
                background: rgba(251, 146, 60, 0.05);
                text-decoration: none;
                color: inherit;
                min-width: 0;
                transition: background 0.18s ease, border-color 0.18s ease;
            }

            .chat-profile-strip:hover {
                background: rgba(251, 146, 60, 0.1);
                border-color: rgba(251, 146, 60, 0.28);
            }

            .chat-profile-avatar-wrap {
                position: relative;
                width: 34px;
                height: 34px;
                flex-shrink: 0;
                border-radius: 50%;
                overflow: hidden;
                background: linear-gradient(135deg, rgba(251, 146, 60, 0.3), rgba(37, 99, 235, 0.25));
                border: 1.5px solid rgba(251, 146, 60, 0.3);
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .chat-profile-avatar-img {
                position: absolute;
                inset: 0;
                width: 100%;
                height: 100%;
                object-fit: cover;
                border-radius: 50%;
            }

            .chat-profile-avatar-initial {
                font-size: 0.85rem;
                font-weight: 700;
                color: #f8fafc;
                text-transform: uppercase;
                line-height: 1;
            }

            .chat-profile-status-dot {
                position: absolute;
                right: 1px;
                bottom: 1px;
                width: 8px;
                height: 8px;
                border-radius: 50%;
                background: #fb923c;
                border: 2px solid rgba(18, 10, 4, 0.95);
                box-shadow: 0 0 6px rgba(251, 146, 60, 0.5);
            }

            .chat-profile-text {
                flex: 1;
                min-width: 0;
                display: flex;
                flex-direction: column;
                gap: 1px;
            }

            .chat-profile-name {
                font-size: 0.82rem;
                font-weight: 600;
                color: #f1f5f9;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                line-height: 1.3;
            }

            .chat-profile-sub {
                font-size: 0.68rem;
                color: rgba(148, 163, 184, 0.7);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                line-height: 1.2;
            }

            .chat-profile-verified {
                color: #fb923c;
                font-style: normal;
            }

            .chat-profile-chevron {
                flex-shrink: 0;
                color: rgba(148, 163, 184, 0.4);
                transition: color 0.18s ease;
                position: static !important;
            }

            .chat-profile-strip:hover .chat-profile-chevron {
                color: rgba(251, 146, 60, 0.7);
            }

            .bottom_buttons .chat-sidebar-clear-btn {
                width: 100%;
                margin: 0;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                padding: 11px 14px;
                border-radius: 999px;
                border: 1px solid rgba(255, 255, 255, 0.12);
                background: rgba(8, 13, 26, 0.52);
                color: #f8fafc;
                font-size: 0.82rem;
                font-weight: 600;
                cursor: pointer;
                transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
            }

            .bottom_buttons .chat-sidebar-clear-btn:hover {
                color: #fb923c;
                background: rgba(251, 146, 60, 0.08);
                border-color: rgba(251, 146, 60, 0.32);
                box-shadow: 0 10px 22px rgba(2, 6, 23, 0.22);
            }

            /* 2026-04-07 — Extra-wide screens: expand content column further */
            @media (min-width: 1800px) {
                :root { --chat-content-max: min(900px, 52vw); }
            }

            /* Update the mobile theme toggle styling */
            #mobile-theme-toggle {
                position: absolute;
                top: 10px;
                right: 10px;
                width: 40px;
                height: 40px;
                display: flex;
                align-items: center;
                justify-content: center;
                background-color: var(--secondary);
                border-radius: 50%;
                margin: 0;
                z-index: 1002;
                border: 1px solid var(--border);
            }

            /* Create a hamburger to X animation */
            .mobile-sidebar span {
                display: block;
                width: 24px;
                height: 3px;
                background-color: white;
                margin: 4px 0;
                transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
                transform-origin: center;
            }

            body.mobile-nav-open .mobile-sidebar span:nth-child(1) {
                transform: translateY(7px) rotate(45deg);
            }

            body.mobile-nav-open .mobile-sidebar span:nth-child(2) {
                opacity: 0;
                transform: scale(0);
            }

            body.mobile-nav-open .mobile-sidebar span:nth-child(3) {
                transform: translateY(-7px) rotate(-45deg);
            }

            /* 2026-04-07 — Mobile sidebar layout: compact top+bottom, chat list fills remaining space */
            @media (max-width: 768px) {
                /* Make the sidebar content use flexbox for proper ordering */
                .box.conversations {
                    display: flex;
                    flex-direction: column;
                }

                /* Adjust the top section with New Conversation button — compact */
                .top {
                    order: 0;
                    padding-top: 8px;
                    padding-bottom: 6px;
                    flex-shrink: 0;
                }

                /* Chat list fills all remaining vertical space */
                .conversations-list {
                    order: 1;
                    flex: 1;
                    min-height: 0;
                    overflow-y: auto;
                    scrollbar-width: none;
                    -ms-overflow-style: none;
                }
                .conversations-list::-webkit-scrollbar { display: none; }

                /* Clear button + profile strip at bottom — compact */
                .bottom_buttons {
                    order: 2;
                    flex-shrink: 0;
                    position: relative;
                    top: 0;
                    padding: 8px 12px max(10px, env(safe-area-inset-bottom));
                    border-bottom: none;
                    border-top: 1px solid rgba(255, 255, 255, 0.06);
                    gap: 8px;
                }

                #welcome-screen {
                    padding: 12px 14px 20px;
                    justify-content: flex-start;
                }
            }

            /* Fix mobile scrolling issues when keyboard appears */
            @media (max-width: 768px) {
                body {
                    overflow-x: hidden;
                    overflow-y: hidden;
                    height: 100vh;
                    height: 100dvh;
                    min-height: 100vh;
                    min-height: 100dvh;
                }
                
                .row {
                    min-height: calc(100vh - var(--navbar-height));
                    min-height: calc(100dvh - var(--navbar-height));
                    height: calc(100vh - var(--navbar-height));
                    height: calc(100dvh - var(--navbar-height));
                }
                
                .conversation #messages {
                    padding-bottom: 24px;
                    overflow-y: auto;
                    -webkit-overflow-scrolling: touch;
                }
                
                .conversation {
                    height: 100%;
                    min-height: 0;
                }
                
                @supports (-webkit-touch-callout: none) {
                    .conversation #messages {
                        padding-bottom: 24px;
                    }
                }
            }

            /* Remove the blue icon overlapping text on mobile */
            @media (max-width: 768px) {
                .mobile-sidebar {
                    display: none !important;
                }
                
                /* Ensure logo text is fully visible */
                .logo {
                    z-index: 10;
                }
                
                /* Fix navbar layout on mobile */
                .navbar-left {
                    width: auto;
                    display: flex;
                    align-items: center;
                }
            }

/* ═══════════════════════════════════════════
   THINK TOGGLE — from tiny inline <style> block
═══════════════════════════════════════════ */

            #think-toggle-btn { display: none !important; }

/* ═══════════════════════════════════════════
   THINKING ANIMATION + STREAM STYLES
   (moved from chat.js dynamic injection — CSP fix)
═══════════════════════════════════════════ */

        .ai-thinking-shell {
          display: flex;
          flex-direction: column;
          gap: 10px;
          min-width: min(100%, 320px);
          margin: 2px 0 6px;
        }
        .ai-thinking-pill {
          display: flex;
          align-items: center;
          gap: 12px;
          padding: 12px 14px;
          border-radius: 18px;
          background:
            linear-gradient(135deg, rgba(15,23,42,0.92), rgba(30,41,59,0.88)),
            linear-gradient(135deg, rgba(56,189,248,0.18), rgba(249,115,22,0.12));
          border: 1px solid rgba(125,211,252,0.18);
          box-shadow: 0 14px 32px rgba(2, 6, 23, 0.28);
          overflow: hidden;
          position: relative;
        }
        .ai-thinking-pill::after {
          content: '';
          position: absolute;
          inset: 0;
          background: linear-gradient(110deg, transparent 10%, rgba(255,255,255,0.08) 45%, transparent 80%);
          transform: translateX(-120%);
          animation: thinkShimmer 7.4s ease-in-out infinite;
          pointer-events: none;
        }
        @keyframes thinkShimmer {
          0% { transform: translateX(-120%); }
          100% { transform: translateX(120%); }
        }
        .ai-thinking-orb {
          width: 28px;
          height: 28px;
          border-radius: 50%;
          flex-shrink: 0;
          border: 3px solid rgba(148, 163, 184, 0.2);
          border-top-color: rgba(251, 146, 60, 0.9);
          animation: thinkSpinner 0.8s linear infinite;
        }
        @keyframes thinkSpinner {
          to { transform: rotate(360deg); }
        }
        .ai-thinking-copy {
          display: flex;
          flex-direction: column;
          gap: 3px;
          min-width: 0;
          flex: 1;
        }
        .ai-thinking-label {
          font-size: 0.7rem;
          text-transform: uppercase;
          letter-spacing: 0.18em;
          color: rgba(148, 163, 184, 0.9);
        }
        .ai-thinking-word {
          font-size: 0.94rem;
          font-weight: 700;
          color: #f8fafc;
          letter-spacing: 0.01em;
          line-height: 1.2;
          text-wrap: balance;
        }
        @keyframes thinkWordIn {
          from { opacity: 0; transform: translateY(8px); }
          to   { opacity: 1; transform: translateY(0); }
        }
        @keyframes thinkWordOut {
          from { opacity: 1; transform: translateY(0); }
          to   { opacity: 0; transform: translateY(-8px); }
        }
        .ai-thinking-elapsed {
          font-size: 0.72rem;
          color: rgba(191, 219, 254, 0.88);
          font-family: ui-monospace, monospace;
          min-width: 38px;
          text-align: right;
        }
        .ai-thinking-preview {
          display: grid;
          gap: 6px;
          padding-left: 46px;
        }
        .ai-thinking-preview-line {
          display: block;
          height: 9px;
          border-radius: 999px;
          background: linear-gradient(90deg, rgba(148,163,184,0.14), rgba(125,211,252,0.34), rgba(148,163,184,0.1));
          background-size: 200% 100%;
          animation: thinkSkeleton 6.8s linear infinite;
        }
        .ai-thinking-preview-line:nth-child(1) { width: 88%; }
        .ai-thinking-preview-line:nth-child(2) { width: 72%; }
        .ai-thinking-preview-line:nth-child(3) { width: 81%; }
        @keyframes thinkSkeleton {
          0% { background-position: 200% 0; opacity: 0.55; }
          50% { opacity: 1; }
          100% { background-position: -200% 0; opacity: 0.55; }
        }
        .content .thought-summary {
          display: block;
          font-size: 0.58rem !important;
          color: rgba(148,163,184,0.62) !important;
          margin-bottom: 8px;
          letter-spacing: 0.12em;
          text-transform: uppercase;
          font-family: ui-sans-serif, system-ui, sans-serif;
          line-height: 1.3;
        }
        .response-empty-note {
          display: inline-block;
          font-size: 0.88rem;
          color: rgba(148,163,184,0.88);
          border: 1px solid rgba(148,163,184,0.18);
          background: rgba(15,23,42,0.55);
          border-radius: 12px;
          padding: 10px 12px;
        }
        .stream-response-body {
          opacity: 0.18;
          transform: translateY(6px);
          filter: blur(5px);
          transition:
            opacity 0.54s cubic-bezier(0.22, 1, 0.36, 1),
            transform 0.54s cubic-bezier(0.22, 1, 0.36, 1),
            filter 0.54s cubic-bezier(0.22, 1, 0.36, 1);
          will-change: opacity, transform, filter;
        }
        .stream-response-body.is-visible {
          opacity: 1;
          transform: translateY(0);
          filter: blur(0);
        }
        .stream-response-body > *:last-child {
          margin-bottom: 0;
        }
        .response-cursor {
          display: inline-block;
          width: 11px;
          height: 11px;
          border-radius: 999px;
          background: rgba(255,255,255,0.95);
          margin-left: 5px;
          vertical-align: -0.1em;
          animation: cursorBlink 1.1s ease-in-out infinite;
          box-shadow: 0 0 8px rgba(255,255,255,0.45);
        }
        @keyframes cursorBlink {
          0%,100% { opacity: 1; transform: scale(1); }
          50% { opacity: 0.34; transform: scale(0.76); }
        }

/* ═══════════════════════════════════════════
   WELCOME SCREEN + ANIMATIONS — from inline <style> block
═══════════════════════════════════════════ */

            /* ═══════════════════════════════════════════
               WELCOME SCREEN
            ═══════════════════════════════════════════ */
            /* 2026-04-28 — Welcome flows naturally in the conversation column above the always-visible composer dock. */
            #welcome-screen {
                position: relative;
                flex: 1 1 auto;
                z-index: 1;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 18px;
                padding:
                    32px
                    max(var(--chat-shell-gutter), calc((100% - var(--welcome-content-width)) / 2))
                    32px;
                background: transparent;
                transition: opacity 220ms cubic-bezier(0.2, 0, 0, 1), transform 220ms cubic-bezier(0.2, 0, 0, 1);
                overflow-y: auto;
                overflow-x: clip;
                max-width: 100%;
                overscroll-behavior-x: none;
                -webkit-overflow-scrolling: touch;
            }
            #welcome-screen.welcome-hiding {
                opacity: 0;
                transform: translateY(-4px);
                pointer-events: none;
            }
            #welcome-screen.welcome-hidden {
                display: none;
            }

            .theme-toggle,
            #mobile-theme-toggle,
            .theme-toggle-container {
                display: none !important;
            }

            .welcome-grid-lines {
                position: absolute;
                inset: 0;
                background-image:
                    linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
                background-size: 64px 64px;
                mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
                opacity: 0.35;
                pointer-events: none;
            }

            .welcome-kicker {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                margin-bottom: 8px;
                padding: 5px 12px;
                border-radius: 999px;
                border: 1px solid rgba(251, 146, 60, 0.22);
                background: rgba(15, 23, 42, 0.72);
                color: #cbd5e1;
                font-size: 0.76rem;
                letter-spacing: 0.12em;
                text-transform: uppercase;
                max-width: min(100%, var(--welcome-content-width));
                text-align: center;
                white-space: normal;
                line-height: 1.35;
                box-shadow: 0 18px 40px rgba(2, 6, 23, 0.25);
                animation: welcomeFadeUp 0.9s ease forwards;
            }

            .welcome-kicker-icon {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                flex: 0 0 24px;
                border-radius: 999px;
                overflow: hidden;
                border: 1px solid rgba(251, 146, 60, 0.34);
                background:
                    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0) 48%),
                    linear-gradient(135deg, rgba(251, 146, 60, 0.22), rgba(37, 99, 235, 0.18));
                box-shadow:
                    0 0 0 2px rgba(251, 146, 60, 0.08),
                    0 10px 22px rgba(2, 6, 23, 0.28);
            }

            .welcome-kicker-icon-img {
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
            }

            .welcome-proof-grid {
                display: grid;
                grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
                gap: 8px;
                width: 100%;
                max-width: min(760px, var(--welcome-content-width));
                margin: 0 auto 10px;
                animation: welcomeFadeUp 0.8s ease 0.2s forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            .welcome-proof-card {
                padding: 8px 12px;
                border-radius: 16px;
                border: 1px solid rgba(251, 146, 60, 0.16);
                background:
                    linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(13, 24, 48, 0.88)),
                    linear-gradient(135deg, rgba(251, 146, 60, 0.08), rgba(37, 99, 235, 0.06));
                box-shadow: 0 12px 30px rgba(2, 6, 23, 0.22);
                color: #e2e8f0;
                line-height: 1.4;
                text-align: left;
            }

            .welcome-proof-card strong {
                display: block;
                font-size: 0.82rem;
                font-weight: 600;
                color: #cbd5e1;
            }

            .welcome-proof-label {
                display: inline-block;
                margin-bottom: 3px;
                color: #fb923c;
                font-size: 0.64rem;
                letter-spacing: 0.12em;
                text-transform: uppercase;
            }

            #welcome-screen.welcome-hiding {
                opacity: 0;
                transform: translateY(-24px);
                pointer-events: none;
            }

            #welcome-screen.welcome-hidden {
                display: none;
            }

            /* Ambient background glow */
            .welcome-bg-glow {
                position: absolute;
                top: 35%;
                left: 50%;
                transform: translate(-50%, -50%);
                width: 480px;
                height: 480px;
                background: radial-gradient(circle, rgba(251, 146, 60, 0.08) 0%, rgba(37, 99, 235, 0.05) 50%, transparent 75%);
                border-radius: 50%;
                filter: blur(40px);
                animation: welcomeGlowPulse 16s ease-in-out infinite;
                pointer-events: none;
            }

            @keyframes welcomeGlowPulse {
                0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
                50% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
            }

            /* Heading */
            .welcome-heading {
                font-size: 1.85rem;
                font-weight: 700;
                text-align: center;
                width: min(100%, var(--welcome-content-width));
                max-width: min(780px, var(--welcome-content-width));
                margin-bottom: 5px;
                letter-spacing: -0.03em;
                line-height: 1.2;
                background: linear-gradient(135deg, #f9fafb 40%, #fb923c 100%);
                -webkit-background-clip: text;
                background-clip: text;
                -webkit-text-fill-color: transparent;
                animation: welcomeFadeUp 0.7s ease forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            .welcome-sub {
                font-size: 0.9rem;
                color: #64748b;
                text-align: center;
                width: min(100%, var(--welcome-content-width));
                max-width: min(780px, var(--welcome-content-width));
                margin-bottom: 12px;
                animation: welcomeFadeUp 0.7s ease 0.15s forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            @keyframes welcomeFadeUp {
                to { opacity: 1; transform: translateY(0); }
            }

            /* Input wrap */
            .welcome-input-wrap {
                width: 100%;
                max-width: min(580px, var(--welcome-content-width));
                position: relative;
                margin-bottom: 8px;
                animation: welcomeFadeUp 0.7s ease 0.25s forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            .welcome-placeholder-fade {
                position: absolute;
                left: 16px;
                right: 54px;
                top: 12px;
                color: rgba(100, 116, 139, 0.96);
                font-size: 15px;
                line-height: 1.5;
                pointer-events: none;
                opacity: 1;
                transform: translateY(0);
                transition: opacity 0.48s ease, transform 0.48s ease, filter 0.48s ease;
                filter: blur(0);
                z-index: 3;
            }

            .welcome-placeholder-fade.is-switching {
                opacity: 0;
                transform: translateY(8px);
                filter: blur(4px);
            }

            .welcome-input-wrap.has-value .welcome-placeholder-fade,
            .welcome-input-wrap.is-focused .welcome-placeholder-fade {
                opacity: 0;
                transform: translateY(-6px);
                filter: blur(4px);
            }

            .welcome-input-wrap textarea {
                width: 100%;
                padding: 11px 52px 11px 16px;
                background: linear-gradient(180deg, rgba(9, 16, 32, 0.96), rgba(12, 22, 42, 0.94));
                border: 1px solid rgba(251, 146, 60, 0.22);
                border-radius: 14px;
                color: #f9fafb;
                font-size: 15px;
                font-family: 'Inter', sans-serif;
                outline: none;
                resize: none;
                min-height: 44px;
                max-height: 120px;
                overflow-y: auto;
                transition: border-color 0.2s, box-shadow 0.2s;
                line-height: 1.5;
                box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
                overflow-y: hidden;
                position: relative;
                z-index: 2;
            }

            .welcome-input-wrap textarea:focus {
                border-color: rgba(251, 146, 60, 0.6);
                box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1), 0 6px 30px rgba(0, 0, 0, 0.4);
            }

            .welcome-send-btn {
                position: absolute;
                right: 8px;
                top: 50%;
                transform: translateY(-50%);
                width: 34px;
                height: 34px;
                background: linear-gradient(135deg, #fb923c, #f97316);
                border: none;
                border-radius: 10px;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
                color: white;
                transition: transform 0.2s, box-shadow 0.2s;
                box-shadow: 0 2px 14px rgba(251, 146, 60, 0.45);
            }

            .welcome-send-btn:hover {
                transform: translateY(-50%) scale(1.06);
                box-shadow: 0 4px 20px rgba(251, 146, 60, 0.55);
            }

            /* Quick chips */
            .welcome-chips {
                display: flex;
                flex-wrap: wrap;
                gap: 6px;
                justify-content: center;
                width: min(100%, var(--welcome-content-width));
                max-width: min(580px, var(--welcome-content-width));
                animation: welcomeFadeUp 0.7s ease 0.4s forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            .welcome-chip {
                padding: 6px 13px;
                background: rgba(251, 146, 60, 0.07);
                border: 1px solid rgba(251, 146, 60, 0.18);
                border-radius: 24px;
                color: #94a3b8;
                font-size: 13px;
                font-family: 'Inter', sans-serif;
                cursor: pointer;
                transition: all 0.2s ease;
                white-space: nowrap;
            }

            .welcome-chip:hover {
                background: rgba(251, 146, 60, 0.15);
                border-color: rgba(251, 146, 60, 0.45);
                color: #fb923c;
                transform: translateY(-2px);
                box-shadow: 0 4px 12px rgba(251, 146, 60, 0.12);
            }

            .welcome-trust-strip {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 8px;
                width: min(100%, var(--welcome-content-width));
                max-width: min(760px, var(--welcome-content-width));
                margin-top: 8px;
                animation: welcomeFadeUp 0.9s ease 0.5s forwards;
                opacity: 0;
                transform: translateY(16px);
            }

            .welcome-trust-strip span {
                padding: 5px 10px;
                border-radius: 999px;
                background: rgba(15, 23, 42, 0.78);
                border: 1px solid rgba(148, 163, 184, 0.12);
                color: #cbd5e1;
                font-size: 0.75rem;
            }

            /* ── Mobile compact mode (≤ 640px) ── */
            @media (max-width: 640px) {
                /* Navbar: tighten so logo doesn't overflow */
                .navbar {
                    padding: 0 10px;
                    height: 52px;
                    gap: 6px;
                }
                .navbar-left {
                    gap: 4px;
                    left: 8px;
                }
                .navbar-actions {
                    gap: 4px;
                }
                .navbar-action-btn {
                    padding: 6px;
                    width: 34px;
                    height: 34px;
                }
                .navbar-action-btn svg {
                    width: 17px;
                    height: 17px;
                }
                /* On very small screens, hide the logo text and show only the image */
                .logo h1 {
                    display: none;
                }
                .logo-img {
                    width: 26px;
                    height: 26px;
                }
                .logo {
                    margin-left: 0;
                }
                .hamburger-menu span {
                    width: 22px;
                    height: 2.5px;
                }

                /* Welcome screen: center content vertically, scroll on short screens */
                #welcome-screen {
                    justify-content: flex-start;
                    padding: max(16px, 5dvh) 14px max(110px, 18dvh);
                    overflow-y: auto;
                    -webkit-overflow-scrolling: touch;
                }

                /* Smaller kicker badge */
                .welcome-kicker {
                    font-size: 0.60rem;
                    padding: 6px 12px;
                    margin-bottom: 10px;
                    letter-spacing: 0.08em;
                    max-width: 100%;
                }

                .welcome-kicker-icon {
                    width: 22px;
                    height: 22px;
                    flex-basis: 22px;
                }

                /* Compact heading */
                .welcome-heading {
                    font-size: 1.45rem;
                    margin-bottom: 6px;
                    letter-spacing: -0.02em;
                }
                .welcome-sub {
                    font-size: 0.85rem;
                    margin-bottom: 14px;
                    line-height: 1.5;
                }

                /* Proof grid: collapse to a single rotating card */
                .welcome-proof-grid {
                    display: block;
                    position: relative;
                    max-width: 100%;
                    min-height: 80px;
                    margin-bottom: 12px;
                }
                .welcome-proof-card {
                    padding: 9px 12px;
                    position: absolute;
                    inset: 0;
                    opacity: 0;
                    pointer-events: none;
                    transform: translateY(8px) scale(0.98);
                    transition: opacity 0.5s ease, transform 0.5s ease;
                }
                .welcome-proof-card strong { font-size: 0.84rem; }
                .welcome-proof-card.is-active {
                    opacity: 1;
                    pointer-events: auto;
                    transform: translateY(0) scale(1);
                }

                /* Input - adequately sized for mobile tap targets */
                .welcome-input-wrap {
                    margin-bottom: 10px;
                }
                .welcome-input-wrap textarea {
                    padding: 15px 52px 15px 16px;
                    font-size: 16px; /* prevent iOS zoom */
                    min-height: 64px;
                    border-radius: 14px;
                }
                .welcome-send-btn {
                    width: 36px;
                    height: 36px;
                    right: 9px;
                    top: 50%;
                    transform: translateY(-50%);
                    border-radius: 9px;
                }

                /* Chips: tighter & smaller text */
                .welcome-chips {
                    gap: 7px;
                    max-width: 100%;
                }
                .welcome-chip {
                    font-size: 11.5px;
                    padding: 6px 11px;
                }

                /* Trust strip: hide on very small screens to save vertical space */
                .welcome-trust-strip {
                    display: none;
                }

                /* Composer adjustments */
                .composer-shell { gap: 4px; }
                .composer-surface { padding: 9px 11px 7px; border-radius: 16px; gap: 7px; }
                .composer-shell #message-input { min-height: 34px; font-size: 16px; } /* 16px prevents iOS zoom */
                .composer-controls { gap: 5px; }
                .composer-icon-btn,
                #send-button { width: 32px; height: 32px; }
                .composer-followup {
                    margin-bottom: 3px;
                }
                .composer-followup-chip {
                    font-size: 0.65rem;
                    padding: 3px 9px 3px 7px;
                }
                .composer-disclaimer { font-size: 0.70rem; line-height: 1.25; }

                /* User input bar: always sticky at bottom (layout only; visibility controlled by JS) */
                .conversation .user-input {
                    position: relative !important;
                    bottom: auto !important;
                    left: auto !important;
                    right: auto !important;
                    width: auto !important;
                    padding: 10px 12px !important;
                    padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
                    z-index: 50 !important;
                    background: linear-gradient(to top, rgba(8, 13, 26, 0.99) 80%, rgba(8, 13, 26, 0.92)) !important;
                    backdrop-filter: blur(20px) !important;
                    -webkit-backdrop-filter: blur(20px) !important;
                    margin-top: auto;
                }
                /* Keep the scrollable message area fully visible above the in-flow composer */
                .conversation #messages {
                    padding-bottom: 24px !important;
                }

                /* Row height accounting for compact navbar */
                .row {
                    margin-top: 52px !important;
                    height: calc(100vh - 52px) !important;
                    height: calc(100dvh - 52px) !important;
                    min-height: calc(100vh - 52px) !important;
                    min-height: calc(100dvh - 52px) !important;
                }
            }

            /* Extra small screens below 400px */
            @media (max-width: 400px) {
                .welcome-heading { font-size: 1.25rem; }
                .welcome-kicker { display: none; }
                #welcome-screen { padding: max(8px, 3dvh) 12px max(110px, 18dvh); }
                /* Very small: only first 3 chips visible to prevent overflow */
                .welcome-chip:nth-child(n+4) { display: none; }
            }


            /* Ensure .conversation is relative for absolute welcome screen */
            .conversation {
                position: relative !important;
            }

            /* ═══════════════════════════════════════════
               LOGO RESPONDING ANIMATION
            ═══════════════════════════════════════════ */
            #messages .message .user.logo-responding {
                overflow: visible !important;
                border-radius: 10px;
                animation: logoOutlinePulse 1.8s ease-in-out infinite;
            }

            @keyframes logoOutlinePulse {
                0%, 100% {
                    box-shadow:
                        0 0 0 2px rgba(251, 146, 60, 0.35),
                        0 0 12px rgba(251, 146, 60, 0.15);
                }
                50% {
                    box-shadow:
                        0 0 0 3px rgba(251, 146, 60, 0.65),
                        0 0 28px rgba(251, 146, 60, 0.35),
                        0 0 56px rgba(251, 146, 60, 0.1);
                }
            }

            /* Spinning arc around responding logo */
            #messages .message .user.logo-responding::before {
                content: '';
                position: absolute;
                inset: -5px;
                border-radius: 13px;
                border: 2px solid transparent;
                border-top-color: #fb923c;
                border-right-color: rgba(249, 115, 22, 0.5);
                animation: logoSpinArc 1.4s linear infinite;
                z-index: 5;
            }

            @keyframes logoSpinArc {
                0% { transform: rotate(0deg); }
                100% { transform: rotate(360deg); }
            }

            /* Logo image breathes */
            #messages .message .user.logo-responding img {
                animation: logoImgBreath 1.8s ease-in-out infinite;
            }

            @keyframes logoImgBreath {
                0%, 100% {
                    filter: brightness(1) drop-shadow(0 0 5px rgba(251, 146, 60, 0.35));
                    transform: scale(1);
                }
                50% {
                    filter: brightness(1.12) drop-shadow(0 0 14px rgba(251, 146, 60, 0.7));
                    transform: scale(1.05);
                }
            }

            /* Message area background */
            #messages {
                background: transparent !important;
            }

            .box#messages {
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
                backdrop-filter: none !important;
            }

            /* 2026-04-28 — Removed the rule that hid .user-input when the welcome screen was visible.
               The composer is now always docked at the bottom; the welcome screen flows above it. */

            /* ══════════════════════════════════════════
               EPIC ANIMATIONS
            ══════════════════════════════════════════ */

            /* Message bubble entrance */
            @keyframes msgSlideIn {
                from { opacity: 0; transform: translateY(20px) scale(0.97); }
                to   { opacity: 1; transform: translateY(0)    scale(1); }
            }
            .message {
                animation: msgSlideIn 0.38s cubic-bezier(0.34, 1.3, 0.64, 1) both;
            }

            /* Conversation sidebar item — enter */
            @keyframes convoEnter {
                from { opacity: 0; transform: translateX(-18px); }
                to   { opacity: 1; transform: translateX(0); }
            }
            .convo.convo-entering {
                animation: convoEnter 0.32s cubic-bezier(0.34, 1.2, 0.64, 1) both;
                opacity: 0;
            }

            /* Conversation sidebar item — exit */
            @keyframes convoExit {
                from { opacity: 1; transform: translateX(0) scaleY(1);   max-height: 60px; margin-bottom: 4px; padding: 8px 12px; }
                to   { opacity: 0; transform: translateX(-20px) scaleY(0.6); max-height: 0;   margin-bottom: 0;  padding: 0; }
            }
            .convo.convo-exiting {
                animation: convoExit 0.3s cubic-bezier(0.4, 0, 0.6, 1) forwards;
                overflow: hidden;
                pointer-events: none;
            }

            /* Send button click pulse */
            @keyframes sendPulse {
                0%   { transform: scale(1);    box-shadow: 0 2px 12px rgba(251,146,60,0.3); }
                40%  { transform: scale(0.88); box-shadow: 0 1px 6px  rgba(251,146,60,0.15); }
                100% { transform: scale(1);    box-shadow: 0 2px 12px rgba(251,146,60,0.3); }
            }
            #send-button.sending {
                animation: sendPulse 0.35s ease forwards;
            }

            /* Welcome chips staggered entrance */
            .welcome-chips .welcome-chip:nth-child(1) { animation-delay: 0.45s; }
            .welcome-chips .welcome-chip:nth-child(2) { animation-delay: 0.52s; }
            .welcome-chips .welcome-chip:nth-child(3) { animation-delay: 0.59s; }
            .welcome-chips .welcome-chip:nth-child(4) { animation-delay: 0.66s; }
            .welcome-chips .welcome-chip:nth-child(5) { animation-delay: 0.73s; }
            .welcome-chips .welcome-chip:nth-child(6) { animation-delay: 0.80s; }

            /* Floating particles in welcome screen */
            .welcome-particle {
                position: absolute;
                border-radius: 50%;
                background: rgba(251, 146, 60, 0.35);
                animation: particleFloat linear infinite;
                pointer-events: none;
                z-index: 1;
            }
            @keyframes particleFloat {
                0%   { transform: translateY(0)    translateX(0);              opacity: 0; }
                10%  { opacity: 0.7; }
                90%  { opacity: 0.3; }
                100% { transform: translateY(-110vh) translateX(var(--drift)); opacity: 0; }
            }

            /* Disclaimer / login modal entrance */
            @keyframes modalPop {
                from { opacity: 0; transform: scale(0.9) translateY(20px); }
                to   { opacity: 1; transform: scale(1)   translateY(0); }
            }
            #disclaimer-modal > div,
            #login-modal > div {
                animation: modalPop 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
            }

            /* Logo shimmer — only while AI is responding */
            .logo h1 {
                background-size: 200% auto;
            }
            body.ai-responding .logo h1 {
                animation: logoShimmer 7.2s linear infinite;
            }
            @keyframes logoShimmer {
                0%   { background-position: -200% center; }
                100% { background-position:  200% center; }
            }

            /* Input focus glow pulse */
            @keyframes inputGlowPulse {
                0%, 100% { box-shadow: 0 0 0 3px rgba(251,146,60,0.10), 0 4px 20px rgba(0,0,0,0.3); }
                50%       { box-shadow: 0 0 0 3px rgba(251,146,60,0.22), 0 4px 28px rgba(251,146,60,0.08); }
            }
            #message-input:focus,
            #welcome-input:focus {
                animation: inputGlowPulse 7s ease infinite;
            }

            /* Mobile — lighter message animation */
            @media (max-width: 768px) {
                .message {
                    animation-duration: 0.28s;
                }
                .convo.convo-entering {
                    animation-duration: 0.22s;
                }
            }


/* ═══════════════════════════════════════════
   TOOL RESULT CARDS + TPS BADGE — from inline <style> block
═══════════════════════════════════════════ */

            .tool-result-card {
                margin-top: 10px;
                padding: 10px 14px;
                border-radius: 8px;
                font-size: 0.9rem;
                line-height: 1.5;
            }
            .tool-result-card.tool-success {
                background: rgba(34,197,94,0.12);
                border: 1px solid rgba(34,197,94,0.3);
                color: #86efac;
            }
            .tool-result-card.tool-error {
                background: rgba(239,68,68,0.1);
                border: 1px solid rgba(239,68,68,0.3);
                color: #fca5a5;
            }

            /* 2026-05-06 - Rich tool cards live in CSS so saved chat history reloads with styling. */
            .tool-rich-card {
                margin: 12px 0 6px;
                padding: 14px 16px;
                border-radius: 14px;
                border: 1px solid rgba(251, 146, 60, 0.22);
                background: linear-gradient(180deg, rgba(15, 23, 42, 0.78), rgba(7, 11, 20, 0.86));
                color: rgba(248, 250, 252, 0.94);
                box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 12px 28px rgba(0, 0, 0, 0.28);
                animation: toolAnimEnter 0.32s cubic-bezier(0.2, 0, 0, 1) both;
            }

            .tool-rich-card .trc-title {
                font-size: 0.78rem;
                font-weight: 600;
                letter-spacing: 0.12em;
                text-transform: uppercase;
                color: rgba(251, 146, 60, 0.85);
                margin: 0 0 8px;
            }

            .tool-rich-card .trc-body {
                font-size: 0.92rem;
                line-height: 1.45;
                margin: 0 0 10px;
            }

            .tool-rich-card .trc-actions {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
            }

            .tool-rich-card .trc-cta {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 8px;
                padding: 9px 14px;
                border-radius: 10px;
                background: linear-gradient(180deg, #fb923c, #ea580c);
                color: #1a0a00;
                font-weight: 600;
                font-size: 0.88rem;
                text-decoration: none;
                border: none;
                cursor: pointer;
                box-shadow: 0 6px 16px rgba(251, 146, 60, 0.35);
                transition: transform 120ms ease, box-shadow 120ms ease;
            }

            .tool-rich-card .trc-cta:hover {
                color: #1a0a00;
                transform: translateY(-1px);
                box-shadow: 0 10px 22px rgba(251, 146, 60, 0.45);
            }

            .tool-rich-card .trc-cta-secondary {
                background: rgba(255, 255, 255, 0.06);
                color: rgba(248, 250, 252, 0.92);
                box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
            }

            /* ── Thinking display ── */
            .thinking-display {
                display: inline-flex;
                align-items: center;
                gap: 10px;
                padding: 6px 14px 6px 10px;
                background: rgba(99, 102, 241, 0.08);
                border: 1px solid rgba(99, 102, 241, 0.2);
                border-radius: 20px;
            }
            .thinking-word {
                font-size: 0.88rem;
                font-weight: 600;
                color: #a5b4fc;
                letter-spacing: 0.01em;
                animation: thinkWordFade 0.14s ease;
            }
            @keyframes thinkWordFade {
                0%   { opacity: 0.4; transform: translateY(3px); }
                100% { opacity: 1;   transform: translateY(0); }
            }
            .thinking-elapsed {
                font-size: 0.75rem;
                color: #4b5563;
                font-family: ui-monospace, monospace;
                min-width: 22px;
            }

            /* Tool pending animation */
            .tool-pending-anim {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                margin-top: 10px;
                padding: 8px 14px;
                background: rgba(99,102,241,0.12);
                border: 1px solid rgba(99,102,241,0.3);
                border-radius: 8px;
                font-size: 0.88rem;
                color: #a5b4fc;
                animation: toolPendingFade 0.4s ease;
            }
            @keyframes toolPendingFade {
                from { opacity: 0; transform: translateY(4px); }
                to   { opacity: 1; transform: translateY(0); }
            }
            .tool-pending-dots span {
                display: inline-block;
                animation: toolDot 1.2s infinite ease-in-out both;
                font-size: 1.1em;
                color: #818cf8;
            }
            .tool-pending-dots span:nth-child(2) { animation-delay: 0.2s; }
            .tool-pending-dots span:nth-child(3) { animation-delay: 0.4s; }
            @keyframes toolDot {
                0%, 80%, 100% { opacity: 0.2; }
                40% { opacity: 1; }
            }

            /* Removed chat flag button */
            .legacy-chat-flag-btn {
                display: inline-block;
                margin-top: 6px;
                padding: 3px 10px;
                font-size: 0.78rem;
                color: var(--muted-foreground, #6b7280);
                background: none;
                border: 1px solid transparent;
                border-radius: 6px;
                cursor: pointer;
                opacity: 0;
                transition: opacity 0.2s, border-color 0.2s, color 0.2s;
            }
            .message:hover .legacy-chat-flag-btn { opacity: 1; }
            .legacy-chat-flag-btn:hover {
                border-color: rgba(239,68,68,0.4);
                color: #fca5a5;
            }
            .legacy-chat-flag-btn:disabled { cursor: default; color: #6b7280; border-color: transparent; }

            /* ── Live response cursor dot ── */
            .response-cursor {
                display: inline-block;
                width: 6px;
                height: 6px;
                border-radius: 50%;
                background: rgba(255, 255, 255, 0.9);
                margin-left: 5px;
                vertical-align: middle;
                position: relative;
                top: -1px;
                animation: responseCursorPulse 0.7s ease-in-out infinite;
                box-shadow: 0 0 6px rgba(255, 255, 255, 0.5);
            }
            @keyframes responseCursorPulse {
                0%, 100% { opacity: 1;   transform: scale(1); }
                50%       { opacity: 0.2; transform: scale(0.6); }
            }

            /* ── Tokens/s badge ── */
            .tps-badge {
                display: inline-flex;
                align-items: center;
                font-size: 0.62rem;
                color: rgba(251, 146, 60, 0.8);
                background: rgba(251, 146, 60, 0.08);
                border: 1px solid rgba(251, 146, 60, 0.14);
                border-radius: 999px;
                padding: 1px 7px;
                margin-left: 8px;
                font-family: ui-monospace, 'Cascadia Code', monospace;
                letter-spacing: 0.02em;
                vertical-align: middle;
                opacity: 0;
                white-space: nowrap;
                animation: tpsFadeIn 0.4s ease 0.15s forwards;
            }
            @keyframes tpsFadeIn {
                to { opacity: 1; }
            }

/* 2026-04-28 — Material Dark /chat redesign final layer */
:root {
  --chat-sidebar-width: 280px;
  --chat-shell-gutter: 24px;
  --chat-content-max: 900px;
}

html,
body {
  background: var(--chat-md-bg);
}

body {
  color: var(--chat-md-text);
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(11, 18, 32, 0.96) 0%, rgba(7, 11, 20, 1) 44%, rgba(5, 8, 14, 1) 100%);
}

.gradient,
.welcome-bg-glow,
.welcome-particle {
  display: none !important;
}

.row {
  height: calc(100vh - var(--navbar-height));
  height: calc(100dvh - var(--navbar-height));
  margin-top: var(--navbar-height) !important;
  padding: 0;
  gap: 0;
  max-width: none;
}

.navbar {
  height: var(--navbar-height);
  padding: 0 18px;
  background: rgba(7, 11, 20, 0.88);
  border-bottom: 1px solid var(--chat-md-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.navbar-left,
.navbar-right,
.navbar-actions {
  position: static;
}

.navbar-left {
  gap: 12px;
}

.logo {
  margin-left: 8px;
}

.logo h1 {
  font-size: 1rem;
  letter-spacing: 0;
  font-weight: 700;
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--chat-md-text);
}

.logo a:hover h1 {
  color: var(--chat-md-brass);
}

.logo-img,
.welcome-kicker-icon,
.chat-profile-avatar-wrap,
.message .user {
  border-radius: var(--chat-md-radius);
}

.navbar-action-btn,
.hamburger-menu,
.composer-icon-btn,
#send-button,
.welcome-send-btn {
  min-width: 40px;
  width: 40px;
  height: 40px;
  border-radius: var(--chat-md-radius);
  border: 1px solid transparent;
  color: var(--chat-md-muted);
  transition:
    background-color var(--chat-md-transition),
    border-color var(--chat-md-transition),
    color var(--chat-md-transition),
    transform var(--chat-md-transition),
    box-shadow var(--chat-md-transition);
}

.navbar-action-btn:hover,
.hamburger-menu:hover,
.composer-icon-btn:hover {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--chat-md-border);
  color: var(--chat-md-text);
  transform: none;
}

.hamburger-menu {
  position: static !important;
  justify-content: center;
  gap: 4px;
}

.hamburger-menu span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.box.conversations {
  top: var(--navbar-height);
  width: var(--chat-sidebar-width);
  height: calc(100vh - var(--navbar-height));
  height: calc(100dvh - var(--navbar-height));
  padding: 16px 12px;
  gap: 12px;
  background: rgba(7, 11, 20, 0.9) !important;
  border: 0 !important;
  border-right: 1px solid var(--chat-md-border) !important;
  border-radius: 0;
  box-shadow: none;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  z-index: 70;
}

.conversations .top {
  flex: 0 0 auto;
  min-height: 0;
}

.conversations-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 0 2px 0 0;
}

.conversations .convo {
  min-height: 44px;
  padding: 8px 10px;
  border-radius: var(--chat-md-radius);
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  gap: 8px;
  transition:
    background-color var(--chat-md-transition),
    border-color var(--chat-md-transition),
    color var(--chat-md-transition);
}

.conversations .convo:hover {
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--chat-md-border);
  transform: none;
  box-shadow: none;
}

.conversations .convo.active {
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.24);
  box-shadow: none;
}

.convo-title {
  font-size: 0.84rem;
  color: var(--chat-md-muted);
}

.conversations .convo.active .convo-title {
  color: var(--chat-md-text);
}

.bottom_buttons {
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--chat-md-border);
  background: transparent;
}

.chat-profile-strip,
.bottom_buttons .chat-sidebar-clear-btn {
  border-radius: var(--chat-md-radius);
  border: 1px solid var(--chat-md-border);
  background: rgba(15, 23, 42, 0.62);
  box-shadow: none;
}

.chat-profile-strip:hover,
.bottom_buttons .chat-sidebar-clear-btn:hover {
  background: rgba(251, 146, 60, 0.09);
  border-color: rgba(251, 146, 60, 0.24);
  color: var(--chat-md-brass);
}

.conversation {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 769px) {
  body {
    --chat-sidebar-offset: var(--chat-sidebar-width);
  }

  body.desktop-nav-closed {
    --chat-sidebar-offset: 0px;
  }

  .conversation {
    width: calc(100% - var(--chat-sidebar-offset));
    margin-left: var(--chat-sidebar-offset);
    transition:
      width 220ms cubic-bezier(0.2, 0, 0, 1),
      margin-left 220ms cubic-bezier(0.2, 0, 0, 1);
  }

  body.desktop-nav-closed .conversation {
    width: 100%;
    margin-left: 0;
  }

  body:not(.desktop-nav-closed) .box.conversations {
    transform: translateX(0);
  }
}

.conversation #messages,
.box#messages {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.conversation #messages {
  gap: 14px;
  padding: 28px max(24px, calc((100% - var(--chat-content-max)) / 2)) 24px;
  scroll-behavior: auto;
}

.message {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 0;
  border: 0 !important;
  animation: materialMessageIn 180ms cubic-bezier(0.2, 0, 0, 1) both;
}

.message:last-child {
  margin-bottom: 0;
}

.message + .message {
  margin-top: 18px;
}

@keyframes materialMessageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message .user {
  width: 34px;
  height: 34px;
  overflow: hidden;
  border: 1px solid var(--chat-md-border);
  background: rgba(15, 23, 42, 0.78);
  box-shadow: none;
}

.message .user i {
  display: none;
}

.message .content {
  flex: 0 1 auto;
  max-width: min(720px, calc(100% - 52px));
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--chat-md-radius-lg);
  border: 1px solid var(--chat-md-border);
  background: rgba(15, 23, 42, 0.72);
  color: var(--chat-md-text);
  box-shadow: var(--chat-md-shadow-soft);
}

.message-assistant .content {
  border-top-left-radius: 4px;
}

.message-user {
  flex-direction: row-reverse;
  justify-content: flex-start;
}

.message-user .content {
  border-color: rgba(251, 146, 60, 0.28);
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.18), rgba(180, 83, 9, 0.15));
  border-top-right-radius: 4px;
}

.message .content p,
.message .content li,
.message .content table,
.message .content blockquote {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--chat-md-text);
}

.message .content table {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 12px 0;
  overflow-x: auto;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--chat-md-border);
  border-radius: var(--chat-md-radius);
  background: rgba(2, 6, 23, 0.45);
  font-size: 0.9rem;
  line-height: 1.5;
  -webkit-overflow-scrolling: touch;
}

.message .content table thead {
  background: rgba(251, 146, 60, 0.1);
}

.message .content table th {
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--chat-md-brass);
  border-bottom: 1px solid var(--chat-md-border);
  white-space: nowrap;
}

.message .content table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--chat-md-border);
  vertical-align: top;
}

.message .content table tbody tr:last-child td {
  border-bottom: none;
}

.message .content table tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.5);
}

.message .content p {
  margin: 0 0 10px;
}

.message .content p:last-child,
.message .content ul:last-child,
.message .content ol:last-child {
  margin-bottom: 0;
}

.message .content ul,
.message .content ol {
  margin: 0 0 10px 20px;
}

.message .content a {
  color: var(--chat-md-brass);
  text-underline-offset: 3px;
}

.message-assistant .content a.sl-chat-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: fit-content;
  max-width: 100%;
  min-height: 42px;
  margin: 8px 0 6px;
  padding: 0 16px;
  border: 1px solid rgba(255, 186, 117, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #fb923c, #f97316);
  color: #fff7ed;
  box-shadow: 0 10px 24px rgba(249, 115, 22, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
  text-align: center;
  text-decoration: none;
  transition: transform var(--chat-md-transition), box-shadow var(--chat-md-transition), border-color var(--chat-md-transition);
  overflow-wrap: anywhere;
}

.message-assistant .content a.sl-chat-action-btn::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.message-assistant .content a.sl-chat-action-btn:hover {
  color: #ffffff;
  border-color: rgba(255, 221, 170, 0.72);
  box-shadow: 0 14px 30px rgba(249, 115, 22, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.message .content code {
  background: rgba(2, 6, 23, 0.62);
  border: 1px solid var(--chat-md-border);
  border-radius: 6px;
  color: #fde68a;
}

.message .content pre {
  border-radius: var(--chat-md-radius);
  background: rgba(2, 6, 23, 0.72);
  border-color: var(--chat-md-border);
}

/* 2026-04-28 — Welcome screen: natural flow above the composer dock; no longer absolute. */
#welcome-screen {
  justify-content: center;
  gap: 18px;
  padding: 32px max(24px, calc((100% - 720px) / 2));
  background: transparent;
}

.welcome-grid-lines {
  opacity: 0.22;
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, transparent 0%, black 18%, black 76%, transparent 100%);
}

.welcome-kicker {
  margin: 0;
  padding: 6px 10px;
  border-radius: var(--chat-md-radius);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.66);
  box-shadow: none;
  color: var(--chat-md-muted);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
  animation: materialMessageIn 180ms ease both;
}

.welcome-kicker-icon {
  border-color: rgba(251, 146, 60, 0.32);
  background: rgba(251, 146, 60, 0.12);
  box-shadow: none;
}

.welcome-heading {
  width: min(100%, 760px);
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--chat-md-text);
  background: none;
  -webkit-text-fill-color: currentColor;
  animation: materialMessageIn 200ms ease 40ms both;
}

.welcome-heading::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin: 14px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--chat-md-ember), var(--chat-md-brass));
}

.welcome-sub {
  width: min(100%, 660px);
  margin: 0;
  color: var(--chat-md-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  animation: materialMessageIn 200ms ease 70ms both;
}

.welcome-proof-grid {
  width: min(100%, 640px);
  display: block;
  margin: 2px 0 4px;
  animation: materialMessageIn 200ms ease 90ms both;
}

.welcome-proof-card {
  padding: 14px 16px;
  border-radius: var(--chat-md-radius-lg);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.72);
  box-shadow: var(--chat-md-shadow-soft);
  text-align: center;
}

.welcome-proof-label {
  color: var(--chat-md-brass);
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: none;
}

.welcome-proof-card strong {
  margin-top: 4px;
  color: var(--chat-md-text);
  font-size: 0.92rem;
  line-height: 1.5;
  font-weight: 600;
}

.welcome-input-wrap {
  width: min(100%, 640px);
  max-width: 640px;
  margin: 0;
  animation: materialMessageIn 200ms ease 110ms both;
}

.welcome-input-wrap textarea {
  min-height: 56px;
  padding: 16px 60px 16px 16px;
  border-radius: var(--chat-md-radius-lg);
  border-color: var(--chat-md-border-strong);
  background: rgba(15, 23, 42, 0.86);
  box-shadow: var(--chat-md-shadow);
  color: var(--chat-md-text);
  font-size: 1rem;
}

.welcome-input-wrap textarea:focus {
  border-color: var(--chat-md-ember);
  box-shadow: 0 0 0 3px var(--chat-md-focus), var(--chat-md-shadow);
  animation: none;
}

.welcome-placeholder-fade {
  left: 16px;
  top: 16px;
  right: 62px;
  color: var(--chat-md-subtle);
  transition: opacity var(--chat-md-transition), transform var(--chat-md-transition);
  filter: none;
}

.welcome-placeholder-fade.is-switching,
.welcome-input-wrap.has-value .welcome-placeholder-fade,
.welcome-input-wrap.is-focused .welcome-placeholder-fade {
  transform: translateY(-2px);
  filter: none;
}

.welcome-send-btn,
#send-button,
.composer-controls #send-button,
.sl-chat-modal-primary {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, #fb923c, #d97706);
  color: #111827;
  box-shadow: 0 10px 22px rgba(251, 146, 60, 0.24);
  font-weight: 700;
}

.welcome-send-btn:hover,
#send-button:hover,
.composer-controls #send-button:hover,
.sl-chat-modal-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(251, 146, 60, 0.3);
}

.welcome-chips {
  width: min(100%, 640px);
  max-width: 640px;
  gap: 8px;
  animation: materialMessageIn 200ms ease 130ms both;
}

.welcome-chip,
.composer-followup-chip {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: var(--chat-md-radius);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.62);
  color: var(--chat-md-muted);
  font-size: 0.84rem;
  transition:
    background-color var(--chat-md-transition),
    border-color var(--chat-md-transition),
    color var(--chat-md-transition),
    transform var(--chat-md-transition);
  animation: none;
}

.welcome-chip:hover,
.composer-followup-chip:hover {
  background: rgba(251, 146, 60, 0.1);
  border-color: rgba(251, 146, 60, 0.32);
  color: var(--chat-md-brass);
  transform: none;
  box-shadow: none;
}

.welcome-trust-strip {
  margin-top: 0;
  gap: 8px;
  animation: materialMessageIn 200ms ease 150ms both;
}

.welcome-trust-strip span {
  border-radius: var(--chat-md-radius);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.44);
  color: var(--chat-md-subtle);
}

.conversation .user-input {
  padding: 14px max(24px, calc((100% - var(--chat-content-max)) / 2)) 12px;
  border-top: 1px solid var(--chat-md-border);
  background: rgba(7, 11, 20, 0.88);
  box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.18);
  transition: transform var(--chat-md-transition), padding var(--chat-md-transition), background var(--chat-md-transition), border-color var(--chat-md-transition);
}

/* 2026-04-28 — single-composer hero override; rule lives near the top of the file too,
   re-stated here at higher specificity to win over the dock styles above. */
.conversation .user-input.composer--hero {
  padding: 0;
  border-top: none;
  background: transparent;
  box-shadow: none;
}

.composer-surface {
  gap: 8px;
  padding: 12px;
  border-radius: var(--chat-md-radius-lg);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.9);
  box-shadow: var(--chat-md-shadow);
}

.composer-surface:focus-within {
  border-color: rgba(251, 146, 60, 0.42);
  box-shadow: 0 0 0 3px var(--chat-md-focus), var(--chat-md-shadow);
}

.composer-shell #message-input {
  min-height: 34px;
  max-height: 150px;
  padding: 2px 0;
  color: var(--chat-md-text);
  font-size: 1rem;
  line-height: 1.5;
  letter-spacing: 0;
}

.composer-shell #message-input::placeholder {
  color: var(--chat-md-subtle);
}

.composer-controls {
  gap: 8px;
}

.composer-icon-btn,
.composer-controls #send-button {
  min-width: 36px;
  width: 36px;
  height: 36px;
  border-radius: var(--chat-md-radius);
}

.composer-icon-btn {
  background: rgba(148, 163, 184, 0.07);
  border-color: var(--chat-md-border);
}

.composer-actions-menu {
  border-radius: var(--chat-md-radius-lg);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.98);
  box-shadow: var(--chat-md-shadow);
  transform: translateY(6px);
}

.composer-actions-menu.menu-open {
  transform: translateY(0);
}

.composer-actions-menu button {
  border-radius: var(--chat-md-radius);
}

.composer-disclaimer {
  color: var(--chat-md-subtle);
  font-size: 0.72rem;
}

.stop_generating {
  bottom: 92px;
}

.stop_generating button {
  border-radius: var(--chat-md-radius);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: var(--chat-md-shadow-soft);
}

.ai-thinking-shell {
  min-width: min(100%, 300px);
  gap: 8px;
}

.ai-thinking-pill {
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--chat-md-radius-lg);
  border-color: var(--chat-md-border);
  background: rgba(15, 23, 42, 0.68);
  box-shadow: none;
}

.ai-thinking-pill::after {
  display: none;
}

.ai-thinking-orb {
  width: 10px;
  height: 10px;
  background: var(--chat-md-ember);
  box-shadow: 0 0 0 4px rgba(251, 146, 60, 0.1);
  animation: materialStatusPulse 1400ms ease-in-out infinite;
}

@keyframes materialStatusPulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

.ai-thinking-label,
.ai-thinking-word,
.ai-thinking-elapsed {
  color: var(--chat-md-muted);
  letter-spacing: 0;
  text-transform: none;
}

.ai-thinking-word {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--chat-md-text);
}

@keyframes thinkWordIn {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes thinkWordOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-2px); }
}

.ai-thinking-preview {
  display: none;
}

.stream-response-body {
  opacity: 0;
  transform: translateY(4px);
  filter: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.stream-response-body.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.response-cursor {
  width: 3px;
  height: 1.05em;
  border-radius: 999px;
  background: var(--chat-md-brass);
  margin-left: 4px;
  vertical-align: -0.18em;
  box-shadow: none;
  animation: cursorBlink 1100ms steps(2, start) infinite;
}

#messages .message .user.logo-responding,
#messages .message .user.logo-responding img {
  animation: none !important;
  box-shadow: none !important;
  filter: none !important;
  transform: none !important;
}

#messages .message .user.logo-responding::before {
  display: none !important;
}

.tps-badge,
.content .thought-summary {
  border-radius: var(--chat-md-radius);
  color: var(--chat-md-subtle) !important;
  background: rgba(148, 163, 184, 0.08);
  border-color: var(--chat-md-border);
  letter-spacing: 0;
  text-transform: none;
}

/* 2026-05-04 — Redesigned modal system: deeper bg, sharper borders, refined hierarchy. */
.sl-chat-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000000;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sl-chat-modal-js {
  z-index: 2000001;
}

.sl-chat-modal-card {
  width: min(100%, 440px);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(12, 14, 20, 0.98);
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f8fafc;
}

.sl-chat-modal-card-centered {
  text-align: center;
}

.sl-chat-modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.sl-chat-modal-card h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.12rem;
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: 0;
}

.sl-chat-modal-card h3 {
  margin: 0 0 12px;
  color: #f8fafc;
  font-size: 1.08rem;
  font-weight: 680;
  line-height: 1.25;
  letter-spacing: 0;
}

.sl-chat-modal-header h2 {
  margin: 0;
}

.sl-chat-modal-mark,
.sl-chat-modal-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid rgba(251, 146, 60, 0.22);
  background: rgba(251, 146, 60, 0.09);
  color: var(--chat-md-brass);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.sl-chat-modal-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sl-chat-modal-icon {
  margin: 0 auto 16px;
}

.sl-chat-modal-copy {
  margin: 0 0 20px;
  color: rgba(226, 232, 240, 0.7);
  line-height: 1.65;
  font-size: 0.93rem;
}

.sl-chat-modal-copy strong {
  color: #f8fafc;
}

/* Legacy notice box — kept for compat but hidden by default in new design */
.sl-chat-modal-notice {
  margin-bottom: 20px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(251, 146, 60, 0.2);
  background: rgba(251, 146, 60, 0.07);
}

.sl-chat-modal-notice p {
  margin: 0;
  color: rgba(251, 191, 36, 0.9);
  font-size: 0.9rem;
  line-height: 1.6;
}

.sl-chat-modal-notice a,
.sl-chat-modal-notice a[style] {
  color: var(--chat-md-brass) !important;
  text-underline-offset: 3px;
}

.sl-chat-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.sl-chat-modal-actions-end {
  justify-content: flex-end;
}

.sl-chat-modal-primary,
.sl-chat-modal-secondary,
.sl-chat-modal-danger,
.sl-chat-modal-dismiss {
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--chat-md-transition),
    border-color var(--chat-md-transition),
    color var(--chat-md-transition),
    transform var(--chat-md-transition),
    box-shadow var(--chat-md-transition);
}

.sl-chat-modal-actions .sl-chat-modal-primary,
.sl-chat-modal-actions .sl-chat-modal-secondary {
  flex: 1;
}

.sl-chat-modal-card > .sl-chat-modal-primary {
  width: 100%;
}

.sl-chat-modal-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(226, 232, 240, 0.9);
}

.sl-chat-modal-secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.16);
  color: #f8fafc;
}

.sl-chat-modal-danger {
  background: rgba(220, 38, 38, 0.15);
  color: #fca5a5;
  border-color: rgba(220, 38, 38, 0.35);
}

.sl-chat-modal-danger:hover {
  background: rgba(220, 38, 38, 0.25);
  border-color: rgba(220, 38, 38, 0.5);
  color: #fecaca;
}

.sl-chat-modal-dismiss {
  margin: 12px auto 0;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 8px;
  color: rgba(148, 163, 184, 0.7);
  background: transparent;
  font-weight: 400;
  font-size: 0.87rem;
}

.sl-chat-modal-dismiss:hover {
  color: rgba(226, 232, 240, 0.9);
  background: rgba(255, 255, 255, 0.05);
}

/* 2026-05-04 — Rename modal text field. */
.sl-chat-rename-field {
  display: grid;
  gap: 7px;
  margin: 4px 0 20px;
  text-align: left;
}

.sl-chat-rename-field span {
  color: rgba(148, 163, 184, 0.8);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.sl-chat-rename-field input {
  width: 100%;
  min-height: 46px;
  padding: 11px 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.04);
  color: #f8fafc;
  font: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.sl-chat-rename-field input:focus {
  border-color: rgba(251, 146, 60, 0.48);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════
   2026-04-28 — Material Dark redesign refinements
   ──────────────────────────────────────────────────────────────────────── */

/* When welcome screen is visible, #messages collapses so welcome owns the flex space.
   This prevents the welcome from being cramped into half the column. */
#welcome-screen:not(.welcome-hidden) ~ #messages {
  flex: 0 0 0 !important;
  min-height: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  border: none !important;
  box-shadow: none !important;
  overflow: hidden !important;
  background: transparent !important;
}

/* Welcome logo (new minimal hero) */
.welcome-logo {
  display: inline-flex;
  width: 64px;
  height: 64px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(251, 146, 60, 0.06);
  box-shadow: 0 0 0 8px rgba(251, 146, 60, 0.05), 0 0 32px rgba(251, 146, 60, 0.08);
  animation: welcomeFadeUp 0.5s ease both;
}
.welcome-logo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Welcome heading underline accent — keep the brand orange-gradient text fill but kill the bouncy ::after pill */
.welcome-heading::after {
  display: none !important;
}

/* Welcome chips: cleaner hover (no translate-jump) */
#welcome-screen .welcome-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--chat-md-border);
  background: var(--chat-md-surface);
  color: var(--chat-md-muted);
  font-size: 0.86rem;
  letter-spacing: 0;
  transition: border-color var(--chat-md-transition), color var(--chat-md-transition), background var(--chat-md-transition);
  transform: none !important;
  box-shadow: none !important;
}
#welcome-screen .welcome-chip:hover {
  border-color: var(--chat-md-border-strong);
  color: var(--chat-md-text);
  background: var(--chat-md-surface-2);
  transform: none !important;
  box-shadow: none !important;
}
#welcome-screen .welcome-chips {
  gap: 8px;
}

/* Composer plus + send buttons: clean Material lift on hover */
.composer-icon-btn,
.composer-controls #send-button {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--chat-md-border);
  background: rgba(148, 163, 184, 0.06);
  color: var(--chat-md-muted);
  cursor: pointer;
  transition: background var(--chat-md-transition), border-color var(--chat-md-transition), color var(--chat-md-transition), transform var(--chat-md-transition);
}
.composer-icon-btn:hover {
  background: rgba(148, 163, 184, 0.12);
  color: var(--chat-md-text);
  border-color: var(--chat-md-border-strong);
}
.composer-controls #send-button {
  background: var(--chat-md-ember);
  border-color: transparent;
  color: #fff;
}
.composer-controls #send-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(251, 146, 60, 0.32);
}
.composer-controls #send-button:active {
  transform: translateY(0);
}
.composer-controls #send-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}
/* Override the legacy bouncy sendPulse animation with a calm Material press */
#send-button.sending {
  animation: none !important;
  transform: scale(0.96);
}

/* Composer disclaimer — smaller, muted */
.composer-disclaimer {
  margin: 8px auto 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--chat-md-subtle);
  max-width: 760px;
}

/* Message bubbles — flat, Material */
.message {
  animation-duration: 220ms !important;
  animation-timing-function: cubic-bezier(0.2, 0, 0, 1) !important;
}
.message .content {
  box-shadow: none !important;
}

/* Sidebar conversation hover — drop the translateY that contributes to a jumpy feel */
.conversations .convo:hover {
  transform: none !important;
  background: rgba(251, 146, 60, 0.06);
  border-color: var(--chat-md-border);
}
.conversations .convo.active {
  border-left: 2px solid var(--chat-md-ember);
}

/* Modal: replace display-toggle with class-based show + entry animation */
.sl-chat-modal {
  display: none;
}
.sl-chat-modal.is-open {
  display: flex;
  animation: slModalFadeIn 180ms cubic-bezier(0.2, 0, 0, 1) both;
}
.sl-chat-modal.is-open .sl-chat-modal-card {
  animation: slModalCardIn 220ms cubic-bezier(0.2, 0, 0, 1) both;
}
@keyframes slModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slModalCardIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Modal link: clean ember accent (replaces the old inline style="color:#60a5fa;") */
.sl-chat-modal-link {
  color: var(--chat-md-brass);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color var(--chat-md-transition);
}
.sl-chat-modal-link:hover {
  color: var(--chat-md-ember);
}

/* Polish the primary CTA on the modal — consistent ember accent */
.sl-chat-modal-primary {
  background: var(--chat-md-ember);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
  transition: transform var(--chat-md-transition), box-shadow var(--chat-md-transition), background var(--chat-md-transition);
}
.sl-chat-modal-primary:hover {
  background: #ef8a28;
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(251, 146, 60, 0.32);
}

/* 2026-05-01 - Grok-ish /chat redesign final layer */
:root {
  --chat-rail-width: 58px;
  --chat-drawer-width: min(308px, calc(100vw - var(--chat-rail-width) - 18px));
  --chat-content-max: 820px;
  --chat-composer-max: 800px;
  --chat-black: #020304;
  --chat-panel: rgba(18, 18, 20, 0.88);
  --chat-panel-strong: rgba(25, 25, 27, 0.94);
  --chat-line: rgba(255, 255, 255, 0.1);
  --chat-line-strong: rgba(255, 255, 255, 0.18);
  --chat-ember-soft: rgba(251, 146, 60, 0.16);
}

html,
body {
  background: var(--chat-black) !important;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255, 255, 255, 0.035), transparent 34%),
    linear-gradient(180deg, #000 0%, #020304 54%, #050506 100%) !important;
}

.chat-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.88), transparent 22%, transparent 78%, rgba(0, 0, 0, 0.86)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent 28%, transparent 78%, rgba(0, 0, 0, 0.84));
}

.chat-ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(251, 146, 60, 0.025) 48%, transparent 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0 1px, transparent 1px 92px);
  opacity: 0.38;
}

#chat-starfield {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.82;
  transition: opacity 260ms cubic-bezier(0.2, 0, 0, 1), filter 260ms cubic-bezier(0.2, 0, 0, 1);
}

body.chat-has-messages #chat-starfield {
  opacity: 0.32;
  filter: saturate(0.8);
}

body.chat-transitioning-to-messages #chat-starfield {
  opacity: 0.58;
  filter: saturate(0.9);
}

.gradient,
.welcome-bg-glow,
.welcome-particle,
.welcome-grid-lines,
.welcome-kicker,
.welcome-proof-grid,
.welcome-trust-strip,
.welcome-input-wrap,
.welcome-placeholder-fade,
.welcome-send-btn {
  display: none !important;
}

.row {
  position: relative;
  z-index: 2;
  width: calc(100vw - var(--chat-rail-width));
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 100vh !important;
  min-height: 100dvh !important;
  max-width: none !important;
  margin: 0 0 0 var(--chat-rail-width) !important;
  padding: 0 !important;
  gap: 0 !important;
}

.navbar {
  position: fixed !important;
  inset: 0 auto 0 0;
  z-index: 130;
  width: var(--chat-rail-width);
  height: 100vh !important;
  height: 100dvh !important;
  padding: 12px 8px !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  background: rgba(0, 0, 0, 0.58) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.navbar-left,
.navbar-right,
.navbar-actions {
  position: static !important;
  display: flex;
  align-items: center;
}

.navbar-left {
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.navbar-actions {
  order: 2;
  flex-direction: column;
  gap: 8px;
}

.navbar-right {
  order: 3;
  margin-top: 0;
}

.logo {
  order: 1;
  margin: 0 !important;
}

.logo a {
  width: 40px;
  height: 40px;
  justify-content: center;
}

.logo picture,
.logo-img {
  width: 28px !important;
  height: 28px !important;
  flex-basis: 28px !important;
}

.logo h1 {
  display: none !important;
}

.navbar-action-btn,
.hamburger-menu {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  border-radius: 12px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.74) !important;
  box-shadow: none !important;
}

.navbar-action-btn:hover,
.hamburger-menu:hover,
body:not(.desktop-nav-closed) .hamburger-menu {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  transform: none !important;
}

.hamburger-menu {
  position: static !important;
  display: inline-flex !important;
}

.hamburger-menu span {
  width: 18px;
  height: 2px;
  background: currentColor;
}

.box.conversations {
  position: fixed !important;
  top: 0 !important;
  left: var(--chat-rail-width) !important;
  z-index: 120 !important;
  width: var(--chat-drawer-width) !important;
  max-width: var(--chat-drawer-width) !important;
  height: 100vh !important;
  height: 100dvh !important;
  padding: 16px 12px !important;
  border: 0 !important;
  border-right: 1px solid rgba(255, 255, 255, 0.095) !important;
  border-radius: 0 !important;
  background: rgba(8, 8, 10, 0.92) !important;
  box-shadow: 22px 0 44px rgba(0, 0, 0, 0.34) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transform: translateX(0);
  transition: transform 220ms cubic-bezier(0.2, 0, 0, 1), box-shadow 220ms cubic-bezier(0.2, 0, 0, 1);
}

body.desktop-nav-closed .box.conversations {
  transform: translateX(calc(-1 * var(--chat-drawer-width) - 10px));
  box-shadow: none !important;
}

@media (min-width: 769px) {
  body,
  body.desktop-nav-closed {
    --chat-sidebar-offset: 0px !important;
  }

  .conversation,
  body.desktop-nav-closed .conversation,
  body:not(.desktop-nav-closed) .conversation {
    width: 100% !important;
    margin-left: 0 !important;
  }
}

.conversations-list {
  gap: 3px !important;
  padding-right: 0 !important;
}

.conversations .convo {
  min-height: 42px;
  border-radius: 10px !important;
  border: 1px solid transparent !important;
  background: transparent !important;
}

.conversations .convo:hover,
.conversations .convo.active {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.conversations .convo.active {
  border-left-color: rgba(251, 146, 60, 0.5) !important;
}

.chat-profile-strip,
.bottom_buttons .chat-sidebar-clear-btn {
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.conversation {
  position: relative !important;
  z-index: 2;
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

body.chat-welcome-active .conversation {
  justify-content: center;
  padding: 0 clamp(16px, 4vw, 56px) 7vh;
}

#welcome-screen {
  flex: 0 0 auto !important;
  justify-content: center !important;
  gap: 12px !important;
  width: min(100%, var(--chat-composer-max));
  margin: 0 auto !important;
  padding: 0 !important;
  overflow: visible !important;
  text-align: center;
}

body.chat-transitioning-to-messages #welcome-screen.welcome-hiding {
  opacity: 0;
  transform: translateY(-12px) scale(0.992);
  pointer-events: none;
  transition:
    opacity 220ms cubic-bezier(0.2, 0, 0, 1),
    transform 220ms cubic-bezier(0.2, 0, 0, 1);
}

.welcome-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 4px;
  color: #fff;
  animation: materialMessageIn 220ms cubic-bezier(0.2, 0, 0, 1) both;
}

.welcome-logo {
  width: 54px !important;
  height: 54px !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 0 36px rgba(251, 146, 60, 0.12) !important;
}

.welcome-wordmark {
  font-size: clamp(1.4rem, 2.3vw, 2.15rem);
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0;
}

.welcome-heading {
  width: min(100%, var(--chat-composer-max)) !important;
  max-width: var(--chat-composer-max) !important;
  margin: 0 auto !important;
  color: #f8fafc !important;
  font-size: clamp(1.35rem, 2.2vw, 2.1rem) !important;
  font-weight: 650 !important;
  line-height: 1.16 !important;
  letter-spacing: 0 !important;
  text-wrap: balance;
}

.welcome-heading::after {
  display: none !important;
}

.welcome-sub {
  width: min(100%, 640px) !important;
  margin: 0 auto 8px !important;
  color: rgba(226, 232, 240, 0.66) !important;
  font-size: 0.98rem !important;
  line-height: 1.5 !important;
  letter-spacing: 0 !important;
}

.conversation .user-input {
  position: relative !important;
  z-index: 4;
  width: 100%;
  padding: 14px max(18px, calc((100% - var(--chat-composer-max)) / 2)) 14px !important;
  border-top: 1px solid rgba(255, 255, 255, 0.075) !important;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.74) 32%, rgba(0, 0, 0, 0.92)) !important;
  box-shadow: none !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.conversation .user-input.composer--hero {
  width: min(100%, var(--chat-composer-max));
  margin: 10px auto 0 !important;
  padding: 0 !important;
  border-top: 0 !important;
  background: transparent !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.chat-transitioning-to-messages .conversation .user-input.composer--hero {
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  pointer-events: none;
  transition:
    opacity 220ms cubic-bezier(0.2, 0, 0, 1),
    transform 220ms cubic-bezier(0.2, 0, 0, 1);
}

.composer-shell,
.input-box {
  overflow: visible !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.composer-surface {
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  gap: 10px !important;
  width: 100%;
  min-height: 58px;
  padding: 8px 8px 8px 12px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: var(--chat-panel) !important;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  transition: border-color 180ms cubic-bezier(0.2, 0, 0, 1), box-shadow 180ms cubic-bezier(0.2, 0, 0, 1), background 180ms cubic-bezier(0.2, 0, 0, 1);
}

.composer-surface:focus-within {
  border-color: rgba(255, 255, 255, 0.26) !important;
  background: var(--chat-panel-strong) !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.48), 0 0 0 3px rgba(251, 146, 60, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.composer-controls {
  display: contents !important;
}

.composer-left {
  order: -1;
  flex: 0 0 auto !important;
  align-self: flex-end;
}

.composer-shell #message-input {
  order: 0;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px !important;
  max-height: 170px !important;
  padding: 9px 4px 7px !important;
  border: 0 !important;
  background: transparent !important;
  color: #f8fafc !important;
  font-size: 1rem !important;
  line-height: 1.45 !important;
  letter-spacing: 0 !important;
  resize: none !important;
}

.composer-shell #message-input::placeholder {
  color: rgba(226, 232, 240, 0.58) !important;
}

.composer-icon-btn,
.composer-controls #send-button {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  border-radius: 999px !important;
  align-self: flex-end;
}

.composer-icon-btn {
  color: rgba(255, 255, 255, 0.78) !important;
  background: transparent !important;
  border-color: transparent !important;
}

.composer-icon-btn:hover {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

.composer-controls #send-button {
  order: 2;
  color: #050506 !important;
  background: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  box-shadow: none !important;
}

.composer-controls #send-button:hover,
.composer-controls #send-button:focus-visible {
  color: #111827 !important;
  background: linear-gradient(180deg, #fff7ed, #fb923c) !important;
  box-shadow: 0 10px 24px rgba(251, 146, 60, 0.28) !important;
}

.composer-actions-menu {
  bottom: calc(100% + 10px) !important;
  min-width: 180px;
  border-radius: 16px !important;
  background: rgba(12, 14, 20, 0.99) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  overflow: hidden;
}

.composer-actions-menu button {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100% !important;
  min-height: 40px !important;
  padding: 0 14px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.88) !important;
  font-size: 0.92rem !important;
  font-weight: 500 !important;
  text-align: left;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}

.composer-actions-menu button:first-child {
  border-radius: 10px 10px 0 0 !important;
}

.composer-actions-menu button:last-child {
  border-radius: 0 0 10px 10px !important;
}

.composer-actions-menu button:hover {
  background: rgba(255, 255, 255, 0.07) !important;
  color: #f8fafc !important;
}

.composer-actions-menu button.composer-action-danger {
  color: rgba(252, 165, 165, 0.9) !important;
}

.composer-actions-menu button.composer-action-danger:hover {
  background: rgba(220, 38, 38, 0.12) !important;
  color: #fca5a5 !important;
}

body.chat-welcome-active .welcome-chips {
  display: flex !important;
  width: min(100%, var(--chat-composer-max)) !important;
  max-width: var(--chat-composer-max) !important;
  justify-content: center;
  gap: 10px !important;
  margin: 14px auto 0 !important;
  flex-wrap: wrap;
}

body.chat-has-messages .welcome-chips {
  display: none !important;
}

#welcome-screen .welcome-chip,
.welcome-chip {
  min-height: 38px !important;
  padding: 8px 14px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.13) !important;
  background: rgba(255, 255, 255, 0.045) !important;
  color: rgba(255, 255, 255, 0.82) !important;
  font-size: 0.88rem !important;
  line-height: 1.2;
  letter-spacing: 0 !important;
}

#welcome-screen .welcome-chip:hover,
.welcome-chip:hover {
  background: rgba(251, 146, 60, 0.12) !important;
  border-color: rgba(251, 146, 60, 0.34) !important;
  color: #fff !important;
}

body.chat-welcome-active .composer-disclaimer {
  display: none !important;
}

body.chat-has-messages .composer-disclaimer {
  display: block;
}

.conversation #messages {
  padding: 32px max(18px, calc((100% - var(--chat-content-max)) / 2)) 22px !important;
}

body.chat-thread-revealing .conversation #messages {
  animation: chatThreadReveal 340ms cubic-bezier(0.2, 0, 0, 1) both;
}

body.chat-thread-revealing .conversation .user-input:not(.composer--hero) {
  animation: composerDockIn 360ms cubic-bezier(0.2, 0, 0, 1) both;
}

@keyframes chatThreadReveal {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes composerDockIn {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

body.chat-welcome-active #welcome-screen:not(.welcome-hidden) ~ #messages {
  flex: 0 0 0 !important;
  height: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.chat-has-messages .message .content {
  background: rgba(20, 20, 22, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.105) !important;
  border-radius: 18px !important;
  box-shadow: none !important;
}

body.chat-has-messages .message-user .content {
  background: rgba(255, 255, 255, 0.1) !important;
  border-color: rgba(255, 255, 255, 0.13) !important;
}

.stop_generating {
  z-index: 20;
}

@media (prefers-reduced-motion: reduce) {
  #chat-starfield {
    opacity: 0.44;
  }
}

/* 2026-05-04 - Grok-style assistant responses: text on the page, not inside a card. */
.message-assistant {
  gap: 0 !important;
}

.message-user + .message-assistant {
  margin-top: clamp(34px, 5.5vh, 62px) !important;
}

.message-assistant .user {
  display: none !important;
}

.message-assistant .content {
  flex: 1 1 auto !important;
  width: 100% !important;
  max-width: min(var(--chat-content-max), 100%) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #f8fafc !important;
}

body.chat-has-messages .message-assistant .content {
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.message-assistant .stream-response-body {
  width: 100%;
}

.message-assistant .content p,
.message-assistant .content li,
.message-assistant .content blockquote {
  font-size: 1rem !important;
  line-height: 1.75 !important;
  font-weight: 520;
  color: #f8fafc !important;
}

.message-assistant .content p {
  margin: 0 0 16px !important;
}

.message-assistant .content p:last-child,
.message-assistant .content ul:last-child,
.message-assistant .content ol:last-child {
  margin-bottom: 0 !important;
}

.message-assistant .content ul,
.message-assistant .content ol {
  margin: 0 0 18px 1.35rem !important;
}

.message-assistant .content li {
  padding-left: 0.1rem;
  margin: 0 0 8px !important;
}

.message-assistant .content li::marker {
  color: rgba(248, 250, 252, 0.68);
}

.message-assistant .content h1,
.message-assistant .content h2,
.message-assistant .content h3 {
  margin: 26px 0 12px !important;
  color: #fff !important;
  font-weight: 720 !important;
  line-height: 1.22 !important;
  letter-spacing: 0 !important;
}

.message-assistant .content h1 {
  font-size: 1.55rem !important;
}

.message-assistant .content h2 {
  font-size: 1.34rem !important;
}

.message-assistant .content h3 {
  font-size: 1.14rem !important;
}

.message-assistant .content table {
  display: table !important;
  width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed;
  overflow: hidden !important;
  margin: 18px 0 22px !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  background: rgba(5, 10, 22, 0.54) !important;
}

.message-assistant .content table thead,
.message-assistant .content table tbody,
.message-assistant .content table tr {
  width: 100%;
}

.message-assistant .content table thead {
  background: transparent !important;
}

.message-assistant .content table tbody tr {
  background: rgba(10, 16, 30, 0.7);
}

.message-assistant .content table tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.86);
}

.message-assistant .content table th {
  padding: 10px 14px !important;
  background: linear-gradient(180deg, rgba(251, 146, 60, 0.16), rgba(251, 146, 60, 0.09)) !important;
  color: #f8c56e !important;
  font-size: 0.92rem !important;
  font-weight: 720 !important;
  line-height: 1.35 !important;
  white-space: normal !important;
}

.message-assistant .content table td {
  min-height: 42px;
  padding: 11px 14px !important;
  background: transparent !important;
  color: #f1f5f9 !important;
  font-size: 0.92rem !important;
  font-weight: 560;
  line-height: 1.45 !important;
  overflow-wrap: anywhere;
}

.message-assistant .content table th:not(:last-child),
.message-assistant .content table td:not(:last-child) {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.message-assistant .ai-thinking-shell {
  min-width: 0 !important;
  margin: 0 0 14px !important;
  gap: 0 !important;
}

.message-assistant .ai-thinking-pill {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  gap: 8px !important;
  color: rgba(226, 232, 240, 0.7);
}

.message-assistant .ai-thinking-orb {
  width: 14px !important;
  height: 14px !important;
  border: 2px solid rgba(226, 232, 240, 0.25);
  border-top-color: rgba(226, 232, 240, 0.72);
  animation: thinkSpinner 0.8s linear infinite !important;
}

.message-assistant .ai-thinking-copy {
  flex: 0 1 auto;
}

.message-assistant .ai-thinking-label,
.message-assistant .ai-thinking-word,
.message-assistant .ai-thinking-elapsed {
  color: rgba(226, 232, 240, 0.7) !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
}

.message-assistant .ai-thinking-word {
  display: none !important;
}

.message-assistant .ai-thinking-elapsed {
  min-width: 0 !important;
  font-family: inherit !important;
}

.message-assistant .ai-thinking-elapsed::before {
  content: "for ";
}

.message-assistant .tps-badge {
  display: none !important;
}

.content .thought-summary {
  display: flex !important;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0 0 16px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.68) !important;
  box-shadow: none !important;
  font-family: var(--font-sans) !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.thought-summary-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: rgba(226, 232, 240, 0.7);
}

.thought-summary-tools {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: rgba(226, 232, 240, 0.58);
}

.thought-summary-tools::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.35);
}

/* 2026-05-04 — live "Thinking…" pill reuses the bulb so the icon is consistent
   with the final "Thought for X.Xs" summary. The wrapper aligns it as a flex
   item; a slow pulse signals the pill is alive. */
.ai-thinking-bulb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 15px;
  color: rgba(226, 232, 240, 0.85);
  animation: aiThinkingBulbPulse 1800ms ease-in-out infinite;
}
.ai-thinking-bulb .thought-summary-icon {
  color: inherit;
}
@keyframes aiThinkingBulbPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* 2026-05-04 — tool-using pill: same dimensions/alignment as the bulb so the
   layout doesn't shift when the pill morphs from "Thinking…" to "Using a tool". */
.ai-thinking-tool-icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 15px;
  color: rgba(226, 232, 240, 0.85);
  animation: aiThinkingBulbPulse 1800ms ease-in-out infinite;
}
.ai-thinking-tool-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: inherit;
}

/* 2026-05-04 — pill mount is just a positioning slot; the inner shell or
   thought-summary span carries all the visible styling. */
.ai-status-pill-mount {
  display: block;
}
.ai-status-pill-mount:empty {
  display: none;
}

/* 2026-05-05 - AI-provided follow-up replies render as compact prompt buttons. */
.followup-replies {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: min(100%, 520px);
  margin-top: 22px;
}

.followup-reply {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 100%;
  min-height: 28px;
  padding: 2px 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(248, 250, 252, 0.92);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 620;
  line-height: 1.35;
  letter-spacing: 0;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  transition:
    color 180ms cubic-bezier(0.2, 0, 0, 1),
    transform 180ms cubic-bezier(0.2, 0, 0, 1);
}

.followup-reply:hover {
  color: #fff;
  transform: translateX(1px);
}

.followup-reply:focus-visible {
  outline: 2px solid rgba(251, 146, 60, 0.72);
  outline-offset: 4px;
}

.followup-reply-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  color: rgba(148, 163, 184, 0.82);
  stroke-width: 1.45;
  vector-effect: non-scaling-stroke;
}

.followup-reply span {
  min-width: 0;
}

@media (max-width: 768px) {
  .message-assistant .content p,
  .message-assistant .content li,
  .message-assistant .content blockquote {
    font-size: 0.98rem !important;
    line-height: 1.7 !important;
  }

  .content .thought-summary {
    font-size: 0.9rem !important;
    margin-bottom: 14px !important;
  }

  .message-user + .message-assistant {
    margin-top: 32px !important;
  }

  .followup-replies {
    width: 100%;
    gap: 9px;
    margin-top: 18px;
  }

  .followup-reply {
    font-size: 0.92rem;
  }

  .message-assistant .content table {
    table-layout: auto;
    font-size: 0.86rem !important;
  }

  .message-assistant .content table th,
  .message-assistant .content table td {
    padding: 9px 10px !important;
    font-size: 0.86rem !important;
  }
}

/* 2026-05-04 - Conversation drawer redesign and status polish. */
.chat-menu-head,
.chat-sidebar-cta,
.chat-conversations-title,
.chat-sidebar-search,
.chat-sidebar-round-btn {
  display: flex;
  align-items: center;
}

.chat-menu-head {
  gap: 12px;
  padding: 2px 0 6px;
}

.chat-profile-strip-primary {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
}

.chat-profile-strip-primary .chat-profile-avatar-wrap {
  width: 46px;
  height: 46px;
  flex-basis: 46px;
}

.chat-profile-strip-primary .chat-profile-name {
  font-size: 1.05rem;
  font-weight: 720;
}

.chat-profile-strip-primary .chat-profile-sub {
  max-width: 210px;
}

.chat-menu-collapse {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(248, 250, 252, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.chat-sidebar-cta {
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border-radius: 22px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #1556ff, #0b45df);
  box-shadow: 0 14px 32px rgba(21, 86, 255, 0.24);
}

.chat-sidebar-cta-thanks {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.18), rgba(255, 255, 255, 0.075));
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.chat-sidebar-cta-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.13);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0.02em;
}

.chat-sidebar-cta-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.chat-sidebar-cta-copy strong {
  font-size: 0.97rem;
  line-height: 1.2;
}

.chat-sidebar-cta-copy small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
  line-height: 1.3;
}

.chat-sidebar-cta-action {
  margin-left: auto;
  padding: 8px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-size: 0.82rem;
  font-weight: 760;
  white-space: nowrap;
}

.chat-conversations-title {
  justify-content: space-between;
  margin: 8px 0 2px;
  color: rgba(226, 232, 240, 0.56);
  font-size: 0.92rem;
  font-weight: 660;
}

.chat-conversations-title button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: rgba(226, 232, 240, 0.56);
  cursor: pointer;
}

body.chat-convos-collapsed .conversations-list,
body.chat-convos-collapsed .top {
  display: none !important;
}

.bottom_buttons > .chat-profile-strip,
.bottom_buttons .chat-sidebar-clear-btn {
  display: none !important;
}

.bottom_buttons {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 46px 52px;
  gap: 10px !important;
  align-items: center;
}

.chat-sidebar-search {
  min-width: 0;
  height: 46px;
  gap: 10px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(226, 232, 240, 0.66);
}

.chat-sidebar-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f8fafc;
  font: inherit;
  font-size: 0.96rem;
}

.chat-sidebar-search input::placeholder {
  color: rgba(226, 232, 240, 0.52);
}

.chat-sidebar-round-btn {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: rgba(248, 250, 252, 0.82);
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.chat-sidebar-round-btn:hover,
.chat-sidebar-round-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
  outline: none;
}

/* 2026-05-04 — Grok-style new-chat button: solid dark square, no tinted overlay.
   Sized slightly larger than the settings gear so the primary action reads first. */
.chat-sidebar-new-btn {
  width: 52px !important;
  height: 52px !important;
  background: #1a1a1d !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 14px !important;
  color: #f8fafc !important;
}

.chat-sidebar-new-btn svg {
  width: 30px;
  height: 30px;
  stroke-width: 1.9;
}

.chat-sidebar-new-btn:hover,
.chat-sidebar-new-btn:focus-visible {
  background: #232327 !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
}

.conversations-list {
  padding: 4px 0 8px !important;
}

.conversations .convo {
  min-height: 70px !important;
  padding: 10px 6px !important;
  border-radius: 10px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.conversations .convo .left {
  display: grid !important;
  gap: 4px;
  min-width: 0;
}

.convo-title-row {
  min-width: 0;
}

.convo-title {
  color: rgba(248, 250, 252, 0.84) !important;
  font-size: 1rem !important;
  font-weight: 500 !important;
  line-height: 1.24;
  white-space: normal !important;
  display: -webkit-box !important;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.convo-time {
  color: rgba(148, 163, 184, 0.74);
  font-size: 0.86rem;
  line-height: 1.1;
}

.convo-menu-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(226, 232, 240, 0.55);
  display: inline-grid;
  place-items: center;
  gap: 2px;
  cursor: pointer;
}

.convo-menu-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(226, 232, 240, 0.85);
}

.convo-menu-btn span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.chat-sidebar-empty {
  padding: 28px 12px;
  color: rgba(148, 163, 184, 0.78);
  font-size: 0.92rem;
}

/* 2026-05-04 — Pinned conversations get their own collapsible section above the
   regular list. The section is rendered dynamically and removed when empty. */
.chat-pinned-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-pinned-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0 2px;
  color: rgba(226, 232, 240, 0.56);
  font-size: 0.92rem;
  font-weight: 660;
}

.chat-pinned-title button {
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: rgba(226, 232, 240, 0.56);
  cursor: pointer;
  transition: transform 180ms ease;
}

body.chat-pinned-collapsed .chat-pinned-title button {
  transform: rotate(180deg);
}

body.chat-pinned-collapsed .chat-pinned-list {
  display: none !important;
}

.chat-pinned-list {
  display: flex;
  flex-direction: column;
  padding: 2px 0 6px;
}

/* 2026-05-04 — Sidebar actions overlay: redesigned for premium feel. */
.chat-actions-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-actions-sheet {
  width: min(100%, 520px);
  padding: 8px 8px max(24px, env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: rgba(12, 14, 20, 0.99);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  box-shadow: 0 -28px 80px rgba(0, 0, 0, 0.56);
}

.chat-actions-handle {
  display: block;
  width: 44px;
  height: 5px;
  margin: 8px auto 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.chat-actions-title {
  margin: 0 6px 4px;
  padding: 2px 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(148, 163, 184, 0.7);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-actions-item {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(248, 250, 252, 0.9);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 14px;
  font: inherit;
  font-size: 1.06rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.chat-actions-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chat-actions-delete {
  color: rgba(252, 165, 165, 0.9);
}

.chat-actions-delete:hover {
  background: rgba(220, 38, 38, 0.1);
  color: #fca5a5;
}

/* 2026-05-04 — Desktop popover variant: small dropdown anchored to the 3-dot button. */
.chat-actions-overlay--desktop {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  align-items: flex-start;
  justify-content: flex-start;
}

.chat-actions-overlay--desktop .chat-actions-sheet {
  position: fixed;
  width: 210px;
  min-height: 0;
  padding: 6px;
  border-radius: 16px;
  background: rgba(14, 15, 20, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.chat-actions-overlay--desktop .chat-actions-item {
  min-height: 38px;
  padding: 0 12px;
  gap: 11px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 500;
}

.chat-actions-overlay--desktop .chat-actions-item:hover,
.chat-actions-overlay--desktop .chat-actions-item:focus-visible {
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.chat-actions-overlay--desktop .chat-actions-delete {
  color: rgba(252, 165, 165, 0.9);
}

.chat-actions-overlay--desktop .chat-actions-delete:hover,
.chat-actions-overlay--desktop .chat-actions-delete:focus-visible {
  background: rgba(220, 38, 38, 0.12);
  color: #fca5a5;
}

body.chat-has-messages .composer-disclaimer {
  display: block !important;
  width: min(100%, var(--chat-composer-max));
  margin: 8px auto 0 !important;
  padding: 0 12px;
  color: rgba(226, 232, 240, 0.6);
  text-align: center;
  line-height: 1.35;
}

.message-assistant .ai-thinking-shell {
  margin: 0 0 18px !important;
}

.message-assistant .ai-thinking-pill {
  gap: 9px !important;
}

.message-assistant .ai-thinking-orb,
.thought-summary-icon {
  width: 18px !important;
  height: 18px !important;
}

.message-assistant .ai-thinking-orb {
  position: relative !important;
  flex-shrink: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.82) !important;
  overflow: visible !important;
  animation: thinkOrbBreathe 1.8s ease-in-out infinite !important;
}

.message-assistant .ai-thinking-orb::before {
  content: "" !important;
  position: absolute !important;
  top: 1px !important;
  left: 4px !important;
  right: 4px !important;
  height: 8px !important;
  border: 1.6px solid currentColor !important;
  border-bottom: 0 !important;
  border-radius: 999px 999px 0 0 !important;
  background: transparent !important;
  box-shadow: 0 0 10px rgba(251, 146, 60, 0.18) !important;
}

.message-assistant .ai-thinking-orb::after {
  content: "" !important;
  position: absolute !important;
  left: 2px !important;
  right: 2px !important;
  top: 8px !important;
  bottom: 2px !important;
  background: currentColor !important;
  border-radius: 2.5px !important;
  box-shadow: 0 0 8px rgba(251, 146, 60, 0.18) !important;
}

@keyframes thinkOrbBreathe {
  0%, 100% { opacity: 0.78; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.message-assistant .ai-thinking-label,
.message-assistant .ai-thinking-elapsed,
.content .thought-summary {
  font-weight: 560 !important;
}

.thought-summary-icon {
  stroke-width: 2.1px;
  color: rgba(226, 232, 240, 0.78);
}

@media (min-width: 769px) {
  .box.conversations {
    width: min(380px, calc(100vw - 72px)) !important;
    max-width: min(380px, calc(100vw - 72px)) !important;
    padding: 18px !important;
    gap: 14px !important;
    background: rgba(8, 8, 10, 0.96) !important;
  }

  body:not(.desktop-nav-closed) .box.conversations {
    transform: translateX(0) !important;
  }

  body.desktop-nav-closed .box.conversations {
    transform: translateX(calc(-1 * min(380px, calc(100vw - 72px)) - 12px)) !important;
  }
}

/* ═══════════════════════════════════════════
   2026-05-04 — USER MESSAGE ACTIONS
   msg-body wrapper stacks content + actions
   vertically under the avatar row.
═══════════════════════════════════════════ */

/* Column wrapper: content on top, actions underneath */
.msg-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 0;
}

/* Action bar — always visible below message text */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  padding-top: 6px;
}

/* ── ICON BUTTONS (materialistic rounded-square) ── */
.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: rgba(148, 163, 184, 0.42);
  cursor: pointer;
  flex-shrink: 0;
  transition:
    background 0.2s cubic-bezier(0.2, 0, 0, 1),
    color 0.2s cubic-bezier(0.2, 0, 0, 1),
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  outline: none;
}
.msg-action-btn:hover {
  background: rgba(148, 163, 184, 0.08);
  color: rgba(203, 213, 225, 0.85);
  transform: scale(1.08);
}
.msg-action-btn:active {
  transform: scale(0.93);
  transition-duration: 0.06s;
}

/* SVG icons — natural weight */
.msg-action-icon {
  display: block;
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  stroke-width: 1.8;
}

/* Copy icon swap */
.msg-action-icon--copy  { display: block; }
.msg-action-icon--check { display: none;  }

.msg-copy-btn.msg-copy-ok {
  color: #4ade80;
  background: rgba(34, 197, 94, 0.08);
  animation: msgCopyPop 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg-copy-btn.msg-copy-ok .msg-action-icon--copy  { display: none; }
.msg-copy-btn.msg-copy-ok .msg-action-icon--check {
  display: block;
  animation: msgCheckDraw 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes msgCopyPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.2); }
  65%  { transform: scale(0.95); }
  100% { transform: scale(1); }
}
@keyframes msgCheckDraw {
  0%   { opacity: 0; transform: scale(0.3) rotate(-20deg); }
  50%  { opacity: 1; transform: scale(1.1) rotate(3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* ── VERSION NAVIGATION ── */
.msg-version-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  font-family: 'Inter', sans-serif;
}
.msg-version-nav--hidden { display: none; }

.msg-version-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(148, 163, 184, 0.45);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  outline: none;
  -webkit-tap-highlight-color: transparent;
  line-height: 1;
  padding: 0;
}
.msg-version-arrow:hover {
  background: rgba(148, 163, 184, 0.1);
  color: rgba(226, 232, 240, 0.85);
  transform: scale(1.12);
}
.msg-version-arrow:active { transform: scale(0.88); }

.msg-version-label {
  font-size: 0.72rem;
  color: rgba(148, 163, 184, 0.48);
  min-width: 26px;
  text-align: center;
  user-select: none;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* ── SLIDE ANIMATIONS ── */
.msg-slide-out-left  { animation: msgSlideOutL 0.18s ease forwards; pointer-events: none; }
.msg-slide-out-right { animation: msgSlideOutR 0.18s ease forwards; pointer-events: none; }
.msg-slide-in-left   { animation: msgSlideInL  0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.msg-slide-in-right  { animation: msgSlideInR  0.24s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

@keyframes msgSlideOutL { to { opacity: 0; transform: translateX(-16px); } }
@keyframes msgSlideOutR { to { opacity: 0; transform: translateX(16px); } }
@keyframes msgSlideInL  { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: translateX(0); } }
@keyframes msgSlideInR  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: translateX(0); } }

/* ── EDIT MODE ── */
.msg-edit-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  animation: msgEditIn 0.2s ease;
}
@keyframes msgEditIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.msg-edit-input {
  width: 100%;
  min-height: 36px;
  max-height: 180px;
  padding: 8px 12px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.5);
  color: #f1f5f9;
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.88rem, calc(0.82rem + 0.18vw), 1rem);
  line-height: 1.5;
  resize: none;
  outline: none;
  overflow-y: auto;
  transition: border-color 0.2s ease;
}
.msg-edit-input:focus {
  border-color: rgba(148, 163, 184, 0.32);
}

.msg-edit-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.msg-edit-cancel,
.msg-edit-save {
  padding: 5px 14px;
  border-radius: 8px;
  border: none;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.msg-edit-cancel {
  background: rgba(148, 163, 184, 0.1);
  color: rgba(148, 163, 184, 0.7);
}
.msg-edit-cancel:hover {
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
}
.msg-edit-save {
  background: rgba(148, 163, 184, 0.14);
  color: #e2e8f0;
}
.msg-edit-save:hover {
  background: rgba(148, 163, 184, 0.22);
  color: #fff;
}
.msg-edit-save:active,
.msg-edit-cancel:active {
  transform: scale(0.96);
}

/* 2026-05-04 — Chat polish pass: sharper icons, compact thought chip, modern edit shell. */
.content .thought-summary {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  width: auto;
  margin: 0 0 10px !important;
  padding: 6px 11px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.09), rgba(56, 189, 248, 0.06)),
    rgba(7, 11, 20, 0.86) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: rgba(226, 232, 240, 0.86) !important;
  font-size: 0.75rem !important;
  font-weight: 560 !important;
  letter-spacing: 0.01em !important;
  line-height: 1.05 !important;
  text-transform: none !important;
}

.thought-summary-icon {
  width: 13px !important;
  height: 13px !important;
  flex: 0 0 13px;
  color: rgba(125, 211, 252, 0.92);
  stroke-width: 2.2px;
  shape-rendering: geometricPrecision;
}

.msg-actions {
  gap: 4px;
  padding-top: 8px;
}

.msg-action-btn {
  width: 32px;
  height: 32px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.4);
  color: rgba(226, 232, 240, 0.58);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.05);
}

.msg-action-btn:hover {
  border-color: rgba(148, 163, 184, 0.3);
  background: linear-gradient(135deg, rgba(148, 163, 184, 0.13), rgba(56, 189, 248, 0.09));
  color: rgba(248, 250, 252, 0.95);
  transform: translateY(-1px) scale(1.04);
}

.msg-action-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2.15;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
}

.msg-version-nav {
  margin-left: 8px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.36);
}

.msg-version-arrow {
  width: 26px;
  height: 26px;
  border-radius: 999px;
}

.msg-version-label {
  min-width: 40px;
  font-size: 0.7rem;
  color: rgba(191, 219, 254, 0.82);
}

.msg-edit-wrap {
  gap: 10px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(251, 146, 60, 0.24);
  background:
    radial-gradient(circle at top right, rgba(251, 146, 60, 0.14), transparent 42%),
    rgba(7, 11, 20, 0.86);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.34);
  animation: msgEditIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-edit-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.msg-edit-title {
  font-size: 0.77rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(251, 191, 36, 0.94);
}

.msg-edit-hint {
  font-size: 0.69rem;
  color: rgba(148, 163, 184, 0.85);
}

.msg-edit-input {
  min-height: 42px;
  max-height: 220px;
  padding: 11px 13px;
  border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(2, 6, 23, 0.72);
  color: #f8fafc;
  font-size: 0.92rem;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.msg-edit-input:focus {
  border-color: rgba(251, 146, 60, 0.5);
  box-shadow:
    0 0 0 3px rgba(251, 146, 60, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.msg-edit-controls {
  gap: 8px;
}

.msg-edit-cancel,
.msg-edit-save {
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 0.8rem;
  font-weight: 650;
}

.msg-edit-cancel {
  background: rgba(51, 65, 85, 0.5);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(226, 232, 240, 0.86);
}

.msg-edit-save {
  background: linear-gradient(135deg, rgba(251, 146, 60, 0.9), rgba(245, 158, 11, 0.9));
  border-color: rgba(251, 191, 36, 0.55);
  color: #0f172a;
  box-shadow: 0 10px 24px rgba(251, 146, 60, 0.28);
}

/* 2026-05-04 — Compact user-bubble pass + edit-scroll polish. */
.message-user .msg-body {
  flex: 0 1 auto;
  width: fit-content;
  max-width: min(560px, calc(100% - 54px));
  align-items: flex-end;
}

.message-user .content {
  max-width: 100%;
  padding: 9px 12px;
  border-radius: 14px;
}

.message-user .content p,
.message-user .content li {
  font-size: 0.9rem;
  line-height: 1.48;
}

/* Revert thought line to pre-refresh presentation. */
.content .thought-summary {
  display: flex !important;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0 0 16px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(226, 232, 240, 0.68) !important;
  box-shadow: none !important;
  font-size: 0.95rem !important;
  font-weight: 400 !important;
  line-height: 1.35 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.thought-summary-icon {
  width: 15px !important;
  height: 15px !important;
  flex: 0 0 15px;
  color: rgba(226, 232, 240, 0.7) !important;
  stroke-width: 2.1px;
}

.msg-edit-wrap {
  gap: 12px;
  padding: 14px;
  border-radius: 22px;
  border-color: rgba(251, 146, 60, 0.28);
  background:
    radial-gradient(circle at top right, rgba(251, 146, 60, 0.16), transparent 40%),
    rgba(7, 11, 20, 0.92);
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.36);
  transform-origin: top right;
  animation: msgEditIn 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-edit-head {
  gap: 12px;
}

.msg-edit-title {
  font-size: 0.78rem;
}

.msg-edit-hint {
  font-size: 0.71rem;
}

.msg-edit-input {
  min-height: 52px;
  max-height: 320px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 0.96rem;
  line-height: 1.56;
  border-color: rgba(251, 146, 60, 0.32);
  background: rgba(2, 6, 23, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.55) rgba(2, 6, 23, 0.36);
}

.msg-edit-input::-webkit-scrollbar {
  width: 9px;
}

.msg-edit-input::-webkit-scrollbar-track {
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.45);
}

.msg-edit-input::-webkit-scrollbar-thumb {
  border-radius: 10px;
  border: 2px solid rgba(2, 6, 23, 0.55);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.72), rgba(100, 116, 139, 0.82));
}

.msg-edit-input::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.86), rgba(148, 163, 184, 0.9));
}

/* 2026-05-05 - Keep the AI disclaimer in the single composer instead of letting
   welcome chips, messages, or the viewport edge push it out of view.
   2026-05-05 - Render below the welcome chips and force a single line; shrink
   the text responsively rather than wrapping on narrow screens. */
.conversation .user-input .composer-disclaimer,
body.chat-welcome-active .conversation .user-input .composer-disclaimer,
body.chat-has-messages .conversation .user-input .composer-disclaimer {
  display: block !important;
  flex: 0 0 auto;
  order: 1;
  width: 100%;
  max-width: 100%;
  margin: 8px auto 0 !important;
  padding: 0 8px;
  color: rgba(226, 232, 240, 0.66);
  font-size: clamp(0.5rem, 2.4vw, 0.72rem);
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
}

body.chat-welcome-active .conversation {
  min-height: 0;
}

.conversation .user-input {
  display: flex !important;
  flex-direction: column;
  flex: 0 0 auto;
}

.conversation #messages {
  min-height: 0;
}

/* ==========================================================
   Voice Input — listening + typewriter (2026-05-08)
   All animation driven by class/attribute toggling in voice-input.js.
   No JS-injected styles — CSP-safe.
   ========================================================== */

/* Color tokens */
:root {
  --voice-cyan: #22d3ee;
  --voice-cyan-soft: rgba(34, 211, 238, 0.55);
  --voice-cyan-fade: rgba(34, 211, 238, 0);
  --voice-scanline: rgba(34, 211, 238, 0.18);
}

/* Audio-reactive level (0..1) — voice-input.js writes this on the composer
   surface every animation frame; CSS below uses it to scale the halo, the
   EQ bars, and the pulse rings. Defaults to 0 when idle. */
.composer-surface {
  --voice-level: 0;
}

/* ── Press burst ─────────────────────────────────────────── */
#composer-mic-button {
  position: relative;
  overflow: visible;
  transition: color 160ms ease;
}

.mic-burst {
  display: none;
  pointer-events: none;
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.mic-burst::before,
.mic-burst::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
  border: 1.5px solid var(--voice-cyan);
  opacity: 0;
}

#composer-mic-button.mic-burst-active .mic-burst {
  display: block;
}

#composer-mic-button.mic-burst-active .mic-burst::before {
  animation: voiceBurstOuter 600ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#composer-mic-button.mic-burst-active .mic-burst::after {
  animation: voiceBurstInner 600ms 80ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes voiceBurstOuter {
  0%   { transform: scale(1);    opacity: 1; }
  100% { transform: scale(2.5);  opacity: 0; }
}

@keyframes voiceBurstInner {
  0%   { transform: scale(1);    opacity: 0.9; }
  100% { transform: scale(1.8);  opacity: 0; }
}

/* Button scale on press */
#composer-mic-button.mic-burst-active {
  animation: voiceBtnPress 300ms ease forwards;
}

@keyframes voiceBtnPress {
  0%   { transform: scale(1); }
  40%  { transform: scale(0.92); }
  75%  { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* ── Listening pulse ─────────────────────────────────────── */
#composer-mic-button.mic-listening {
  color: var(--voice-cyan);
  /* The mic button itself rides the voice level — a tiny breath that
     swells slightly when the user speaks louder. */
  transform: scale(calc(1 + var(--voice-level, 0) * 0.08));
  transition: transform 90ms ease-out, color 160ms ease;
}

#composer-mic-button.mic-listening::before,
#composer-mic-button.mic-listening::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1.5px solid var(--voice-cyan-soft);
  animation: voicePulse 1.4s ease-out infinite;
  pointer-events: none;
  /* Pulse ring opacity rides the voice level so quiet = subtle, loud = bold. */
  opacity: calc(0.5 + var(--voice-level, 0) * 0.5);
}

#composer-mic-button.mic-listening::after {
  animation-delay: 0.7s;
}

@keyframes voicePulse {
  0%   { transform: scale(1);    opacity: 0.9; }
  70%  { transform: scale(1.6);  opacity: 0; }
  100% { transform: scale(1.6);  opacity: 0; }
}

/* ── EQ bars ────────────────────────────────────────────── */
.mic-eq {
  display: none;
  position: absolute;
  bottom: 3px;
  right: 3px;
  align-items: flex-end;
  gap: 1px;
  height: 11px;
  pointer-events: none;
}

.mic-eq span {
  display: block;
  width: 2px;
  height: 3px;
  border-radius: 1px;
  background: var(--voice-cyan);
  /* Voice level multiplies the bar's vertical scale — quiet = barely
     moving; loud = full swing. The keyframes below provide rhythm; this
     transform provides amplitude. */
  transform-origin: bottom center;
  transform: scaleY(calc(0.4 + var(--voice-level, 0) * 1.4));
  transition: transform 70ms ease-out;
}

#composer-mic-button.mic-listening .mic-eq {
  display: flex;
}

#composer-mic-button.mic-listening .mic-eq span:nth-child(1) {
  animation: eqBar1 0.65s ease-in-out infinite alternate;
}

#composer-mic-button.mic-listening .mic-eq span:nth-child(2) {
  animation: eqBar2 0.85s ease-in-out 120ms infinite alternate;
}

#composer-mic-button.mic-listening .mic-eq span:nth-child(3) {
  animation: eqBar3 0.55s ease-in-out 240ms infinite alternate;
}

@keyframes eqBar1 {
  from { height: 3px; }
  to   { height: 11px; }
}

@keyframes eqBar2 {
  from { height: 5px; }
  to   { height: 9px; }
}

@keyframes eqBar3 {
  from { height: 3px; }
  to   { height: 11px; }
}

/* ── Permission error shake ─────────────────────────────── */
@keyframes voiceMicError {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-4px); }
  40%       { transform: translateX(4px); }
  60%       { transform: translateX(-3px); }
  80%       { transform: translateX(3px); }
}

#composer-mic-button.mic-error {
  animation: voiceMicError 240ms ease;
}

/* ── Composer surface — outer cyan halo (listening + typing) ─────────
   Replaces the old tight border/inset highlight. The halo lives on
   .composer-surface itself via box-shadow stacks, with each layer's
   spread + alpha riding --voice-level so the glow visibly inflates with
   the user's voice. A slow breath baseline (driven by JS) keeps it
   alive when quiet. */
.composer-surface {
  position: relative;
}

[data-voice-state="listening"] .composer-surface,
[data-voice-state="typing"] .composer-surface {
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, calc(0.30 + var(--voice-level, 0) * 0.45)),
    0 0 calc(10px + var(--voice-level, 0) * 28px) rgba(34, 211, 238, calc(0.22 + var(--voice-level, 0) * 0.40)),
    0 0 calc(34px + var(--voice-level, 0) * 70px) rgba(34, 211, 238, calc(0.10 + var(--voice-level, 0) * 0.28));
  transition: box-shadow 90ms linear;
}

/* Scanline sweep — typing only */
[data-voice-state="typing"] .composer-surface::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--voice-scanline);
  pointer-events: none;
  z-index: 1;
  animation: voiceScanline 2.4s linear infinite;
}

@keyframes voiceScanline {
  0%   { top: 0%; }
  100% { top: 100%; }
}

/* Textarea no longer carries its own border highlight — the halo lives on
   the surrounding surface. We keep the transition so the input doesn't
   visually fight the halo when state flips. */
[data-voice-state="listening"] #message-input,
[data-voice-state="typing"] #message-input {
  transition: border-color 200ms ease, box-shadow 200ms ease;
}

/* Blinking caret */
[data-voice-state="typing"] .composer-surface::after {
  content: '▍';
  position: absolute;
  left: var(--caret-x, 0px);
  top: var(--caret-y, 0px);
  color: var(--voice-cyan);
  font-size: 0.85em;
  line-height: 1;
  pointer-events: none;
  z-index: 2;
  animation: voiceCaret 1s step-end infinite;
}

@keyframes voiceCaret {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* ── Reduced motion overrides ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .mic-burst,
  .mic-burst::before,
  .mic-burst::after,
  .mic-eq span,
  #composer-mic-button.mic-listening::before,
  #composer-mic-button.mic-listening::after,
  [data-voice-state="typing"] .composer-surface::before,
  [data-voice-state="typing"] .composer-surface::after,
  #composer-mic-button.mic-burst-active,
  #composer-mic-button.mic-error {
    animation: none !important;
    opacity: 1;
  }
}

