        *,
        *::before,
        *::after {
            box-sizing: border-box;
        }

        html,
        body {
            margin: 0;
            padding: 0;
            height: 100%;
            background: #f4f6fb;
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        .page-wrapper {
            height: 100vh;
            display: flex;
            align-items: stretch;
        }

        /* ── Chat wrapper ── */
        .chat-wrapper {
            display: flex;
            width: 100%;
            overflow: hidden;
            background: #fff;
        }

        /* ── Left sidebar ── */
        .chat-leftsidebar {
            width: 270px;
            min-width: 270px;
            border-right: none;
            display: flex;
            flex-direction: column;
            background: #2a3042;
        }

        .chat-leftsidebar-header {
            padding: 14px;
            border-bottom: 1px solid rgba(255, 255, 255, .07);
        }

        .sidebar-brand {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 4px;
            padding: 4px 0 10px;
        }

        .sidebar-brand-logo {
            flex-shrink: 0;
        }

        .sidebar-brand-logo img {
            height: 60px;
            object-fit: contain;
        }

        .sidebar-brand-sub {
            font-size: 11px;
            color: rgba(255, 255, 255, .4);
        }

        .sidebar-new-chat {
            display: flex;
            align-items: center;
            gap: 8px;
            background: #556ee6;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 8px 12px;
            width: 100%;
            font-size: 13px;
            font-weight: 500;
            cursor: pointer;
            /* transition: background .15s; */
        }

        .sidebar-new-chat:hover {
            background: #4a60d4;
        }

        /* Quota */
        .sidebar-quota {
            padding: 14px;
            border-bottom: 1px solid rgba(255, 255, 255, .07);
        }

        .quota-label {
            font-size: 11px;
            color: rgba(255, 255, 255, .45);
            margin-bottom: 6px;
            display: flex;
            justify-content: space-between;
        }

        .quota-track {
            height: 6px;
            background: rgba(255, 255, 255, .1);
            border-radius: 999px;
            overflow: hidden;
        }

        .quota-fill {
            height: 100%;
            border-radius: 999px;
            background: linear-gradient(90deg, #556ee6, #7b8ef7);
            transition: width .4s;
        }

        .quota-fill.warn {
            background: linear-gradient(90deg, #f1734f, #f8a170);
        }

        .quota-fill.exhausted {
            background: linear-gradient(90deg, #f46a6a, #ff9999);
        }

        /* Auth CTA (anonymous guests only — hidden once a trial identity exists).
           Moved here from the right capabilities panel so it's still reachable
           if that panel is closed or never opened. */
        .sidebar-bottom {
            margin-top: auto;
            display: flex;
            flex-direction: column;
        }

        .sidebar-cta {
            padding: 12px 14px;
        }

        .sidebar-cta-meta {
            margin-top: 8px;
            text-align: center;
            font-size: 11px;
            color: rgba(255, 255, 255, .4);
        }

        .sidebar-cta-meta a {
            color: #a5b4fc;
            font-weight: 600;
            text-decoration: none;
        }

        .sidebar-cta-meta a:hover {
            text-decoration: underline;
        }


        /* ── Trial user card ── */
        .trial-user-card {
            padding: 10px 12px;
            border-top: 1px solid rgba(255,255,255,.08);
            position: relative;
        }
        .trial-user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            padding: 8px 10px;
            border-radius: 8px;
            transition: background .15s;
        }
        .trial-user-info:hover { background: rgba(255,255,255,.07); }
        .trial-user-avatar {
            width: 34px; height: 34px; border-radius: 50%;
            background: #4f46e5;
            display: flex; align-items: center; justify-content: center;
            font-size: 14px; font-weight: 700; color: #fff;
            flex-shrink: 0;
        }
        .trial-user-text { flex: 1; min-width: 0; }
        .trial-user-name {
            font-size: 13px; font-weight: 600; color: #fff;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .trial-user-plan { font-size: 11px; color: rgba(255,255,255,.45); margin-top: 1px; }
        .trial-user-more { color: rgba(255,255,255,.4); font-size: 18px; flex-shrink: 0; }
        .trial-user-menu {
            display: none;
            position: absolute;
            bottom: 100%; left: 12px; right: 12px;
            background: #1e2030;
            border: 1px solid rgba(255,255,255,.1);
            border-radius: 10px;
            overflow: hidden;
            box-shadow: 0 -4px 20px rgba(0,0,0,.3);
            margin-bottom: 4px;
        }
        .trial-user-menu.open { display: block; }
        .trial-menu-item {
            display: flex; align-items: center; gap: 10px;
            padding: 12px 16px;
            font-size: 13px; font-weight: 500;
            color: rgba(255,255,255,.8);
            text-decoration: none;
            transition: background .12s;
        }
        .trial-menu-item:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
        .trial-menu-item i { font-size: 16px; }
        .trial-menu-upgrade { color: #a5b4fc; }
        .trial-menu-upgrade:hover { color: #c7d2fe; }
        .trial-menu-logout { color: rgba(255,255,255,.5); }
        .trial-menu-logout:hover { color: #f87171; }


        /* ── Main chat content ── */
        .chat-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            min-width: 0;
            position: relative;
        }

        /* Copyright strip, scoped to .chat-content's own width (same column
           as the topbar/input box above it — sidebar and the right panel
           are unaffected). Colors/sizing match theme/footer.php's .footer
           (_footer.scss: #f2f2f5 bg, #74788d text, 60px tall, 20px/18px
           padding); guest chat is a standalone page (no theme/layout.php),
           so it needs its own copy. */
        .guest-page-footer {
            flex: 0 0 auto;
            height: 60px;
            padding: 20px 18px;
            display: flex;
            align-items: center;
            font-size: 0.8125rem;
            color: #74788d;
            background-color: #f2f2f5;
        }

        /* Drag-over overlay — mirrors the logged-in chat's drag-and-drop */
        .drag-overlay {
            display: none; position: absolute; inset: 0; z-index: 20;
            background: rgba(85,110,230,.07);
            border: 2px dashed #556ee6;
            border-radius: 4px;
            align-items: center; justify-content: center;
            flex-direction: column; gap: 10px;
            pointer-events: none;
        }
        .drag-overlay i { font-size: 40px; color: #556ee6; opacity: .6; }
        .drag-overlay span { font-size: 14px; font-weight: 600; color: #556ee6; }
        .chat-content.drag-over .drag-overlay { display: flex; }

        .chat-topbar {
            height: 56px;
            border-bottom: 1px solid #e9e9ef;
            display: flex;
            align-items: center;
            padding: 0 18px;
            gap: 10px;
            flex-shrink: 0;
            background: #fff;
        }

        .chat-topbar-title {
            flex: 1;
            font-size: 14px;
            font-weight: 600;
            color: #343a40;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        /* Privacy banner */
        .privacy-banner {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 18px;
            font-size: 12px;
            border-bottom: 1px solid #e9e9ef;
            background: #eff6ff;
            color: #1e3a5f;
            flex-shrink: 0;
        }

        .privacy-banner i {
            flex-shrink: 0;
            color: #3b82f6;
        }

        .privacy-banner .btn-close {
            font-size: 10px;
            margin-left: auto;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 28px 24px;
            background: #f8f9fc;
        }

        #replyBar {
            display: none; align-items: center; gap: 8px;
            background: #eff6ff; border-bottom: 1px solid #bfdbfe;
            padding: 6px 18px; font-size: 12px; color: #1e40af; flex-shrink: 0;
        }
        #replyBar .reply-snippet {
            flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        }
        #replyBar .btn-cancel-reply {
            background: none; border: none; font-size: 14px; color: #93c5fd; cursor: pointer; padding: 0 2px;
        }
        #replyBar .btn-cancel-reply:hover { color: #1e40af; }

        .msg-reply-quote {
            border-left: 3px solid rgba(255,255,255,.5); padding: 5px 10px;
            margin-bottom: 8px; font-size: 12px; opacity: .8;
            border-radius: 0 4px 4px 0; background: rgba(0,0,0,.06);
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        }
        .message-row.assistant .msg-reply-quote { border-left-color: #556ee6; background: #f0f3ff; opacity: 1; color: #4b5563; }

        .chat-messages::-webkit-scrollbar {
            width: 4px;
        }

        .chat-messages::-webkit-scrollbar-thumb {
            background: #e2e8f0;
            border-radius: 4px;
        }

        /* Welcome */
        .chat-welcome {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
            text-align: center;
            padding: 40px 20px;
        }

        .chat-welcome-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 20px;
        }

        .chat-welcome-icon img {
            height: 44px;
            object-fit: contain;
        }

        .suggestion-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
            max-width: 520px;
            width: 100%;
            margin-top: 24px;
        }

        .suggestion-card {
            background: #fff;
            border: 1px solid #e9e9ef;
            border-radius: 10px;
            padding: 14px;
            text-align: left;
            cursor: pointer;
            transition: border-color .15s, box-shadow .15s;
        }

        .suggestion-card:hover {
            border-color: #556ee6;
            box-shadow: 0 2px 12px rgba(85, 110, 230, .1);
        }

        .suggestion-card .s-icon {
            display: inline-flex;
            margin-bottom: 8px;
        }

        .s-icon-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            border-radius: 50%;
            font-size: 16px;
        }

        .suggestion-card .s-title {
            font-size: 12px;
            font-weight: 600;
            color: #495057;
            margin-bottom: 2px;
        }

        .suggestion-card .s-sub {
            font-size: 11px;
            color: #adb5bd;
        }

        /* Message bubbles */
        .message-row {
            margin-bottom: 22px;
            display: flex;
            flex-direction: column;
        }

        .message-row.user {
            align-items: flex-end;
        }

        .message-row.assistant {
            align-items: flex-start;
        }

        .message-row.system {
            align-items: flex-start;
        }

        .msg-meta {
            font-size: 11px;
            color: #adb5bd;
            font-weight: 500;
            margin-bottom: 5px;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .msg-precheck-note { font-size: 10.5px; color: #adb5bd; margin: -2px 0 6px; }
        /* Darker/more legible than the base .msg-meta gray (#adb5bd) — this
           slot now carries a full sentence, not a short caption, so it needs
           to actually be readable rather than fading into the background.
           Matches .btn-copy's existing text color for visual consistency. */
        .message-row.assistant .msg-meta { color: #74788d; }
        .msg-response-by { font-size: 10.5px; color: #74788d; display: flex; align-items: center; }

        /* Wraps the bubble + its actions row together so the actions row
           (Copy on the left, "Response by" on the right) can be stretched
           to exactly match the bubble's own rendered width via width:100%
           below — a plain sibling div has no width to inherit from the
           bubble otherwise, since block elements don't share width with
           adjacent siblings. */
        .ai-bubble-wrap { display: inline-flex; flex-direction: column; max-width: 75%; }
        .ai-bubble-wrap .msg-bubble { max-width: 100%; }
        .ai-bubble-wrap .msg-actions { width: 100%; justify-content: space-between; }

        .msg-bubble {
            max-width: 75%;
            padding: 11px 15px;
            border-radius: 14px;
            font-size: 13.5px;
            line-height: 1.7;
        }

        .message-row.user .msg-bubble {
            background: #556ee6;
            color: #fff;
            border-radius: 14px 14px 4px 14px;
        }

        .message-row.assistant .msg-bubble {
            background: #fff;
            border: 1px solid #e9e9ef;
            color: #343a40;
            border-radius: 14px 14px 14px 4px;
            box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
        }

        .sys-msg-banner {
            display: flex;
            align-items: flex-start;
            gap: 8px;
            max-width: 75%;
            padding: 11px 15px;
            border-radius: 14px 14px 14px 4px;
            font-size: 13.5px;
            line-height: 1.7;
            background: #fffbeb;
            border: 1px solid #fde68a;
            color: #92400e;
            box-shadow: 0 1px 4px rgba(0, 0, 0, .05);
        }

        .sys-msg-banner.sys-info {
            background: #eff6ff;
            border-color: #bfdbfe;
            color: #1e40af;
        }

        .sys-msg-banner.sys-error {
            background: #fff5f5;
            border-color: #fca5a5;
            color: #991b1b;
        }

        .sys-msg-banner.sys-warning {
            background: #fff7ed;
            border-color: #fed7aa;
            color: #9a3412;
        }

        .sys-msg-banner i {
            font-size: 15px;
            flex-shrink: 0;
            margin-top: 3px;
        }

        .sys-msg-icon-badge {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            flex-shrink: 0;
            margin-top: 0;
        }

        .sys-msg-icon-badge i { font-size: 13px; margin-top: 0; }

        .sys-msg-banner.sys-info    .sys-msg-icon-badge { background: #dbeafe; color: #2563eb; }
        .sys-msg-banner.sys-error   .sys-msg-icon-badge { background: #fee2e2; color: #dc2626; }
        .sys-msg-banner.sys-warning .sys-msg-icon-badge { background: #ffedd5; color: #c2410c; }

        /* Upgrade banner (credits exhausted) */
        .sys-msg-banner.sys-upgrade {
            background: #f0fdf4;
            border-color: #86efac;
            color: #15803d;
            flex-direction: column;
            gap: 10px;
        }

        .sys-msg-banner.sys-upgrade .upgrade-row {
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .btn-upgrade {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #15803d;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 8px 16px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            transition: background .15s;
            margin-top: 4px;
        }

        .btn-upgrade:hover {
            background: #166534;
            color: #fff;
        }

        /* Locked-model banner — same shape as .sys-upgrade, red instead of
           green: this is a restriction being enforced, not an upsell. */
        .sys-msg-banner.sys-locked {
            background: #fff5f5;
            border-color: #fca5a5;
            color: #991b1b;
            flex-direction: column;
            gap: 10px;
        }

        .sys-msg-banner.sys-locked .upgrade-row {
            display: flex;
            align-items: flex-start;
            gap: 8px;
        }

        .btn-locked {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            background: #b91c1c;
            color: #fff;
            border: none;
            border-radius: 8px;
            padding: 8px 16px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            transition: background .15s;
            margin-top: 4px;
        }

        .btn-locked:hover {
            background: #991b1b;
            color: #fff;
        }

        /* Markdown */
        .msg-bubble h1,
        .msg-bubble h2,
        .msg-bubble h3 {
            font-size: 14px;
            font-weight: 700;
            margin: 10px 0 6px;
        }

        .msg-bubble p {
            margin: 0 0 8px;
        }

        .msg-bubble p:last-child {
            margin-bottom: 0;
        }

        .msg-bubble ul,
        .msg-bubble ol {
            padding-left: 18px;
            margin: 6px 0;
        }

        .msg-bubble li {
            margin-bottom: 3px;
        }

        .msg-bubble code {
            background: #f1f3f9;
            padding: 1px 5px;
            border-radius: 4px;
            font-family: monospace;
            font-size: 12px;
            color: #556ee6;
        }

        .msg-bubble pre {
            background: #1e293b;
            border-radius: 8px;
            padding: 12px 14px;
            overflow-x: auto;
            margin: 8px 0;
        }

        .msg-bubble pre code {
            background: transparent;
            color: #e2e8f0;
            font-size: 12px;
            padding: 0;
        }

        .msg-bubble strong {
            font-weight: 700;
        }

        .msg-bubble em {
            font-style: italic;
        }

        .msg-bubble blockquote {
            border-left: 3px solid #556ee6;
            padding-left: 10px;
            color: #74788d;
            margin: 8px 0;
            font-style: italic;
        }

        .msg-bubble table {
            border-collapse: collapse;
            width: 100%;
            margin: 8px 0;
            font-size: 12px;
        }

        .msg-bubble th {
            background: #f8f9fc;
            padding: 5px 8px;
            border: 1px solid #e9e9ef;
            font-weight: 600;
        }

        .msg-bubble td {
            padding: 5px 8px;
            border: 1px solid #e9e9ef;
        }

        /* Copy */
        .msg-actions {
            display: flex;
            align-items: center;
            gap: 4px;
            margin-top: 4px;
            justify-content: flex-end;
        }

        .msg-actions-left { display: flex; align-items: center; gap: 4px; }

        /* Icon-only — a tooltip (title attribute) carries the label instead
           of visible text, per request to keep this row visually quieter. */
        .btn-copy, .btn-reply {
            background: none;
            border: 1px solid #e9e9ef;
            border-radius: 5px;
            padding: 3px 6px;
            font-size: 13px;
            line-height: 1;
            color: #74788d;
            cursor: pointer;
            transition: background .12s;
        }

        .btn-copy:hover {
            background: #f0f3ff;
            color: #556ee6;
            border-color: #556ee6;
        }
        .btn-reply:hover {
            background: #f0fdf4;
            color: #16a34a;
            border-color: #86efac;
        }

        /* Typing */
        .typing-dots span {
            display: inline-block;
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: #adb5bd;
            margin: 0 2px;
            animation: tdot 1.2s infinite;
        }

        .typing-dots span:nth-child(2) {
            animation-delay: .2s;
        }

        .typing-dots span:nth-child(3) {
            animation-delay: .4s;
        }

        @keyframes tdot {

            0%,
            60%,
            100% {
                transform: translateY(0)
            }

            30% {
                transform: translateY(-5px)
            }
        }

        .ai-thinking-bubble { display: flex; align-items: center; gap: 9px; }
        .ai-thinking-orb {
            position: relative; width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0;
            background: radial-gradient(circle at 35% 30%, #8b9cf6, #556ee6 70%);
            animation: ai-orb-pulse 1.8s ease-in-out infinite;
        }
        @keyframes ai-orb-pulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(85,110,230,.45); transform: scale(1); }
            50%      { box-shadow: 0 0 0 6px rgba(85,110,230,0); transform: scale(1.12); }
        }
        .ai-thinking-text { font-size: 13px; color: #74788d; font-weight: 500; }
        .ai-thinking-bubble .typing-dots { display: inline-flex; align-items: center; }

        .guardian-live-preview {
            margin-top: 8px; padding: 9px 12px; border-radius: 8px;
            background: #fff; border: 1px solid #fecaca; color: #4b5563;
            font-size: 13px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
        }
        .dlp-highlight {
            background: #fecaca; color: #991b1b; border-radius: 3px;
            padding: 0 2px; font-weight: 600;
        }
        .input-highlight-overlay mark.dlp-highlight {
            padding: 0; font-weight: inherit; border-radius: 0;
        }

        /* Streaming cursor */
        .stream-content.streaming>*:last-child::after {
            content: '▍';
            display: inline;
            color: #556ee6;
            animation: blink-cursor .7s step-end infinite;
            margin-left: 1px;
            font-size: .9em;
        }

        @keyframes blink-cursor {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: 0
            }
        }

        /* Input */
        .chat-input-area {
            border-top: 1px solid #e9e9ef;
            padding: 12px 18px 14px;
            background: #fff;
            flex-shrink: 0;
        }

        .chat-input-box {
            border: 1px solid #dde1f0;
            border-radius: 12px;
            padding: 10px 14px;
            background: #f8f9fc;
            transition: border-color .2s, box-shadow .2s;
        }

        .chat-input-box:focus-within {
            border-color: #556ee6;
            box-shadow: 0 0 0 3px rgba(85, 110, 230, .1);
            background: #fff;
        }
        /* The model <select> is borderless by design (blends into the footer
           like plain text) — but a real click/keyboard focus still needs a
           visible indicator for accessibility. The browser's default focus
           ring is a harsh rectangle that clashes with that borderless look,
           so suppress it in favor of the same soft brand-color highlight
           .chat-input-box's own :focus-within already puts around the whole
           box when this select (or anything else inside it) is focused. */
        #modelSelect:focus { outline: none; box-shadow: none; }

        .input-highlight-wrap { position: relative; box-sizing: border-box; }
        .input-highlight-overlay {
            position: absolute; inset: 0; margin: 0; padding: 0; border: 0; box-sizing: border-box;
            font-size: 13.5px; font-family: inherit; font-weight: normal; letter-spacing: normal;
            line-height: 1.6; white-space: pre-wrap; word-wrap: break-word; word-spacing: normal;
            overflow: hidden; color: #343a40; pointer-events: none; z-index: 0;
        }

        .chat-input-box textarea {
            position: relative;
            z-index: 1;
            box-sizing: border-box;
            width: 100%;
            margin: 0;
            padding: 0;
            border: none;
            outline: none;
            background: transparent;
            color: transparent;
            caret-color: #343a40;
            font-size: 13.5px;
            font-family: inherit;
            font-weight: normal;
            letter-spacing: normal;
            resize: none;
            line-height: 1.6;
            max-height: 160px;
            min-height: 22px;
        }

        .chat-input-box textarea::placeholder {
            color: #adb5bd;
        }

        .chat-input-box textarea::selection { background: rgba(85,110,230,.25); }

        .chat-input-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-top: 8px;
        }

        .precheck-btn { border: 1px solid transparent; border-radius: 8px; padding: 6px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: .15s ease; }
        .precheck-btn-primary { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
        .precheck-btn-primary:hover { background: #ffedd5; }
        .precheck-btn-secondary { background: #f8fafc; color: #475569; border-color: #e2e8f0; }
        .precheck-btn-secondary:hover { background: #f1f5f9; }

        .guardian-notice .msg-bubble { border-color: #fed7aa; background: #fffaf5; }
        .guardian-notice-error .msg-bubble { border-color: #fecaca; background: #fff5f5; color: #991b1b; }
        .guardian-notice-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
        .guardian-risk-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 600; color: #495057; margin-bottom: 6px; }
        .guardian-risk-label { display: inline-flex; align-items: center; gap: 6px; }
        .guardian-risk-score { font-size: 11px; color: #98a0b3; }
        .guardian-risk-track { height: 8px; border-radius: 999px; overflow: hidden; background: #edf1f7; }
        .guardian-risk-fill { height: 100%; border-radius: 999px; }
        .guardian-risk-fill.risk-orange { background: linear-gradient(90deg, #ea580c, #fb923c); }
        .guardian-risk-fill.risk-red { background: linear-gradient(90deg, #dc2626, #f87171); }
        .guardian-risk-message { margin-top: 7px; font-size: 13.5px; }
        .guardian-risk-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
        .guardian-risk-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; background: #fff7ed; color: #c2410c; border: 1px solid #fed7aa; }
        .guardian-risk-chip.risk-red { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

        .btn-attach {
            background: none;
            border: none;
            color: #adb5bd;
            padding: 2px 6px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 17px;
            line-height: 1;
            transition: color .15s, background .15s;
        }

        .btn-attach:hover { color: #556ee6; background: rgba(85,110,230,.08); }

        /* Model selector */
        .model-selector-wrap { position: relative; }

        .model-selector-btn {
            display: flex;
            align-items: center;
            gap: 5px;
            background: rgba(85,110,230,.08);
            border: 1px solid rgba(85,110,230,.2);
            border-radius: 20px;
            padding: 3px 10px 3px 8px;
            font-size: 11.5px;
            font-weight: 600;
            color: #556ee6;
            cursor: pointer;
            white-space: nowrap;
        }

        .model-selector-btn:hover { background: rgba(85,110,230,.15); }

        .model-dropdown {
            display: none;
            position: absolute;
            bottom: calc(100% + 8px);
            left: 0;
            min-width: 200px;
            background: #fff;
            border: 1px solid #e9e9ef;
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,.12);
            z-index: 100;
            overflow: hidden;
        }

        .model-dropdown.open { display: block; }

        .model-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 14px;
            font-size: 12.5px;
            cursor: pointer;
            color: #495057;
            transition: background .1s;
        }

        .model-dropdown-item:hover { background: #f8f9fc; }

        .model-dropdown-item.active {
            background: rgba(85,110,230,.07);
            color: #556ee6;
            font-weight: 600;
        }

        .model-dropdown-sep {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: .06em;
            color: #adb5bd;
            padding: 8px 14px 4px;
        }

        /* Language selector (topbar) */
        .lang-selector-wrap { position: relative; }

        .lang-selector-btn {
            display: flex;
            align-items: center;
            gap: 4px;
            background: rgba(85,110,230,.08);
            border: 1px solid rgba(85,110,230,.2);
            border-radius: 20px;
            padding: 3px 8px;
            font-size: 14px;
            cursor: pointer;
            line-height: 1;
        }

        .lang-selector-btn:hover { background: rgba(85,110,230,.15); }

        .lang-dropdown {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            right: 0;
            min-width: 160px;
            background: #fff;
            border: 1px solid #e9e9ef;
            border-radius: 10px;
            box-shadow: 0 8px 24px rgba(0,0,0,.12);
            z-index: 100;
            overflow: hidden;
        }

        .lang-dropdown.open { display: block; }

        .lang-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 9px 14px;
            font-size: 12.5px;
            cursor: pointer;
            color: #495057;
            text-decoration: none;
            transition: background .1s;
        }

        .lang-dropdown-item:hover { background: #f8f9fc; color: #495057; }

        .lang-dropdown-item.active {
            background: rgba(85,110,230,.07);
            color: #556ee6;
            font-weight: 600;
        }

        .windows-app-pill-guest-group {
            display: flex;
            align-items: stretch;
            border-radius: 6px;
            background: #f1f3f9;
            overflow: hidden;
        }
        .windows-app-pill-guest {
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 5px 8px 5px 10px;
            color: #495057;
            font-size: 12px;
            font-weight: 400;
            cursor: pointer;
            transition: background-color .15s ease;
        }
        .windows-app-pill-guest:hover,
        .windows-app-pill-guest:focus {
            background: #e7e9f2;
            outline: none;
        }
        .windows-app-pill-guest i.bxl-windows {
            font-size: 13px;
            color: #556ee6;
        }
        .windows-app-pill-guest-divider {
            align-self: center;
            width: 1px;
            height: 12px;
            background: #d3d6e2;
        }
        .windows-app-pill-guest-info {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 10px;
            font-size: 14px;
            color: #98a2b3;
            cursor: pointer;
            transition: background-color .15s ease;
        }
        .windows-app-pill-guest-info:hover,
        .windows-app-pill-guest-info:focus {
            color: #556ee6;
            background: rgba(85, 110, 230, .12);
            outline: none;
        }

        #activeModelBadge {
            padding: 6px !important;
        }

        /* Windows app info modal */
        .windows-app-info-modal {
            background: #fff;
            border-radius: 16px;
            padding: 28px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
            position: relative;
            animation: modal-in .18s ease;
            text-align: center;
        }
        .windows-app-info-modal-icon {
            width: 64px;
            height: 64px;
            border-radius: 50%;
            background: rgba(85, 110, 230, .1);
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 0 auto 16px;
        }
        .windows-app-info-modal-icon i {
            font-size: 32px;
            color: #556ee6;
        }
        .windows-app-info-modal h5 {
            font-size: 16px;
            font-weight: 700;
            color: #343a40;
            margin: 0 0 8px;
        }
        .windows-app-info-modal .windows-app-info-modal-sub {
            font-size: 13px;
            color: #74788d;
            margin: 0;
        }
        .windows-app-info-modal-features {
            text-align: left;
            background: #f8f9fc;
            border-radius: 10px;
            padding: 14px 16px;
            margin-top: 14px;
        }
        .windows-app-info-modal-feature {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            font-size: 13px;
            color: #495057;
        }
        .windows-app-info-modal-feature + .windows-app-info-modal-feature {
            margin-top: 8px;
        }
        .windows-app-info-modal-feature i {
            font-size: 16px;
            color: #34c38f;
            flex-shrink: 0;
            margin-top: 1px;
        }
        .windows-app-info-modal-feature.is-negative i {
            color: #f46a6a;
        }
        .windows-app-info-modal .btn-start-trial {
            margin-top: 18px;
        }

        /* File preview chip — block-level (not inline-flex) so it always
           starts its own line instead of crowding onto the same line as
           short preceding message text. */
        .file-chip {
            display: flex;
            width: fit-content;
            align-items: center;
            gap: 6px;
            background: rgba(85,110,230,.08);
            border: 1px solid rgba(85,110,230,.2);
            border-radius: 8px;
            padding: 3px 10px;
            font-size: 12px;
            color: #556ee6;
            margin-bottom: 6px;
        }

        .file-chip .remove-file {
            cursor: pointer;
            color: #adb5bd;
            font-size: 14px;
            line-height: 1;
        }

        /* .file-chip's default colors (light blue tint + blue text) are
           tuned for the white-background pre-send preview panel above. Sent
           user messages sit in a solid blue bubble (see .message-row.user
           .msg-bubble) — the same blue-on-blue-tinted styling there is
           nearly invisible (confirmed: chip renders correctly in the DOM,
           just unreadable). Overridden here to a white-tinted overlay with
           inherited (white) text, matching how the main authenticated
           chat's equivalent chip already handles this same blue-bubble
           context. */
        .message-row.user .file-chip {
            background: rgba(255, 255, 255, .18);
            border-color: rgba(255, 255, 255, .35);
            color: inherit;
        }

        .file-chip .remove-file:hover { color: #f46a6a; }

        /* Demo attachment chips (simulateAttachmentDemo) never have a real
           attachment behind them, so they render as a non-interactive
           status chip instead of the normal file preview. */
        .file-chip.flagged { cursor: default; }
        .file-chip .att-flagged { color: #dc2626; font-size: 13px; }
        .message-row.user .file-chip .att-flagged { color: #ffc9c9; }

        /* ── Right capabilities panel ── */
        .chat-panel {
            width: 300px;
            min-width: 300px;
            border-left: 1px solid #e9e9ef;
            display: flex;
            flex-direction: column;
            background: #fff;
            transition: width .25s ease, min-width .25s ease;
            overflow: hidden;
        }

        .chat-panel.collapsed {
            width: 0;
            min-width: 0;
            border-left: none;
        }

        .panel-header {
            height: 56px;
            border-bottom: 1px solid #e9e9ef;
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 16px;
            flex-shrink: 0;
            background: #fff;
        }

        .panel-header-title {
            font-size: 13px;
            font-weight: 700;
            color: #343a40;
        }

        .btn-panel-close {
            background: none;
            border: none;
            color: #adb5bd;
            font-size: 18px;
            cursor: pointer;
            padding: 4px;
            line-height: 1;
            border-radius: 5px;
        }

        .btn-panel-close:hover {
            color: #495057;
            background: #f8f9fc;
        }

        .panel-body {
            flex: 1;
            overflow-y: auto;
            padding: 20px 18px 24px 16px;
        }

        .panel-footer {
            flex-shrink: 0;
            padding: 16px;
            border-top: 1px solid #e9e9ef;
            background: #fafbfc;
            font-size: 11px;
            color: #adb5bd;
            text-align: center;
            line-height: 1.6;
        }

        .panel-footer a {
            color: #556ee6;
            font-weight: 600;
            text-decoration: none;
        }

        .panel-footer a:hover {
            text-decoration: underline;
        }

        .panel-body::-webkit-scrollbar {
            width: 3px;
        }

        .panel-body::-webkit-scrollbar-thumb {
            background: #e2e8f0;
            border-radius: 3px;
        }

        .panel-title {
            font-size: 15px;
            font-weight: 700;
            color: #343a40;
            margin-bottom: 6px;
        }

        .panel-desc {
            font-size: 12.5px;
            color: #74788d;
            line-height: 1.55;
            margin-bottom: 20px;
        }

        .panel-feature {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px 0;
            border-bottom: 1px solid #f0f2f8;
        }

        .panel-feature:last-of-type {
            border-bottom: none;
        }

        .panel-feature-icon {
            width: 36px;
            height: 36px;
            border-radius: 10px;
            flex-shrink: 0;
            background: linear-gradient(135deg, #eff2ff, #e0e7ff);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 17px;
        }

        .panel-feature-name {
            font-size: 13px;
            font-weight: 600;
            color: #343a40;
            margin-bottom: 2px;
        }

        .panel-feature-sub {
            font-size: 11.5px;
            color: #74788d;
            line-height: 1.4;
        }

        .panel-section-label {
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: .7px;
            color: #10b981;
            margin: 16px 0 6px;
        }

        .panel-icon-free {
            background: linear-gradient(135deg, #d1fae5, #a7f3d0);
            color: #059669;
        }

        .panel-check-icon {
            color: #10b981;
            font-size: 18px;
            flex-shrink: 0;
            align-self: center;
        }

        .btn-try-it {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            width: 100%;
            padding: 9px;
            background: linear-gradient(135deg, #556ee6, #7b8ef7);
            color: #fff;
            border: none;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 600;
            cursor: pointer;
            transition: opacity .15s;
            box-shadow: 0 2px 8px rgba(85, 110, 230, .25);
        }

        .btn-try-it:hover {
            opacity: .9;
        }

        .btn-panel-google-login {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 7px;
            width: 100%;
            margin-top: 6px;
            padding: 8px;
            background: #fff;
            color: #3c4043;
            border: 1px solid #e2e8f0;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            text-decoration: none;
            transition: background .15s, border-color .15s;
        }

        .btn-panel-google-login:hover {
            background: #f8f9fb;
            border-color: #c7d2fe;
            color: #3c4043;
            text-decoration: none;
        }

        /* Panel toggle button in topbar */
        .btn-panel-toggle {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 30px;
            height: 30px;
            background: none;
            border: 1px solid #e9e9ef;
            border-radius: 7px;
            font-size: 15px;
            color: #74788d;
            cursor: pointer;
            transition: background .12s, color .12s;
        }

        .btn-panel-toggle:hover {
            background: #f0f3ff;
            color: #556ee6;
            border-color: #c7d2fe;
        }

        .btn-panel-toggle i {
            font-size: 14px;
        }

        /* ── Clear chat modal ── */
        .modal-backdrop-guest {
            display: none;
            position: fixed;
            inset: 0;
            z-index: 1000;
            background: rgba(0, 0, 0, .45);
            backdrop-filter: blur(2px);
            align-items: center;
            justify-content: center;
        }

        .modal-backdrop-guest.visible {
            display: flex;
        }

        .clear-modal {
            background: #fff;
            border-radius: 16px;
            padding: 28px 28px 22px;
            width: 100%;
            max-width: 380px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
            position: relative;
            animation: modal-in .18s ease;
        }

        @keyframes modal-in {
            from {
                opacity: 0;
                transform: scale(.96) translateY(6px)
            }

            to {
                opacity: 1;
                transform: none
            }
        }

        .clear-modal-close {
            position: absolute;
            top: 14px;
            right: 16px;
            background: none;
            border: none;
            font-size: 18px;
            color: #adb5bd;
            cursor: pointer;
        }

        .clear-modal-close:hover {
            color: #495057;
        }

        .clear-modal h5 {
            font-size: 16px;
            font-weight: 700;
            color: #343a40;
            margin: 0 0 10px;
        }

        .clear-modal p {
            font-size: 13px;
            color: #74788d;
            line-height: 1.55;
            margin: 0 0 22px;
        }

        .clear-modal-actions {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .btn-clear-confirm {
            width: 100%;
            padding: 11px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            border: 1.5px solid #e9e9ef;
            background: #fff;
            color: #343a40;
            cursor: pointer;
            transition: background .15s;
        }

        .btn-clear-confirm:hover {
            background: #f8f9fc;
        }

        .btn-clear-cancel {
            width: 100%;
            padding: 11px;
            border-radius: 10px;
            font-size: 14px;
            font-weight: 600;
            border: none;
            background: #343a40;
            color: #fff;
            cursor: pointer;
            transition: background .15s;
        }

        .btn-clear-cancel:hover {
            background: #495057;
        }

        /* ── Try it out modal ── */
        .trial-modal {
            background: #fff;
            border-radius: 16px;
            padding: 32px 28px 24px;
            width: 100%;
            max-width: 420px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
            position: relative;
            animation: modal-in .18s ease;
        }

        .trial-modal-header {
            text-align: center;
            margin-bottom: 24px;
        }

        .trial-modal-icon {
            width: 56px;
            height: 56px;
            border-radius: 16px;
            background: linear-gradient(135deg, #556ee6, #7b8ef7);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            margin: 0 auto 14px;
            box-shadow: 0 6px 20px rgba(85, 110, 230, .3);
        }

        .trial-modal h5 {
            font-size: 18px;
            font-weight: 700;
            color: #343a40;
            margin: 0 0 6px;
        }

        .trial-modal .trial-sub {
            font-size: 13px;
            color: #74788d;
            margin: 0;
        }

        .trial-form-group {
            margin-bottom: 16px;
        }

        .trial-form-group label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            color: #495057;
            margin-bottom: 6px;
        }

        .trial-form-group input {
            width: 100%;
            padding: 10px 14px;
            border: 1.5px solid #e9e9ef;
            border-radius: 9px;
            font-size: 14px;
            color: #343a40;
            outline: none;
            transition: border-color .2s, box-shadow .2s;
            background: #f8f9fc;
        }

        .trial-form-group input:focus {
            border-color: #556ee6;
            box-shadow: 0 0 0 3px rgba(85, 110, 230, .1);
            background: #fff;
        }

        .btn-start-trial {
            width: 100%;
            padding: 13px;
            background: linear-gradient(135deg, #556ee6, #7b8ef7);
            color: #fff;
            border: none;
            border-radius: 10px;
            font-size: 15px;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 4px 14px rgba(85, 110, 230, .3);
            transition: opacity .15s;
            margin-top: 4px;
        }

        .btn-start-trial:hover {
            opacity: .9;
        }

        .trial-terms {
            font-size: 11px;
            color: #adb5bd;
            text-align: center;
            margin-top: 12px;
            line-height: 1.5;
        }

        .trial-terms a {
            color: #556ee6;
            text-decoration: none;
        }

        .trial-error {
            font-size: 12px;
            color: #dc2626;
            margin-top: 8px;
            display: none;
        }

        .trial-close {
            position: absolute;
            top: 14px;
            right: 16px;
            background: none;
            border: none;
            font-size: 18px;
            color: #adb5bd;
            cursor: pointer;
        }

        .trial-close:hover {
            color: #495057;
        }

        /* Credit limit info in sidebar */
        .sidebar-limit-badge {
            margin: 10px 14px 0;
            padding: 8px 10px;
            background: rgba(85, 110, 230, .15);
            border: 1px solid rgba(85, 110, 230, .3);
            border-radius: 8px;
            font-size: 11.5px;
            color: rgba(255, 255, 255, .65);
            display: flex;
            align-items: center;
            gap: 7px;
        }

        .sidebar-limit-badge i {
            color: #7b8ef7;
            font-size: 14px;
            flex-shrink: 0;
        }

        .sidebar-limit-badge a {
            color: #7b8ef7 !important;
        }

        @media (max-width:900px) {
            .chat-leftsidebar {
                display: none;
            }

            .chat-panel {
                display: none;
            }

            .page-wrapper {
                padding: 0;
            }

            .chat-wrapper {
                border-radius: 0;
                border: none;
            }

            .msg-bubble {
                max-width: 90%;
            }
        }
