
            :root {
                --bg-color: #0a0a0a;
                --card-bg: var(--glass-chrome-bg);
                --header-bg: var(--glass-bg);
                --accent-color: #f5f5f4;
                --accent-hover: #ffffff;
                --text-main: #f4f4f3;
                --text-muted: #b6b6b6;
                --border-color: rgba(170, 170, 170, 0.12);
                --border-strong: rgba(170, 170, 170, 0.22);
                --danger: #e88b8b;
                --danger-text: #e88b8b;
                --success: #7fd1a8;
                --success-text: #7fd1a8;
                --warning: #e6c37a;
                --radius-window: 20px;
                --radius-header: 18px;
                --radius-btn: 10px;
                --radius-btn-sm: 8px;
                --glass-chrome-bg: rgba(40, 40, 40, 0.18);
                --glass-scrim-bg: rgba(22, 22, 22, 0.58);
                --glass-scrim-blur: blur(24px) saturate(150%);
                --glass-bg: var(--glass-chrome-bg);
                --glass-bg-strong: var(--glass-chrome-bg);
                --glass-inset: rgba(40, 40, 40, 0.28);
                --glass-highlight: none;
                --glass-shadow:
                    0 10px 28px rgba(0, 0, 0, 0.28),
                    0 0 0 rgba(0, 0, 0, 0);
                --glass-blur: blur(15px) saturate(145%);
                --glass-border: rgba(255, 255, 255, 0.12);
                /* Modal stack flattened: overlay dim + the same face as .modal-content */
                --glass-window-dim: rgba(22, 22, 22, 0.36);
                --glass-window-stack:
                    var(--glass-highlight),
                    linear-gradient(var(--glass-window-dim), var(--glass-window-dim));
                --glass-window-bg: var(--glass-bg);
                --glass-window-blur: var(--glass-scrim-blur);
                --glass-popover-fill: rgba(32, 32, 32, 0.86);
                --ink-bg: #252525;
                --ink-stack: none;
                --ink-shadow: none;
                --panel-card-bg: var(--ink-bg);
                --page-glow: radial-gradient(ellipse at 20% 0%, rgba(45, 45, 45, 0.42) 0%, rgba(26, 26, 26, 0.16) 48%, transparent 72%), linear-gradient(145deg, #101010 0%, #060606 65%, #0c0c0c 100%);
            }
            /* Hide scrollbars everywhere (PC + phone). Scroll still works via wheel/touch. */
            html,
            body,
            html *,
            body * {
                scrollbar-width: none !important;
                -ms-overflow-style: none !important;
                scrollbar-gutter: auto !important;
            }
            #pageParticleField {
                display: none !important;
                position: fixed;
                inset: 0;
                width: 100%;
                height: 100%;
                pointer-events: none;
            }
            html.has-cursor-glow {
                background-color: var(--bg-color, #0a0a0a);
                background-image: var(--page-glow);
                --glass-chrome-bg: rgba(40, 40, 40, 0.14);
                --glass-scrim-bg: rgba(22, 22, 22, 0.50);
                --glass-inset: rgba(40, 40, 40, 0.22);
            }
            html.has-cursor-glow #pageParticleField {
                display: none !important;
            }
            html.has-cursor-glow body {
                position: relative;
                z-index: 0;
                isolation: isolate;
                background-image: none;
                background-color: transparent;
            }
            html.has-cursor-glow body > header {
                position: fixed;
                z-index: 100;
            }
            html.has-cursor-glow body > .view-container {
                z-index: 1;
            }
            html.has-cursor-glow body > #modal-root {
                position: fixed !important;
                z-index: 20000 !important;
                pointer-events: none;
            }
            html.has-cursor-glow body > header {
                z-index: 100;
            }
            html.has-cursor-glow .view-container,
            html.has-cursor-glow #aiManagerContainer,
            html.has-cursor-glow #scpManagerContainer,
            html.has-cursor-glow #notesManagerContainer {
                background-image: none;
                background-color: transparent;
            }
            html.has-cursor-glow .scp-card,
            html.has-cursor-glow .notes-window,
            html.has-cursor-glow .ai-panel-window{
                position: relative;
                z-index: 1;
            }
            html.has-cursor-glow .panel-window-head {
                /* keep sticky/fixed from layout rules; only raise stacking for glow */
                z-index: 40;
            }
            html.has-cursor-glow .auth-card {
                position: relative;
                z-index: 1;
            }
            
            
            
            
            html.has-cursor-glow .notes-create-cta:hover {
                background-image: var(--ink-stack) !important;
                background-color: var(--ink-bg) !important;
            }
            html.has-cursor-glow .scp-drop:hover,
            html.has-cursor-glow .scp-drop.dragover,
            html.has-cursor-glow .scp-drop-half:hover,
            html.has-cursor-glow .scp-drop-half:active {
                background-image: var(--ink-stack) !important;
                background-color: var(--ink-bg) !important;
            }
            .notes-list > .note-item,
            .file-list .file-item,
            .notes-create-cta,
            .scp-drop,
            .scp-mkdir-btn {
                transition: transform 0.22s ease, border-color 0.15s ease, box-shadow 0.22s ease;
            }
            html .notes-list > .note-item:hover,
            html .notes-list > .note-item:active,
            html .file-list .file-item:hover,
            html .file-list .file-item:active,
            html .notes-create-cta:hover,
            html .notes-create-cta:active,
            html .scp-drop:hover,
            html .scp-drop:active,
            html .scp-drop.dragover,
            html .scp-mkdir-btn:hover,
            html .scp-mkdir-btn:active {
                transform: translateY(-3px);
                border-color: rgba(245, 245, 244, 0.55) !important;
                box-shadow: none !important;
                background-image: var(--ink-stack) !important;
                background-color: var(--ink-bg) !important;
                color: #f4f4f3 !important;
            }
            html.has-cursor-glow .scp-drop:hover .scp-drop-icon,
            html.has-cursor-glow .scp-drop:hover .scp-drop-title,
            html.has-cursor-glow .scp-drop.dragover .scp-drop-icon,
            html.has-cursor-glow .scp-drop.dragover .scp-drop-title,
            html.has-cursor-glow .notes-create-cta:hover .notes-create-cta-icon,
            html.has-cursor-glow .notes-create-cta:hover .notes-create-cta-title,
            html.has-cursor-glow .file-item:hover .file-item-name,
            html.has-cursor-glow .file-item:hover .file-item-name span,
            html.has-cursor-glow .file-item:hover .file-item-folder-icon {
                color: #f4f4f3 !important;
            }
            html.has-cursor-glow .scp-drop:hover .scp-drop-hint,
            html.has-cursor-glow .scp-drop.dragover .scp-drop-hint,
            html.has-cursor-glow .notes-create-cta:hover .notes-create-cta-hint,
            html.has-cursor-glow .file-item:hover .file-item-meta,
            html.has-cursor-glow .file-item:hover .file-item-date,
            html.has-cursor-glow .file-item:hover .file-item-size {
                color: #a6a6a6 !important;
            }
            html.has-cursor-glow .panel-head-menu-panel,
            html.has-cursor-glow .panel-head-menu-panel.is-ported {
                isolation: auto;
                background-image: none !important;
                background: var(--glass-highlight) !important;
                background-color: var(--glass-bg) !important;
                backdrop-filter: var(--glass-blur) !important;
                -webkit-backdrop-filter: var(--glass-blur) !important;
            }
            html.has-cursor-glow .panel-search-field,
            html.has-cursor-glow .header-panel-tools .panel-search-field,
            html.has-cursor-glow .panel-search-tray.is-ported .panel-search-field {
                isolation: isolate;
                background: var(--glass-highlight) !important;
                background-color: var(--glass-bg) !important;
                backdrop-filter: var(--glass-blur) !important;
                -webkit-backdrop-filter: var(--glass-blur) !important;
            }
            
            
            
            @media (max-width: 600px) {
                html.has-cursor-glow .panel-window-head.is-searching {
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                }
                html.has-cursor-glow .panel-search-tray.is-ported,
                html.has-cursor-glow .panel-window-head.is-searching .panel-search-tray {
                    isolation: auto !important;
                    transform: none !important;
                    background: var(--glass-highlight) !important;
                    background-color: var(--glass-bg) !important;
                    background-image: var(--glass-highlight) !important;
                    border: 1px solid var(--glass-border) !important;
                    box-shadow: var(--glass-shadow) !important;
                    backdrop-filter: var(--glass-blur) !important;
                    -webkit-backdrop-filter: var(--glass-blur) !important;
                }
                html.has-cursor-glow .panel-window-head.is-searching .panel-search-field,
                html.has-cursor-glow .panel-search-tray.is-ported .panel-search-field,
                html.has-cursor-glow .ai-sheet-search,
                html.has-cursor-glow .ai-jump-search {
                    isolation: auto !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    border: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                }
                html.has-cursor-glow .ai-sheet-search,
                html.has-cursor-glow .ai-jump-search {
                    isolation: auto !important;
                    background: var(--glass-highlight) !important;
                    background-color: var(--glass-bg) !important;
                    background-image: var(--glass-highlight) !important;
                    border: 1px solid var(--glass-border) !important;
                    box-shadow: var(--glass-shadow) !important;
                    backdrop-filter: var(--glass-blur) !important;
                    -webkit-backdrop-filter: var(--glass-blur) !important;
                }
            }
            html.has-cursor-glow .modal-overlay:not(.auth-stage),
            html.has-cursor-glow .component-modal-overlay {
                background: var(--glass-scrim-bg) !important;
                backdrop-filter: var(--glass-scrim-blur) !important;
                -webkit-backdrop-filter: var(--glass-scrim-blur) !important;
            }
            html.has-cursor-glow .modal-overlay.auth-stage {
                background: transparent !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
            }
            * { box-sizing: border-box; }
            html, body, button, a, [role="button"], label, summary, input, select, textarea {
                -webkit-tap-highlight-color: transparent;
            }
            button, a, [role="button"], input[type="button"], input[type="submit"] {
                outline: none;
            }
            button:focus, button:focus-visible, button:active,
            a:focus, a:focus-visible, a:active,
            [role="button"]:focus, [role="button"]:focus-visible {
                outline: none;
                box-shadow: none;
            }
            button::-moz-focus-inner {
                border: 0;
            }
            .glass-surface {
                position: relative;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-window);
                box-shadow: var(--glass-shadow);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                overflow: hidden;
            }
            .glass-surface > *:not(.glass-accent) { position: relative; z-index: 1; }
            .glass-card {
                position: relative;
                background-image: var(--glass-window-stack);
                background-color: var(--glass-bg);
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-window);
                box-shadow: var(--glass-shadow);
                backdrop-filter: var(--glass-window-blur);
                -webkit-backdrop-filter: var(--glass-window-blur);
            }
            .glass-accent {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 2px;
                background: var(--accent-color);
                z-index: 2;
                pointer-events: none;
            }
            .glass-accent.danger { background: var(--danger); }
            .glass-accent.success { background: var(--success); }
            .glass-inset {
                background: var(--glass-inset);
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
            }
            .glass-chip {
                background: var(--glass-inset);
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn-sm);
                color: var(--text-muted);
                font-size: 10px;
                padding: 5px 10px;
                text-transform: uppercase;
                letter-spacing: 0.03em;
            }
            .panel-window-head {
                display: flex;
                justify-content: space-between;
                align-items: center;
                gap: 10px;
                flex-wrap: wrap;
                padding: 14px 16px 0;
                flex-shrink: 0;
                overflow: visible;
            }
            .panel-window-title {
                margin: 0;
                font-size: 13px;
                font-weight: 600;
                color: var(--text-main);
                display: flex;
                align-items: center;
                gap: 8px;
                text-transform: uppercase;
                letter-spacing: 0.04em;
            }
            .panel-window-title svg {
                width: 15px;
                height: 15px;
                flex-shrink: 0;
                color: var(--text-main);
            }
            
            
            
            
            .notes-window,
            .scp-card{
                color: var(--text-main);
                background: transparent;
                background-color: transparent;
                border: none;
                border-radius: 0;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                width: min(100%, 1200px);
                height: auto;
                max-height: none;
                min-height: 0;
                position: relative;
                top: auto;
                left: auto;
                flex: 0 0 auto;
                margin: 12px auto 24px;
                transform: none;
                display: flex;
                flex-direction: column;
                gap: 8px;
                overflow: visible;
                padding: 0;
                box-sizing: border-box;
                align-self: center;
            }
            
            .scp-card > *:not(.panel-window-head),
            .ai-panel-window > *:not(.panel-window-head):not(.ai-dusk) { position: relative; z-index: 1; }
            .notes-window > .panel-window-head,
            .scp-card > .panel-window-head,
            .ai-panel-window > .panel-window-head{
                padding: 6px 12px;
                gap: 8px;
                min-height: 38px;
                width: 100%;
                box-sizing: border-box;
                align-self: stretch;
                border: 1px solid var(--glass-border);
                margin: 0;
                flex-shrink: 0;
                z-index: 40;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                border-radius: var(--radius-header);
            }
            .notes-window .panel-window-title,
            .scp-card .panel-window-title,
            .ai-panel-window .panel-window-title{
                font-size: 11px;
                gap: 6px;
            }
            .notes-window .panel-window-title svg,
            .scp-card .panel-window-title svg,
            .ai-panel-window .panel-window-title svg{
                width: 13px;
                height: 13px;
            }
            .notes-window .glass-chip,
            .scp-card .glass-chip{
                font-size: 9px;
                padding: 2px 7px;
            }
            .panel-window-head-start {
                display: flex;
                align-items: center;
                gap: 8px;
                flex-wrap: nowrap;
                min-width: 0;
                flex: 1 1 auto;
            }
            .panel-window-head-end {
                display: flex;
                align-items: center;
                gap: 6px;
                flex: 0 0 auto;
                margin-left: auto;
            }
            .panel-head-icon-btn {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 28px;
                height: 28px;
                padding: 0;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-muted);
                cursor: pointer;
                flex: 0 0 auto;
                transition: border-color 0.15s, color 0.15s, background-color 0.15s;
            }
            .panel-head-icon-btn svg {
                width: 14px;
                height: 14px;
                display: block;
            }
            .panel-window-head.is-searching .panel-head-icon-btn[data-panel-search-toggle] {
                display: none;
            }
            @media (hover: hover) and (pointer: fine) {
                .panel-head-icon-btn:hover {
                    color: #dcdcda;
                    border-color: rgba(245, 245, 244, 0.65);
                    background: rgba(245, 245, 244, 0.18);
                }
            }
            
            /* Mobile panel overflow menus (hamburger). Hidden on desktop. */
            .panel-head-menu {
                position: relative;
                display: none;
                flex: 0 0 auto;
            }
            .panel-head-menu.is-open > [data-panel-menu-toggle] {
                color: #dcdcda;
                border-color: rgba(245, 245, 244, 0.65);
                background: rgba(245, 245, 244, 0.18);
            }
            .panel-head-menu-panel {
                position: absolute;
                top: calc(100% + 8px);
                right: 0;
                left: auto;
                z-index: 120;
                min-width: min(280px, calc(100vw - 16px));
                width: min(280px, calc(100vw - 16px));
                padding: 6px;
                box-sizing: border-box;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                display: flex;
                flex-direction: column;
                gap: 4px;
                transform-origin: top right;
            }
            .panel-head-menu-panel.is-ported {
                display: flex;
                position: fixed;
                z-index: 10050;
                margin: 0;
                transform-origin: top right;
            }
            .panel-head-menu-panel[hidden] {
                display: none !important;
            }
            .panel-head-menu-item {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 12px;
                width: 100%;
                margin: 0;
                padding: 10px 12px;
                border: 1px solid transparent;
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-main);
                text-align: left;
                cursor: pointer;
                font: inherit;
                box-sizing: border-box;
                min-height: 52px;
                -webkit-tap-highlight-color: transparent;
            }
            .panel-head-menu-item-icon {
                flex: 0 0 36px;
                width: 36px;
                height: 36px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 10px;
                background: rgba(245, 245, 244, 0.16);
                color: #dcdcda;
            }
            .panel-head-menu-item-icon svg {
                width: 18px;
                height: 18px;
                display: block;
            }
            .panel-head-menu-item-body {
                min-width: 0;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                gap: 2px;
            }
            .panel-head-menu-item-label {
                font-size: 12px;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                line-height: 1.25;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .panel-head-menu-item-hint {
                font-size: 11px;
                line-height: 1.3;
                color: var(--text-muted);
                letter-spacing: 0;
                text-transform: none;
                font-weight: 400;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .panel-head-menu-item:hover,
            .panel-head-menu-item:active,
            .panel-head-menu-item:focus-visible {
                border-color: rgba(245, 245, 244, 0.55);
                color: #dcdcda;
                outline: none;
            }
            
            .panel-search-tray {
                display: none;
                flex: 1 1 100%;
                min-width: 0;
            }
            .panel-window-head.is-searching .panel-search-tray {
                display: block;
                animation: panelSearchReveal 0.18s ease-out both;
            }
            @keyframes panelSearchReveal {
                /* No transform: a leftover translate on the tray kills child backdrop-filter. */
                from { opacity: 0; }
                to { opacity: 1; }
            }
            .panel-search-tray.is-ported {
                display: block !important;
                position: fixed;
                z-index: 10050;
                margin: 0;
                padding: 0;
                pointer-events: auto;
                transform: none;
                animation: panelSearchReveal 0.18s ease-out both;
            }
            .panel-search-field {
                display: flex;
                align-items: center;
                gap: 8px;
                width: 100%;
                box-sizing: border-box;
                padding: 8px 10px 8px 12px;
                isolation: isolate;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                box-shadow: var(--glass-shadow);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
            }
            .panel-window-head.is-searching .panel-search-field {
                border-color: var(--glass-border);
                box-shadow: var(--glass-shadow);
            }
            .panel-search-field > svg {
                width: 14px;
                height: 14px;
                flex: 0 0 auto;
                color: #dcdcda;
            }
            .panel-search-input {
                flex: 1 1 auto;
                min-width: 0;
                margin: 0;
                padding: 0;
                border: none;
                outline: none;
                background: transparent;
                color: var(--text-main);
                font: inherit;
                font-size: 13px;
                -webkit-appearance: none;
                appearance: none;
            }
            .panel-search-input::-webkit-search-decoration,
            .panel-search-input::-webkit-search-cancel-button,
            .panel-search-input::-webkit-search-results-button {
                -webkit-appearance: none;
                appearance: none;
            }
            .panel-search-input::placeholder {
                color: var(--text-muted);
            }
            .panel-search-clear {
                display: none;
                align-items: center;
                justify-content: center;
                flex: 0 0 auto;
                width: 28px;
                height: 28px;
                margin: 0;
                padding: 0;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn-sm);
                background: rgba(255, 255, 255, 0.06);
                color: var(--text-muted);
                font-size: 18px;
                line-height: 1;
                cursor: pointer;
                transition: color 0.15s, border-color 0.15s, background-color 0.15s;
            }
            .panel-search-clear:hover {
                color: var(--text-main);
                border-color: rgba(255, 255, 255, 0.22);
                background: rgba(255, 255, 255, 0.1);
            }
            .panel-window-head.is-searching .panel-search-clear,
            .panel-search-tray.is-ported .panel-search-clear {
                display: inline-flex;
            }
            .note-item.is-search-hidden,
            .file-item.is-search-hidden,
            .ai-history-item.is-search-hidden,
            .ai-jump-item.is-search-hidden {
                display: none !important;
            }
            .panel-search-empty {
                color: var(--text-muted);
                text-align: center;
                padding: 18px 8px;
                font-size: 13px;
            }
            .visibility-toggle {
                display: none;
                align-items: center;
                gap: 6px;
                color: var(--text-muted);
                font-size: 11px;
                font-weight: 600;
                letter-spacing: 0.01em;
                cursor: pointer;
                white-space: nowrap;
                user-select: none;
            }
            
            .visibility-toggle.is-shown {
                display: inline-flex;
            }
            .visibility-toggle .vis-box {
                position: relative;
                width: 16px;
                height: 16px;
                flex: 0 0 auto;
            }
            .visibility-toggle input {
                position: absolute;
                inset: 0;
                margin: 0;
                opacity: 0;
                cursor: pointer;
                width: 16px;
                height: 16px;
            }
            .visibility-toggle .vis-check {
                position: absolute;
                inset: 0;
                border: 1px solid var(--glass-border);
                border-radius: 4px;
                background: var(--glass-inset);
                pointer-events: none;
            }
            .visibility-toggle.is-on .vis-check {
                background: rgba(245, 245, 244, 0.22);
                border-color: rgba(245, 245, 244, 0.65);
            }
            .visibility-toggle.is-on .vis-check::after {
                content: "";
                position: absolute;
                left: 4px;
                top: 1px;
                width: 5px;
                height: 9px;
                border: solid #dcdcda;
                border-width: 0 2px 2px 0;
                transform: rotate(45deg);
            }
            .visibility-toggle.is-on .vis-label {
                color: #dcdcda;
            }
            .notes-panel-body,
            .scp-body{
                position: relative;
                flex: 1 1 auto;
                min-height: 0;
                padding: 0;
                box-sizing: border-box;
                background: transparent;
                background-color: transparent;
                border-radius: 0;
            }
            .notes-panel-body,
            .scp-body {
                overflow: visible;
            }
            
            @keyframes panelReveal {
                from { opacity: 0; transform: translateY(8px); }
                to { opacity: 1; transform: translateY(0); }
            }
            /* Opacity-only: transform on the body creates a containing block and
               pins position:fixed AI composer to the short panel top for ~0.3s. */
            @keyframes panelBodyReveal {
                from { opacity: 0; }
                to { opacity: 1; }
            }
            .panel-body-enter {
                animation: panelBodyReveal 0.22s ease-out both;
            }
            ::selection {
                background: rgba(245, 245, 244, 0.45);
                color: #fafaf9;
            }
            ::-moz-selection {
                background: rgba(245, 245, 244, 0.45);
                color: #fafaf9;
            }
            @keyframes controlReveal {
                from { opacity: 0; transform: translateY(-5px); }
                to { opacity: 1; transform: translateY(0); }
            }
            
            @keyframes modalBackdropReveal {
                from { opacity: 0; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
                to { opacity: 1; backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); }
            }
            @keyframes modalCardReveal {
                from { opacity: 0; transform: translateY(12px) scale(0.96); }
                to { opacity: 1; transform: translateY(0) scale(1); }
            }
            @keyframes modalBackdropHide {
                from { opacity: 1; backdrop-filter: blur(24px) saturate(150%); -webkit-backdrop-filter: blur(24px) saturate(150%); }
                to { opacity: 0; backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px); }
            }
            @keyframes modalCardHide {
                from { opacity: 1; transform: translateY(0) scale(1); }
                to { opacity: 0; transform: translateY(12px) scale(0.96); }
            }
            body > header { animation: controlReveal 0.35s ease-out both; }
            .control-panel > *:not(.nav-active-pill):not(.header-panel-tools) { animation: controlReveal 0.35s ease-out both; }
            .control-panel > :nth-child(2) { animation-delay: 0.04s; }
            .control-panel > :nth-child(3) { animation-delay: 0.08s; }
            .control-panel > :nth-child(4) { animation-delay: 0.12s; }
            .control-panel > :nth-child(5) { animation-delay: 0.16s; }
            .control-panel > :nth-child(6) { animation-delay: 0.2s; }
            .view-container.tab-enter { animation: none; }
            #modal-root {
                position: fixed !important;
                inset: 0;
                z-index: 20000;
                pointer-events: none;
            }
            #modal-root > .modal-overlay,
            #modal-root > .component-modal-overlay {
                pointer-events: auto;
            }
            .modal-overlay,
            .component-modal-overlay {
                display: none;
            }
            .modal-overlay.modal-showing,
            .component-modal-overlay.modal-showing {
                animation: modalBackdropReveal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both; 
            }
            .modal-overlay[style*="display: flex"],
            .modal-overlay[style*="display: block"],
            .component-modal-overlay[style*="display: flex"],
            .component-modal-overlay[style*="display: block"] {
                animation: modalBackdropReveal 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) both;
            }
            .modal-overlay.is-closing,
            .component-modal-overlay.is-closing {
                animation: modalBackdropHide 0.3s cubic-bezier(0.4, 0, 1, 0.2) both;
                pointer-events: none;
            }
            .modal-overlay.modal-showing > .modal-content,
            .modal-overlay.modal-showing > .error-card,
            .modal-overlay.modal-showing > .success-card,
            .modal-overlay.modal-showing > .choice-card,
            .modal-overlay.modal-showing > .confirm-card,
            .modal-overlay.modal-showing > .revoked-card,
            .modal-content,
            .error-card,
            .success-card,
            .choice-card,
            .confirm-card,
            .revoked-card { animation: modalCardReveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
            .component-modal-card { animation: modalCardReveal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
            #noteViewerOverlay > .note-viewer-window.component-modal-card {
                animation: none !important;
            }
            .modal-overlay.is-closing > .modal-content,
            .modal-overlay.is-closing > .error-card,
            .modal-overlay.is-closing > .success-card,
            .modal-overlay.is-closing > .choice-card,
            .modal-overlay.is-closing > .confirm-card,
            .modal-overlay.is-closing > .revoked-card {
                animation: modalCardHide 0.3s cubic-bezier(0.4, 0, 1, 0.2) both;
                pointer-events: none;
            }
            .component-modal-overlay.is-closing > .component-modal-card {
                animation: modalCardHide 0.3s cubic-bezier(0.4, 0, 1, 0.2) both;
                pointer-events: none;
            }
            @media (prefers-reduced-motion: reduce) {
                *, *::before, *::after {
                    animation-duration: 0.01ms !important;
                    animation-iteration-count: 1 !important;
                    transition-duration: 0.01ms !important;
                }
            }
            body { 
                margin: 0; padding: 0; height: 100vh; height: 100dvh; 
                display: flex; flex-direction: column; overflow: hidden; font-family: 'Segoe UI', Roboto, sans-serif; 
                -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
                background-color: var(--bg-color);
                background-image: var(--page-glow);
                -webkit-tap-highlight-color: transparent;
            }
            body > header { 
                margin: 0;
                padding: 6px 10px;
                color: var(--text-main);
                font-size: 13px;
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                z-index: 100;
                overflow: visible;
                border-radius: 0;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                border: none;
                border-bottom: 1px solid var(--glass-border);
                box-shadow: none;
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
            }
            body > header::before {
                content: none;
            }
            .control-panel {
                display: flex;
                align-items: center;
                gap: 8px;
                width: 100%;
                flex-wrap: wrap;
                position: relative;
                z-index: 1;
                overflow: visible;
            }
            select, .nav-btn{ 
                padding: 6px 12px;
                background: rgba(40, 40, 40, 0.40);
                color: var(--text-main);
                border: 1px solid rgba(255, 255, 255, 0.1);
                border-radius: var(--radius-btn); cursor: pointer; font-size: 12px; max-width: 100%;
                transition: border-color 0.15s, color 0.15s, background-color 0.15s;
                white-space: nowrap;
                backdrop-filter: blur(8px);
                -webkit-backdrop-filter: blur(8px);
                font-family: inherit;
                line-height: 1.2;
            }
             .nav-btn:hover { border-color: var(--accent-color); color: var(--accent-color); background: rgba(245, 245, 244, 0.12); }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            .nav-btn { font-weight: 500; text-transform: uppercase; letter-spacing: 0.03em; font-size: 11px; }
            .nav-btn.active { border: none; border-color: transparent; color: var(--accent-color); background: transparent; }
            
            
            
            .logout-link {
                color: var(--danger-text);
                text-decoration: none;
                font-size: 11px;
                margin-left: auto;
                font-weight: 500;
                text-transform: uppercase;
                letter-spacing: 0.03em;
                white-space: nowrap;
            }
            .logout-link:hover { color: #f0b6b6; }

            .panel-nav {
                display: contents;
            }
            .nav-btn {
                display: inline-flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 2px;
                min-width: 56px;
                padding: 2px 8px 2px;
                position: relative;
                z-index: 1;
                text-transform: none;
                letter-spacing: 0.01em;
                font-size: 10px;
                font-weight: 500;
                border: none;
                background: transparent;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
            }
            a.nav-btn {
                text-decoration: none;
                color: inherit;
                cursor: pointer;
            }
            .nav-btn:hover {
                border: none;
                background: transparent;
                color: var(--accent-color);
            }
            .nav-active-pill {
                position: absolute;
                top: 0;
                left: 0;
                z-index: 5;
                flex: none;
                margin: 0;
                box-sizing: border-box;
                border-radius: 10px;
                border: 1.5px solid var(--accent-color);
                background: transparent;
                box-shadow: 0 0 0 1px rgba(245, 245, 244, 0.22);
                pointer-events: none;
                opacity: 0;
                animation: none !important;
                overflow: visible;
                will-change: transform, width, height;
                transform: translate3d(0, 0, 0);
                transition:
                    transform 0.26s cubic-bezier(0.22, 1, 0.36, 1),
                    width 0.26s cubic-bezier(0.22, 1, 0.36, 1),
                    height 0.26s cubic-bezier(0.22, 1, 0.36, 1),
                    opacity 0.16s ease;
            }
            .nav-active-pill.is-hidden {
                opacity: 0;
            }
            .nav-active-pill.is-ready:not(.is-hidden) {
                opacity: 1;
            }
            .nav-active-pill.is-instant {
                transition: none !important;
            }
            .nav-btn .nav-icon {
                display: flex;
                align-items: center;
                justify-content: center;
                min-width: 44px;
                height: 24px;
                padding: 0 10px;
                border-radius: 999px;
                position: relative;
                z-index: 1;
                transition: color 0.18s ease;
            }
            .nav-btn .nav-icon svg {
                width: 17px;
                height: 17px;
                display: block;
            }
            .nav-btn .nav-label {
                display: block;
                line-height: 1.05;
                font-size: 9px;
                white-space: nowrap;
            }
            .nav-btn.active .nav-icon {
                background: transparent;
                color: var(--accent-color);
            }
            
            .logout-link.nav-btn {
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 2px;
                min-width: 56px;
                padding: 2px 8px 2px;
                margin-left: 0;
                background: transparent;
                border: none;
                border-radius: 0;
                box-shadow: none;
                color: #e88b8b;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                text-transform: none;
                letter-spacing: 0.01em;
                font-size: 10px;
                font-weight: 500;
            }
            .logout-link.nav-btn .nav-icon {
                display: flex;
                color: #e88b8b;
            }
            .logout-link.nav-btn .nav-label {
                display: block;
                color: #e88b8b;
            }
            .logout-link.nav-btn:hover {
                color: #f0b6b6;
                border: none;
                background: transparent;
            }
            .logout-link.nav-btn:hover .nav-icon {
                color: #f0b6b6;
                background: rgba(232, 139, 139, 0.14);
            }
            .logout-link.nav-btn:hover .nav-label {
                color: #f0b6b6;
            }

            
            .view-container { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; width: 100%; height: 100%; min-height: 0; }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            

            
            
            
            
            
            
            

            
            .stub-box {
                background-image: var(--ink-stack);
                background-color: var(--ink-bg);
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-window);
                padding: 26px; max-width: 400px; width: 90%;
                box-shadow: var(--ink-shadow);
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                position: relative;
                overflow: hidden;
            }
            .stub-box::after { content: none; }
            .stub-box > * { position: relative; z-index: 1; }

            .modal-overlay,
            .component-modal-overlay {
                display: none;
                position: fixed !important;
                inset: 0 !important;
                top: 0 !important;
                left: 0 !important;
                width: 100% !important;
                height: 100% !important;
                margin: 0 !important;
                box-sizing: border-box;
                background: var(--glass-scrim-bg);
                backdrop-filter: var(--glass-scrim-blur);
                -webkit-backdrop-filter: var(--glass-scrim-blur);
                z-index: 1000;
                justify-content: center;
                align-items: center;
                padding: 16px;
            }
            html.has-cursor-glow .modal-overlay,
            html.has-cursor-glow .component-modal-overlay,
            html.has-cursor-glow #modal-root {
                position: fixed !important;
            }
            #globalPermissionNotifyModal { z-index: 10005; }
            
            #clientJournalModal,
            #permsModal { z-index: 10010; }
            
            #aiHistorySheet,
            #aiJumpSheet { z-index: 10012; }
            
            #confirmBackupModal,
            #confirmRevokeModal { z-index: 10018; }
            
            .ai-sheet-search {
                display: flex;
                margin: 0 0 12px;
            }
            #aiHistorySheet .ai-sheet-action {
                position: relative;
                z-index: 1;
            }
            #appAlertModal { z-index: 10020; }
            #aiShareGroupsModal { z-index: 10014; }
            #appConfirmModal,
            #chatConfirmModal { z-index: 23050; }
            #appConfirmModal .confirm-card {
                background-image: var(--glass-highlight);
                background-color: var(--glass-popover-fill);
            }
            #chatConfirmModal .confirm-card {
                background-image: var(--glass-highlight);
                background-color: var(--glass-popover-fill);
            }
            
            .view-container[aria-hidden="true"] {
                display: none !important;
                pointer-events: none !important;
                visibility: hidden !important;
            }
            .modal-content::after { content: none; }
            .modal-content > *:not(.glass-accent) { position: relative; z-index: 1; }
            .modal-content .glass-accent { z-index: 2; }
            .modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--glass-border); padding-bottom: 10px; margin-bottom: 14px; }
            .modal-header h3 { margin: 0; font-size: 13px; color: var(--text-main); display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
            .modal-header h3 svg { width: 15px; height: 15px; color: var(--accent-color); flex-shrink: 0; }
            .close-btn { background: none; border: none; color: var(--text-muted); font-size: 18px; cursor: pointer; line-height: 1; padding: 2px; border-radius: var(--radius-btn-sm); }
            .close-btn:hover { background: rgba(255,255,255,0.06); }
            .close-btn:hover { color: #fff; }
            
            .section-title { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 18px; margin-bottom: 6px; display: flex; align-items: center; gap: 7px; text-transform: uppercase; letter-spacing: 0.05em; }
            .section-title svg { width: 13px; height: 13px; color: var(--text-main); }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            #permsModal .modal-content {
                max-height: min(86vh, 720px);
                overflow-y: auto;
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            #sessionLinksModal .session-links-modal {
                width: min(440px, calc(100vw - 24px)) !important;
                max-width: 440px !important;
                height: min(86vh, 720px);
                min-height: 0;
                max-height: min(86vh, 720px);
                padding-bottom: 18px;
                overflow: hidden;
                display: flex;
                flex-direction: column;
            }
            #sessionLinksModal .glass-accent,
            #sessionLinksModal .modal-header,
            #sessionLinksModal #sessionLinkSaveBtn {
                flex: 0 0 auto;
            }
            #sessionLinksModal #sessionLinkSaveBtn {
                position: static;
                z-index: auto;
                margin-top: 12px;
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            @media (max-width: 600px) {
                #sessionLinksModal .session-links-modal {
                    width: 100% !important;
                    max-width: none !important;
                    height: min(86vh, calc(100dvh - 96px));
                    max-height: min(86vh, calc(100dvh - 96px));
                }
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            .note-item.is-item-focus,
            .file-item.is-item-focus {
                outline: 1px solid rgba(245, 245, 244, 0.7);
                border-color: rgba(245, 245, 244, 0.7);
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            .card-action-btn {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                margin: 0;
                padding: 3px 7px;
                min-height: 0;
                background: transparent;
                border: 1px solid var(--border-color);
                border-radius: var(--radius-btn-sm);
                color: var(--text-main);
                cursor: pointer;
                font: inherit;
                font-size: 10px;
                font-weight: 500;
                line-height: 1.2;
                letter-spacing: 0.03em;
                text-transform: uppercase;
                text-decoration: none;
                box-sizing: border-box;
                outline: none;
                -webkit-tap-highlight-color: transparent;
                transition: background-color 0.15s, border-color 0.15s, color 0.15s;
            }
            .card-action-btn:focus,
            .card-action-btn:focus-visible,
            .card-action-btn:active {
                outline: none;
                box-shadow: none;
            }
            .card-action-btn::-moz-focus-inner {
                border: 0;
            }
            .card-action-btn:hover {
                background: rgba(255, 255, 255, 0.06);
            }
            .card-action-btn.is-accent {
                color: #dcdcda;
                border-color: rgba(245, 245, 244, 0.4);
            }
            .card-action-btn.is-accent:hover {
                background: rgba(245, 245, 244, 0.12);
            }
            .card-action-btn.is-danger {
                color: var(--danger-text);
                border-color: rgba(232, 139, 139, 0.4);
            }
            .card-action-btn.is-danger:hover {
                background: rgba(232, 139, 139, 0.12);
            }

            .status-badge { padding: 2px 7px; border-radius: var(--radius-btn-sm); font-size: 10px; font-weight: 500; border: 1px solid; text-transform: uppercase; letter-spacing: 0.03em; }
            .status-success { background: rgba(127, 209, 168, 0.1); color: var(--success-text); border-color: rgba(127, 209, 168,0.35); }
            .status-fail { background: rgba(232, 139, 139, 0.1); color: var(--danger-text); border-color: rgba(232, 139, 139,0.35); }
            .revoked-card::after, .choice-card::after, .confirm-card::after,
            .error-card::after, .success-card::after { content: none; }
            .revoked-card > *:not(.glass-accent),
            .choice-card > *:not(.glass-accent),
            .confirm-card > *:not(.glass-accent),
            .error-card > *:not(.glass-accent),
            .success-card > *:not(.glass-accent) { position: relative; z-index: 1; }
            .revoked-card .glass-accent,
            .choice-card .glass-accent,
            .confirm-card .glass-accent,
            .error-card .glass-accent,
            .success-card .glass-accent { z-index: 2; }

            .icon-badge {
                width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
                margin: 0 auto 14px; border: 1px solid; flex-shrink: 0;
            }
            .icon-badge svg { width: 21px; height: 21px; }
            .icon-badge.danger { background: rgba(232, 139, 139, 0.08); border-color: rgba(232, 139, 139, 0.4); color: var(--danger-text); }
            .icon-badge.success { background: rgba(127, 209, 168, 0.08); border-color: rgba(127, 209, 168, 0.4); color: var(--success-text); }
            .icon-badge.warning { background: rgba(230, 195, 122, 0.08); border-color: rgba(230, 195, 122, 0.4); color: var(--warning); }
            .icon-badge.info { background: rgba(245, 245, 244, 0.08); border-color: rgba(245, 245, 244, 0.4); color: var(--accent-color); }

            .revoked-title { color: var(--danger-text); font-size: 14px; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
            .revoked-text { color: var(--text-muted); font-size: 12px; line-height: 1.5; margin-bottom: 18px; }
            .revoked-btn { background: var(--danger); color: white; border: none; padding: 9px 16px; border-radius: var(--radius-btn); font-weight: 600; cursor: pointer; width: 100%; text-transform: uppercase; letter-spacing: 0.03em; font-size: 12px; transition: background-color 0.15s; }
            .revoked-btn:hover { background: #d67070; }

            .choice-title { color: var(--text-main); font-size: 14px; font-weight: 600; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
            .choice-subtitle { color: var(--text-muted); font-size: 12px; margin-bottom: 18px; }
            .choice-buttons { display: flex; flex-direction: column; gap: 6px; }
            .choice-btn {
                display: flex; align-items: center; justify-content: center; gap: 8px;
                padding: 10px 14px; border-radius: var(--radius-btn); border: 1px solid var(--border-color); font-size: 12px; font-weight: 500;
                cursor: pointer; background: var(--glass-inset); color: var(--text-main); transition: border-color 0.15s, color 0.15s;
                text-transform: uppercase; letter-spacing: 0.03em;
            }
            .choice-btn svg { width: 15px; height: 15px; }
            .choice-btn:hover { border-color: var(--accent-color); color: var(--accent-color); }
            
            

            #scpManagerContainer,
            #notesManagerContainer,
            #chatManagerContainer{
                background-color: var(--bg-color);
                background-image: var(--page-glow);
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
                padding: 8px;
                padding-top: var(--header-offset, 72px);
                box-sizing: border-box;
                width: 100%;
                height: 100%;
                min-height: 0;
                overflow: hidden;
                flex: 1 1 0;
                position: relative;
            }
            #scpManagerContainer::before,
            #scpManagerContainer::after,
            #notesManagerContainer::before,
            #notesManagerContainer::after,
            #chatManagerContainer::before,
            #chatManagerContainer::after{
                content: "";
                display: block;
                flex: 1 1 0%;
                min-height: 0;
                pointer-events: none;
            }
            

            @media (max-width: 600px) {

                html, body {
                    width: 100%;
                    max-width: 100vw;
                    overflow-x: hidden;
                }

                
                html.has-cursor-glow body > header {
                    top: auto;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    z-index: 200;
                }
                
                html.has-cursor-glow #scpManagerContainer,
                html.has-cursor-glow #notesManagerContainer,
                html.has-cursor-glow #aiManagerContainer {
                    position: fixed;
                    top: 0;
                    right: 0;
                    bottom: 0;
                    left: 0;
                    width: auto;
                    height: auto;
                }
                body > header {
                    top: auto;
                    bottom: 0;
                    left: 0;
                    right: 0;
                    padding: 3px 8px;
                    padding-bottom: calc(3px + var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
                    gap: 4px;
                    min-height: 0;
                    box-sizing: border-box;
                    border-radius: 0;
                    border: none;
                    border-top: 1px solid var(--glass-border);
                    border-bottom: none;
                    box-shadow: var(--glass-shadow);
                    z-index: 200;
                }
                .header-panel-tools {
                    display: none !important;
                }
                .control-panel {
                    position: relative;
                    display: flex;
                    flex-direction: row;
                    flex-wrap: wrap;
                    align-items: stretch;
                    gap: 2px;
                }
                
                
                
                
                
                
                
                
                
                select, .choice-btn, .revoked-btn, .close-btn, .card-action-btn {
                    min-height: 36px;
                    padding: 6px 10px;
                    font-size: 11px;
                    touch-action: manipulation;
                    -webkit-tap-highlight-color: transparent;
                }
                .panel-nav {
                    display: flex;
                    position: relative;
                    flex: 1 1 auto;
                    align-items: stretch;
                    justify-content: stretch;
                    flex-wrap: nowrap;
                    gap: 2px;
                    padding: 2px;
                    min-width: 0;
                    border: none;
                    border-radius: 0;
                    background: transparent;
                    box-sizing: border-box;
                    overflow: visible;
                }
                .card-action-row {
                    display: flex;
                    flex-direction: row;
                    flex-wrap: nowrap;
                    align-items: stretch;
                    gap: 6px;
                    width: 100%;
                }
                .card-action-row .card-action-btn {
                    flex: 1 1 0;
                    min-width: 0;
                    padding: 6px 8px;
                    font-size: 10px;
                    white-space: nowrap;
                }
                
                
                body.is-kbd-open .panel-nav {
                    display: none !important;
                }
                body.is-kbd-open > header {
                    display: none !important;
                    visibility: hidden !important;
                    pointer-events: none !important;
                }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                .panel-nav .nav-btn,
                .control-panel > .logout-link {
                    flex: 1 1 0;
                    min-width: 0;
                    min-height: 40px;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: center;
                    gap: 2px;
                    padding: 5px 2px;
                    margin: 0;
                    border: 1px solid transparent;
                    background: transparent;
                    box-shadow: none;
                    backdrop-filter: none;
                    -webkit-backdrop-filter: none;
                    border-radius: 10px;
                    color: rgba(244, 244, 243, 0.72);
                    font-size: 9px;
                    font-weight: 500;
                    letter-spacing: 0.01em;
                    text-transform: none;
                    text-decoration: none;
                    touch-action: manipulation;
                    -webkit-tap-highlight-color: transparent;
                    position: relative;
                    z-index: 1;
                    box-sizing: border-box;
                    transition: color 0.18s ease;
                }
                .control-panel > .logout-link.nav-logout {
                    flex: 0 0 auto;
                    width: 48px;
                    min-width: 48px;
                    max-width: 52px;
                    margin-left: 2px;
                    padding: 5px 0;
                }
                .panel-nav .nav-btn:hover,
                .control-panel > .logout-link:hover {
                    border-color: transparent;
                    background: transparent;
                    color: rgba(244, 244, 243, 0.92);
                }
                .panel-nav .nav-btn .nav-icon,
                .control-panel > .logout-link .nav-icon {
                    display: flex;
                    align-items: center;
                    justify-content: center;
                    width: auto;
                    min-width: 0;
                    height: 18px;
                    padding: 0;
                    border-radius: 0;
                    position: relative;
                    z-index: 1;
                    transition: color 0.18s ease;
                }
                .panel-nav .nav-btn .nav-icon svg,
                .control-panel > .logout-link .nav-icon svg {
                    width: 16px;
                    height: 16px;
                    display: block;
                }
                .panel-nav .nav-btn .nav-label,
                .control-panel > .logout-link .nav-label {
                    display: block;
                    line-height: 1.1;
                    font-size: 9px;
                    white-space: nowrap;
                    transition: color 0.18s ease;
                }
                .panel-nav .nav-btn.active {
                    color: var(--accent-color);
                    background: transparent;
                    border-color: transparent;
                }
                .panel-nav .nav-btn.active .nav-icon {
                    background: transparent;
                    color: var(--accent-color);
                }
                .control-panel > .nav-active-pill,
                .panel-nav .nav-active-pill {
                    z-index: 5;
                    border-radius: 10px;
                    border: 1.5px solid var(--accent-color);
                    background: rgba(245, 245, 244, 0.08);
                    box-shadow: 0 0 0 1px rgba(245, 245, 244, 0.22);
                }
                .control-panel > .logout-link {
                    color: #e88b8b;
                    margin-left: 0;
                    align-self: stretch;
                    justify-content: center;
                }
                .control-panel > .logout-link .nav-icon {
                    color: #e88b8b;
                }
                .control-panel > .logout-link .nav-label {
                    color: #e88b8b;
                }
                .control-panel > .logout-link:hover {
                    color: #f0b6b6;
                }
                .control-panel > .logout-link:hover .nav-icon {
                    color: #f0b6b6;
                    background: rgba(232, 139, 139, 0.14);
                }
                .control-panel > .logout-link:hover .nav-label {
                    color: #f0b6b6;
                }
                .control-panel > .logout-link,
                .control-panel > .nav-logout,
                .logout-link.nav-logout {
                    display: none !important;
                }
                

                
                
                
                
                
                .close-btn { width: 44px; min-width: 44px; padding: 0; font-size: 24px; }
                
                .choice-buttons { gap: 10px; }
                .choice-btn { width: 100%; }
                .modal-content { width: 100% !important; max-width: none !important; padding: 16px; }
                .modal-overlay,
                .component-modal-overlay {
                    padding: 8px !important;
                    padding-top: max(8px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    padding-bottom: calc(72px + var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
                    align-items: center;
                    justify-content: center;
                }
                #noteViewerOverlay {
                    padding: 8px !important;
                    align-items: center;
                    justify-content: center;
                }
                .revoked-card,
                .choice-card,
                .confirm-card,
                .error-card,
                .success-card,
                .component-modal-card,
                .notes-modal-card {
                    width: 100% !important;
                    max-width: none !important;
                }
                #accessDeniedModal .revoked-card {
                    width: 90% !important;
                    max-width: 380px !important;
                }
                #revokedModal .revoked-card {
                    width: 100% !important;
                    max-width: none !important;
                    height: auto !important;
                    min-height: 0 !important;
                }
                #appAlertModal .modal-content {
                    width: 90% !important;
                    max-width: 380px !important;
                }
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                .panel-head-icon-btn {
                    width: 32px;
                    height: 32px;
                }
                .panel-head-icon-btn svg {
                    width: 14px;
                    height: 14px;
                }
                .panel-search-tray.is-ported,
                .panel-window-head.is-searching .panel-search-tray {
                    left: 8px;
                    right: 8px;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                    width: auto;
                    max-width: none;
                    transform: none !important;
                    filter: none;
                    isolation: auto;
                    overflow: visible;
                    border: 1px solid var(--glass-border);
                    border-radius: var(--radius-header);
                    box-shadow: var(--glass-shadow);
                    /* Same plate as header / composer-bar — blur lives here, not on the label. */
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                }
                .panel-search-field,
                .panel-search-tray.is-ported .panel-search-field,
                .panel-window-head.is-searching .panel-search-field {
                    min-height: 40px;
                    padding: 8px 12px;
                    isolation: auto !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    border: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                }
                .ai-sheet-search,
                .ai-jump-search {
                    min-height: 40px;
                    padding: 8px 12px;
                    isolation: auto !important;
                    background: var(--glass-highlight) !important;
                    background-color: var(--glass-bg) !important;
                    background-image: var(--glass-highlight) !important;
                    border: 1px solid var(--glass-border) !important;
                    border-radius: var(--radius-header) !important;
                    box-shadow: var(--glass-shadow) !important;
                    backdrop-filter: var(--glass-blur) !important;
                    -webkit-backdrop-filter: var(--glass-blur) !important;
                }
                .panel-search-input {
                    font-size: 16px;
                }
                
                
                
                
                
                
                
                
                
                
                
                
                

                #scpManagerContainer,
                #notesManagerContainer,
                #chatManagerContainer,
                #aiManagerContainer {
                    position: fixed;
                    top: 0;
                    right: 0;
                    bottom: 0;
                    left: 0;
                    width: auto;
                    height: auto;
                    flex: none;
                    z-index: 1;
                    display: flex;
                    flex-direction: column;
                    align-items: stretch;
                    justify-content: flex-start;
                    box-sizing: border-box;
                    padding: 4px;
                    padding-top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                    padding-bottom: var(--footer-offset, 80px);
                    overflow-x: hidden;
                    overflow-y: auto;
                    -webkit-overflow-scrolling: touch;
                    scroll-padding-top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                }
                #scpManagerContainer::before,
                #scpManagerContainer::after,
                #notesManagerContainer::before,
                #notesManagerContainer::after,
                #chatManagerContainer::before,
                #chatManagerContainer::after,
                #aiManagerContainer::before,
                #aiManagerContainer::after {
                    content: none;
                    display: none;
                    flex: none;
                }
                .notes-window,
                .scp-card,
                #chatManagerContainer .chat-panel-window,
                #aiManagerContainer .ai-panel-window {
                    position: relative;
                    top: auto;
                    left: auto;
                    width: 100%;
                    height: auto !important;
                    max-height: none !important;
                    min-height: 0 !important;
                    flex: 0 0 auto !important;
                    margin: 0;
                    align-self: stretch;
                    overflow: visible !important;
                    transform: none;
                }
                .notes-panel-body,
                .scp-body,
                .chat-panel-body,
                .ai-panel-body {
                    overflow: visible !important;
                    flex: 1 0 auto;
                    min-height: 0;
                    padding: 8px 4px 12px;
                }
                
                /* Mobile panel heads: same size/sticky as Gemini head */
                #notesManagerContainer .notes-window > .panel-window-head,
                #scpManagerContainer .scp-card > .panel-window-head,
                #aiManagerContainer .ai-panel-window > .panel-window-head {
                    position: sticky !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    z-index: 90 !important;
                    flex: 0 0 auto;
                    min-height: 38px;
                    height: auto;
                    padding: 6px 12px;
                    gap: 8px;
                    flex-wrap: nowrap;
                    align-items: center;
                    border: 1px solid var(--glass-border);
                    border-radius: var(--radius-header);
                    box-shadow: var(--glass-shadow);
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    margin: 0;
                    width: auto;
                    align-self: stretch;
                    box-sizing: border-box;
                }
                
                
                
                #notesManagerContainer .panel-window-title,
                #scpManagerContainer .panel-window-title,
                #aiManagerContainer .panel-window-title {
                    font-size: 11px;
                    gap: 6px;
                }
                #notesManagerContainer .panel-window-title svg,
                #scpManagerContainer .panel-window-title svg,
                #aiManagerContainer .panel-window-title svg {
                    width: 13px;
                    height: 13px;
                }
                #notesManagerContainer .panel-head-icon-btn,
                #scpManagerContainer .panel-head-icon-btn,
                #aiManagerContainer .panel-head-icon-btn {
                    width: 32px;
                    height: 32px;
                }

                /* Compact mobile heads: overlay chip — no reserved gap above content */
                #notesManagerContainer .panel-window-head-start,
                #scpManagerContainer .panel-window-head-start,
                #aiManagerContainer .panel-window-head-start {
                    display: none !important;
                }
                #notesManagerContainer .is-desktop-head-action,
                #scpManagerContainer .is-desktop-head-action,
                #aiManagerContainer .is-desktop-head-action {
                    display: none !important;
                }
                #notesManagerContainer .panel-head-menu.is-mobile-head-menu,
                #scpManagerContainer .panel-head-menu.is-mobile-head-menu,
                #aiManagerContainer .panel-head-menu.is-mobile-head-menu {
                    display: block;
                }
                #notesManagerContainer .notes-window,
                #scpManagerContainer .scp-card,
                #aiManagerContainer .ai-panel-window {
                    position: relative;
                    gap: 0 !important;
                }
                /* Float over content — fixed to viewport, does not scroll away */
                #notesManagerContainer .notes-window > .panel-window-head:not(.is-searching),
                #scpManagerContainer .scp-card > .panel-window-head:not(.is-searching),
                #aiManagerContainer .ai-panel-window > .panel-window-head:not(.is-searching) {
                    position: fixed !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    right: 4px !important;
                    left: auto !important;
                    width: auto !important;
                    max-width: none;
                    align-self: auto;
                    margin: 0 !important;
                    min-height: 0 !important;
                    height: auto !important;
                    padding: 0 !important;
                    gap: 0 !important;
                    border: none !important;
                    border-radius: 0 !important;
                    box-shadow: none !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    z-index: 95 !important;
                    pointer-events: none;
                }
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-window-head-end,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-window-head-end,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-window-head-end,
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn,
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-menu,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-menu,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-menu {
                    pointer-events: auto;
                    margin-left: 0;
                }
                /* Corner control = same glass as main nav header */
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn {
                    width: 38px;
                    height: 38px;
                    border-radius: var(--radius-header);
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    border: 1px solid var(--glass-border);
                    box-shadow: var(--glass-shadow);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    color: var(--text-main);
                    outline: none !important;
                    box-sizing: border-box;
                    -webkit-tap-highlight-color: transparent;
                    -webkit-appearance: none;
                    appearance: none;
                }
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn svg,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn svg,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn svg {
                    width: 15px;
                    height: 15px;
                }
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus,
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus-visible,
                #notesManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:active,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus-visible,
                #scpManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:active,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:focus-visible,
                #aiManagerContainer .panel-window-head:not(.is-searching) .panel-head-icon-btn:active {
                    outline: none !important;
                    box-shadow: var(--glass-shadow);
                }
                /* Search: one compact row (toggle + field), not a second empty line */
                #notesManagerContainer .panel-window-head.is-searching,
                #scpManagerContainer .panel-window-head.is-searching,
                #chatManagerContainer .panel-window-head.is-searching,
                #chatManagerContainer #chatPanelHead.is-searching {
                    position: sticky !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    width: auto !important;
                    align-self: stretch;
                    flex-wrap: nowrap !important;
                    flex-direction: row !important;
                    align-items: center;
                    padding: 0;
                    gap: 0;
                    min-height: 0;
                    height: auto !important;
                    max-height: none !important;
                    overflow: visible !important;
                    visibility: visible !important;
                    display: flex !important;
                    border: none !important;
                    border-radius: 0;
                    box-shadow: none !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    pointer-events: auto !important;
                    z-index: 95 !important;
                }
                #notesManagerContainer .panel-window-head.is-searching .panel-window-head-start,
                #scpManagerContainer .panel-window-head.is-searching .panel-window-head-start,
                #chatManagerContainer .panel-window-head.is-searching .panel-window-head-start,
                #notesManagerContainer .panel-window-head.is-searching .panel-window-head-end,
                #scpManagerContainer .panel-window-head.is-searching .panel-window-head-end,
                #chatManagerContainer .panel-window-head.is-searching .panel-window-head-end {
                    display: none !important;
                }
                #notesManagerContainer .panel-window-head.is-searching .panel-search-tray,
                #scpManagerContainer .panel-window-head.is-searching .panel-search-tray,
                #chatManagerContainer .panel-window-head.is-searching .panel-search-tray {
                    display: block !important;
                    position: fixed !important;
                    left: 8px !important;
                    right: 8px !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    width: auto !important;
                    flex: none !important;
                    min-width: 0;
                    margin: 0 !important;
                    padding: 0 !important;
                    z-index: 10050 !important;
                    order: 0;
                    pointer-events: auto;
                    transform: none !important;
                    isolation: auto;
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    border: 1px solid var(--glass-border);
                    border-radius: var(--radius-header);
                    box-shadow: var(--glass-shadow);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    animation: panelSearchReveal 0.18s ease-out both;
                }
                #notesManagerContainer .panel-window-head.is-searching .panel-search-field,
                #scpManagerContainer .panel-window-head.is-searching .panel-search-field,
                #aiManagerContainer .panel-window-head.is-searching .panel-search-field,
                #chatManagerContainer .panel-window-head.is-searching .panel-search-field {
                    padding: 8px 10px 8px 12px;
                    min-height: 40px;
                    width: 100%;
                    box-sizing: border-box;
                    isolation: auto !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    border: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    opacity: 1;
                }
                
                
                /* Same glass as #aiModelMenu — not the opaque popover fill */
                #notesManagerContainer .panel-head-menu-panel,
                #scpManagerContainer .panel-head-menu-panel,
                #aiManagerContainer .panel-head-menu-panel,
                .panel-head-menu-panel.is-ported {
                    position: absolute;
                    top: calc(100% + 8px);
                    right: 0;
                    left: auto;
                    border-radius: var(--radius-header);
                    background-image: none;
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    border: 1px solid var(--glass-border);
                    box-shadow: var(--glass-shadow);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    padding: 6px;
                    transform-origin: top right;
                }
                .panel-head-menu-panel.is-ported {
                    position: fixed;
                }
                #notesManagerContainer .panel-head-menu-item,
                #scpManagerContainer .panel-head-menu-item,
                #aiManagerContainer .panel-head-menu-item,
                #aiManagerContainer .ai-model-option,
                #aiManagerContainer .ai-attach-option {
                    background: var(--glass-inset);
                    border: 1px solid transparent;
                    border-radius: var(--radius-btn-sm);
                    outline: none !important;
                    -webkit-tap-highlight-color: transparent;
                }
                #aiManagerContainer .ai-model-option:hover,
                #aiManagerContainer .ai-model-option:active,
                #aiManagerContainer .ai-model-option:focus-visible,
                #aiManagerContainer .ai-model-option.is-active {
                    border-color: rgba(245, 245, 244, 0.55);
                    color: #dcdcda;
                }
                .notes-window,
                .scp-card,
                #aiManagerContainer .ai-panel-window {
                    border: none;
                    box-shadow: none;
                    background: transparent;
                }

                
                
                
                
                
                
                


            }

            @media (min-width: 601px) {
                body > header {
                    padding: 2px 10px;
                    top: 0;
                    left: 0;
                    right: 0;
                    min-height: 40px;
                    box-sizing: border-box;
                    display: flex;
                    align-items: center;
                    overflow: visible;
                    border-radius: 0;
                    border: none;
                    border-bottom: 1px solid var(--glass-border);
                    box-shadow: none;
                }
                .control-panel {
                    display: grid;
                    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
                    justify-content: stretch;
                    align-items: center;
                    gap: 6px;
                    min-height: 34px;
                    width: 100%;
                    height: 100%;
                }
                .header-panel-tools {
                    position: relative;
                    left: auto;
                    top: auto;
                    bottom: auto;
                    transform: none !important;
                    animation: none !important;
                    display: flex;
                    align-items: center;
                    justify-content: flex-start;
                    gap: 8px;
                    z-index: 3;
                    grid-column: 1;
                    grid-row: 1;
                    justify-self: start;
                    max-width: 100%;
                    min-width: 0;
                    pointer-events: none;
                }
                .header-panel-tools:empty {
                    display: none;
                }
                .header-panel-tools > * {
                    pointer-events: auto;
                }
                .header-panel-tools > .panel-window-head,
                .header-panel-tools > .panel-window-head.is-in-main-header {
                    position: relative !important;
                    top: auto !important;
                    left: auto !important;
                    right: auto !important;
                    bottom: auto !important;
                    transform: none !important;
                    animation: none !important;
                    display: flex !important;
                    flex: 0 1 auto;
                    flex-wrap: nowrap;
                    align-items: center !important;
                    justify-content: flex-start;
                    gap: 8px;
                    margin: 0 !important;
                    padding: 0 !important;
                    min-height: 0 !important;
                    height: auto !important;
                    width: auto !important;
                    max-width: 100%;
                    align-self: center;
                    border: none !important;
                    border-radius: 0 !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    isolation: auto;
                }
                /* Cursor-glow must not re-frost the ported head (ghost plate under buttons). */
                html.has-cursor-glow .header-panel-tools > .panel-window-head,
                html.has-cursor-glow .header-panel-tools > .panel-window-head.is-in-main-header,
                html.has-cursor-glow .header-panel-tools .panel-window-head-start,
                html.has-cursor-glow .header-panel-tools .panel-window-head-end,
                html.has-cursor-glow .header-panel-tools .panel-head-menu {
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    border-color: transparent !important;
                }
                .header-panel-tools > .panel-window-head::after {
                    content: none !important;
                    display: none !important;
                }
                .header-panel-tools .panel-window-head-start,
                .header-panel-tools .panel-window-head-end,
                .header-panel-tools .panel-head-menu {
                    background: transparent !important;
                    background-color: transparent !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                }
                .header-panel-tools .panel-window-title {
                    display: none !important;
                }
                .header-panel-tools .panel-window-head-start,
                .header-panel-tools .panel-window-head-end {
                    display: inline-flex;
                    align-items: center;
                    flex: 0 0 auto;
                    margin: 0;
                    min-width: 0;
                    gap: 6px;
                }
                .header-panel-tools .panel-window-head-end {
                    order: -1;
                }
                .header-panel-tools .panel-window-head-start {
                    order: 0;
                }
                .header-panel-tools .panel-head-icon-btn {
                    width: 30px;
                    height: 30px;
                    flex: 0 0 auto;
                }
                
                
                .header-panel-tools .visibility-toggle {
                    align-items: center;
                    margin: 0;
                }
                .header-panel-tools .panel-search-tray {
                    display: none;
                    flex: none;
                    min-width: 0;
                    max-width: none;
                }
                .header-panel-tools .panel-window-head.is-searching {
                    flex-wrap: nowrap !important;
                    max-width: none;
                    overflow: visible;
                }
                .header-panel-tools .panel-window-head.is-searching .panel-search-tray {
                    display: block;
                    position: fixed;
                    z-index: 10050;
                    left: 10px;
                    top: calc(8px + 52px + 8px);
                    width: max-content;
                    max-width: calc(100vw - 16px);
                    min-width: 0;
                    margin: 0;
                    padding: 0;
                    animation: panelSearchReveal 0.18s ease-out both;
                    pointer-events: auto;
                }
                .header-panel-tools .panel-window-head.is-searching .panel-search-field,
                .panel-search-tray.is-ported .panel-search-field {
                    width: max-content;
                    max-width: calc(100vw - 16px);
                    min-width: 280px;
                    isolation: isolate;
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    border: 1px solid var(--glass-border);
                    box-shadow: var(--glass-shadow);
                    border-radius: var(--radius-header);
                    opacity: 1;
                }
                .header-panel-tools .panel-search-input {
                    flex: 1 1 auto;
                    width: auto;
                    min-width: 8ch;
                    max-width: none;
                    field-sizing: content;
                }
                /* PC: secondary heads live in main header — hide residual in panels */
                .notes-window > .panel-window-head,
                .scp-card > .panel-window-head,
                .ai-panel-window > .panel-window-head,
                .chat-panel-window > .panel-window-head{
                    display: none !important;
                }
                .notes-window,
                .scp-card,
                #aiManagerContainer .ai-panel-window{
                    gap: 0;
                }
                
                
                .panel-nav {
                    display: flex;
                    position: relative;
                    align-items: stretch;
                    justify-content: center;
                    flex-wrap: nowrap;
                    gap: 4px;
                    padding: 2px;
                    grid-column: 2;
                    grid-row: 1;
                    min-width: 0;
                    z-index: 1;
                    overflow: visible;
                    border: none;
                    border-radius: 0;
                    background: transparent;
                    box-sizing: border-box;
                }
                .panel-nav .nav-btn{
                    flex: 1 1 0;
                    min-width: 52px;
                    min-height: 0;
                    height: auto;
                    margin: 0;
                    padding: 5px 10px;
                    border: 1px solid transparent;
                    border-radius: 10px;
                    background: transparent;
                    background-image: none;
                    box-shadow: none;
                    backdrop-filter: none;
                    -webkit-backdrop-filter: none;
                    color: var(--text-muted);
                    z-index: 1;
                    transition: color 0.18s ease;
                }
                .panel-nav .nav-btn:hover{
                    color: var(--text-main);
                    background: rgba(255, 255, 255, 0.03);
                    border-color: transparent;
                }
                .panel-nav .nav-btn.active,
                .panel-nav .nav-btn.active:hover {
                    color: var(--accent-color);
                    background: transparent;
                    border-color: transparent;
                }
                .panel-nav .nav-btn.active .nav-icon {
                    color: var(--accent-color);
                    background: transparent;
                }
                .panel-nav .nav-btn .nav-icon {
                    min-width: 0;
                    height: 16px;
                    padding: 0;
                    border-radius: 0;
                    position: relative;
                    z-index: 1;
                }
                .panel-nav .nav-btn .nav-icon svg {
                    width: 15px;
                    height: 15px;
                }
                .panel-nav .nav-btn .nav-label {
                    font-size: 10px;
                    font-weight: 600;
                    letter-spacing: 0.02em;
                    transition: color 0.18s ease;
                }
                .panel-nav .nav-active-pill {
                    z-index: 5;
                    border-radius: 10px;
                    border: 1.5px solid var(--accent-color);
                    background: rgba(245, 245, 244, 0.08);
                    box-shadow: 0 0 0 1px rgba(245, 245, 244, 0.22);
                }
                select{
                    padding: 5px 10px;
                    font-size: 11px;
                    min-height: 0;
                    line-height: 1.2;
                }
                
                .logout-link,
                .logout-link.nav-btn {
                    position: relative;
                    right: auto;
                    top: auto;
                    bottom: auto;
                    transform: translateY(0);
                    margin-left: 0;
                    display: inline-flex !important;
                    align-items: center;
                    justify-content: center;
                    height: auto;
                    min-height: 30px;
                    padding: 5px 10px;
                    gap: 6px;
                    flex-direction: row;
                    border: 1px solid var(--glass-border);
                    border-radius: var(--radius-btn-sm);
                    background: var(--glass-chrome-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    grid-column: 3;
                    grid-row: 1;
                    justify-self: end;
                    z-index: 2;
                    transition: transform 0.42s cubic-bezier(0.34, 1.45, 0.64, 1), border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.22s ease;
                }
                .logout-link.nav-btn .nav-icon svg { width: 15px; height: 15px; }
                .logout-link.nav-btn .nav-label { font-size: 11px; }
                .logout-link.nav-btn:hover {
                    border-color: rgba(232, 139, 139, 0.5);
                    background: rgba(232, 139, 139, 0.1);
                    transform: translateY(-3px);
                    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.24);
                }
                .logout-link.nav-btn:active,
                .logout-link.nav-btn:focus-visible {
                    border-color: #e88b8b;
                    box-shadow: 0 0 0 1px #e88b8b, 0 10px 22px rgba(0, 0, 0, 0.24);
                    background: rgba(232, 139, 139, 0.14);
                    transform: translateY(-3px);
                }
                @media (max-width: 1100px) {
                    .control-panel {
                        gap: 6px;
                    }
                    .nav-btn {
                        min-width: 48px;
                        padding: 2px 4px;
                    }
                    .nav-btn .nav-icon {
                        min-width: 36px;
                        padding: 0 8px;
                    }
                    .nav-btn .nav-label {
                        font-size: 8px;
                    }
                    
                }
                @media (max-width: 900px) {
                    .nav-btn .nav-label {
                        display: none;
                    }
                    .nav-btn {
                        min-width: 40px;
                        padding: 2px;
                    }
                    
                }

                

                #scpManagerContainer,
                #notesManagerContainer,
                #chatManagerContainer,
                #aiManagerContainer {
                    position: fixed;
                    top: 0;
                    right: 0;
                    bottom: 0;
                    left: 0;
                    width: auto;
                    height: auto;
                    flex: none;
                    z-index: 1;
                    display: flex;
                    flex-direction: column;
                    align-items: center;
                    justify-content: flex-start;
                    box-sizing: border-box;
                    padding: 8px;
                    padding-top: 8px;
                    overflow-x: hidden;
                    overflow-y: auto;
                    -webkit-overflow-scrolling: touch;
                    scroll-padding-top: var(--header-offset, 72px);
                }
                #scpManagerContainer::before,
                #scpManagerContainer::after,
                #notesManagerContainer::before,
                #notesManagerContainer::after,
                #chatManagerContainer::before,
                #chatManagerContainer::after,
                #aiManagerContainer::before,
                #aiManagerContainer::after {
                    content: none;
                    display: none;
                    flex: none;
                }

                

                
                .notes-window,
                .scp-card,
                #chatManagerContainer .chat-panel-window,
                #aiManagerContainer .ai-panel-window {
                    position: relative;
                    top: auto;
                    left: auto;
                    right: auto;
                    bottom: auto;
                    width: min(100%, 1200px);
                    height: auto !important;
                    max-height: none !important;
                    min-height: 0 !important;
                    margin: 0 auto 24px;
                    margin-top: calc(var(--header-offset, 72px) - 8px);
                    flex: 0 0 auto !important;
                    align-self: center;
                    transform: none;
                    overflow: visible !important;
                    display: flex;
                    flex-direction: column;
                    gap: 8px;
                    border: none;
                    box-shadow: none;
                    background: transparent;
                }
                

                /* PC: sticky glass heads; container scrolls; content slides under */
                .notes-window,
                .scp-card,
                .ai-panel-window,
                #notesManagerContainer .notes-window,
                #scpManagerContainer .scp-card,
                #chatManagerContainer .chat-panel-window,
                #aiManagerContainer .ai-panel-window{
                    gap: 8px;
                    border: none;
                    border-radius: 0;
                    box-shadow: none;
                    background: transparent;
                    background-color: transparent;
                    backdrop-filter: none;
                    -webkit-backdrop-filter: none;
                    overflow: visible !important;
                    box-sizing: border-box;
                }
                html.has-cursor-glow .notes-window,
                html.has-cursor-glow .scp-card,
                html.has-cursor-glow .ai-panel-window,
                html.has-cursor-glow #notesManagerContainer .notes-window,
                html.has-cursor-glow #scpManagerContainer .scp-card,
                html.has-cursor-glow #aiManagerContainer .ai-panel-window{
                    background: transparent !important;
                    background-color: transparent !important;
                    border: none !important;
                    box-shadow: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                }
                .notes-window > .panel-window-head,
                .scp-card > .panel-window-head,
                .ai-panel-window > .panel-window-head,
                #notesManagerContainer .notes-window > .panel-window-head,
                #scpManagerContainer .scp-card > .panel-window-head,
                #aiManagerContainer .ai-panel-window > .panel-window-head,
                html.has-cursor-glow .notes-window > .panel-window-head,
                html.has-cursor-glow .scp-card > .panel-window-head,
                html.has-cursor-glow .ai-panel-window > .panel-window-head {
                    position: sticky !important;
                    top: var(--header-offset, 72px) !important;
                    z-index: 90 !important;
                    flex: 0 0 auto;
                    border: 1px solid var(--glass-border);
                    border-radius: var(--radius-header);
                    margin: 0;
                    width: auto;
                    align-self: stretch;
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    box-shadow: var(--glass-shadow);
                }
                .notes-window > .panel-window-head::after,
                .scp-card > .panel-window-head::after,
                .ai-panel-window > .panel-window-head::after{
                    content: "";
                    position: absolute;
                    left: 10px;
                    right: 10px;
                    top: 100%;
                    height: 16px;
                    pointer-events: none;
                    background: linear-gradient(
                        180deg,
                        rgba(22, 22, 22, 0.42) 0%,
                        rgba(22, 22, 22, 0) 100%
                    );
                    opacity: 0.85;
                }
                #aiManagerContainer .ai-panel-window > .panel-window-head::after{
                    content: none !important;
                    display: none !important;
                }
                html.has-cursor-glow .notes-window > .panel-window-head,
                html.has-cursor-glow .scp-card > .panel-window-head,
                html.has-cursor-glow .ai-panel-window > .panel-window-head{
                    background: var(--glass-highlight) !important;
                    background-color: var(--glass-bg) !important;
                    backdrop-filter: var(--glass-blur) !important;
                    -webkit-backdrop-filter: var(--glass-blur) !important;
                    border: 1px solid var(--glass-border) !important;
                    box-shadow: var(--glass-shadow) !important;
                }
                
                .notes-panel-body,
                .scp-body,
                .ai-panel-body {
                    flex: 1 0 auto;
                    min-height: 0;
                    padding: 0;
                    background: transparent;
                    overflow: visible !important;
                }
                

                

                
                
                
                
                
                
                
            }

            /* Gemini AI chat panel — container scrolls on PC; log scrolls on mobile */
            #aiManagerContainer {
                --ai-column-width: 840px;
                background-color: var(--bg-color);
                background-image: var(--page-glow);
                width: 100%;
                height: 100%;
                min-height: 0;
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: flex-start;
                overflow-x: hidden;
                overflow-y: auto;
                box-sizing: border-box;
                padding: 8px;
                padding-top: 8px;
                flex: 1 1 0;
                position: relative;
                scroll-padding-top: var(--header-offset, 72px);
            }
            .ai-panel-window.ai-panel-window {
                display: flex;
                flex-direction: column;
                /* Same column as the composer bar — cards must not spill past it. */
                width: min(100%, var(--ai-column-width, 840px));
                max-width: var(--ai-column-width, 840px);
                margin: 0 auto;
                margin-top: calc(var(--header-offset, 72px) - 8px);
                flex: 0 0 auto !important;
                min-height: 0 !important;
                height: auto !important;
                max-height: none !important;
                overflow: visible !important;
                gap: 8px !important;
                align-self: center;
                border: none !important;
                box-shadow: none !important;
                background: transparent !important;
                box-sizing: border-box;
            }
            .ai-panel-window > .panel-window-head {
                position: sticky;
                top: var(--header-offset, 72px);
                z-index: 90;
                flex: 0 0 auto;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                box-shadow: var(--glass-shadow);
            }
            .ai-panel-body {
                display: flex;
                flex-direction: column;
                gap: 8px;
                flex: 1 0 auto;
                min-height: 0;
                overflow: visible;
                padding: 0;
                position: relative;
                background: transparent;
                border: none;
                border-radius: 0;
                box-shadow: none;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
            .ai-panel-body-denied {
                justify-content: center;
                align-items: center;
                padding: 24px 16px;
            }
            .ai-denied-stub {
                width: 100%;
                display: flex;
                justify-content: center;
                align-items: center;
                flex: 1 1 auto;
                min-height: 0;
            }
            .ai-denied-box {
                text-align: center;
                max-width: 380px;
            }
            .ai-denied-title {
                color: #e88b8b;
                font-size: 14px;
                font-weight: 600;
                margin-bottom: 8px;
                text-transform: uppercase;
                letter-spacing: 0.03em;
            }
            .ai-denied-text {
                color: #a6a6a6;
                font-size: 13px;
                line-height: 1.5;
            }
            .ai-chat-log {
                flex: 1 0 auto;
                min-height: 0;
                overflow: visible;
                border: none;
                border-radius: 0;
                background: transparent;
                padding: 4px 0 0;
                display: flex;
                flex-direction: column;
                gap: 10px;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
            }
            .ai-older-turns {
                align-self: center;
                margin: 2px 0 4px;
                padding: 9px 16px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: var(--text-muted);
                font: inherit;
                font-size: 11px;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .ai-older-turns:hover,
            .ai-older-turns:active,
            .ai-older-turns:focus-visible {
                border-color: rgba(245, 245, 244, 0.55);
                color: #dcdcda;
                outline: none;
            }
            .ai-jump-nav {
                position: fixed;
                right: 10px;
                top: 50%;
                transform: translateY(-50%);
                z-index: 55;
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 10px;
                padding: 16px 4px 16px 16px;
                box-sizing: border-box;
            }
            .ai-jump-nav[hidden] {
                display: none !important;
            }
            .ai-jump-rail {
                display: flex;
                flex-direction: column;
                align-items: center;
                justify-content: center;
                gap: 8px;
                width: 28px;
                min-height: 44px;
                padding: 8px 0;
                box-sizing: border-box;
                cursor: pointer;
            }
            .ai-jump-tick {
                display: block;
                width: 14px;
                height: 2px;
                flex: 0 0 2px;
                border-radius: 1px;
                background: rgba(232, 232, 231, 0.42);
                pointer-events: none;
            }
            .ai-jump-nav:hover .ai-jump-tick,
            .ai-jump-nav.is-open .ai-jump-tick {
                background: rgba(232, 232, 231, 0.88);
            }
            .ai-jump-search {
                display: flex;
                flex: 0 0 auto;
                margin: 0 0 6px;
                padding: 6px 10px;
                min-height: 36px;
                isolation: auto;
                background-image: none;
                background: var(--glass-inset);
                background-color: transparent;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
            }
            .ai-jump-menu {
                position: relative;
                width: min(280px, calc(100vw - 64px));
                max-height: min(56vh, 460px);
                padding: 6px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                opacity: 0;
                transform: translateX(8px) scale(0.98);
                transform-origin: center right;
                pointer-events: none;
                transition: opacity 0.16s ease, transform 0.16s ease;
                overflow: hidden;
                display: flex;
                flex-direction: column;
                box-sizing: border-box;
            }
            .ai-jump-nav.is-open .ai-jump-menu {
                opacity: 1;
                transform: translateX(0) scale(1);
                pointer-events: auto;
            }
            .ai-jump-menu[hidden] {
                display: none !important;
            }
            .ai-jump-nav.is-open .ai-jump-menu[hidden] {
                display: flex !important;
            }
            .ai-jump-list {
                display: flex;
                flex-direction: column;
                gap: 4px;
                min-height: 0;
                max-height: min(48vh, 392px);
                overflow-x: hidden;
                overflow-y: auto;
                overscroll-behavior: contain;
            }
            .ai-jump-item {
                display: flex;
                align-items: center;
                width: 100%;
                margin: 0;
                padding: 10px 12px;
                border: 1px solid transparent;
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-main);
                text-align: left;
                cursor: pointer;
                font: inherit;
                box-sizing: border-box;
                min-height: 44px;
                -webkit-tap-highlight-color: transparent;
            }
            .ai-jump-item:hover,
            .ai-jump-item:active,
            .ai-jump-item:focus-visible {
                border-color: rgba(245, 245, 244, 0.55);
                color: #dcdcda;
                outline: none;
            }
            .ai-jump-item-text {
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                overflow: hidden;
                font-size: 12px;
                line-height: 1.35;
                font-weight: 500;
                width: 100%;
            }
            @media (min-width: 601px) {
                /* Composer (~52px at bottom:8px) + ~10px gap = same as header.bottom+10. */
                #aiManagerContainer .ai-panel-window.ai-panel-window {
                    padding-bottom: 72px;
                    margin-bottom: 0 !important;
                }
                #aiManagerContainer .ai-composer {
                    position: fixed;
                    left: 50%;
                    /* Keep X+Y in one transform so empty→docked can animate smoothly. */
                    transform: translate(-50%, 0);
                    bottom: 8px;
                    /* Match chat column exactly (slightly wider than before). */
                    width: min(calc(100% - 16px), var(--ai-column-width, 840px));
                    max-width: var(--ai-column-width, 840px);
                    z-index: 50;
                    margin: 0;
                    padding: 0;
                    box-sizing: border-box;
                    transition:
                        bottom 0.55s cubic-bezier(0.22, 1, 0.36, 1),
                        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
                }
                #aiManagerContainer .ai-panel-window.is-chat-empty .ai-composer {
                    /* Center in the viewport; translateY(50%) offsets half the bar height. */
                    bottom: 50%;
                    transform: translate(-50%, 50%);
                }
                #aiManagerContainer .ai-panel-window.no-composer-anim .ai-composer {
                    transition: none;
                }
                #aiManagerContainer .ai-chat-log {
                    padding-bottom: 0;
                }
            }
            @media (min-width: 601px) and (prefers-reduced-motion: reduce) {
                #aiManagerContainer .ai-composer {
                    transition: none;
                }
            }
            .ai-msg-card {
                position: relative;
                width: 100%;
                max-width: 100%;
                flex: 0 0 auto;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
                background-image: var(--ink-stack);
                background-color: var(--ink-bg);
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                padding: 10px 12px;
                box-shadow: var(--ink-shadow);
                overflow: visible;
                display: flex;
                flex-direction: column;
                gap: 6px;
                min-height: 0;
                color: var(--text-main);
                box-sizing: border-box;
                -webkit-tap-highlight-color: transparent;
            }
            .ai-msg-card::before {
                content: none;
                display: none;
            }
            .ai-msg-card.is-entering {
                animation: aiMsgEnter 0.28s ease;
            }
            @keyframes aiMsgEnter {
                from {
                    opacity: 0;
                    transform: translateY(8px);
                }
                to {
                    opacity: 1;
                    transform: none;
                }
            }
            @media (prefers-reduced-motion: reduce) {
                .ai-msg-card.is-entering {
                    animation: none;
                }
            }
            .ai-msg-body.is-streaming::after {
                content: none;
                display: none;
            }
            .ai-msg-body.is-waiting::after {
                display: none;
            }
            .ai-typing-dots {
                display: inline-flex;
                align-items: center;
                gap: 5px;
                min-height: 1.2em;
                padding: 2px 0;
            }
            .ai-typing-dots i {
                width: 6px;
                height: 6px;
                border-radius: 50%;
                background: #dcdcda;
                opacity: 0.35;
                animation: aiTypingDot 1.05s ease-in-out infinite;
            }
            .ai-typing-dots i:nth-child(2) { animation-delay: 0.15s; }
            .ai-typing-dots i:nth-child(3) { animation-delay: 0.3s; }
            @keyframes aiTypingDot {
                0%, 80%, 100% { opacity: 0.28; transform: translateY(0); }
                40% { opacity: 1; transform: translateY(-2px); }
            }
            @media (prefers-reduced-motion: reduce) {
                .ai-typing-dots i {
                    animation: none;
                    opacity: 0.7;
                }
            }
            .ai-msg-unit {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                gap: 2px;
                width: 100%;
                max-width: 100%;
                flex: 0 0 auto;
                align-self: stretch;
                box-sizing: border-box;
            }
            .ai-msg-unit.is-user {
                align-self: flex-end;
                width: fit-content;
                max-width: min(55ch, 100%);
                align-items: flex-end;
            }
            .ai-msg-unit .ai-msg-user {
                align-self: stretch;
                width: 100%;
                max-width: 100%;
            }
            .ai-msg-user {
                align-self: flex-end;
                width: fit-content;
                /* ~55 chars/line (spaces & punctuation included); wrap beyond that. */
                max-width: min(55ch, 100%);
            }
            .ai-msg-user .ai-msg-body {
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                word-break: break-word;
            }
            /* Assistant: plain text like ChatGPT/Claude — no card chrome. */
            .ai-msg-bot {
                align-self: stretch;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                border: none;
                background: transparent;
                background-image: none;
                background-color: transparent;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                padding: 4px 2px;
                gap: 4px;
            }
            .ai-msg-bot .ai-msg-head {
                display: flex;
            }
            .ai-msg-error {
                align-self: stretch;
                width: 100%;
                max-width: 100%;
                box-sizing: border-box;
                border: none;
                background: transparent;
                background-image: none;
                background-color: transparent;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                padding: 4px 2px;
            }
            .ai-msg-error .ai-msg-head {
                margin-bottom: 2px;
            }
            /* Chrome windows that stay glass. */
            
            /* Content cards: opaque ink plate, same radius/rim as chrome. */
            
            
            
            .panel-head-menu-panel {
                position: absolute;
                top: calc(100% + 8px);
                right: 0;
                left: auto;
                background-image: none;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                border-color: var(--glass-border);
                border-radius: var(--radius-header);
                box-shadow: var(--glass-shadow);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
            }
            .panel-head-menu-panel.is-ported {
                position: fixed;
            }
            .panel-search-field {
                isolation: isolate;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
            }
            .ai-msg-error::before {
                content: none;
                display: none;
            }
            .ai-msg-head {
                display: flex;
                align-items: center;
                gap: 8px;
                margin-bottom: 0;
                flex: 0 0 auto;
                flex-wrap: wrap;
                width: 100%;
                min-width: 0;
            }
            .ai-msg-time {
                margin-left: auto;
                color: var(--text-muted);
                font-size: 10px;
                font-weight: 400;
                line-height: 1.5;
                font-variant-numeric: tabular-nums;
                letter-spacing: 0.01em;
                white-space: nowrap;
                -webkit-text-fill-color: var(--text-muted);
            }
            .ai-msg-badge {
                display: inline-flex;
                align-items: center;
                padding: 2px 8px;
                border-radius: var(--radius-btn-sm);
                border: 1px solid transparent;
                font-size: 10px;
                font-weight: 700;
                letter-spacing: 0.03em;
                text-transform: uppercase;
                background: rgba(245, 245, 244, 0.12);
                color: #dcdcda;
            }
            .ai-msg-user .ai-msg-badge {
                background: rgba(245, 245, 244, 0.12);
                color: #dcdcda;
                border-color: transparent;
            }
            .ai-msg-bot .ai-msg-badge {
                border: none;
                padding: 0;
                background: linear-gradient(
                    105deg,
                    #4285f4 0%,
                    #9b72cb 28%,
                    #d96570 55%,
                    #e6c37a 82%,
                    #34a853 100%
                );
                -webkit-background-clip: text;
                background-clip: text;
                color: transparent;
                -webkit-text-fill-color: transparent;
                text-transform: none;
                letter-spacing: 0.02em;
                font-size: 12px;
                font-weight: 700;
            }
            .ai-msg-error .ai-msg-badge {
                background: rgba(232, 139, 139, 0.14);
                color: #e88b8b;
                border-color: transparent;
                -webkit-text-fill-color: #e88b8b;
            }
            .ai-msg-files {
                display: flex;
                flex-wrap: wrap;
                gap: 6px;
                margin: 0 0 8px;
            }
            .ai-file-chip {
                display: inline-flex;
                align-items: center;
                max-width: 100%;
                padding: 4px 8px;
                border-radius: var(--radius-btn-sm);
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #e8e8e7;
                font-size: 11px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                cursor: pointer;
                font-family: inherit;
            }
            .ai-file-chip:hover, .ai-file-chip:focus-visible { border-color: var(--accent-color); color: #fff; }
            .ai-file-chip:disabled { cursor: default; opacity: 0.7; }
            .ai-msg-gallery {
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                gap: 4px;
                margin: 0 0 4px;
            }
            .ai-msg-thumb-wrap {
                display: block;
                border-radius: 8px;
                overflow: hidden;
                max-width: min(220px, 68vw);
                cursor: pointer;
                background: #252525;
                -webkit-tap-highlight-color: transparent;
            }
            .ai-msg-thumb {
                display: block;
                width: 100%;
                height: auto;
                max-height: 220px;
                object-fit: cover;
                pointer-events: none;
                border: 0;
                box-shadow: none;
                background: #252525;
            }
            .ai-msg-body {
                color: #f4f4f3;
                font-size: 16px;
                line-height: 1.6;
                white-space: pre-wrap;
                word-break: break-word;
                overflow: visible;
                max-height: none;
            }
            .ai-msg-body.ai-msg-md {
                white-space: normal;
            }
            .notes-md-body {
                white-space: normal;
            }
            :is(.ai-msg-md, .notes-md) > :first-child {
                margin-top: 0;
            }
            :is(.ai-msg-md, .notes-md) > :last-child {
                margin-bottom: 0;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-p {
                margin: 0 0 0.75em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-p:last-child {
                margin-bottom: 0;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-h {
                margin: 1em 0 0.45em;
                color: #fafaf9;
                font-weight: 650;
                line-height: 1.3;
                letter-spacing: 0.01em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-h1 { font-size: 1.28em; }
            :is(.ai-msg-md, .notes-md) .ai-md-h2 { font-size: 1.16em; }
            :is(.ai-msg-md, .notes-md) .ai-md-h3 { font-size: 1.06em; color: #e8e8e7; }
            :is(.ai-msg-md, .notes-md) .ai-md-h4 { font-size: 1em; color: #d6d6d5; }
            :is(.ai-msg-md, .notes-md) .ai-md-ul,
            :is(.ai-msg-md, .notes-md) .ai-md-ol {
                margin: 0.35em 0 0.85em;
                padding-left: 1.35em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-ul { list-style: disc; }
            :is(.ai-msg-md, .notes-md) .ai-md-ol { list-style: decimal; }
            :is(.ai-msg-md, .notes-md) li {
                margin: 0.28em 0;
                padding-left: 0.15em;
            }
            :is(.ai-msg-md, .notes-md) li::marker {
                color: #dcdcda;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-steps {
                margin: 0.55em 0 1em;
                padding-left: 1.45em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-steps > li {
                margin: 0.55em 0 0.85em;
                padding-left: 0.35em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-li-head {
                margin: 0 0 0.45em;
                line-height: 1.5;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-li-p {
                margin: 0.35em 0 0.45em;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-steps .ai-md-pre {
                margin: 0.4em 0 0.35em;
            }
            :is(.ai-msg-md, .notes-md) strong {
                color: #fff;
                font-weight: 700;
            }
            :is(.ai-msg-md, .notes-md) em {
                color: #e8e8e7;
                font-style: italic;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-inline {
                font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
                font-size: 0.92em;
                color: #e8e8e6;
                background: rgba(28, 28, 28, 0.55);
                border: 1px solid rgba(166, 166, 166, 0.22);
                border-radius: 5px;
                padding: 0.08em 0.35em;
                /* Inline fragments may wrap: a backdrop layer blurs adjacent lines on Android. */
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                box-decoration-break: clone;
                -webkit-box-decoration-break: clone;
                overflow-wrap: anywhere;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre {
                margin: 0.55em 0 0.9em;
                padding: 0;
                overflow: hidden;
                max-width: 100%;
                min-width: 0;
                border-radius: var(--radius-btn-sm, 8px);
                border: 1px solid rgba(166, 166, 166, 0.22);
                background: rgba(15, 15, 15, 0.72);
                box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
                display: flex;
                flex-direction: column;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-bar {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
                padding: 6px 8px 6px 12px;
                border-bottom: 1px solid rgba(166, 166, 166, 0.16);
                background: rgba(255, 255, 255, 0.03);
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-lang {
                font-size: 11px;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                color: #a6a6a6;
                min-width: 0;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-copy {
                flex: 0 0 auto;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                gap: 4px;
                min-height: 28px;
                padding: 0 8px;
                border: none;
                border-radius: 8px;
                background: transparent;
                color: #a6a6a6;
                cursor: pointer;
                font-size: 11px;
                font-weight: 600;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-copy svg {
                width: 14px;
                height: 14px;
                display: block;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-copy:hover,
            :is(.ai-msg-md, .notes-md) .ai-md-pre-copy:focus-visible {
                background: rgba(255, 255, 255, 0.08);
                color: #e8e8e7;
                outline: none;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre-copy.is-copied {
                color: #ace2c4;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre .ai-md-code {
                display: block;
                padding: 12px;
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                color: #e8e8e7;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre .ai-md-code-raw {
                display: none !important;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-code-body {
                margin: 0;
                padding: 0;
                /* Fit the chat column: wrap instead of nested horizontal scroll. */
                overflow-x: hidden;
                max-width: 100%;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-code-line {
                display: flex;
                align-items: flex-start;
                font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
                font-size: 12px;
                line-height: 1.5;
                min-height: 1.5em;
                max-width: 100%;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-line-num {
                flex: 0 0 var(--ai-code-gutter, 3.5ch);
                width: var(--ai-code-gutter, 3.5ch);
                min-width: var(--ai-code-gutter, 3.5ch);
                max-width: var(--ai-code-gutter, 3.5ch);
                padding: 0 6px;
                text-align: right;
                user-select: none;
                color: #767676;
                background: rgba(255, 255, 255, 0.025);
                box-sizing: border-box;
                white-space: pre;
                font-variant-numeric: tabular-nums;
                overflow: hidden;
                line-height: 1.5;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text {
                flex: 1 1 auto;
                min-width: 0;
                max-width: 100%;
                padding: 0 10px 0 8px;
                color: #e9e9e8;
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                word-break: break-word;
                hyphens: none;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-kw { color: #dcdcda; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-cmd { color: #d4d4d2; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-no { color: #e88b8b; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-str { color: #7fd1a8; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-cmt { color: #767676; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-num { color: #e6c37a; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-fn { color: #b0b0b0; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-dec { color: #d9d9d8; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-text .tok-op { color: #a6a6a6; }
            :is(.ai-msg-md, .notes-md) .ai-md-line-num,
            :is(.ai-msg-md, .notes-md) .ai-md-line-text,
            :is(.ai-msg-md, .notes-md) .ai-md-line-text span {
                font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
                font-size: inherit;
                font-style: normal;
                font-weight: 400;
                line-height: inherit;
                vertical-align: baseline;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-pre,
            :is(.ai-msg-md, .notes-md) .ai-md-code-body,
            :is(.ai-msg-md, .notes-md) .ai-md-code-line {
                box-sizing: border-box;
            }
            .ai-msg-actions {
                display: flex;
                align-items: center;
                gap: 4px;
                margin: 0;
                padding: 0 2px;
                background: transparent;
                border: none;
                box-shadow: none;
            }
            .ai-msg-unit.is-user > .ai-msg-actions,
            .ai-msg-user .ai-msg-actions {
                justify-content: flex-end;
            }
            .ai-msg-action {
                position: relative;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 32px;
                height: 32px;
                border: none;
                border-radius: 9px;
                background: transparent;
                color: rgba(166, 166, 166, 0.72);
                cursor: pointer;
                padding: 0;
            }
            .ai-msg-action svg {
                width: 16px;
                height: 16px;
                display: block;
            }
            .ai-msg-action:hover,
            .ai-msg-action:focus-visible,
            .ai-msg-action.is-open {
                background: rgba(255, 255, 255, 0.08);
                color: #e8e8e7;
                outline: none;
            }
            .ai-msg-action.is-copied {
                color: #ace2c4;
            }
            .ai-msg-action:disabled { opacity: 0.5; cursor: wait; }
            .ai-document-artifact { display: flex; align-items: stretch; gap: 8px; width: min(100%, 520px); max-width: 100%; margin: 8px 0 2px; }
            .ai-document-artifact-open, .ai-document-artifact-download { min-height: 60px; border: 1px solid var(--border-color); border-radius: var(--radius-btn); font: inherit; color: var(--text-main); cursor: pointer; transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
            .ai-document-artifact-open { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 9px 12px; text-align: left; background: #252525; }
            .ai-document-artifact-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid rgba(245, 245, 244,0.5); border-radius: 8px; color: #dcdcda; font-size: 18px; font-weight: 700; }
            .ai-document-artifact-copy { display: flex; flex-direction: column; min-width: 0; gap: 3px; }
            .ai-document-artifact-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
            .ai-document-artifact-copy small { color: var(--text-muted); font-size: 11px; }
            .ai-document-artifact-arrow { margin-left: auto; color: var(--text-muted); }
            .ai-document-artifact-download { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 0 14px; background: var(--glass-inset); font-size: 12px; font-weight: 600; }
            .ai-document-artifact-download svg { width: 17px; height: 17px; }
            .ai-document-artifact-open:hover, .ai-document-artifact-open:focus-visible, .ai-document-artifact-download:hover, .ai-document-artifact-download:focus-visible { transform: translateY(-3px); border-color: var(--accent-color); box-shadow: none !important; outline: none; }
            .ai-document-artifact-download:disabled { cursor: wait; opacity: 0.6; transform: none; }
            .ai-msg-regen-wrap {
                position: relative;
            }
            .ai-regen-menu {
                position: absolute;
                left: 0;
                bottom: calc(100% + 8px);
                width: min(240px, calc(100vw - 32px));
                padding: 6px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                z-index: 85;
                opacity: 0;
                transform: translateY(6px) scale(0.98);
                transform-origin: bottom left;
                pointer-events: none;
                transition: opacity 0.16s ease, transform 0.16s ease;
                overflow: hidden;
            }
            .ai-regen-menu.is-open {
                opacity: 1;
                transform: translateY(0) scale(1);
                pointer-events: auto;
            }
            .ai-msg-md .ai-md-hr {
                border: none;
                border-top: 1px solid rgba(166, 166, 166, 0.28);
                margin: 1em 0;
            }
            :is(.ai-msg-md, .notes-md) .ai-md-quote {
                margin: 0.45em 0 0.85em;
                padding: 0.45em 0.75em;
                border-left: 3px solid rgba(245, 245, 244, 0.65);
                color: #d6d6d5;
                background: rgba(245, 245, 244, 0.08);
                border-radius: 0 8px 8px 0;
            }
            .ai-msg-error .ai-msg-body {
                color: #f5cece;
            }
            .ai-composer {
                display: flex;
                flex-direction: column;
                gap: 8px;
                flex: 0 0 auto;
                position: relative;
                z-index: 2;
                margin-top: 0;
                padding-top: 0;
                padding-bottom: 0;
                background: transparent;
            }
            .ai-composer-dock,
            .ai-attach-list,
            .ai-status-line {
                position: relative;
                z-index: 2;
            }
            .ai-dusk,
            .ai-dusk-above,
            .ai-dusk-below,
            #aiManagerContainer .ai-dusk-top {
                display: none !important;
            }
            .ai-dusk {
                pointer-events: none;
                position: absolute;
                z-index: 0;
            }
            .ai-composer-dock > .ai-composer-bar {
                position: relative;
                z-index: 1;
            }
            .ai-dusk-above {
                left: -2px;
                right: -2px;
                bottom: calc(100% - 14px);
                height: 48px;
                background: linear-gradient(
                    to bottom,
                    rgba(40, 40, 40, 0) 0%,
                    rgba(40, 40, 40, 0.38) 28%,
                    rgba(40, 40, 40, 0.72) 62%,
                    rgba(40, 40, 40, 0.92) 100%
                );
            }
            .ai-dusk-below {
                left: -2px;
                right: -2px;
                top: calc(100% - 14px);
                height: calc(var(--footer-offset, 0px) + 32px);
                background: linear-gradient(
                    to bottom,
                    rgba(40, 40, 40, 0.92) 0%,
                    rgba(40, 40, 40, 0.72) 28%,
                    rgba(40, 40, 40, 0.38) 62%,
                    rgba(40, 40, 40, 0) 100%
                );
            }
            /* Same layering as the composer dusk: fixed overlay ABOVE scrolling text. */
            #aiManagerContainer .ai-dusk-top {
                position: fixed;
                left: 0;
                right: 0;
                /* header-offset = header.bottom + 10; overlap 14px into the header. */
                top: calc(var(--header-offset, 72px) - 24px);
                z-index: 51;
                height: 48px;
                margin: 0;
                background: linear-gradient(
                    to bottom,
                    rgba(40, 40, 40, 0.92) 0%,
                    rgba(40, 40, 40, 0.72) 38%,
                    rgba(40, 40, 40, 0.38) 72%,
                    rgba(40, 40, 40, 0) 100%
                );
            }
            .ai-panel-window.is-chat-empty .ai-dusk {
                display: none !important;
            }
            .ai-attach-list[hidden] {
                display: none !important;
            }
            .ai-composer.is-drop .ai-composer-bar {
                border-color: rgba(245, 245, 244, 0.65);
                box-shadow:
                    var(--glass-shadow),
                    0 0 0 1px rgba(245, 245, 244, 0.25);
            }
            .ai-attach-list {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
            }
            .ai-attach-chip {
                display: inline-flex;
                align-items: center;
                gap: 8px;
                max-width: 100%;
                padding: 6px 8px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #e8e8e7;
                font-size: 12px;
            }
            .ai-attach-chip img,
            .ai-attach-chip video {
                width: 28px;
                height: 28px;
                object-fit: cover;
                border-radius: 8px;
                border: 1px solid var(--glass-border);
                background: rgba(40, 40, 40, 0.55);
            }
            .ai-attach-chip span {
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                max-width: 160px;
            }
            .ai-attach-name {
                max-width: 160px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                border: 0;
                background: transparent;
                color: inherit;
                font: inherit;
                cursor: pointer;
            }
            .ai-document-preview {
                position: fixed;
                inset: 0;
                z-index: 20000;
                display: flex;
                flex-direction: column;
                background: #0a0a0a;
                color: #f4f4f3;
            }
            .ai-document-bar {
                flex: 0 0 auto;
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 12px;
                padding: max(10px, var(--bp-safe-top, env(safe-area-inset-top))) 16px 10px;
                border-bottom: 1px solid var(--glass-border);
                background: var(--glass-chrome-bg);
                backdrop-filter: var(--glass-blur);
            }
            .ai-document-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
            .ai-document-bar a { margin-left: auto; color: var(--accent-color); white-space: nowrap; }
            .ai-document-bar button {
                min-height: 44px;
                padding: 0 16px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
                background: var(--glass-bg);
                color: inherit;
                cursor: pointer;
            }
            .ai-document-content { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px; }
            .ai-document-content pre {
                margin: 0;
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
                user-select: text;
            }
            .ai-document-content iframe { width: 100%; height: 100%; border: 0; background: #fff; }
            .ai-document-content:has(iframe) { padding: 0; }
            .ai-document-content a { display: inline-block; margin: 16px 0; color: var(--accent-color); }
            .ai-document-preview {
                padding: 18px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-window);
                overflow: hidden;
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                box-sizing: border-box;
            }
            .ai-document-window { display: contents; }
            .ai-document-window > .glass-accent { z-index: 2; }
            .ai-document-bar {
                min-height: 44px;
                padding: 0 0 10px;
                margin-bottom: 12px;
                background: transparent;
                backdrop-filter: none;
            }
            .ai-document-bar strong { font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
            .ai-document-bar .ai-document-close {
                flex: 0 0 44px;
                width: 44px;
                min-height: 44px;
                padding: 0;
                border: 0;
                background: transparent;
                color: #a6a6a6;
                font-size: 24px;
                line-height: 1;
            }
            .ai-document-bar .ai-document-close:hover { background: rgba(255,255,255,0.06); color: #fff; }
            .ai-document-content {
                padding: 8px 0;
                border: 0;
                border-radius: 0;
                background: transparent;
                overscroll-behavior: contain;
            }
            .ai-document-content pre { font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
            .ai-document-page { width: 100%; max-width: none; margin: 0; padding: 0; box-sizing: border-box; border: 0; background: transparent; color: #f4f4f3; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
            .ai-docx-image { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; margin: 12px auto; object-fit: contain; }
            .ai-pptx-preview { display: grid; gap: 16px; width: 100%; margin: 0; padding: 0; box-sizing: border-box; }
            .ai-pptx-slide { position: relative; aspect-ratio: 16 / 9; min-width: 0; padding: 0; box-sizing: border-box; border: 1px solid rgba(245, 245, 244,0.45); border-radius: 12px; background: #252525; color: #d6d6d5; overflow: hidden; overflow: clip; }
            .ai-pptx-canvas { --slide-font-factor: 1; --slide-scale: 1; position: absolute; inset: 0 auto auto 0; display: flex; flex-direction: column; gap: 20px; width: 1280px; height: 720px; padding: 64px 80px; box-sizing: border-box; transform: scale(var(--slide-scale)); transform-origin: top left; }
            .ai-pptx-canvas > small { flex: 0 0 auto; color: #d4d4d2; font-size: 14px; font-weight: 700; letter-spacing: 0.12em; }
            .ai-pptx-canvas > h2 { flex: 0 0 auto; margin: 0; color: #fafaf9; font-size: calc(44px * var(--slide-font-factor)); line-height: 1.15; overflow-wrap: anywhere; }
            .ai-pptx-slide.is-cover .ai-pptx-canvas { padding-top: 144px; }
            .ai-pptx-slide.is-cover h2 { font-size: calc(58px * var(--slide-font-factor)); }
            .ai-pptx-subtitle { flex: 0 0 auto; color: #a6a6a6; font-size: calc(28px * var(--slide-font-factor)); margin: 0; line-height: 1.2; overflow-wrap: anywhere; }
            .ai-pptx-slide.is-columns ul { columns: 2; column-gap: 64px; column-fill: balance; height: 100%; }
            .ai-pptx-slide.is-columns li { break-inside: avoid; }
            .ai-pptx-slide.has-code .ai-pptx-slide-content, .ai-pptx-slide.has-table.has-points .ai-pptx-slide-content { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 48px; align-items: start; }
            .ai-pptx-slide.has-code pre { min-width: 0; min-height: 0; max-height: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: Consolas, monospace; font-size: calc(26px * var(--slide-font-factor)); line-height: 1.25; }
            .ai-pptx-slide.has-code pre:only-child { grid-column: 1 / -1; }
            .ai-pptx-slide.has-code.is-stacked .ai-pptx-slide-content { display: flex; flex-direction: column; gap: 24px; }
            .ai-pptx-slide.has-code.is-stacked pre { flex: 0 0 auto; max-height: 40%; width: 100%; }
            .ai-pptx-slide.has-code.is-stacked ul { flex: 1 1 auto; }
            .ai-pptx-slide-content { flex: 1 1 auto; display: flex; flex-direction: column; gap: 24px; min-height: 0; min-width: 0; }
            .ai-pptx-slide.has-image.has-points .ai-pptx-slide-content { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); gap: 48px; align-items: start; }
            .ai-pptx-slide.has-image.has-points figure { grid-column: 2; grid-row: 1; }
            .ai-pptx-slide.has-image.has-points ul { grid-column: 1; grid-row: 1; }
            .ai-pptx-slide figure { height: 100%; min-height: 0; margin: 0; text-align: center; }
            .ai-pptx-slide figure img { display: block; width: 100%; height: calc(100% - 40px); object-fit: contain; border-radius: 6px; }
            .ai-pptx-slide figcaption { margin-top: 8px; color: #a6a6a6; font-size: calc(20px * var(--slide-font-factor)); }
            .ai-pptx-slide table { width: 100%; min-width: 0; border-collapse: collapse; table-layout: fixed; color: #d6d6d5; font-size: calc(24px * var(--slide-font-factor)); }
            .ai-pptx-slide th, .ai-pptx-slide td { padding: 0.55em 0.7em; border: 1px solid #444444; text-align: left; overflow-wrap: anywhere; }
            .ai-pptx-slide th { background: #3f3f3f; color: #fafaf9; }
            .ai-pptx-slide td { background: #1d1d1d; }
            .ai-pptx-diagram { flex: 0 0 auto; display: block; width: 100%; max-height: 50%; height: auto; margin: 0; }
            .ai-pptx-diagram-node { flex: 1 1 0; min-width: 0; padding: 0.9em 0.6em; border: 1px solid #f5f5f4; border-radius: 10px; background: #282828; color: #fafaf9; font-size: clamp(11px, 1.5vw, 18px); text-align: center; overflow-wrap: anywhere; }
            .ai-pptx-diagram-arrow { color: #d4d4d2; font-size: clamp(14px, 2.2vw, 24px); }
            .ai-pptx-slide ul { min-width: 0; min-height: 0; max-height: 100%; margin: 0; padding-left: 1.25em; font-size: calc(28px * var(--slide-font-factor)); line-height: 1.25; overflow-wrap: anywhere; }
            .ai-pptx-slide li + li { margin-top: 0.35em; }
            .ai-document-actions { display: flex; gap: 8px; margin-top: 12px; flex: 0 0 auto; }
            .ai-document-actions:empty { display: none; }
            .ai-document-actions .ai-document-action {
                display: flex;
                align-items: center;
                justify-content: center;
                flex: 1 1 0;
                min-height: 36px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-main);
                font-size: 11px;
                font-weight: 600;
                letter-spacing: 0.03em;
                text-transform: uppercase;
                text-decoration: none;
            }
            .ai-document-actions .ai-document-action:hover { border-color: var(--accent-color); color: #dcdcda; }
            .ai-docx-paragraph { margin: 0 0 0.85em; white-space: pre-wrap; }
            .ai-docx-paragraph:empty { min-height: 1em; }
            .ai-docx-paragraph.is-list { padding-left: 1.4em; position: relative; }
            .ai-docx-paragraph.is-list::before { content: '•'; position: absolute; left: 0.3em; color: #dcdcda; }
            .ai-docx-page h1, .ai-docx-page h2, .ai-docx-page h3, .ai-docx-page h4, .ai-docx-page h5, .ai-docx-page h6 { margin: 1em 0 0.45em; line-height: 1.3; }
            .ai-docx-page h1 { font-size: 1.7em; } .ai-docx-page h2 { font-size: 1.45em; } .ai-docx-page h3 { font-size: 1.2em; }
            .ai-document-table-scroll, .ai-md-table-scroll { max-width: 100%; overflow-x: auto; margin: 12px 0 18px; border: 1px solid var(--border-color); border-radius: 10px; }
            .ai-document-table, .ai-md-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.92em; white-space: normal; }
            .ai-document-table td, .ai-document-table th, .ai-md-table td, .ai-md-table th { min-width: 80px; padding: 10px 12px; border-right: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); vertical-align: top; overflow-wrap: anywhere; }
            .ai-document-table tr:last-child td, .ai-md-table tr:last-child td { border-bottom: 0; }
            .ai-document-table td:last-child, .ai-md-table td:last-child, .ai-md-table th:last-child { border-right: 0; }
            .ai-document-table th, .ai-md-table th { background: #212121; font-weight: 650; color: #f0f0ee; }
            .ai-document-table tr:nth-child(even) td, .ai-md-table tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
            .ai-document-table .ai-docx-paragraph { margin: 0 0 0.35em; }
            @media (max-width: 900px) {
                .ai-document-preview {
                    inset: 0;
                    width: 100%;
                    height: 100%;
                    padding: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px)))
                             max(4px, var(--bp-safe-right, env(safe-area-inset-right, 0px)))
                             max(4px, var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)))
                             max(4px, var(--bp-safe-left, env(safe-area-inset-left, 0px)));
                    border: 0;
                    border-radius: 0;
                    background: transparent;
                    backdrop-filter: none;
                    -webkit-backdrop-filter: none;
                    box-shadow: none;
                }
                .ai-document-artifact { gap: 6px; }
                .ai-document-artifact-download { padding: 0 10px; }
            }
            @media (min-width: 901px) {
                #aiManagerContainer { transition: width 0.42s cubic-bezier(0.22, 1, 0.36, 1); }
                #aiManagerContainer .ai-composer {
                    transition: left 0.42s cubic-bezier(0.22, 1, 0.36, 1), width 0.42s cubic-bezier(0.22, 1, 0.36, 1), bottom 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
                }
                body.ai-document-split { --ai-preview-width: clamp(420px, 44vw, 850px); }
                body.ai-document-split #aiManagerContainer {
                    left: 0 !important;
                    right: auto !important;
                    width: calc(100vw - var(--ai-preview-width) - 24px) !important;
                    max-width: calc(100vw - var(--ai-preview-width) - 24px) !important;
                }
                body.ai-document-split #aiManagerContainer .ai-panel-window.ai-panel-window {
                    width: min(100%, 840px) !important;
                    max-width: min(100%, 840px) !important;
                }
                body.ai-document-split #aiManagerContainer .ai-composer {
                    left: calc((100vw - var(--ai-preview-width) - 24px) / 2) !important;
                    width: min(calc(100vw - var(--ai-preview-width) - 40px), var(--ai-column-width, 840px)) !important;
                }
                body.ai-document-split #aiManagerContainer .ai-jump-nav { right: calc(var(--ai-preview-width) + 24px); }
                .ai-document-preview.is-side-panel {
                    --ai-preview-width: clamp(420px, 44vw, 850px);
                    inset: calc(var(--header-offset, 72px) + 8px) 12px 12px auto;
                    width: var(--ai-preview-width);
                    height: auto;
                    transform: translateX(100%);
                    transition: transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
                }
                .ai-document-preview.is-side-panel.is-open { transform: translateX(0); }
            }
            @media (prefers-reduced-motion: reduce) {
                body.ai-document-split #aiManagerContainer,
                body.ai-document-split #aiManagerContainer .ai-composer,
                .ai-document-preview.is-side-panel { transition: none !important; }
            }
            .ai-attach-remove {
                border: none;
                background: transparent;
                color: #a6a6a6;
                font-size: 16px;
                line-height: 1;
                cursor: pointer;
                padding: 0 2px;
            }
            .ai-attach-remove:hover {
                color: #e88b8b;
            }
            .ai-composer-dock {
                position: relative;
                z-index: 2;
            }
            .ai-model-menu {
                position: absolute;
                right: 44px;
                bottom: calc(100% + 10px);
                width: min(280px, calc(100vw - 24px));
                padding: 6px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                /* Same glass material as .ai-composer-bar */
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                z-index: 80;
                opacity: 0;
                transform: translateY(6px) scale(0.98);
                transform-origin: bottom right;
                pointer-events: none;
                transition: opacity 0.16s ease, transform 0.16s ease;
                overflow: visible;
                display: flex;
                flex-direction: column;
                box-sizing: border-box;
            }
            .ai-model-menu.is-open,
            .ai-attach-menu.is-open {
                opacity: 1;
                transform: translateY(0) scale(1);
                pointer-events: auto;
            }
            .ai-attach-menu {
                position: absolute;
                left: 0;
                bottom: calc(100% + 10px);
                width: min(280px, calc(100vw - 24px));
                padding: 6px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                z-index: 80;
                opacity: 0;
                transform: translateY(6px) scale(0.98);
                transform-origin: bottom left;
                pointer-events: none;
                transition: opacity 0.16s ease, transform 0.16s ease;
                display: flex;
                flex-direction: column;
                gap: 4px;
            }
            .ai-attach-option {
                display: flex;
                flex-direction: row;
                align-items: center;
                gap: 12px;
                width: 100%;
                margin: 0;
                padding: 10px 12px;
                border: 1px solid transparent;
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-main);
                text-align: left;
                cursor: pointer;
                font: inherit;
                -webkit-tap-highlight-color: transparent;
            }
            .ai-attach-option-icon {
                flex: 0 0 36px;
                width: 36px;
                height: 36px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 10px;
                background: rgba(245, 245, 244, 0.16);
                color: #dcdcda;
            }
            .ai-attach-option-icon svg {
                width: 18px;
                height: 18px;
                display: block;
            }
            .ai-attach-option-body {
                min-width: 0;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                gap: 2px;
            }
            .ai-attach-option-label {
                font-size: 12px;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
            }
            .ai-attach-option-hint {
                font-size: 11px;
                color: var(--text-muted);
                letter-spacing: 0;
                text-transform: none;
                font-weight: 400;
            }
            .ai-attach-option:hover,
            .ai-attach-option:active,
            .ai-attach-option:focus-visible {
                border-color: rgba(245, 245, 244, 0.55);
                color: #dcdcda;
                outline: none;
            }
            .ai-composer-icon-btn.is-open {
                color: #dcdcda;
                background: rgba(245, 245, 244, 0.18);
            }
            .ai-model-list {
                display: flex;
                flex-direction: column;
                gap: 4px;
                /* Match attachment tiles: keep their shared blue halo intact. */
                overflow: visible;
                min-height: 0;
            }
            .ai-model-menu-sep {
                height: 1px;
                flex: 0 0 1px;
                margin: 2px 4px;
                background: rgba(255, 255, 255, 0.1);
            }
            .ai-model-option {
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                justify-content: center;
                gap: 2px;
                width: 100%;
                margin: 0;
                padding: 10px 12px;
                border: 1px solid transparent;
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                color: var(--text-main);
                text-align: left;
                cursor: pointer;
                font: inherit;
                box-sizing: border-box;
                min-height: 52px;
                -webkit-tap-highlight-color: transparent;
                position: relative;
                z-index: 1;
            }
            .ai-model-option:hover,
            .ai-model-option:active,
            .ai-model-option:focus-visible,
            .ai-model-option.is-active {
                border-color: rgba(245, 245, 244, 0.55);
                color: #dcdcda;
                outline: none;
            }
            .ai-model-option.is-exhausted {
                opacity: 0.72;
            }
            /* Retain the shared selector press feedback while the model menu closes. */
            html body .ai-model-option.is-pressed:not(:disabled),
            html body .ai-model-chip.is-pressed:not(:disabled) {
                scale: 0.96;
                border-color: var(--accent-color) !important;
                color: #d4d4d2 !important;
                background-color: rgba(245, 245, 244, 0.22) !important;
                box-shadow: 0 0 0 1px #f5f5f4 !important;
            }
            .ai-model-option-mark,
            .ai-model-option-check {
                display: none;
            }
            .ai-model-option-body {
                min-width: 0;
                width: 100%;
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                gap: 2px;
            }
            .ai-model-option-name {
                font-size: 12px;
                font-weight: 600;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                line-height: 1.25;
                color: inherit;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .ai-model-option-meta {
                font-size: 11px;
                line-height: 1.3;
                color: var(--text-muted);
                letter-spacing: 0;
                text-transform: none;
                font-weight: 400;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                max-width: 100%;
            }
            .ai-model-option.is-exhausted .ai-model-option-meta {
                color: var(--text-muted);
            }
            /* Model picker uses the same icon tiles and spacing as attachments. */
            #aiModelMenu .ai-model-option {
                flex-direction: row;
                align-items: center;
                justify-content: flex-start;
                flex: 0 0 auto;
                gap: 12px;
                min-height: 58px;
            }
            #aiModelMenu .ai-model-option-icon {
                flex: 0 0 36px;
                width: 36px;
                height: 36px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 10px;
                background: rgba(245, 245, 244, 0.16);
                color: #dcdcda;
            }
            #aiModelMenu .ai-model-option-icon svg {
                width: 18px;
                height: 18px;
                display: block;
            }
            #aiModelMenu .ai-model-option-body {
                flex: 1 1 auto;
                width: auto;
            }
            #aiModelMenu .ai-model-option-name,
            #aiModelMenu .ai-model-option-meta {
                white-space: normal;
                overflow: visible;
                text-overflow: clip;
                overflow-wrap: anywhere;
            }
            #aiModelMenu.is-compact .ai-model-list { gap: 2px; }
            #aiModelMenu.is-compact .ai-model-option {
                min-height: 44px;
                padding: 6px 10px;
                gap: 10px;
            }
            #aiModelMenu.is-compact .ai-model-option-icon {
                flex-basis: 30px;
                width: 30px;
                height: 30px;
                border-radius: 8px;
            }
            #aiModelMenu.is-compact .ai-model-option-meta { display: none; }
            #aiModelMenu.is-short .ai-model-list {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
            }
            #aiModelMenu.is-short .ai-model-option { padding: 6px; gap: 6px; }
            #aiModelMenu.is-short .ai-model-option-icon {
                flex-basis: 24px;
                width: 24px;
                height: 24px;
            }
            #aiModelMenu.is-short .ai-model-option-name { font-size: 11px; }
            .ai-deepseek-effort {
                display: flex;
                flex-direction: column;
                align-items: stretch;
                gap: 8px;
                margin: 0;
                padding: 10px 12px;
                border-radius: var(--radius-btn-sm);
                background: var(--glass-inset);
                -webkit-tap-highlight-color: transparent;
            }
            .ai-deepseek-effort-seg {
                display: flex;
                align-items: center;
                padding: 3px;
                gap: 2px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn-sm);
                background: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
            }
            .ai-deepseek-effort-btn {
                flex: 1 1 0;
                min-width: 0;
                appearance: none;
                border: none;
                margin: 0;
                background: transparent;
                color: var(--text-muted);
                font: inherit;
                font-size: 11px;
                font-weight: 600;
                letter-spacing: 0.04em;
                padding: 5px 2px;
                min-height: 44px;
                border-radius: 8px;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
                transition: background 0.15s ease, color 0.15s ease;
            }
            .ai-deepseek-effort-btn:hover {
                color: #e8e8e7;
                background: rgba(255, 255, 255, 0.06);
            }
            .ai-deepseek-effort-btn.is-active {
                background: rgba(245, 245, 244, 0.22);
                color: #dcdcda;
                box-shadow: inset 0 0 0 1px rgba(245, 245, 244, 0.55);
            }
            .ai-deepseek-effort[hidden] { display: none; }
            .ai-composer-bar {
                display: flex;
                align-items: flex-end;
                gap: 6px;
                min-height: 52px;
                padding: 8px 10px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-header);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                transition: border-color 0.15s ease, box-shadow 0.15s ease;
            }
            .ai-composer-icon-btn,
            .ai-composer-send {
                flex: 0 0 auto;
                width: 36px;
                height: 36px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border: none;
                border-radius: 10px;
                background: transparent;
                color: #e8e8e7;
                cursor: pointer;
                padding: 0;
                transition: background 0.15s ease, color 0.15s ease;
            }
            .ai-composer-icon-btn svg,
            .ai-composer-send svg,
            .ai-model-chip svg {
                width: 18px;
                height: 18px;
                display: block;
            }
            .ai-composer-icon-btn:hover,
            .ai-model-chip:hover {
                background: rgba(255, 255, 255, 0.06);
            }
            .ai-composer-send {
                background: rgba(245, 245, 244, 0.22);
                color: #dcdcda;
            }
            .ai-composer-send:hover {
                background: rgba(245, 245, 244, 0.34);
                color: #e8e8e6;
            }
            .chat-send-btn {
                position: relative;
                overflow: hidden;
                touch-action: none;
                user-select: none;
                -webkit-user-select: none;
                transition:
                    background 0.22s ease,
                    color 0.22s ease,
                    border-radius 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.22s ease;
            }
            .chat-send-btn .chat-send-glyph {
                position: absolute;
                inset: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
            }
            .chat-send-btn .chat-send-glyph svg {
                width: 18px;
                height: 18px;
                display: block;
            }
            .chat-send-btn .chat-send-glyph-plane {
                opacity: 0;
                transform: scale(0.35) rotate(-50deg);
            }
            .chat-send-btn .chat-send-glyph-mic {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn .chat-send-glyph-cam,
            .chat-send-btn .chat-send-glyph-trash {
                opacity: 0;
                transform: scale(0.35) rotate(50deg);
                pointer-events: none;
            }
            .chat-send-btn.is-send-ready .chat-send-glyph-plane {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn.is-send-ready .chat-send-glyph-mic,
            .chat-send-btn.is-send-ready .chat-send-glyph-cam,
            .chat-send-btn.is-send-ready .chat-send-glyph-trash {
                opacity: 0;
                transform: scale(0.35) rotate(50deg);
            }
            .chat-send-btn.is-voice-mode:not(.is-send-ready):not(.is-recording):not(.is-cancel) .chat-send-glyph-mic {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn.is-voice-mode:not(.is-send-ready) .chat-send-glyph-plane {
                opacity: 0;
                transform: scale(0.35) rotate(-50deg);
            }
            .chat-send-btn.is-circle-mode {
                background: rgba(245, 245, 244, 0.36);
                color: #f0f0ee;
                border-radius: 50%;
            }
            .chat-send-btn.is-circle-mode:not(.is-send-ready) .chat-send-glyph-plane,
            .chat-send-btn.is-circle-mode:not(.is-send-ready) .chat-send-glyph-mic {
                opacity: 0;
                transform: scale(0.35) rotate(-50deg);
            }
            .chat-send-btn.is-circle-mode:not(.is-send-ready) .chat-send-glyph-cam {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn.is-recording {
                background: rgba(232, 139, 139, 0.32);
                color: #f5cece;
                animation: chat-send-rec-pulse 1.15s ease-in-out infinite;
            }
            .chat-send-btn.is-recording .chat-send-glyph-plane {
                opacity: 0;
                transform: scale(0.35) rotate(-28deg);
            }
            .chat-send-btn.is-recording.is-voice-mode .chat-send-glyph-mic {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn.is-recording.is-circle-mode .chat-send-glyph-cam {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            .chat-send-btn.is-recording:not(.is-circle-mode) .chat-send-glyph-cam,
            .chat-send-btn.is-recording:not(.is-voice-mode) .chat-send-glyph-mic {
                opacity: 0;
            }
            .chat-send-btn.is-recording .chat-send-glyph-trash {
                opacity: 0;
            }
            .chat-send-btn.is-cancel {
                background: rgba(232, 139, 139, 0.46);
                color: #f8e2e2;
                animation: none;
            }
            .chat-send-btn.is-cancel .chat-send-glyph-cam,
            .chat-send-btn.is-cancel .chat-send-glyph-mic,
            .chat-send-btn.is-cancel .chat-send-glyph-plane {
                opacity: 0;
                transform: scale(0.35) rotate(-28deg);
            }
            .chat-send-btn.is-cancel .chat-send-glyph-trash {
                opacity: 1;
                transform: scale(1) rotate(0deg);
            }
            @keyframes chat-send-rec-pulse {
                0%, 100% { box-shadow: 0 0 0 0 rgba(232, 139, 139, 0.42); }
                50% { box-shadow: 0 0 0 7px rgba(232, 139, 139, 0); }
            }
            .ai-composer-icon-btn:disabled {
                opacity: 0.4;
                cursor: default;
            }
            .ai-composer-icon-btn:disabled:hover {
                background: transparent;
            }
            .ai-composer-send:disabled {
                opacity: 0.45;
                cursor: default;
            }
            .ai-prompt-input {
                flex: 1 1 auto;
                min-width: 0;
                width: auto;
                min-height: 36px;
                max-height: 160px;
                margin: 0;
                padding: 8px 4px;
                border: none;
                border-radius: 0;
                background: transparent;
                color: #f4f4f3;
                resize: none;
                overflow-y: auto;
                field-sizing: content;
                font-family: inherit;
                font-size: 16px;
                line-height: 1.45;
                outline: none;
                box-shadow: none;
            }
            .ai-prompt-input::placeholder {
                color: #a6a6a6;
            }
            .ai-model-chip {
                flex: 0 0 auto;
                display: inline-flex;
                align-items: center;
                gap: 4px;
                max-width: min(168px, 42vw);
                min-height: 36px;
                padding: 0 8px 0 10px;
                border: 1px solid transparent;
                border-radius: 10px;
                background: transparent;
                color: #d6d6d5;
                font-size: 12px;
                font-weight: 500;
                cursor: pointer;
                white-space: nowrap;
            }
            .ai-model-chip.is-open,
            .ai-model-chip.is-fallback {
                border-color: rgba(230, 195, 122, 0.45);
                color: #e6c37a;
            }
            .ai-model-chip.is-open:not(.is-fallback) {
                border-color: rgba(166, 166, 166, 0.35);
                color: #e8e8e7;
                background: rgba(255, 255, 255, 0.05);
            }
            #aiModelChipLabel {
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .ai-model-chip svg {
                width: 14px;
                height: 14px;
                opacity: 0.75;
                flex: 0 0 auto;
                transition: transform 0.18s ease;
            }
            .ai-model-chip.is-open svg {
                transform: rotate(180deg);
                opacity: 1;
            }
            @media (prefers-reduced-motion: reduce) {
                .ai-model-chip svg { transition: none; }
                html body .ai-model-option.is-pressed:not(:disabled),
                html body .ai-model-chip.is-pressed:not(:disabled) { scale: 1; }
            }
            .ai-sheet-scrim {
                position: absolute;
                inset: auto 0 0 0;
                top: -280px;
                bottom: 0;
                border-radius: var(--radius-window);
                background: var(--glass-scrim-bg);
                backdrop-filter: var(--glass-scrim-blur);
                -webkit-backdrop-filter: var(--glass-scrim-blur);
                z-index: 3;
                opacity: 0;
                pointer-events: none;
                transition: opacity 0.22s ease;
            }
            .ai-composer-dock.is-sheet-open .ai-sheet-scrim {
                opacity: 1;
                pointer-events: auto;
            }
            .ai-sheet {
                position: absolute;
                left: 0;
                right: 0;
                bottom: calc(100% + 8px);
                z-index: 4;
                max-height: min(52vh, 420px);
                overflow: auto;
                padding: 16px 16px 14px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-window);
                background: var(--glass-highlight);
                background-color: rgba(15, 15, 15, 0.88);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: var(--text-main);
                transform: translateY(14px) scale(0.98);
                opacity: 0;
                pointer-events: none;
                transition:
                    transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
                    opacity 0.22s ease;
            }
            .ai-sheet::before {
                content: "";
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                height: 2px;
                background: var(--accent-color);
                opacity: 0.9;
                pointer-events: none;
                z-index: 2;
            }
            .ai-sheet.is-open {
                transform: translateY(0) scale(1);
                opacity: 1;
                pointer-events: auto;
            }
            .ai-sheet-handle {
                display: none;
            }
            .ai-sheet-head {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
                margin: 0 0 12px;
                padding: 0 0 10px;
                border-bottom: 1px solid var(--glass-border);
                position: relative;
                z-index: 1;
            }
            .ai-sheet-title {
                margin: 0;
                font-size: 13px;
                font-weight: 600;
                color: var(--text-main);
                letter-spacing: 0.04em;
                text-transform: uppercase;
            }
            .ai-sheet-close {
                width: 28px;
                height: 28px;
                border: none;
                border-radius: var(--radius-btn-sm);
                background: transparent;
                color: var(--text-muted);
                font-size: 18px;
                line-height: 1;
                cursor: pointer;
            }
            .ai-sheet-close:hover {
                background: rgba(255, 255, 255, 0.06);
                color: #fff;
            }
            .ai-sheet-note {
                font-size: 12px;
                line-height: 1.5;
                color: var(--text-muted);
                margin-bottom: 12px;
                position: relative;
                z-index: 1;
            }
            .ai-sheet-action {
                width: 100%;
                display: flex;
                align-items: center;
                gap: 12px;
                text-align: left;
                padding: 12px;
                margin-bottom: 10px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                box-shadow: var(--glass-shadow);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                color: var(--text-main);
                cursor: pointer;
                transition: background 0.15s ease, border-color 0.15s ease;
                position: relative;
                z-index: 1;
            }
            .ai-sheet-action:hover {
                background: rgba(245, 245, 244, 0.12);
                border-color: rgba(245, 245, 244, 0.35);
            }
            .ai-sheet-action-icon {
                width: 36px;
                height: 36px;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                border-radius: 10px;
                background: rgba(245, 245, 244, 0.18);
                color: #dcdcda;
                font-size: 22px;
                font-weight: 400;
                line-height: 1;
                flex: 0 0 auto;
            }
            .ai-sheet-action strong {
                display: block;
                font-size: 13px;
                font-weight: 600;
                margin-bottom: 2px;
            }
            .ai-sheet-action small {
                display: block;
                font-size: 11px;
                color: #a6a6a6;
            }
            .ai-composer-send.is-busy {
                opacity: 1;
                pointer-events: auto;
                background: rgba(232, 139, 139, 0.22);
                color: #f0b6b6;
            }
            .ai-composer-send.is-stop:hover {
                background: rgba(232, 139, 139, 0.34);
                color: #f5cece;
            }
            .ai-composer-send.is-busy svg {
                animation: none;
            }
            @keyframes aiSendPulse {
                0%, 100% { opacity: 0.35; transform: translateY(0); }
                50% { opacity: 1; transform: translateY(-2px); }
            }
            .ai-history-list {
                display: flex;
                flex-direction: column;
                gap: 8px;
                margin-top: 4px;
                max-height: min(60vh, 420px);
                overflow-y: auto;
                overscroll-behavior: contain;
            }
            .ai-history-item {
                display: flex;
                flex-direction: column;
                gap: 4px;
                width: 100%;
                padding: 10px 12px;
                border: 1px solid var(--glass-border);
                border-radius: var(--radius-btn);
                background: var(--glass-inset);
                color: var(--text-main);
                text-align: left;
                cursor: pointer;
                transition: border-color 0.15s ease, background 0.15s ease;
                position: relative;
                z-index: 1;
            }
            .ai-history-item:hover {
                background: rgba(255, 255, 255, 0.05);
                border-color: rgba(166, 166, 166, 0.32);
            }
            .ai-history-item.is-active {
                border-color: rgba(245, 245, 244, 0.55);
                background: rgba(245, 245, 244, 0.12);
            }
            .ai-history-item-top {
                display: flex;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
            }
            .ai-history-item-title {
                flex: 1 1 auto;
                min-width: 0;
                border: none;
                background: transparent;
                color: inherit;
                font-size: 13px;
                font-weight: 600;
                text-align: left;
                padding: 0;
                cursor: inherit;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                pointer-events: none;
            }
            .ai-history-item-meta {
                font-size: 11px;
                color: #a6a6a6;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                pointer-events: none;
            }
            .ai-history-item-del {
                flex: 0 0 auto;
                width: 24px;
                height: 24px;
                border: none;
                border-radius: 8px;
                background: transparent;
                color: #a6a6a6;
                font-size: 16px;
                line-height: 1;
                cursor: pointer;
            }
            .ai-history-item-del:hover {
                background: rgba(232, 139, 139, 0.12);
                color: #e88b8b;
            }
            .ai-history-item-share {
                flex: 0 0 auto;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                width: 24px;
                height: 24px;
                padding: 0;
                border: none;
                border-radius: 8px;
                background: transparent;
                color: #a6a6a6;
                cursor: pointer;
            }
            .ai-history-item-share svg { width: 15px; height: 15px; }
            .ai-history-item-share:hover { background: rgba(245, 245, 244, 0.14); color: var(--accent-color, #f5f5f4); }
            .ai-history-item-share.is-shared { color: var(--accent-color, #f5f5f4); }
            @media (max-width: 600px) {
                .ai-history-item-share { width: 44px; height: 44px; margin: -10px 0; }
            }
            /* Float above the composer so status text never grows the fixed bar
               and collapses the gap under the last message. */
            .ai-status-line {
                position: absolute;
                left: 4px;
                right: 4px;
                bottom: calc(100% + 6px);
                margin: 0;
                padding: 0 4px;
                font-size: 12px;
                line-height: 1.35;
                text-align: center;
                color: #dcdcda;
                pointer-events: none;
                z-index: 3;
            }
            .ai-status-line.is-error {
                color: #f0b6b6;
            }
            @media (max-width: 600px) {
                #aiManagerContainer,
                #notesManagerContainer,
                #scpManagerContainer{
                    overflow-x: hidden !important;
                    overflow-y: auto !important;
                }
                #aiManagerContainer {
                    align-items: stretch !important;
                    padding-top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                }
                #aiManagerContainer .ai-panel-window.ai-panel-window {
                    width: 100% !important;
                    margin: 0 !important;
                    margin-top: 0 !important;
                    gap: 8px !important;
                    height: auto !important;
                    max-height: none !important;
                    min-height: 0 !important;
                    flex: 0 0 auto !important;
                    align-self: stretch !important;
                    overflow: visible !important;
                    border: none !important;
                    box-shadow: none !important;
                    background: transparent !important;
                    /* Composer bar (~38px) + ~10px gap (same as top under main header). */
                    padding-bottom: 64px;
                }
                #aiManagerContainer .ai-panel-window > .panel-window-head:not(.is-searching) {
                    position: fixed !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    right: 4px !important;
                    left: auto !important;
                    z-index: 95 !important;
                    flex: 0 0 auto;
                    width: auto !important;
                    align-self: auto;
                    min-height: 0 !important;
                    height: auto !important;
                    padding: 0 !important;
                    gap: 0 !important;
                    border: none !important;
                    border-radius: 0 !important;
                    box-shadow: none !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    pointer-events: none;
                }
                #aiManagerContainer .ai-panel-window > .panel-window-head.is-searching {
                    position: sticky !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    width: auto !important;
                    align-self: stretch;
                    padding: 4px 6px 4px 4px !important;
                    gap: 6px !important;
                    flex-wrap: nowrap !important;
                    min-height: 0 !important;
                    border: 1px solid var(--glass-border) !important;
                    border-radius: var(--radius-header) !important;
                    box-shadow: var(--glass-shadow) !important;
                    background-image: var(--glass-window-stack) !important;
                    background-color: var(--glass-popover-fill) !important;
                    backdrop-filter: var(--glass-window-blur) !important;
                    -webkit-backdrop-filter: var(--glass-window-blur) !important;
                    pointer-events: auto;
                }
                #aiManagerContainer .ai-panel-window .panel-window-title {
                    font-size: 11px;
                    gap: 6px;
                }
                #aiManagerContainer .ai-panel-window .panel-window-title svg {
                    width: 13px;
                    height: 13px;
                }
                #aiManagerContainer .ai-panel-window .panel-head-icon-btn {
                    width: 32px;
                    height: 32px;
                }
                #aiManagerContainer .ai-panel-body {
                    overflow: visible !important;
                    flex: 1 0 auto;
                    min-height: 0;
                    gap: 8px;
                    display: flex;
                    flex-direction: column;
                    padding: 0;
                }
                #aiManagerContainer .ai-chat-log {
                    overflow: visible !important;
                    flex: 1 0 auto;
                    min-height: 0;
                    max-height: none;
                    padding: 4px 2px 0;
                }
                #aiManagerContainer .ai-composer {
                    position: fixed !important;
                    left: 4px !important;
                    right: 4px !important;
                    transform: none !important;
                    bottom: calc(var(--footer-offset, 80px) + 4px) !important;
                    width: auto !important;
                    max-width: none !important;
                    z-index: 50;
                    margin-top: 0;
                    padding-top: 0;
                    padding-bottom: 0;
                    background: transparent;
                    flex: 0 0 auto;
                    transition: none !important;
                }
                #aiManagerContainer .ai-dusk-above,
                #aiManagerContainer .ai-dusk-below {
                    left: -4px;
                    right: -4px;
                }
                #aiManagerContainer .ai-dusk-above {
                    height: 40px;
                }
                #aiManagerContainer .ai-dusk-below {
                    /* Runs down under the bottom nav glass. */
                    height: calc(var(--footer-offset, 80px) + 18px);
                }
                #aiManagerContainer .ai-dusk-top {
                    top: 0;
                    left: 0;
                    right: 0;
                    height: 48px;
                    z-index: 51;
                    background: linear-gradient(
                        to bottom,
                        rgba(40, 40, 40, 0.92) 0%,
                        rgba(40, 40, 40, 0.72) 38%,
                        rgba(40, 40, 40, 0.38) 72%,
                        rgba(40, 40, 40, 0) 100%
                    );
                }
                /* Phone: composer always docked at bottom — center empty state is PC-only. */
                #aiManagerContainer .ai-panel-window.is-chat-empty .ai-composer {
                    bottom: calc(var(--footer-offset, 80px) + 4px) !important;
                    transform: none !important;
                }
                #aiManagerContainer .ai-panel-window.no-composer-anim .ai-composer {
                    transition: none !important;
                }
                #aiManagerContainer .ai-composer-bar {
                    border-radius: var(--radius-header);
                    min-height: 38px;
                    padding: 6px 10px;
                    gap: 4px;
                    align-items: center;
                }
                #aiManagerContainer .ai-composer-icon-btn,
                #aiManagerContainer .ai-composer-send {
                    width: 32px;
                    height: 32px;
                    border-radius: 10px;
                }
                #aiManagerContainer .ai-model-chip {
                    max-width: min(150px, 38vw);
                    min-height: 32px;
                    padding: 0 6px 0 8px;
                    font-size: 11px;
                    border-radius: 10px;
                }
                #aiManagerContainer .ai-prompt-input {
                    font-size: 16px;
                    min-height: 34px;
                    padding: 6px 4px;
                }
                #aiManagerContainer .ai-msg-user {
                    max-width: min(55ch, 100%);
                }
                #aiManagerContainer .ai-msg-bot,
                #aiManagerContainer .ai-msg-error {
                    max-width: 100%;
                    width: 100%;
                }
                /* Phone: wrap long CLI/code lines so commands stay readable. */
                #aiManagerContainer .ai-msg-md .ai-md-code-line {
                    font-size: 11px;
                    line-height: 1.55;
                    min-height: 1.55em;
                }
                #aiManagerContainer .ai-msg-md .ai-md-line-num {
                    padding: 0 4px;
                    line-height: 1.55;
                }
                #aiManagerContainer .ai-msg-md .ai-md-line-text {
                    padding: 0 8px 0 6px;
                    white-space: pre-wrap;
                    overflow-wrap: anywhere;
                    word-break: break-word;
                }
                #aiManagerContainer .ai-msg-md .ai-md-code-body {
                    overflow-x: hidden;
                }
                #aiManagerContainer .ai-msg-md .ai-md-pre-copy-label {
                    display: none;
                }
                #aiManagerContainer .ai-model-menu,
                #aiManagerContainer .ai-attach-menu {
                    left: 0;
                    right: 0;
                    width: auto;
                    bottom: calc(100% + 8px);
                    transform-origin: bottom center;
                }
                .ai-jump-nav {
                    display: none !important;
                }
            }

            
            html::-webkit-scrollbar,
            body::-webkit-scrollbar,
            *::-webkit-scrollbar,
            *::-webkit-scrollbar-thumb,
            *::-webkit-scrollbar-thumb:hover,
            *::-webkit-scrollbar-track,
            *::-webkit-scrollbar-corner,
            *::-webkit-scrollbar-button,
            #notesManagerContainer::-webkit-scrollbar,
            #scpManagerContainer::-webkit-scrollbar,
            #aiManagerContainer::-webkit-scrollbar,
            .ai-chat-log::-webkit-scrollbar,
            .ai-history-list::-webkit-scrollbar,
            .note-viewer-body::-webkit-scrollbar{
                width: 0 !important;
                height: 0 !important;
                display: none !important;
                background: transparent !important;
                border: none !important;
                box-shadow: none !important;
            }
            #notesManagerContainer,
            #scpManagerContainer,
            #chatManagerContainer,
            #aiManagerContainer,
            .ai-chat-log,
            .chat-log,
            .ai-history-list,
            .note-viewer-body {
                scrollbar-width: none !important;
                -ms-overflow-style: none !important;
                scrollbar-gutter: auto !important;
            }
            @media (max-width: 600px) {
                html,
                body {
                    scrollbar-width: none !important;
                    -ms-overflow-style: none !important;
                }
            }

            /* ---- User chat ---- */
            #chatManagerContainer {
                display: flex;
                flex-direction: column;
                min-height: 0;
            }
            .chat-panel-window {
                display: flex;
                flex-direction: column;
                flex: 1;
                min-height: 0;
                width: min(100%, 1200px);
                max-width: 1200px;
                position: relative;
                align-self: center;
                box-sizing: border-box;
            }
            .chat-panel-body {
                display: flex;
                flex-direction: column;
                flex: 1;
                min-height: 0;
                overflow: hidden;
                position: relative;
                width: 100%;
            }
            .chat-panel-body-denied {
                align-items: center;
                justify-content: center;
                padding: 24px 16px;
            }
            .chat-denied-stub { width: 100%; max-width: 360px; }
            .chat-denied-title {
                color: #e88b8b;
                font-size: 14px;
                font-weight: 600;
                margin-bottom: 6px;
                text-transform: uppercase;
                letter-spacing: 0.03em;
                text-align: center;
            }
            .chat-denied-text {
                color: #a6a6a6;
                font-size: 13px;
                text-align: center;
            }
            /* display:flex beats bare [hidden] — force hide */
            #chatManagerContainer .chat-room-list[hidden],
            #chatManagerContainer .chat-thread[hidden],
            #chatManagerContainer .chat-composer[hidden],
            #chatManagerContainer #chatComposer[hidden],
            #chatManagerContainer .chat-mobile-back[hidden],
            #chatPanelHead .chat-back-btn[hidden],
            #chatPanelHead #chatRefreshBtn[hidden],
            .header-panel-tools .chat-back-btn[hidden],
            .header-panel-tools #chatRefreshBtn[hidden]{
                display: none !important;
            }
            .chat-room-list {
                flex: 1;
                overflow-y: auto;
                padding: 8px 10px 18px;
                display: flex;
                flex-direction: column;
                gap: 2px;
                width: 100%;
                box-sizing: border-box;
                min-height: 0;
            }
            .chat-room-card {
                display: flex;
                align-items: center;
                gap: 12px;
                width: 100%;
                text-align: left;
                cursor: pointer;
                border: none;
                background: transparent;
                color: inherit;
                padding: 10px 8px;
                border-radius: 12px;
                font: inherit;
                box-sizing: border-box;
            }
            .chat-room-card:hover,
            .chat-room-card:active {
                background: rgba(255, 255, 255, 0.04);
            }
            .chat-avatar {
                position: relative;
                flex: 0 0 auto;
                width: 48px;
                height: 48px;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
                background: hsl(var(--chat-av-hue, 210) 48% 42%);
                color: #fff;
                font-size: 18px;
                font-weight: 700;
                letter-spacing: 0;
                user-select: none;
            }
            .chat-avatar-letter { line-height: 1; }
            .chat-avatar.is-saved {
                background: #f5f5f4;
                color: #fff;
            }
            .chat-avatar.is-saved svg {
                width: 22px;
                height: 22px;
                display: block;
            }
            .chat-room-card.is-saved .chat-room-title {
                font-weight: 700;
            }
            .chat-msg-unit {
                display: flex;
                flex-direction: column;
                gap: 1px;
                flex: 0 0 auto;
                max-width: 100%;
                box-sizing: border-box;
                min-width: 0;
            }
            /* Peer: from left, leave ~30% on the right → wrap later. */
            .chat-msg-unit.is-peer {
                align-self: flex-start;
                align-items: flex-start;
                width: fit-content;
                max-width: 70%;
            }
            /* Mine: from right, leave ~25% on the left. */
            .chat-msg-unit.is-mine {
                align-self: flex-end;
                align-items: flex-end;
                width: fit-content;
                max-width: 75%;
            }
            .chat-msg-unit .chat-msg-mine,
            .chat-msg-unit .chat-msg-peer {
                align-self: auto;
                /* Grow with nick+text, never past the unit. */
                width: max-content;
                max-width: 100%;
                min-width: 0;
                overflow: hidden;
                box-sizing: border-box;
            }
            .chat-msg-copy {
                width: 28px;
                height: 28px;
                flex: 0 0 auto;
                color: rgba(166, 166, 166, 0.72);
                background: transparent;
                border: none;
                box-shadow: none;
            }
            .chat-msg-actions {
                display: flex;
                align-items: center;
                gap: 2px;
                background: transparent;
                border: none;
                box-shadow: none;
                padding: 0 2px;
            }
            .chat-msg-unit.is-mine .chat-msg-actions {
                justify-content: flex-end;
            }
            .chat-msg-unit.is-peer .chat-msg-actions {
                justify-content: flex-start;
            }
            /* Thread burger + search — show when a room is open (PC + phone). */
            .chat-thread-menu,
            .chat-thread-search {
                display: none;
                flex: 0 0 auto;
            }
            #chatManagerContainer.is-chat-thread .chat-thread-menu:not([hidden]),
            .chat-panel-window.is-thread-open .chat-thread-menu:not([hidden]),
            body:has(#chatManagerContainer.is-chat-thread) .header-panel-tools .chat-thread-menu:not([hidden]),
            body:has(#chatManagerContainer.is-chat-thread) .header-panel-tools #chatThreadMenu:not([hidden]),
            #chatManagerContainer.is-chat-thread .chat-thread-search:not([hidden]),
            .chat-panel-window.is-thread-open .chat-thread-search:not([hidden]),
            body:has(#chatManagerContainer.is-chat-thread) .header-panel-tools .chat-thread-search:not([hidden]) {
                display: inline-flex !important;
            }
            .chat-panel-window.is-thread-open #chatPanelHead.is-searching .chat-thread-menu,
            body:has(#chatManagerContainer.is-chat-thread) .header-panel-tools #chatPanelHead.is-searching .chat-thread-menu {
                display: none !important;
            }
            .chat-reply-bar {
                display: none;
                align-items: center;
                gap: 10px;
                margin: 0 0 8px;
                padding: 8px 10px;
                border-radius: var(--radius-header, 14px);
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                border-left: 3px solid var(--accent-color, #f5f5f4);
                box-sizing: border-box;
            }
            .chat-reply-bar:not([hidden]) {
                display: flex !important;
            }
            .chat-reply-bar-body {
                min-width: 0;
                flex: 1 1 auto;
            }
            .chat-reply-bar-label {
                font-size: 11px;
                font-weight: 600;
                color: #dcdcda;
                margin-bottom: 2px;
            }
            .chat-reply-bar-text {
                font-size: 12px;
                color: var(--text-muted, #a6a6a6);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .chat-reply-bar-close {
                flex: 0 0 36px;
                width: 36px;
                height: 36px;
                border: none;
                border-radius: 10px;
                background: var(--glass-inset);
                color: var(--text-main);
                display: inline-flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .chat-reply-bar-close svg {
                width: 16px;
                height: 16px;
            }
            .chat-select-bar {
                display: none;
                align-items: center;
                gap: 8px;
                margin: 0 0 8px;
                padding: 8px 10px;
                border-radius: var(--radius-header, 14px);
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                box-sizing: border-box;
            }
            .chat-select-bar:not([hidden]) {
                display: flex !important;
            }
            .chat-select-cancel {
                border: none;
                background: transparent;
                color: #dcdcda;
                font: inherit;
                font-size: 13px;
                font-weight: 600;
                cursor: pointer;
                padding: 6px 4px;
                min-height: 44px;
            }
            .chat-select-count {
                flex: 1 1 auto;
                font-size: 13px;
                color: var(--text-muted);
            }
            .chat-msg-unit.is-selecting {
                position: relative;
                padding-left: 36px;
            }
            .chat-msg-unit.is-mine.is-selecting {
                padding-left: 0;
                padding-right: 36px;
            }
            .chat-msg-check {
                position: absolute;
                top: 10px;
                left: 0;
                width: 28px;
                height: 28px;
                border-radius: 50%;
                border: 2px solid rgba(255, 255, 255, 0.35);
                background: rgba(16, 16, 16, 0.45);
                color: transparent;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                padding: 0;
                box-sizing: border-box;
                -webkit-tap-highlight-color: transparent;
            }
            .chat-msg-unit.is-mine .chat-msg-check {
                left: auto;
                right: 0;
            }
            .chat-msg-check.is-on {
                border-color: var(--accent-color, #f5f5f4);
                background: var(--accent-color, #f5f5f4);
                color: #fff;
            }
            .chat-msg-check svg {
                width: 14px;
                height: 14px;
                display: block;
            }
            .chat-msg-reply-quote {
                display: block;
                width: 100%;
                max-width: 100%;
                margin: 0 0 6px;
                padding: 6px 8px;
                border-radius: 8px;
                border-left: 3px solid var(--accent-color, #f5f5f4);
                background: rgba(245, 245, 244, 0.12);
                box-sizing: border-box;
                cursor: pointer;
                text-align: left;
                border-top: none;
                border-right: none;
                border-bottom: none;
                color: inherit;
                font: inherit;
            }
            .chat-msg-reply-name {
                display: block;
                font-size: 11px;
                font-weight: 600;
                color: #dcdcda;
                margin-bottom: 2px;
            }
            .chat-msg-reply-text {
                display: block;
                font-size: 12px;
                color: var(--text-muted, #a6a6a6);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .chat-msg-unit.is-search-hit .chat-msg-media-shell,
            .chat-msg-unit.is-search-hit .chat-msg-mine,
            .chat-msg-unit.is-search-hit .chat-msg-peer {
                outline: 1px solid rgba(245, 245, 244, 0.55);
            }
            .chat-msg-unit.is-search-dim,
            .chat-msg-unit.is-search-hidden {
                display: none !important;
            }
            .chat-composer.is-select-mode .ai-composer-dock {
                display: none !important;
            }
            .chat-composer.is-select-mode .chat-reply-bar {
                display: none !important;
            }
            .chat-msg-delete,
            .ai-msg-action-delete {
                color: rgba(166, 166, 166, 0.72);
            }
            .chat-msg-delete:hover,
            .chat-msg-delete:focus-visible,
            .ai-msg-action-delete:hover,
            .ai-msg-action-delete:focus-visible {
                color: #f0b6b6;
                background: rgba(232, 139, 139, 0.12);
            }
            .chat-avatar.is-online::after {
                content: "";
                position: absolute;
                right: 1px;
                bottom: 1px;
                width: 12px;
                height: 12px;
                border-radius: 50%;
                background: #7fd1a8;
                border: 2px solid var(--bg-color, #0a0a0a);
                box-sizing: border-box;
            }
            .chat-room-main {
                flex: 1 1 auto;
                min-width: 0;
                display: flex;
                flex-direction: column;
                gap: 3px;
            }
            .chat-room-card-top {
                display: flex;
                align-items: baseline;
                justify-content: space-between;
                gap: 8px;
            }
            .chat-room-title {
                font-weight: 600;
                font-size: 15px;
                color: #f4f4f3;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                min-width: 0;
                flex: 1 1 auto;
            }
            .chat-room-title-row {
                display: flex;
                align-items: center;
                gap: 6px;
                min-width: 0;
                flex: 1 1 auto;
                overflow: hidden;
            }
            .chat-room-meta {
                color: #a6a6a6;
                font-size: 11px;
                flex-shrink: 0;
            }
            .chat-room-bottom {
                display: flex;
                align-items: center;
                gap: 8px;
                min-width: 0;
            }
            .chat-room-preview {
                flex: 1 1 auto;
                color: #a6a6a6;
                font-size: 13px;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
                min-width: 0;
            }
            .chat-unread-badge {
                display: inline-flex;
                align-items: center;
                justify-content: center;
                min-width: 20px;
                height: 20px;
                padding: 0 6px;
                border-radius: 999px;
                background: var(--accent-color, #f5f5f4);
                color: #fff;
                font-size: 11px;
                font-weight: 700;
                flex-shrink: 0;
            }
            .chat-empty {
                color: #a6a6a6;
                font-size: 13px;
                text-align: center;
                padding: 28px 16px;
            }
            .chat-thread {
                flex: 1;
                display: flex;
                flex-direction: column;
                min-height: 0;
                width: 100%;
                box-sizing: border-box;
            }
            .chat-log {
                flex: 1;
                overflow-y: auto;
                padding: 12px 12px 8px;
                display: flex;
                flex-direction: column;
                gap: 8px;
                width: 100%;
                box-sizing: border-box;
                min-height: 0;
            }
            .chat-msg-peer {
                align-self: flex-start;
                width: max-content;
                max-width: 100%;
                min-width: 0;
                overflow: hidden;
                background-image: var(--ink-stack);
                background-color: var(--ink-bg, #252525);
                border: 1px solid rgba(255,255,255,0.08);
                border-radius: 12px;
                padding: 8px 10px;
                box-sizing: border-box;
            }
            .chat-msg-peer .ai-msg-body {
                white-space: pre-wrap;
                overflow-wrap: anywhere;
                word-break: break-word;
                font-size: 13px;
                line-height: 1.35;
            }
            .chat-msg-mine {
                align-self: flex-end;
                width: max-content;
                max-width: 100%;
                min-width: 0;
                overflow: hidden;
                padding: 8px 10px;
                border-radius: 12px;
                box-sizing: border-box;
            }
            .chat-msg-unit.is-mine .chat-msg-mine,
            .chat-msg-unit.is-peer .chat-msg-peer {
                align-self: auto;
                width: max-content;
                max-width: 100%;
            }
            .chat-msg-unit.is-mine .ai-msg-body {
                font-size: 13px;
                line-height: 1.35;
            }
            .chat-msg-head {
                display: flex;
                align-items: center;
                gap: 6px;
                margin-bottom: 3px;
                min-width: 0;
                max-width: 100%;
                overflow: hidden;
            }
            .chat-msg-head .chat-avatar {
                width: 22px;
                height: 22px;
                font-size: 10px;
                flex: 0 0 auto;
            }
            .chat-msg-name {
                font-size: 11px;
                font-weight: 600;
                color: var(--accent-color, #f5f5f4);
                min-width: 0;
                flex: 1 1 auto;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }
            .chat-msg-foot {
                display: flex;
                align-items: center;
                gap: 4px;
                margin-top: 3px;
                justify-content: flex-end;
            }
            .chat-msg-meta {
                display: flex;
                align-items: center;
                gap: 6px;
                padding: 0 2px;
                margin-top: 2px;
                color: #a6a6a6;
                font-size: 11px;
                line-height: 1.2;
            }
            .chat-msg-unit.is-mine .chat-msg-meta {
                justify-content: flex-end;
            }
            .chat-msg-unit.is-peer .chat-msg-meta {
                justify-content: flex-start;
            }
            .chat-msg-time {
                font-size: 9px;
                color: #a6a6a6;
            }
            .chat-msg-ticks {
                font-size: 10px;
                color: #767676;
                letter-spacing: -0.04em;
            }
            .chat-msg-upload {
                position: relative;
                height: 3px;
                margin-top: 6px;
                border-radius: 2px;
                background: rgba(255, 255, 255, 0.12);
                overflow: hidden;
            }
            .chat-msg-upload-bar {
                height: 100%;
                width: 0;
                border-radius: 2px;
                background: var(--accent-color, #f5f5f4);
                transition: width 0.15s linear;
            }
            .chat-msg-unit.is-uploading .chat-msg-mine,
            .chat-msg-unit.is-uploading .chat-msg-peer {
                opacity: 0.92;
            }
            .chat-msg-ticks.is-read {
                color: #f5f5f4;
            }
            .chat-msg-ticks.is-pending {
                color: #e6c37a;
                letter-spacing: 0;
            }
            .chat-log-end-spacer {
                display: none;
                flex: 0 0 auto;
                width: 100%;
                height: 0;
                pointer-events: none;
            }
            .chat-back-btn {
                margin-right: 2px;
            }
            .chat-mobile-back{
                display: none;
            }
            /* Fixed back — glass floater (phone only; PC uses main header) */
            .chat-panel-window.is-thread-open .chat-mobile-back:not([hidden]) {
                display: none;
            }
            @media (max-width: 600px) {
                .chat-panel-window.is-thread-open .chat-mobile-back:not([hidden]) {
                    display: inline-flex;
                    position: fixed;
                    top: max(8px, var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                    left: 8px;
                    z-index: 95;
                    width: 40px;
                    height: 40px;
                    min-width: 40px;
                    min-height: 40px;
                    margin: 0;
                    padding: 0;
                    align-items: center;
                    justify-content: center;
                    border-radius: 12px;
                    border: 1px solid var(--glass-border);
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    box-shadow: var(--glass-shadow);
                    color: #f4f4f3;
                    cursor: pointer;
                    box-sizing: border-box;
                }
                .chat-panel-window.is-thread-open .chat-mobile-back:not([hidden]) svg {
                    width: 18px;
                    height: 18px;
                    display: block;
                }
            }
            #chatPanelHead .panel-window-head-start {
                display: flex;
                align-items: center;
                gap: 4px;
                min-width: 0;
            }
            /* Composer: same docking as AI (PC) */
            @media (min-width: 601px) {
                #chatManagerContainer .chat-panel-window.is-thread-open {
                    padding-bottom: 0;
                }
                #chatManagerContainer .chat-composer.ai-composer {
                    position: fixed;
                    left: 50%;
                    transform: translate(-50%, 0);
                    bottom: 8px;
                    width: min(calc(100% - 16px), var(--ai-column-width, 840px));
                    max-width: var(--ai-column-width, 840px);
                    z-index: 50;
                    margin: 0;
                    padding: 0;
                    box-sizing: border-box;
                }
                #chatManagerContainer .chat-log {
                    max-width: var(--ai-column-width, 840px);
                    width: 100%;
                    margin: 0 auto;
                    box-sizing: border-box;
                }
                /* Scroller is .chat-log — pad so last msgs clear the composer */
                #chatManagerContainer .chat-panel-window.is-thread-open .chat-log {
                    padding-bottom: 72px;
                }
                /* PC: controls live in main header — no floating chrome */
                #chatManagerContainer .chat-mobile-back,
                .chat-panel-window.is-thread-open .chat-mobile-back {
                    display: none !important;
                }
            }
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            .confirm-actions,
            .chat-confirm-actions {
                display: flex;
                gap: 6px;
            }
            .confirm-actions .choice-btn,
            .chat-confirm-actions .choice-btn {
                flex: 1;
                padding: 10px 0;
                font-size: 11px;
                min-height: 44px;
            }
            .confirm-ok,
            .chat-confirm-ok {
                flex: 1;
                min-height: 44px;
                background: #e88b8b;
                color: #fff;
                border: none;
                padding: 10px 0;
                border-radius: var(--radius-btn);
                cursor: pointer;
                font: inherit;
                font-size: 11px;
                font-weight: 600;
                text-transform: uppercase;
                letter-spacing: 0.03em;
            }
            .confirm-ok.is-primary {
                background: #f5f5f4;
            }
            .confirm-ok:hover,
            .confirm-ok:active,
            .chat-confirm-ok:hover,
            .chat-confirm-ok:active {
                filter: brightness(1.08);
            }
            .ai-sheet-head-end {
                display: flex;
                align-items: center;
                gap: 4px;
            }
            .ai-sheet-head-end .panel-head-icon-btn {
                width: 36px;
                height: 36px;
                min-width: 36px;
                min-height: 36px;
            }
            .ai-sheet-head-end .panel-head-icon-btn[hidden] {
                display: none !important;
            }
            
            
            
            
            
            
            .chat-room-kind {
                flex: 0 0 auto;
                font-size: 10px;
                font-weight: 700;
                letter-spacing: 0.02em;
                text-transform: lowercase;
                color: #dcdcda;
                background: rgba(245, 245, 244, 0.14);
                border: 1px solid rgba(245, 245, 244, 0.28);
                border-radius: 999px;
                padding: 1px 7px;
                line-height: 1.4;
            }
            .chat-room-kind.is-dm {
                color: #d0d0cf;
                background: rgba(170, 170, 170, 0.12);
                border-color: rgba(170, 170, 170, 0.25);
            }
            .chat-room-section {
                font-size: 12px;
                font-weight: 600;
                color: #a6a6a6;
                padding: 10px 8px 4px;
                letter-spacing: 0.02em;
            }
            button.chat-room-section.is-toggle {
                display: flex;
                width: 100%;
                align-items: center;
                justify-content: space-between;
                gap: 8px;
                margin: 0;
                border: 0;
                background: transparent;
                text-align: left;
                cursor: pointer;
                color: #a6a6a6;
                -webkit-tap-highlight-color: transparent;
            }
            button.chat-room-section.is-toggle::after {
                content: '';
                width: 8px;
                height: 8px;
                border-right: 2px solid #a6a6a6;
                border-bottom: 2px solid #a6a6a6;
                transform: rotate(-45deg);
                transition: transform 0.15s ease;
                flex: 0 0 auto;
                opacity: 0.8;
            }
            button.chat-room-section.is-toggle.is-open::after {
                transform: rotate(45deg);
            }
            button.chat-room-section.is-toggle:hover,
            button.chat-room-section.is-toggle:focus-visible {
                color: #e8e8e7;
            }
            @media (max-width: 600px) {
                /* Mobile list: no chat glass header. Thread open: AI-style float head (burger only). */
                #chatManagerContainer:not(.is-chat-thread) .chat-panel-window > .panel-window-head,
                #chatManagerContainer:not(.is-chat-thread) .panel-window-head,
                #chatManagerContainer:not(.is-chat-thread) #chatPanelHead {
                    display: none !important;
                    visibility: hidden !important;
                    height: 0 !important;
                    min-height: 0 !important;
                    max-height: 0 !important;
                    margin: 0 !important;
                    padding: 0 !important;
                    overflow: hidden !important;
                    border: none !important;
                    box-shadow: none !important;
                    pointer-events: none !important;
                }
                #chatManagerContainer.is-chat-thread .chat-panel-window > .panel-window-head:not(.is-searching),
                #chatManagerContainer.is-chat-thread #chatPanelHead:not(.is-searching) {
                    display: flex !important;
                    visibility: visible !important;
                    position: fixed !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    right: 4px !important;
                    left: auto !important;
                    width: auto !important;
                    max-width: none;
                    height: auto !important;
                    min-height: 0 !important;
                    max-height: none !important;
                    margin: 0 !important;
                    padding: 0 !important;
                    gap: 0 !important;
                    overflow: visible !important;
                    border: none !important;
                    border-radius: 0 !important;
                    box-shadow: none !important;
                    background: transparent !important;
                    background-color: transparent !important;
                    background-image: none !important;
                    backdrop-filter: none !important;
                    -webkit-backdrop-filter: none !important;
                    z-index: 95 !important;
                    pointer-events: none !important;
                    align-self: auto;
                    flex: 0 0 auto;
                }
                #chatManagerContainer.is-chat-thread .panel-window-head-start,
                #chatManagerContainer.is-chat-thread .is-desktop-head-action {
                    display: none !important;
                }
                #chatManagerContainer.is-chat-thread .panel-window-head:not(.is-searching) .panel-window-head-end,
                #chatManagerContainer.is-chat-thread .panel-window-head:not(.is-searching) .panel-head-menu,
                #chatManagerContainer.is-chat-thread .panel-window-head:not(.is-searching) .panel-head-icon-btn {
                    pointer-events: auto;
                    margin-left: 0;
                }
                #chatManagerContainer.is-chat-thread .panel-head-menu.is-mobile-head-menu:not([hidden]) {
                    display: block !important;
                }
                #chatManagerContainer.is-chat-thread .panel-window-head:not(.is-searching) .panel-head-icon-btn {
                    width: 38px;
                    height: 38px;
                    border-radius: var(--radius-header);
                    background: var(--glass-highlight);
                    background-color: var(--glass-bg);
                    border: 1px solid var(--glass-border);
                    box-shadow: var(--glass-shadow);
                    backdrop-filter: var(--glass-blur);
                    -webkit-backdrop-filter: var(--glass-blur);
                    color: var(--text-main);
                    outline: none !important;
                    box-sizing: border-box;
                    -webkit-tap-highlight-color: transparent;
                    -webkit-appearance: none;
                    appearance: none;
                }
                #chatManagerContainer.is-chat-thread .panel-window-head:not(.is-searching) .panel-head-icon-btn svg {
                    width: 15px;
                    height: 15px;
                }
                #chatManagerContainer .chat-panel-window.chat-panel-window {
                    display: flex !important;
                    flex-direction: column !important;
                    /* Match AI: size to content, do NOT force full viewport — that
                       eats end spacer and leaves last bubbles under the composer. */
                    flex: 0 0 auto !important;
                    min-height: 0 !important;
                    max-height: none !important;
                    height: auto !important;
                    overflow: visible !important;
                    gap: 0 !important;
                    padding-bottom: 0 !important;
                }
                #chatManagerContainer .chat-panel-window.is-thread-open {
                    /* Composer (~38–46px) + gap above nav — same idea as AI 64px */
                    padding-bottom: 64px !important;
                }
                #chatManagerContainer .chat-panel-body {
                    flex: 1 0 auto !important;
                    min-height: 0 !important;
                    overflow: visible !important;
                    padding: 0 !important;
                    width: 100% !important;
                }
                #chatManagerContainer .chat-panel-window.is-thread-open .chat-panel-body {
                    padding-bottom: 0 !important;
                }
                #chatManagerContainer .chat-room-list,
                #chatManagerContainer .chat-thread,
                #chatManagerContainer .chat-log {
                    width: 100% !important;
                    max-width: none !important;
                    box-sizing: border-box;
                }
                #chatManagerContainer .chat-room-list {
                    overflow-y: visible !important;
                    padding: 4px 2px 12px !important;
                    /* List mode: fill screen so empty state isn't tiny */
                    min-height: calc(100dvh - var(--footer-offset, 80px) - 24px);
                }
                #chatManagerContainer .chat-panel-window.is-thread-open .chat-room-list {
                    min-height: 0 !important;
                    display: none !important;
                }
                #chatManagerContainer .chat-log {
                    overflow: visible !important;
                    flex: 1 0 auto;
                    min-height: 0;
                    max-height: none;
                    padding: 4px 2px 0 !important;
                }
                #chatManagerContainer .chat-panel-window.is-thread-open .chat-log {
                    padding-top: 52px !important;
                    /* Same as AI log: clearance lives on the panel (64px), not stacked here */
                    padding-bottom: 0 !important;
                }
                #chatManagerContainer .chat-panel-window.is-thread-open .chat-log-end-spacer {
                    display: none !important;
                    height: 0 !important;
                    min-height: 0 !important;
                    flex: 0 0 0 !important;
                    pointer-events: none;
                }
                /* Thread: keep footer clearance; panel/log pad clears the composer */
                #chatManagerContainer.is-chat-thread {
                    scroll-padding-bottom: 72px;
                }
                #chatManagerContainer:has(.chat-panel-window.is-thread-open) {
                    scroll-padding-bottom: 72px;
                }
                /* Composer: same dock as AI on phone */
                #chatManagerContainer .chat-composer.ai-composer {
                    position: fixed !important;
                    left: 4px !important;
                    right: 4px !important;
                    transform: none !important;
                    bottom: calc(var(--footer-offset, 80px) + 4px) !important;
                    width: auto !important;
                    max-width: none !important;
                    z-index: 50;
                    margin: 0;
                    padding: 0;
                    background: transparent;
                    flex: 0 0 auto;
                }
                #chatManagerContainer .chat-composer .ai-composer-bar {
                    border-radius: var(--radius-header);
                    min-height: 38px;
                    padding: 6px 10px;
                    gap: 4px;
                    align-items: center;
                }
                #chatManagerContainer .chat-composer .ai-composer-send {
                    width: 32px;
                    height: 32px;
                    border-radius: 10px;
                }
                
                
                /* Back stays fixed; same 40px as other mobile top glass buttons */
                .chat-panel-window.is-thread-open .chat-mobile-back:not([hidden]) {
                    display: inline-flex !important;
                    position: fixed !important;
                    top: max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
                    left: 4px !important;
                    width: 40px !important;
                    height: 40px !important;
                    min-width: 40px !important;
                    min-height: 40px !important;
                    border-radius: 12px !important;
                    z-index: 95 !important;
                }
                .chat-panel-window.is-thread-open .chat-mobile-back:not([hidden]) svg {
                    width: 18px !important;
                    height: 18px !important;
                }
                
                #chatManagerContainer .chat-msg-unit.is-peer {
                    max-width: 70%;
                }
                #chatManagerContainer .chat-msg-unit.is-mine {
                    max-width: 75%;
                }
                #chatManagerContainer .chat-msg-peer,
                #chatManagerContainer .chat-msg-mine {
                    max-width: 100%;
                }
                #chatManagerContainer .chat-msg-unit.is-bare-media.is-peer {
                    width: fit-content;
                    max-width: min(70%, 320px);
                }
                #chatManagerContainer .chat-msg-unit.is-bare-media.is-mine {
                    width: fit-content;
                    max-width: min(75%, 320px);
                }
            }

            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            

            /* ---- Media capture: Telegram-style shoot mode, site glass chrome ---- */
            .media-capture-overlay {
                display: none;
                position: fixed !important;
                inset: 0 !important;
                width: 100% !important;
                height: 100% !important;
                height: 100dvh !important;
                max-width: none !important;
                align-items: stretch !important;
                justify-content: stretch !important;
                z-index: 22000;
                margin: 0 !important;
                padding: 0 !important;
                border-radius: 0;
                background: #000 !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
            }
            .media-capture-overlay:not([hidden]) {
                display: flex !important;
            }
            .media-capture-modal {
                position: relative;
                flex: 1 1 auto;
                align-self: stretch;
                width: 100% !important;
                height: 100% !important;
                max-width: none !important;
                max-height: none !important;
                border-radius: 0;
                border: none !important;
                background: #000 !important;
                box-shadow: none !important;
                backdrop-filter: none !important;
                -webkit-backdrop-filter: none !important;
                display: flex;
                flex-direction: column;
                gap: 0;
                padding: 0;
                overflow: hidden;
            }
            .media-capture-back {
                position: absolute;
                top: calc(12px + var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                left: 12px;
                z-index: 6;
                width: 44px;
                height: 44px;
                min-width: 44px;
                min-height: 44px;
                padding: 0;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #f4f4f3;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .media-capture-back svg {
                width: 22px;
                height: 22px;
            }
            .media-capture-body {
                position: absolute;
                inset: 0;
                min-height: 0;
                border-radius: 0;
                overflow: hidden;
                background: #000;
                aspect-ratio: auto;
                max-height: none;
            }
            .media-capture-placeholder {
                position: absolute;
                inset: 0;
                z-index: 3;
                display: flex;
                align-items: center;
                justify-content: center;
                background: #252525;
                pointer-events: none;
            }
            .media-capture-placeholder-icon {
                width: 64px;
                height: 64px;
                min-width: 64px;
                min-height: 64px;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #e8e8e7;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .media-capture-placeholder-icon svg {
                width: 28px;
                height: 28px;
            }
            .media-capture-body.is-live .media-capture-placeholder {
                display: none;
            }
            .media-capture-video,
            .media-capture-still {
                position: absolute;
                inset: 0;
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
                background: #000;
            }
            .media-capture-video {
                opacity: 0;
            }
            .media-capture-still {
                z-index: 4;
                opacity: 0;
                transform: scale(1.04);
            }
            .media-capture-still.is-in {
                animation: mediaShotIn 0.28s ease forwards;
            }
            .media-capture-still[hidden] {
                display: none !important;
            }
            @keyframes mediaShotIn {
                to { opacity: 1; transform: none; }
            }
            .media-capture-body.is-live .media-capture-video {
                opacity: 1;
            }
            .media-capture-video::-webkit-media-controls,
            .media-capture-video::-webkit-media-controls-enclosure,
            .media-capture-video::-webkit-media-controls-start-playback-button,
            .media-capture-video::-webkit-media-controls-overlay-play-button,
            .chat-msg-video::-webkit-media-controls,
            .chat-msg-video::-webkit-media-controls-start-playback-button,
            .chat-msg-video::-webkit-media-controls-overlay-play-button,
            .chat-msg-circle-video::-webkit-media-controls,
            .chat-msg-circle-video::-webkit-media-controls-start-playback-button,
            .chat-msg-circle-video::-webkit-media-controls-overlay-play-button {
                display: none !important;
                -webkit-appearance: none;
                opacity: 0;
                pointer-events: none;
            }
            .media-capture-timer {
                position: absolute;
                top: calc(14px + var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                left: 50%;
                transform: translateX(-50%);
                z-index: 5;
                padding: 4px 12px;
                border-radius: 999px;
                background: rgba(16, 16, 16, 0.72);
                color: #e88b8b;
                font-size: 13px;
                font-weight: 600;
                letter-spacing: 0.04em;
            }
            .media-capture-dock {
                position: absolute;
                left: 0;
                right: 0;
                bottom: 0;
                z-index: 6;
                padding: 10px 20px calc(18px + var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 14px;
                background: linear-gradient(to top, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.28) 70%, transparent 100%);
                pointer-events: none;
            }
            .media-capture-dock > * {
                pointer-events: auto;
            }
            .media-capture-review {
                display: flex;
                gap: 12px;
                width: min(440px, 100%);
            }
            .media-capture-review[hidden] {
                display: none !important;
            }
            .media-capture-choice {
                flex: 1 1 0;
                min-height: 52px;
                padding: 12px 16px;
                border-radius: 16px;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #f4f4f3;
                font-size: 15px;
                font-weight: 650;
                letter-spacing: 0.04em;
                text-transform: uppercase;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .media-capture-choice:not(.is-save) {
                border-color: rgba(232, 139, 139, 0.9);
                color: #f0b6b6;
            }
            .media-capture-choice.is-save {
                border-color: rgba(255, 255, 255, 0.22);
                color: #f4f4f3;
            }
            .media-capture-hint {
                text-align: center;
                font-size: 13px;
                line-height: 1.3;
                color: rgba(244, 244, 243, 0.92);
                margin: 0;
                text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
                max-width: 92vw;
            }
            .media-capture-actions[hidden] {
                display: none !important;
            }
            .media-capture-actions {
                display: flex;
                gap: 28px;
                justify-content: center;
                align-items: center;
                width: 100%;
                max-width: 360px;
                min-height: 72px;
            }
            .media-capture-side-btn {
                width: 48px;
                height: 48px;
                min-width: 48px;
                min-height: 48px;
                padding: 0;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #f4f4f3;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .media-capture-side-btn svg {
                width: 22px;
                height: 22px;
            }
            .media-capture-side-btn.is-on {
                color: #e6c37a;
                border-color: rgba(230, 195, 122, 0.45);
            }
            .media-capture-side-btn:disabled {
                opacity: 0.45;
                cursor: default;
            }
            .media-capture-shutter {
                width: 72px;
                height: 72px;
                min-width: 72px;
                min-height: 72px;
                border-radius: 50%;
                padding: 0;
                border: 3px solid #ffffff;
                background: transparent;
                box-shadow: none;
                backdrop-filter: none;
                -webkit-backdrop-filter: none;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                touch-action: none;
                user-select: none;
                -webkit-user-select: none;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
            }
            .media-capture-shutter-inner {
                width: 58px;
                height: 58px;
                border-radius: 50%;
                background: transparent;
                border: 2px solid rgba(255, 255, 255, 0.35);
                pointer-events: none;
                transition: width 0.15s ease, height 0.15s ease, border-radius 0.15s ease, background 0.15s ease;
            }
            .media-capture-shutter.is-recording {
                border-color: #e88b8b;
            }
            .media-capture-shutter.is-recording .media-capture-shutter-inner {
                width: 28px;
                height: 28px;
                border-radius: 6px;
                border: none;
                background: #e88b8b;
            }
            .media-capture-flash {
                position: absolute;
                inset: 0;
                z-index: 4;
                background: #fff;
                opacity: 0;
                pointer-events: none;
            }
            .media-capture-flash.is-on {
                animation: mediaCaptureFlash 0.22s ease-out;
            }
            @keyframes mediaCaptureFlash {
                0% { opacity: 0.85; }
                100% { opacity: 0; }
            }
            .media-capture-shutter {
                transition: transform 0.12s ease;
            }
            .media-capture-shutter.is-shot {
                transform: scale(0.9);
            }
            .media-capture-shutter.is-shot .media-capture-shutter-inner {
                transform: scale(0.82);
                transition: transform 0.12s ease;
            }
            .media-lightbox-image {
                transform-origin: center center;
                touch-action: none;
            }
            .chat-attach-list:not([hidden]),
            .ai-attach-list:not([hidden]) {
                display: flex !important;
            }
            .chat-msg-attachments {
                display: flex;
                flex-direction: column;
                align-items: flex-start;
                gap: 4px;
                margin: 0 0 4px;
                max-width: 100%;
                overflow: hidden;
            }
            .chat-msg-image-wrap {
                display: block;
                align-self: flex-start;
                border-radius: 12px;
                overflow: hidden;
                max-width: min(280px, 78vw, 100%);
                cursor: pointer;
                background: transparent;
                border: none;
                box-shadow: none;
                -webkit-tap-highlight-color: transparent;
            }
            .chat-msg-image {
                display: block;
                width: 100%;
                height: auto;
                max-height: min(360px, 52vh);
                object-fit: cover;
                pointer-events: none;
                background: transparent;
            }
            .chat-msg-video-wrap {
                position: relative;
                display: block;
                align-self: flex-start;
                width: min(280px, 78vw, 100%);
                max-width: 100%;
                aspect-ratio: 16 / 10;
                height: auto;
                min-height: 0;
                margin: 0;
                padding: 0;
                border: 0 !important;
                outline: none;
                appearance: none;
                -webkit-appearance: none;
                border-radius: 12px;
                overflow: hidden;
                isolation: isolate;
                background: #141414;
                cursor: pointer;
                box-shadow: none;
                -webkit-tap-highlight-color: transparent;
            }
            .chat-msg-video-thumb {
                display: block;
                width: 100%;
                height: 100%;
                object-fit: cover;
                background: #141414;
                pointer-events: none;
            }
            /* Voice / video / circle / image alone: no ink plate; time outside. */
            .chat-msg-unit.is-bare-media {
                width: fit-content;
                max-width: 70%;
                background: transparent !important;
                gap: 4px;
            }
            .chat-msg-unit.is-bare-media.is-mine {
                max-width: 75%;
            }
            #chatManagerContainer .chat-msg-unit.is-bare-media.is-peer {
                width: fit-content;
                max-width: min(70%, 320px);
            }
            #chatManagerContainer .chat-msg-unit.is-bare-media.is-mine {
                width: fit-content;
                max-width: min(75%, 320px);
            }
            .chat-msg-unit.is-bare-media .chat-msg-media-shell {
                position: relative;
                display: block;
                width: fit-content;
                max-width: 100%;
                background: transparent !important;
                background-image: none !important;
                border: none !important;
                box-shadow: none !important;
                padding: 0;
                margin: 0;
                overflow: visible;
            }
            .chat-msg-unit.is-voice-msg .chat-msg-media-shell {
                background-image: var(--ink-stack) !important;
                background-color: var(--ink-bg, #252525) !important;
                border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.12)) !important;
                border-radius: 12px;
                box-shadow: var(--ink-shadow);
                overflow: hidden;
                padding: 6px 8px;
            }
            .chat-msg-unit.is-bare-media .chat-msg-attachments {
                margin: 0;
                max-width: 100%;
                width: fit-content;
            }
            .chat-msg-unit.is-mine .chat-msg-attachments {
                align-items: flex-end;
            }
            .chat-msg-unit.is-mine .chat-msg-video-wrap,
            .chat-msg-unit.is-mine .chat-msg-image-wrap {
                align-self: flex-end;
            }
            .chat-msg-unit.is-circle-msg .chat-msg-circle {
                width: 200px;
                height: 200px;
                max-width: min(200px, 62vw);
                max-height: min(200px, 62vw);
                aspect-ratio: 1 / 1;
                border-radius: 50% !important;
                overflow: hidden !important;
                border: none !important;
                box-shadow: none !important;
            }
            .chat-msg-unit.is-bare-media .chat-msg-head {
                margin-bottom: 4px;
                max-width: 100%;
                min-width: 0;
            }
            .chat-msg-unit.is-voice-msg .chat-msg-voice {
                background: transparent;
                border: none;
                padding: 0;
                min-width: min(200px, 64vw);
            }
            /* Image / video: media only — no ink frame (Telegram). */
            .chat-msg-unit.is-image-msg .chat-msg-media-shell,
            .chat-msg-unit.is-video-msg .chat-msg-media-shell {
                background: transparent !important;
                background-image: none !important;
                border: none !important;
                box-shadow: none !important;
                padding: 0;
                overflow: visible;
            }
            .chat-msg-unit.is-image-msg .chat-msg-image-wrap {
                max-width: min(280px, 78vw);
                border-radius: 12px;
                background: transparent;
                border: none;
                box-shadow: none;
            }
            .chat-msg-unit.is-image-msg .chat-msg-image {
                max-height: min(360px, 52vh);
                border-radius: 12px;
            }
            .chat-msg-unit.is-video-msg .chat-msg-video-wrap {
                display: block;
                width: min(280px, 78vw);
                max-width: 100%;
                aspect-ratio: 16 / 10;
                border-radius: 12px;
                overflow: hidden;
                isolation: isolate;
                background: #141414;
                border: none !important;
                box-shadow: none;
                align-self: auto;
            }
            .chat-msg-unit.is-video-msg .chat-msg-video-thumb {
                display: block;
                width: 100%;
                height: 100%;
                object-fit: cover;
                object-position: center;
                background: #141414;
            }
            .chat-msg-media-play {
                position: absolute;
                inset: 0;
                display: flex;
                align-items: center;
                justify-content: center;
                border: 0;
                background: transparent;
                cursor: pointer;
                padding: 0;
                pointer-events: none;
            }
            .chat-msg-media-play span {
                width: 48px;
                height: 48px;
                min-width: 48px;
                min-height: 48px;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: none;
                color: #fafaf9;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .chat-msg-media-play svg {
                width: 20px;
                height: 20px;
                margin-left: 2px;
            }
            .chat-msg-file {
                display: inline-flex;
                align-items: center;
                gap: 6px;
                padding: 8px 10px;
                border-radius: 10px;
                background: #252525;
                color: #dcdcda;
                text-decoration: none;
                font-size: 13px;
                word-break: break-word;
            }
            .chat-msg-circle {
                position: relative;
                display: block;
                /* Telegram-like circle size (no ink ring). */
                width: 200px;
                height: 200px;
                border-radius: 50%;
                overflow: hidden;
                isolation: isolate;
                background: #141414;
                border: none;
                box-shadow: none;
                flex-shrink: 0;
                cursor: pointer;
                -webkit-tap-highlight-color: transparent;
                appearance: none;
                -webkit-appearance: none;
                padding: 0;
                margin: 0;
            }
            .chat-msg-circle-video {
                display: block;
                width: 100%;
                height: 100%;
                object-fit: cover;
                border-radius: 50%;
                background: #141414;
                pointer-events: none;
            }
            .chat-msg-circle .chat-msg-media-play {
                background: rgba(16, 16, 16, 0.22);
                transition: opacity 0.15s ease;
            }
            .chat-msg-circle.is-playing .chat-msg-media-play {
                opacity: 0;
                pointer-events: none;
            }
            .chat-voice-bar {
                display: none;
                align-items: center;
                gap: 10px;
                margin: 0 0 8px;
                padding: 10px 12px;
                border-radius: var(--radius-header, 14px);
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                color: #f4f4f3;
            }
            .chat-voice-bar:not([hidden]) {
                display: flex !important;
            }
            .chat-composer.is-voice-recording .ai-composer-dock {
                opacity: 0.55;
                pointer-events: none;
            }
            .chat-voice-pulse {
                width: 10px;
                height: 10px;
                border-radius: 50%;
                background: #e88b8b;
                box-shadow: 0 0 0 0 rgba(232, 139, 139, 0.45);
                animation: chat-send-rec-pulse 1.15s ease-in-out infinite;
                flex: 0 0 auto;
            }
            .chat-voice-timer {
                font-variant-numeric: tabular-nums;
                font-weight: 600;
                font-size: 13px;
                color: #f5cece;
                min-width: 3.2em;
            }
            .chat-voice-hint {
                font-size: 12px;
                color: #a6a6a6;
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }
            .chat-msg-voice {
                display: flex;
                align-items: center;
                gap: 10px;
                min-width: min(220px, 68vw);
                max-width: 100%;
                padding: 8px 10px;
                border-radius: 12px;
                background: rgba(255, 255, 255, 0.06);
                border: 1px solid rgba(255, 255, 255, 0.08);
            }
            .chat-msg-voice-play {
                width: 36px;
                height: 36px;
                min-width: 36px;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                color: #e8e8e7;
                display: inline-flex;
                align-items: center;
                justify-content: center;
                padding: 0;
                cursor: pointer;
            }
            .chat-msg-voice-play svg {
                width: 16px;
                height: 16px;
            }
            .chat-msg-voice.is-playing .chat-msg-voice-play {
                color: #dcdcda;
                border-color: rgba(245, 245, 244, 0.45);
            }
            .chat-msg-voice-wave {
                display: flex;
                align-items: flex-end;
                gap: 3px;
                height: 18px;
                flex: 1 1 auto;
            }
            .chat-msg-voice-wave span {
                width: 3px;
                border-radius: 2px;
                background: rgba(220, 220, 218, 0.75);
                height: 40%;
            }
            .chat-msg-voice-wave span:nth-child(2) { height: 70%; }
            .chat-msg-voice-wave span:nth-child(3) { height: 100%; }
            .chat-msg-voice-wave span:nth-child(4) { height: 55%; }
            .chat-msg-voice-wave span:nth-child(5) { height: 80%; }
            .chat-msg-voice.is-playing .chat-msg-voice-wave span {
                animation: chat-voice-wave 0.9s ease-in-out infinite;
            }
            .chat-msg-voice.is-playing .chat-msg-voice-wave span:nth-child(2) { animation-delay: 0.1s; }
            .chat-msg-voice.is-playing .chat-msg-voice-wave span:nth-child(3) { animation-delay: 0.2s; }
            .chat-msg-voice.is-playing .chat-msg-voice-wave span:nth-child(4) { animation-delay: 0.15s; }
            .chat-msg-voice.is-playing .chat-msg-voice-wave span:nth-child(5) { animation-delay: 0.05s; }
            @keyframes chat-voice-wave {
                0%, 100% { transform: scaleY(0.55); }
                50% { transform: scaleY(1); }
            }
            .chat-msg-voice-label {
                font-size: 12px;
                color: #a6a6a6;
                flex: 0 0 auto;
            }
            .chat-circle-overlay {
                position: fixed;
                inset: 0;
                z-index: 80;
                display: none;
                align-items: flex-end;
                justify-content: center;
                padding: 0 16px calc(var(--footer-offset, 80px) + 56px);
                background: transparent;
                pointer-events: none;
            }
            .chat-circle-overlay:not([hidden]) {
                display: flex !important;
            }
            .chat-circle-overlay[hidden] {
                display: none !important;
            }
            .chat-circle-trash {
                position: fixed;
                left: max(16px, var(--bp-safe-left, env(safe-area-inset-left, 0px)));
                bottom: calc(var(--footer-offset, 80px) + 92px);
                z-index: 120;
                width: 52px;
                height: 52px;
                border-radius: 50%;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                color: #e8e8e7;
                display: none;
                align-items: center;
                justify-content: center;
                padding: 0;
                pointer-events: auto;
                touch-action: manipulation;
                -webkit-tap-highlight-color: transparent;
                transition: transform 0.18s ease, background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
            }
            .chat-circle-trash:not([hidden]) {
                display: flex !important;
            }
            .chat-circle-overlay.is-review .chat-circle-trash {
                display: flex;
            }
            .chat-circle-trash svg {
                width: 22px;
                height: 22px;
                display: block;
            }
            .chat-circle-trash.is-hot,
            .chat-circle-overlay.is-cancel .chat-circle-trash {
                background: rgba(232, 139, 139, 0.42);
                border-color: rgba(232, 139, 139, 0.55);
                color: #f8e2e2;
                transform: scale(1.12);
            }
            .chat-circle-preview-wrap {
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 10px;
                transform: translateX(0) scale(1);
                opacity: 1;
                transition: transform 0.2s ease, opacity 0.2s ease;
            }
            .chat-circle-overlay.is-review .chat-circle-preview-wrap,
            .chat-circle-overlay:not([hidden]) .chat-circle-preview-wrap {
                pointer-events: auto;
                touch-action: none;
            }
            .chat-circle-overlay.is-discard .chat-circle-preview-wrap {
                animation: chat-circle-discard 0.3s ease-in forwards;
            }
            .chat-circle-overlay.is-send-out .chat-circle-preview-wrap {
                animation: chat-circle-send-out 0.22s ease-in forwards;
            }
            @keyframes chat-circle-discard {
                to { transform: translateX(-160px) scale(0.35); opacity: 0; }
            }
            @keyframes chat-circle-send-out {
                to { transform: scale(0.2); opacity: 0; }
            }
            .chat-circle-stage {
                position: relative;
                width: 200px;
                height: 200px;
                border-radius: 50%;
                overflow: hidden;
                background: #252525;
                border: 3px solid #f5f5f4;
                box-shadow: 0 0 0 6px rgba(245, 245, 244, 0.18);
                transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
            }
            .chat-circle-overlay.is-cancel .chat-circle-stage {
                border-color: #e88b8b;
                box-shadow: 0 0 0 6px rgba(232, 139, 139, 0.2);
            }
            .chat-circle-placeholder {
                position: absolute;
                inset: 0;
                z-index: 2;
                display: flex;
                align-items: center;
                justify-content: center;
                background: #252525;
                pointer-events: none;
            }
            .chat-circle-placeholder-icon {
                width: 72px;
                height: 72px;
                border-radius: 18px;
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                color: #e8e8e7;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .chat-circle-placeholder-icon svg {
                width: 32px;
                height: 32px;
            }
            .chat-circle-preview {
                position: absolute;
                inset: 0;
                width: 100%;
                height: 100%;
                object-fit: cover;
                display: block;
                background: #252525;
                opacity: 0;
                border: 0;
            }
            .chat-circle-stage.is-live .chat-circle-placeholder {
                display: none;
            }
            .chat-circle-stage.is-live .chat-circle-preview {
                opacity: 1;
            }
            .chat-circle-preview::-webkit-media-controls,
            .chat-circle-preview::-webkit-media-controls-start-playback-button,
            .chat-circle-preview::-webkit-media-controls-overlay-play-button {
                display: none !important;
            }
            .chat-circle-timer {
                color: #e88b8b;
                font-size: 18px;
                font-weight: 700;
                letter-spacing: 0.06em;
            }
            .chat-circle-overlay.is-review .chat-circle-timer {
                visibility: hidden;
            }
            .chat-circle-hint {
                color: var(--text-muted, #a6a6a6);
                font-size: 13px;
                text-align: center;
            }
            .bp-drop-veil {
                position: fixed;
                inset: 0;
                z-index: 20000;
                display: flex;
                align-items: center;
                justify-content: center;
                padding: 24px;
                box-sizing: border-box;
                background: rgba(40, 40, 40, 0.46);
                backdrop-filter: blur(16px) saturate(140%);
                -webkit-backdrop-filter: blur(16px) saturate(140%);
                opacity: 0;
                visibility: hidden;
                pointer-events: none;
                transition: opacity 0.18s ease, visibility 0.18s ease;
            }
            .bp-drop-veil.is-on {
                opacity: 1;
                visibility: visible;
                pointer-events: auto;
            }
            .bp-drop-veil-card {
                display: flex;
                flex-direction: column;
                align-items: center;
                gap: 8px;
                min-width: min(280px, 86vw);
                padding: 28px 32px;
                border-radius: 18px;
                border: 1px dashed rgba(245, 245, 244, 0.65);
                background: rgba(16, 16, 16, 0.72);
                box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
                color: #e8e8e7;
                transform: translateY(10px) scale(0.98);
                transition: transform 0.22s ease;
            }
            .bp-drop-veil.is-on .bp-drop-veil-card {
                transform: none;
            }
            .bp-drop-veil-icon {
                width: 28px;
                height: 28px;
                color: #dcdcda;
                animation: bpDropFloat 1.1s ease-in-out infinite;
            }
            .bp-drop-veil-title {
                font-size: 15px;
                font-weight: 600;
                letter-spacing: 0.02em;
            }
            .bp-drop-veil-hint {
                font-size: 12px;
                color: #a6a6a6;
            }
            @keyframes bpDropFloat {
                0%, 100% { transform: translateY(0); }
                50% { transform: translateY(-4px); }
            }
            .media-lightbox-overlay {
                display: none;
                position: fixed;
                inset: 0;
                z-index: 22100;
                align-items: center;
                justify-content: center;
                padding: 0;
                box-sizing: border-box;
                background: transparent;
            }
            .media-lightbox-overlay.is-open,
            .media-lightbox-overlay:not([hidden]) {
                display: flex !important;
            }
            .media-lightbox-scrim {
                position: absolute;
                inset: 0;
                z-index: 0;
                background: var(--glass-scrim-bg, rgba(22, 22, 22, 0.58));
                backdrop-filter: var(--glass-scrim-blur, blur(24px) saturate(150%));
                -webkit-backdrop-filter: var(--glass-scrim-blur, blur(24px) saturate(150%));
                pointer-events: auto;
            }
            .media-lightbox-stage {
                position: absolute;
                inset: 0;
                z-index: 1;
                display: flex;
                align-items: center;
                justify-content: center;
                width: auto;
                height: auto;
                max-width: none;
                max-height: none;
                /* No side padding — chrome floats over the image, does not shift it. */
                padding: 0;
                box-sizing: border-box;
                pointer-events: auto;
            }
            .media-lightbox-image,
            .media-lightbox-video {
                pointer-events: auto;
                max-width: 100%;
                max-height: 100%;
                width: auto;
                height: auto;
                object-fit: contain;
                border-radius: 0;
                background: transparent;
                box-shadow: none;
            }
            .media-lightbox-image[hidden],
            .media-lightbox-video[hidden],
            .media-lightbox-controls[hidden] {
                display: none !important;
            }
            .media-lightbox-overlay.is-image .media-lightbox-video,
            .media-lightbox-overlay.is-image .media-lightbox-controls {
                display: none !important;
            }
            .media-lightbox-overlay.is-video .media-lightbox-image {
                display: none !important;
            }
            .media-lightbox-video::-webkit-media-controls,
            .media-lightbox-video::-webkit-media-controls-start-playback-button,
            .media-lightbox-video::-webkit-media-controls-overlay-play-button {
                display: none !important;
            }
            .media-lightbox-controls {
                position: absolute;
                left: 50%;
                bottom: max(16px, var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
                transform: translateX(-50%);
                z-index: 3;
                display: flex;
                align-items: center;
                gap: 8px;
                width: min(520px, calc(100% - 120px));
                padding: 10px 12px;
                border-radius: var(--radius-header, 14px);
                border: 1px solid var(--glass-border);
                background: var(--glass-highlight);
                background-color: var(--glass-bg);
                backdrop-filter: var(--glass-blur);
                -webkit-backdrop-filter: var(--glass-blur);
                box-shadow: var(--glass-shadow);
                box-sizing: border-box;
            }
            .media-lightbox-overlay.is-image .media-lightbox-controls {
                display: none !important;
            }
            .media-lightbox-skip,
            .media-lightbox-play {
                flex: 0 0 auto;
                min-width: 44px;
                min-height: 44px;
                padding: 0 10px;
                border-radius: var(--radius-btn);
                border: 1px solid var(--glass-border);
                background: rgba(16, 16, 16, 0.35);
                color: #e8e8e7;
                font: inherit;
                font-size: 12px;
                font-weight: 600;
                cursor: pointer;
                display: inline-flex;
                align-items: center;
                justify-content: center;
            }
            .media-lightbox-play svg {
                width: 18px;
                height: 18px;
            }
            .media-lightbox-clock {
                flex: 0 0 auto;
                font-size: 11px;
                font-variant-numeric: tabular-nums;
                color: #a6a6a6;
                min-width: 2.4em;
            }
            .media-lightbox-seek {
                flex: 1 1 auto;
                min-width: 0;
                height: 4px;
                -webkit-appearance: none;
                appearance: none;
                background: rgba(255, 255, 255, 0.16);
                border-radius: 999px;
                outline: none;
            }
            .media-lightbox-seek::-webkit-slider-thumb {
                -webkit-appearance: none;
                appearance: none;
                width: 16px;
                height: 16px;
                border-radius: 50%;
                background: #f5f5f4;
                border: 0;
                cursor: pointer;
            }
            .media-lightbox-seek::-moz-range-thumb {
                width: 16px;
                height: 16px;
                border-radius: 50%;
                background: #f5f5f4;
                border: 0;
                cursor: pointer;
            }
            .media-lightbox-overlay.is-chrome-hidden .media-lightbox-controls {
                opacity: 0;
                pointer-events: none;
            }
            @media (max-width: 600px) {
                .media-lightbox-stage {
                    padding: 0;
                }
                .media-lightbox-controls {
                    width: calc(100% - 24px);
                    left: 12px;
                    transform: none;
                }
            }
            button:not(.media-capture-shutter):not(:disabled),
            [role="button"]:not(:disabled) {
                transition: scale 0.12s ease, background-color 0.12s ease, background 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease !important;
            }
            /* One hover/focus contour for every ordinary control, matching the
               generated-document card and its Download button. */
            
            
            button.revoked-btn:active,
            button.revoked-btn:focus,
            button.revoked-btn:focus-visible,
            button.error-btn:active,
            button.error-btn:focus,
            button.error-btn:focus-visible,
            button.danger:active,
            button.danger:focus,
            button.danger:focus-visible,
            button.is-danger:active,
            button.is-danger:focus,
            button.is-danger:focus-visible {
                color: #fff !important;
                background-color: #e88b8b !important;
                border-color: #e88b8b !important;
                box-shadow: none !important;
                outline: none !important;
            }
            button.confirm-ok:not(.is-primary):hover,
            button.confirm-ok:not(.is-primary):active,
            button.confirm-ok:not(.is-primary):focus,
            button.confirm-ok:not(.is-primary):focus-visible,
            button.chat-confirm-ok:hover,
            button.chat-confirm-ok:active,
            button.chat-confirm-ok:focus,
            button.chat-confirm-ok:focus-visible,
            button.scp-modal-btn.danger:active,
            button.notes-modal-btn.danger:active,
            button.revoked-btn:active,
            #confirmRevokeBtn:active {
                border-color: #e88b8b !important;
                color: #fff !important;
                background-color: #d67070 !important;
                box-shadow: none !important;
            }
            a.nav-btn:not(.nav-logout):hover,
            a.nav-btn:not(.nav-logout):active,
            .nav-btn:not(.nav-logout):hover,
            .nav-btn:not(.nav-logout):active {
                background: transparent !important;
                background-color: transparent !important;
                border-color: transparent !important;
                box-shadow: none !important;
                scale: 1;
            }
            button.scp-drop-half:hover,
            button.scp-drop-half:active {
                background-color: transparent !important;
                background-image: none !important;
                box-shadow: none !important;
                border-color: transparent !important;
                color: #f4f4f3 !important;
                scale: 1;
            }
            button.card-action-btn.is-danger:active {
                border-color: #e88b8b !important;
                color: #f5cece !important;
                background-color: rgba(232, 139, 139, 0.22) !important;
                box-shadow: none !important;
            }
            .media-capture-choice:not(.is-save):active {
                border-color: #e88b8b !important;
                color: #f5cece !important;
                background-color: rgba(232, 139, 139, 0.2) !important;
                box-shadow: none !important;
            }
            .media-capture-shutter:active {
                border-color: #f5f5f4 !important;
                box-shadow: 0 0 0 1px #f5f5f4 !important;
                scale: 0.94;
            }
            /* Ink cards are not <button>s.  Put their contour rule last so the
               older ink/cursor-glow rules cannot mute the document-style glow. */
            html.has-cursor-glow .notes-list > .note-item:hover,
            html.has-cursor-glow .notes-list > .note-item:focus-within,
            html.has-cursor-glow .notes-list > .note-item:focus-visible,
            html.has-cursor-glow .file-list .file-item:hover,
            html.has-cursor-glow .file-list .file-item:focus-within,
            html.has-cursor-glow .file-list .file-item:focus-visible,
            html .notes-list > .note-item:hover,
            html .notes-list > .note-item:focus-within,
            html .notes-list > .note-item:focus-visible,
            html .file-list .file-item:hover,
            html .file-list .file-item:focus-within,
            html .file-list .file-item:focus-visible,
            html .notes-create-cta:hover,
            html .notes-create-cta:focus-visible,
            html .scp-drop:hover,
            html .scp-drop:focus-visible,
            html .scp-drop.dragover,
            html .scp-mkdir-btn:hover,
            html .scp-mkdir-btn:focus-visible{
                border-color: var(--accent-color) !important;
                box-shadow: none !important;
                outline: none;
            }
            /* One geometry/opacity for all action colors. Keep this after the
               legacy !important resets (TECH, navigation, danger and success). */
            html body :is(button, [role="button"], input[type="button"], input[type="submit"], a.nav-btn, a.card-action-btn, a.ai-document-action, summary, select){
                --control-rgb: 245, 245, 244;
            }
            html body :is(button, [role="button"], input[type="button"], input[type="submit"], a.nav-btn, a.card-action-btn):is(
                .success, .is-success, .notes-save-btn,
                .is-on, .is-done, .media-capture-choice.is-save
            ){
                --control-rgb: 127, 209, 168;
            }
            html body :is(button, [role="button"], input[type="button"], input[type="submit"], a.nav-btn, a.card-action-btn):is(
                .danger, .is-danger, .revoked-btn, .error-btn,
                .has-alert, .nav-logout, .ai-msg-action-delete,
                .ai-history-item-del, .ai-attach-remove, .chat-confirm-ok,
                .confirm-ok:not(.is-primary), .media-capture-choice:not(.is-save),
                #aiSendBtn.is-stop
            ){
                --control-rgb: 232, 139, 139;
            }
            html body :is(button, [role="button"], input[type="button"], input[type="submit"], a.nav-btn, a.card-action-btn, a.ai-document-action, summary, select):not(:disabled):not([aria-disabled="true"]):is(:hover, :focus-visible, :active){
                border-color: rgb(var(--control-rgb)) !important;
                box-shadow: none !important;
                outline: none;
            }
            @media (max-width: 600px) {
                html body :is(button, [role="button"], input[type="button"], input[type="submit"], a.nav-btn, a.ai-document-action, summary, select) {
                    min-height: 44px;
                    min-width: 44px;
                }
                .ai-msg-time { font-size: 10px; }
            }
            html body .ai-msg-actions button.ai-msg-action.ai-msg-action-delete:is(:hover, :focus-visible, :active) {
                background: transparent !important;
                background-color: transparent !important;
                color: var(--danger-text) !important;
            }
            
            
            
            /* Same visible cross and hit target in every window. */
            html body button:is(.close-btn, .ai-sheet-close, .ai-document-close, .scp-preview-close, .note-viewer-close, .note-image-lightbox-close, .media-lightbox-x){
                display: inline-flex !important;
                align-items: center !important;
                justify-content: center !important;
                width: 44px !important;
                height: 44px !important;
                min-width: 44px !important;
                min-height: 44px !important;
                flex: 0 0 44px !important;
                padding: 0 !important;
                border-radius: 50% !important;
                font-family: Arial, sans-serif !important;
                font-size: 32px !important;
                font-weight: 400 !important;
                line-height: 1 !important;
            }
            .ai-msg-actions {
                flex-wrap: wrap;
                max-width: 100%;
            }
            .ai-msg-actions > .ai-msg-time {
                display: inline-block;
                margin-left: 6px;
                align-self: center;
                color: var(--text-muted);
            }
            .ai-msg-unit:not(.is-user) > .ai-msg-actions > .ai-msg-time { margin: 0 8px 0 0; }
            .ai-msg-card > .ai-msg-time {
                align-self: flex-end;
                margin-top: 4px;
            }
            #aiHistorySheet > .modal-content { box-sizing: border-box; }
            #aiHistorySheet [id^="aiHistoryView"],
            #aiHistorySheet [id^="aiShareView"],
            #aiHistorySheet #aiChatShareView { overflow: visible; }
            #aiHistorySheet .modal-header {
                min-height: 44px;
                min-width: 0;
                flex: 0 0 auto;
                box-sizing: border-box;
                overflow: visible;
                padding-right: 4px;
            }
            #aiHistorySheet .modal-header h3 { min-width: 0; }
            #aiHistorySheet .ai-sheet-head-end { flex: 0 0 auto; }
           

            
            

            /* Navy palette: floating capsule chrome with soft, borderless edges. */
            body > header,
            html.has-cursor-glow body > header {
                width: calc(100% - 48px);
                max-width: 1360px;
                margin: 0 auto;
                left: 0;
                right: 0;
                top: calc(14px + var(--bp-safe-top, env(safe-area-inset-top, 0px)));
                bottom: auto;
                padding: 4px 18px;
                min-height: 48px;
                border: 0;
                border-radius: 999px;
                background-image: none;
                background-color: var(--header-bg);
                box-shadow: 0 12px 36px rgba(12, 12, 12, 0.24);
            }
            @media (min-width: 601px) {
                .control-panel { min-height: 40px; }
                .panel-nav { padding-block: 0; }
                .panel-nav .nav-btn { min-height: 40px; }
            }
            @media (min-width: 601px) and (max-width: 980px) {
                body > header,
                html.has-cursor-glow body > header {
                    width: calc(100% - 24px);
                    padding-inline: 12px;
                }
            }
            @media (max-width: 600px) {
                body > header,
                html.has-cursor-glow body > header {
                    top: auto;
                    bottom: calc(8px + var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
                    width: calc(100% - 16px);
                    min-height: 0;
                    padding: 6px 10px;
                    border: 0;
                    border-radius: 30px;
                    box-shadow: 0 8px 28px rgba(12, 12, 12, 0.28);
                }
                .panel-nav .nav-btn,
                body > header .nav-logout {
                    min-height: 44px;
                    min-width: 44px;
                }
                
            }


html > body > header,
html.has-cursor-glow body > header,
html body .ai-composer-bar,
html.has-cursor-glow body .ai-composer-bar,
html body .auth-card,
html.has-cursor-glow body .auth-card,
html body .stub-box,
html.has-cursor-glow body .stub-box,
html body #scpManagerContainer .file-item,
html.has-cursor-glow body #scpManagerContainer .file-item,
html.has-cursor-glow body #scpManagerContainer .file-item:hover,
html.has-cursor-glow body #scpManagerContainer .file-item:active,
html.has-cursor-glow body #scpManagerContainer .file-item.dragover,
html body #scpManagerContainer .scp-drop,
html.has-cursor-glow body #scpManagerContainer .scp-drop,
html.has-cursor-glow body #scpManagerContainer .scp-drop:hover,
html.has-cursor-glow body #scpManagerContainer .scp-drop:active,
html.has-cursor-glow body #scpManagerContainer .scp-drop.dragover,
html body #scpManagerContainer .scp-drop-half,
html.has-cursor-glow body #scpManagerContainer .scp-drop-half,
html.has-cursor-glow body #scpManagerContainer .scp-drop-half:hover,
html.has-cursor-glow body #scpManagerContainer .scp-drop-half:active,
html.has-cursor-glow body #scpManagerContainer .scp-drop-half.dragover,
html body #notesManagerContainer .note-item,
html.has-cursor-glow body #notesManagerContainer .note-item,
html.has-cursor-glow body #notesManagerContainer .note-item:hover,
html.has-cursor-glow body #notesManagerContainer .note-item:active,
html.has-cursor-glow body #notesManagerContainer .note-item.dragover,
html body #notesManagerContainer .notes-create-cta,
html.has-cursor-glow body #notesManagerContainer .notes-create-cta,
html.has-cursor-glow body #notesManagerContainer .notes-create-cta:hover,
html.has-cursor-glow body #notesManagerContainer .notes-create-cta:active,
html.has-cursor-glow body #notesManagerContainer .notes-create-cta.dragover,
html body #aiManagerContainer .ai-msg-user,
html.has-cursor-glow body #aiManagerContainer .ai-msg-user,
html body #aiManagerContainer .ai-msg-card:not(.ai-msg-bot):not(.ai-msg-error),
html.has-cursor-glow body #aiManagerContainer .ai-msg-card:not(.ai-msg-bot):not(.ai-msg-error){
    background-image: var(--glass-highlight) !important;
    background-color: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--glass-border) !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

/* Same grey rim as the full-screen document / note viewer window: the header
   keeps its blur plate and gets the viewer contour without the card shadow. */
html body > header,
html.has-cursor-glow body > header {
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
}

/* Flat translucent header trial: keep the glass fill, without a highlight gradient. */
html body > header,
html.has-cursor-glow body > header {
    background-image: none !important;
}

/* AI uses the flat translucent header material, including ported chrome. */
html.has-cursor-glow body #aiManagerContainer,
html.has-cursor-glow body #aiHistorySheet,
html.has-cursor-glow body #aiJumpSheet,
html.has-cursor-glow body #aiJumpNav,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools,
html.has-cursor-glow body.ai-flat-ui > header {
    --glass-highlight: none;
    --glass-window-stack: none;
    --glass-popover-fill: var(--glass-bg);
    --glass-inset: var(--glass-bg);
    --glass-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

html.has-cursor-glow body #aiManagerContainer,
html.has-cursor-glow body #aiManagerContainer *,
html.has-cursor-glow body #aiManagerContainer *::before,
html.has-cursor-glow body #aiManagerContainer *::after,
html.has-cursor-glow body #aiHistorySheet,
html.has-cursor-glow body #aiHistorySheet *,
html.has-cursor-glow body #aiHistorySheet *::before,
html.has-cursor-glow body #aiHistorySheet *::after,
html.has-cursor-glow body #aiJumpSheet,
html.has-cursor-glow body #aiJumpSheet *,
html.has-cursor-glow body #aiJumpSheet *::before,
html.has-cursor-glow body #aiJumpSheet *::after,
html.has-cursor-glow body #aiJumpNav,
html.has-cursor-glow body #aiJumpNav *,
html.has-cursor-glow body #aiJumpNav *::before,
html.has-cursor-glow body #aiJumpNav *::after,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported *,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported *::before,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported *::after,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported *,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported *::before,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported *::after,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools *,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools *::before,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools *::after,
html.has-cursor-glow body.ai-flat-ui > header *,
html.has-cursor-glow body.ai-flat-ui > header *::before,
html.has-cursor-glow body.ai-flat-ui > header *::after {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

html.has-cursor-glow body #aiManagerContainer :is(.ai-composer-bar,.ai-model-menu,.ai-model-option,.ai-model-chip,.ai-attach-menu,.ai-attach-option,.ai-attach-chip,.ai-file-chip,.ai-regen-menu,.ai-msg-user,.ai-msg-card:not(.ai-msg-bot):not(.ai-msg-error),.ai-document-artifact,.ai-document-artifact-open,.ai-md-pre,.stub-box,.ai-sheet,.ai-sheet-search,.ai-jump-search,.panel-head-menu-panel,.panel-search-field),
html.has-cursor-glow body .notes-md .ai-md-pre,
html.has-cursor-glow body #aiHistorySheet :is(.modal-content,.panel-search-field,.ai-history-item,.ai-rag-knowledge-card,.ai-jump-item,input:not([type="checkbox"]),button),
html.has-cursor-glow body #aiJumpSheet :is(.modal-content,.panel-search-field,.ai-history-item,.ai-jump-item,input:not([type="checkbox"]),button),
html.has-cursor-glow body #aiJumpNav :is(.ai-jump-menu,.ai-jump-search,.ai-jump-item),
html.has-cursor-glow body #aiHistorySheet :is(#aiShareGroupsList,#aiSharePeople,#aiChatSharePeople,#aiShareSelectedChips) > *,
html.has-cursor-glow body #aiDocumentPreview :is(.ai-document-bar,.ai-document-window,.ai-document-action,.ai-document-close),
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported .panel-head-menu-item,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported .panel-search-field,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools .panel-search-field {
    background-image: none !important;
    background-color: var(--ai-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: var(--ai-flat-shadow, 0 10px 28px rgba(0, 0, 0, 0.28)) !important;
}

/* Markdown notes use the same code/header/quote surfaces as AI answers. */
html.has-cursor-glow body .notes-md :is(.ai-md-pre-bar, .ai-md-quote, .ai-md-table-scroll, .ai-md-table, .ai-md-table th, .ai-md-table td) {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

html.has-cursor-glow body #aiManagerContainer :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body #aiManagerContainer :is(input,textarea):not(.ai-prompt-input):focus-visible,
html.has-cursor-glow body #aiHistorySheet :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body #aiHistorySheet :is(input,textarea):focus-visible,
html.has-cursor-glow body #aiJumpSheet :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body #aiJumpSheet :is(input,textarea):focus-visible,
html.has-cursor-glow body #aiJumpNav :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body #aiJumpNav :is(input,textarea):focus-visible,
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body.ai-flat-ui .panel-head-menu-panel.is-ported :is(input,textarea):focus-visible,
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body.ai-flat-ui .panel-search-tray.is-ported :is(input,textarea):focus-visible,
html.has-cursor-glow body.ai-flat-ui #headerPanelTools :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body.ai-flat-ui #headerPanelTools :is(input,textarea):focus-visible,
html.has-cursor-glow body.ai-flat-ui > header :is(button,[role="button"],[role="option"]):is(:hover,:focus-visible,:active,.is-active,.is-open,.is-pressed),
html.has-cursor-glow body.ai-flat-ui > header :is(input,textarea):focus-visible,
html.has-cursor-glow body #aiJumpNav .ai-jump-item.is-active {
    --ai-flat-bg: rgba(245, 245, 244, 0.16);
    --ai-flat-shadow: 0 0 18px rgba(245, 245, 244, 0.20);
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    color: #dcdcda !important;
}

html.has-cursor-glow body #aiManagerContainer .ai-model-menu-sep,
html.has-cursor-glow body #aiManagerContainer .ai-sheet::before,
html.has-cursor-glow body #aiHistorySheet .glass-accent,
html.has-cursor-glow body #aiJumpSheet .glass-accent {
    display: none !important;
}
html.has-cursor-glow body #aiDocumentPreview :is(.ai-document-bar,.ai-document-window,.ai-document-action,.ai-document-close) {
    border: 0 !important;
    outline: 0 !important;
}

/* One flat translucent material for every UI card, with no opaque fallback. */
html.has-cursor-glow {
    --glass-highlight: none;
    --glass-window-stack: none;
    --glass-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}
html.has-cursor-glow body .file-item,
html.has-cursor-glow body .file-item:hover,
html.has-cursor-glow body .file-item:active,
html.has-cursor-glow body .file-item.is-active,
html.has-cursor-glow body .file-item.dragover,
html.has-cursor-glow body .note-item,
html.has-cursor-glow body .note-item:hover,
html.has-cursor-glow body .note-item:active,
html.has-cursor-glow body .note-item.is-active,
html.has-cursor-glow body .note-item.dragover,
html.has-cursor-glow body .notes-create-cta,
html.has-cursor-glow body .notes-create-cta:hover,
html.has-cursor-glow body .notes-create-cta:active,
html.has-cursor-glow body .notes-create-cta.is-active,
html.has-cursor-glow body .notes-create-cta.dragover,
html.has-cursor-glow body .scp-drop,
html.has-cursor-glow body .scp-drop:hover,
html.has-cursor-glow body .scp-drop:active,
html.has-cursor-glow body .scp-drop.is-active,
html.has-cursor-glow body .scp-drop.dragover,
html.has-cursor-glow body .scp-drop-half,
html.has-cursor-glow body .scp-drop-half:hover,
html.has-cursor-glow body .scp-drop-half:active,
html.has-cursor-glow body .scp-drop-half.is-active,
html.has-cursor-glow body .scp-drop-half.dragover,
html.has-cursor-glow body .auth-card,
html.has-cursor-glow body .auth-card:hover,
html.has-cursor-glow body .auth-card:active,
html.has-cursor-glow body .auth-card.is-active,
html.has-cursor-glow body .auth-card.dragover,
html.has-cursor-glow body .stub-box,
html.has-cursor-glow body .stub-box:hover,
html.has-cursor-glow body .stub-box:active,
html.has-cursor-glow body .stub-box.is-active,
html.has-cursor-glow body .stub-box.dragover,
html.has-cursor-glow body .glass-card,
html.has-cursor-glow body .glass-card:hover,
html.has-cursor-glow body .glass-card:active,
html.has-cursor-glow body .glass-card.is-active,
html.has-cursor-glow body .glass-card.dragover,
html.has-cursor-glow body .notes-editor-wrap,
html.has-cursor-glow body .notes-editor-wrap:hover,
html.has-cursor-glow body .notes-editor-wrap:active,
html.has-cursor-glow body .notes-editor-wrap.is-active,
html.has-cursor-glow body .notes-editor-wrap.dragover,
html.has-cursor-glow body .notes-bulk-bar,
html.has-cursor-glow body .notes-bulk-bar:hover,
html.has-cursor-glow body .notes-bulk-bar:active,
html.has-cursor-glow body .notes-bulk-bar.is-active,
html.has-cursor-glow body .notes-bulk-bar.dragover,
html.has-cursor-glow body .files-bulk-bar,
html.has-cursor-glow body .files-bulk-bar:hover,
html.has-cursor-glow body .files-bulk-bar:active,
html.has-cursor-glow body .files-bulk-bar.is-active,
html.has-cursor-glow body .files-bulk-bar.dragover,
html.has-cursor-glow body .ai-sheet,
html.has-cursor-glow body .ai-sheet:hover,
html.has-cursor-glow body .ai-sheet:active,
html.has-cursor-glow body .ai-sheet.is-active,
html.has-cursor-glow body .ai-sheet.dragover{
    background-image: none !important;
    background-color: var(--ui-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}
html.has-cursor-glow body #scpManagerContainer :is(.file-item,.scp-drop,.scp-drop-half):is(:hover,:active,.dragover),
html.has-cursor-glow body #notesManagerContainer :is(.note-item,.notes-create-cta):is(:hover,:active){
    background-image: none !important;
    background-color: var(--ui-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

html.has-cursor-glow body .scp-preview-body {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}
html.has-cursor-glow body :is(.modal-content,.component-modal-card,.auth-card,.confirm-card,.choice-card,.error-card,.success-card) > .glass-accent {
    display: none !important;
}

html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools,.panel-head-menu-panel.is-ported,.panel-search-tray.is-ported),
html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools,.panel-head-menu-panel.is-ported,.panel-search-tray.is-ported) *,
html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools,.panel-head-menu-panel.is-ported,.panel-search-tray.is-ported) *::before,
html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools,.panel-head-menu-panel.is-ported,.panel-search-tray.is-ported) *::after,
html.has-cursor-glow body #aiDocumentPreview :is(button,.ai-document-bar,.ai-document-window) {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
html.has-cursor-glow body #aiDocumentPreview .glass-accent {
    display: none !important;
}
html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools .panel-search-field,.panel-head-menu-panel.is-ported,.panel-head-menu-panel.is-ported .panel-head-menu-item,.panel-search-tray.is-ported,.panel-search-tray.is-ported .panel-search-field),
html.has-cursor-glow body #aiDocumentPreview :is(.ai-document-bar,.ai-document-window,.ai-document-action,.ai-document-close) {
    background-image: none !important;
    background-color: var(--ai-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: var(--ai-flat-shadow, 0 10px 28px rgba(0, 0, 0, 0.28)) !important;
}
html.has-cursor-glow body.ai-flat-ui :is(#headerPanelTools,.panel-head-menu-panel.is-ported,.panel-search-tray.is-ported) :is(button,input,[role="menuitem"]):is(:hover,:focus-visible,:active,.is-active,.is-open),
html.has-cursor-glow body #aiDocumentPreview button:is(:hover,:focus-visible,:active) {
    --ai-flat-bg: rgba(245, 245, 244, 0.16);
    --ai-flat-shadow: 0 0 18px rgba(245, 245, 244, 0.20);
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
html.has-cursor-glow body :is(#aiHistorySheet,.modal-overlay,.component-modal-overlay) .notes-editor-wrap,
html.has-cursor-glow body :is(#aiHistorySheet,.modal-overlay,.component-modal-overlay) .notes-editor-wrap:hover,
html.has-cursor-glow body :is(#aiHistorySheet,.modal-overlay,.component-modal-overlay) .notes-editor-wrap:active,
html.has-cursor-glow body :is(#aiHistorySheet,.modal-overlay,.component-modal-overlay) .notes-editor-wrap.is-active{
    background-image: none !important;
    background-color: var(--ui-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
}

/* Shared dialogs and navigation also lose rings while the AI view is active. */
html.has-cursor-glow body.ai-flat-ui #modal-root *,
html.has-cursor-glow body.ai-flat-ui #modal-root *::before,
html.has-cursor-glow body.ai-flat-ui #modal-root *::after,
html.has-cursor-glow body.ai-flat-ui > header #headerPanelTools,
html.has-cursor-glow body.ai-flat-ui > header #headerPanelTools * {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
html.has-cursor-glow body.ai-flat-ui #modal-root :is(.modal-content,.component-modal-card,.confirm-card,.choice-card,.revoked-card,.error-card,.success-card,.panel-search-field,.ai-history-item,.ai-rag-knowledge-card,.ai-jump-item,.ai-sheet-search) {
    background-image: none !important;
    background-color: var(--ai-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--glass-border) !important;
    outline: 0 !important;
    box-shadow: var(--ai-flat-shadow, 0 10px 28px rgba(0, 0, 0, 0.28)) !important;
}
html.has-cursor-glow body.ai-flat-ui #modal-root :is(button,input,textarea):focus-visible,
html.has-cursor-glow body.ai-flat-ui > header :is(#headerPanelTools,.panel-nav,.nav-logout) :is(button,a):focus-visible {
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}

/* Neutral workspace wrappers; the translucent face belongs to the inner cards. */
html.has-cursor-glow body #scpManagerContainer > .scp-card,
html.has-cursor-glow body #notesManagerContainer > .notes-window{
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}



/* Nested tiles/popovers share the exact header fill, rather than a denser inset. */
html.has-cursor-glow {
    --glass-inset: var(--glass-bg);
    --glass-popover-fill: var(--glass-bg);
}
html.has-cursor-glow body .panel-head-menu-panel,
html.has-cursor-glow body :is(#headerPanelTools,.panel-head-menu-panel) .panel-head-menu-item{
    background-image: none !important;
    background-color: var(--ai-flat-bg, var(--glass-bg)) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    box-shadow: var(--ai-flat-shadow, 0 10px 28px rgba(0, 0, 0, 0.28)) !important;
}

/* Content cards and CTAs keep the flat header glass and soft interaction glow. */
:root {
    --card-contour-shadow: 0 0 0 1px rgba(245, 245, 244, 0.24),
        0 0 20px rgba(245, 245, 244, 0.18),
        0 6px 20px rgba(245, 245, 244, 0.12);
}
html:root body #scpManagerContainer .scp-body :is(.file-item, .scp-drop, .scp-mkdir-btn),
html:root body #notesManagerContainer .notes-panel-body :is(.note-item, .notes-create-cta){
    background-image: none !important;
    background-color: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 0 !important;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28) !important;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}
html:root body #scpManagerContainer .scp-mkdir-btn {
    min-height: 44px;
    border-radius: 12px;
    font-family: inherit;
    color: var(--text-color, #f4f4f3) !important;
}
html:root body #scpManagerContainer .scp-drop .scp-drop-half {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: 0 !important;
    box-shadow: none !important;
}
@media (min-width: 601px) {
    html:root body #scpManagerContainer .scp-mkdir-btn {
        border-radius: 14px;
    }
}
@media (hover: hover) and (pointer: fine) {
    html:root body #scpManagerContainer .scp-body :is(.file-item, .scp-drop, .scp-mkdir-btn):not(:disabled):hover,
    html:root body #notesManagerContainer .notes-panel-body :is(.note-item, .notes-create-cta):not(:disabled):hover{
        box-shadow: var(--card-contour-shadow) !important;
        transform: translateY(-1px);
    }
    
}
html:root body #scpManagerContainer .scp-body :is(.file-item, .scp-drop, .scp-mkdir-btn):not(:disabled):is(:focus-visible, :focus-within, :active, .is-selected, .is-drop-target, .dragover),
html:root body #notesManagerContainer .notes-panel-body :is(.note-item, .notes-create-cta):not(:disabled):is(:focus-visible, :focus-within, :active, .is-selected, .is-editing){
    box-shadow: var(--card-contour-shadow) !important;
}


/* AI's flat resets must not hide feedback on the shared navigation, including touch. */
html.has-cursor-glow body.ai-flat-ui > header a.nav-btn:not([aria-disabled="true"]):is(:hover, :active, :focus-visible) {
    box-shadow: none !important;
    outline: none;
}

/* Terminal and the session tabs now share the requested card glass. */



@media (hover: none), (pointer: coarse) {
    html:root body #scpManagerContainer .scp-body :is(.file-item, .scp-drop, .scp-mkdir-btn):active,
    html:root body #notesManagerContainer .notes-panel-body :is(.note-item, .notes-create-cta):active {
        transform: none;
    }
}

/* Typing stays plain inside the glass composer, including keyboard focus. */
html:root body #aiManagerContainer #aiPromptInput {
    background: transparent !important;
    color: var(--text-main, #f4f4f3) !important;
    -webkit-text-fill-color: var(--text-main, #f4f4f3) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    outline: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

/* RAG shares the attachment menu; the composer keeps a single row. */
.ai-attach-menu { box-sizing:border-box; overflow-y:auto; overscroll-behavior:contain; max-height:calc(100dvh - 120px); }
.ai-attach-option[hidden] { display:none; }
.ai-attach-rag { min-height:58px; }
.ai-attach-rag .ai-attach-option-body { flex:1 1 auto; }
.ai-rag-switch { position:relative; width:28px; height:16px; flex:0 0 28px; border-radius:999px; background:rgba(166, 166, 166,.22); transition:background .18s; }
.ai-rag-switch::after { content:''; position:absolute; left:3px; top:3px; width:10px; height:10px; border-radius:50%; background:#a6a6a6; transition:transform .18s,background .18s; }
.ai-attach-rag[aria-checked="true"] .ai-rag-switch { background:rgba(245, 245, 244,.3); }
.ai-attach-rag[aria-checked="true"] .ai-rag-switch::after { transform:translateX(12px); background:#dcdcda; }
#aiAttachOpenBtn { position:relative; }
.ai-attach-rag-dot { display:none; position:absolute; right:5px; top:5px; width:6px; height:6px; border-radius:50%; background:#d4d4d2; box-shadow:0 0 7px rgba(245, 245, 244,.55); pointer-events:none; }
#aiAttachOpenBtn.is-rag-on { color:#dcdcda; }
#aiAttachOpenBtn.is-rag-on .ai-attach-rag-dot { display:block; }
.visibility-toggle[data-flag="rag"] { min-height:44px; box-sizing:border-box; }

/* Explicit common knowledge action, using the same database glyph as the paperclip. */
.ai-msg-action.ai-msg-action-database {
    width:auto; min-width:44px; min-height:44px; gap:4px; padding:0 6px;
    font-size:11px; font-weight:500; flex:0 0 auto;
}
.ai-msg-action-database.is-saved { opacity:.85; }

/* Wider rights editor; the viewport remains the safety limit on short screens. */
#permsModal {
    padding: 12px;
}
#permsModal .modal-content {
    box-sizing: border-box;
    width: min(100%, 660px) !important;
    max-width: 660px !important;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 20px;
}









@media (max-width: 600px) {
    #permsModal .modal-content {
        max-width: 100% !important;
        padding: 16px;
    }
    
    
}

/* Saved knowledge lives in the history sheet; each source keeps its own height. */
.ai-msg-bot > .ai-msg-head { display:none; }
#aiRagViewHome .modal-header { flex:0 0 auto; gap:8px; align-items:center; }
#aiRagViewHome .modal-header h3 { flex:1 1 auto; min-width:0; }
#aiRagManageBtn, #aiRagViewHome .panel-head-icon-btn {
    width:44px; height:44px; min-width:44px; min-height:44px; flex:0 0 44px;
}
#aiRagKnowledgeList {
    display:flex; flex-direction:column; gap:10px; min-height:0;
    overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain;
    max-height:min(55dvh,460px); padding:2px 0 14px; scrollbar-width:thin;
}
#aiRagViewHome .ai-sheet-note { flex:0 0 auto; margin:0 0 12px; line-height:1.5; }
.ai-rag-knowledge-card {
    flex:0 0 auto; min-width:0; padding:12px; border-radius:var(--radius-btn,12px);
    border:1px solid var(--glass-border); background:var(--glass-inset);
    color:var(--text-main,#f4f4f3); overflow-wrap:anywhere;
}
.ai-rag-knowledge-top { display:flex; align-items:flex-start; gap:8px; min-width:0; }
.ai-rag-knowledge-open {
    display:flex; flex-direction:column; align-items:flex-start; justify-content:center;
    flex:1 1 auto; min-width:0; min-height:44px; gap:5px; padding:3px 0;
    border:0; border-radius:8px; background:transparent !important; box-shadow:none !important; color:inherit;
    font:inherit; text-align:left; cursor:pointer; overflow-wrap:anywhere;
}
.ai-rag-knowledge-title { font-size:13px; line-height:1.45; font-weight:600; }
html.has-cursor-glow body #aiHistorySheet .ai-rag-knowledge-card .ai-rag-knowledge-open {
    background:transparent !important; box-shadow:none !important;
    backdrop-filter:none !important; -webkit-backdrop-filter:none !important;
}
.ai-rag-knowledge-date { color:var(--text-muted,#a6a6a6); font-size:11px; line-height:1.4; }
.ai-rag-knowledge-delete {
    --control-rgb:232, 139, 139 !important;
    display:grid; place-items:center; width:44px; height:44px; min-width:44px; min-height:44px;
    flex:0 0 44px; padding:0; border:0; border-radius:9px; background:transparent;
    color:rgba(166, 166, 166,.8); cursor:pointer;
}
.ai-rag-knowledge-delete svg { width:17px; height:17px; }
.ai-rag-knowledge-delete:disabled { opacity:.45; cursor:wait; }
.ai-rag-knowledge-preview, .ai-rag-knowledge-content {
    margin:10px 0 0; color:var(--text-muted,#a6a6a6); font-size:13px; line-height:1.6;
    white-space:pre-wrap; overflow-wrap:anywhere;
}
.ai-rag-knowledge-content { color:var(--text-main,#f4f4f3); }
.ai-rag-knowledge-status, .ai-rag-knowledge-empty, .ai-rag-knowledge-error {
    flex:0 0 auto; margin:10px 0 14px; color:var(--text-muted,#a6a6a6);
    font-size:13px; line-height:1.6; overflow-wrap:anywhere;
}
.ai-rag-knowledge-content[hidden], .ai-rag-knowledge-preview[hidden] { display:none !important; }
.ai-rag-knowledge-retry, #aiRagKnowledgeRetry, #aiRagKnowledgeMore {
    min-height:44px; margin:10px 0 0; padding:10px 14px; flex:0 0 auto;
    border:1px solid var(--glass-border,rgba(166, 166, 166,.16)); border-radius:var(--radius-btn,12px);
    background:var(--glass-bg,rgba(28, 28, 28,.6)); color:var(--text-main,#f4f4f3);
    font:inherit; font-size:12px; cursor:pointer;
}
#aiRagKnowledgeMore { margin:0 0 14px; }
#aiRagViewHome [hidden] { display:none !important; }
.ai-rag-knowledge-heading { display:flex; align-items:center; gap:8px; min-width:0; }
.ai-rag-knowledge-heading svg { width:18px; height:18px; flex:0 0 18px; color:var(--text-muted,#a6a6a6); }
#aiRagKnowledgeBack { display:grid; place-items:center; width:44px; height:44px; min-width:44px; min-height:44px; }
#aiRagKnowledgeBack svg { width:20px; height:20px; }
.ai-rag-pending {
    margin:12px 0; padding:14px; min-width:0; border:1px solid rgba(166, 166, 166,.14);
    border-radius:var(--radius-btn,12px); background:#101010;
    color:var(--text-muted,#a6a6a6); font-size:13px; line-height:1.6;
    backdrop-filter:none; -webkit-backdrop-filter:none; overflow-wrap:anywhere;
}
.ai-rag-pending-text { white-space:pre-wrap; overflow-wrap:anywhere; }
.ai-rag-pending-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.ai-rag-pending-continue, .ai-rag-pending-cancel {
    min-height:44px; padding:10px 14px; border:1px solid var(--glass-border,rgba(166, 166, 166,.16));
    border-radius:var(--radius-btn,12px); background:var(--glass-bg,rgba(28, 28, 28,.6));
    color:var(--text-main,#f4f4f3); font:inherit; font-size:12px; cursor:pointer;
}
.ai-rag-pending-cancel { color:var(--text-muted,#a6a6a6); background:transparent; }
.ai-rag-pending-continue:disabled, .ai-rag-pending-cancel:disabled { opacity:.45; cursor:wait; }

/* RAG search reuses the AI composer bar: same glass, icon and plain input. */
.ai-rag-search { flex: 1 1 300px; min-width: 0; }
.ai-rag-search.ai-composer-bar { align-items: center; min-height: 48px; }
.ai-rag-search .ai-composer-icon-btn { width: 32px; height: 32px; flex: 0 0 32px; color: var(--text-muted, #a6a6a6); }
.ai-rag-search .ai-composer-icon-btn svg { width: 17px; height: 17px; }
html.has-cursor-glow body #aiRagViewHome .ai-rag-search.ai-composer-bar,
html body #aiRagViewHome .ai-rag-search.ai-composer-bar {
    border: 1px solid var(--glass-border) !important;
    box-shadow: var(--glass-shadow) !important;
    background-image: none !important;
    background-color: var(--glass-bg) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
}
/* The shared feedback layer highlights the bar, not the typed text. */
html.has-cursor-glow body #aiRagViewHome :is(#aiRagKnowledgeSearch,#aiRagPageUrl).ai-prompt-input,
html body #aiRagViewHome :is(#aiRagKnowledgeSearch,#aiRagPageUrl).ai-prompt-input {
    background: transparent !important; background-color: transparent !important;
    background-image: none !important; box-shadow: none !important;
    border: 0 !important; outline: none !important;
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    color: var(--text-main, #f4f4f3) !important;
    -webkit-text-fill-color: var(--text-main, #f4f4f3) !important;
    text-shadow: none !important;
}
#aiRagViewHome :is(#aiRagKnowledgeSearch,#aiRagPageUrl)::placeholder { color: #a6a6a6; }
html body #aiRagViewHome #aiRagPageUrl.ai-prompt-input:disabled { opacity: .6; cursor: progress; }

/* AI list glow gutters: keep the halo inside the scrollport and over adjacent rows. */
html.has-cursor-glow body :is(#aiHistoryList,#aiJumpSheetList,#aiJumpList) {
    box-sizing: border-box;
    width: calc(100% + 40px);
    padding: 20px;
    margin-left: -20px;
    margin-right: -20px;
    margin-bottom: -20px;
    scroll-padding-block: 20px;
    overflow-x: hidden;
    overflow-y: auto;
}
html.has-cursor-glow body #aiJumpSheetList { margin-top: -16px; }
html.has-cursor-glow body #aiJumpList { margin-top: -20px; }
html.has-cursor-glow body #aiJumpNav .ai-jump-menu { overflow: visible; }
/* People pickers (group members, chat sharing) scroll too: the row halo needs the
   same gutter inside the scrollport, otherwise it is cut at the left/right edges. */
html.has-cursor-glow body #aiHistorySheet :is(#aiSharePeople,#aiChatSharePeople) {
    box-sizing: border-box;
    width: calc(100% + 40px);
    max-height: calc(min(48vh, 360px) + 32px);
    margin: -16px -20px -8px;
    padding: 16px 20px 20px;
    gap: 4px;
    scroll-padding-block: 16px;
    overflow-x: hidden;
    overflow-y: auto;
}


html.has-cursor-glow body :is(#aiHistorySheet,#aiJumpSheet,#aiJumpNav) :is(#aiHistoryList,#aiJumpSheetList,#aiJumpList) :is(.ai-history-item,.ai-jump-item) {
    position: relative; box-sizing: border-box; min-width: 0; flex-shrink: 0;
    box-shadow: none !important;
}
html.has-cursor-glow body :is(#aiHistorySheet,#aiJumpSheet,#aiJumpNav) :is(#aiHistoryList,#aiJumpSheetList,#aiJumpList) :is(.ai-history-item,.ai-jump-item):is(:hover,:focus-visible,.is-active) {
    z-index: 3;
    box-shadow: none !important;
}

/* Shared important feedback layer must own these overrides too. */
@layer boxpoint-feedback {
    html body :is(#aiHistoryList,#aiJumpSheetList,#aiJumpList) :is(.ai-history-item,.ai-jump-item) {
        box-shadow: none !important;
    }
    html body :is(#aiHistoryList,#aiJumpSheetList,#aiJumpList) :is(.ai-history-item,.ai-jump-item):is(:hover,:focus-visible,:active,.is-active) {
        box-shadow: none !important;
    }
}

/* RAG management v20261017b: glass window/controls and glass source cards. */
#aiHistorySheet.is-rag-management > .modal-content {
    width:min(1120px,calc(100vw - 48px)); max-width:1120px;
    height:min(900px,calc(100dvh - 48px)); max-height:calc(100dvh - 48px);
    display:flex; flex-direction:column; padding:24px; overflow:hidden;
}
#aiHistorySheet.is-rag-management #aiRagViewHome {
    display:flex; flex:1 1 auto; flex-direction:column; min-height:0; overflow:visible;
}
#aiRagViewHome .modal-header { margin-bottom:18px; }

.ai-rag-management-overview {
    display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:14px;
    padding:16px; margin-bottom:16px; border:1px solid var(--glass-border); border-radius:16px;
    background:var(--glass-inset); flex:0 0 auto;
}
.ai-rag-management-overview > div { flex:1; min-width:180px; }
#aiRagManagementSummary { font-size:15px; line-height:1.5; font-weight:600; }
#aiRagManagementNotice { margin:6px 0 0; color:var(--text-muted,#a6a6a6); font-size:12px; line-height:1.6; }
.ai-rag-management-toolbar { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin-bottom:16px; flex:0 0 auto; }
#aiRagViewHome .ai-rag-management-toolbar .ai-rag-search { flex:1 1 300px; width:auto; margin:0; }
.ai-rag-page-form { display:flex; gap:10px; align-items:center; flex-wrap:wrap; margin:0 0 12px; flex:0 0 auto; }
#aiRagViewHome .ai-rag-page-form .ai-rag-search { flex:1 1 300px; width:auto; margin:0; }
#aiRagPageAdd:disabled { cursor:progress; opacity:.7; }
/* Login cookies for one page fetch: same glass controls, ink-free inputs. */
#aiRagViewHome .ai-rag-cookies { flex:1 1 100%; display:grid; gap:8px; }
#aiRagViewHome .ai-rag-cookies > summary { list-style:none; justify-self:start; }
#aiRagViewHome .ai-rag-cookies > summary::-webkit-details-marker { display:none; }
#aiRagViewHome .ai-rag-cookies > summary::after { content:'▾'; margin-left:6px; opacity:.7; }
#aiRagViewHome .ai-rag-cookies[open] > summary::after { content:'▴'; }
#aiRagViewHome .ai-rag-cookies-note { margin:0; font-size:12.5px; color:var(--text-muted,#a6a6a6); }
#aiRagViewHome .ai-rag-cookie-rows { display:grid; gap:8px; }
#aiRagViewHome .ai-rag-cookie-row { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,2fr) 44px; gap:8px; }
html body #aiRagViewHome .ai-rag-cookie-input { min-height:44px; padding:0 12px; border-radius:12px; border:1px solid var(--glass-border) !important;
    background:var(--glass-bg) !important; backdrop-filter:var(--glass-blur); -webkit-backdrop-filter:var(--glass-blur);
    color:var(--text-main,#f4f4f3); font:13px ui-monospace,SFMono-Regular,Consolas,monospace; outline:none; box-shadow:none !important; min-width:0; }
html body #aiRagViewHome .ai-rag-cookie-input:focus { border-color:var(--accent-color,#f5f5f4) !important; }
#aiRagViewHome .ai-rag-cookie-remove { padding:0; font-size:18px; }
#aiRagCookieAdd { justify-self:start; }
#aiRagViewHome .ai-rag-cookie-actions { display:flex; flex-wrap:wrap; gap:8px 14px; align-items:center; }
#aiRagViewHome .ai-rag-cookie-remember { display:inline-flex; align-items:center; gap:8px; min-height:44px; font-size:13px; color:var(--text-muted,#a6a6a6); cursor:pointer; }
#aiRagViewHome .ai-rag-cookie-remember input { width:18px; height:18px; accent-color:var(--accent-color,#f5f5f4); }
/* Section pages picker and batch progress: same glass card as the RAG sources. */
#aiRagViewHome .ai-rag-batch { display:grid; gap:10px; margin:0 0 14px; padding:14px; border-radius:16px; flex:0 0 auto;
    background:var(--glass-bg); border:1px solid var(--glass-border); box-shadow:var(--glass-shadow); backdrop-filter:var(--glass-blur); -webkit-backdrop-filter:var(--glass-blur); }
#aiRagViewHome .ai-rag-batch[hidden] { display:none; }
#aiRagViewHome .ai-rag-batch-head { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
#aiRagViewHome .ai-rag-batch-tools, #aiRagViewHome .ai-rag-batch-foot { display:flex; gap:8px; flex-wrap:wrap; }
#aiRagViewHome .ai-rag-batch-list { display:grid; gap:2px; max-height:min(42vh,360px); overflow:auto; margin:0 -6px; padding:0 6px; }
#aiRagViewHome .ai-rag-batch-list:empty { display:none; }
#aiRagViewHome .ai-rag-batch-group { padding:10px 6px 4px; font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--text-muted,#a6a6a6); }
#aiRagViewHome .ai-rag-batch-row { display:flex; align-items:center; gap:12px; min-height:44px; padding:6px 8px; border-radius:10px; cursor:pointer; }
#aiRagViewHome .ai-rag-batch-row:hover { background:rgba(166, 166, 166,.08); }
#aiRagViewHome .ai-rag-batch-row input { width:18px; height:18px; flex:0 0 18px; accent-color:var(--accent-color,#f5f5f4); }
#aiRagViewHome .ai-rag-batch-row span { display:grid; min-width:0; }
#aiRagViewHome .ai-rag-batch-row b { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#aiRagViewHome .ai-rag-batch-row small { color:var(--text-muted,#a6a6a6); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:12px; }
#aiRagBatchStop[hidden], #aiRagBatchRun[hidden] { display:none; }
@media (max-width: 600px) {
    #aiRagViewHome #aiRagPageDiscover, #aiRagViewHome #aiRagBatchRun, #aiRagViewHome #aiRagBatchStop { flex-basis:100%; }
}
@media (max-width: 600px) {
    #aiRagViewHome .ai-rag-cookie-row { grid-template-columns:minmax(0,1fr) 44px; }
    #aiRagViewHome .ai-rag-cookie-row .ai-rag-cookie-input:nth-child(2) { grid-column:1 / 2; grid-row:2; }
    #aiRagViewHome .ai-rag-cookie-remove { grid-row:1 / span 2; grid-column:2; }
}
.ai-rag-control {
    --control-rgb:245, 245, 244; display:inline-flex; align-items:center; justify-content:center;
    min-width:44px; min-height:44px; padding:10px 15px; border:0;
    border-radius:12px; background:var(--glass-bg,rgba(44, 44, 44,.5)); color:var(--text-main,#e8e8e7);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
    font:inherit; font-size:13px; cursor:pointer; line-height:1.4; gap:8px;
}
.ai-rag-control:disabled { opacity:.5; cursor:wait; }
.ai-rag-control:focus-visible, .ai-rag-knowledge-open:focus-visible { outline:none; }
.ai-rag-control[aria-pressed="true"] { color:#dcdcda; box-shadow: none !important; }
.ai-rag-control option { background:#101010; color:#f4f4f3; }


.ai-rag-dropdown { flex: 0 0 auto; }

#aiHistorySheet.is-rag-management #aiRagKnowledgeList { flex:1 1 auto; min-height:100px; max-height:none; padding:2px 4px 12px 0; gap:12px; }
/* Horizontal glow gutter: card halos must not be clipped by the scrollport. */
html.has-cursor-glow body #aiHistorySheet.is-rag-management #aiRagKnowledgeList {
    box-sizing: border-box;
    width: calc(100% + 40px);
    padding-left: 20px;
    padding-right: 20px;
    margin-left: -20px;
    margin-right: -20px;
    scroll-padding-inline: 20px;
}
html.has-cursor-glow body #aiHistorySheet .ai-rag-knowledge-card,
html body #aiHistorySheet .ai-rag-knowledge-card {
    padding:16px; background-image:none !important;
    background-color:var(--glass-bg) !important;
    backdrop-filter:var(--glass-blur) !important;
    -webkit-backdrop-filter:var(--glass-blur) !important;
    border:0 !important;
    box-shadow:0 10px 28px rgba(0, 0, 0, 0.28) !important;
    transition: box-shadow 0.18s ease;
}
#aiRagViewHome .ai-rag-knowledge-title { font-size:14px; }
#aiRagViewHome .ai-rag-knowledge-preview { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin-top:8px; }
.ai-rag-progress { margin-top:14px; display:flex; flex-direction:column; gap:8px; }
.ai-rag-progress-label { color:#a6a6a6; font-size:12px; line-height:1.5; }
.ai-rag-progress progress { width:100%; height:5px; border:0; border-radius:8px; overflow:hidden; background:#232323; accent-color:#f5f5f4; }
.ai-rag-progress progress::-webkit-progress-bar { background:#232323; border-radius:8px; }
.ai-rag-progress progress::-webkit-progress-value { background:#f5f5f4; border-radius:8px; }
.ai-rag-source-controls { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
/* RAG source viewers keep the Notes/Files windowed layout, just above the sheet. */
#aiDocumentPreview.is-rag-preview,
#noteViewerOverlay.rag-source-viewer { z-index:23040 !important; }
/* Important layer preserves viewer chrome above unlayered flat/AI resets,
   including hover/active states and viewers ported into #modal-root. */
@layer boxpoint-viewers {
    html body :is(#noteViewerOverlay, #scpDocumentModal, #scpPreviewModal, #aiDocumentPreview.is-rag-preview)
        > :is(.note-viewer-window, .scp-preview-window, .ai-document-window) {
        border:1px solid var(--glass-border) !important;
        box-shadow:var(--glass-shadow) !important;
    }
    html body :is(#noteViewerOverlay, #scpDocumentModal, #scpPreviewModal, #aiDocumentPreview.is-rag-preview)
        :is(.note-viewer-header, .scp-preview-header, .ai-document-bar) {
        border-bottom:1px solid var(--glass-border) !important;
    }
}
#aiDocumentPreview.is-rag-preview {
    padding:16px 20px;
    align-items:center;
    justify-content:center;
    border:0;
    border-radius:0;
    background:var(--glass-scrim-bg);
    backdrop-filter:var(--glass-scrim-blur);
    -webkit-backdrop-filter:var(--glass-scrim-blur);
    box-shadow:none;
    overflow:auto;
    box-sizing:border-box;
}
/* Match the Files document viewer: bordered header, plain close, wide download. */
html body #aiDocumentPreview.is-rag-preview .ai-document-bar {
    padding:0 0 10px;
    margin-bottom:12px;
    background:transparent !important;
    box-shadow:none !important;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-bar strong {
    font-size:13px;
    font-weight:600;
    letter-spacing:0.04em;
    text-transform:uppercase;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-bar .ai-document-close {
    flex:0 0 44px;
    width:44px;
    min-height:44px;
    padding:0;
    border:0 !important;
    background:transparent !important;
    box-shadow:none !important;
    color:#a6a6a6;
    font-size:18px;
    line-height:1;
    border-radius:var(--radius-btn-sm,8px);
}
html body #aiDocumentPreview.is-rag-preview .ai-document-bar .ai-document-close:hover {
    background:rgba(255,255,255,0.06) !important;
    color:#fff;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-content {
    padding:0;
    border:0;
    background:transparent;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-actions {
    display:flex;
    justify-content:center;
    gap:8px;
    margin-top:12px;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-actions .ai-document-action {
    flex:0 0 auto;
    width:calc((100% - 16px) / 3);
    min-height:36px;
    padding:8px 10px;
    border:1px solid var(--border-color) !important;
    border-radius:var(--radius-btn-sm);
    background:var(--glass-inset) !important;
    color:var(--text-main);
    font-size:11px;
    font-weight:500;
    letter-spacing:0.03em;
    text-transform:uppercase;
    text-align:center;
    box-shadow:none;
    transition:transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
html body #aiDocumentPreview.is-rag-preview .ai-document-actions .ai-document-action:hover,
html body #aiDocumentPreview.is-rag-preview .ai-document-actions .ai-document-action:focus-visible {
    transform:translateY(-3px);
    border-color:var(--accent-color) !important;
    box-shadow:0 6px 18px rgba(245, 245, 244,0.15);
    outline:none;
}
@media(max-width:600px) {
    #aiRagViewHome .modal-header { gap:4px; margin-bottom:14px; }
    #aiRagViewHome .ai-rag-knowledge-heading { font-size:17px; }
    
    .ai-rag-management-overview { padding:12px; gap:10px; }
    #aiRagManagementPause { width:100%; }
    .ai-rag-management-toolbar { gap:8px; }
    #aiRagViewHome .ai-rag-management-toolbar .ai-rag-search { flex-basis:100%; }
    .ai-rag-page-form { gap:8px; }
    #aiRagViewHome .ai-rag-page-form .ai-rag-search, #aiRagPageAdd { flex-basis:100%; }
    #aiRagViewHome .ai-rag-management-toolbar .ai-rag-dropdown { flex:1 1 auto; min-width:0; }
    html body #aiHistorySheet .ai-rag-knowledge-card { padding:12px; }
    #aiDocumentPreview.is-rag-preview {
        padding:4px !important;
        padding-top:max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
        padding-bottom:4px !important;
        padding-left:max(4px, var(--bp-safe-left, env(safe-area-inset-left, 0px))) !important;
        padding-right:max(4px, var(--bp-safe-right, env(safe-area-inset-right, 0px))) !important;
    }
    #aiDocumentPreview.is-rag-preview .ai-document-window {
        width:100%;
        max-width:100%;
        height:100%;
        max-height:100%;
        border-radius:var(--radius-window);
        padding:12px 12px 10px;
        padding-bottom:max(10px, var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
    }
}

/* Keep glass above global cursor material selectors. */
html body #aiHistorySheet.is-rag-management #aiRagViewHome #aiRagKnowledgeList .ai-rag-knowledge-card {
    background-image:none !important;
    background-color:var(--glass-bg) !important;
    backdrop-filter:var(--glass-blur) !important;
    -webkit-backdrop-filter:var(--glass-blur) !important;
    border:1px solid var(--glass-border) !important;
    box-shadow:0 10px 28px rgba(0, 0, 0, 0.28) !important;
}
html body #aiHistorySheet.is-rag-management #aiRagViewHome #aiRagKnowledgeList .ai-rag-knowledge-card::before,
html body #aiHistorySheet.is-rag-management #aiRagViewHome #aiRagKnowledgeList .ai-rag-knowledge-card::after {
    background:none !important; box-shadow:none !important; backdrop-filter:none !important;
}
/* Soft shadow contour for focus and hover, above the base glass shadow. */
html body #aiHistorySheet.is-rag-management #aiRagViewHome #aiRagKnowledgeList .ai-rag-knowledge-card:focus-within {
    box-shadow: var(--card-contour-shadow) !important;
}
@media (hover:hover) and (pointer:fine) {
    html body #aiHistorySheet.is-rag-management #aiRagViewHome #aiRagKnowledgeList .ai-rag-knowledge-card:hover {
        box-shadow: var(--card-contour-shadow) !important;
    }
}

#aiRagViewHome .ai-rag-control.is-danger { --control-rgb:232, 139, 139 !important; color:#f0b6b6; }

/* Grey rim on every card, header and menu (v20261017c, gray-rim).
   Same 1px `--glass-border` contour as the full-screen document and note
   viewer windows.  Important layer: it outranks the flat ink/AI resets and,
   on hover/focus/active, the blue feedback glow that would otherwise drop
   the rim back to 0. */
@layer boxpoint-cards {
    /* Cards, header, composer and floating menus. */
    
    /* Every modal window: AI history/RAG sheet, jump sheet, groups, TECH,
       logs, permissions, alerts, session links, notes and shared modals. */
    
    
    
}

/* UI v20261018a: wrapping inline code is text, never a backdrop layer. */
html body :is(.ai-msg-md, .notes-md) .ai-md-inline {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}






















/* Keep the history search above the list, including when the list is scrolled. */
html body #aiHistoryViewMain > .ai-sheet-search {
    flex:0 0 auto;
    min-height:44px;
    margin-bottom:12px;
}
html body #aiHistoryViewMain > #aiHistoryList {
    flex:1 1 auto;
    min-height:0;
    margin-top:0;
    padding-top:12px;
    scroll-padding-top:12px;
}

/* UI v20261018e: let menu-card halos pass the unchanged outer frame. */
html body :is(.ai-model-menu, .ai-model-list, .ai-attach-menu, .ai-regen-menu, .panel-head-menu-panel, .ai-jump-menu, #aiRagFilterMenu){
    overflow:visible;
}
/* A scrolling selector has a transparent scrollport outside its glass frame.
   Negative margins cancel the glow padding, keeping the options/frame aligned. */

/* Journal/TECH scroll gutters leave room on every side of the card's halo. */




/* Request navigation has a scrollport outside its unchanged menu frame. */
html body #aiJumpNav #aiJumpList {
    width:calc(100% + 64px); padding:32px;
    margin-left:-32px; margin-right:-32px;
    margin-top:-32px; margin-bottom:-32px;
    max-height:calc(min(48vh,392px) + 24px);
    scroll-padding:32px;
}

/* Context actions: compact mobile icons, native text selection and halo room. */
html body .note-more-btn, html body .file-item > .file-more-btn {
    display:none; align-items:center; justify-content:center;
    width:44px; min-width:44px; height:44px; min-height:44px;
    padding:0; margin:0; border:0; border-radius:12px;
    background:transparent; color:var(--text-muted); cursor:pointer;
    font:inherit; line-height:1; flex:0 0 44px;
    -webkit-user-select:none; user-select:none;
}
.note-more-btn > svg, .file-more-btn > svg { width:18px; height:18px; display:block; flex:0 0 18px; }
@media (max-width:600px) {
    html body .note-more-btn, html body .file-item > .file-more-btn { display:inline-flex; }
    html body .file-item { position:relative; padding-right:52px; }
}
.file-item > .file-more-btn { position:absolute; right:4px; top:50%; transform:translateY(-50%); }
html body .note-item-title-row { align-items:center; }
html body :is(.note-ctx, .scp-ctx),
html body .scp-ctx.scp-ctx-sub { overflow:visible; }
.scp-ctx-sub > .menu-glow-scroll {
    display:flex; flex-direction:column; gap:4px; flex:1 1 auto; min-height:0;
    width:calc(100% + 48px); margin:-24px; padding:24px;
    overflow:auto; overscroll-behavior:contain; scroll-padding:24px;
}
@media (any-pointer:coarse) {
    .note-item-title, .notes-line-text, .file-item-name, .file-item-meta {
        -webkit-user-select:text; user-select:text; -webkit-touch-callout:default;
    }
}

/* Keep permissions inside the mobile viewport. */
@media (max-width:600px) {
    html body #permsModal {
        box-sizing:border-box;
        inset:0 !important; width:100% !important; height:100% !important;
        max-height:100%; overflow:hidden;
        padding:4px !important;
        padding-top:max(4px, var(--bp-safe-top, env(safe-area-inset-top, 0px))) !important;
        padding-bottom:max(4px, var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px))) !important;
        padding-left:max(4px, var(--bp-safe-left, env(safe-area-inset-left, 0px))) !important;
        padding-right:max(4px, var(--bp-safe-right, env(safe-area-inset-right, 0px))) !important;
        align-items:stretch !important; justify-content:stretch !important;
    }
    html body #permsModal > .modal-content {
        box-sizing:border-box; display:flex; flex-direction:column;
        flex:1 1 auto; min-width:0; min-height:0; margin:0;
        width:100% !important; max-width:100% !important;
        height:100% !important; max-height:100% !important;
        border-radius:var(--radius-window) !important;
        padding:12px 12px 10px;
        padding-bottom:max(10px, var(--bp-safe-bottom, env(safe-area-inset-bottom, 0px)));
        overflow:hidden;
    }
    html body #permsModal .modal-header { flex:0 0 auto; align-items:center; min-height:44px; }
    html body #permsModal .close-btn { width:44px; min-width:44px; height:44px; flex:0 0 44px; }
    html body #permsRightsPane {
        flex:1 1 auto; min-height:0; overflow-y:auto; overflow-x:hidden;
        overscroll-behavior:contain; -webkit-overflow-scrolling:touch;
    }
    html body #aiHistorySheet.is-rag-management #aiRagViewHome { min-height:0; }
}
/* With a landscape viewport or keyboard, keep all RAG controls reachable. */
@media (max-width:600px) and (max-height:540px) {
    html body #aiHistorySheet.is-rag-management #aiRagViewHome { overflow-y:auto; overscroll-behavior:contain; }
    html body #aiHistorySheet.is-rag-management #aiRagKnowledgeList { flex:0 0 auto; overflow:visible; min-height:0; }
}

/* Only the native edge-to-edge host supplies these pixel values. */
html.boxpoint-edge body > header {
    left:max(8px, var(--bp-safe-left, 0px)) !important;
    right:max(8px, var(--bp-safe-right, 0px)) !important;
    width:auto !important;
}
.ai-rag-illustrations { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:10px; margin-top:12px; }
.ai-rag-figure { display:flex; flex-direction:column; min-height:44px; overflow:hidden; border:1px solid var(--glass-border); border-radius:12px; background:#101010; color:inherit; cursor:zoom-in; -webkit-tap-highlight-color:transparent; }
.ai-rag-figure[hidden] { display:none; }
.ai-rag-figure:focus-visible { outline:2px solid var(--accent-color); outline-offset:2px; }
.ai-rag-figure img { display:block; width:100%; background:#101010; }
.ai-rag-figure span { display:block; padding:8px 10px; font-size:12px; opacity:.75; overflow-wrap:anywhere; }
.ai-rag-illustrations .ai-rag-figure img { height:150px; object-fit:contain; }
/* Inline step illustration: full answer width, natural aspect, capped height. */
.ai-msg-md .ai-rag-figure { width:fit-content; max-width:100%; margin:10px 0 14px; }
.ai-msg-md .ai-rag-figure img { width:auto; max-width:100%; max-height:min(520px,70vh); object-fit:contain; }
.ai-msg-md li > .ai-rag-figure { margin:8px 0 10px; }
@media (min-width:601px) {
    html.boxpoint-edge body > header { top:max(8px, var(--bp-safe-top, 0px)); }
}

/* Important layer gives every control the same feedback despite legacy resets. */
@layer boxpoint-feedback {
    
    
    html body :where(button, a[href], [role="button"], [role="option"], [role="menuitem"], summary, select, input, textarea,
        label:has(input[type="checkbox"]), label:has(input[type="radio"]),
        .file-item, .note-item, .notes-create-cta, .scp-drop, .ai-composer-bar, .notes-editor-wrap, .keep-field){
        --control-rgb: 245, 245, 244 !important;
        --control-glow-shadow: none;
        transition-property: box-shadow, border-color, background-color, color, transform, opacity, scale;
        transition-duration: 0.18s;
        transition-timing-function: ease;
    }
    html body :is([data-ui-tone="danger"], [data-lb-action="delete"], [data-ai-share-del],
        .danger, .is-danger, .confirm-ok:not(.is-primary), .chat-confirm-ok,
        .ai-msg-action-delete, .ai-history-item-del, .ai-attach-remove,
        .keep-drop, .keep-clear){
        --control-rgb: 232, 139, 139 !important;
    }
    html body :is([data-ui-tone="copy"], [data-lb-action="copy"], [data-action="copy"],
        .ai-msg-action-copy, .ai-md-pre-copy, .chat-msg-copy, #noteViewerCopyBtn,
        [aria-label^="Копировать"], [aria-label^="Скопировать"], [title^="Копировать"], [title^="Скопировать"]) {
        --control-rgb: 127, 209, 168 !important;
    }
    html body [data-ui-tone="blue"] {
        --control-rgb: 245, 245, 244 !important;
    }
    html body :where(button, a[href], [role="button"], [role="option"], [role="menuitem"], summary, select,
        input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), textarea,
        .file-item, .note-item, .notes-create-cta, .scp-drop):where(:not(#aiPromptInput):not(#aiRagKnowledgeSearch):not(:disabled):not([aria-disabled="true"])):is(
            :hover, :focus-visible, :active, .active, .is-active, .is-selected, .is-open, .is-on, .is-pressed, .is-done, .is-copied,
            [aria-selected="true"], [aria-pressed="true"], [aria-expanded="true"]){
        box-shadow: none !important;
        border-color: rgba(var(--control-rgb), 0.24) !important;
        outline: none !important;
    }
    html body :where(button, a[href], [role="button"], [role="option"], [role="menuitem"], summary, select):where(:not(:disabled):not([aria-disabled="true"])):is(
            :hover, :focus-visible, :active, .active, .is-active, .is-selected, .is-open, .is-on, .is-pressed, .is-done, .is-copied,
            [aria-selected="true"], [aria-pressed="true"], [aria-expanded="true"]) {
        color: rgb(var(--control-rgb)) !important;
        background-color: rgba(var(--control-rgb), 0.10) !important;
        background-image: none !important;
    }
    html body :is(.notes-save-btn, .is-primary, button[type="submit"]):not(:disabled):is(:hover, :focus-visible, :active){
        color: #f4f4f3 !important;
        background-color: #f5f5f4 !important;
    }
    html body :is(.notes-create-cta, .scp-mkdir-btn):is(:hover, :focus-visible, :active) {
        background-color: var(--glass-bg) !important;
    }
    
    html body .visibility-toggle:is(:hover, :focus-within, :active) {
        box-shadow: none !important;
        border-color: transparent !important;
        outline: none !important;
    }
    html body .visibility-toggle:not(:has(input:disabled)):is(:hover, :focus-within, :active) .vis-check {
        box-shadow: none !important;
        border-color: rgba(245, 245, 244, 0.24) !important;
    }
    
    
    html body input:is([type="checkbox"], [type="radio"]):not(label input):not(:disabled):is(:hover, :focus-visible, :active, :checked) {
        accent-color: #f5f5f4 !important;
        border-color: rgba(245, 245, 244, 0.24) !important;
        box-shadow: none !important;
        outline: none !important;
    }
    
    html body :is(.media-capture-choice, .media-lightbox-rail-btn)[data-ui-tone="blue"] {
        color: #f4f4f3 !important;
        border-color: var(--glass-border) !important;
        background-color: var(--glass-bg) !important;
    }
    html body :is(.media-capture-choice, .media-lightbox-rail-btn)[data-ui-tone="blue"]:is(:hover, :focus-visible, :active, .is-done) {
        color: #f5f5f4 !important;
        border-color: rgba(245, 245, 244, 0.24) !important;
        background-color: rgba(245, 245, 244, 0.10) !important;
    }
    html body #mediaCaptureFlash:is(.is-on, [aria-pressed="true"]) {
        --control-rgb: 245, 245, 244 !important;
        color: #f5f5f4 !important;
        border-color: rgba(245, 245, 244, 0.24) !important;
        background-color: rgba(245, 245, 244, 0.10) !important;
        box-shadow: none !important;
    }
    html body .scp-drop:has(.scp-drop-half:is(:hover, :focus-visible, :active)) {
        box-shadow: none !important;
    }
    html body .scp-drop .scp-drop-half:is(:hover, :focus-visible, :active) {
        box-shadow: none !important;
        background-color: transparent !important;
    }
    /* Menus transfer focus between children; keep the composer's frame steady. */
    html body .ai-composer-bar:has(#aiPromptInput) {
        box-shadow: none !important;
        border-color: var(--glass-border) !important;
    }
    html body :is(.notes-editor-wrap, .keep-field):has([contenteditable="true"]):is(:hover, :focus-within, :active) {
        box-shadow: none !important;
        border-color: rgba(var(--control-rgb), 0.24) !important;
    }
    /* The terminal is a reading surface; its glass stays quiet while typing. */
    
    html body #aiPromptInput {
        box-shadow: none !important;
        text-shadow: none !important;
        background: transparent !important;
        color: #f4f4f3 !important;
        -webkit-text-fill-color: #f4f4f3 !important;
        outline: none !important;
    }
    /* Session names are inline text; only the short-lived editor has a frame. */
    
    
    
    
    
    html body .nav-active-pill {
        box-shadow: none !important;
        border: none !important;
        background-color: rgba(245, 245, 244, 0.08) !important;
    }
}


@layer boxpoint-feedback {
    
    html body :is(.ai-model-menu, .ai-model-list, .ai-attach-menu, .ai-regen-menu, .panel-head-menu-panel, .ai-jump-menu, #aiRagFilterMenu) :is(.ai-model-option, .ai-attach-option, .panel-head-menu-item, .ai-jump-item) {
        border:0 !important; outline:none !important;
        box-shadow:inset 0 0 0 1px var(--glass-border) !important;
        position:relative !important; z-index:1 !important;
    }
    
    html body :is(.ai-model-menu, .ai-model-list, .ai-attach-menu, .ai-regen-menu, .panel-head-menu-panel, .ai-jump-menu, #aiRagFilterMenu) :is(.ai-model-option, .ai-attach-option, .panel-head-menu-item, .ai-jump-item):not(:disabled):is(.is-active, .is-selected, [aria-selected="true"], [aria-pressed="true"]) {
        box-shadow: none !important;
        z-index:3 !important;
        background-color:rgba(245, 245, 244,.16) !important; color:#dcdcda !important;
    }
    
    html body :is(.ai-model-menu, .ai-model-list, .ai-attach-menu, .ai-regen-menu, .panel-head-menu-panel, .ai-jump-menu, #aiRagFilterMenu) :is(.ai-model-option, .ai-attach-option, .panel-head-menu-item, .ai-jump-item):not(:disabled):is(:hover, :focus-visible, :active, .is-pressed) {
        box-shadow: none !important;
        z-index:3 !important;
        background-color:rgba(245, 245, 244,.24) !important; color:#dcdcda !important;
    }
}

@layer boxpoint-feedback {
    /* Preserve the jump card's original border-box dimensions. */
    html body #aiJumpNav .ai-jump-menu .ai-jump-item { border:1px solid transparent !important; }
}

/* UI v20261018d: search feedback belongs to the capsule, never the text input. */
@layer boxpoint-feedback {
    html body .panel-search-field > .panel-search-input {
        border:0 !important;
        outline:none !important;
        box-shadow:none !important;
        background:transparent !important;
        backdrop-filter:none !important;
        -webkit-backdrop-filter:none !important;
        text-shadow:none !important;
        color:var(--text-main, #f4f4f3) !important;
        -webkit-text-fill-color:var(--text-main, #f4f4f3) !important;
    }
    html body .panel-search-field > .panel-search-input::placeholder {
        color:var(--text-muted, #b6b6b6) !important;
        -webkit-text-fill-color:var(--text-muted, #b6b6b6) !important;
    }
    html body .panel-search-field:is(:hover, :focus-within, :active, .has-query) {
        border-color:rgba(245, 245, 244,.24) !important;
        box-shadow: none !important;
    }
    @media (max-width:600px) {
        /* Mobile panel search puts its glass on the enclosing tray. */
        html body .panel-search-tray:has(.panel-search-field:is(:hover, :focus-within, :active, .has-query)) {
            border-color:rgba(245, 245, 244,.24) !important;
            box-shadow: none !important;
        }
        html body .panel-search-tray .panel-search-field {
            border:0 !important;
            box-shadow:none !important;
        }
    }
}

/* Context menus use the same soft contours; action tones retain copy/delete colors. */
@layer boxpoint-feedback {
    html body :is(.note-ctx, .scp-ctx) :is(.note-ctx-item, .scp-ctx-item) {
        border:0 !important; outline:none !important;
        box-shadow:inset 0 0 0 1px var(--glass-border) !important;
        position:relative !important; z-index:1 !important; min-height:44px !important;
    }
    html body :is(.note-ctx, .scp-ctx) :is(.note-ctx-item, .scp-ctx-item):not(:disabled):is(:hover, :focus-visible, :active, .is-active) {
        box-shadow: none !important;
        background-color:rgba(var(--control-rgb,59,130,246),.16) !important;
        color:rgb(var(--control-rgb,59,130,246)) !important; z-index:3 !important;
    }
}

/* Public/open: grey rim for cards, menus and shared modals (@layer boxpoint-cards). */
@layer boxpoint-cards {
html body :is(body > header,.ai-composer-bar,.auth-card,.stub-box,#scpManagerContainer .file-item,#scpManagerContainer .scp-drop,#scpManagerContainer .scp-drop-half,#scpManagerContainer .scp-mkdir-btn,#notesManagerContainer .note-item,#notesManagerContainer .notes-create-cta,#aiManagerContainer .ai-msg-user,#aiManagerContainer .ai-msg-card:not(.ai-msg-bot):not(.ai-msg-error),#aiManagerContainer .ai-document-artifact,#aiHistorySheet .ai-rag-knowledge-card,#aiDocumentPreview .ai-document-window,#aiManagerContainer .ai-model-menu,#aiManagerContainer .ai-attach-menu,.server-dropdown-menu){border: 1px solid var(--glass-border) !important;}
html body :is(.modal-content,.component-modal-card,.notes-modal-card,.confirm-card,.choice-card,.revoked-card,.error-card,.success-card,.ai-jump-menu,.ai-regen-menu,.panel-head-menu-panel){border: 1px solid var(--glass-border) !important;}
html body :is(.ai-composer-bar,#scpManagerContainer .file-item,#scpManagerContainer .scp-drop,#scpManagerContainer .scp-drop-half,#scpManagerContainer .scp-mkdir-btn,#notesManagerContainer .note-item,#notesManagerContainer .notes-create-cta){border: 1px solid var(--glass-border) !important;}
html body :is(.ai-composer-bar,#scpManagerContainer .file-item,#scpManagerContainer .scp-drop,#scpManagerContainer .scp-drop-half,#scpManagerContainer .scp-mkdir-btn,#notesManagerContainer .note-item,#notesManagerContainer .notes-create-cta){border: 1px solid var(--glass-border) !important;}
}
