        
        @font-face {
            font-family: 'SYN';
            src: url('https://cdn.synthenis.com/fonts/syn.woff2') format('woff2');
            font-weight: 400 900;
            font-style: normal;
            font-display: swap;
        }

        @font-face {
            font-family: 'Default';
            src: url('data:font/woff2;base64,d09GMk9UVE8AAAM0AAkAAAAABcgAAALuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADYJIBmAAfgE2AiQDDAQGBYRyByAbIwVRlKvJFsDPBJtObcFDgzooFmKOOuZpZMG4Jg7aB8Nn8fzDvXrufz9r8tgCAU4XFVvjosSo0yqWv9Z+b8++or6Y3y3ikk0laqIkfBkSQzINien2vweAH79N8JdohCbbWndr/HZ5v86kXxrEqV+cqnlKNBcLjY0Bj8Ka512LSgsolgt1Wa1Wr27atM/jBW21RrW55g21jw81IoJNHn2c/z24BlCQTVVvW09zVvtAY1dzeOZwYxugoDCNO2g8kMZDDRpPRuPFajC3qWY31RzV9+loj/h/e6ud/0/bfxcbEILkKpVrQNhwTzuJycoVI0S9RjZZES7WjkQvApCsAhsUn3SuWdP3UZ0zRZT+X1OW1h0OGr9NflM3xRvmiClHqQORzvz/tQbQb7L8b7XUFdZrb+h13MhqctFw/8PP+snI1CnebrExOvET/Fh/hn+knPwQZw89wnNvi+62ERUZoHLr9BC1nCwROqghul1go6hTCVTs54ZppNw6x+jkYtzYdoEMTuGT8KCP/A/hDIeWUloqM4VXWm2g5T0CrvPF5g3kAs04zXJGkI7P96za7LmtKwgBAmhGzB07gBpPeEUAKyzEwwWJxIBzFaQeHZwg6BYQxo6W2Qwz739fUTpv+v/c+Xy3Sv6VF/uN3w8uFpdbNkDuXnWVGkBhvGn75R1LYEgq295Z+QHimbpBIbxAAQtPAhA2QAAaMjYQQHHzONnK8R1EFN9lrZmfUxvmFzjzl5dsLLNQqwDEx+49z7B0yrNi3SQ58LwmAy/AqeOtOWduzoY8+2s/wMFgbxAWiEesMNZAalIE2r8JllitrXeokZEbwVJpR0hSXFLwa+wftjSPNWMSERMRGxMrEi0DVYcfdnhxQ66Eqt62nmYsq32gsaspM4cb2ypPtQ531Q+IIoj9J0lKy0pzkjTFKxoOtd8ODLb39mD0t/UONT71Ry6QDBlaIonr767vbJaUtzSPNQOBmOXFihFLROyYXvXnrUOTszoAAA==') format('woff2');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
            ascent-override: 90%;
            descent-override: 20%;
        }

        .toast-container {
            position: fixed;
            top: 12px;
            right: 12px;
            z-index: 2147483647;
            display: flex;
            flex-direction: column;
            gap: 6px;
            pointer-events: none;
        }
        .toast-notification {
            background: #2f2f2f;
            border: none;
            border-radius: 20px;
            padding: 12px 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 260px;
            max-width: 360px;
            pointer-events: auto;
            transform: translateX(calc(100% + 24px));
            opacity: 0;
            cursor: grab;
            user-select: none;
            touch-action: pan-x;
            transition: transform 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.32s cubic-bezier(0.4,0,0.2,1);
        }
        .toast-notification:active { cursor: grabbing; }
        .toast-notification.swiping { transition: none !important; }
        .toast-notification.show {
            transform: translateX(0);
            opacity: 1;
            animation: none !important;
        }
        .toast-icon {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .toast-icon img {
            width: 20px;
            height: 20px;
            pointer-events: none;
            user-select: none;
            filter: brightness(0) invert(1);
        }
        .toast-content { flex: 1; }
        .toast-title {
            font-size: 13px;
            font-weight: 700;
            color: #ffffff;
            margin-bottom: 3px;
            line-height: 1.3;
        }
        .toast-message {
            font-size: 12px;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.9);
            line-height: 1.4;
        }
        .toast-close {
            background: rgba(255, 255, 255, 0.07);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: #ffffff;
            cursor: pointer;
            padding: 0;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .toast-close img {
            width: 14px;
            height: 14px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
            -webkit-user-drag: none;
            filter: brightness(0) invert(1);
        }
        .toast-close:hover {
            background: rgba(255, 255, 255, 0.14);
            border-color: rgba(255, 255, 255, 0.22);
        }
        .toast-close:active {
            transform: scale(0.95);
        }
        @media (max-width: 768px) {
            .toast-notification {
                min-width: 240px;
                max-width: calc(100vw - 24px);
                padding: 10px 12px;
            }
            .toast-title { font-size: 12px; }
            .toast-message { font-size: 11px; }
        }
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent !important;
            -webkit-touch-callout: none;
            cursor: default;
        }
        ::selection {
            background-color: var(--selection-bg);
            color: var(--selection-color);
        }

        ::-moz-selection {
            background-color: var(--selection-bg);
            color: var(--selection-color);
        }

        .message.user ::selection {
            background-color: var(--user-selection-bg, color-mix(in oklab, var(--selection-bg) 65%, white));
            color: #ffffff;
        }

        .message.user ::-moz-selection {
            background-color: var(--user-selection-bg, color-mix(in oklab, var(--selection-bg) 65%, white));
            color: #ffffff;
        }
        :root {
            --primary: #212121;
            --secondary: #212121;
            --accent: #2f2f2f;
            --accent-hover: #3a3a3a;
            --surface: #2f2f2f;
            --surface-hover: #3a3a3a;
            --text-primary: #ececec;
            --text-secondary: #b4b4b4;
            --text-muted: #818181;
            --border: rgba(255,255,255,0.1);
            --success: #04b84c;
            --error: #fa423e;
            --warning: #f59e0b;
            --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
            --blur: backdrop-filter: blur(1px);
            --custom-color: #6366f1;
            --custom-color-hover: #5855eb;
            --custom-gradient: linear-gradient(135deg, var(--custom-color) 0%, var(--custom-color-hover) 100%);
            --selection-color: #ffffff;
            --selection-bg: #394a5b;
            --btn-accent: #ffffff;
            --btn-accent-hover: #f9f9f9;
            --btn-accent-fg: #0d0d0d;
            --user-bubble-bg: #303030;
            --send-bg: #ffffff;
            --send-bg-hover: #ececec;
            --send-fg: #0d0d0d;
            --chat-width: 768px;
            --sidebar-width: 250px;
            --input-height: 56px;
            --message-spacing: 24px;
            --user-bubble: #2B7CE6;
            --assistant-bg: transparent;
            --border-radius: 12px;

            --send-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            --toggle-track-off: #545454;
            --toggle-track-on: #0285ff;
            --toggle-thumb-off: #ececec;
            --toggle-thumb-on: #ffffff;
            --dir: 1;
            --button-bg-hover: rgba(255,255,255,0.1);
            --button-bg-active: rgba(255,255,255,0.05);
            --button-bg-hover-light: rgba(255,255,255,0.1);
            --bg-dark: #171717;
            --bg-darker: #0d0d0d;
            --bg-modal: #2f2f2f;
            --bg-modal-body: #212121;
            --bg-footer: #171717;
            --menu-border: rgba(255,255,255,0.15);
            --menu-divider: rgba(255,255,255,0.08);
            --sep: rgba(255,255,255,0.15);
            --sep-soft: rgba(255,255,255,0.08);
            --fill-code: #2f2f2f;
            --anchor: #60a5fa;
            --anchor-hover: #3b82f6;
            --shadow-sm: 0 1px 3px rgba(0,0,0,0.24);
            --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
            --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.4);
        }

        [data-theme="light"] {
            --primary: #ffffff;
            --secondary: #f9f9f9;
            --accent: #f3f3f3;
            --accent-hover: #ececec;
            --surface: #f4f4f4;
            --surface-hover: #ececec;
            --text-primary: #0d0d0d;
            --text-secondary: #5d5d5d;
            --text-muted: #8f8f8f;
            --border: rgba(0,0,0,0.1);
            --success: #04b84c;
            --error: #fa423e;
            --warning: #f59e0b;
            --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
            --custom-gradient: linear-gradient(135deg, var(--custom-color) 0%, var(--custom-color-hover) 100%);
            --selection-bg: #b3d4fc;
            --selection-color: #0d0d0d;
            --btn-accent: #0d0d0d;
            --btn-accent-hover: #1c1c1c;
            --btn-accent-fg: #ffffff;
            --user-bubble-bg: #ececec;
            --send-bg: #0d0d0d;
            --send-bg-hover: #1c1c1c;
            --send-fg: #ffffff;
            --chat-width: 768px;
            --sidebar-width: 250px;
            --input-height: 56px;
            --message-spacing: 24px;
            --user-bubble: #2B7CE6;
            --assistant-bg: transparent;
            --border-radius: 12px;

            --send-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
            --toggle-track-off: #cdcdcd;
            --toggle-track-on: #0285ff;
            --toggle-thumb-off: #ffffff;
            --toggle-thumb-on: #ffffff;
            --dir: 1;
            --button-bg-hover: rgba(0,0,0,0.05);
            --button-bg-active: rgba(0,0,0,0.08);
            --button-bg-hover-light: rgba(0,0,0,0.05);
            --bg-dark: #f9f9f9;
            --bg-darker: #ffffff;
            --bg-modal: #ffffff;
            --bg-modal-body: #f9f9f9;
            --bg-footer: #f9f9f9;
            --menu-border: rgba(0,0,0,0.1);
            --menu-divider: rgba(0,0,0,0.06);
            --sep: rgba(0,0,0,0.12);
            --sep-soft: rgba(0,0,0,0.06);
            --fill-code: #f3f3f3;
            --anchor: #0285ff;
            --anchor-hover: #0169cc;
            --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
            --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
            --shadow-dropdown: 0 4px 16px rgba(0,0,0,0.08);
        }

        [data-theme="light"] body {
            background: #ffffff !important;
            color: #0d0d0d !important;
        }

        [data-theme="light"] .ui-icon-white { filter: brightness(0) !important; }
        [data-theme="light"] .cdn-icon,
        [data-theme="light"] img[src*="cdn.synthenis.com/img/phosphor"] { filter: brightness(0) !important; }
        [data-theme="light"] .ui-icon-gray { filter: brightness(0) saturate(100%) invert(42%) sepia(0%) saturate(0%) brightness(60%) contrast(91%) !important; }
        [data-theme="light"] svg[fill="white"],
        [data-theme="light"] svg[fill="#fff"],
        [data-theme="light"] svg[fill="#ffffff"] { fill: #0d0d0d !important; }
        [data-theme="light"] svg[stroke="white"],
        [data-theme="light"] svg[stroke="#fff"],
        [data-theme="light"] svg[stroke="#ffffff"] { stroke: #0d0d0d !important; }

        [data-theme="light"] .switch-btn[aria-checked="false"] { background: #cdcdcd; }
        [data-theme="light"] .switch-btn .switch-thumb { background: #ffffff; }

        [data-theme="light"] .toast-notification { background: #ffffff; border: 1px solid #e0e0e0; box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
        [data-theme="light"] .toast-title { color: #0d0d0d; }
        [data-theme="light"] .toast-message { color: #5d5d5d; }
        [data-theme="light"] .toast-close { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #0d0d0d; }
        [data-theme="light"] .toast-close:hover { background: rgba(0,0,0,0.1); border-color: rgba(0,0,0,0.15); }
        [data-theme="light"] .toast-close img { filter: brightness(0) !important; }
        [data-theme="light"] .toast-icon img { filter: brightness(0) !important; }

        [data-theme="light"] .sidebar { background: #f9f9f9 !important; border-right-color: #e0e0e0 !important; }
        [data-theme="light"] .sidebar > *:not(.sidebar-footer) { background: #ffffff !important; }
        [data-theme="light"] .sidebar .sidebar-footer { background: #f9f9f9 !important; }
        [data-theme="light"] .sidebar.open { background: #f9f9f9 !important; }
        [data-theme="light"] .sidebar:not(.collapsed) { background: #f9f9f9 !important; }

        [data-theme="light"] .chat-item:hover::before { background: rgba(0,0,0,0.04); box-shadow: inset 0 1px 0 rgba(0,0,0,0.03), inset 0 -1px 0 rgba(0,0,0,0.03), 0 0 0 1px rgba(0,0,0,0.03); }
        [data-theme="light"] .chat-item.menu-open::before { background: rgba(0,0,0,0.04); }
        [data-theme="light"] .chat-item.hover-box.menu-open { background: #ececec !important; color: #0d0d0d !important; }
        [data-theme="light"] .chat-item.hover-box.active { background: #ececec !important; color: #0d0d0d !important; }
        [data-theme="light"] .chat-menu-trigger { color: #0d0d0d; }
        [data-theme="light"] #chatMenu button { color: #0d0d0d; }
        [data-theme="light"] #chatMenu button:hover { color: #0d0d0d; }
        [data-theme="light"] #chatMenu .divider, [data-theme="light"] #chatMenu hr { background: rgba(0,0,0,0.08); }
        [data-theme="light"] #chatMenu button.danger { color: #d32f2f; }
        [data-theme="light"] #chatMenu button.danger:hover { background: rgba(211,47,47,0.08); color: #d32f2f; }
        [data-theme="light"] #chatMenu button.danger img.ui-icon-white { filter: brightness(0) sepia(1) saturate(5) hue-rotate(0deg); }
        [data-theme="light"] .sidebar-action:hover { background: transparent !important; }

        [data-theme="light"] .header { background: rgba(255,255,255,0.85) !important; }
        [data-theme="light"] .header.shadow-visible { box-shadow: 0 6px 20px rgba(255,255,255,0.5), 0 2px 8px rgba(0,0,0,0.06) !important; }
        [data-theme="light"] .header::after { background: linear-gradient(to bottom, rgba(255,255,255,0.65), rgba(255,255,255,0) 100%) !important; }

        [data-theme="light"] .main-content { background: #ffffff !important; }
        [data-theme="light"] .messages-container { background: #ffffff !important; }
        [data-theme="light"] .messages-area { background: #ffffff !important; }
        [data-theme="light"] .input-area { background: #ffffff !important; }

        [data-theme="light"] .message.assistant .message-bubble { background: #ffffff !important; }
        [data-theme="light"] .message.user .message-bubble { color: #0d0d0d !important; }

        [data-theme="light"] .greeting { color: #0d0d0d; }

        [data-theme="light"] .message-text code { background: #f3f3f3 !important; color: var(--text-primary) !important; }
        [data-theme="light"] .message-text blockquote::after { background-color: rgba(0,0,0,0.15); }
        [data-theme="light"] .message-text blockquote blockquote::after { background-color: rgba(0,0,0,0.1); }
        [data-theme="light"] .message-text blockquote blockquote blockquote::after { background-color: rgba(0,0,0,0.06); }
        [data-theme="light"] .message-text th { border-bottom-color: rgba(0,0,0,0.12); }
        [data-theme="light"] .message-text hr { border-top-color: rgba(0,0,0,0.12); }

        [data-theme="light"] .code-block { background: #f4f4f4 !important; border-color: #e0e0e0 !important; }
        [data-theme="light"] .code-header { background: #f4f4f4 !important; border-bottom-color: #e0e0e0 !important; }
        [data-theme="light"] .code-lang-icon { filter: brightness(0) !important; }
        [data-theme="light"] .code-content { background: #f4f4f4 !important; }
        [data-theme="light"] .code-content pre { background: #f4f4f4 !important; color: #0d0d0d !important; }
        [data-theme="light"] .code-content pre code { background: #f4f4f4 !important; color: #0d0d0d !important; }
        [data-theme="light"] .code-output { background: #f3f3f3 !important; color: #0d0d0d !important; }
        [data-theme="light"] .code-header .code-actions .copy-btn:hover,
        [data-theme="light"] .code-header .code-actions .copy-btn:focus-visible,
        [data-theme="light"] .code-header .code-actions .run-btn:hover,
        [data-theme="light"] .code-header .code-actions .run-btn:focus-visible,
        [data-theme="light"] .code-header .copy-btn:hover,
        [data-theme="light"] .code-header .copy-btn:focus-visible,
        [data-theme="light"] .code-header .run-btn:hover,
        [data-theme="light"] .code-header .run-btn:focus-visible { background: #ececec !important; color: #0d0d0d !important; }

        [data-theme="light"] .tok-kw { color: #d73a49; }
        [data-theme="light"] .tok-lit { color: #6f42c1; }
        [data-theme="light"] .tok-str { color: #032f62; }
        [data-theme="light"] .tok-num { color: #6f42c1; }
        [data-theme="light"] .tok-cm { color: #6a737d; }
        [data-theme="light"] .tok-prop { color: #22863a; }
        [data-theme="light"] .tok-tag { color: #d73a49; }
        [data-theme="light"] .tok-attr { color: #22863a; }
        [data-theme="light"] .tok-ent { color: #005cc5; }
        [data-theme="light"] .tok-sel { color: #22863a; }
        [data-theme="light"] .tok-var { color: #0d0d0d; }
        [data-theme="light"] .tok-func { color: #005cc5; }
        [data-theme="light"] .tok-op { color: #d73a49; }

        [data-theme="light"] .modal-content { background: #ffffff; }
        [data-theme="light"] .modal-header { background: #ffffff; }
        [data-theme="light"] .modal-body { background: #f9f9f9; }
        [data-theme="light"] .modal-close { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); color: #0d0d0d; }
        [data-theme="light"] .modal-close:hover { background: rgba(0,0,0,0.1); color: #0d0d0d; }
        [data-theme="light"] .modal-close img { filter: brightness(0) !important; }

        [data-theme="light"] #settingsModal .modal-content { background: #ffffff; }
        [data-theme="light"] #settingsModal .modal-body { background: #ffffff; }
        [data-theme="light"] #settingsModal .modal-body::before { background: #ffffff; }
        [data-theme="light"] #settingsModal .modal-header { background: #ffffff !important; }
        [data-theme="light"] .settings-nav .settings-tab { color: #5d5d5d !important; }
        [data-theme="light"] .settings-nav .settings-tab img { filter: brightness(0) !important; }
        [data-theme="light"] .settings-nav .settings-tab svg { fill: #0d0d0d !important; stroke: #0d0d0d !important; }
        [data-theme="light"] .settings-nav .settings-tab.active svg { fill: #0d0d0d !important; stroke: #0d0d0d !important; }
        [data-theme="light"] .settings-nav .settings-tab:focus-visible { color: #0d0d0d !important; }
        [data-theme="light"] .settings-nav .settings-tab.active { color: #0d0d0d !important; }
        [data-theme="light"] #personalization-panel .setting-title { color: #0d0d0d !important; }
        [data-theme="light"] #personalization-panel .setting-description { color: #5d5d5d !important; }
        [data-theme="light"] #personalization-panel h4 { color: #0d0d0d !important; }
        [data-theme="light"] #personalization-panel h4 + div[style*="height:1px"] { background: rgba(0,0,0,0.1) !important; }
        [data-theme="light"] #personalization-panel .setting-item { border-bottom-color: rgba(0,0,0,0.06) !important; }

        [data-theme="light"] .select-trigger { color: #0d0d0d; }
        [data-theme="light"] select.custom-select { background: #ffffff; color: #0d0d0d; border-color: #e0e0e0; }

        [data-theme="light"] .markdown-table { border-color: #e0e0e0; }
        [data-theme="light"] .markdown-table th { background: #f3f3f3; color: #0d0d0d; border-color: #e0e0e0; border-bottom-color: #d0d0d0; }
        [data-theme="light"] .markdown-table td { border-color: #ececec; color: #0d0d0d; }
        [data-theme="light"] .markdown-table tbody tr:nth-child(odd) { background: #fafafa; }
        [data-theme="light"] .markdown-table tbody tr:nth-child(even) { background: #ffffff; }
        [data-theme="light"] .markdown-table tbody tr:hover { background: #f3f3f3; }
        [data-theme="light"] .markdown-table tbody tr:hover td { color: #0d0d0d; }

        [data-theme="light"] .table-block { background: #f4f4f4; }
        [data-theme="light"] .table-toolbar { background: #f4f4f4; border-bottom-color: #e0e0e0; }
        [data-theme="light"] .table-copy-btn:hover,
        [data-theme="light"] .table-export-btn:hover { background: #ececec; color: #0d0d0d; }
        [data-theme="light"] .table-block .markdown-table th { background: #f3f3f3; }
        [data-theme="light"] .table-block .markdown-table tbody tr:nth-child(odd) { background: #f4f4f4; }
        [data-theme="light"] .table-block .markdown-table tbody tr:nth-child(even) { background: #fafafa; }
        [data-theme="light"] .table-block .markdown-table tbody tr:hover { background: #ececec; }

        [data-theme="light"] .pasa-artifact-card { background: #f4f4f4; border-color: #e0e0e0; }
        [data-theme="light"] .pasa-artifact-card:hover { background: #ececec; border-color: #d0d0d0; }
        [data-theme="light"] .pasa-artifact-card-name { color: #0d0d0d; }
        [data-theme="light"] .pasa-artifact-card-type { color: #5d5d5d; }
        [data-theme="light"] .artifact-card { border-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .artifact-card:hover { background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.15); }
        [data-theme="light"] .artifact-thumbnail-inner { background: linear-gradient(to bottom, rgba(0,0,0,0.03), transparent); border-color: rgba(0,0,0,0.1); }
        [data-theme="light"] .artifact-thumbnail-inner img { filter: none; }
        [data-theme="light"] .artifact-title { color: rgba(0,0,0,0.85); }
        [data-theme="light"] .artifact-subtitle { color: rgba(0,0,0,0.4); }
        [data-theme="light"] .artifact-generating-card { background: #f4f4f4; border-color: #e0e0e0; }
        [data-theme="light"] .pasa-artifact-panel { background: #ffffff; border-left-color: #e0e0e0; }
        [data-theme="light"] .pasa-artifact-panel-header { background: #f9f9f9; border-bottom-color: #e0e0e0; }
        [data-theme="light"] .pasa-artifact-panel-title { color: #0d0d0d; }
        [data-theme="light"] .pasa-artifact-panel-tabs { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.08); }
        [data-theme="light"] .pasa-artifact-tab-slider { background: rgba(0,0,0,0.1); }
        [data-theme="light"] .pasa-artifact-panel-tab { color: rgba(0,0,0,0.45); }
        [data-theme="light"] .pasa-artifact-panel-tab:hover { color: rgba(0,0,0,0.75); }
        [data-theme="light"] .pasa-artifact-panel-tab.active { color: #0d0d0d; }
        [data-theme="light"] .pasa-artifact-panel-tab:disabled { color: rgba(0,0,0,0.22); }
        [data-theme="light"] .pasa-artifact-panel-btn { color: #5d5d5d; }
        [data-theme="light"] .pasa-artifact-panel-btn:hover { background: rgba(0,0,0,0.06); color: #0d0d0d; }
        [data-theme="light"] .pasa-artifact-panel-content { background: #ffffff; }
        [data-theme="light"] .pasa-artifact-panel-content pre { color: #0d0d0d; background: #f4f4f4; }
        [data-theme="light"] .pasa-artifact-overlay { background: rgba(0,0,0,0.2); }

        [data-theme="light"] #accountMenu { background: #ffffff !important; color: #0d0d0d !important; border-color: #e0e0e0 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important; }
        [data-theme="light"] #accountMenu button { color: #0d0d0d !important; }
        [data-theme="light"] #accountMenu #accountMenuEmailContainer { color: #5d5d5d !important; }
        [data-theme="light"] #accountMenu #accountMenuEmailContainer svg { stroke: #5d5d5d !important; }
        [data-theme="light"] #accountMenu button img { filter: brightness(0) !important; }
        [data-theme="light"] #accountMenu button svg { color: #0d0d0d !important; }
        [data-theme="light"] #accountMenu button svg[fill="white"] { fill: #0d0d0d !important; }

        [data-theme="light"] #iconModal { background: #ffffff !important; color: #0d0d0d !important; border-color: #e0e0e0 !important; }

        [data-theme="light"] .tools-menu { background: #ffffff !important; color: #0d0d0d !important; border-color: #e0e0e0 !important; box-shadow: 0 4px 16px rgba(0,0,0,0.1) !important; }
        [data-theme="light"] .tools-menu .tool-item { color: #0d0d0d !important; --button-background-color: #ececec; --button-background-color-active: #e0e0e0; }
        [data-theme="light"] .tools-menu .tool-item svg { color: #0d0d0d !important; }
        [data-theme="light"] .tools-menu .tool-item img { filter: brightness(0) !important; }

        [data-theme="light"] .floating-tooltip { background: #ffffff; color: #0d0d0d; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border: 1px solid #e0e0e0; }
        [data-theme="light"] .floating-tip::after { background: #ffffff; color: #0d0d0d; box-shadow: 0 4px 12px rgba(0,0,0,0.1); border: 1px solid #e0e0e0; }

        [data-theme="light"] .input-wrapper .tools-btn:hover,
        [data-theme="light"] .input-wrapper .tools-btn:focus-visible { background: #ececec !important; color: #0d0d0d !important; }
        [data-theme="light"] .input-wrapper .tools-btn .icon-plus,
        [data-theme="light"] .input-wrapper .tools-btn .icon-mic { color: #0d0d0d !important; }
        [data-theme="light"] .input-wrapper .tools-btn .icon-plus img,
        [data-theme="light"] .input-wrapper .tools-btn .icon-mic img { filter: brightness(0) !important; }
        [data-theme="light"] .input-wrapper .tools-btn.open { background: #ececec !important; color: #0d0d0d !important; }

        [data-theme="light"] .error-retry-btn { --button-background-color: #ececec; --button-background-color-active: #e0e0e0; }

        [data-theme="light"] .session-title { color: #0d0d0d; }
        [data-theme="light"] .session-avatar { background: #f3f3f3; }

        [data-theme="light"] .btn-ghost { color: #0d0d0d; }

        [data-theme="light"] .ask-to-synthenis-btn { background: #0d0d0d; border-color: #0d0d0d; color: #ffffff; }

        [data-theme="light"] .pai-shimmer { background: linear-gradient(90deg, #0d0d0d 42%, #5d5d5d 50%, #0d0d0d 58%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; }


        [data-theme="light"] .message-actions img { filter: brightness(0) !important; }

        [data-theme="light"] ::-webkit-scrollbar-thumb { background: #d0d0d0; }
        [data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: #b0b0b0; }

        [data-theme="light"] .button-container { background-color: #f3f3f3 !important; }

        [data-theme="light"] .skeleton { background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 37%, rgba(0,0,0,0.04) 63%); }
        [data-theme="light"] .skeleton-line { background: rgba(0,0,0,0.06); }
        [data-theme="light"] .skeleton-btn { background: rgba(0,0,0,0.06); }

        [data-theme="light"] #sidebarDisplayName { color: #0d0d0d !important; }
        [data-theme="light"] #sidebarPlanLabel { color: #5d5d5d !important; }
        [data-theme="light"] #sidebarToggleBtn { color: #0d0d0d; }

        [data-theme="light"] .sidebar.open { box-shadow: 0 10px 40px rgba(0,0,0,0.1) !important; }

        [data-theme="light"] .cosmos-memory-modal { background: #ffffff !important; }
        [data-theme="light"] .cosmos-memory-modal .memory-header { background: rgba(255,255,255,0.92) !important; }

        [data-theme="light"] #pastChatsLabel { color: #5d5d5d !important; }

        [data-theme="light"] .setting-title { color: #0d0d0d !important; }
        [data-theme="light"] .setting-description { color: #5d5d5d !important; }

        [data-theme="light"] .chat-info h1 { color: #0d0d0d; }
        [data-theme="light"] .chat-info h1:hover { background: #f3f3f3; }
        [data-theme="light"] .title-edit-input { color: #0d0d0d; background: #f4f4f4; border-color: #e0e0e0; }

        [data-theme="light"] .modal { background: rgba(0,0,0,0.4); }

        [data-theme="light"] .tw-ring-white\/10 { --tw-ring-color: rgba(0,0,0,0.06) !important; }

        [data-theme="light"] kbd { background: #f3f3f3 !important; color: #0d0d0d !important; border-color: #e0e0e0 !important; }

        [data-theme="light"] .template-card { background: #f4f4f4 !important; border-color: #e0e0e0 !important; }
        [data-theme="light"] .template-card .ui-icon-white { filter: brightness(0) !important; }
        [data-theme="light"] .template-card div[style*="color:var(--text-primary)"] { color: #0d0d0d !important; }

        [data-theme="light"] .tool-card:not(.tool-complete) .tool-status { background: linear-gradient(90deg, #5d5d5d 0%, rgba(0,0,0,0.4) 50%, #5d5d5d 100%) !important; }

        [data-theme="light"] .switch[data-state="unchecked"] { background: #cdcdcd !important; }

        [data-theme="light"] .message.user ::selection { background-color: rgba(0,0,0,0.15); color: #0d0d0d; }

        [data-theme="light"] #memoryModal > .custom-modal > div { background: #ffffff !important; border-color: rgba(0,0,0,0.08) !important; box-shadow: 0 20px 60px rgba(0,0,0,0.15) !important; }
        [data-theme="light"] #memoryModal > .custom-modal > div > div:first-child { background: rgba(255,255,255,0.92) !important; border-bottom-color: rgba(0,0,0,0.06) !important; }
        [data-theme="light"] #memoryModal h3 { color: #0d0d0d !important; }
        [data-theme="light"] #memoryModal p { color: rgba(0,0,0,0.5) !important; }
        [data-theme="light"] #memoryModal #closeMemoryModal { background: rgba(0,0,0,0.05) !important; border-color: rgba(0,0,0,0.1) !important; }
        [data-theme="light"] #memoryModal #closeMemoryModal img { filter: brightness(0) !important; }
        [data-theme="light"] #memoryModal #memoryListContent { background: rgba(0,0,0,0.02) !important; border-color: rgba(0,0,0,0.06) !important; color: rgba(0,0,0,0.85) !important; }
        [data-theme="light"] #memoryModal #memoryLoading { color: rgba(0,0,0,0.4) !important; }
        [data-theme="light"] #memoryModal #memoryLoading div { border-color: rgba(0,0,0,0.1) !important; border-top-color: rgba(0,0,0,0.4) !important; }
        [data-theme="light"] #memoryModal #memoryEmpty { color: rgba(0,0,0,0.35) !important; }

        [data-theme="light"] .tools-menu > div[style*="background:#3a3a3a"],
        [data-theme="light"] .tools-menu > div[style*="background: #3a3a3a"] { background: #e0e0e0 !important; }

        [data-theme="light"] #linkConfirmModal { background: rgba(0,0,0,0.3) !important; }
        [data-theme="light"] #reportAbuseModal { background: rgba(0,0,0,0.3) !important; }

        [data-theme="light"] .modal-header { border-bottom-color: rgba(0,0,0,0.06) !important; }

        [data-theme="light"] .sidebar-footer { background: #f9f9f9 !important; }

        [data-theme="light"] .sidebar > *:not(.sidebar-footer) { background: #ffffff !important; }

        [data-theme="light"] .sidebar-action svg { color: #0d0d0d !important; }
        [data-theme="light"] .sidebar-action .ui-icon-white { filter: brightness(0) !important; }
        [data-theme="light"] .sidebar-action { color: #0d0d0d !important; }

        [data-theme="light"] .chat-item { color: #0d0d0d !important; }
        [data-theme="light"] .chat-item .chat-title { color: #0d0d0d !important; }

        [data-theme="light"] .header-actions { background: rgba(255,255,255,0.85) !important; border-color: rgba(0,0,0,0.1) !important; box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important; }
        [data-theme="light"] .header-actions .header-btn { color: #0d0d0d !important; --button-background-color: rgba(0,0,0,0.05); --button-background-color-active: rgba(0,0,0,0.08); }
        [data-theme="light"] .header-actions .header-btn:focus-visible { outline-color: rgba(0,0,0,0.3); }
        [data-theme="light"] .header-actions .header-btn img { filter: brightness(0) !important; }

        [data-theme="light"] .send-btn svg { color: var(--send-fg, #ffffff) !important; }

        [data-theme="light"] .message-text { color: #0d0d0d !important; }
        [data-theme="light"] .message.user .message-text { color: #0d0d0d !important; }

        [data-theme="light"] ::selection { background-color: var(--selection-bg, #b3d4fc); color: var(--selection-color, #0d0d0d); }

        [data-theme="light"] .loading-screen { background: #ffffff !important; }

        [data-theme="light"] .sidebar .chat-item .chat-menu-trigger svg { color: #5d5d5d !important; }

        [data-theme="light"] #thinkMoreCounter { color: #5d5d5d !important; }

        [data-theme="light"] #templateCancel,
        [data-theme="light"] #projectWorkspaceCloseFooter,
        [data-theme="light"] #confirmCancel { color: rgba(0,0,0,0.75) !important; border-color: rgba(0,0,0,0.15) !important; }
        [data-theme="light"] #templateCancel:hover,
        [data-theme="light"] #projectWorkspaceCloseFooter:hover,
        [data-theme="light"] #confirmCancel:hover { background: rgba(0,0,0,0.05) !important; border-color: rgba(0,0,0,0.2) !important; }

        [data-theme="light"] .modal-footer { background: #f9f9f9 !important; }

        [data-theme="light"] .custom-modal { background: #ffffff !important; border-color: #e0e0e0 !important; }

        [data-theme="light"] .floating-button-group { background: rgba(255,255,255,0.85) !important; border-color: rgba(0,0,0,0.1) !important; box-shadow: 0 4px 16px rgba(0,0,0,0.08) !important; }
        [data-theme="light"] .floating-button-group .btn-icon { color: #0d0d0d !important; --button-background-color: rgba(0,0,0,0.05); --button-background-color-active: rgba(0,0,0,0.08); }
        [data-theme="light"] .floating-button-group .btn-icon img { filter: brightness(0) !important; }

        [data-theme="light"] .search-container { background: rgba(0,0,0,0.04) !important; border-color: rgba(0,0,0,0.08) !important; }
        [data-theme="light"] .search-container input { color: #0d0d0d !important; }
        [data-theme="light"] .search-container input::placeholder { color: #8f8f8f !important; }
        [data-theme="light"] .search-container svg { color: #8f8f8f !important; }

        [data-theme="light"] .modal-header { border-bottom-color: rgba(0,0,0,0.06); }

        [data-theme="light"] .modal-header h3 { color: #0d0d0d; }

        [data-theme="light"] .modal img[style*="brightness(0) invert(1)"] { filter: brightness(0) !important; }

        [data-theme="light"] .btn-primary { background-color: var(--btn-accent, #0d0d0d) !important; color: var(--btn-accent-fg, #ffffff) !important; }
        [data-theme="light"] .btn-primary:hover { background-color: var(--btn-accent-hover, #2f2f2f) !important; }
        [data-theme="light"] .btn-secondary { background-color: #ffffff; color: #0d0d0d; border-color: #e0e0e0; }
        [data-theme="light"] .btn-secondary:hover { background-color: #f4f4f4; }

        [data-theme="light"] .cosmos-activity-header:hover { background: transparent; }
        [data-theme="light"] .cosmos-activity-summary { color: rgba(0,0,0,0.5); }
        [data-theme="light"] .cosmos-activity-box.active .cosmos-activity-header { background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.03) 50%, transparent 100%); background-size: 200% 100%; }
        [data-theme="light"] .cosmos-activity-box.active .cosmos-activity-summary { color: rgba(0,0,0,0.7); }
        [data-theme="light"] .cosmos-activity-step { color: rgba(0,0,0,0.6); }
        [data-theme="light"] .cosmos-activity-steps .cosmos-activity-step:not(:first-child) { border-top-color: rgba(0,0,0,0.07) !important; }
        [data-theme="light"] .cosmos-activity-step .step-label { color: rgba(0,0,0,0.6); }
        [data-theme="light"] .cosmos-activity-step .step-badge { color: rgba(0,0,0,0.35); }
        [data-theme="light"] .cosmos-activity-step.done-step { color: rgba(0,0,0,0.35); }
        [data-theme="light"] .cosmos-activity-step.done-step .step-label { color: rgba(0,0,0,0.35); }
        [data-theme="light"] .cosmos-activity-step .step-icon { filter: none; opacity: 0.5; }
        [data-theme="light"] .cosmos-activity-box.error .cosmos-activity-summary { color: rgba(220,38,38,0.7); }

        [data-theme="light"] .sidebar-header { color: #0d0d0d; }
        [data-theme="light"] .sidebar-header .logo-text { color: #0d0d0d !important; }

        [data-theme="light"] #sidebarUserInfo .display-name { color: #0d0d0d !important; }

        [data-theme="light"] .hover-box { color: #0d0d0d !important; }
        [data-theme="light"] .hover-box:hover { background: #ececec !important; }

        [data-theme="light"] #accountMenu button[role="menuitem"] { color: #0d0d0d !important; }

        [data-theme="light"] .chat-item:hover::before { opacity: 1; background: rgba(0,0,0,0.04) !important; box-shadow: none !important; }

        [data-theme="light"] .floating-button-group { background: rgba(255,255,255,0.9) !important; border-color: rgba(0,0,0,0.08) !important; }
        [data-theme="light"] .floating-button-group .btn-icon { color: #0d0d0d !important; }

        [data-theme="light"] .bigChats:hover { border-color: color-mix(in oklab, var(--border) 75%, #000000 10%); background: color-mix(in oklab, var(--surface) 92%, #000000 4%); }

        [data-theme="light"] .skeleton::after { background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.06) 50%, transparent 100%) !important; }

        [data-theme="light"] .avatar-btn #avatarInitial { color: #0d0d0d !important; }
        [data-theme="light"] .avatar-btn img,
        [data-theme="light"] .header-btn.avatar-btn img { filter: none !important; }
        [data-theme="light"] .avatar-btn { background: #ececec !important; }
        [data-theme="light"] .avatar-btn:hover { background: #e3e3e3 !important; }
        [data-theme="light"] .profile-avatar-lg img { filter: none !important; }
        [data-theme="light"] .profile-avatar-lg { background: #ececec !important; }

        [data-theme="light"] .sidebar .action-btn { color: #0d0d0d !important; }
        [data-theme="light"] .sidebar .action-btn img { filter: brightness(0) !important; }

        [data-theme="light"] #chatTitle { color: #0d0d0d !important; }
        [data-theme="light"] .header-btn img { filter: brightness(0) !important; }

        [data-theme="light"] .sidebar .sidebar-header img { filter: brightness(0) !important; }

        [data-theme="light"] #confirmModal .custom-modal > div { background: #ffffff !important; }

        @media (max-width: 768px) {
            [data-theme="light"] #settingsModal .settings-nav[style] { border-bottom-color: rgba(0,0,0,0.06) !important; background: #ffffff !important; }
            [data-theme="light"] #settingsModal .modal-header { background: #ffffff !important; }
            [data-theme="light"] #settingsModal .modal-body { background: #ffffff !important; }
        }

        /* Force white tint for inline img-based UI icons */
        .ui-icon-white { filter: brightness(0) invert(1); }
        /* Global CDN icon styling */
        .cdn-icon, img[src*="cdn.synthenis.com/img/phosphor"] { pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; filter: brightness(0) invert(1); }
        .message-actions img, .message-actions svg { pointer-events: none; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
        .ui-icon-gray { filter: brightness(0) saturate(100%) invert(58%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(100%) contrast(91%); }
        /* Preserve brand colors for brand icons */
        .brand-icon { filter: none !important; }

        /* Switch button (Radix-like) theme-aware styles */
        .switch-btn {
            position: relative;
            box-sizing: border-box;
            width: 36px;
            height: 20px;
            padding: 2px;
            border-radius: 20px;
            color: inherit;
            border: none;
            outline: none;
            display: inline-flex;
            align-items: center;
            justify-content: flex-start;
            background: var(--toggle-track-off); /* off state */
            cursor: pointer;
            vertical-align: middle;
            user-select: none;
            touch-action: none;
        }
        /* On state track */
        .switch-btn[aria-checked="true"] { background: var(--toggle-track-on); }
        .switch-btn[aria-checked="false"] { background: var(--toggle-track-off); }
        .switch-btn:active .switch-thumb {
            box-shadow: none;
        }
        @media (max-width: 640px) {
            .setting-item { align-items: center; gap: 16px; }
            .setting-item > .switch-btn { margin-left: auto; }
            .setting-label { margin-right: 6px; }
            .settings-section { padding-left: 12px; padding-right: 12px; }
            .modal-content { width: calc(100vw - 24px); max-width: calc(100vw - 24px); margin: 0 auto; border-radius: 25px; }
        }
        .switch-thumb {
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: var(--toggle-thumb-off);
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            transform: translateX(0);
            box-shadow: 0 2px 8px rgba(0,0,0,0.15);
        }
        .switch-btn[aria-checked="true"] .switch-thumb { background: var(--toggle-thumb-on); transform: translateX(16px); }
        .switch-btn[aria-checked="true"] { justify-content: flex-start; }
        /* Slightly enlarge settings nav icons */
        .settings-nav img.ui-icon-white,
        .settings-nav svg { width: 20px !important; height: 20px !important; min-width: 20px !important; min-height: 20px !important; }
        /* Global switch styles (.switch) */
        .switch { position: relative; box-sizing: content-box; aspect-ratio: 7/4; flex-shrink: 0; border-radius: 9999px; background-color: var(--toggle-track-off); padding: 2px; height: 16px; border: none; cursor: pointer; outline: none; }
        .switch:focus-visible { box-shadow: 0 0 0 2px #3a3a3a, 0 0 0 4px rgba(55, 65, 81, 0.1); }
        .switch[data-state="checked"] { background-color: var(--toggle-track-on); }
        .switch:disabled { opacity: 0.5; }
        @media (prefers-color-scheme: dark) { .switch { background-color: var(--toggle-track-off); } .switch[data-state="checked"] { background-color: var(--toggle-track-on); } }
        .switch .switch-thumb { display: flex; aspect-ratio: 1; height: 100%; align-items: center; justify-content: center; border-radius: 9999px; background-color: #ffffff; transform: translateX(0); }
        .switch[data-state="checked"] .switch-thumb { transform: translateX(calc(var(--dir, 1) * 100% * (7/4 - 1))); }
        [dir="rtl"] { --dir: -1; }
        html, body { -webkit-user-select: text !important; user-select: text !important; }
        /* Allow selecting content where it matters */
        .message-text,
        .message-content,
        .code-content,
        .code-content pre,
        pre code,
        .mjx-container,
        .MathJax,
        mjx-container,
        [class*="mjx"],
        [class*="MathJax"] {
            -webkit-user-select: text !important;
            user-select: text !important;
        }
        input, textarea {
            -webkit-user-select: text;
            user-select: text;
        }
        button, .clickable, [role="button"] {
            outline: none !important;
            -webkit-appearance: none;
            appearance: none;
        }
        /* Keyboard accessibility: clear, consistent focus */
        button:focus-visible,
        .action-btn:focus-visible,
        .header-btn:focus-visible,
        .menu-toggle:focus-visible,
        .new-chat:focus-visible,
        .chat-item:focus-visible,
        .send-btn:focus-visible {
            outline: 2px solid var(--accent) !important;
            outline-offset: 2px !important;
        }
        /* Disabled state clarity */
        button:disabled,
        .action-btn:disabled,
        .new-chat:disabled {
            cursor: not-allowed !important;
            opacity: 0.55 !important;
        }
        .input-wrapper,
        .sidebar,
        .header,
        .message,
        .toggle-switch,
        .toggle-slider,
        .menu-toggle,
        .send-btn {
            transform: translateZ(0);
            -webkit-transform: translateZ(0);
            will-change: transform;
        }
        body {
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
            font-size: 16px;
            background: #212121;
            color: var(--text-primary);
            line-height: 1.6;
            overflow: hidden;
            height: 100vh;
            cursor: default;
            position: relative;
            user-select: text;
            -webkit-user-select: text;
        }
        picture.absolute {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            width: 100vw !important;
            height: 100vh !important;
            z-index: -1 !important;
        }
        picture img.blur-2xl {
            filter: blur(32px) !important;
        }
        .bg-gradient-to-b.from-transparent {
            background: linear-gradient(to bottom, transparent, rgba(38, 38, 36, 0.8));
        }
        [data-theme="dark"] .bg-gradient-to-b.from-transparent {
            background: linear-gradient(to bottom, transparent, rgba(15, 15, 35, 0.9));
        }

        [data-theme="dark"] picture img.dark\\:opacity-30 {
            opacity: 0.3 !important;
        }
        [data-theme="light"] .bg-gradient-to-b.from-transparent {
            background: linear-gradient(to bottom, transparent, rgba(255, 255, 255, 0.8));
        }

        [data-theme="light"] picture img.opacity-50 {
            opacity: 0.5 !important;
        }
        @media (max-width: 768px) {
            picture img.blur-2xl {
                filter: blur(24px) !important;
                opacity: 0.25 !important;
            }
            
            .bg-gradient-to-b.from-transparent {
                background: linear-gradient(to bottom, transparent, rgba(38, 38, 36, 0.9));
            }

            .bg-opacity-20 {
                background-color: rgba(0, 0, 0, 0.25) !important;
            }

            [data-theme="dark"] .dark\\:bg-opacity-30 {
                background-color: rgba(0, 0, 0, 0.35) !important;
            }
        }

        @media (max-width: 480px) {
            picture img.blur-2xl {
                filter: blur(20px) !important;
                opacity: 0.2 !important;
            }

            .bg-opacity-20 {
                background-color: rgba(0, 0, 0, 0.3) !important;
            }

            [data-theme="dark"] .dark\\:bg-opacity-30 {
                background-color: rgba(0, 0, 0, 0.4) !important;
            }
        }
        .absolute {
            position: absolute !important;
        }

        .inset-0 {
            top: 0 !important;
            right: 0 !important;
            bottom: 0 !important;
            left: 0 !important;
        }
        .h-full {
            height: 100% !important;
        }
        .w-full {
            width: 100% !important;
        }

        .overflow-hidden {
            overflow: hidden !important;
        }

        .object-cover {
            object-fit: cover !important;
        }
        .scale-\[1\.02\] {
            transform: scale(1.02) !important;
        }
        .bg-black {
            background-color: rgb(0, 0, 0) !important;
        }
        .bg-opacity-20 {
            background-color: rgba(0, 0, 0, 0.2) !important;
        }
        .dark\\:bg-opacity-30 {
            background-color: rgba(0, 0, 0, 0.2) !important;
        }
        [data-theme="dark"] .dark\\:bg-opacity-30 {
            background-color: rgba(0, 0, 0, 0.3) !important;
        }
        img {
            -webkit-user-drag: none;
            -khtml-user-drag: none;
            -moz-user-drag: none;
            -o-user-drag: none;
            pointer-events: none;
        }
        .message-content,
        .message-content *,
        .message-text,
        .message-text *,
        #messageInput,
        #messageInput *,
        input[type="text"],
        input[type="password"],
        input[type="email"],
        textarea {
            user-select: text !important;
            -webkit-user-select: text !important;
            -moz-user-select: text !important;
            -ms-user-select: text !important;
        }

        button,
        a,
        input,
        textarea,
        select,
        .clickable,
        [role="button"],
        [onclick] {
            pointer-events: auto;
        }

        button, .header-btn, .send-btn, .new-chat, .action-btn, .chat-item {
            cursor: pointer !important;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }
        input, textarea, select {
            cursor: text !important;
        }

        .app {
            display: flex;
            height: 100vh;
            position: relative;
            z-index: 1;
        }

        .sidebar {
            width: var(--sidebar-width);
            background: var(--bg-dark);
            border-right: 1px solid var(--border);
            display: flex;
            flex-direction: column;
            position: relative;
            z-index: 100;
            box-shadow: none;
            transform: translateX(0);
            opacity: 1;
            transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                        opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                        width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                        min-width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                        margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .sidebar.sidebar-hidden {
            transform: translateX(-100%);
            opacity: 0;
            pointer-events: none;
            width: 0;
            min-width: 0;
            margin-left: calc(-1 * var(--sidebar-width));
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
        }
        .sidebar.open {
            transform: translateX(0) !important;
            opacity: 1 !important;
            pointer-events: auto !important;
        }
        @media (min-width: 769px) {
            .sidebar {
            }
        }
        .sidebar > *:not(.sidebar-footer) { background: var(--bg-darker); }

        .sidebar-header {
            padding: 12px 12px;
            border-bottom: none;
        }

        .search-container {
            margin-bottom: 16px;
            position: relative;
            display: flex;
            align-items: center;
            gap: 8px;
            height: 40px;
            padding: 0 8px;
            border-radius: 9999px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text-primary);
        }

        .search-container:focus-within {
            border-color: var(--border);
            box-shadow: none;
            background: var(--surface);
        }

        /* Larger and clearer search icon */
        .search-container > svg { width: 24px; height: 24px; }
        .search-container > svg path,
        .search-container > svg circle { stroke-width: 2.2 !important; }

        /* Match chatTitle active ring visuals */
        .search-container.is-active-ring {
            border-color: var(--accent) !important;
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
            background-color: rgba(255,255,255,0.02);
        }

        .search-input {
            width: 100%;
            height: 100%;
            padding: 0 6px;
            background: transparent;
            border: none;
            color: var(--text-primary);
            font-size: 14px;
            outline: none;
        }

        .search-input:focus {
            outline: none;
            box-shadow: none;
        }

        .search-input::placeholder {
            color: var(--text-muted);
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 20px;
        }

        .logo-icon {
            width: 34px;
            height: 34px;
            background: var(--gradient);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 16px;
        }

        .logo-text {
            font-family: 'SYN', sans-serif;
            font-size: 18px;
            font-weight: 700;
            color: #ffffff;
            letter-spacing: -0.02em;
            white-space: nowrap;
            flex-shrink: 0;
            line-height: 1;
        }

        .new-chat {
            width: 100%;
            padding: 10px 12px;
            background: var(--custom-gradient);
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            border: none;
            border-radius: 12px;
            color: white;
            font-weight: 500;
            cursor: pointer;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
            position: relative;
            overflow: hidden;
        }
        .new-chat:hover {
            background: transparent;
            opacity: 1;
            transform: none;
            box-shadow: none;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .new-chat > * {
            position: relative;
            z-index: 1;
        }

        .new-chat::before {
            content: '';
            position: absolute;
            width: 60px;
            height: 60px;
            background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 80%);
            border-radius: 50%;
            pointer-events: none;
            z-index: 0;
            opacity: 0;
            left: var(--mouse-x, 50%);
            top: var(--mouse-y, 50%);
            transform: translate(-50%, -50%);
        }


        .new-chat:disabled {
            opacity: 0.3 !important;
            cursor: not-allowed !important;
            pointer-events: none;
            background: var(--custom-gradient) !important;
            transform: none !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
        }

        .new-chat:disabled:hover {
            background: var(--custom-gradient) !important;
            opacity: 0.3 !important;
            transform: none !important;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
        }

        .sidebar-action { height: 44px; display: inline-flex; align-items: center; justify-content: flex-start; border-radius: 10px; width: 100%; gap: 8px; margin-bottom: 0; cursor: pointer; color: inherit; font-size: inherit; font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-weight: 400; }
        .sidebar-action img { width: 20px; height: 20px; }

        .chat-history {
            flex: 1;
            overflow-y: auto;
            padding: 8px 12px 8px;
        }
        .chat-list-title {
            font-size: 12px;
            color: var(--text-secondary);
            text-transform: none;
            letter-spacing: 0;
            margin: 12px 2px 6px 2px;
        }

        .chat-section-title {
            display: none;
            margin: 0;
            padding: 0;
            height: 0;
        }

        .chat-item.dragging {
            opacity: 0.5;
            transform: none !important;
            z-index: 1000;
        }
        .chat-item[draggable="true"] {
            cursor: move;
        }

        .chat-item[draggable="true"]:hover {
            cursor: move;
        }
        .drop-indicator {
            height: 0; /* no space when not visible */
            background: var(--custom-color);
            border-radius: 1px;
            opacity: 0;
            margin: 0; /* remove vertical gap between items */
        }
        .drop-indicator.visible {
            opacity: 1;
            height: 2px; /* only take space when shown */
            margin: 4px 0;
        }
        /* Ensure no vertical gaps between chat rows in both normal chats and projects */
        #chatHistory, .chat-history { row-gap: 0 !important; gap: 0 !important; }
        #chatHistory .chat-item + .chat-item,
        .chat-history .chat-item + .chat-item { margin-top: 0 !important; }
        /* Remove any residual spacing between hover-box rows, including active states */
        #chatHistory .chat-item.hover-box,
        .chat-history .chat-item.hover-box { margin: 0; }
        #chatHistory .chat-item.hover-box + .chat-item.hover-box,
        .chat-history .chat-item.hover-box + .chat-item.hover-box { margin-top: 0; }
        #chatHistory .chat-item.hover-box.active,
        .chat-history .chat-item.hover-box.active { margin: 0; }
        #chatHistory .chat-item.hover-box.active + .chat-item.hover-box,
        .chat-history .chat-item.hover-box.active + .chat-item.hover-box { margin-top: 0; }
        #chatHistory .chat-item.hover-box + .chat-item.hover-box.active,
        .chat-history .chat-item.hover-box + .chat-item.hover-box.active { margin-top: 0; }
        #chatHistory .chat-item.active + .chat-item,
        .chat-history .chat-item.active + .chat-item { margin-top: 0; }
        .chat-item {
            padding: 8px 12px;
            padding-right: 52px; /* space for larger 3-dots button */
            margin-bottom: 0 !important;
            border-radius: 10px;
            cursor: pointer;
            position: relative;
            overflow: visible;
            background: transparent;
            border: none;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }

        .chat-item::before { content: ""; position: absolute; inset: 0; border-radius: 10px; background: transparent; pointer-events: none; opacity: 0; }
        .chat-item::after { content: none; }
        .chat-item:hover::before { opacity: 1; background: rgba(255,255,255,0.06); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), inset 0 -1px 0 rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.04); }
        .chat-item:hover { color: var(--text-primary); }
        .chat-item.menu-open::before { opacity: 1; background: rgba(255,255,255,0.06); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), inset 0 -1px 0 rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.04); }
        .chat-item.menu-open { color: var(--text-primary); }
        /* If chat-item also has hover-box, prefer hover-box visuals */
        .chat-item.hover-box:hover::before { opacity: 0 !important; background: transparent !important; box-shadow: none !important; }
        .chat-item.hover-box.menu-open { background: #2f2f2f !important; box-shadow: none !important; color: #ececec !important; }

        /* Chat item 3-dots trigger */
        .chat-menu-trigger { position:absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 40px; border-radius: 9999px; background: transparent; border: none; display:flex; align-items:center; justify-content:center; opacity: 0; padding:0; color: #ececec; cursor: pointer; overflow: hidden; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; }
        .chat-menu-trigger::before { content: none; }
        .chat-item:hover .chat-menu-trigger { opacity: 1; }
        .chat-item.active .chat-menu-trigger { opacity: 1; }
        .chat-item.menu-open .chat-menu-trigger { opacity: 1; }
        .chat-menu-trigger img { width: 20px !important; height: 20px !important; }

        /* Mobile: always show chat menu trigger */
        @media (max-width: 768px) {
            .chat-menu-trigger { opacity: 1 !important; }
        }

        /* Floating chat menu (account menu style) */
         #chatMenu { position: fixed; left:0; top:0; transform: translate(0,0); width: 220px; z-index:10500; overflow: visible; }
        #chatMenu button img, #chatMenu button svg { width: 16px !important; height: 16px !important; }
        #chatMenu .divider, #chatMenu hr { height:1px; background: rgba(255,255,255,0.06); border:0; margin:4px 6px; }
        #chatMenu button.danger { color: #FA8585; }
        #chatMenu button.danger:hover { background: rgba(211,47,47,0.12); color: #FA8585; }
        #chatMenu button.danger:active { background: rgba(211,47,47,0.18); }
        #chatMenu button.danger img.ui-icon-white { filter: invert(80%) sepia(24%) saturate(863%) hue-rotate(314deg) brightness(103%) contrast(98%); }

        /* Mobile: constrain chat menu within viewport */
        @media (max-width: 768px) {
            #chatMenu { max-width: 92vw; max-height: 70vh; overflow: auto; }
        }

        .chat-item.active { background: transparent; color: var(--text-primary); }
        /* Ensure selected items show hover visuals persistently */
        .chat-item.active:hover::before,
        .chat-item.active::before { opacity: 1; background: rgba(255,255,255,0.06); box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), inset 0 -1px 0 rgba(0,0,0,0.28), 0 0 0 1px rgba(255,255,255,0.04); }
        /* Persist hover-box look for active project/chat rows cloned as hover-box */
        .chat-item.hover-box.active { background: #2f2f2f !important; box-shadow: none !important; color: #ececec !important; padding: 8px 12px !important; padding-right: 36px !important; margin: 0; }

        .chat-item.disabled {
            opacity: 0.5;
            cursor: not-allowed;
            pointer-events: none;
        }

        .chat-item.disabled:hover {
            background: rgba(255, 255, 255, 0.02);
            transform: none;
            box-shadow: none;
        }
        .chat-title { font-size: 14px; font-weight: 400; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }

        .chat-preview { display: none; }

        .chat-actions { display: none; }
        .delete-chat {
            width: 28px;
            height: 28px;
            border: none;
            background: var(--error);
            color: white;
            border-radius: 18px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0.8;
        }
        .delete-chat:hover {
            opacity: 1;
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            position: relative;
            min-height: 0;
            overflow: hidden;
        }

        .header {
            height: 48px;
            background: rgba(33,33,33,0.85) !important;
            backdrop-filter: blur(16px) !important;
            -webkit-backdrop-filter: blur(16px) !important;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            position: sticky;
            top: 0;
            left: 0;
            right: 0;
            width: 100%;
            z-index: 11000;
            overflow: visible;
            border-bottom: none !important;
            box-shadow: none !important;
            transition: box-shadow 0.3s cubic-bezier(0.4,0,0.2,1) !important;
            transform: translateZ(0);
            -webkit-transform: translateZ(0);
            will-change: transform;
        }

        .header-left {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .menu-toggle {
            display: none;
            width: 32px;
            height: 32px;
            border: none;
            background: var(--surface);
            color: var(--text-primary);
            border-radius: 18px;
            cursor: pointer;
            align-items: center;
            justify-content: center;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }

        .menu-toggle:hover {
            background: transparent;
            transform: none !important;
        }
        .chat-info h1 {
            font-size: 17px;
            font-weight: 600;
            color: var(--text-primary);
            cursor: pointer;
            padding: 4px 8px;
            border-radius: 18px;
        }
        .chat-info { flex: 0 0 auto; }

        .chat-info h1:hover {
            background: var(--surface);
        }
        .title-edit-input {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-primary);
            background: var(--surface);
            border: 1px solid var(--accent);
            border-radius: 8px;
            padding: 4px 8px;
            outline: none;
            width: 200px;
        }

        .header.shadow-visible { box-shadow: 0 6px 20px #212121, 0 2px 8px rgba(33,33,33,0.8) !important; }
        .header::after {
            content: '';
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            height: 28px;
            transform: translateY(100%);
            background: linear-gradient(to bottom, rgba(33,33,33,0.65), rgba(33,33,33,0) 100%);
            pointer-events: none;
            z-index: 1;
            opacity: 0;
            transition: opacity 0.3s cubic-bezier(0.4,0,0.2,1);
        }
        .header.shadow-visible::after { opacity: 1; }

        .header-actions {
            display: flex;
            gap: 3px;
            align-items: center;
            background: rgba(18, 18, 18, 0.6);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 40px;
            padding: 3px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
            margin-top: 6px;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
        }
        .header-actions .header-btn {
            background: transparent;
            color: #ffffff;
            border: none;
            width: 32px;
            height: 32px;
            min-width: 32px;
            min-height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            position: relative;
            isolation: isolate;
            padding: 0;
            --button-background-color: rgba(255, 255, 255, 0.08);
            --button-background-color-active: rgba(255, 255, 255, 0.12);
            --scale: 0.98;
        }
        .header-actions .header-btn::before {
            position: absolute;
            inset: 0;
            display: block;
            border-radius: inherit;
            background-color: var(--button-background-color);
            content: "";
            opacity: 0;
            transform: scale(1);
            z-index: -1;
            pointer-events: none;
        }
        .header-actions .header-btn:hover::before {
            opacity: 1;
            transform: scale(1);
        }
        .header-actions .header-btn:hover {
            background: transparent !important;
            box-shadow: none !important;
        }
        .header-actions .header-btn:active::before {
            opacity: 1;
            transform: scale(var(--scale));
            background-color: var(--button-background-color-active);
        }
        .header-actions .header-btn > * {
            position: relative;
            z-index: 1;
        }
        .header-actions .header-btn:focus {
            outline: none;
        }
        .header-actions .header-btn:focus-visible {
            outline: 2px solid rgba(255, 255, 255, 0.4);
            outline-offset: 2px;
        }
        .header-actions .header-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            pointer-events: none;
        }
        .header-actions .header-btn svg,
        .header-actions .header-btn img {
            width: 20px;
            height: 20px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
        }

        /* Chat title hover/focus ring behavior */
        #chatTitle {
        }
        #chatTitle:hover {
            border-color: rgba(255,255,255,0.4) !important; /* subtle ring on hover, not pure white */
        }
        #chatTitle.editing,
        #chatTitle:active,
        #chatTitle.is-active-ring {
            border-color: var(--accent) !important; /* use theme color for active */
            box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent);
            background-color: rgba(255,255,255,0.02);
        }
        .title-edit-input {
            position: absolute;
            left: 50%;
            top: 50%;
            transform: translate(-50%, -50%);
            margin: 0;
            font-size: 14px;
            font-weight: 700;
            color: #fff;
            padding: 6px 12px;
            border: 1px solid var(--accent);
            border-radius: 9999px;
            line-height: 1;
            background: transparent;
            outline: none;
            width: auto;
            min-width: 120px;
            text-align: center;
        }

        .header-btn {
            background: transparent;
            color: #ffffff;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            position: relative;
            isolation: isolate;
            --button-background-color: rgba(255, 255, 255, 0.08);
            --button-background-color-active: rgba(255, 255, 255, 0.12);
            --scale: 0.98;
        }

        .header-btn::before {
            position: absolute;
            inset: 0;
            display: block;
            border-radius: inherit;
            background-color: var(--button-background-color);
            content: "";
            opacity: 0;
            transform: scale(1);
            z-index: -1;
            pointer-events: none;
        }

        .header-btn:hover::before {
            opacity: 1;
            transform: scale(1);
        }

        .header-btn:hover {
            background: transparent !important;
            box-shadow: none !important;
        }

        .header-btn:active::before {
            opacity: 1;
            transform: scale(var(--scale));
            background-color: var(--button-background-color-active);
        }

        .header-btn > * {
            position: relative;
            z-index: 1;
        }

        .header-btn:focus {
            outline: none;
        }

        .header-btn:focus-visible {
            outline: 2px solid rgba(255, 255, 255, 0.4);
            outline-offset: 2px;
        }

        .header-btn:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            pointer-events: none;
        }

        .header-btn svg,
        .header-btn img {
            width: 20px;
            height: 20px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
            -webkit-user-drag: none;
        }

        /* Avatar button styled like other header buttons but circular */
        .avatar-btn {
            border-radius: 50% !important;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 14px;
            color: #fff;
            text-transform: uppercase;
            overflow: hidden;
            position: relative;
            padding: 0;
            flex: 0 0 auto;
            aspect-ratio: 1 / 1;
            line-height: 0;
            align-self: center;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }
        .avatar-btn img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            display: block;
        }
        /* Hide initial only when an image is present */
        .avatar-btn.has-image #avatarInitial { display: none; }
        .profile-avatar-lg.has-image #profileAvatarInitialLg { display: none; }
        /* Disable touch callout on mobile when class is set */
        body.no-callout *, body.no-callout {
            -webkit-touch-callout: none;
        }
        @media (max-width: 480px) {
            .avatar-btn {
                width: 21px !important;
                height: 21px !important;
                min-width: 21px !important;
                min-height: 21px !important;
            }
        }
        @media (min-width: 481px) and (max-width: 768px) {
            .avatar-btn {
                width: 23px !important;
                height: 23px !important;
                min-width: 23px !important;
                min-height: 23px !important;
            }
        }
        @media (min-width: 769px) {
            .avatar-btn {
                width: 25px !important;
                height: 25px !important;
                min-width: 25px !important;
                min-height: 25px !important;
            }
        }
        
        .avatar-btn:hover {
            background: rgba(255,255,255,0.12) !important;
        }

        .favorite-btn {
            color: var(--text-muted);
        }

        .favorite-btn.active {
            color: var(--warning);
        }

        .modal {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 1);
            backdrop-filter: blur(1px);
            -webkit-backdrop-filter: blur(1px);
            z-index: 22000 !important;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
        }
        .modal.show {
            display: flex;
        }
        .modal.show .modal-content {
        }
        .modal-overlay {
            z-index: 22000 !important;
        }
        .modal-content {
            background: var(--bg-modal);
            border: none;
            border-radius: 25px;
            width: 100%;
            max-width: 500px;
            max-height: 80vh;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        .modal-header {
            padding: 20px 24px;
            border-bottom: 1px solid var(--menu-divider);
            display: flex;
            align-items: center;
            justify-content: space-between;
            position: relative;
            background: var(--bg-modal);
        }
        .modal-title {
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            text-align: center;
        }

        .modal-close {
            width: 32px;
            height: 32px;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(255,255,255,0.1);
            color: #fff;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            flex-shrink: 0;
        }

        .modal-close:hover {
            background: rgba(255,255,255,0.1);
            color: #fff;
        }

        .modal-close:active {
            transform: scale(0.9);
        }

        .modal-body {
            padding: 24px;
            flex: 1;
            overflow-y: auto;
            background: var(--bg-modal-body);
        }
        /* Modal animations — keyframes from paiK3xN1anim.css (modal-enter) */
        .modal.show .modal-content {
            animation: modal-enter 0.22s ease-out both;
        }
        .modal {
            transition: none !important;
        }


        .settings-section {
            margin-bottom: 32px;
        }

        .settings-section > h3 {
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
            font-weight: 700;
            letter-spacing: 0.2px;
        }

        .settings-section h3 {
            font-size: 16px;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 16px;
        }
        .setting-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 0;
            border-bottom: 1px solid var(--border);
            gap: 20px;
            min-height: 60px;
        }

        .setting-item:last-child {
            border-bottom: none;
        }

        .setting-label {
            display: flex;
            flex-direction: column;
            flex: 1;
        }

        .setting-title {
            font-size: 15px;
            font-weight: 400;
            color: var(--text-primary);
            margin-bottom: 4px;
            line-height: 1.3;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            pointer-events: none;
        }
        .setting-description {
            font-size: 12px;
            color: var(--text-muted);
        }

        .toggle-switch {
            position: relative;
            width: 36px;
            height: 20px;
            background: var(--toggle-track-off);
            border-radius: 20px;
            cursor: pointer;
            flex-shrink: 0;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            outline: none !important;
            -webkit-tap-highlight-color: transparent !important;
            display: flex;
            align-items: center;
            padding: 2px;
            box-sizing: border-box;
            border: none;
        }

        .toggle-switch.active { background: var(--toggle-track-on); border-color: var(--accent); }

        .toggle-slider {
            position: relative;
            width: 16px;
            height: 16px;
            background: var(--toggle-thumb-off);
            border-radius: 50%;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            transform: translateX(0);
            flex-shrink: 0;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }
        .toggle-switch.active .toggle-slider { transform: translateX(16px); background: var(--toggle-thumb-on); }

        .favorites-list {
            max-height: 400px;
            overflow-y: auto;
        }

        .favorite-item {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 16px;
            margin-bottom: 12px;
            cursor: pointer;
        }

        .favorite-item:hover {
            background: var(--surface-hover);
            border-color: var(--accent);
        }
        .favorite-item:last-child {
            margin-bottom: 0;
        }
        .favorite-content {
            font-size: 14px;
            color: white;
            margin-bottom: 8px;
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 3;
            line-clamp: 3;
            -webkit-box-orient: vertical;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }
        .favorite-content p {
            color: white !important;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }
        .favorite-content * {
            color: white !important;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

        .favorite-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 12px;
            color: white;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }
        .favorite-meta span:first-child {
            font-weight: bold;
        }
        .favorite-meta span:last-child {
            font-style: italic;
        }
        .search-results {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px;
            margin-top: 8px;
            max-height: 300px;
            overflow-y: auto;
            display: none;
        }
        .search-result {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            cursor: pointer;
        }

        .search-result:hover {
            background: var(--surface-hover);
        }

        .search-result:last-child {
            border-bottom: none;
        }

        .search-result-text {
            font-size: 14px;
            color: var(--text-primary);
            margin-bottom: 4px;
        }

        .search-result-meta {
            font-size: 12px;
            color: var(--text-muted);
        }

        .highlight {
            background: var(--accent);
            color: white;
            padding: 2px 4px;
            border-radius: 4px;
        }

        .modal-overlay {
            position: fixed !important;
            top: 0 !important;
            left: 0 !important;
            right: 0;
            bottom: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.6);
            backdrop-filter: blur(1px);
            -webkit-backdrop-filter: blur(1px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10600;
            opacity: 0;
            pointer-events: none;
            overflow: hidden;
            transition: none !important;
        }
        @supports (height: 100dvh) {
            .modal-overlay { height: 100dvh; }
        }

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

        .modal-overlay.show .custom-modal {
            animation: modal-enter 0.22s ease-out both;
        }

        .custom-modal {
            background: rgba(31, 30, 29, 0.95);
            backdrop-filter: blur(1px) saturate(180%);
            -webkit-backdrop-filter: blur(1px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 16px;
            min-width: 320px;
            max-width: 480px;
            width: 90%;
            max-height: 90vh;
            margin: 0 auto;
            position: relative;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
            z-index: 10601;
            display: block;
            flex-shrink: 0;
        }

        /* Confirm modal: remove frosted container without changing size */
        .custom-modal.confirm-modal {
            background: var(--bg-dark);
            box-shadow: var(--shadow-sm);
            padding: 0;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            transform: none !important;
        }
        /* Ensure confirm modal is perfectly centered and sized on mobile */
        .custom-modal.confirm-modal {
            min-width: 0 !important;
            width: auto !important;
            margin: 0 auto !important;
        }
        /* Make confirm link URL white and bold */
        #linkConfirmUrl,
        .linkConfirmUrl {
            color: #ffffff !important;
            font-weight: 700 !important;
        }
        #memoryModal {
            justify-content: center !important;
            align-items: center !important;
        }
        #memoryModal .custom-modal.confirm-modal {
            display: flex !important;
            justify-content: center !important;
            align-items: center !important;
        }
        /* Reinforce centering for the confirm overlay */
        #confirmModal {
            justify-content: center !important;
            align-items: center !important;
        }
        /* Ensure inner content of confirm modal is centered within its container */
        #confirmModal .custom-modal.confirm-modal {
            display: flex !important;
            justify-content: center !important;
            align-items: center !important;
        }

        .modal-header {
            padding: 20px 24px 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }

        .modal-header h3 {
            margin: 0;
            font-size: 18px;
            font-weight: 600;
            color: var(--text-primary);
        }

        .modal-body {
            padding: 20px 24px;
        }

        .modal-body p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.5;
        }
        .modal-footer {
            padding: 16px 24px 20px;
            display: flex;
            gap: 12px;
            justify-content: flex-end;
            background: var(--bg-footer) !important;
        }
        #templateOk,
        #templateCancel,
        #projectWorkspaceCloseFooter,
        #confirmCancel,
        #confirmOk {
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            min-width: fit-content;
            white-space: nowrap;
        }

        /* Cancel Buttons - Normal Button Design */
        #templateCancel,
        #projectWorkspaceCloseFooter,
        #confirmCancel {
            background: transparent;
            color: rgba(255, 255, 255, 0.85);
            border: 1px solid rgba(255, 255, 255, 0.2);
            padding: 10px 18px !important;
            border-radius: 40px;
            font-size: 14px;
            font-weight: 500;
        }

        #templateCancel:hover,
        #projectWorkspaceCloseFooter:hover,
        #confirmCancel:hover {
            background: rgba(255, 255, 255, 0.1);
            border-color: rgba(255, 255, 255, 0.3);
        }

        #templateCancel:active,
        #projectWorkspaceCloseFooter:active,
        #confirmCancel:active {
            transform: scale(0.95);
        }

        /* OK Buttons - Primary Button Design */
        #confirmOk {
            background: var(--btn-accent, #fff);
            color: var(--btn-accent-fg, #000) !important;
            padding: 10px 18px !important;
            border-radius: 40px;
            border: none;
            font-size: 14px;
            font-weight: 400;
        }

        #confirmOk:hover {
            background: var(--btn-accent-hover, rgba(255, 255, 255, 0.9));
        }

        #confirmOk:active {
            transform: scale(0.95);
        }

        #templateOk {
            background: var(--btn-accent, #fff);
            color: var(--btn-accent-fg, #000) !important;
            padding: 10px 18px !important;
            border-radius: 40px;
            border: none;
            font-size: 14px;
            font-weight: 400;
        }

        #templateOk:hover {
            background: var(--btn-accent-hover, rgba(255, 255, 255, 0.9));
        }

        #templateOk:active {
            transform: scale(0.95);
        }

        #templateOk:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .floating-button-group {
            position: fixed;
            top: 8px;
            left: 24px;
            display: flex;
            opacity: 0;
            visibility: hidden;
            transform: translateX(-10px);
            background: rgba(18, 18, 18, 0.6);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid rgba(255, 255, 255, 0.15);
            border-radius: 40px;
            padding: 3px;
            gap: 3px;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
            z-index: 12000;
        }
        .floating-button-group.visible {
            opacity: 1;
            visibility: visible;
            transform: translateX(0);
        }

        .floating-button-group .btn-icon {
            background: transparent;
            color: #ffffff;
            border: none;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
            position: relative;
            isolation: isolate;
            --button-background-color: rgba(255, 255, 255, 0.08);
            --button-background-color-active: rgba(255, 255, 255, 0.12);
            --scale: 0.98;
        }

        .floating-button-group .btn-icon::before {
            position: absolute;
            inset: 0;
            display: block;
            border-radius: inherit;
            background-color: var(--button-background-color);
            content: "";
            opacity: 0;
            transform: scale(1);
            z-index: -1;
            pointer-events: none;
        }

        .floating-button-group .btn-icon:hover::before {
            opacity: 1;
            transform: scale(1);
        }

        .floating-button-group .btn-icon:hover {
            background: transparent !important;
            box-shadow: none !important;
        }

        .floating-button-group .btn-icon:active::before {
            opacity: 1;
            transform: scale(var(--scale));
            background-color: var(--button-background-color-active);
        }

        .floating-button-group .btn-icon > * {
            position: relative;
            z-index: 1;
        }

        .floating-button-group .btn-icon:focus {
            outline: none;
        }

        .floating-button-group .btn-icon:focus-visible {
            outline: 2px solid rgba(255, 255, 255, 0.4);
            outline-offset: 2px;
        }

        .floating-button-group .btn-icon:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            pointer-events: none;
        }

        .floating-button-group .btn-icon svg {
            width: 20px;
            height: 20px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
            -webkit-user-drag: none;
            fill: currentColor;
            stroke: currentColor;
        }
        
        @media (max-width: 768px) {
            .floating-button-group { display: flex !important; }
            .floating-button-group .btn-icon.mobile-hidden { display: none !important; }
            .floating-button-group.mobile-visible {
                opacity: 1 !important;
                visibility: visible !important;
                transform: translateX(0) !important;
            }
        }
        
        @media (max-width: 768px) {
            .custom-modal {
                width: 95% !important;
                min-width: 280px !important;
                max-width: none !important;
                margin: 20px auto !important;
            }
            
            .modal-header h3 {
                font-size: 16px;
            }
            
            .modal-body p {
                font-size: 14px;
            }
            
        }

        @media (max-width: 480px) {
            .custom-modal {
                width: 98% !important;
                margin: 10px auto !important;
            }
            
            .modal-footer {
                flex-direction: column;
                gap: 8px;
            }
            
        }

        body.font-small {
            font-size: 14px;
        }

        body.font-small .message-text,
        body.font-small .message-input,
        body.font-small .form-input {
            font-size: 13px;
        }

        body.font-medium {
            font-size: 16px;
        }

        body.font-medium .message-text,
        body.font-medium .message-input,
        body.font-medium .form-input {
            font-size: 15px;
        }

        body.font-large {
            font-size: 18px;
        }

        body.font-large .message-text,
        body.font-large .message-input,
        body.font-large .form-input {
            font-size: 17px;
        }

        body.reduce-motion * {
        }

        body.reduce-brightness {
            filter: brightness(0.7);
        }

        /* Remove hiding rule; keep toggle visible on all widths */
        @media (max-width: 1200px) {
            .sidebar-toggle-btn {
                display: none !important;
            }
        }

        .messages-area {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            position: relative;
            display: flex;
            justify-content: center;
            align-items: flex-start;
            min-height: 0;
        }

        .messages-container {
            padding: 32px 24px 80px 24px;
            max-width: var(--chat-width);
            margin: 0 auto;
            width: 100%;
            display: flex;
            flex-direction: column;
            direction: ltr;
            align-items: stretch;
            box-sizing: border-box;
            overflow-x: hidden;
        }

        /* Message spacing and layout */
        .message { margin-top: var(--message-spacing); margin-bottom: 16px; position: relative; z-index: 1; }
        .message:first-child { margin-top: 0; }
        .message.user { min-width: 0; }
        .message.assistant { width: 100%; padding: 20px 4px 20px 0; }
        .message .message-bubble { border-radius: var(--border-radius); }
        .message.user .message-bubble { background: var(--user-bubble) !important; color: #fff !important; }
        .message.assistant .message-bubble { background: #212121; }

        .welcome-screen { display: none; }

        /* Tools button animated icon */
        .tools-btn { position: relative; }
        /* Remove default UA styles for input bar tool buttons */
        .input-wrapper .tools-btn { background: transparent !important; border: none !important; outline: none !important; box-shadow: none !important; -webkit-appearance: none; appearance: none; }
        .input-wrapper .tools-btn:focus, .input-wrapper .tools-btn:focus-visible { outline: none !important; box-shadow: none !important; }
        .input-wrapper .tools-btn::before, .input-wrapper .tools-btn::after { content: none !important; }
        .input-wrapper .tools-btn .icon, .input-wrapper .tools-btn svg { background: transparent !important; border: none !important; box-shadow: none !important; }
        .tools-btn .icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
        .tools-btn svg { width: 20px; height: 20px; }
        .tools-btn .icon-plus { opacity: 1; transform: rotate(0deg) scale(1); }
        .tools-btn .icon-close { display: none; }
        .tools-btn.open .icon-plus { opacity: 1; transform: rotate(0deg) scale(1); }
        .tools-btn.open .icon-close { display: none; }

        /* AccountMenu-like circular hover for tools buttons inside input bar */
        .input-wrapper .tools-btn:hover,
        .input-wrapper .tools-btn:focus-visible { background: #454545 !important; color: #ffffff !important; }
        /* Force plus and mic icons to white inside input bar */
        .input-wrapper .tools-btn .icon-plus,
        .input-wrapper .tools-btn .icon-mic { color: #FFFFFF !important; }
        /* Keep hover look while menu is open, slightly dimmed */
        .input-wrapper .tools-btn.open { background: #454545 !important; color: #ffffff !important; opacity: 0.85; }
        .input-wrapper .tools-btn.open:hover,
        .input-wrapper .tools-btn.open:focus-visible { opacity: 1; }

        /* Tools menu item hover color */
        .tools-menu .tool-item { position: relative; isolation: isolate; --button-background-color: #3a3a3a; --button-background-color-active: #454545; --scale: 0.98; }
        .tools-menu .tool-item::before { position: absolute; inset: 0; display: block; border-radius: inherit; background-color: var(--button-background-color); content: ""; opacity: 0; transform: scale(1); z-index: -1; pointer-events: none; }
        .tools-menu .tool-item:hover::before { opacity: 1; transform: scale(1); }
        .tools-menu .tool-item:active::before { opacity: 1; transform: scale(var(--scale)); background-color: var(--button-background-color-active); }
        .tools-menu .tool-item:hover,
        .tools-menu .tool-item:focus-visible { background: transparent !important; }
        .tools-menu .tool-item > * { position: relative; z-index: 0; }

        .greeting {
            position: fixed;
            top: calc(40% - 90px);
            left: 50%;
            transform: translateX(-50%);
            width: max-content;
            max-width: 90vw;
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
            font-size: 28px;
            line-height: 34px;
            font-weight: 400;
            letter-spacing: 0.38px;
            text-align: center;
            color: inherit;
            margin: 0;
            padding: 0;
            z-index: 9998;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
            user-select: none;
            -webkit-touch-callout: none;
        }
        .greeting.greet-anim {
            animation: greetFade 0.6s ease-out;
        }
        @keyframes greetFade {
            from { opacity: 0; transform: translateX(-50%) translateY(8px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }

        .message-wrapper {
            display: flex;
            gap: 16px;
            align-items: flex-start;
        }
        .message.user .message-wrapper {
            justify-content: flex-end !important;
            align-items: flex-end !important;
            width: auto !important;
            max-width: var(--user-chat-width, 70%) !important;
        }

        .message.assistant .message-wrapper {
            justify-content: flex-start;
            width: 100%;
        }

        .message-content {
            max-width: 80%;
            width: fit-content;
            min-width: 0;
        }

        .message.user .message-content {
            max-width: 100% !important;
            display: block !important;
            min-width: 0 !important;
        }

        .message.assistant .message-content {
            max-width: 100%;
            width: 100%;
        }

        .message-bubble {
            padding: 16px 20px;
            border-radius: 18px;
            position: relative;
            word-wrap: break-word;
            display: inline-block;
            max-width: 100%;
        }

        .message.user .message-bubble {
            display: block !important;
            width: fit-content !important;
            max-width: 100% !important;
            margin-left: auto !important;
            background: #171717;
            color: white;
            border: none !important;
            outline: none !important;
            border-bottom-right-radius: 18px;
            padding: 6px 16px !important;
            overflow-wrap: break-word !important;
            word-break: break-word !important;
        }
        /* Keep only short messages in one line and size bubble to content */
        .message.user .message-bubble[data-singleline] { min-width: max-content; max-width: 100%; }
        .message.user .message-bubble[data-singleline] .message-text { white-space: nowrap !important; overflow: hidden; text-overflow: ellipsis; }
        /* User bubble color is controlled via --user-bubble-bg set in JS */
        .message.user .message-bubble[data-multiline] { padding-top: 12px !important; padding-bottom: 12px !important; }
        .message.user .message-text { white-space: pre-wrap !important; padding: 0; font-family: 'Default', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; font-size: 17px !important; word-break: normal !important; overflow-wrap: break-word !important; }
        .message.user .message-text::selection {
            background-color: var(--user-selection-bg, color-mix(in oklab, var(--selection-bg) 65%, white));
            color: #ffffff;
        }
        .message.user .message-text::-moz-selection {
            background-color: var(--user-selection-bg, color-mix(in oklab, var(--selection-bg) 65%, white));
            color: #ffffff;
        }
        .message.user .message-bubble { word-break: normal !important; overflow-wrap: break-word !important; }

        .message.assistant .message-bubble {
            background: #212121;
            border: none;
            border-radius: 0;
            padding: 20px 0 0;
            width: 100%;
            max-width: 100%;
            display: block;
        }
        .error-retry-btn {
            --button-background-color: #3a3a3a;
            --button-background-color-active: #454545;
            --scale: 0.98;
        }
        .error-retry-btn::before {
            position: absolute;
            inset: 0;
            display: block;
            border-radius: inherit;
            background-color: var(--button-background-color);
            content: "";
            opacity: 0;
            transform: scale(1);
            z-index: -1;
            pointer-events: none;
        }
        .error-retry-btn:hover::before {
            opacity: 1;
            transform: scale(1);
        }
        .error-retry-btn:active::before {
            opacity: 1;
            transform: scale(var(--scale));
            background-color: var(--button-background-color-active);
        }
        .error-retry-btn:hover {
            background: transparent;
            border-radius: 18px;
        }
        .message.assistant .message-text {
            line-height: 1.65;
            color: var(--text-primary);
            padding: 0;
            font-family: 'Default', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif !important;
            font-size: 17px !important;
            letter-spacing: 0.005em;
            overflow-wrap: break-word;
            word-break: break-word;
            min-width: 0;
            max-width: 100%;
        }
        /* Ensure all messages are selectable (user and assistant) */
        .message, .message * {
            -webkit-user-select: text !important;
            user-select: text !important;
        }

        .message.assistant {
            border-bottom: none;
            margin-bottom: 0;
            padding-bottom: 20px;
        }
        .message.assistant:last-child {
            border-bottom: none;
        }
        .message.user {
            margin-bottom: 20px;
            margin-top: 8px;
            display: flex !important;
            justify-content: flex-end !important;
            width: 100% !important;
        }
        .message-text {
            font-size: 15px;
            line-height: 1.6;
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
            overflow-wrap: break-word;
            word-break: break-word;
            min-width: 0;
            max-width: 100%;
        }

        .message-text p {
            margin-bottom: 12px;
        }
        .message-text strong {
            font-weight: 600;
        }
        .message-text em {
            font-style: italic;
        }
        .message-text code {
            background: var(--fill-code, #2f2f2f);
            color: var(--text-primary);
            padding: 2px 6px;
            border-radius: 4px;
            font-family: monospace;
            font-size: 0.875em;
            font-weight: 500;
        }
        .message-text blockquote {
            position: relative;
            border: none;
            padding: 8px 0 8px 24px;
            margin: 0 0 8px 0;
            background: transparent;
            line-height: 1.5;
            font-weight: 500;
            color: var(--text-primary);
        }
        .message-text blockquote::after {
            content: "";
            position: absolute;
            left: 0;
            top: 0.5rem;
            bottom: 0.5rem;
            width: 4px;
            border-radius: 2px;
            background-color: var(--sep, rgba(255,255,255,0.15));
        }
        .message-text blockquote > p {
            margin: 0;
            font-weight: 400;
        }
        .message-text blockquote blockquote {
            margin-top: 4px;
        }
        .message-text blockquote blockquote::after {
            background-color: rgba(255,255,255,0.1);
        }
        .message-text blockquote blockquote blockquote::after {
            background-color: rgba(255,255,255,0.06);
        }
        .message-text h1 {
            font-weight: 600;
            letter-spacing: -0.04rem;
            margin: 24px 0 12px 0;
        }
        .message-text h1:first-child { margin-top: 0; }
        .message-text h2 {
            font-weight: 600;
            margin: 32px 0 12px 0;
        }
        .message-text h2:first-child { margin-top: 0; }
        .message-text h3 {
            font-weight: 600;
            margin: 24px 0 8px 0;
        }
        .message-text h3:first-child { margin-top: 0; }
        .message-text h4, .message-text h5, .message-text h6 {
            font-weight: 600;
            margin: 16px 0 8px 0;
        }
        .message-text table {
            border-collapse: separate;
            border-spacing: 0;
            width: 100%;
            margin: 8px 0 16px 0;
        }
        .message-text th {
            border-bottom: 1px solid var(--sep, rgba(255,255,255,0.15));
            padding: 8px 12px;
            text-align: left;
            font-weight: 600;
            line-height: 1;
        }
        .message-text td {
            padding: 10px 12px;
        }
        .message-text hr {
            border: none;
            border-top: 1px solid var(--sep, rgba(255,255,255,0.15));
            margin: 28px 0;
        }
        .code-block {
            background: #171717;
            border-radius: 25px;
            margin: 12px 0;
            overflow: hidden;
            border: 1px solid rgba(180,180,180,0.13);
        }

        .code-header {
            background: #171717 !important;
            padding: 10px 14px;
            border-bottom: 1px solid rgba(180,180,180,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .code-lang-container {
            display: flex;
            align-items: center;
            gap: 7px;
            user-select: none;
            -webkit-user-select: none;
            pointer-events: none;
        }

        .code-lang-icon {
            width: 14px;
            height: 14px;
            object-fit: contain;
            border-radius: 2px;
            filter: brightness(0) invert(1);
            opacity: 0.7;
            pointer-events: none;
            -webkit-user-drag: none;
        }
        .code-lang {
            font-size: 11px;
            color: var(--text-secondary);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            pointer-events: none;
        }
        .copy-btn {
            padding: 6px 12px;
            background: var(--accent);
            border: none;
            border-radius: 18px;
            color: white;
            font-size: 12px;
            cursor: pointer;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }

        .copy-btn:hover {
            background: var(--accent-hover);
        }

        .code-actions {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .run-btn {
            padding: 6px 12px;
            background: var(--success);
            border: none;
            border-radius: 18px;
            color: #fff;
            font-size: 12px;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 6px;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }

        .run-btn:hover { filter: brightness(1.05); }
        .run-btn.running { background: var(--warning); }

        /* Make code-header buttons backgroundless and aligned */
        .code-header .copy-btn,
        .code-header .run-btn {
            background: transparent !important;
            color: var(--text-secondary);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            line-height: 1;
            padding: 6px 12px;
            box-shadow: none !important;
            outline: none !important;
        }
        .code-header .copy-btn svg,
        .code-header .run-btn svg,
        .code-header .copy-btn img,
        .code-header .run-btn img {
            width: 20px;
            height: 20px;
        }
        .code-header .copy-btn:hover,
        .code-header .run-btn:hover {
            background: transparent !important;
            filter: none;
            box-shadow: none !important;
            outline: none !important;
        }
        .code-header .copy-btn::before,
        .code-header .run-btn::before { display: none !important; }
        .code-header .run-btn.running { background: transparent !important; }

        /* Use accountMenu-like hover for code-actions buttons */
        .code-header .code-actions .copy-btn:hover,
        .code-header .code-actions .copy-btn:focus-visible,
        .code-header .code-actions .run-btn:hover,
        .code-header .code-actions .run-btn:focus-visible {
            background: #2f2f2f !important;
            color: #ffffff !important;
            box-shadow: none !important;
            filter: none !important;
        }

        /* Ensure hover applies even when buttons are not inside .code-actions */
        .code-header .copy-btn:hover,
        .code-header .copy-btn:focus-visible,
        .code-header .run-btn:hover,
        .code-header .run-btn:focus-visible {
            background: #2f2f2f !important;
            color: #ffffff !important;
            box-shadow: none !important;
            filter: none !important;
        }

        .code-content {
            padding: 14px 16px;
            overflow-x: auto;
            background: #171717 !important;
            border: none;
            border-radius: 0;
        }
        .code-content pre {
            font-family: monospace;
            font-size: 13px;
            line-height: 1.55;
            color: var(--text-primary);
            background: #171717 !important;
            font-weight: normal;
            margin: 0;
            padding: 0;
            white-space: pre;
        }
        .code-content pre code {
            color: #f8f8f2;
            font-weight: normal;
            display: block;
            margin: 0;
            padding: 0;
            background: #171717 !important;
        }

        .tok-kw { color: #ff79c6; font-weight: 500; }
        .tok-lit { color: #bd93f9; }
        .tok-str { color: #f1fa8c; }
        .tok-num { color: #bd93f9; }
        .tok-cm { color: #6272a4; font-style: italic; }
        .tok-prop { color: #50fa7b; }
        .tok-tag { color: #ff79c6; }
        .tok-attr { color: #50fa7b; }
        .tok-ent { color: #8be9fd; }
        .tok-sel { color: #50fa7b; }
        .tok-var { color: #f8f8f2; }
        .tok-func { color: #8be9fd; }
        .tok-op { color: #ff79c6; }

        /* Terminal-like output styling */
        .code-output {
            position: relative;
            background: #0b0b0b !important;
            color: #ececec !important;
            display: none !important;
            font-family: 'Monaco', 'Menlo', monospace !important;
            font-size: 13px;
            line-height: 1.5;
            padding: 12px 14px !important;
            border-top: 1px solid var(--border) !important;
            white-space: pre-wrap !important;
            overflow-x: auto;
        }
        .code-output.visible { display: block !important; }
        .code-output::before {
            content: "";
            position: absolute;
            inset: 0;
            pointer-events: none;
            background: repeating-linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.03) 1px, transparent 1px, transparent 3px);
            opacity: 0.2;
        }
        .code-output a { color: #93c5fd; }
        .code-output::-webkit-scrollbar { height: 8px; }
        .code-output::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

        .message-actions { display: flex; gap: 10px; margin-top: 10px; margin-left: 0; flex-wrap: wrap; align-items: center; opacity: 0; pointer-events: none; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; z-index: 1000 !important; position: relative !important; }
        .message-actions.pinned { opacity: 1 !important; pointer-events: auto !important; }
        body.always-show-actions .message-actions { opacity: 1 !important; pointer-events: auto !important; }
        .message.assistant .message-actions { opacity: 1 !important; pointer-events: auto !important; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; z-index: 1000 !important; position: relative !important; margin-right: 4px !important; }

        /* High contrast mode */
        body.high-contrast { --text-primary: #ffffff; --text-secondary: #ececec; --text-muted: #cbd5e1; --border: rgba(255,255,255,0.35); --surface: #0f0f0f; }
        body.high-contrast .message-bubble { border: 1px solid var(--border) !important; }
        body.high-contrast .header, body.high-contrast .modal-content { border-color: var(--border) !important; }

        /* Focus highlight */
        body.focus-highlight :focus-visible { outline: 3px solid #60a5fa !important; outline-offset: 2px !important; border-radius: 10px; }

        /* Text spacing */
        body.text-spacing { letter-spacing: 0.2px; }
        body.text-spacing .message-text, body.text-spacing .input-wrapper textarea { line-height: 1.7 !important; }

        .message.user .message-actions {
            justify-content: flex-end !important;
            flex-direction: column;
            flex-wrap: nowrap;
            align-items: flex-end;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            z-index: 1000 !important;
            position: relative !important;
            margin-top: 6px;
            gap: 4px;
        }
        .message.user .message-actions-buttons {
            display: flex;
            flex-direction: row;
            gap: 6px;
        }
        .message.user .message-actions .action-btn {
            flex: 0 0 auto;
        }
        .message.user .message-actions .message-timestamp {
            order: 1;
            margin-right: 0;
            height: auto;
            padding: 0;
        }

        .message-timestamp {
            font-size: 11px;
            color: var(--text-muted, #5d5d5d);
            cursor: default;
            display: inline-flex;
            align-items: center;
            height: 28px;
            padding: 0 6px;
            opacity: 0;
            visibility: hidden;
        }
        .message:hover .message-timestamp,
        .message-actions.pinned .message-timestamp {
            opacity: 1;
            visibility: visible;
        }
        body.is-mobile-device .message-timestamp {
            opacity: 1 !important;
            visibility: visible !important;
        }
        .message-actions {
            position: relative;
        }

        .message:hover .message-actions { opacity: 1; pointer-events: auto; }

        .action-btn { width: 28px; height: 28px; padding: 0; background: transparent; border: none; border-radius: 18px; color: var(--text-secondary); font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; z-index: 1001 !important; position: relative !important; }
        .action-btn .action-label { display: none !important; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; pointer-events: none !important; }
        .action-btn img, .action-btn svg { width: 20px; height: 20px; display: block; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; pointer-events: none !important; }
        .action-btn.more-btn img, .action-btn.more-btn svg { width: 20px; height: 20px; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; pointer-events: none !important; }
        .action-btn:hover, .action-btn:focus-visual {
            background: transparent;
            box-shadow: none;
            color: var(--text-primary);
        }
        .action-btn.favorited { background: transparent; color: var(--accent); border-color: transparent; }
        .action-btn.favorited:hover, .action-btn.favorited:focus-visible {
            background: transparent;
            box-shadow: none;
            color: var(--accent);
        }

        /* Mobile: keep message-actions visible and remove frames/borders */
        @media (max-width: 768px) {
            .message-actions { opacity: 1 !important; pointer-events: auto !important; border: none !important; user-select: none !important; -webkit-user-select: none !important; -moz-user-select: none !important; -ms-user-select: none !important; z-index: 1000 !important; position: relative !important; }
            .message:hover .message-actions { opacity: 1 !important; pointer-events: auto !important; }
            .action-btn,
            .action-btn:hover,
            .action-btn:focus-visible,
            .action-btn.favorited,
            .action-btn.favorited:hover,
            .action-btn.favorited:focus-visible {
                background: transparent !important;
                box-shadow: none !important;
                border: none !important;
                outline: none !important;
                color: var(--text-secondary) !important;
                user-select: none !important;
                -webkit-user-select: none !important;
                -moz-user-select: none !important;
                -ms-user-select: none !important;
                z-index: 1001 !important;
                position: relative !important;
            }
        }

        /* Desktop: apply accountMenu-like hover to message-actions */
        .message-actions .action-btn:hover,
        .message-actions .action-btn:focus-visible,
        .message-actions .action-btn.favorited:hover,
        .message-actions .action-btn.favorited:focus-visible {
            background: #2f2f2f !important;
            color: #ffffff !important;
            box-shadow: none !important;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }
        [data-theme="light"] .message-actions .action-btn:hover,
        [data-theme="light"] .message-actions .action-btn:focus-visible,
        [data-theme="light"] .message-actions .action-btn.favorited:hover,
        [data-theme="light"] .message-actions .action-btn.favorited:focus-visible {
            background: #ececec !important;
            color: #0d0d0d !important;
        }
        [data-theme="light"] .message-actions .action-btn:hover img,
        [data-theme="light"] .message-actions .action-btn:focus-visible img {
            filter: brightness(0) !important;
        }

        .action-btn.favorited svg {
            fill: currentColor !important;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            pointer-events: none !important;
        }


        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            border: 0;
        }

        /* Cosmos Activity Box — Claude Code style */
        @keyframes activity-shimmer {
            0% { background-position: -200% 0; }
            100% { background-position: 200% 0; }
        }

        .cosmos-activity-box {
            margin: 8px 0;
            overflow: hidden;
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-activity-box * {
            user-select: none !important;
            -webkit-user-select: none !important;
        }

        .cosmos-activity-logo {
            width: 25px;
            height: 25px;
            flex-shrink: 0;
            user-select: none;
            -webkit-user-select: none;
            pointer-events: none;
        }
        .cosmos-activity-logo-light { display: none; }
        [data-theme="light"] .cosmos-activity-logo-dark { display: none; }
        [data-theme="light"] .cosmos-activity-logo-light { display: inline; }
        .cosmos-activity-header {
            display: flex;
            align-items: center;
            gap: 8px;
            border-radius: 24px;
            padding: 10px 14px 10px 10px;
            cursor: pointer;
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-activity-header:hover {
            background: transparent;
        }

        .cosmos-activity-summary {
            flex: 1;
            font-size: 13px;
            color: rgba(255,255,255,0.5);
            font-weight: 400;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            user-select: none;
            -webkit-user-select: none;
        }

        .cosmos-activity-box.active .cosmos-activity-header {
            background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.03) 50%, transparent 100%);
            background-size: 200% 100%;
            animation: activity-shimmer 2s ease-in-out infinite;
        }
        .cosmos-activity-box.active .cosmos-activity-summary {
            color: rgba(255,255,255,0.7);
        }

        .cosmos-activity-steps {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        .cosmos-activity-box.expanded .cosmos-activity-steps {
            max-height: 500px;
            overflow-y: auto;
        }

        .cosmos-activity-step {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 7px 14px 7px 18px;
            font-size: 13px;
            color: rgba(255,255,255,0.6);
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-activity-steps .cosmos-activity-step:not(:first-child) {
            border-top: 1px solid rgba(255,255,255,0.07) !important;
        }
        .cosmos-activity-step .step-icon {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            opacity: 0.5;
            filter: invert(1);
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-activity-step .step-label {
            flex: 1;
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-activity-step .step-badge {
            font-size: 11px;
            color: rgba(255,255,255,0.35);
            background: rgba(255,255,255,0.06);
            padding: 2px 8px;
            border-radius: 20px;
            flex-shrink: 0;
            user-select: none;
            -webkit-user-select: none;
        }

        .cosmos-activity-step.done-step {
            color: rgba(255,255,255,0.35);
            padding-bottom: 10px;
        }

        .cosmos-activity-box.error .cosmos-activity-summary {
            color: rgba(239, 68, 68, 0.7);
        }

        .cosmos-activity-steps::-webkit-scrollbar {
            width: 4px;
        }
        .cosmos-activity-steps::-webkit-scrollbar-track {
            background: transparent;
        }
        .cosmos-activity-steps::-webkit-scrollbar-thumb {
            background: rgba(255,255,255,0.08);
            border-radius: 4px;
        }

        @media (max-width: 768px) {
            .cosmos-activity-header { padding: 8px 12px 8px 10px; min-height: 44px; }
            .cosmos-activity-summary { font-size: 12px; }
            .cosmos-activity-step { padding: 6px 12px 6px 14px; font-size: 12px; }
        }
        @media (max-width: 480px) {
            .cosmos-activity-header { padding: 8px 10px 8px 8px; }
            .cosmos-activity-step { gap: 8px; }
        }

        .selection-reply-popup {
            position: absolute;
            display: none;
            z-index: 5000;
            background: #2f2f2f;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 50%;
            width: 36px;
            height: 36px;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(0,0,0,0.35);
            color: #ececec;
            pointer-events: auto;
            user-select: none;
            -webkit-user-select: none;
        }
        .selection-reply-popup:hover {
            background: #3a3a3a;
        }
        .selection-reply-popup svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }
        [data-theme="light"] .selection-reply-popup {
            background: #ffffff;
            border-color: rgba(0,0,0,0.1);
            box-shadow: 0 4px 16px rgba(0,0,0,0.12);
            color: #0d0d0d;
        }
        [data-theme="light"] .selection-reply-popup:hover {
            background: #f4f4f4;
        }

        .reply-context-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            font-size: 12px;
            color: var(--text-secondary, #818181);
            border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
            user-select: none;
            -webkit-user-select: none;
        }
        .reply-context-bar svg {
            width: 14px;
            height: 14px;
            flex-shrink: 0;
            opacity: 0.5;
        }
        .reply-context-text {
            flex: 1;
            min-width: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .reply-context-cancel {
            flex-shrink: 0;
            background: transparent;
            border: none;
            color: var(--text-secondary, #818181);
            cursor: pointer;
            padding: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            width: 20px;
            height: 20px;
        }
        .reply-context-cancel:hover {
            color: var(--text, #ececec);
            background: rgba(255,255,255,0.08);
        }
        [data-theme="light"] .reply-context-cancel:hover {
            color: var(--text, #0d0d0d);
            background: rgba(0,0,0,0.06);
        }
        .reply-context-cancel svg {
            width: 12px;
            height: 12px;
            opacity: 1;
        }

        .research-context-bar {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            font-size: 12px;
            color: var(--text-secondary, #818181);
            border-bottom: 1px solid var(--border, rgba(255,255,255,0.08));
            user-select: none;
            -webkit-user-select: none;
        }
        .research-context-bar button:hover {
            color: var(--text, #ececec);
            background: rgba(255,255,255,0.08);
        }
        [data-theme="light"] .research-context-bar button:hover {
            color: var(--text, #0d0d0d);
            background: rgba(0,0,0,0.06);
        }

        .cosmos-lightbox {
            position: fixed;
            inset: 0;
            z-index: 15000;
            background: rgba(0,0,0,0.92);
            display: none;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            user-select: none;
            -webkit-user-select: none;
        }
        .cosmos-lightbox.open {
            display: flex;
        }
        .cosmos-lightbox-img {
            max-width: 90vw;
            max-height: 80vh;
            object-fit: contain;
            border-radius: 6px;
            user-select: none;
            -webkit-user-drag: none;
        }
        .cosmos-lightbox-close {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.1);
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 2;
        }
        .cosmos-lightbox-close:hover {
            background: rgba(255,255,255,0.2);
        }
        .cosmos-lightbox-arrow {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.1);
            color: #ffffff;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 2;
        }
        .cosmos-lightbox-arrow:hover {
            background: rgba(255,255,255,0.2);
        }
        .cosmos-lightbox-arrow.prev {
            left: 16px;
        }
        .cosmos-lightbox-arrow.next {
            right: 16px;
        }
        .cosmos-lightbox-footer {
            position: absolute;
            bottom: 20px;
            left: 0;
            right: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 16px;
            pointer-events: none;
        }
        .cosmos-lightbox-counter {
            font-size: 14px;
            color: rgba(255,255,255,0.7);
            font-weight: 400;
        }
        .cosmos-lightbox-domain {
            position: absolute;
            bottom: 20px;
            left: 20px;
            font-size: 12px;
            color: rgba(255,255,255,0.45);
            pointer-events: none;
        }
        @media (max-width: 768px) {
            .cosmos-lightbox-arrow { width: 36px; height: 36px; }
            .cosmos-lightbox-close { width: 36px; height: 36px; top: 12px; right: 12px; }
            .cosmos-lightbox-img { max-width: 96vw; max-height: 85vh; }
        }

        /* Thinking text: Roboto normal, white, subtle sweep inside text only */
        .thinking-text {
            font-size: 14px;
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            font-weight: 400;
            letter-spacing: 0.5px;
            user-select: none;
            text-shadow: none;
            display: inline-block;
            background: linear-gradient(90deg,
                rgba(186,186,186,0.25) 0%,
                rgba(186,186,186,0.45) 42%,
                #BABABA 50%,
                rgba(186,186,186,0.45) 58%,
                rgba(186,186,186,0.25) 100%
            );
            background-size: 200% 100%;
            -webkit-background-clip: text;
            background-clip: text;
            color: transparent;
            -webkit-text-fill-color: transparent;
        }
        

        .input-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
            background: #303030;
            border: none !important;
            border-radius: 28px;
            padding: 10px;
            min-height: var(--input-height);
            max-height: min(max(35svh, 5rem), 13rem);
            position: relative;
            max-width: var(--chat-width);
            width: min(94vw, var(--chat-width));
            z-index: 100;
            box-shadow: none;
        }
        .input-wrapper.centered {
            position: fixed;
            top: 40%;
            bottom: auto;
            left: 50%;
            transform: translateX(-50%);
            z-index: 9999;
            max-width: 640px;
            width: min(980px, 92%);
            padding: 10px;
            gap: 10px;
            min-height: 56px;
        }
        .input-area {
            background: #212121;
            padding: 8px 0 24px;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
        .input-area:has(.input-wrapper.centered) {
            height: 0;
            padding: 0;
        }
        /* Use app assistant font inside input wrapper */
        .input-wrapper, .input-wrapper * { font-family: 'Default', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif !important; }
        .attachment-panel {
            position: absolute;
            left: 14px;
            right: 14px;
            bottom: calc(100% + 6px);
            box-sizing: border-box;
            background: rgba(28, 28, 30, 0.92);
            backdrop-filter: blur(20px) saturate(180%);
            -webkit-backdrop-filter: blur(20px) saturate(180%);
            border: 0.5px solid rgba(255, 255, 255, 0.08);
            border-radius: 12px;
            padding: 6px 10px;
            z-index: 1;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24), 0 0 0 0.5px rgba(255, 255, 255, 0.04);
        }

        .attach-chip {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: rgba(255, 255, 255, 0.04);
            border: 0.5px solid rgba(255, 255, 255, 0.08);
            border-radius: 10px;
            padding: 6px 8px;
            max-width: 100%;
            cursor: pointer;
        }
        .attach-chip:hover {
            background: rgba(255, 255, 255, 0.08);
            border-color: rgba(255, 255, 255, 0.12);
        }
        .attach-icon {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
            opacity: 0.9;
        }
        .attach-meta {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            min-width: 0;
        }
        .attach-name {
            font-size: 11.5px;
            max-width: 200px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            font-weight: 450;
            letter-spacing: -0.01em;
        }
        .attach-size {
            font-size: 10.5px;
            color: rgba(255, 255, 255, 0.5);
            font-weight: 400;
        }
        .attach-ext {
            font-size: 9px;
            line-height: 1;
            color: rgba(255, 255, 255, 0.6);
            border: 0.5px solid rgba(255, 255, 255, 0.1);
            border-radius: 4px;
            padding: 2px 5px;
            background: rgba(255, 255, 255, 0.04);
            text-transform: uppercase;
            letter-spacing: 0.02em;
            font-weight: 500;
        }
        .attach-remove {
            margin-left: auto;
            background: transparent;
            border: none;
            color: rgba(255, 255, 255, 0.5);
            cursor: pointer;
            font-size: 13px;
            border-radius: 50%;
            width: 20px;
            height: 20px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .attach-remove:hover {
            color: rgba(255, 255, 255, 0.9);
            background: rgba(255, 255, 255, 0.1);
            transform: scale(1.1);
        }

        /* User message attachment chips (square tiles) */
        .user-attach-bar { margin-bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 9998; }
        .file-chip {
            position: relative;
            display: inline-flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            width: 96px;
            height: 96px;
            padding: 10px 8px;
            border-radius: 12px;
            background: var(--surface);
            border: 1px solid var(--border);
            box-shadow: none;
            color: var(--text-primary);
            text-align: center;
            cursor: pointer;
            box-sizing: border-box;
        }
        .file-chip:hover { border-color: color-mix(in oklab, var(--border) 75%, #ffffff 25%); background: color-mix(in oklab, var(--surface) 92%, #ffffff 8%); }
        .file-chip:active { transform: translateY(1px); }
        .file-chip .ext-badge {
            position: absolute; top: 6px; right: 6px;
            font-size: 10px; line-height: 1; letter-spacing: .3px;
            padding: 3px 6px; border-radius: 9999px;
            background: var(--surface-hover); color: var(--text-secondary);
            border: 1px solid var(--border);
        }
        .file-chip .tile-icon { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-hover); margin-bottom: 6px; }
        .file-chip .tile-name { font-size: 11px; line-height: 1.25; max-width: 100%; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

        .bigChats {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            padding: 14px 18px;
            border-radius: 24px;
            background: var(--surface);
            border: 1px solid var(--border);
            cursor: pointer;
            font-size: 14px;
            color: var(--text-primary);
            width: 100%;
            max-width: 700px;
            text-align: left;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }
        .bigChats:hover { border-color: color-mix(in oklab, var(--border) 75%, #ffffff 25%); background: color-mix(in oklab, var(--surface) 92%, #ffffff 8%); }
        .bigChats:active { transform: translateY(1px) scale(0.98); }
        
        #pastChatsLabel {
            display: none;
            font-size: 13px;
            color: #888;
            margin-bottom: 8px;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
            -ms-user-select: none;
        }

        .input-wrapper:focus-within { background: #303030; border: none !important; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; transform: translateX(-50%); outline: none; }

        /* Subtle note under the input for context */
        .input-wrapper::after {
            content: "Cosmos is AI-powered and may make errors. Please verify information from reliable sources.";
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: -18px;
            font-size: 11px;
            line-height: 1;
            color: #ffffff;
            font-weight: normal;
            pointer-events: none;
            white-space: nowrap;
            letter-spacing: 0.2px;
        }
        .input-wrapper.centered::after { display: none; }

        .message-input {
            flex: 1;
            background: none;
            border: none;
            color: var(--text-primary);
            font-size: 15px;
            resize: none;
            outline: none;
            max-height: 999px; /* JS limits to 4 lines */
            min-height: 24px;
            font-family: inherit;
            line-height: 1.5;
            text-align: left;
            padding: 2px 0;
            vertical-align: middle;
        }
        .message-input::placeholder {
            color: var(--text-muted);
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
        }
        #messageInput::placeholder {
            color: #AFAFAF;
            opacity: 1;
            user-select: none;
            -webkit-user-select: none;
            -moz-user-select: none;
        }
        .send-btn {
            width: 40px;
            height: 40px;
            background: var(--send-bg) !important;
            border: none;
            border-radius: 50%;
            color: var(--send-fg) !important;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            outline: none !important;
            -webkit-tap-highlight-color: transparent !important;
            -webkit-appearance: none;
            appearance: none;
            box-shadow: none;
        }

        .send-btn:hover:not(:disabled) { background: var(--send-bg-hover) !important; transform: none; filter: none !important; color: var(--send-fg) !important; opacity: 1 !important; }

        /* When input is empty, keep button "cold" even on hover/active */
        /* Remove cold/empty styling from send button */

        .send-btn:active:not(:disabled) { background: var(--send-bg-hover) !important; transform: none !important; -webkit-tap-highlight-color: transparent !important; filter: none !important; color: var(--send-fg) !important; opacity: 1 !important; }

        .send-btn:disabled {
            opacity: 1;
            cursor: not-allowed;
            transform: scale(1);
        }

        /* Ensure icon inherits button color and stays fully opaque */
        .send-btn *, .send-btn svg, .send-btn path {
            color: inherit !important;
            opacity: 1 !important;
            filter: none !important;
            mix-blend-mode: normal !important;
            fill: currentColor !important;
            stroke: currentColor !important;
        }
        .send-btn:hover *, .send-btn:active * {
            color: inherit !important;
            opacity: 1 !important;
            filter: none !important;
            mix-blend-mode: normal !important;
        }

        .overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 10000 !important;
            opacity: 0;
            visibility: hidden;
            pointer-events: none;
        }
        .overlay.show {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        ::-webkit-scrollbar {
            width: 6px;
        }

        ::-webkit-scrollbar-track {
            background: transparent;
        }

        ::-webkit-scrollbar-thumb {
            background: var(--border);
            border-radius: 3px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: var(--text-muted);
        }
        @media (max-width: 768px) {
            
            .sidebar {
                position: fixed;
                left: 0;
                top: 0;
                bottom: 0;
                width: 290px; 
                z-index: 10001 !important; 
                transform: translateX(-100%);
                border-right: 1px solid var(--border);
                backdrop-filter: blur(1px);
                -webkit-backdrop-filter: blur(1px);
                box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
                pointer-events: auto;
            }

            .sidebar.open {
                transform: translateX(0);
                display: flex !important;
                pointer-events: auto;
            }

            .sidebar.open * {
                pointer-events: auto;
            }

            .menu-toggle {
                display: flex;
                width: 44px; 
                height: 44px;
                align-items: center;
                justify-content: center;
                border-radius: 12px;
                background: transparent;
                border: none;
                color: var(--text-primary);
                cursor: pointer;
            }
            .menu-toggle:hover {
                background: var(--surface-hover);
                transform: none;
            }

            .menu-toggle:active {
                transform: scale(0.95);
            }


            .main-content {
                width: 100%;
                height: 100svh;
                overflow: hidden;
                display: flex;
                flex-direction: column;
            }

            .messages-container {
                padding: 20px 16px 80px 16px;
                flex: 1;
                max-width: var(--chat-width);
                overflow-y: auto;
                -webkit-overflow-scrolling: touch;
                scroll-behavior: smooth;
            }


            .input-wrapper {
                padding: 12px 14px;
                gap: 10px;
                min-height: 52px; 
                border-radius: 28px;
                border: none !important;
            }

            .input-wrapper:focus-within {
                border: none !important;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                box-shadow: none;
            }

            .message-input {
                font-size: 16px !important; 
                line-height: 1.4;
                min-height: 24px;
                max-height: 120px;
                resize: none;
                background: transparent;
                border: none;
                outline: none;
                color: var(--text-primary);
                width: 100%;
            }

            .message-input::placeholder {
                color: var(--text-muted);
            }


            .send-btn {
                width: 44px;
                height: 44px;
                border-radius: 50%;
                background: var(--send-bg) !important;
                border: none;
                color: var(--send-fg) !important;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .send-btn:hover { background: var(--send-bg-hover) !important; transform: none; filter: none !important; color: var(--send-fg) !important; }

            .send-btn:active { transform: none; filter: none !important; background: var(--send-bg-hover) !important; color: var(--send-fg) !important; }
            .send-btn:disabled {
                opacity: 0.5;
                cursor: not-allowed;
                transform: none;
            }

            .suggestions {
                grid-template-columns: 1fr;
                gap: 16px;
                margin-top: 24px;
            }
            .suggestion {
                padding: 20px;
                border-radius: 18px;
                cursor: pointer;
                min-height: 80px;
                display: flex;
                flex-direction: column;
                justify-content: center;
                background: var(--surface);
                border: 1px solid var(--border);
            }
            .suggestion:hover {
                background: var(--surface-hover);
                border-color: var(--accent);
                transform: translateY(-2px);
                box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
            }

            .suggestion:active {
                transform: scale(0.98);
            }
            .suggestion-icon {
                font-size: 24px;
                margin-bottom: 8px;
            }
            .suggestion h3 {
                font-size: 16px;
                margin-bottom: 4px;
                color: var(--text-primary);
                font-weight: 600;
            }
            .suggestion p {
                font-size: 14px;
                color: var(--text-secondary);
                line-height: 1.4;
            }
            .message-wrapper {
                gap: 12px;
                padding: 16px 0;
            }
            .message-avatar {
                width: 36px;
                height: 36px;
                border-radius: 10px;
                flex-shrink: 0;
            }

            .greeting { font-size: 26px; line-height: 32px; }

            .modal-content {
                margin: 16px;
                max-width: calc(100vw - 32px);
                max-height: calc(100vh - 32px);
                border-radius: 16px;
                background: var(--secondary);
                border: 1px solid var(--border);
                box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
                overflow: hidden;
            }


            .header {
                padding: 12px 16px;
                height: 64px;
                border-bottom: none;
                background: rgba(33,33,33,0.85) !important;
                backdrop-filter: blur(16px) !important;
                -webkit-backdrop-filter: blur(16px) !important;
                position: sticky;
                top: 0;
                z-index: 100;
                display: flex;
                align-items: center;
                justify-content: space-between;
            }

            .chat-info h1 {
                font-size: 17px;
            }

            .title-edit-input {
                font-size: 16px;
                width: 150px;
            }

            .select-menu {
                max-width: calc(100vw - 32px);
                width: 200px;
                border-radius: 24px;
            }

            .select-trigger {
                padding: 10px 12px;
                font-size: 15px;
            }
        }
        @media (max-width: 480px) {
            
            .header {
                height: 60px;
                padding: 8px 12px;
                border-bottom: none;
                background: rgba(33,33,33,0.85) !important;
                backdrop-filter: blur(16px) !important;
                -webkit-backdrop-filter: blur(16px) !important;
            }
            [data-theme="light"] .header {
                background: rgba(255,255,255,0.9) !important;
            }

            .header-left {
                gap: 10px;
            }

            .chat-info h1 {
                max-width: 160px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            .header-actions {
                gap: 3px;
                margin-top: 6px !important;
                padding: 3px !important;
            }

            .floating-button-group {
                top: 8px !important;
                left: 16px !important;
            }
            
            .floating-button-group .btn-icon {
                width: 32px !important;
                height: 32px !important;
            }

            .sidebar {
                width: 270px; 
            }

            .sidebar-header {
                padding: 16px 12px;
            }

            .logo {
                gap: 8px;
                margin-bottom: 16px;
            }

            .logo-icon {
                width: 44px;
                height: 44px;
                font-size: 18px;
                border-radius: 12px;
            }

            .logo-text {
                font-size: 17px;
            }

            .search-input {
                padding: 10px 14px;
                font-size: 16px; 
                border-radius: 10px;
                min-height: 40px;
            }

            .new-chat {
                padding: 12px 16px;
                font-size: 15px;
                min-height: 44px;
                border-radius: 10px;
                font-weight: 600;
                gap: 8px;
            }

            .chat-history {
                padding: 8px 12px 16px;
            }

            .chat-item {
                padding: 10px 12px;
                border-radius: 10px;
                margin-bottom: 0 !important;
                min-height: 40px;
                display: flex;
                align-items: center;
            }

            .chat-title {
                font-size: 14px;
                line-height: 1.3;
            }

            .messages-container {
                padding: 16px 12px 16px 12px;
            }

            .message {
                margin-bottom: 20px;
                padding: 0;
                position: relative;
                z-index: 1;
            }

            .message-wrapper {
                gap: 10px;
                align-items: flex-start;
            }

            .message-avatar {
                width: 32px;
                height: 32px;
                border-radius: 8px;
                flex-shrink: 0;
            }

            .message.user .message-bubble {
                max-width: calc(100vw - 80px);
                padding: 6px 16px !important;
                font-size: 17px;
                line-height: 1.4;
                border-radius: 18px !important;
                background: var(--user-bubble-bg, var(--accent));
                color: white;
                margin-left: auto;
                box-shadow: none;
            }
            
            .message.assistant .message-bubble {
                padding: 16px 0 0;
                max-width: 100%;
                font-size: 15px;
                line-height: 1.5;
                background: #212121;
            }

            .message-text {
                word-wrap: break-word;
                overflow-wrap: break-word;
            }

            .input-wrapper {
                padding: 10px 12px;
                border-radius: 24px;
                min-height: 44px;
                gap: 8px;
                background: #303030;
                border: none !important;
                border: none;
                position: relative;
                bottom: auto;
                left: auto;
                transform: none;
                max-width: 480px;
                width: 90%;
                z-index: 100;
            }
            .input-wrapper.centered {
                position: fixed;
                bottom: auto;
                left: 50%;
                transform: translateX(-50%);
                z-index: 9999;
            }
            .input-wrapper:focus-within {
                background: #303030;
                border: none !important;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                box-shadow: none;
                outline: none;
            }
            .input-wrapper.centered:focus-within {
                transform: translateX(-50%) !important;
            }
            
            .message-input {
                font-size: 16px !important; 
                line-height: 1.4;
                min-height: 20px;
                max-height: 100px;
                padding: 0;
                background: transparent;
                border: none;
                outline: none;
                resize: none;
                width: 100%;
            }

            .message-input::placeholder {
                color: var(--text-muted);
            }
            .send-btn {
                width: 40px;
                height: 40px;
                border-radius: 50%;
                background: var(--send-bg) !important;
                border: none;
                color: var(--send-fg) !important;
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .send-btn:hover { background: var(--send-bg-hover) !important; transform: none; filter: none !important; color: var(--send-fg) !important; opacity: 1 !important; }
            .send-btn:active { transform: none; filter: none !important; color: var(--send-fg) !important; background: var(--send-bg-hover) !important; opacity: 1 !important; }
            .menu-toggle {
                width: 40px;
                height: 40px;
                border-radius: 10px;
                background: transparent;
                border: none;
                color: var(--text-primary);
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
            }

            .menu-toggle:hover {
                background: var(--surface-hover);
                transform: none; /* no lift on hover (sm breakpoint) */
            }
            .greeting { font-size: 24px; line-height: 30px; }

            .suggestions {
                grid-template-columns: 1fr;
                gap: 14px;
                margin-top: 20px;
            }
            .suggestion {
                padding: 16px;
                border-radius: 18px;
                cursor: pointer;
                min-height: 70px;
                display: flex;
                flex-direction: column;
                justify-content: center;
                background: var(--surface);
                border: 1px solid var(--border);
            }

            .suggestion:hover {
                background: var(--surface-hover);
                border-color: var(--accent);
                transform: translateY(-1px);
                box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            }

            .suggestion:active {
                transform: scale(0.98);
            }

            .suggestion-icon {
                font-size: 22px;
                margin-bottom: 6px;
            }
            .suggestion h3 {
                font-size: 15px;
                margin-bottom: 3px;
                color: var(--text-primary);
                font-weight: 600;
            }

            .suggestion p {
                font-size: 13px;
                color: var(--text-secondary);
                line-height: 1.3;
            }
            .action-btn {
                width: 36px;
                height: 36px;
                border-radius: 18px;
                background: transparent;
                border: 1px solid var(--border);
                color: var(--text-secondary);
                cursor: pointer;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            .action-btn:hover {
                background: var(--surface-hover);
                border-color: var(--accent);
                color: var(--text-primary);
                transform: scale(1.05);
            }
        }
        @media (min-width: 769px) and (max-width: 1024px) {
            .main-content {
                padding: 16px;
            }
            
            .messages-container {
                max-width: 700px;
                padding: 24px 20px 80px 20px;
            }

            .sidebar {
                width: 270px;
            }

            .sidebar-toggle-btn {
                display: none !important;
            }
        }
        @media (max-width: 360px) {
            
            .sidebar {
                width: 250px; 
                z-index: 10001 !important; 
            }

            .header {
                height: 56px;
                padding: 6px 10px;
                border-bottom: none;
                backdrop-filter: blur(16px) !important;
                -webkit-backdrop-filter: blur(16px) !important;
            }

            .chat-info h1 {
                font-size: 17px;
                max-width: 140px;
            }

            .header-btn {
                width: 36px;
                height: 36px;
                border-radius: 8px;
            }

            .menu-toggle {
                width: 36px;
                height: 36px;
                border-radius: 8px;
                outline: none !important;
                -webkit-tap-highlight-color: transparent !important;
                -webkit-appearance: none;
                appearance: none;
            }

            .sidebar-header {
                padding: 12px 10px;
            }

            .logo-icon {
                width: 40px;
                height: 40px;
                font-size: 16px;
                border-radius: 10px;
            }

            .logo-text {
                font-size: 16px;
            }

            .search-input {
                padding: 8px 12px;
                font-size: 16px; 
                border-radius: 8px;
                min-height: 36px;
            }

            .new-chat {
                padding: 10px 14px;
                font-size: 14px;
                min-height: 40px;
                border-radius: 8px;
                gap: 6px;
            }

            .chat-history {
                padding: 6px 10px 12px;
            }

            .select-menu {
                max-width: calc(100vw - 24px);
                width: 180px;
                border-radius: 24px;
            }

            .select-trigger {
                padding: 8px 10px;
                font-size: 14px;
                border-radius: 12px;
            }

            .select-option {
                padding: 7px 9px;
                font-size: 14px;
            }

            .chat-item {
                padding: 8px 10px;
                border-radius: 8px;
                margin-bottom: 0 !important;
                min-height: 36px;
            }

            .chat-title {
                font-size: 13px;
                line-height: 1.2;
            }

            .messages-container {
                padding: 12px 10px;
            }

            .message {
                margin-bottom: 16px;
                position: relative;
                z-index: 1;
            }

            .message-avatar {
                width: 28px;
                height: 28px;
                border-radius: 7px;
            }
            
            .message.user .message-bubble {
                max-width: calc(100vw - 60px);
                padding: 6px 16px !important;
                font-size: 17px;
                line-height: 1.3;
                border-radius: 18px 18px 3px 18px;
            }
            
            .message.assistant .message-bubble {
                padding: 14px 0 0;
                max-width: 100%;
                font-size: 14px;
                line-height: 1.4;
                background: #212121;
            }

            .input-wrapper {
                padding: 8px 10px;
                gap: 6px;
                min-height: 40px;
                border-radius: 22px;
                background: #303030;
                border: none !important;
                border: none;
                position: relative;
                bottom: auto;
                left: auto;
                transform: none;
                max-width: 360px;
                width: 92%;
                z-index: 100;
            }
            .input-wrapper.centered {
                position: fixed;
                bottom: auto;
                left: 50%;
                transform: translateX(-50%);
                z-index: 9999;
            }
            .input-wrapper:focus-within {
                background: #303030;
                border: none !important;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                box-shadow: none;
                outline: none;
            }
            .input-wrapper.centered:focus-within {
                transform: translateX(-50%) !important;
            }

            .message-input {
                font-size: 16px !important; 
                line-height: 1.3;
                min-height: 18px;
                max-height: 80px;
            }
            .send-btn {
                width: 36px;
                height: 36px;
                border-radius: 50%;
            }
            .greeting { font-size: 22px; line-height: 28px; }

            .suggestions {
                gap: 12px;
                margin-top: 16px;
            }

            .suggestion {
                padding: 14px;
                border-radius: 12px;
                min-height: 60px;
            }

            .suggestion-icon {
                font-size: 20px;
                margin-bottom: 4px;
            }

            .suggestion h3 {
                font-size: 14px;
                margin-bottom: 2px;
            }

            .suggestion p {
                font-size: 12px;
                line-height: 1.2;
            }

            .action-btn {
                width: 32px;
                height: 32px;
                border-radius: 18px;
                font-size: 11px;
            }

            .modal-content {
                margin: 12px;
                max-width: calc(100vw - 24px);
                max-height: calc(100vh - 24px);
                border-radius: 12px;
            }

            .modal-header {
                padding: 16px 20px 12px;
            }

            .modal-header h3 {
                font-size: 16px;
            }

            .modal-body {
                padding: 16px 20px;
                max-height: 50vh;
            }

            .code-lang-container {
                gap: 6px;
            }

            .code-lang-icon {
                width: 14px;
                height: 14px;
            }

            .code-block {
                margin: 12px 0;
                border-radius: 8px;
            }

            .code-header {
                padding: 8px 12px;
                font-size: 12px;
            }

            .copy-btn {
                width: 28px;
                height: 28px;
                font-size: 12px;
            }


            .code-lang {
                font-size: 11px;
            }
        }

        @media (hover: hover) and (pointer: fine) {
            .sidebar:hover {
                box-shadow: none;
            }
            
            .suggestion:hover {
                transform: translateY(-2px);
                box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
            }
            
            .message-input:hover {
                border-color: var(--accent);
            }
        }
        @media (hover: none) and (pointer: coarse) {
            
            .suggestion:hover,
            .chat-item:hover,
            .menu-toggle:hover {
                transform: none;
                box-shadow: none;
            }

            .suggestion:active {
                transform: scale(0.98);
                background: var(--surface-hover);
                border-color: var(--accent);
            }
            
            .chat-item:active {
                background: var(--surface-hover);
                transform: none;
            }
            
            .header-btn:active,
            .menu-toggle:active {
                background: var(--surface-hover) !important;
                transform: scale(0.95) !important;
                -webkit-tap-highlight-color: transparent !important;
            }
            
            .send-btn:active {
                transform: scale(0.95);
                background: var(--send-bg-hover) !important;
                filter: none !important;
                color: var(--send-fg) !important;
                opacity: 1 !important;
            }
            

            .chat-item {
                min-height: 48px; 
            }
            
            .header-btn,
            .menu-toggle,
            .send-btn {
                min-width: 44px;
                min-height: 44px;
            }
            
            .action-btn {
                min-width: 40px;
                min-height: 40px;
            }
        }
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after { }
        }
        @media (prefers-contrast: high) {
            :root {
                --border: #666666;
                --text-secondary: #ffffff;
                --text-muted: #cccccc;
                --surface: #2f2f2f;
                --surface-hover: #444444;
            }
            
            .input-wrapper:focus-within {
                border: none;
                box-shadow: none;
            }
            
            .suggestion {
                border-width: 2px;
            }
            
            .chat-item.active {
                border-width: 2px;
                border-color: #ffffff;
            }
        }
        @supports (-webkit-touch-callout: none) {
            
            .input-wrapper {
                
                -webkit-text-size-adjust: 100%;
            }
            
            .message-input {
                
                -webkit-appearance: none;
                appearance: none;
                border-radius: 0;
                outline: none !important;
            }

            .header {
                padding-top: max(12px, env(safe-area-inset-top));
                backdrop-filter: blur(16px) !important;
                -webkit-backdrop-filter: blur(16px) !important;
            }
            
            .sidebar {
                padding-top: env(safe-area-inset-top);
            }

            .modal-content {
                margin: 6px;
                max-height: calc(100vh - 12px);
                border-radius: 10px;
            }

            .modal-header {
                padding: 14px 16px 10px;
            }

            .modal-title {
                font-size: 15px;
            }

            .modal-body {
                padding: 12px 16px;
            }

            .settings-section {
                margin-bottom: 20px;
            }

            .settings-section h3 {
                font-size: 13px;
                margin-bottom: 10px;
            }
            .setting-item {
                padding: 14px 0;
                min-height: 66px;
                gap: 12px;
            }

            .setting-title {
                font-size: 15px;
                font-weight: 500;
                color: var(--text-primary);
                margin-bottom: 4px;
                line-height: 1.3;
            }

            .setting-description {
                font-size: 11px;
                line-height: 1.3;
            }
            select {
                min-height: 44px !important;
                padding: 10px 14px !important;
                font-size: 15px !important;
                max-width: 160px;
            }
            .toggle-switch {
                width: 64px;
                height: 34px;
                border-radius: 34px;
                background: var(--toggle-track-off);
                border: 2px solid transparent;
                padding: 3px;
            }
            
            .toggle-switch.active { background: var(--toggle-track-on); border-color: var(--accent); }
            .toggle-slider {
                width: 28px;
                height: 28px;
                box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
                background: var(--toggle-thumb-off);
            }
            
            .toggle-switch.active .toggle-slider { transform: translateX(30px); background: var(--toggle-thumb-on); }
            .color-circle {
                width: 30px;
                height: 30px;
            }
        }
        @media (max-height: 500px) and (orientation: landscape) {
            .greeting { font-size: 20px; line-height: 26px; }

            .suggestions {
                grid-template-columns: repeat(2, 1fr);
                gap: 12px;
                margin-top: 16px;
            }
            
            .header {
                height: 56px;
                background: rgba(33,33,33,0.85) !important;
                backdrop-filter: blur(16px) !important;
                -webkit-backdrop-filter: blur(16px) !important;
                border-bottom: none;
            }
            .messages-container {
                padding: 12px 16px;
            }
        }
        /* Prevent focus click from moving the input bar */
        .input-wrapper.centered:focus-within {
            top: 40% !important;
            bottom: auto !important;
            left: 50% !important;
            transform: translateX(-50%) !important;
            border: none !important;
            box-shadow: none !important;
            background: #303030 !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        .input-wrapper:not(.centered):focus-within {
            border: none !important;
            box-shadow: none !important;
            background: #303030 !important;
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
        }
        @media (pointer: coarse) {
            .action-btn {
                min-height: 44px;
                min-width: 44px;
            }
            .toggle-switch {
                min-height: 44px;
                min-width: 76px;
                width: 76px;
                height: 42px;
                border-radius: 42px;
                outline: none !important;
                -webkit-tap-highlight-color: transparent !important;
                background: var(--toggle-track-off);
                padding: 4px;
                display: flex;
                align-items: center;
                box-sizing: border-box;
                border: 2px solid transparent;
            }
            
            .toggle-switch.active {
                background: var(--toggle-track-on);
                border-color: var(--toggle-track-on);
            }
            
            .toggle-slider {
                position: relative;
                width: 34px;
                height: 34px;
                border-radius: 50%;
                box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
                transform: translateX(0);
                flex-shrink: 0;
            }
            
            .toggle-switch.active .toggle-slider {
                transform: translateX(34px);
            }
            
            .new-chat, .header-btn {
                min-height: 44px;
            }
            /* Stabilize input bar on touch devices to prevent jumping when focused */
            .input-wrapper {
                -webkit-tap-highlight-color: transparent !important;
            }
        }
        @supports (bottom: env(safe-area-inset-bottom)) {
            .input-area {
                padding-bottom: calc(24px + env(safe-area-inset-bottom));
            }
        }
        @supports (bottom: constant(safe-area-inset-bottom)) {
            .input-area {
                padding-bottom: calc(24px + constant(safe-area-inset-bottom));
            }
        }

        .color-palette-container {
            margin-top: 12px;
            width: 100%;
            overflow: hidden;
        }

        .color-palette-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 12px;
            max-width: 350px;
            justify-items: center;
            align-items: center;
        }

        .color-option {
            position: relative;
            cursor: pointer;
            padding: 6px;
            border-radius: 12px;
            border: 2px solid transparent;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 60px;
            height: 60px;
            box-sizing: border-box;
        }

        .color-option:hover {
            border-color: var(--border);
            transform: translateY(-2px);
        }

        .color-option.active {
            border-color: var(--custom-color);
            box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
        }

        .color-circle {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            position: relative;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        }

        .color-option:hover .color-circle {
            transform: scale(1.1);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }
        .color-check {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            color: white;
            font-size: 16px;
            font-weight: bold;
            text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
            opacity: 0;
        }

        .color-option.active .color-check {
            opacity: 1;
        }
        @media (max-width: 768px) {
            
            .modal-content {
                margin: 12px;
                max-height: calc(100vh - 24px);
            }

            .modal-body {
                padding: 20px;
            }

            .settings-section {
                margin-bottom: 28px;
            }

            .settings-section h3 {
                font-size: 15px;
                margin-bottom: 14px;
            }

            .setting-item {
                padding: 14px 0;
                min-height: 60px;
                align-items: flex-start;
                flex-direction: column;
                gap: 12px;
            }

            .setting-label {
                width: 100%;
            }

            .setting-title {
                font-size: 15px;
                font-weight: 500;
                margin-bottom: 4px;
            }

            .setting-description {
                font-size: 13px;
                line-height: 1.4;
            }

            select {
                min-height: 44px !important;
                padding: 10px 16px !important;
                font-size: 16px !important;
                border-radius: 8px !important;
                width: 100% !important;
                max-width: 200px;
            }

            .color-palette-grid {
                display: flex;
                flex-wrap: wrap;
                gap: 10px;
                max-width: 100%;
                justify-content: flex-start;
            }

            .color-circle {
                width: 36px;
                height: 36px;
            }
            
            .color-option {
                flex: 0 0 auto;
            }

            .color-check {
                font-size: 14px;
            }
        }
        @media (max-width: 480px) {
            
            .modal-content {
                margin: 8px;
                max-height: calc(100vh - 16px);
                border-radius: 12px;
            }

            .modal-header {
                padding: 16px 20px 12px;
            }

            .modal-title {
                font-size: 16px;
            }

            .modal-body {
                padding: 16px 20px;
            }

            .settings-section {
                margin-bottom: 24px;
            }

            .settings-section h3 {
                font-size: 14px;
                font-weight: 600;
                margin-bottom: 12px;
            }

            .setting-item {
                padding: 16px 0;
                min-height: 70px;
                align-items: flex-start;
                flex-direction: column;
                gap: 14px;
                border-bottom: 1px solid rgba(255, 255, 255, 0.08);
            }

            .setting-label {
                width: 100%;
            }

            .setting-title {
                font-size: 15px;
                font-weight: 500;
                color: var(--text-primary);
                margin-bottom: 4px;
                line-height: 1.3;
            }

            .setting-description {
                font-size: 12px;
                line-height: 1.4;
                opacity: 0.8;
            }
            select {
                min-height: 48px !important;
                padding: 12px 16px !important;
                font-size: 16px !important;
                border-radius: 10px !important;
                width: 100% !important;
                max-width: 180px;
                -webkit-appearance: none;
                appearance: none;
            }

            .toggle-switch {
                min-height: 44px;
                min-width: 70px;
                width: 70px;
                height: 38px;
                border-radius: 38px;
                padding: 3px;
                align-self: flex-end;
                border: 2px solid transparent;
            }
            
            .toggle-switch.active {
                background: var(--accent);
                border-color: var(--accent);
            }
            
            .toggle-slider {
                width: 32px;
                height: 32px;
                box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
            }
            .toggle-switch.active .toggle-slider {
                transform: translateX(32px);
            }

            .color-palette-container {
                width: 100%;
                margin-top: 16px;
            }

            .color-palette-grid {
                gap: 8px;
                justify-content: center;
            }

            .color-circle {
                width: 32px;
                height: 32px;
            }
            
            .color-check {
                font-size: 12px;
            }

            .memory-display {
                font-size: 12px;
                padding: 8px 12px;
                border-radius: 8px;
            }
        }

        .logo {
            display: flex;
            align-items: center;
            gap: 12px !important;
            margin-bottom: 20px;
            position: relative;
        }
        
        .logo-text {
            font-family: 'SYN', sans-serif !important;
            font-size: 18px !important;
            font-weight: 700 !important;
            color: #ffffff !important;
            letter-spacing: -0.02em;
            white-space: nowrap;
            flex-shrink: 0;
            line-height: 1;
            user-select: none;
        }
        
        .sidebar-toggle-btn {
            background: transparent;
            border: none;
            border-radius: 12px;
            color: var(--text-secondary);
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 44px; /* align to common header button size */
            height: 44px; /* align to common header button size */
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
            padding: 0 !important; /* ensure icon is centered */
            
            margin-left: auto;
        }
        .sidebar-toggle-btn svg { width: 24px !important; height: 24px !important; display: block; margin: 0; transform: translate(0px, -1px); }
        
        .sidebar-toggle-btn:hover {
            background: transparent;
            color: inherit;
            transform: none;
        }
        
        .sidebar-toggle-btn:active {
            transform: translateY(0);
        }
        @media (min-width: 1025px) {
            .sidebar-toggle-btn {
                display: inline-flex !important;
                align-items: center;
                justify-content: center;
            }
        }

        /* Hide sidebar toggle on mobile and on portrait orientation */
        @media (max-width: 900px), (orientation: portrait) {
            .sidebar-toggle-btn {
                display: none !important;
            }
        }
        .sidebar-footer { display:flex; align-items:center; justify-content:flex-start; padding: 8px 8px 10px; position: sticky; bottom: 0; z-index: 50; border-radius: 12px; }
        .sidebar-footer .avatar-btn { width: 24px !important; height: 24px !important; min-width: 24px !important; min-height: 24px !important; border-radius: 50% !important; padding: 0; }
        /* Sidebar footer solid background */
        .sidebar-footer {
            background: #212121 !important;
            -webkit-backdrop-filter: none !important;
            backdrop-filter: none !important;
            border-top: none !important;
            box-shadow: none !important;
            border-radius: 12px;
        }
        @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
            .sidebar-footer { background: #212121 !important; }
        }
        /* Sidebar footer background */
        .sidebar .sidebar-footer { background: #171717 !important; }
        
        .floating-tooltip {
            position: absolute;
            background: #3a3a3a;
            color: #fff;
            font-weight: 400;
            border-radius: 9999px;
            padding: 6px 10px;
            font-size: 12px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.35);
            white-space: nowrap;
            pointer-events: none;
            -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
            z-index: 200000;
            display: none;
        }
        @media (hover: none) and (pointer: coarse) {
            .floating-tooltip { display: none !important; }
        }
        
        .floating-tip { position: relative; }
        .floating-tip::after {
            content: attr(data-tip);
            position: absolute;
            left: 50%;
            top: 100%;
            transform: translateX(-50%) translateY(8px);
            background: #3a3a3a;
            color: #fff;
            border: none;
            box-shadow: 0 8px 24px rgba(0,0,0,0.35);
            padding: 6px 10px;
            border-radius: 9999px;
            font-weight: 400;
            font-size: 12px;
            white-space: nowrap;
            pointer-events: none;
            -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
            opacity: 0;
            visibility: hidden;
            z-index: 200000;
        }
        .floating-tip:hover::after {
            opacity: 1;
            visibility: visible;
        }
        @media (hover: none) and (pointer: coarse) {
            .floating-tip::after { content: none !important; display: none !important; }
        }

        .collapsed-only-tip::after { content: none !important; }

        /* Sidebar header buttons hover should match chat-item hover */
        .sidebar-header .sidebar-action,
        .sidebar-header .sidebar-toggle-btn,
        .sidebar-footer .header-btn,
        .sidebar-header .header-btn {
            position: relative;
            border-radius: 10px;
            overflow: hidden;
        }
        .sidebar-header .sidebar-action:hover,
        .sidebar-header .sidebar-toggle-btn:hover,
        .sidebar-header .header-btn:hover {
            background: transparent !important;
            box-shadow: none !important;
            color: #ffffff !important;
        }
        [data-theme="light"] .sidebar-header .sidebar-action:hover,
        [data-theme="light"] .sidebar-header .sidebar-toggle-btn:hover,
        [data-theme="light"] .sidebar-header .header-btn:hover {
            color: #0d0d0d !important;
        }

        .sidebar-header button {
            height: 36px !important;
        }
        .sidebar-header button:not(.sidebar-action) {
            width: 36px !important;
            padding: 0 !important;
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
        }
        .sidebar-header button svg,
        .sidebar-header button img.ui-icon-white {
            width: 20px !important;
            height: 20px !important;
        }

        .message-limit-display {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            padding: 6px 10px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.08);
            border-radius: 24px;
            font-size: 12px;
        }
        .message-limit-display.pro-user {
            opacity: 1;
            filter: none;
            backdrop-filter: none;
        }

        .limit-info {
            display: flex;
            align-items: baseline;
            gap: 3px;
            white-space: nowrap;
        }

        .messages-used {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 13px;
        }

        .messages-total {
            color: var(--text-muted);
            font-size: 11px;
        }

        .limit-bar {
            width: 60px;
            height: 3px;
            background: rgba(255, 255, 255, 0.08);
            border-radius: 2px;
            overflow: hidden;
            position: relative;
        }

        .limit-progress {
            height: 100%;
            background: var(--accent);
            border-radius: 2px;
            min-width: 2px;
        }

        .limit-progress.warning {
            background: #f59e0b;
        }

        .limit-progress.danger {
            background: #ef4444;
        }

        .limit-status {
            display: none;
        }

        .limit-status-text {
            color: var(--success);
            font-weight: 500;
        }

        .limit-status-text.warning {
            color: #f59e0b;
        }

        .limit-status-text.blocked {
            color: #ef4444;
        }

        .limit-icon {
            display: none;
        }

        .coming-soon-badge {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 12px;
            background: var(--warning);
            color: white;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 500;
            width: fit-content;
        }

        .coming-soon-badge svg {
            color: white;
        }
        [data-theme="dark"] .code-lang-icon {
            filter: brightness(0) invert(1);
            opacity: 0.85;
        }
        .toast-container {
            position: fixed;
            top: 12px;
            right: 12px;
            z-index: 2147483647 !important; 
            display: flex;
            flex-direction: column;
            gap: 6px;
            pointer-events: none;
        }
        .toast {
            position: relative;
            background: #2f2f2f;
            border: none;
            border-radius: 20px;
            padding: 12px 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            min-width: 260px;
            max-width: 360px;
            pointer-events: auto;
            transform: translateX(calc(100% + 24px));
            opacity: 0;
            cursor: grab;
            user-select: none;
            touch-action: pan-x;
            will-change: transform, opacity;
            backface-visibility: hidden;
            -webkit-font-smoothing: antialiased;
            transition: transform 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.32s cubic-bezier(0.4,0,0.2,1);
        }

        .toast:active {
            cursor: grabbing;
        }

        .toast.swiping {
            transition: none !important;
        }

        .toast.show {
            transform: translateX(0);
            opacity: 1;
            animation: none !important;
        }

        .toast.success {
            border-left: 0;
        }

        .toast.error {
            border-left: 0;
        }

        .toast.warning {
            border-left: 0;
        }

        .toast.info {
            border-left: 0;
        }

        .toast-icon {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 0;
        }

        .toast-icon img {
            width: 20px;
            height: 20px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
            -webkit-user-drag: none;
            filter: brightness(0) invert(1);
        }

        .toast-icon.success {
            color: #60a5fa;
        }

        .toast-icon.error {
            color: #f87171;
        }

        .toast-icon.warning {
            color: #fbbf24;
        }

        .toast-icon.info {
            color: #60a5fa;
        }

        .toast-content {
            flex: 1;
        }

        .toast-title {
            font-size: 13px;
            font-weight: 700;
            color: #ffffff;
            margin-bottom: 3px;
            line-height: 1.3;
        }

        .toast-message {
            font-size: 12px;
            font-weight: 400;
            color: rgba(255, 255, 255, 0.9);
            line-height: 1.4;
        }

        .toast-close {
            background: rgba(255, 255, 255, 0.07);
            border: 1px solid rgba(255, 255, 255, 0.12);
            color: #ffffff;
            cursor: pointer;
            padding: 0;
            width: 32px;
            height: 32px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .toast-close img {
            width: 14px;
            height: 14px;
            pointer-events: none;
            user-select: none;
            -webkit-user-select: none;
            -webkit-user-drag: none;
            filter: brightness(0) invert(1);
        }

        .toast-close:hover {
            background: rgba(255, 255, 255, 0.14);
            border-color: rgba(255, 255, 255, 0.22);
            color: #ffffff;
        }

        .toast-close:active {
            transform: scale(0.95);
        }

        @media (max-width: 480px) {
            .toast-container {
                top: 12px;
                right: 12px;
                left: 12px;
            }

            .toast {
                min-width: auto;
                max-width: none;
                padding: 13px 15px;
                gap: 13px;
            }

            .toast-icon {
                width: 22px;
                height: 22px;
            }

            .toast-icon img {
                width: 22px;
                height: 22px;
            }

            .toast-title {
                font-size: 13px;
            }

            .toast-message {
                font-size: 12px;
            }

            .toast-close {
                width: 32px;
                height: 32px;
            }
        }
        .markdown-separator {
            width: 100%;
            height: 1px;
            background: #2D2E2F;
            border: none;
            margin: 16px auto;
        }

        [data-theme="dark"] .markdown-separator {
            background: #2D2E2F;
        }
        /* Excel-like table styling */
        .markdown-table {
            width: 100%;
            border-collapse: collapse;
            margin: 16px 0;
            font-size: 13px;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            border: 1px solid #3a3a3a;
            border-radius: 6px;
            overflow: hidden;
        }

        .markdown-table th {
            background: #2f2f2f;
            color: #ececec;
            padding: 8px 12px;
            text-align: left;
            font-weight: 600;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.3px;
            border: 1px solid #3a3a3a;
            border-bottom: 2px solid #4a4a4a;
            position: sticky;
            top: 0;
            white-space: nowrap;
            user-select: none;
        }

        .markdown-table td {
            padding: 7px 12px;
            border: 1px solid #2e2e2e;
            color: #d0d0d0;
            vertical-align: middle;
            line-height: 1.5;
            white-space: normal;
            word-break: break-word;
        }

        .markdown-table tbody tr:nth-child(odd) {
            background: #171717;
        }

        .markdown-table tbody tr:nth-child(even) {
            background: #171717;
        }

        .markdown-table tbody tr:hover {
            background: #2f2f2f;
        }

        .markdown-table tbody tr:hover td {
            color: #ffffff;
        }

        .markdown-table th:first-child,
        .markdown-table td:first-child {
            border-left: none;
        }
        .markdown-table th:last-child,
        .markdown-table td:last-child {
            border-right: none;
        }

        @media (max-width: 768px) {
            .markdown-table {
                font-size: 11px;
                display: block;
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }
            .markdown-table th,
            .markdown-table td {
                padding: 6px 8px;
            }
        }

        /* Table block wrapper - matches code-block style */
        .table-block {
            background: #100E09;
            border-radius: 24px;
            margin: 16px 0;
            overflow: hidden;
        }
        .table-toolbar {
            background: #100E09;
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .table-toolbar-label {
            font-size: 12px;
            color: var(--text-secondary);
            font-weight: 500;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .table-toolbar-label svg { color: var(--text-secondary); }
        .table-toolbar-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .table-copy-btn, .table-export-btn {
            background: transparent;
            color: var(--text-secondary);
            border: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            padding: 6px 12px;
            border-radius: 18px;
            cursor: pointer;
            font-size: 12px;
        }
        .table-copy-btn:hover, .table-export-btn:hover {
            background: #2f2f2f;
            color: #ffffff;
        }
        .table-content {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }
        .table-block .markdown-table {
            margin: 0;
            border-radius: 0;
            border: none;
        }
        .table-block .markdown-table th {
            background: #1a1608;
        }
        .table-block .markdown-table tbody tr:nth-child(odd) {
            background: #100E09;
        }
        .table-block .markdown-table tbody tr:nth-child(even) {
            background: #151208;
        }
        .table-block .markdown-table tbody tr:hover {
            background: #1f1c12;
        }

        .message-text ul {
            padding-left: 24px;
            margin: 0 0 16px 0;
            list-style: disc;
        }
        .message-text ol {
            padding-left: 24px;
            margin: 0 0 16px 0;
            list-style: decimal;
        }
        .message-text li {
            margin: 4px 0;
            color: var(--text-primary);
        }
        .message-text li::marker {
            font-weight: 700;
            color: currentColor;
        }
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: var(--primary);
            z-index: 9999;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(1px);
            -webkit-backdrop-filter: blur(1px);
        }

        .loading-content {
            text-align: center;
            color: var(--text-primary);
            max-width: 400px;
            padding: 40px;
        }

        .loading-icon {
            margin-bottom: 24px;
        }
        .loading-icon .logo-icon {
            width: 80px;
            height: 80px;
            background: var(--gradient);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto;
            font-size: 40px;
        }

        .loading-title {
            font-family: 'Default', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
            font-size: 36px;
            font-weight: 700;
            margin-bottom: 12px;
            background: var(--gradient);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .loading-subtitle {
            font-size: 18px;
            color: var(--text-secondary);
            margin-bottom: 40px;
        }

        .loading-progress {
            margin-bottom: 24px;
        }

        .loading-bar {
            width: 100%;
            height: 4px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 2px;
            overflow: hidden;
        }

        .loading-fill {
            height: 100%;
            background: var(--gradient);
            width: 0%;
            border-radius: 2px;
        }

        .loading-status {
            font-size: 14px;
            color: var(--text-muted);
            opacity: 0.7;
        }

        

        

        .loading-screen.hidden {
            opacity: 0;
            pointer-events: none;
        }

        /* Button Container & Button Styles */
        .button-container {
            background-color: #2d2d2d;
            position: sticky;
            bottom: 0;
            display: flex;
            min-height: 84px;
            align-items: center;
            justify-content: flex-end;
            border-top: 1px solid #404040;
            padding: 0 16px;
        }

        footer {
            display: flex;
            gap: 8px;
        }

        .btn {
            position: relative;
            border: none;
            border-radius: 9999px;
            padding: 6px 12px;
            font-size: 14px;
            font-weight: normal;
            cursor: pointer;
            user-select: none !important;
            -webkit-user-select: none !important;
            -moz-user-select: none !important;
            -ms-user-select: none !important;
        }

        .btn-secondary {
            background-color: var(--secondary);
            color: var(--text-primary);
            border: 1px solid var(--border);
            min-width: fit-content;
        }

        .btn-secondary:hover {
            background-color: var(--surface);
        }

        .btn-primary {
            background-color: var(--primary);
            color: #ffffff;
            border: none;
            min-width: fit-content;
        }

        .btn-primary:hover {
            background-color: var(--accent-hover);
        }

        .btn-danger {
            background-color: #ef4444;
            color: #ffffff;
        }

        .btn-danger:hover {
            background-color: #dc2626;
        }

        .flex {
            display: flex;
            align-items: center;
            justify-content: center;
        }
