        /* Fallback font stacks se self-hosted não carregar */

        :root {
            --bg: #383e4e;
            --panel: rgba(17, 25, 40, 0.9);
            --text: #f8fafc;
            --muted: #94a3b8;
            --accent: #38bdf8;
            --accent-strong: #0ea5e9;
            --danger: #f87171;
            --success: #34d399;
            --nav-bg: #b6bac5;
            --nav-text: #334155;
            --chat-gutter: clamp(16px, 6vw, 80px);
            --chat-content-gutter-left: clamp(24px, 3.5vw, 72px);
            --chat-content-gutter-right: clamp(16px, 2.5vw, 48px);
        }

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

        html,
        body {
            font-family: 'Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            background-color: var(--bg);
            background-image: var(--bg-image, none);
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed;
            color: var(--text);
            height: 100%;
            margin: 0;
        }

        body {
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        .kg-status-banner {
            position: sticky;
            top: 0;
            z-index: 10;
            margin: 10px 0 6px 0;
            padding: 10px 12px;
            border-radius: 12px;
            background: rgba(120, 96, 10, 0.88);
            border: 1px solid rgba(251, 191, 36, 0.7);
            color: #ffffff;
            font-size: 15px;
            line-height: 1.25;
            text-align: center;
        }

        .kg-status-banner.hidden {
            display: none;
        }

        /* Login-only background image (auth screen) */
        body.auth-mode {
            background-image: url('/static/background_pathdoc_auth_final.webp');
            background-size: cover;
            background-position: center;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        body.auth-mode::before {
            /* content: '';
            position: fixed;
            inset: 0;
            background: rgba(2, 6, 23, 0.35);
            pointer-events: none;
            z-index: 0; */
        }

        body.auth-mode .app-shell {
            position: relative;
            z-index: 1;
        }

        /* Small bootstrap splash while loading the auth background */
        .boot-splash {
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: #000;
            z-index: 9999;
        }

        .boot-progress {
            width: min(520px, 72vw);
            height: 8px;
            background: rgba(255, 255, 255, 0.12);
            border-radius: 999px;
            overflow: hidden;
            box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 12px 40px rgba(0,0,0,0.55);
        }

        .boot-progress > div {
            height: 100%;
            width: 0%;
            border-radius: 999px;
            background: linear-gradient(90deg, rgba(56, 189, 248, 0.8), rgba(14, 165, 233, 1));
            box-shadow: 0 0 18px rgba(56, 189, 248, 0.35);
        }

        /* Background only for the main (post-login) view */
        #chatView.chat-stage {
            background-color: #383e4e;
            --main-bg-opacity: 1;
            --main-bg-blur: 0px;
        }

        /* When the Workspace (library drawer) is opened, blur the background */
        #chatView.chat-stage.three-panels:not(.library-hidden) {
            --main-bg-blur: 16px;
        }

        #chatView.chat-stage::before {
            content: '';
            position: absolute;
            inset: 0;
            background-image: url('/static/background_pathdocv3_2_backup.webp?v=20260216f');
            background-repeat: no-repeat;
            background-position: center;
            background-size: cover;
            opacity: var(--main-bg-opacity);
            filter: blur(var(--main-bg-blur));
            pointer-events: none;
            z-index: 0;
        }

        /* Watermark only on the main (post-login) view */
        #chatView .main-watermark {
            position: absolute;
            top: 0;
            bottom: 0;
            left: var(--watermark-left, 0px);
            right: var(--watermark-right, 0px);
            display: flex;
            align-items: center;
            justify-content: center;
            font-family: 'Orbitron','Rajdhani','Sora', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
            font-size: 220px;
            font-weight: 800;
            letter-spacing: clamp(0.06em, 0.12vw, 0.12em);
            text-transform: uppercase;
            color: var(--muted);
            opacity: 0.04;
            pointer-events: none;
            user-select: none;
            z-index: 1;
            white-space: nowrap;
            overflow: hidden;
            max-width: 100%;
        }

        /* Initial main screen (after login, before opening Workspace): slightly stronger watermark */
        #chatView.chat-stage.library-hidden.workspace-closed .main-watermark {
            opacity: 0.14;
            text-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
        }

        /* When Workspace is opened (blur state), make watermark subtler */
        #chatView.chat-stage.three-panels:not(.library-hidden) .main-watermark {
            opacity: 0.02;
        }

        /* Keep UI panels above background + watermark */
        #chatView > :not(.main-watermark) {
            position: relative;
            z-index: 20;
        }

        /* Avoid blur edge clipping */
        #chatView.chat-stage.three-panels:not(.library-hidden)::before {
            transform: scale(1.04);
        }

        /* Ensure main UI stays above the background layer */
        #sessionsSidebar {
            position: relative;
            z-index: 20;
        }

        .chat-main {
            z-index: 1;
        }

        body.lock-scroll {
            overflow: hidden;
        }

        .app-shell {
            flex: 1;
            width: 100%;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        input::placeholder,
        textarea::placeholder {
            color: rgba(148, 163, 184, 0.8);
        }

        button {
            font-family: inherit;
            border: none;
            border-radius: 18px;
            padding: 0.75rem 1.125rem;
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
        }

        button:active { transform: translateY(1px); }

        .hidden { display: none !important; }

        button,
        input,
        select,
        textarea {
            font-family: inherit;
        }

        button {
            background: none;
            border: none;
            color: inherit;
            cursor: pointer;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
        }

        button:active { transform: translateY(1px); }

        input,
        textarea {
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.4);
            border-radius: 16px;
            padding: 0.75rem 0.875rem;
            color: var(--text);
        }

        input::placeholder,
        textarea::placeholder {
            color: rgba(148, 163, 184, 0.8);
        }

        button:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            box-shadow: none;
        }

        .btn-primary {
            background: linear-gradient(120deg, var(--accent), var(--accent-strong));
            color: #0f172a;
            box-shadow: 0 12px 30px rgba(14, 165, 233, 0.35);
        }

        .login-card {
            width: min(420px, 90%);
            margin: clamp(40px, 10vh, 120px) auto 24px;
            text-align: center;
            background: rgba(15, 23, 42, 0.85);
            border: 1px solid rgba(148, 163, 184, 0.3);
            border-radius: 28px;
            padding: 2rem 2rem 1.5rem;
            box-shadow: 0 25px 60px rgba(2, 6, 23, 0.75);
            position: relative;
        }

        /* Mobile browsers can change `vh` after initial paint (address bar collapse),
           which makes the login card jump down. Prefer `svh` when available. */
        @supports (height: 100svh) {
            .login-card {
                margin: clamp(40px, 10svh, 120px) auto 24px;
            }
        }

        .login-card h2 {
            margin-top: -1rem;
            margin-bottom: 1.125rem;
            font-family: 'Orbitron','Rajdhani','Arial Black',sans-serif;
            text-transform: uppercase;
            letter-spacing: 0.18em;
            font-weight: 700;
            color: var(--accent);
        }

        .login-error {
            color: var(--danger);
            font-size: 0.8125rem;
        }

        .chat-stage {
            flex: 1;
            width: 100%;
            min-height: 100vh;
            height: 100vh;
            display: flex;
            flex-direction: row;
            align-items: stretch;
            gap: 0;
            padding: 0;
            background-color: #383e4e;
            border: none;
            box-shadow: none;
            position: relative;
            overflow: hidden;
        }

        /* ===== Sessions Sidebar ===== */
        .sessions-sidebar {
            width: 3.25rem;
            min-width: 3.25rem;
            height: 100%;
            background: var(--nav-bg);
            border-right: 1px solid rgba(148, 163, 184, 0.15);
            display: flex;
            flex-direction: column;
            transition: none;
            overflow: hidden;
            z-index: 20;
        }

        .sessions-sidebar.collapsed {
            width: 3.25rem;
            min-width: 3.25rem;
        }

        .sidebar-header {
            display: flex;
            align-items: center;
            padding: 0.5rem;
        }

        .sidebar-top-actions {
            display: flex;
            flex-direction: column;
            gap: 0.35rem;
            width: 100%;
            align-items: center;
        }

        .sidebar-top-btn {
            margin: 0;
            cursor: pointer;
        }

        #healthIndicator {
            cursor: default;
        }

        .sidebar-top-btn:hover {
            background: transparent;
            color: var(--nav-text);
        }

        .sessions-sidebar.collapsed .sidebar-header {
            width: 3.25rem;
            padding: 0.5rem 0;
            justify-content: center;
            box-sizing: border-box;
        }

        .sidebar-toggle {
            width: 2.25rem;
            height: 2.25rem;
            border-radius: 6px;
            background: transparent;
            border: none;
            outline: none;
            color: var(--nav-text);
            display: grid;
            place-items: center;
            cursor: pointer;
        }

        .sidebar-toggle:hover {
            color: var(--nav-text);
        }

        .sidebar-toggle:focus {
            outline: none;
            box-shadow: none;
        }

        .sidebar-toggle svg {
            width: 1.35rem;
            height: 1.35rem;
            transition: transform 0.25s ease;
        }

        .sessions-sidebar.collapsed .sidebar-toggle svg {
            transform: rotate(180deg);
        }

        .sessions-sidebar.collapsed .sidebar-toggle {
            width: 3.25rem;
            margin: 0;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .new-session-btn {
            width: 2.25rem;
            height: 2.25rem;
            margin: 0 0 0.5rem 0.5rem;
            border-radius: 6px;
            background: transparent;
            border: none;
            outline: none;
            color: var(--nav-text);
            cursor: pointer;
            transition: background 0.15s ease, color 0.15s ease;
            display: grid;
            place-items: center;
        }

        .sessions-sidebar.collapsed .new-session-btn {
            width: 3.25rem;
            margin: 0 0 0.5rem 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
        }

        .new-session-btn:hover {
            background: rgba(56, 189, 248, 0.15);
            color: #0f172a;
        }

        .new-session-btn:focus {
            outline: none;
            box-shadow: none;
        }

        .new-session-btn svg {
            width: 1.25rem;
            height: 1.25rem;
        }

        .sidebar-btn {
            width: 2.25rem;
            height: 2.25rem;
            margin: 0 0 0.5rem 0.5rem;
            border-radius: 6px;
            background: transparent;
            border: none;
            outline: none;
            color: var(--muted);
            cursor: pointer;
            transition: background 0.15s ease, color 0.15s ease;
            display: grid;
            place-items: center;
        }

        .sessions-sidebar.collapsed .sidebar-btn {
            width: 3.25rem;
            margin: 0 0 0.5rem 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
        }

        .sidebar-btn:hover {
            background: rgba(148, 163, 184, 0.15);
            color: var(--text);
        }

        .sidebar-btn:focus {
            outline: none;
            box-shadow: none;
        }

        .sidebar-btn svg {
            width: 1.25rem;
            height: 1.25rem;
        }

        .sessions-list {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 0 0 0.5rem 0;
        }

        .sessions-sidebar.collapsed .sessions-list {
            padding: 0;
            display: none;
        }

        .sidebar-bottom-actions {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            margin-top: auto;
            padding: 0.5rem 0 0.75rem 0;
        }

        .sidebar-bottom-btn {
            width: 2.25rem;
            height: 2.25rem;
            margin: 0 0 0 0.5rem;
            border-radius: 6px;
            background: transparent;
            border: none;
            outline: none;
            color: var(--nav-text);
            cursor: pointer;
            display: grid;
            place-items: center;
            flex-shrink: 0;
            transition: color 0.15s, background 0.15s;
        }

        .sessions-sidebar.collapsed .sidebar-bottom-actions {
            padding: 0.5rem 0 0.75rem 0;
        }

        .sessions-sidebar.collapsed .sidebar-bottom-btn {
            width: 3.25rem;
            margin: 0;
            padding: 0;
            display: flex;
            justify-content: center;
            align-items: center;
            box-sizing: border-box;
        }

        .sidebar-bottom-btn:hover {
            color: #0f172a;
            background: rgba(56, 189, 248, 0.15);
        }

        .sidebar-bottom-btn:focus {
            outline: none;
            box-shadow: none;
        }

        .sidebar-bottom-btn svg {
            width: 1.25rem;
            height: 1.25rem;
        }

        /* Profile menu removed (use Configurações > Conta) */

        .account-row {
            display: grid;
            grid-template-columns: 1fr;
            gap: 8px;
        }

        .account-actions {
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .account-hint {
            font-size: 0.75rem;
            color: var(--muted);
            margin-top: 6px;
        }

        /* TAB Conta — duas colunas: perfil à esquerda, segurança+uso à direita */
        .settings-tab-content.active[data-tab-content="account"] {
            grid-template-areas:
                "profile security"
                "profile usage";
            grid-template-rows: auto 1fr;
            align-content: start;
        }
        .settings-tab-content.active[data-tab-content="account"] #accountProfileCard {
            grid-area: profile;
        }
        .settings-tab-content.active[data-tab-content="account"] #accountPasswordCard {
            grid-area: security;
        }
        .settings-tab-content.active[data-tab-content="account"] #accountUsageCard {
            grid-area: usage;
        }

        @media (max-width: 920px) {
            .settings-tab-content.active[data-tab-content="account"] {
                grid-template-columns: 1fr;
                grid-template-areas:
                    "profile"
                    "security"
                    "usage";
            }
        }

        .account-usage-metric {
            margin-bottom: 10px;
        }

        .account-usage-line {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.85rem;
            color: rgba(226, 232, 240, 0.95);
            margin-bottom: 6px;
        }

        .account-usage-label {
            color: rgba(226, 232, 240, 0.9);
        }

        .account-usage-value {
            color: rgba(226, 232, 240, 0.95);
            font-variant-numeric: tabular-nums;
        }

        .account-usage-bar {
            height: 6px;
            border-radius: 999px;
            background: rgba(148, 163, 184, 0.18);
            overflow: hidden;
        }

        .account-usage-bar-fill {
            height: 100%;
            width: 0%;
            border-radius: 999px;
            background: rgba(59, 130, 246, 0.95);
            transition: width 160ms ease;
        }

        .account-usage-kv {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 6px;
            padding-top: 8px;
            border-top: 1px solid rgba(148, 163, 184, 0.14);
        }

        .account-usage-kv-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            font-size: 0.85rem;
        }

        .account-usage-kv-key {
            color: rgba(226, 232, 240, 0.85);
        }

        .account-usage-kv-val {
            color: rgba(226, 232, 240, 0.95);
            font-variant-numeric: tabular-nums;
        }

        /* Graph Drawer */
        .graph-drawer {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--bg);
            z-index: 2000;
            display: none;
            flex-direction: column;
        }

        .graph-drawer.visible {
            display: flex;
        }

        /* Docs Help Drawer */
        .docs-help-drawer {
            position: fixed;
            top: 0;
            right: -33.33%;
            width: 33.33%;
            height: 100%;
            background: var(--bg);
            border-left: 1px solid rgba(148, 163, 184, 0.15);
            z-index: 3000;
            display: flex;
            flex-direction: column;
            transition: right 0.3s ease;
            box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
        }

        .docs-help-drawer.visible {
            right: 0;
        }

        .docs-help-header {
            padding: 1.5rem;
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            background: var(--nav-bg);
            position: relative;
        }

        .docs-help-header h3 {
            margin: 0 0 0.5rem 0;
            font-size: 1.25rem;
            font-weight: 600;
            color: var(--nav-text);
        }

        .docs-help-header p {
            margin: 0;
            font-size: 0.875rem;
            color: var(--nav-text);
            opacity: 0.8;
        }
        
        .docs-help-clear-btn {
            position: absolute;
            top: 1.5rem;
            right: 1.5rem;
            background: rgba(239, 68, 68, 0.15);
            border: 1px solid rgba(239, 68, 68, 0.3);
            color: #ef4444;
            padding: 0.5rem 0.75rem;
            border-radius: 6px;
            cursor: pointer;
            font-size: 1rem;
            transition: all 0.2s;
        }
        
        .docs-help-clear-btn:hover {
            background: rgba(239, 68, 68, 0.25);
            transform: translateY(-1px);
        }

        .docs-help-content {
            flex: 1;
            overflow-y: auto;
            background: var(--bg);
        }

        .docs-help-answer {
            padding: 1.5rem;
            color: var(--text);
            line-height: 1.8;
            font-size: 0.8125rem;
        }

        .docs-help-answer strong {
            color: var(--accent);
            font-weight: 600;
            font-size: 0.875rem;
        }

        .docs-help-answer p {
            margin: 0.5rem 0;
        }

        .docs-help-answer h1, 
        .docs-help-answer h2, 
        .docs-help-answer h3 {
            color: var(--accent);
            margin-top: 1rem;
            margin-bottom: 0.5rem;
            font-size: 0.9375rem;
        }

        .docs-help-answer ul,
        .docs-help-answer ol {
            margin: 0.5rem 0;
            padding-left: 1.5rem;
        }

        .docs-help-answer li {
            margin: 0.25rem 0;
        }

        .docs-help-answer code {
            background: rgba(148, 163, 184, 0.15);
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'Courier New', monospace;
            font-size: 0.75rem;
        }

        .docs-help-answer pre {
            background: rgba(15, 23, 42, 0.6);
            padding: 0.75rem;
            border-radius: 6px;
            overflow-x: auto;
            margin: 0.5rem 0;
        }

        .docs-help-answer pre code {
            background: none;
            padding: 0;
        }

        .docs-help-answer hr {
            margin: 1.25rem 0;
            border: none;
            border-top: 1px solid rgba(148, 163, 184, 0.2);
        }

        .docs-help-loading {
            display: none;
        }

        .docs-help-loading.visible {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 2rem;
        }

        .docs-help-loading-content {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            color: var(--muted);
            font-size: 0.875rem;
        }

        .docs-help-loading-content svg {
            flex-shrink: 0;
        }

        .docs-help-loading-content p {
            margin: 0;
            font-size: 0.875rem;
        }

        /* Quando loading visível, esconder resposta */
        .docs-help-loading.visible ~ .docs-help-answer {
            display: none;
        }

        .docs-help-input-area {
            padding: 1rem 1.5rem;
            border-top: 1px solid rgba(148, 163, 184, 0.15);
            background: var(--bg);
        }

        .docs-help-input-area textarea {
            width: 100%;
            min-height: 80px;
            padding: 0.75rem;
            border: 1px solid rgba(148, 163, 184, 0.3);
            border-radius: 8px;
            background: rgba(17, 25, 40, 0.6);
            color: var(--text);
            font-family: inherit;
            font-size: 0.875rem;
            resize: vertical;
        }

        .docs-help-input-area textarea:focus {
            outline: none;
            border-color: var(--accent);
        }

        .docs-help-btn-group {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }

        .docs-help-btn {
            flex: 1;
            padding: 0.625rem 1rem;
            border-radius: 6px;
            border: none;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s;
        }

        .docs-help-btn-primary {
            background: linear-gradient(120deg, var(--accent), var(--accent-strong));
            color: #0f172a;
        }

        .docs-help-btn-primary:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
        }

        .docs-help-btn-secondary {
            background: rgba(148, 163, 184, 0.15);
            color: var(--text);
        }

        .docs-help-btn-secondary:hover {
            background: rgba(148, 163, 184, 0.25);
        }
        
        .docs-help-msg-user,
        .docs-help-msg-assistant {
            margin-bottom: 1rem;
            padding: 0.75rem;
            border-radius: 8px;
            line-height: 1.6;
        }
        
        .docs-help-msg-user {
            background: rgba(148, 163, 184, 0.15);
            border-left: 3px solid var(--accent);
        }
        
        .docs-help-msg-assistant {
            background: rgba(56, 189, 248, 0.1);
            border-left: 3px solid var(--accent-strong);
        }
        
        .docs-help-msg-user strong,
        .docs-help-msg-assistant strong {
            display: block;
            margin-bottom: 0.5rem;
            font-size: 0.875rem;
            opacity: 0.9;
        }

        /* Removed - using sidebar-bottom-btn class instead */

        .graph-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1rem 1.5rem;
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            background: var(--nav-bg);
        }

        .graph-scope-hint {
            padding: 0.65rem 1.5rem;
            border-bottom: 1px solid rgba(148, 163, 184, 0.12);
            background: rgba(56, 189, 248, 0.08);
            color: var(--text);
            font-size: 0.85rem;
        }

        .graph-scope-hint.hidden {
            display: none;
        }

        .graph-header h3 {
            margin: 0;
            font-size: 1.125rem;
            font-weight: 600;
            color: var(--nav-text);
        }

        .graph-header-info {
            display: flex;
            align-items: center;
            gap: 16px;
        }

        .graph-header-info span {
            font-size: 0.8125rem;
            color: var(--nav-text);
        }

        .graph-close-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0.5rem 1rem;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text);
            cursor: pointer;
            border-radius: 6px;
            font-size: 0.875rem;
            font-weight: 500;
            transition: all 0.15s;
        }

        .graph-close-btn:hover {
            background: var(--primary);
            border-color: var(--primary);
        }

        .graph-close-btn svg {
            width: 18px;
            height: 18px;
        }

        .graph-container {
            flex: 1;
            overflow: hidden;
            position: relative;
        }

        .graph-container iframe {
            width: 100%;
            height: 100%;
            border: none;
        }

        .graph-loading {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: var(--muted);
        }

        .graph-loading svg {
            width: 3rem;
            height: 3rem;
            animation: spin 1s linear infinite;
            margin-bottom: 0.75rem;
        }

        @keyframes spin {
            from { transform: rotate(0deg); }
            to { transform: rotate(360deg); }
        }

        .graph-empty {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: var(--muted);
        }

        .graph-empty svg {
            width: 64px;
            height: 64px;
            margin-bottom: 16px;
            opacity: 0.5;
        }

        .graph-empty p {
            margin: 0;
            font-size: 0.875rem;
        }

        .sessions-list::-webkit-scrollbar {
            width: 4px;
        }

        .sessions-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .sessions-list::-webkit-scrollbar-thumb {
            background: #5c5e63;
            border-radius: 4px;
        }

        .session-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 0.5rem;
            padding-left: 1.60rem;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s ease;
            margin-bottom: 0.25rem;
            overflow: hidden;
        }

        .sessions-sidebar.collapsed .session-item {
            width: 3.25rem;
            padding: 0.5rem 1rem;
            margin: 0 0 0.25rem 0;
            justify-content: flex-start;
            gap: 0;
            box-sizing: border-box;
        }

        .session-item:hover {
            background: rgba(148, 163, 184, 0.1);
        }

        .session-item.active {
            background: rgba(148, 163, 184, 0.15);
        }

        .session-item .session-icon {
            flex-shrink: 0;
            width: 20px;
            height: 20px;
            color: var(--nav-text);
        }

        .session-item.active .session-icon {
            color: var(--nav-text);
        }

        .session-item .session-title {
            flex: 1;
            font-size: 0.85rem;
            color: var(--nav-text);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            opacity: 1;
            transition: opacity 0.2s ease;
        }

        .sessions-sidebar.collapsed .session-item .session-title {
            opacity: 0;
            width: 0;
        }

        .session-loading-indicator {
            font-size: 0.75rem;
            margin-left: 4px;
            animation: pulse-loading 1.5s infinite;
        }

        @keyframes pulse-loading {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.4; }
        }

        .sessions-sidebar.collapsed .session-loading-indicator {
            display: none;
        }

        .session-item .session-actions {
            position: relative;
            opacity: 0;
            transition: opacity 0.15s ease;
        }

        .session-item:hover .session-actions {
            opacity: 1;
        }

        .sessions-sidebar.collapsed .session-item .session-actions {
            display: none;
        }

        .session-menu-btn {
            width: 28px;
            height: 28px;
            background: transparent;
            border: none;
            color: var(--muted);
            display: grid;
            place-items: center;
            cursor: pointer;
            font-size: 1rem;
            letter-spacing: 1px;
        }

        .session-menu-btn:hover {
            color: var(--text);
        }

        .session-dropdown {
            position: fixed;
            min-width: 140px;
            background: #3a3b3f;
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            padding: 4px 0;
            z-index: 9999;
            display: none;
        }

        .session-dropdown.show {
            display: block;
        }

        .session-dropdown-item {
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            padding: 0.5rem 0.75rem;
            background: transparent;
            border: none;
            color: var(--text);
            font-size: 0.85rem;
            cursor: pointer;
            text-align: left;
        }

        .session-dropdown-item:hover {
            background: rgba(148, 163, 184, 0.15);
        }

        .session-dropdown-item.danger:hover {
            background: rgba(239, 68, 68, 0.15);
            color: var(--danger);
        }

        .session-dropdown-item svg {
            width: 16px;
            height: 16px;
            flex-shrink: 0;
        }

        .session-action-btn {
            width: 24px;
            height: 24px;
            border-radius: 4px;
            background: transparent;
            border: none;
            color: var(--muted);
            display: grid;
            place-items: center;
            cursor: pointer;
            font-size: 0.8rem;
        }

        .session-action-btn:hover {
            background: rgba(148, 163, 184, 0.2);
            color: var(--text);
        }

        .session-action-btn.delete:hover {
            color: var(--danger);
        }

        .sidebar-footer {
            padding: 0.75rem;
        }

        /* Main content area (wraps header + chat window + composer) */
        .chat-main {
            flex: 1;
            min-width: 0;
            height: 100%;
            position: relative;
            overflow: hidden;
        }

        /* ===== 3-panel layout (Workspace / Preview / Chat) ===== */
        .chat-stage.three-panels {
            --workspace-col-width: 360px;
            padding: 0;
            gap: 12px;
            box-sizing: border-box;
        }

        /* Initial after login: show only the icons sidebar */
        .chat-stage.three-panels.library-hidden {
            padding: 0;
            gap: 0;
        }

        .chat-stage.three-panels.library-hidden .chat-main {
            display: block;
            padding: 0;
        }

        /* When showing only the icons sidebar, keep overlay drawers available (Settings / Graph / Help). */
        .chat-stage.three-panels.library-hidden .chat-main > :not(#settingsDrawer):not(#graphDrawer):not(#docsHelpDrawer):not(#toastContainer) {
            display: none !important;
        }

        /* Before opening a collection: show only the collections column */
        .chat-stage.three-panels.workspace-closed .chat-main {
            grid-template-columns: var(--workspace-col-width);
            justify-content: start;
        }

        .chat-stage.three-panels.workspace-closed #docPreviewPane,
        .chat-stage.three-panels.workspace-closed #chatPanel {
            display: none;
        }

        .chat-stage.three-panels.workspace-closed .library-files {
            display: none;
        }

        /* After selecting a collection but before clicking a file: show only workspace */
        .chat-stage.three-panels.reader-closed .chat-main {
            grid-template-columns: var(--workspace-col-width);
            justify-content: start;
        }

        .chat-stage.three-panels.reader-closed #docPreviewPane,
        .chat-stage.three-panels.reader-closed #chatPanel {
            display: none;
        }

        /* Allow hiding viewer so chat expands */
        .chat-stage.three-panels.viewer-collapsed .chat-main {
            grid-template-columns: var(--workspace-col-width) minmax(320px, 1fr);
        }

        .chat-stage.three-panels.viewer-collapsed #docPreviewPane {
            display: none;
        }

        .chat-stage.three-panels .chat-main {
            display: grid;
            /* Keep Workspace column fixed-width; other panels flex. */
            grid-template-columns: var(--workspace-col-width) minmax(320px, 1fr) minmax(320px, 1fr);
            gap: 12px;
            padding: 12px;
            box-sizing: border-box;
        }

        .chat-stage.three-panels .floating-logo {
            display: none;
        }

        .chat-panel {
            position: relative;
            overflow: hidden;
            border: 2px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            background: rgba(15, 23, 42, 0.15);
        }

        .chat-stage.three-panels .chat-panel .chat-header {
            display: none;
        }

        .chat-stage.three-panels .chat-panel .chat-window {
            position: absolute;
            top: 12px;
            left: 0;
            right: 0;
            bottom: 110px;
            /* Keep scrollbar at the far edge; apply gutters on the content instead */
            padding: 0;
        }
        /* Suggestions: push content by actual bar height */
        .chat-panel.suggestions-visible .chat-window {
            bottom: calc(100px + var(--suggestions-push, 0px));
        }

        .chat-stage.three-panels .chat-panel.suggestions-visible .chat-window {
            bottom: calc(110px + var(--suggestions-push, 0px));
        }

        .chat-panel.suggestions-visible .chat-scroll {
            padding-bottom: var(--suggestions-push, 0px);
        }

        .chat-panel.suggestions-visible .chat-timeline {
            padding-bottom: calc(32px + var(--suggestions-push, 0px));
        }

        .chat-stage.three-panels .chat-panel.suggestions-visible .chat-timeline {
            padding-bottom: calc(24px + var(--suggestions-push, 0px));
        }

        .chat-stage.three-panels .chat-panel .chat-scroll {
            align-items: stretch;
            padding: 0;
        }

        .chat-stage.three-panels .chat-panel .chat-timeline {
            width: 100%;
            max-width: none;
            margin: 0;
            /* Add content gutters without moving the scrollbar */
            padding: 0 var(--chat-content-gutter-right) 24px var(--chat-content-gutter-left);
        }

        .chat-stage.three-panels .chat-panel .composer {
            padding: 6px var(--chat-content-gutter-right) 0 var(--chat-content-gutter-left);
            background: transparent;
        }

        .chat-stage.three-panels .chat-panel #chatForm {
            max-width: 100%;
            width: 100%;
        }

        /* toast-container positioning is now handled via JS (updateToastPosition) */

        /* Docked workspace panel (no overlay) */
        .chat-stage.three-panels .library-drawer {
            position: relative;
            top: auto;
            bottom: auto;
            left: auto;
            width: auto;
            transform: none;
            opacity: 1;
            pointer-events: auto;
            transition: none;
            z-index: 1;
            border-radius: 16px;
            background: rgba(15, 23, 42, 0.15);
        }

        .chat-stage.three-panels .library-drawer.visible {
            transform: none;
        }

        .chat-header {
            width: 100%;
            display: flex;
            justify-content: flex-end;
            align-items: center;
            padding: 0 var(--chat-gutter);
            background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 60%, transparent 100%);
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            z-index: 10;
            pointer-events: none;
            height: 28px;
            box-sizing: border-box;
        }

        .chat-header-inner {
            display: flex;
            align-items: center;
            gap: 4px;
            pointer-events: auto;
        }

        /* Floating logo */
        .floating-logo {
            position: absolute;
            top: 0.25rem;
            left: clamp(5.25rem, calc(3.75rem + 2vw), 6.25rem);
            z-index: 11;
            pointer-events: none;
        }

        .floating-logo .brand-logo {
            width: clamp(7rem, 8.125rem, 10rem);
            height: auto;
            display: block;
            filter: drop-shadow(0 0.375rem 1.125rem rgba(0, 0, 0, 0.35));
        }

        /* Esconder logo quando viewport muito pequeno (DevTools aberto, mobile) */
        @media (max-height: 600px) {
            .floating-logo {
                display: none;
            }
        }

        .collection-action:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .icon-btn {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: transparent;
            border: none;
            color: var(--text);
            display: grid;
            place-items: center;
            font-size: 1.25rem;
        }

        /* Health indicator LED */
        .health-indicator {
            display: flex;
            align-items: center;
            margin-right: 4px;
        }
        .health-led {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--muted);
            transition: background 0.3s ease, box-shadow 0.3s ease;
        }
        .health-led.online {
            background: #22c55e;
            box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
        }
        .health-led.offline {
            background: #ef4444;
            box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
        }

        .settings-collection {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .collection-controls {
            display: flex;
            align-items: center;
            gap: 8px;
            flex-shrink: 0;
        }

        .collection-action {
            width: 30px;
            height: 30px;
            border-radius: 8px;
            border: 1px solid rgba(148, 163, 184, 0.35);
            background: rgba(8, 15, 30, 0.6);
            color: #e2e8f0;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
        }

        #collectionSelect option {
            background: #1b1f2b;
            color: var(--text);
        }

        .chat-window {
            position: absolute;
            top: 28px; /* começa abaixo do header fino */
            left: 0;
            right: 0;
            bottom: 100px;
            display: flex;
            flex-direction: column;
            /* Keep scrollbar at the far right: no horizontal padding here */
            padding: 0;
            box-sizing: border-box;
            overflow: hidden;
        }

        .chat-scroll {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            width: 100%;
            padding: 0;
            margin: 0;
            scroll-behavior: smooth;
            scrollbar-width: thin;
            scrollbar-color: #5c5e63 transparent;
        }

        /* Espaçador flex empurra a timeline para a base quando há pouco conteúdo */
        .chat-scroll::before {
            content: '';
            flex: 1 0 auto;
        }

        .chat-scroll::-webkit-scrollbar {
            width: 8px;
        }

        .chat-scroll::-webkit-scrollbar-track {
            background: transparent;
        }

        .chat-scroll::-webkit-scrollbar-thumb {
            background: #5c5e63;
            border-radius: 12px;
        }

        .chat-scroll::-webkit-scrollbar-thumb:hover {
            background: #787a80;
        }

        .chat-timeline {
            width: 100%;
            max-width: 900px;
            /* Add content gutters without moving the scrollbar */
            padding: 0 var(--chat-content-gutter-right) 32px var(--chat-content-gutter-left);
            display: flex;
            flex-direction: column;
            gap: 18px;
            margin: 0 auto;
        }

        .message {
            width: 100%;
            padding: 2px 0 6px;
            line-height: 1.55;
            font-size: 0.95rem;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

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

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

        .message.user .message-body {
            color: #f8fafc;
            background: transparent;
            border: 1px solid rgba(92, 94, 99, 0.6);
            padding: 1rem 1.25rem;
            border-radius: 18px 18px 6px 18px;
            max-width: 75%;
            box-shadow: 0 18px 35px rgba(3, 6, 15, 0.55);
        }

        .message.assistant .message-body {
            color: var(--text);
            background: transparent;
            border: none;
            padding: 0;
            max-width: 100%;
            width: 100%;
            line-height: 1.86;
        }

        .message.estimate-message .message-body {
            font-style: italic;
            color: rgba(226, 232, 240, 0.9);
        }

        .message.failed .message-body {
            color: var(--danger);
        }

        .message-meta {
            font-size: 0.6875rem;
            color: #8a94a9;
            display: flex;
            justify-content: flex-start;
            gap: 8px;
            letter-spacing: 0.03em;
            text-transform: none;
            white-space: nowrap;
        }
        .meta-time { color: inherit; }
        .meta-thinking { 
            color: inherit;
            font-style: italic;
            opacity: 0.85;
        }

        .message-body {
            white-space: pre-wrap;
            font-size: 0.855rem;
        }

        /* Markdown rendered content styling */
        .message-body.markdown-rendered {
            white-space: normal;
        }
        .message-body.markdown-rendered h1,
        .message-body.markdown-rendered h2,
        .message-body.markdown-rendered h3 {
            margin-top: 1em;
            margin-bottom: 0.5em;
            font-weight: 600;
        }
        .message-body.markdown-rendered h1 { font-size: 1.3em; }
        .message-body.markdown-rendered h2 { font-size: 1.15em; }
        .message-body.markdown-rendered h3 { font-size: 1.05em; }
        .message-body.markdown-rendered p {
            margin: 0.5em 0;
        }
        .message-body.markdown-rendered ul,
        .message-body.markdown-rendered ol {
            margin: 0.5em 0;
            padding-left: 1.5em;
        }
        .message-body.markdown-rendered li {
            margin: 0.25em 0;
        }
        .message-body.markdown-rendered strong {
            font-weight: 800;
            color: #7dd3fc;  /* Accent mais claro para destacar em tema escuro */
            letter-spacing: 0.01em;
        }
        .message-body.markdown-rendered em {
            font-style: italic;
        }
        .message-body.markdown-rendered code {
            background: rgba(0,0,0,0.1);
            padding: 0.1em 0.3em;
            border-radius: 3px;
            font-family: monospace;
            font-size: 0.9em;
        }
        .message-body.markdown-rendered pre {
            background: rgba(0,0,0,0.15);
            padding: 0.75em;
            border-radius: 6px;
            overflow-x: auto;
            margin: 0.5em 0;
        }
        .message-body.markdown-rendered pre code {
            background: transparent;
            padding: 0;
        }

        /* highlight.js (minimal theme using existing tokens) */
        .message-body.markdown-rendered pre code.hljs {
            display: block;
            overflow-x: auto;
            color: var(--text);
        }
        .message-body.markdown-rendered pre code .hljs-comment,
        .message-body.markdown-rendered pre code .hljs-quote {
            color: var(--muted);
            font-style: italic;
        }
        .message-body.markdown-rendered pre code .hljs-keyword,
        .message-body.markdown-rendered pre code .hljs-selector-tag,
        .message-body.markdown-rendered pre code .hljs-literal,
        .message-body.markdown-rendered pre code .hljs-symbol {
            color: var(--accent-strong);
        }
        .message-body.markdown-rendered pre code .hljs-string,
        .message-body.markdown-rendered pre code .hljs-title,
        .message-body.markdown-rendered pre code .hljs-section {
            color: var(--accent);
        }
        .message-body.markdown-rendered pre code .hljs-number,
        .message-body.markdown-rendered pre code .hljs-attr,
        .message-body.markdown-rendered pre code .hljs-attribute {
            color: var(--success);
        }
        .message-body.markdown-rendered blockquote {
            border-left: 3px solid var(--accent);
            margin: 0.5em 0;
            padding-left: 1em;
            opacity: 0.9;
        }
        .message-body.markdown-rendered hr {
            border: none;
            border-top: 1px solid rgba(148, 163, 184, 0.3);
            margin: 1em 0;
        }
        .message-body.markdown-rendered table {
            border-collapse: collapse;
            margin: 0.5em 0;
            width: 100%;
        }
        .message-body.markdown-rendered th,
        .message-body.markdown-rendered td {
            border: 1px solid rgba(148, 163, 184, 0.3);
            padding: 0.4em 0.6em;
            text-align: left;
        }
        .message-body.markdown-rendered th {
            background: rgba(0,0,0,0.1);
            font-weight: 600;
        }

        .message-sources {
            margin-top: 10px;
            padding-top: 8px;
            border-top: 1px solid rgba(148, 163, 184, 0.2);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: flex-start;
            font-size: 0.75rem;
            color: var(--muted);
        }

        .source-entry {
            display: flex;
            flex-direction: column;
            gap: 6px;
            align-items: flex-start;
            min-width: 160px;
        }

        .source-doc-link-title {
            white-space: nowrap;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .message-sources strong {
            font-weight: 600;
            color: rgba(226, 232, 240, 0.9);
            flex: 0 0 100%;
            margin-bottom: 2px;
        }

        .sources-inline {
            flex: 0 0 100%;
            line-height: 1.5;
            color: var(--muted);
        }

        .sources-files-line {
            /* Filenames line */
        }

        .sources-pages-line {
            flex: 0 0 100%;
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin-top: 6px;
        }

        .source-pages-group {
            display: flex;
            flex-wrap: wrap;
            align-items: center;
            gap: 8px;
        }

        .source-doc-link-compact {
            opacity: 0.92;
        }

        .source-pages-prefix {
            opacity: 0.85;
        }

        .source-doc-link {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            color: rgba(226, 232, 240, 0.92);
            text-decoration: none;
            cursor: pointer;
        }

        .source-doc-link:hover {
            text-decoration: underline;
        }

        .source-pages {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            align-items: center;
        }

        .source-page-chip {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 2px 8px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.25);
            background: rgba(148, 163, 184, 0.1);
            color: rgba(226, 232, 240, 0.92);
            cursor: pointer;
            user-select: none;
            line-height: 1.4;
        }

        .source-page-chip:hover {
            background: rgba(148, 163, 184, 0.16);
        }

        .md-table-wrapper {
            width: 100%;
            overflow-x: auto;
            margin: 0.35rem 0;
        }

        .md-table {
            width: 100%;
            border-collapse: collapse;
            table-layout: auto;
        }

        .md-table th,
        .md-table td {
            border: 1px solid rgba(148, 163, 184, 0.2);
            padding: 6px 10px;
            vertical-align: top;
            white-space: normal;
        }

        .md-table th {
            font-weight: 600;
        }

        .md-text {
            white-space: pre-wrap;
        }

        .message.loading .message-body {
            min-height: 18px;
        }

        /* Loading spinner com morphing circle to squares */
        .loading-spinner-container {
            display: flex;
            align-items: center;
            gap: 8px;
            min-height: 24px;
        }

        .morph-spinner-small {
            width: 13px;
            height: 13px;
            position: relative;
            flex-shrink: 0;
            animation: morphRotate 3s linear infinite;
        }

        .morph-shape-small {
            position: absolute;
            width: 5.4px;
            height: 5.4px;
            border: 1.1px solid rgba(148, 163, 184, 0.9);
            box-sizing: border-box;
        }

        .morph-shape-small:nth-child(1) {
            top: 0;
            left: 3.8px;
            animation: morphSmall1 3s ease-in-out infinite;
        }

        .morph-shape-small:nth-child(2) {
            top: 3.8px;
            right: 0;
            animation: morphSmall2 3s ease-in-out infinite;
        }

        .morph-shape-small:nth-child(3) {
            bottom: 0;
            left: 3.8px;
            animation: morphSmall3 3s ease-in-out infinite;
        }

        .morph-shape-small:nth-child(4) {
            top: 3.8px;
            left: 0;
            animation: morphSmall4 3s ease-in-out infinite;
        }

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

        @keyframes morphSmall1 {
            0%, 100% {
                border-radius: 50% 50% 0 0;
                top: 0;
                left: 3.8px;
                width: 5.4px;
                height: 5.4px;
            }
            40%, 60% {
                border-radius: 2px;
                top: 1.1px;
                left: 1.1px;
                width: 5.1px;
                height: 5.1px;
            }
        }

        @keyframes morphSmall2 {
            0%, 100% {
                border-radius: 0 50% 50% 0;
                top: 3.8px;
                right: 0;
                width: 5.4px;
                height: 5.4px;
            }
            40%, 60% {
                border-radius: 2px;
                top: 1.1px;
                right: 1.1px;
                width: 5.1px;
                height: 5.1px;
            }
        }

        @keyframes morphSmall3 {
            0%, 100% {
                border-radius: 0 0 50% 50%;
                bottom: 0;
                left: 3.8px;
                width: 5.4px;
                height: 5.4px;
            }
            40%, 60% {
                border-radius: 2px;
                bottom: 1.1px;
                left: 1.1px;
                width: 5.1px;
                height: 5.1px;
            }
        }

        @keyframes morphSmall4 {
            0%, 100% {
                border-radius: 50% 0 0 50%;
                top: 3.8px;
                left: 0;
                width: 5.4px;
                height: 5.4px;
            }
            40%, 60% {
                border-radius: 2px;
                top: 6.9px;
                left: 1.1px;
                width: 5.1px;
                height: 5.1px;
            }
        }

        .loading-status-text {
            color: rgba(148, 163, 184, 0.9);
            font-size: 0.74rem;
            line-height: 1.4;
            animation: fadeInOut 2s ease-in-out infinite;
        }

        @keyframes fadeInOut {
            0% { opacity: 0; }
            10% { opacity: 1; }
            90% { opacity: 1; }
            100% { opacity: 0; }
        }

        /* Botões de feedback da mensagem */
        .message-actions {
            display: flex;
            gap: 8px;
            margin-top: 6px;
            padding: 0;
            border: none;
            background: transparent;
        }

        /* Ícones puros (sem botão) */
        .message-action-icon {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 18px;
            height: 18px;
            padding: 0;
            margin: 0;
            background: transparent;
            border: 0;
            outline: 0;
            box-shadow: none;
            cursor: pointer;
            user-select: none;
            opacity: 0.75;
            transition: opacity 0.2s ease, transform 0.15s ease, color 0.15s ease;
            color: rgba(148, 163, 184, 0.9);
        }

        .message-action-icon.feedback-up.active {
            color: var(--success);
            transform: scale(1.12);
        }

        .message-action-icon.feedback-down.active {
            color: var(--danger);
            transform: scale(1.12);
        }

        .message-action-icon.feedback-click {
            animation: feedbackPop 240ms ease-out;
        }

        @keyframes feedbackPop {
            0% { transform: scale(1); }
            45% { transform: scale(1.22); }
            100% { transform: scale(1.08); }
        }

        .message-action-icon:hover {
            opacity: 1;
        }

        .message-action-icon.active {
            opacity: 1;
        }

        .message-action-icon svg {
            width: 18px;
            height: 18px;
            display: block;
            fill: none;
            stroke: currentColor;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }

        /* Compatibilidade: esconder qualquer label antiga (ex.: "Copiar") */
        .message-actions button,
        .message-actions .message-action-btn {
            display: none !important;
        }

        button.message-action-btn,
        .message-action-btn {
            display: inline-flex !important;
            align-items: center !important;
            justify-content: center !important;
            padding: 0 !important;
            margin: 0 !important;
            background: transparent !important;
            background-color: transparent !important;
            background-image: none !important;
            border: 0 !important;
            border-color: transparent !important;
            outline: 0 !important;
            box-shadow: none !important;
            color: rgba(148, 163, 184, 0.7) !important;
            cursor: pointer !important;
            transition: color 0.2s ease !important;
            line-height: 0 !important;
            min-width: 0 !important;
            min-height: 0 !important;
        }

        button.message-action-btn:hover,
        .message-action-btn:hover {
            color: #e2e8f0 !important;
            background: transparent !important;
            background-color: transparent !important;
            border: 0 !important;
            box-shadow: none !important;
        }

        button.message-action-btn:focus,
        .message-action-btn:focus {
            outline: 0 !important;
            box-shadow: none !important;
            background: transparent !important;
            background-color: transparent !important;
            border: 0 !important;
        }

        button.message-action-btn:active,
        .message-action-btn:active {
            background: transparent !important;
            background-color: transparent !important;
            border: 0 !important;
            box-shadow: none !important;
        }

        .message-action-btn svg {
            width: 15px !important;
            height: 15px !important;
            flex-shrink: 0;
            display: block;
        }

        button.message-action-btn.active,
        .message-action-btn.active {
            color: #38bdf8 !important;
            background: transparent !important;
            background-color: transparent !important;
        }

        button.message-action-btn.copied,
        .message-action-btn.copied {
            color: #22c55e !important;
            background: transparent !important;
            background-color: transparent !important;
        }

        /* Manter compatibilidade com código antigo */
        .typing-dots {
            display: none;
        }

        .typing-dot {
            display: none;
        }

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

        /* Indicador de carregar mais histórico */
        .load-more-indicator {
            display: flex;
            justify-content: center;
            padding: 0.75rem 0;
            margin-bottom: 0.5rem;
        }

        .load-more-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 0.5rem 1rem;
            background: rgba(56, 189, 248, 0.1);
            border: 1px solid rgba(56, 189, 248, 0.3);
            border-radius: 20px;
            color: #7dd3fc;
            font-size: 0.8125rem;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .load-more-btn:hover {
            background: rgba(56, 189, 248, 0.2);
            border-color: rgba(56, 189, 248, 0.5);
        }

        .load-more-btn svg {
            width: 16px;
            height: 16px;
        }

        .loading-spinner-small {
            width: 16px;
            height: 16px;
            border: 2px solid rgba(56, 189, 248, 0.3);
            border-top-color: #7dd3fc;
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
            display: inline-block;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .ingest-stage-text {
            margin-bottom: 6px;
            font-size: 0.92rem;
            color: var(--text);
        }
        
        .estimate-disclaimer {
            display: block;
            font-size: 0.75rem;
            color: var(--muted);
            opacity: 0.8;
            margin-top: 2px;
        }

        .drop-overlay {
            position: absolute;
            inset: 0;
            border: 2px dashed rgba(56, 189, 248, 0.6);
            border-radius: 24px;
            background: rgba(8, 47, 73, 0.75);
            color: #e0f2fe;
            font-weight: 600;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.125rem;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.2s ease;
        }

        .drop-overlay.visible { opacity: 1; }

        /* Initial Upload Zone (Welcome Screen) */
        .initial-upload-zone {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 100;
            opacity: 1;
            transition: opacity 0.3s ease;
            pointer-events: auto;
            width: min(1570px, calc(103vw - 280px));
            height: min(889px, calc(100vh - 200px));
        }

        .initial-upload-zone.hidden {
            opacity: 0;
            pointer-events: none;
        }

        .upload-zone-content {
            width: 100%;
            height: 100%;
            padding-bottom: 80px;
            border: 0.5px solid rgba(255, 255, 255, 0.12);
            border-radius: 20px;
            background: rgba(0, 0, 0, 0.02);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-end;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .upload-zone-content:hover {
            border-color: rgba(255, 255, 255, 0.18);
            background: rgba(255, 255, 255, 0.02);
        }

        .upload-zone-content.drag-over {
            border-color: rgba(255, 255, 255, 0.24);
            background: rgba(255, 255, 255, 0.04);
        }

        .upload-icon {
            width: 56px;
            height: 56px;
            color: rgba(255, 255, 255, 0.25);
            margin-bottom: 28px;
            transition: color 0.3s ease, transform 0.3s ease;
        }

        .upload-zone-content:hover .upload-icon {
            color: rgba(255, 255, 255, 0.4);
        }

        .upload-text {
            margin: 0;
            font-size: 0.85rem;
            color: rgba(255, 255, 255, 0.4);
        }

        @media (max-width: 768px) {
            .initial-upload-zone {
                width: calc(100vw - 40px);
                height: calc(100vh - 200px);
            }
            
            .upload-icon {
                width: 48px;
                height: 48px;
            }
            
            .upload-text {
                font-size: 0.8rem;
            }
        }

        .composer {
            position: absolute;
            left: 0;
            right: 0;
            bottom: 0;
            padding: 6px var(--chat-gutter) 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            background: transparent;
            z-index: 4;
        }

        .suggest-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 2.25rem;
            height: 2.25rem;
            padding: 0;
            border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--text);
            cursor: pointer;
            box-shadow: none;
            transition: transform 0.15s ease;
        }

        .suggest-btn svg {
            width: 18px;
            height: 18px;
            stroke: currentColor;
        }

        .suggest-btn.ready svg {
            stroke: #facc15;
        }

        .suggest-btn.ready {
            color: #facc15;
        }

        .suggest-btn:hover {
            transform: translateY(-1px);
        }

        .suggest-btn.disabled,
        .suggest-btn:disabled {
            opacity: 0.45;
            cursor: not-allowed;
            transform: none;
        }

        .suggestions-bar {
            position: static;
            margin: 0 0 6px;
            padding: 6px 12px;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: rgba(8, 15, 30, 0.9);
            display: flex;
            flex-direction: column;
            gap: 6px;
            z-index: 5;
            animation: suggestionsFloatUp 220ms ease-out;
            width: 100%;
            max-width: min(900px, 100%);
            align-self: center;
            box-sizing: border-box;
        }

        .chat-stage.three-panels .chat-panel .composer .suggestions-bar {
            max-width: 100%;
        }

        .chat-panel.suggestions-visible .chat-window {
            bottom: 150px;
        }

        .chat-stage.three-panels .chat-panel.suggestions-visible .chat-window {
            bottom: 160px;
        }

        .chat-panel.suggestions-visible .chat-timeline {
            padding-bottom: 90px;
        }

        .chat-stage.three-panels .chat-panel.suggestions-visible .chat-timeline {
            padding-bottom: 90px;
        }

        @keyframes suggestionsFloatUp {
            from {
                transform: translateY(14px);
                opacity: 0;
            }
            to {
                transform: translateY(0);
                opacity: 1;
            }
        }

        .suggestions-bar.hidden {
            display: none;
        }

        .youtube-links-bar {
            position: static;
            margin: 0 0 6px;
            padding: 8px 12px;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: rgba(8, 15, 30, 0.9);
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 5;
            animation: suggestionsFloatUp 220ms ease-out;
            width: 100%;
            max-width: min(900px, 100%);
            align-self: center;
            box-sizing: border-box;
        }

        .youtube-links-bar.hidden {
            display: none;
        }

        .youtube-links-title {
            font-size: 0.85rem;
            color: #e2e8f0;
        }

        .youtube-links-input {
            width: 100%;
            min-height: 160px;
            resize: vertical;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.25);
            background: rgba(15, 23, 42, 0.75);
            color: var(--text);
            padding: 10px;
            line-height: 1.35;
        }

        .youtube-links-actions {
            display: flex;
            justify-content: flex-end;
            gap: 8px;
        }

        .youtube-links-btn {
            border-radius: 8px;
            padding: 6px 10px;
            font-size: 0.82rem;
            border: 1px solid rgba(148, 163, 184, 0.28);
            color: #e2e8f0;
            background: transparent;
        }

        .youtube-links-btn.primary {
            background: rgba(56, 189, 248, 0.18);
            border-color: rgba(56, 189, 248, 0.45);
        }

        .image-preview {
            position: relative;
            display: inline-block;
            max-width: min(180px, 45%);
            margin: 0 0 6px;
            border-radius: 12px;
            overflow: hidden;
            background: rgba(30, 36, 50, 0.95);
            border: 1px solid rgba(148, 163, 184, 0.25);
            animation: suggestionsFloatUp 220ms ease-out;
        }

        .image-preview.hidden {
            display: none;
        }

        .image-preview img {
            display: block;
            width: 100%;
            max-height: 160px;
            border-radius: 12px;
            object-fit: cover;
        }

        .image-preview-actions {
            position: absolute;
            top: 6px;
            right: 6px;
            display: flex;
            gap: 4px;
        }

        .image-action-btn {
            width: 26px;
            height: 26px;
            border-radius: 50%;
            border: none;
            background: rgba(0, 0, 0, 0.6);
            color: white;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s ease;
            backdrop-filter: blur(4px);
        }

        .image-action-btn:hover {
            background: rgba(0, 0, 0, 0.85);
            transform: scale(1.1);
        }

        .image-transcribe-overlay {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.55);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 8px;
            border-radius: 12px;
            color: #e2e8f0;
            font-size: 0.8rem;
            backdrop-filter: blur(2px);
            z-index: 2;
        }

        /* Hide edit/remove buttons while transcription overlay is visible */
        .image-preview.transcribing .image-preview-actions {
            display: none;
        }

        .image-transcribe-overlay.hidden {
            display: none;
        }

        .transcribe-spinner {
            width: 22px;
            height: 22px;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-top-color: white;
            border-radius: 50%;
            animation: spin 0.7s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .suggestions-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .suggestion-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            border-radius: 8px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: rgba(8, 15, 30, 0.9);
            color: #ffffff;
            font-size: 0.86rem;
            cursor: pointer;
            transition: background 0.15s ease, border-color 0.15s ease;
        }

        .suggestion-item:hover {
            background: rgba(8, 15, 30, 0.9);
            border-color: rgba(56, 189, 248, 0.7);
        }

        .doc-summary-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 6px;
            border-radius: 0;
            border: none;
            background: transparent;
            color: #ffffff;
            font-weight: 700;
            font-size: 0.72rem;
            cursor: pointer;
            flex: 0 0 auto;
        }

        .doc-summary-btn:hover {
            color: #7dd3fc;
        }

        /* KG reprocess (retry) button */
        .doc-kg-retry-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 4px;
            border-radius: 0;
            border: none;
            background: transparent;
            color: rgba(251, 191, 36, 0.9);
            font-weight: 700;
            font-size: 0.85rem;
            cursor: pointer;
            flex: 0 0 auto;
            transition: color 0.15s;
        }
        .doc-kg-retry-btn:hover {
            color: rgba(251, 191, 36, 1);
        }
        .doc-kg-retry-btn.spinning {
            animation: kg-spin 0.8s linear infinite;
            pointer-events: none;
            opacity: 0.6;
        }
        @keyframes kg-spin {
            from { transform: rotate(0deg); }
            to   { transform: rotate(360deg); }
        }

        #chatForm {
            width: 100%;
            max-width: min(900px, 100%);
            display: flex;
            flex-direction: column;
            gap: 0;
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 10px;
            padding: 0.125rem 0.75rem;
            background: rgba(8, 15, 30, 0.9);
            box-shadow: 0 12px 30px rgba(2, 6, 23, 0.55);
        }

        .composer-input-row {
            display: flex;
            align-items: center;
            width: 100%;
        }

        .composer-toolbar-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            width: 100%;
            padding: 0 0 4px;
        }

        .composer-toolbar-left {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .composer-toolbar-right {
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .attachment-btn {
            background: none;
            border: none;
            color: var(--text-muted, #94a3b8);
            cursor: pointer;
            padding: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            transition: color 0.15s, background 0.15s;
            flex-shrink: 0;
        }
        .attachment-btn:hover {
            color: var(--text, #e2e8f0);
            background: rgba(148, 163, 184, 0.1);
        }

        #chatForm textarea {
            flex: 1;
            min-height: 46px;
            max-height: 160px;
            border: none;
            background: transparent;
            color: var(--text);
            font-size: 0.9375rem;
            line-height: 1.4;
            /* Keep text/placeholder vertically centered inside the composer box */
            padding: 14px 0 10px 1ch;
            resize: none;
            overflow-y: hidden;
        }

        #chatForm textarea::placeholder {
            font-size: inherit;
            line-height: inherit;
            transform: none;
        }

        /* System/status messages (e.g., ingestion progress) should not hug the left edge */
        .message.assistant.system {
            padding: 2px 12px 6px;
        }

        #chatForm textarea:focus { outline: none; }

        /* ── Mode Selector (Claude-style) ── */
        .mode-selector {
            position: relative;
        }

        .mode-selector-btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 3px 10px;
            border-radius: 6px;
            border: none;
            background: transparent;
            color: var(--text-muted, #94a3b8);
            font-size: 0.8rem;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }

        .mode-selector-btn:hover {
            background: rgba(148, 163, 184, 0.1);
            color: var(--text, #e2e8f0);
        }

        .mode-selector-btn[data-mode="analytical"] {
            color: #facc15;
        }

        .mode-selector-icon {
            width: 14px;
            height: 14px;
        }

        .mode-selector-chevron {
            width: 12px;
            height: 12px;
            transition: transform 0.15s;
        }

        .mode-selector-btn.open .mode-selector-chevron {
            transform: rotate(180deg);
        }

        .mode-selector-popover {
            position: absolute;
            bottom: calc(100% + 6px);
            right: 0;
            min-width: 280px;
            background: rgba(15, 23, 42, 0.97);
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 12px;
            padding: 6px;
            box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.4);
            backdrop-filter: blur(12px);
            z-index: 100;
            animation: modePopoverUp 150ms ease-out;
        }

        .mode-selector-popover.hidden {
            display: none;
        }

        @keyframes modePopoverUp {
            from { transform: translateY(6px); opacity: 0; }
            to   { transform: translateY(0);   opacity: 1; }
        }

        .mode-option {
            padding: 10px 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.12s;
        }

        .mode-option:hover {
            background: rgba(148, 163, 184, 0.08);
        }

        .mode-option + .mode-option {
            border-top: 1px solid rgba(148, 163, 184, 0.1);
        }

        .mode-option-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .mode-option-name {
            font-size: 0.875rem;
            font-weight: 500;
            color: #e2e8f0;
        }

        .mode-check {
            width: 16px;
            height: 16px;
            color: #38bdf8;
            display: none;
        }

        .mode-option.active .mode-check {
            display: block;
        }

        .mode-option-desc {
            font-size: 0.75rem;
            color: #64748b;
            margin-top: 2px;
            display: block;
        }

        /* ── Analytical mode visual identity ── */
        .message.analytical .message-meta {
            color: rgba(217, 181, 72, 0.85);
        }
        .message.user.analytical .message-body {
            border-color: rgba(217, 181, 72, 0.35);
        }

        /* ── Modo Dialético (Debate) ── */
        .mode-selector-btn[data-mode="dialectical"] {
            color: #8b5cf6;
        }

        .message.dialectical .message-meta span:first-child {
            font-weight: 600;
        }
        .message.debate-agent-proponent .message-meta span:first-child {
            color: #3b82f6;
        }
        .message.debate-agent-opponent .message-meta span:first-child {
            color: #f97316;
        }
        .message.debate-agent-mediator .message-meta span:first-child {
            color: #22c55e;
        }
        .message.debate-agent-researcher .message-meta span:first-child {
            color: #6b7280;
        }
        .message.debate-agent-system .message-meta span:first-child {
            color: #8b5cf6;
        }

        /* Round separators */
        .debate-round-separator {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0.5rem 0;
            color: var(--text-muted, #888);
            font-size: 0.75rem;
            font-weight: 500;
            letter-spacing: 0.05em;
            text-transform: uppercase;
        }
        .debate-round-separator::before,
        .debate-round-separator::after {
            content: '';
            flex: 1;
            height: 1px;
            background: var(--border, #333);
            margin: 0 0.75rem;
        }
        .debate-round-separator.debate-early-stop span {
            color: #f59e0b;
        }
        .debate-round-separator.debate-summary-sep span {
            color: #22c55e;
            font-weight: 600;
        }

        /* Config card */
        .debate-config-card {
            background: var(--surface, #1e1e2e);
            border: 1px solid var(--border, #333);
            border-radius: 10px;
            padding: 1rem 1.25rem;
            max-width: 400px;
        }
        .debate-config-title {
            font-weight: 600;
            font-size: 0.9rem;
            margin-bottom: 0.75rem;
            color: #8b5cf6;
        }
        .debate-config-field {
            margin-bottom: 0.75rem;
        }
        .debate-config-field label {
            display: block;
            font-size: 0.8rem;
            color: var(--text-muted, #aaa);
            margin-bottom: 0.35rem;
        }
        .debate-rounds-selector {
            display: flex;
            gap: 0.3rem;
            flex-wrap: wrap;
        }
        .debate-round-btn {
            width: 2rem;
            height: 2rem;
            border-radius: 6px;
            border: 1px solid var(--border, #444);
            background: transparent;
            color: var(--text, #ccc);
            font-size: 0.8rem;
            cursor: pointer;
            transition: all 0.15s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0;
            line-height: 1;
        }
        .debate-round-btn:hover {
            border-color: #8b5cf6;
            color: #8b5cf6;
        }
        .debate-round-btn.active {
            background: #8b5cf6;
            border-color: #8b5cf6;
            color: #fff;
            font-weight: 600;
        }
        .debate-checkbox-label {
            display: flex !important;
            align-items: center;
            gap: 0.5rem;
            cursor: pointer;
            font-size: 0.85rem !important;
            color: var(--text, #ccc) !important;
        }
        .debate-checkbox-label input[type="checkbox"] {
            accent-color: #8b5cf6;
            width: 1rem;
            height: 1rem;
        }
        .debate-config-hint {
            display: block;
            font-size: 0.7rem;
            color: var(--text-muted, #888);
            margin-top: 0.2rem;
            margin-left: 1.5rem;
        }
        .debate-start-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.4rem;
            width: 100%;
            padding: 0.6rem 1rem;
            border-radius: 8px;
            border: none;
            background: #8b5cf6;
            color: #fff;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s;
            margin-top: 0.5rem;
        }
        .debate-start-btn:hover:not(:disabled) {
            background: #7c3aed;
        }
        .debate-start-btn:disabled {
            opacity: 0.6;
            cursor: default;
        }
        .debate-config-started {
            opacity: 0.7;
        }
        .debate-config-started .debate-start-btn {
            background: var(--surface, #2a2a3e);
            color: var(--text-muted, #888);
            font-weight: 400;
            font-size: 0.8rem;
        }

        /* ── Painel de turno do usuário no debate participativo ─────────── */
        .debate-user-turn-panel {
            background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(139,92,246,0.06));
            border: 1px solid rgba(139,92,246,0.35);
            border-radius: 10px;
            padding: 0.9rem 1rem 0.75rem;
            margin: 0.5rem 0;
            max-width: 600px;
        }
        .debate-user-turn-panel.debate-user-turn-done {
            opacity: 0.55;
            pointer-events: none;
        }
        .debate-user-turn-header {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-bottom: 0.6rem;
        }
        .debate-user-turn-icon { font-size: 1.1rem; }
        .debate-user-turn-title {
            font-weight: 600;
            font-size: 0.85rem;
            color: #a78bfa;
        }
        .debate-user-turn-hint {
            font-size: 0.72rem;
            color: var(--text-muted, #888);
            margin-left: auto;
        }
        .debate-user-turn-input {
            width: 100%;
            background: var(--surface, #1e1e2e);
            border: 1px solid rgba(139,92,246,0.3);
            border-radius: 7px;
            color: var(--text, #e2e8f0);
            font-size: 0.85rem;
            padding: 0.5rem 0.65rem;
            resize: vertical;
            outline: none;
            box-sizing: border-box;
            font-family: inherit;
            transition: border-color 0.15s;
        }
        .debate-user-turn-input:focus {
            border-color: #8b5cf6;
        }
        .debate-user-turn-actions {
            display: flex;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }
        .debate-user-send-btn {
            flex: 1;
            padding: 0.45rem 0.75rem;
            border-radius: 7px;
            border: none;
            background: #8b5cf6;
            color: #fff;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: background 0.15s;
        }
        .debate-user-send-btn:hover:not(:disabled) { background: #7c3aed; }
        .debate-user-send-btn:disabled { opacity: 0.5; cursor: default; }
        .debate-user-skip-btn {
            padding: 0.45rem 0.75rem;
            border-radius: 7px;
            border: 1px solid var(--border, #444);
            background: transparent;
            color: var(--text-muted, #888);
            font-size: 0.8rem;
            cursor: pointer;
            transition: border-color 0.15s, color 0.15s;
        }
        .debate-user-skip-btn:hover:not(:disabled) {
            border-color: #888;
            color: var(--text, #ccc);
        }
        .debate-user-skip-btn:disabled { opacity: 0.5; cursor: default; }
        .debate-user-countdown-bar-wrap {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.55rem;
        }
        .debate-user-countdown-bar {
            height: 3px;
            background: #8b5cf6;
            border-radius: 2px;
            transition: width 0.1s linear;
            flex: 1;
        }
        .debate-user-countdown-label {
            font-size: 0.7rem;
            color: var(--text-muted, #888);
            min-width: 2.5rem;
            text-align: right;
        }
        .debate-user-skip-note {
            opacity: 0.6;
            font-style: italic;
        }

        #send-btn {
            width: 2.25rem;
            height: 2.25rem;
            display: grid;
            place-items: center;
            padding: 0;
            border-radius: 6px;
            background: transparent;
            color: var(--text);
            box-shadow: none;
        }

        #send-btn svg {
            width: 1.25rem;
            height: 1.25rem;
        }

        #send-btn:hover {
            background: rgba(56, 189, 248, 0.15);
        }

        .chat-disclaimer {
            width: 100%;
            text-align: center;
            font-size: 0.6875rem;
            color: rgba(226, 232, 240, 0.5);
            padding: 0.5rem 1rem 0.75rem;
            margin: 0;
        }


        .toast-container {
            position: fixed;
            bottom: 150px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            flex-direction: column;
            gap: 10px;
            align-items: center;
            z-index: 9999;
            pointer-events: none;
            width: max-content;
            max-width: 90%;
        }

        /* Ensure toasts appear above the graph drawer overlay (z-index: 2000) */
        .graph-drawer.visible ~ .toast-container {
            z-index: 2001;
        }

        .toast {
            padding: 14px 18px;
            border-radius: 18px;
            color: #e2e8f0;
            min-width: 240px;
            max-width: 500px;
            background: rgba(15, 23, 42, 0.95);
            border: 1px solid rgba(100, 116, 139, 0.3);
            box-shadow: 0 22px 45px rgba(2, 6, 23, 0.55);
            font-size: 0.85rem;
            letter-spacing: 0.01em;
            line-height: 1.45;
            text-align: center;
            pointer-events: auto;
            animation: toastSlideIn 0.3s ease-out forwards;
            opacity: 0;
            transform: translateY(20px);
        }

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

        .toast.warning {
            border-color: rgba(251, 191, 36, 0.5);
        }

        .confirm-overlay {
            position: fixed;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 20px;
            background: rgba(4, 11, 25, 0.78);
            backdrop-filter: blur(4px);
            z-index: 2000;
        }

        .confirm-dialog {
            width: min(420px, 90%);
            background: rgba(17, 25, 40, 0.96);
            border-radius: 20px;
            border: 1px solid rgba(148, 163, 184, 0.3);
            box-shadow: 0 25px 70px rgba(2, 6, 23, 0.8);
            padding: 28px;
            display: flex;
            flex-direction: column;
        .estimate-notice {
            position: absolute;
            top: 1.5rem;
            left: 50%;
            transform: translateX(-50%);
            padding: 0.65rem 1.25rem;
            background: rgba(15, 23, 42, 0.85);
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 999px;
            font-size: 0.9rem;
            color: var(--text);
            box-shadow: 0 12px 30px rgba(2, 6, 23, 0.55);
            z-index: 8;
        }

        .estimate-notice.hidden {
            display: none;
        }
            gap: 16px;
            text-align: left;
            color: var(--text);
        }

        .confirm-icon {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: rgba(250, 204, 21, 0.15);
            border: 1px solid rgba(250, 204, 21, 0.5);
            display: grid;
            place-items: center;
            color: #fbbf24;
            font-size: 1.75rem;
        }

        .confirm-title {
            font-size: 1.15rem;
            font-weight: 600;
        }

        .confirm-message {
            font-size: 0.95rem;
            color: rgba(226, 232, 240, 0.85);
            line-height: 1.5;
        }

        .confirm-actions {
            margin-top: 0.5rem;
            display: flex;
            gap: 0.75rem;
            justify-content: flex-end;
        }

        .confirm-btn {
            min-width: 120px;
            padding: 0.625rem 1.125rem;
            border-radius: 12px;
            font-size: 0.95rem;
            border: 1px solid transparent;
            transition: transform 0.15s ease, box-shadow 0.15s ease;
        }

        .confirm-btn:focus-visible {
            outline: 2px solid var(--accent);
            outline-offset: 2px;
        }

        .confirm-btn.ghost {
            background: transparent;
            color: rgba(226, 232, 240, 0.9);
            border-color: rgba(148, 163, 184, 0.4);
        }

        .confirm-btn.primary {
            background: #1d4ed8;
            color: #e2e8f0;
            box-shadow: 0 12px 30px rgba(30, 64, 175, 0.35);
        }

        .confirm-btn.danger {
            background: #dc2626;
            color: #fef2f2;
            box-shadow: 0 12px 30px rgba(220, 38, 38, 0.35);
        }

        .prompt-icon {
            background: rgba(56, 189, 248, 0.15) !important;
            border-color: rgba(56, 189, 248, 0.5) !important;
            color: #38bdf8 !important;
        }

        .prompt-input {
            width: 100%;
            margin-top: 0.75rem;
            padding: 0.75rem 0.875rem;
            background: rgba(15, 23, 42, 0.6);
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 12px;
            font-size: 0.95rem;
            color: var(--text);
            outline: none;
            transition: border-color 0.2s ease, box-shadow 0.2s ease;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .prompt-input:focus {
            border-color: rgba(56, 189, 248, 0.6);
            box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
        }

        .prompt-input::placeholder {
            color: rgba(148, 163, 184, 0.5);
        }

        .toast.info { border-color: rgba(56, 189, 248, 0.85); }
        .toast.success { border-color: rgba(52, 211, 153, 0.85); }
        .toast.error { border-color: rgba(248, 113, 113, 0.9); }
        .toast.warning { border-color: rgba(251, 191, 36, 0.9); }

        /* Settings Modal - Fullscreen Overlay */
        .settings-drawer {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(4px);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 24px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.24s ease;
            z-index: 1000;
        }
        
        .settings-drawer.visible {
            display: flex;
            opacity: 1;
            pointer-events: auto;
        }
        
        .settings-drawer-content {
            width: 85%;
            max-width: 1400px;
            height: auto;
            max-height: 88vh;
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 25px 80px rgba(2, 6, 23, 0.9);
        }
        
        /* Settings Header */
        .settings-modal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20px 28px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            flex-shrink: 0;
        }
        
        .settings-modal-title {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text);
            margin: 0;
        }
        
        .settings-modal-close {
            width: 32px;
            height: 32px;
            border: none;
            background: transparent;
            color: var(--muted);
            cursor: pointer;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            line-height: 1;
            transition: background 0.2s, color 0.2s;
        }
        
        .settings-modal-close:hover {
            background: rgba(148, 163, 184, 0.1);
            color: var(--text);
        }
        
        /* Settings Tabs */
        .settings-tabs {
            display: flex;
            gap: 0;
            padding: 0 28px;
            background: rgba(15, 23, 42, 0.5);
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            flex-shrink: 0;
        }
        
        .settings-tab {
            padding: 14px 20px;
            background: transparent;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--muted);
            font-size: 0.875rem;
            font-weight: 500;
            cursor: pointer;
            transition: color 0.2s, border-color 0.2s;
            white-space: nowrap;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .settings-tab svg {
            width: 1rem;
            height: 1rem;
            flex-shrink: 0;
        }
        
        .settings-tab:hover {
            color: var(--text);
        }
        
        .settings-tab.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }
        
        /* Settings Body - scrollable area */
        .settings-body {
            flex: 1;
            overflow-y: auto;
            padding: 24px 28px;
            min-height: 0;
        }
        
        .settings-body form {
            display: block;
            height: 100%;
        }
        
        /* Settings Footer */
        .settings-modal-footer {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 12px;
            padding: 16px 28px;
            border-top: 1px solid rgba(148, 163, 184, 0.15);
            background: rgba(15, 23, 42, 0.5);
            flex-shrink: 0;
        }
        
        .settings-modal-footer .btn-secondary {
            padding: 10px 20px;
            background: transparent;
            border: 1px solid rgba(148, 163, 184, 0.3);
            border-radius: 8px;
            color: var(--text);
            font-size: 0.875rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        
        .settings-modal-footer .btn-secondary:hover {
            background: rgba(148, 163, 184, 0.1);
            border-color: rgba(148, 163, 184, 0.5);
        }
        
        .settings-modal-footer .btn-primary {
            padding: 10px 24px;
            border-radius: 8px;
            font-size: 0.875rem;
        }
        
        /* Legacy settings styles - keep for content compatibility */
        .settings-scroll {
            display: block;
        }
        
        /* Settings Tab Content */
        .settings-tab-content {
            display: none;
        }
        
        .settings-tab-content.active {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            grid-auto-rows: min-content;
        }

        .settings-tab-content.active[data-tab-content="general"] {
            grid-template-areas:
                "lang prompt"
                "context cache"
                "config preset"
                "fontes preset";
            grid-template-rows: auto auto auto auto;
            align-content: start;
        }
        
        /* Layout SIMPLIFICADO: sem predefinições, 3x2 grid */
        .settings-tab-content.active[data-tab-content="general"].config-simplificada {
            grid-template-areas:
                "lang prompt"
                "context cache"
                "config fontes";
            grid-template-rows: auto auto auto;
        }
        
        .settings-tab-content.active[data-tab-content="general"].config-simplificada .settings-card.general-preset {
            display: none !important;
        }

        .settings-card.general-lang { grid-area: lang; }
        .settings-card.general-prompt { grid-area: prompt; }
        .settings-card.general-context { grid-area: context; }
        .settings-card.general-cache { grid-area: cache; }
        .settings-card.general-preset { 
            grid-area: preset;
        }
        .settings-card.general-fontes { 
            grid-area: fontes; 
        }
        .settings-card.general-config-type { 
            grid-area: config;
        }
        .settings-card.general-spacer {
            display: none;
        }

        .settings-card.general-config-type,
        .settings-card.general-preset {
            align-self: start;
        }

        /* Fontes com mesmo estilo do Cache (padrão) */
        .settings-card.general-config-type {
            padding: 10px 12px;
        }

        .settings-card.general-config-type .settings-description {
            margin-bottom: 6px;
            font-size: 0.76rem;
        }

        .settings-card.general-config-type .lang-toggle {
            margin-top: 6px !important;
        }

        /* TAB: Recuperação — layout em duas colunas (esquerda: BM25/Dense/ColBERT/HiRAG; direita: Graph/PPR) */
        .retriever-layout {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            align-items: start;
        }

        .retriever-layout .retriever-column {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-self: stretch;
            min-width: 0;
        }

        @media (max-width: 920px) {
            .retriever-layout {
                grid-template-columns: 1fr;
            }
        }

        /* TAB: Ingestão — layout em duas colunas (esquerda: pós-processamento/filtros; direita: conversor/chunking/HiRAG) */
        .ingestion-layout {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            align-items: start;
        }

        .ingestion-layout .ingestion-column {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-self: stretch;
            min-width: 0;
        }

        @media (max-width: 920px) {
            .ingestion-layout {
                grid-template-columns: 1fr;
            }
        }

        /* TAB: Otimização — layout em duas colunas (esquerda: HyDE; direita: IRCoT) */
        .optimization-layout {
            grid-column: 1 / -1;
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 20px;
            align-items: start;
        }

        .optimization-layout .optimization-column {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-self: stretch;
            min-width: 0;
        }

        @media (max-width: 920px) {
            .optimization-layout {
                grid-template-columns: 1fr;
            }
        }

        /* TAB: Combinação — empilha Graph+Dense + Rerankers para casar altura do Hypergraph */
        .settings-tab-content.active[data-tab-content="combination"] {
            align-items: stretch;
        }

        .settings-tab-content.active[data-tab-content="combination"] .settings-stack {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-self: stretch;
            height: 100%;
            min-height: 0;
        }

        .settings-tab-content.active[data-tab-content="combination"] .settings-stack > .settings-card {
            flex: 0 0 auto;
        }

        .settings-tab-content.active[data-tab-content="combination"] .settings-stack > .settings-card.fill-remaining {
            flex: 1 1 auto;
            min-height: 0;
        }

        /* TAB: Otimização — HyDE à esquerda; IRCoT + Hierarchical à direita */
        .settings-tab-content.active[data-tab-content="optimization"] {
            align-items: start;
        }

        .settings-tab-content.active[data-tab-content="optimization"] .optimization-right-stack {
            display: flex;
            flex-direction: column;
            gap: 20px;
            align-self: start;
            height: auto;
            min-height: 0;
        }

        @media (max-width: 920px) {
            .settings-tab-content.active[data-tab-content="optimization"] {
                grid-template-columns: 1fr;
            }

            .settings-tab-content.active[data-tab-content="optimization"] .optimization-right-stack {
                grid-column: 1 / -1;
            }
        }
        
        /* Settings Card */
        .settings-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(148, 163, 184, 0.15);
            border-radius: 12px;
            padding: 18px;
        }
        
        .settings-card.full-width {
            grid-column: 1 / -1;
        }
        
        .settings-card h4 {
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--text);
            margin: 0 0 10px 0;
        }
        
        .settings-description {
            font-size: 0.8rem;
            color: var(--muted);
            margin-bottom: 10px;
            line-height: 1.4;
        }
        
        /* Compact Slider - DEPRECATED, use slider-field */
        .slider-compact {
            display: flex;
            align-items: center;
            gap: 10px;
            margin-top: 8px;
        }
        
        .slider-compact label {
            font-size: 0.8rem;
            color: var(--text);
            min-width: 100px;
        }
        
        .slider-compact input[type="range"] {
            flex: 1;
            height: 4px;
            border-radius: 2px;
            background: rgba(148, 163, 184, 0.25);
            -webkit-appearance: none;
            appearance: none;
            max-width: 150px;
        }
        
        .slider-compact input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--accent);
            cursor: pointer;
        }
        
        .slider-compact .slider-value {
            min-width: 30px;
            text-align: right;
            font-weight: 600;
            color: var(--accent);
            font-size: 0.8rem;
        }
        
        /* Standard Slider - Use this pattern for all sliders */
        .slider-field {
            margin-top: 8px;
        }
        
        .slider-row {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .slider-row > span:first-child {
            font-size: 0.85rem;
            color: var(--text);
            min-width: 140px;
        }
        
        .slider-row input[type="range"] {
            flex: 1;
            height: 4px;
            border-radius: 2px;
            background: rgba(148, 163, 184, 0.25);
            -webkit-appearance: none;
            appearance: none;
            max-width: 200px;
        }
        
        .slider-row input[type="range"]::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--accent);
            cursor: pointer;
        }
        
        .slider-row input[type="range"]::-moz-range-thumb {
            width: 14px;
            height: 14px;
            border-radius: 50%;
            background: var(--accent);
            border: none;
            cursor: pointer;
        }
        
        .slider-row .slider-value {
            min-width: 40px;
            text-align: right;
            font-weight: 600;
            color: var(--accent);
            font-size: 0.85rem;
        }
        
        /* Disabled state for slider controls */
        .slider-field.disabled,
        .toggle-controlled.disabled {
            opacity: 0.4;
            pointer-events: none;
        }
        
        /* Language Toggle Button */
        .lang-toggle {
            display: inline-flex;
            background: rgba(148, 163, 184, 0.15);
            border-radius: 6px;
            padding: 2px;
            gap: 2px;
        }
        
        .lang-toggle button {
            padding: 6px 16px;
            border: none;
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            background: transparent;
            color: var(--muted);
        }
        
        .lang-toggle button.active {
            background: var(--accent);
            color: #fff;
        }
        
        .lang-toggle button:hover:not(.active) {
            background: rgba(148, 163, 184, 0.1);
        }

        /* Compact cards (ex: Fontes) */
        .settings-card.compact-card {
            padding: 8px 10px !important;
        }

        .settings-card.compact-card h4 {
            margin-bottom: 4px;
            font-size: 0.85rem;
        }

        .settings-card.compact-card .toggle-row {
            margin-top: 2px;
        }

        /* Spacer card for grid alignment in General tab */
        .settings-card.settings-card-spacer {
            padding: 0;
            min-height: 0;
            border: none;
            background: transparent;
            box-shadow: none;
        }
        
        /* Retriever Item */
        .retriever-item {
            padding: 10px 0;
            border-bottom: 1px solid rgba(148, 163, 184, 0.1);
        }
        
        .retriever-item:last-child {
            border-bottom: none;
            padding-bottom: 0;
        }
        
        .retriever-item:first-child {
            padding-top: 0;
        }
        
        /* Disabled state for settings cards */
        .settings-card.disabled,
        .slider-compact.disabled,
        .retriever-item.disabled {
            opacity: 0.5;
            pointer-events: none;
            user-select: none;
        }
        
        .slider-compact.disabled input[type="range"] {
            cursor: not-allowed;
        }
        
        /* Toggle-controlled sections */
        .toggle-controlled {
            transition: opacity 0.2s ease;
        }
        
        .toggle-controlled.disabled {
            opacity: 0.4;
            pointer-events: none;
        }

        .floating-panel-btn {
            display: none;
        }

        .floating-panel-btn:hover {
            opacity: 1;
            transform: translateY(-1px);
        }

        .library-drawer {
            position: fixed;
            top: 0;
            bottom: 0;
            left: 0;
            width: min(380px, 100%);
            background: rgba(15, 23, 42, 0.96);
            border: 2px solid rgba(148, 163, 184, 0.2);
            border-radius: 0;
            padding: 16px;
            box-shadow: none;
            transform: translateX(-110%);
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.2s ease, transform 0.22s ease;
            z-index: 9999;
            overflow: hidden;
        }

        .library-drawer.reader {
            width: min(1180px, 92vw);
        }

        .library-drawer.visible {
            opacity: 1;
            pointer-events: auto;
            transform: translateX(0);
        }

        /* 3-panel mode: dock Workspace as a normal grid column (never overlay). */
        .chat-stage.three-panels .library-drawer {
            position: relative;
            top: auto;
            bottom: auto;
            left: auto;
            width: auto;
            transform: none;
            opacity: 1;
            pointer-events: auto;
            transition: none;
            z-index: 1;
            border-radius: 16px;
            background: rgba(15, 23, 42, 0.15);
        }

        .chat-stage.three-panels .library-drawer.visible {
            transform: none;
        }

        .library-header h3 {
            font-size: 0.95rem;
            margin-bottom: 4px;
        }

        .library-header p {
            font-size: 0.78rem;
            color: var(--muted);
            margin-bottom: 0.875rem;
        }

        .workspace-view {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .workspace-view.reader-layout {
            display: grid;
            grid-template-columns: minmax(260px, 360px) 1fr;
            gap: 14px;
            height: 100%;
            min-height: 0;
        }

        .workspace-left {
            display: flex;
            flex-direction: column;
            gap: 12px;
            height: calc(100vh - 80px);
            overflow-y: auto;
            overflow-x: hidden;
        }

        .doc-preview {
            border: 2px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            background: rgba(15, 23, 42, 0.15);
            padding: 0;
            position: relative;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        .doc-preview.hidden {
            display: none;
        }

        .doc-preview-header {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 10px;
            margin-bottom: 0;
            position: absolute;
            top: 6px;
            left: 8px;
            right: 8px;
            z-index: 5;
            pointer-events: none;
            background: transparent;
        }

        .doc-preview-title {
            display: none;
        }

        .doc-preview-body {
            flex: 1;
            overflow: hidden;
            min-height: 0;
            padding-right: 0;
        }

        .doc-preview.preview-text .doc-preview-body {
            overflow: auto;
            /* Add inner padding for plain-text/markdown previews and keep content clear of the absolute header */
            padding: 44px 0.9rem 0.9rem 0.9rem;
        }

        .doc-preview-header .icon-btn {
            pointer-events: auto;
            width: 34px;
            height: 34px;
            border-radius: 8px;
            background: transparent;
            color: var(--text);
        }

        .doc-preview-header .icon-btn:hover {
            background: rgba(148, 163, 184, 0.15);
        }

        .doc-preview-frame {
            width: 100%;
            height: 100%;
            border: none;
            border-radius: 12px;
            background: rgba(8, 15, 30, 0.35);
        }

        .doc-preview-text {
            white-space: pre-wrap;
            word-break: break-word;
            font-size: 0.86rem;
            line-height: 1.45;
            color: rgba(226, 232, 240, 0.92);
        }

        .workspace-view[hidden] {
            display: none !important;
        }

        .workspace-top {
            display: flex;
            align-items: center;
            gap: 10px;
            padding-top: 6px;
            /* Match collection card inner padding so header actions align with row actions */
            padding-right: 0.75rem;
        }

        .workspace-title {
            font-size: 0.9rem;
            font-weight: 700;
            color: var(--text);
            flex: 1;
            min-width: 0;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .workspace-folder-icon {
            width: 16px;
            height: 16px;
            flex: 0 0 16px;
            opacity: 0.95;
        }

        .workspace-back-btn {
            width: 34px;
            height: 34px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: transparent;
            color: var(--text);
            cursor: pointer;
        }

        .workspace-back-btn:hover {
            background: rgba(15, 23, 42, 0.35);
        }

        .workspace-add-btn {
            width: 28px;
            height: 28px;
            background: transparent;
            border: none;
            color: var(--muted);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1.1rem;
            font-weight: 700;
            line-height: 1;
            padding: 0;
            flex: 0 0 28px;
        }

        .workspace-add-btn:hover {
            color: var(--text);
        }

        .workspace-upload-btn {
            height: 34px;
            padding: 0 12px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: transparent;
            color: var(--text);
            cursor: pointer;
            font-size: 0.8rem;
            font-weight: 600;
        }

        .workspace-upload-btn:hover {
            background: rgba(15, 23, 42, 0.35);
        }

        .collection-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            flex-shrink: 0;
        }

        .collection-list-item {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 10px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            padding: 0.75rem;
            cursor: pointer;
            background: rgba(15, 23, 42, 0.15);
        }

        .collection-actions-btn {
            width: 28px;
            height: 28px;
            border-radius: 10px;
            border: 1px solid rgba(148, 163, 184, 0.18);
            background: transparent;
            color: rgba(226, 232, 240, 0.8);
            font-size: 0.9rem;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex: 0 0 28px;
            margin-left: auto;
            cursor: pointer;
        }

        .collection-actions-btn:hover {
            background: rgba(15, 23, 42, 0.35);
        }

        .collection-actions-btn:focus-visible {
            outline: 2px solid rgba(56, 189, 248, 0.7);
            outline-offset: 2px;
        }

        .collection-item-menu {
            position: fixed;
            min-width: 160px;
            padding: 6px;
            border-radius: 14px;
            border: 1px solid rgba(148, 163, 184, 0.2);
            background: rgba(17, 25, 40, 0.98);
            box-shadow: 0 18px 60px rgba(2, 6, 23, 0.75);
            z-index: 2100;
        }

        .collection-item-menu.hidden {
            display: none;
        }

        .collection-item-menu button {
            width: 100%;
            border: 0;
            background: transparent;
            color: rgba(226, 232, 240, 0.9);
            padding: 10px 10px;
            border-radius: 12px;
            text-align: left;
            cursor: pointer;
            font-size: 0.85rem;
            font-weight: 600;
        }

        .collection-item-menu button:hover {
            background: rgba(15, 23, 42, 0.45);
        }

        .collection-item-menu button.danger {
            color: var(--danger);
        }

        .collection-list-item:hover {
            background: rgba(15, 23, 42, 0.35);
        }


        .collection-list-item.droppable {
            border-color: rgba(56, 189, 248, 0.6);
            background: rgba(15, 23, 42, 0.95);
        }

        .collection-list-item.active {
            border-color: rgba(56, 189, 248, 0.6);
        }
        .collection-list-item strong {
            font-size: 0.86rem;
            color: var(--text);
            flex: 1;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* removed: collection status pill + unselect-all control */

        .workspace-unselect input {
            accent-color: var(--accent);
        }

        .library-files-head {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 0.85rem;
            margin-bottom: 0.5rem;
        }

        .library-files-head > span {
            font-size: 0.9rem;
            font-weight: 700;
            color: var(--text);
        }

        .library-files {
            margin-top: 14px;
            display: flex;
            flex-direction: column;
            flex-shrink: 0;
        }

        .library-select-all {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            font-size: 0.78rem;
            color: var(--muted);
            margin-bottom: 8px;
            border: 2px solid transparent;
            border-radius: 16px;
            padding: 0.75rem;
            user-select: none;
        }

        .library-select-all span {
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .library-scope-hint {
            font-size: 0.74rem;
            color: var(--muted);
            border: 1px dashed rgba(148, 163, 184, 0.35);
            background: rgba(15, 23, 42, 0.25);
            border-radius: 12px;
            padding: 0.6rem 0.75rem;
            margin-bottom: 10px;
            line-height: 1.35;
        }

        .library-scope-hint strong {
            color: var(--text);
        }

        #dropTargetOverlay .confirm-dialog {
            border: none;
        }

        .doc-scope-checkbox {
            width: 16px;
            height: 16px;
            accent-color: var(--accent);
            cursor: pointer;
        }

        .library-file-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .library-file-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            border: 2px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            padding: 0.75rem;
            gap: 0.75rem;
        }

        .library-file-info {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .library-file-info strong {
            font-size: 0.86rem;
            color: var(--text);
            display: block;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .library-file-info span {
            font-size: 0.75rem;
            color: var(--muted);
        }

        .doc-remove-btn {
            width: auto;
            height: auto;
            padding: 0;
            margin: 0;
            border-radius: 0;
            border: none;
            color: rgba(248, 113, 113, 0.9);
            background: transparent;
            box-shadow: none;
            font-size: 0.9rem;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
        }

        .doc-remove-btn:focus,
        .doc-remove-btn:focus-visible {
            outline: none;
            box-shadow: none;
        }

        .doc-remove-btn:hover {
            color: rgba(248, 113, 113, 1);
            background: transparent;
        }

        .library-empty {
            font-size: 0.8rem;
            color: var(--muted);
            text-align: center;
            padding: 2.5rem 0.75rem;
            border: 1px dashed rgba(148, 163, 184, 0.3);
            border-radius: 16px;
        }

        .settings-drawer h3 {
            font-size: 1rem;
            margin: 0;
        }

        .settings-header {
            display: flex;
            flex-direction: column;
            gap: 4px;
        }

        .settings-header p {
            font-size: 0.78rem;
            color: var(--muted);
        }

        .settings-field {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 1rem;
            font-size: 0.85rem;
        }

        .settings-field span {
            letter-spacing: 0.01em;
        }

        .api-key-row {
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .api-key-input {
            flex: 1;
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 12px;
            background: transparent;
            color: var(--text);
            padding: 8px 12px;
            font-size: 0.85rem;
        }

        .api-key-input:focus {
            outline: none;
            border-color: var(--accent);
        }

        .api-key-input.masked {
            letter-spacing: 0.04em;
            color: rgba(226, 232, 240, 0.85);
        }

        .api-key-remove {
            width: 40px;
            height: 40px;
            border-radius: 12px;
            border: 1px solid rgba(248, 113, 113, 0.4);
            background: transparent;
            color: var(--danger);
            font-size: 1.4rem;
            line-height: 1;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
        }

        .api-key-remove:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .api-key-remove:not(:disabled):hover {
            border-color: var(--danger);
            background: rgba(248, 113, 113, 0.15);
            color: #fee2e2;
        }

        .help-emph {
            color: #3b82f6;
            font-weight: 600;
        }

        .help-close-btn {
            min-width: 26px;
            width: 26px;
            height: 26px;
            padding: 0;
            font-size: 0.95rem;
            line-height: 1;
        }

        .field-hint {
            display: block;
            margin-top: 6px;
            font-size: 0.75rem;
            color: rgba(148, 163, 184, 0.7);
        }

        .field-hint.error {
            color: var(--danger);
        }

        .settings-select {
            position: relative;
            display: inline-flex;
            width: 100%;
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 12px;
        }

        .settings-text-input {
            width: 100%;
            border: 1px solid rgba(148, 163, 184, 0.35);
            border-radius: 12px;
            background: rgba(15, 23, 42, 0.6);
            padding: 10px 12px;
            font-size: 0.85rem;
            color: var(--text);
            transition: border-color 0.2s ease, background 0.2s ease;
        }

        .settings-text-input::placeholder {
            color: rgba(148, 163, 184, 0.8);
        }

        .settings-text-input:focus {
            outline: none;
            border-color: var(--accent);
            background: rgba(15, 23, 42, 0.75);
        }

        .settings-text-input:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .suggest-anchor {
            position: relative;
        }

        .suggest-list {
            position: absolute;
            left: 0;
            right: 0;
            top: calc(100% + 6px);
            margin-top: 0;
            border: 1px solid rgba(148, 163, 184, 0.18);
            border-radius: 12px;
            background: rgba(2, 6, 23, 0.72);
            overflow: hidden;
            z-index: 50;
            max-height: 220px;
            overflow-y: auto;
            box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
        }

        .suggest-list.hidden {
            display: none;
        }

        .suggest-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            padding: 8px 10px;
            cursor: pointer;
            user-select: none;
            border-top: 1px solid rgba(148, 163, 184, 0.08);
        }

        .suggest-item:first-child {
            border-top: none;
        }

        .suggest-item:hover,
        .suggest-item.active {
            background: rgba(148, 163, 184, 0.10);
        }

        .suggest-item .suggest-model {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 0.82rem;
            color: rgba(226, 232, 240, 0.95);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .suggest-item .suggest-meta {
            font-size: 0.72rem;
            color: rgba(148, 163, 184, 0.85);
            flex: 0 0 auto;
        }

        .help-icon-btn {
            width: 18px;
            height: 18px;
            min-width: 18px;
            min-height: 18px;
            border-radius: 999px;
            border: 1px solid rgba(148, 163, 184, 0.45);
            background: transparent;
            padding: 0;
            margin-left: 6px;
            color: rgba(226, 232, 240, 0.85);
            font-weight: 700;
            font-size: 0.78rem;
            line-height: 1;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            transform: translateY(-1px);
            opacity: 0.9;
            flex-shrink: 0;
            pointer-events: auto !important;
            position: relative;
            z-index: 10;
        }

        .help-icon-btn:hover {
            border-color: rgba(148, 163, 184, 0.40);
            color: rgba(226, 232, 240, 0.78);
        }

        .openrouter-field {
            display: flex !important;
        }

        .model-picker-close {
            width: 26px;
            height: 26px;
            min-width: 0;
            padding: 0;
            border-radius: 10px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: 1.05rem;
            line-height: 1;
        }

        .model-picker-dialog {
            max-width: 760px;
            width: min(760px, calc(100vw - 28px));
            max-height: 78vh;
            overflow: hidden;
        }

        .model-picker-list {
            margin-top: 10px;
            border: 1px solid rgba(148, 163, 184, 0.16);
            border-radius: 12px;
            background: rgba(2, 6, 23, 0.65);
            overflow: auto;
            max-height: 52vh;
        }

        .model-picker-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 10px 12px;
            cursor: pointer;
            user-select: none;
            border-top: 1px solid rgba(148, 163, 184, 0.08);
        }

        .model-picker-item:first-child {
            border-top: none;
        }

        .model-picker-item:hover {
            background: rgba(148, 163, 184, 0.10);
        }

        .model-picker-item .model-id {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 0.84rem;
            color: rgba(226, 232, 240, 0.96);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .model-picker-item .model-meta {
            font-size: 0.74rem;
            color: rgba(148, 163, 184, 0.9);
            flex: 0 0 auto;
            white-space: nowrap;
        }

        .settings-select::after {
            content: '▾';
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: rgba(226, 232, 240, 0.8);
            pointer-events: none;
        }

        .settings-select select {
            width: 100%;
            padding: 8px 28px 8px 12px;
            background: transparent;
            border: none;
            color: var(--text);
            font-size: 0.85rem;
            appearance: none;
        }

        .settings-select select.empty {
            color: rgba(148, 163, 184, 0.7);
        }

        .settings-select select:focus {
            outline: none;
        }

        .settings-select option {
            color: #0f172a;
        }

        .settings-drawer input,
        .settings-drawer p,
        .mode-pill {
            font-size: 0.85rem;
        }

        .settings-drawer.visible {
            opacity: 1;
            pointer-events: auto;
            transform: translateY(0);
        }

        /* 3-panel mode: dock Workspace as a normal grid column (never overlay). */
        .chat-stage.three-panels .library-drawer {
            position: relative;
            top: auto;
            bottom: auto;
            left: auto;
            width: auto;
            transform: none;
            opacity: 1;
            pointer-events: auto;
            transition: none;
            z-index: 1;
            border-radius: 16px;
            background: rgba(15, 23, 42, 0.15);
        }

        .chat-stage.three-panels .library-drawer.visible {
            transform: none;
        }

        .settings-drawer form {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 16px;
            min-height: 0;
        }

        .settings-scroll {
            flex: 1;
            overflow-y: auto;
            padding-right: 6px;
            margin-right: -6px;
            display: flex;
            flex-direction: column;
            gap: 18px;
        }

        .settings-scroll::-webkit-scrollbar {
            width: 6px;
        }

        .settings-scroll::-webkit-scrollbar-thumb {
            background: rgba(148, 163, 184, 0.4);
            border-radius: 12px;
        }

        .settings-section {
            border: 1px solid rgba(148, 163, 184, 0.25);
            border-radius: 16px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            background: rgba(8, 15, 30, 0.35);
        }

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

        .settings-section-head h4 {
            font-size: 0.9rem;
            letter-spacing: 0.01em;
        }

        .settings-section-head p {
            font-size: 0.75rem;
            color: var(--muted);
        }

        .settings-actions {
            border-top: 1px solid rgba(148, 163, 184, 0.25);
            padding-top: 10px;
            display: flex;
            justify-content: flex-end;
        }

        .toggle-row {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.85rem;
        }

        .toggle-row input[type="checkbox"] {
            width: 18px;
            height: 18px;
        }

        .retriever-controls.disabled {
            opacity: 0.5;
            pointer-events: none;
        }

        .retriever-controls .toggle-row {
            padding: 6px 0;
        }

        /* Load Balancer Styles */
        .load-balancer-config {
            border: 1px solid rgba(148, 163, 184, 0.25);
            border-radius: 14px;
            padding: 14px;
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .providers-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
            max-height: 300px;
            overflow-y: auto;
        }

        .provider-item {
            display: flex;
            gap: 8px;
            align-items: center;
            padding: 8px;
            background: rgba(148, 163, 184, 0.1);
            border-radius: 8px;
        }

        .provider-item input {
            flex: 1;
            padding: 6px 10px;
            border: 1px solid rgba(148, 163, 184, 0.3);
            border-radius: 6px;
            background: var(--bg);
            color: var(--text);
            font-size: 0.85rem;
        }

        .provider-item input.provider-name {
            flex: 0.8;
        }

        .provider-item input.provider-model {
            flex: 1.2;
        }

        .provider-item input.provider-weight {
            flex: 0.3;
            text-align: center;
        }

        .provider-item button {
            padding: 4px 8px;
            border: none;
            border-radius: 4px;
            background: rgba(239, 68, 68, 0.2);
            color: #ef4444;
            cursor: pointer;
            font-size: 0.8rem;
        }

        .provider-item button:hover {
            background: rgba(239, 68, 68, 0.3);
        }

        .btn-small {
            padding: 6px 12px;
            font-size: 0.8rem;
        }

        .rerank-controls {
            border: 1px solid rgba(148, 163, 184, 0.25);
            border-radius: 14px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            transition: opacity 0.2s ease;
        }

        .rerank-controls.disabled {
            opacity: 0.5;
            pointer-events: none;
        }

        .rerank-heading {
            font-size: 0.78rem;
            color: var(--muted);
        }

        .retriever-grid {
            display: flex;
            gap: 16px;
            flex-wrap: wrap;
        }

        .retriever-grid + .retriever-grid {
            margin-top: 10px;
        }

        .retriever-grid .toggle-row {
            flex: 1;
        }

        .retriever-tab-options {
            margin-top: 6px;
        }

        .retriever-fields {
            display: flex;
            gap: 12px;
            flex-wrap: wrap;
            margin-top: 10px;
        }

        .retriever-field {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 4px;
            font-size: 0.8rem;
        }

        .retriever-field input {
            width: 100%;
        }

        .retriever-options.disabled {
            opacity: 0.65;
        }

        .hyde-controls {
            border: 1px solid rgba(148, 163, 184, 0.25);
            border-radius: 14px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 12px;
            transition: opacity 0.2s ease;
        }

        .hyde-controls.disabled {
            opacity: 0.5;
            pointer-events: none;
        }

        .hyde-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
            gap: 12px;
        }

        .hyde-field {
            display: flex;
            flex-direction: column;
            gap: 4px;
            font-size: 0.8rem;
        }

        .hyde-field textarea {
            min-height: 90px;
            resize: vertical;
        }

        .toggle-row.small span {
            font-size: 0.8rem;
            color: var(--muted);
        }


        .mode-options {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .mode-pill {
            flex: 1;
            text-align: center;
            padding: 10px;
            border-radius: 12px;
            border: 1px solid rgba(148, 163, 184, 0.35);
            cursor: pointer;
            user-select: none;
        }

        .mode-pill.active {
            border-color: var(--accent);
            background: rgba(14, 165, 233, 0.2);
        }

        .mode-tooltip {
            margin-top: 8px;
            font-size: 0.8rem;
            color: rgba(226, 232, 240, 0.9);
            background: rgba(15, 23, 42, 0.8);
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 12px;
            padding: 10px 12px;
            line-height: 1.4;
        }

        /* Tablet breakpoint */
        @media (max-width: 1024px) and (min-width: 721px) {
            .sessions-sidebar {
                width: 15rem;
                min-width: 15rem;
            }
            .chat-window {
                padding: 0 var(--chat-gutter);
            }
            .chat-scroll {
                padding: 0;
            }
        }

        /* Large desktop breakpoint */
        @media (min-width: 1440px) {
            .sessions-sidebar {
                width: 19rem;
                min-width: 19rem;
            }
            .chat-window {
                padding: 0 var(--chat-gutter);
            }
            .chat-scroll {
                padding: 0;
            }
            #chatForm {
                max-width: 1000px;
            }
        }

        /* Mobile breakpoint */
        @media (max-width: 720px) {
            :root {
                --chat-gutter: 16px;
                --chat-content-gutter-left: 16px;
                --chat-content-gutter-right: 16px;
            }
            .chat-header-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
            .collection-controls { width: 100%; justify-content: flex-start; margin-left: 0; }
            #collectionSelect { width: 100%; }
            .chat-window { padding: 0 var(--chat-gutter); }
            #chatForm {
                flex-wrap: wrap;
                border-radius: 10px;
                gap: 0;
                padding: 12px;
            }
            #chatForm textarea {
                width: 100%;
                min-height: 80px;
            }
            .attachment-btn,
            #send-btn {
                width: 3rem;
                height: 3rem;
            }
            .mode-selector-popover {
                min-width: 240px;
            }
            /* Settings modal responsive */
            .settings-drawer-content {
                width: 95%;
                height: 90%;
            }
            .settings-tabs {
                overflow-x: auto;
                padding: 0 16px;
            }
            .settings-body {
                padding: 16px;
            }
        }

        /* Welcome Modal (Trial Users) — same dimensions as settings modal */
        .welcome-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            backdrop-filter: blur(4px);
            display: none;
            align-items: center;
            justify-content: center;
            padding: 24px;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.24s ease;
            z-index: 3000;
        }

        .welcome-overlay.visible {
            display: flex;
            opacity: 1;
            pointer-events: auto;
        }

        .welcome-content {
            width: 85%;
            max-width: 1400px;
            height: auto;
            max-height: 88vh;
            background: rgba(15, 23, 42, 0.98);
            border: 1px solid rgba(148, 163, 184, 0.2);
            border-radius: 16px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 25px 80px rgba(2, 6, 23, 0.9);
        }

        .welcome-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 20px 28px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
            flex-shrink: 0;
        }

        .welcome-title {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text);
            margin: 0;
        }

        .welcome-body {
            flex: 1;
            overflow-y: auto;
            padding: 20px 28px;
            min-height: 0;
        }

        .welcome-footer {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 16px 28px;
            border-top: 1px solid rgba(148, 163, 184, 0.15);
            background: rgba(15, 23, 42, 0.5);
            flex-shrink: 0;
        }

        .welcome-dont-show {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.875rem;
            color: var(--muted);
            cursor: pointer;
            user-select: none;
        }

        .welcome-dont-show input[type="checkbox"] {
            width: 16px;
            height: 16px;
            cursor: pointer;
            accent-color: var(--accent);
        }

        .welcome-start-btn {
            padding: 10px 28px;
            border-radius: 8px;
            font-size: 0.875rem;
            font-weight: 500;
        }

        /* Welcome modal content sections */
        .welcome-intro {
            margin-bottom: 18px;
            font-size: 0.875rem;
            color: var(--text);
            line-height: 1.6;
        }

        .welcome-intro p {
            margin: 0;
        }

        .welcome-section {
            margin-bottom: 18px;
        }

        .welcome-section:last-child {
            margin-bottom: 0;
        }

        .welcome-section-title {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.925rem;
            font-weight: 600;
            color: var(--accent);
            margin: 0 0 8px 0;
        }

        .welcome-section-title svg {
            width: 17px;
            height: 17px;
            color: var(--accent);
            flex-shrink: 0;
        }

        .welcome-section-desc {
            font-size: 0.825rem;
            color: var(--muted);
            line-height: 1.5;
            margin: 0 0 10px 0;
        }

        .welcome-limits {
            list-style: none;
            padding: 0;
            margin: 0;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .welcome-limits li {
            display: flex;
            align-items: flex-start;
            gap: 10px;
            padding: 8px 14px;
            background: rgba(56, 189, 248, 0.06);
            border: 1px solid rgba(56, 189, 248, 0.15);
            border-radius: 8px;
            font-size: 0.8rem;
            color: var(--text);
            line-height: 1.45;
        }

        .welcome-limits li::before {
            content: '';
            flex-shrink: 0;
            width: 6px;
            height: 6px;
            margin-top: 7px;
            border-radius: 50%;
            background: var(--accent);
        }

        .welcome-limits li strong {
            color: var(--accent);
        }

        /* Icons table */
        .welcome-icons-table {
            width: 100%;
            border-collapse: separate;
            border-spacing: 0;
            border: 1px solid rgba(148, 163, 184, 0.15);
            border-radius: 10px;
            overflow: hidden;
            font-size: 0.8rem;
        }

        .welcome-icons-table thead tr {
            background: rgba(148, 163, 184, 0.08);
        }

        .welcome-icons-table th {
            padding: 7px 12px;
            text-align: left;
            font-weight: 600;
            color: var(--muted);
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 1px solid rgba(148, 163, 184, 0.15);
        }

        .welcome-icons-table th:first-child {
            width: 56px;
            text-align: center;
        }

        .welcome-icons-table td {
            padding: 7px 12px;
            color: var(--text);
            border-bottom: 1px solid rgba(148, 163, 184, 0.08);
            vertical-align: middle;
        }

        .welcome-icons-table tbody tr:last-child td {
            border-bottom: none;
        }

        .welcome-icons-table tbody tr:hover {
            background: rgba(148, 163, 184, 0.04);
        }

        .welcome-icon-cell {
            text-align: center;
        }

        .welcome-icon-cell svg {
            width: 18px;
            height: 18px;
            color: var(--accent);
            vertical-align: middle;
        }

        /* Steps */
        .welcome-steps {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .welcome-step {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 9px 14px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(148, 163, 184, 0.12);
            border-radius: 8px;
        }

        .welcome-step-number {
            flex-shrink: 0;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--accent), var(--accent-strong, #0ea5e9));
            color: #0f172a;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 0.8rem;
        }

        .welcome-step-text {
            font-size: 0.8rem;
            color: var(--text);
            line-height: 1.5;
            padding-top: 2px;
        }

        .welcome-step-text strong {
            color: var(--accent);
        }

        .welcome-inline-icon {
            display: inline-block;
            width: 18px;
            height: 18px;
            vertical-align: text-bottom;
            color: var(--accent);
            margin: 0 2px;
        }

        /* Help section */
        .welcome-help {
            padding: 12px 16px;
            background: rgba(56, 189, 248, 0.04);
            border: 1px solid rgba(56, 189, 248, 0.12);
            border-radius: 8px;
        }

        .welcome-help .welcome-section-title {
            margin-bottom: 8px;
        }

        .welcome-help .welcome-section-desc {
            margin-bottom: 0;
        }

        .welcome-link {
            color: var(--accent);
            text-decoration: none;
            font-weight: 500;
        }

        .welcome-link:hover {
            text-decoration: underline;
        }

        /* CSP: remove inline JS handlers (use CSS hover instead) */
        #applyPresetBtn:hover {
            background: var(--accent) !important;
            color: white !important;
            border-color: var(--accent) !important;
        }
