/* Extracted from static/index.html on 2026-05-02.
 * Source-of-truth: this file. Do not re-inline back into index.html.
 * Cache: served via /index.css with FastAPI default ETag/Last-Modified.
 */
        :root {
            --card-radius: 2rem;
            --card-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
            --card-shadow-hover: 0 22px 42px rgba(15, 23, 42, 0.18);
        }

        body { font-family: 'Montserrat', sans-serif; }

        textarea,
        input,
        select {
            min-width: 0;
        }

        /* Story 1.3: Pulse animation for EN LIGNE status dot */
        @keyframes status-pulse {
            0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(16,185,129,0); }
            50% { opacity: 0.7; transform: scale(1.35); box-shadow: 0 0 0 0.35rem rgba(16,185,129,0.18); }
        }
        .status-dot-pulse {
            display: inline-block;
            transform-origin: center;
            will-change: transform, opacity, box-shadow;
            animation: status-pulse 1.8s ease-in-out infinite;
        }

        /* Story 1.3: 200ms hover transitions for sidebar items */
        .sidebar-item {
            transition: background-color 200ms ease, color 200ms ease, transform 200ms ease;
        }

        /* Story 1.2 & 1.3: Agent card hover lift effect */
        .agent-card {
            border-radius: var(--card-radius);
            box-shadow: var(--card-shadow);
            backface-visibility: hidden;
            will-change: transform, box-shadow;
            transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease, background-color 200ms ease;
        }
        .agent-card:hover {
            transform: translateY(-6px);
            box-shadow: var(--card-shadow-hover);
        }

        .card-surface {
            border-radius: var(--card-radius);
        }

        /* Plan-based visibility — hide sub-agent sections for free/starter/startup.
           Only team/team_max/owner can see sub-agents.
           The body.plan-X class is set by refreshAuthBar() on login. */
        body.plan-free .subagent-section,
        body.plan-free .subagent-section + div,
        body.plan-pro .subagent-section,
        body.plan-pro .subagent-section + div,
        body.plan-starter .subagent-section,
        body.plan-starter .subagent-section + div,
        body.plan-free #sidebar-subagents,
        body.plan-pro #sidebar-subagents,
        body.plan-starter #sidebar-subagents,
        body.plan-free #sidebar-custom-agents,
        body.plan-pro #sidebar-custom-agents,
        body.plan-starter #sidebar-custom-agents {
            display: none !important;
        }

        /* team_max-only sub-agents (e.g. Mike Ross / Canadian law).
           Show only on plan-team_max and plan-owner; hide otherwise.
           Pair with [data-min-plan="team_max"] on the card. */
        body:not(.plan-team_max):not(.plan-owner) [data-min-plan="team_max"] {
            display: none !important;
        }

        /* Profile dropdown — uniform icon sizing + text fills remaining space */
        #profile-dropdown-menu button,
        #profile-dropdown-menu a {
            display: flex;
            align-items: center;
        }
        #profile-dropdown-menu svg {
            width: 1.25rem;
            height: 1.25rem;
            flex-shrink: 0;
        }
        /* Credits row has a different layout (justify-between) — keep flex */
        #profile-dropdown-menu > div:first-child {
            display: block;
        }
        #profile-dropdown-menu > div:first-child .flex.items-center {
            display: flex;
        }
        #profile-dropdown-menu > div:first-child svg {
            width: 1rem;
            height: 1rem;
        }

        .card-media {
            transform: scale(1.01);
            transition: transform 500ms ease;
        }

        .agent-card:hover .card-media {
            transform: scale(1.06);
        }

        .card-overlay {
            opacity: 0.84;
            transition: opacity 200ms ease;
        }

        .agent-card:hover .card-overlay {
            opacity: 1;
        }

        /* Uniform card alignment across all languages:
           lock title/role/subtitle to fixed heights with line-clamp so layout
           is identical whether the locale text is short (Chinese) or long
           (French, German, Spanish). Skills are already bottom-anchored via
           mt-auto so they stay aligned automatically. */
        .agent-card h3 {
            display: -webkit-box;
            -webkit-line-clamp: 1;
            -webkit-box-orient: vertical;
            overflow: hidden;
            height: 2.25rem;
            line-height: 2.25rem;
        }
        .agent-card h3 + p {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            height: 2.5rem;
            line-height: 1.25rem;
        }
        .agent-card h3 + p + p {
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
            height: 2rem;
            line-height: 1rem;
        }

        /* Language-responsive typography: verbose locales use smaller fonts
           so the title/role/subtitle fit the same fixed heights as compact
           locales (ZH, EN), keeping every card perfectly aligned. */
        html:lang(fr) .agent-card h3,
        html:lang(es) .agent-card h3,
        html:lang(pt) .agent-card h3 {
            font-size: 1.25rem;
        }
        html:lang(fr) .agent-card h3 + p,
        html:lang(es) .agent-card h3 + p,
        html:lang(pt) .agent-card h3 + p {
            font-size: 0.75rem;
            line-height: 1.15rem;
        }
        html:lang(fr) .agent-card h3 + p + p,
        html:lang(es) .agent-card h3 + p + p,
        html:lang(pt) .agent-card h3 + p + p {
            font-size: 0.65rem;
            line-height: 0.95rem;
        }
        html:lang(de) .agent-card h3 {
            font-size: 1.125rem;
        }
        html:lang(de) .agent-card h3 + p {
            font-size: 0.7rem;
            line-height: 1.1rem;
        }
        html:lang(de) .agent-card h3 + p + p {
            font-size: 0.625rem;
            line-height: 0.9rem;
        }

        .card-badge {
            display: inline-flex;
            align-items: center;
            min-height: 2rem;
            padding: 0.35rem 0.75rem;
            border-radius: 999px;
            backdrop-filter: blur(14px);
            background: rgba(15, 23, 42, 0.28);
            border: 1px solid rgba(255, 255, 255, 0.14);
        }

        .card-copy {
            text-shadow: 0 2px 10px rgba(15, 23, 42, 0.45);
        }

        /* Story 1.2: Skill tags */
        .skill-tag {
            display: inline-block;
            background: rgba(255,255,255,0.15);
            backdrop-filter: blur(4px);
            color: #0f172a;
            font-size: 0.65rem;
            font-weight: 600;
            padding: 2px 8px;
            border-radius: 999px;
            border: 1px solid rgba(255,255,255,0.1);
        }

        /* Story 1.2: Activity indicator */
        .activity-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            white-space: nowrap;
            background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(4px);
            border: 1px solid rgba(16,185,129,0.4);
            color: #6ee7b7;
            font-size: 0.65rem;
            font-weight: 700;
            padding: 0.3rem 0.65rem;
            border-radius: 999px;
            box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
            backdrop-filter: blur(12px);
            white-space: nowrap;
            max-width: min(100%, 13rem);
            overflow: hidden;
            text-overflow: ellipsis;
        }

        @media (max-width: 640px) {
            .dashboard-title {
                white-space: normal;
            }

            .hero-card-copy,
            .hero-card-button {
                width: 100%;
                max-width: none;
            }
        }

        #sprint4-toast {
            max-width: min(calc(100vw - 2rem), 32rem);
            white-space: normal;
            text-align: center;
        }

        @media (max-width: 767px) {
            html { font-size: 14px; } /* Point 5: Min 14px */

            /* iOS Safari rubber-band / blank-page-on-pull fix:
               iOS Safari ignores `interactive-widget=resizes-content` on iOS < 17.4 — the
               LAYOUT viewport (window.innerHeight, html.scrollHeight) stays at full screen
               height (e.g. 781px) when the keyboard opens, while only the VISUAL viewport
               (window.visualViewport.height) shrinks (e.g. 434px). Body content sized via
               --app-vh matches the visual viewport (434px), but html still spans 781px →
               pull-to-refresh / rubber-band overscroll exposes the 347px gap between
               body.scrollHeight (434) and documentElement.scrollHeight (781) as a blank
               white area. Locking html+body with overflow:hidden + overscroll-behavior:none
               kills the rubber-band; in-flow views keep their internal overflow-y-auto
               scrolling (#chat-box, #office-view, #automations-view, etc. are unaffected). */
            html, body {
                overflow: hidden;
                overscroll-behavior: none;
            }


            /* iOS Safari + virtual keyboard fix:
               #chat-view / #office-view / #automations-view / #integrations-view / #reports-view
               are in-flow children of #app-root, which already adapts to the visual viewport via
               --app-vh (set from window.visualViewport.height in main.js). Hardcoding 100dvh on
               them HERE was racing with the keyboard event on iOS Safari (dvh doesn't update
               synchronously when the virtual keyboard appears) — chat-view stayed at the pre-
               keyboard height, overflowed #app-root, and Safari scrolled the header off-screen
               to keep the input visible → blank-page bug.
               #chat-view itself is now promoted to position:fixed below so it follows --app-vh
               directly. The other in-flow views inherit h-full from Tailwind, which gives them
               100% of the JS-managed #app-root.
               Only #sidebar-view keeps 100dvh because it is position:fixed (overlay outside the
               app-root flow) and needs the full viewport. */
            #sidebar-view {
                height: 100dvh;
                min-height: 100dvh;
            }

            /* Point 6: Touch targets */
            button, a, .sidebar-item, .agent-card, .btn {
                min-height: 44px;
            }

            /* Point 5: Typography - Titles no overflow */
            h1, h2, h3, h4, h5, h6, .text-2xl, .text-3xl, .text-4xl {
                overflow-wrap: break-word;
                word-break: break-word;
                hyphens: auto;
            }

            #chat-settings-dropdown {
                width: min(14rem, calc(100vw - 2rem));
                max-width: calc(100vw - 2rem);
            }

            #workspace-dropdown {
                max-width: calc(100vw - 2rem);
            }

            #ab-color-picker {
                flex-wrap: wrap;
            }
        }

        /* Sprint 2: Accordion transitions for Brain modal */
        .brain-section-body {
            overflow: hidden;
            max-height: 600px;
            transition: max-height 0.3s ease, opacity 0.25s ease;
            opacity: 1;
        }
        .brain-section-body.collapsed {
            max-height: 0;
            opacity: 0;
        }
        .brain-chevron {
            transition: transform 0.25s ease;
        }
        .brain-chevron.collapsed {
            transform: rotate(-90deg);
        }

        /* Sprint 2: Chat chips horizontal scroll without scrollbar */
        #chat-chips {
            scrollbar-width: none;
            -ms-overflow-style: none;
            scroll-padding-inline: 0.25rem;
        }
        #chat-chips::-webkit-scrollbar { display: none; }

        .message-bubble {
            max-width: min(100%, 42rem);
            overflow-wrap: anywhere;
            word-break: break-word;
        }

        .message-bubble-agent {
            width: 100%;
        }

        .message-bubble-user {
            max-width: min(100%, 38rem);
        }

        .message-markdown {
            color: #374151;
            font-size: 0.9375rem;
            line-height: 1.65;
        }

        .message-markdown > :first-child {
            margin-top: 0;
        }

        .message-markdown > :last-child {
            margin-bottom: 0;
        }

        .message-markdown p,
        .message-markdown ul,
        .message-markdown ol,
        .message-markdown pre,
        .message-markdown blockquote,
        .message-markdown hr,
        .message-markdown table,
        .message-markdown h1,
        .message-markdown h2,
        .message-markdown h3,
        .message-markdown h4 {
            margin: 0 0 0.9rem;
        }

        .message-markdown h1,
        .message-markdown h2,
        .message-markdown h3,
        .message-markdown h4 {
            color: #111827;
            font-weight: 700;
            line-height: 1.3;
        }

        .message-markdown h1 { font-size: 1.2rem; }
        .message-markdown h2 { font-size: 1.1rem; }
        .message-markdown h3,
        .message-markdown h4 { font-size: 1rem; }

        .message-markdown ul,
        .message-markdown ol {
            padding-left: 1.35rem;
        }

        .message-markdown ul {
            list-style: disc;
        }

        .message-markdown ol {
            list-style: decimal;
        }

        .message-markdown li {
            margin: 0.35rem 0;
            padding-left: 0.15rem;
        }

        .message-markdown li > p {
            margin: 0.2rem 0;
        }

        .message-markdown strong {
            color: #111827;
            font-weight: 700;
        }

        .message-markdown em {
            font-style: italic;
        }

        .message-markdown a {
            color: #2563eb;
            text-decoration: underline;
            text-underline-offset: 0.16em;
        }

        .message-markdown code {
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
            font-size: 0.875em;
            background: #f3f4f6;
            color: #111827;
            padding: 0.125rem 0.375rem;
            border-radius: 0.375rem;
            word-break: break-word;
        }

        .message-markdown pre {
            overflow-x: auto;
            border-radius: 0.9rem;
            background: #0f172a;
            color: #e2e8f0;
            padding: 0.9rem 1rem;
            box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.14);
        }

        .message-markdown pre code {
            display: block;
            background: transparent;
            color: inherit;
            padding: 0;
            border-radius: 0;
            word-break: normal;
            white-space: pre;
        }

        .message-markdown blockquote {
            border-left: 3px solid #cbd5e1;
            color: #475569;
            padding-left: 0.95rem;
        }

        .message-markdown hr {
            border: 0;
            border-top: 1px solid #e5e7eb;
        }

        .message-markdown table {
            display: block;
            width: max-content;
            max-width: 100%;
            overflow-x: auto;
            border-collapse: collapse;
        }

        .message-markdown th,
        .message-markdown td {
            border: 1px solid #e5e7eb;
            padding: 0.45rem 0.7rem;
            text-align: left;
            vertical-align: top;
        }

        .message-markdown th {
            background: #f8fafc;
            color: #111827;
            font-weight: 600;
        }

        @keyframes typing-dot {
            0%, 60%, 100% {
                opacity: 0.28;
                transform: translateY(0) scale(0.92);
            }
            30% {
                opacity: 1;
                transform: translateY(-3px) scale(1);
            }
        }

        .typing-indicator {
            display: inline-flex;
            align-items: center;
            gap: 0.7rem;
            min-height: 3rem;
            padding: 0.7rem 0.95rem;
            border-radius: 1rem;
            border: 1px solid #e5e7eb;
            background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
            box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
        }

        .typing-indicator-dots {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
        }

        .typing-indicator-dot {
            width: 0.45rem;
            height: 0.45rem;
            border-radius: 999px;
            background: #94a3b8;
            animation: typing-dot 1.2s ease-in-out infinite;
        }

        .typing-indicator-dot:nth-child(2) {
            animation-delay: 0.16s;
        }

        .typing-indicator-dot:nth-child(3) {
            animation-delay: 0.32s;
        }

        .typing-indicator-label {
            color: #64748b;
            font-size: 0.8125rem;
            font-weight: 500;
            letter-spacing: 0.01em;
        }

        .task-card {
            background: #fff;
            border: 1px solid #e5e7eb;
            border-radius: 1rem;
            padding: 0.9rem;
            box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
            transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
        }

        .task-card:hover {
            border-color: #dbeafe;
            box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
            transform: translateY(-1px);
        }

        .task-title {
            overflow-wrap: anywhere;
        }

        .task-status-pill {
            display: inline-flex;
            min-width: 5.75rem;
            align-items: center;
            justify-content: center;
            text-align: center;
            line-height: 1.15;
        }

        .task-progress-track {
            height: 0.375rem;
            overflow: hidden;
            border-radius: 999px;
            background: #e5e7eb;
        }

        .task-progress-bar {
            height: 100%;
            border-radius: inherit;
            transition: width 0.45s ease, background-color 0.3s ease;
        }

        .brain-modal-shell {
            max-height: min(92vh, 48rem);
            overflow-y: auto;
        }

        .brain-progress-track {
            height: 0.625rem;
            overflow: hidden;
            border-radius: 999px;
            background: linear-gradient(90deg, #f3f4f6 0%, #e5e7eb 100%);
        }

        .brain-progress-bar {
            height: 100%;
            border-radius: inherit;
            box-shadow: 0 6px 16px rgba(79, 70, 229, 0.2);
            transition: width 0.45s ease, background-color 0.3s ease;
        }

        .brain-progress-label {
            min-width: 2.75rem;
        }

        .brain-section-trigger {
            gap: 0.75rem;
        }

        .brain-drop-status {
            overflow-wrap: anywhere;
        }

        @media (max-width: 767px) {
            .brain-modal-shell {
                max-height: calc(100vh - 1.5rem);
                overflow-y: auto;
            }
        }

        /* Sprint 4: Toggle switch */
        .toggle-switch {
            position: relative;
            display: inline-block;
            width: 2.5rem;
            height: 1.35rem;
            flex-shrink: 0;
        }
        .toggle-switch input { opacity: 0; width: 0; height: 0; }
        .toggle-slider {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background: #cbd5e1;
            border-radius: 999px;
            transition: all 200ms ease;
        }
        .toggle-slider:before {
            content: '';
            position: absolute;
            width: 1rem;
            height: 1rem;
            left: 0.175rem;
            bottom: 0.175rem;
            background: #fff;
            border-radius: 50%;
            transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: 0 1px 3px rgba(0,0,0,0.15);
        }
        .toggle-switch input:checked + .toggle-slider { background: #3b82f6; }
        .toggle-switch input:checked + .toggle-slider:before { transform: translateX(1.15rem); }

        /* Sprint 4: Workspace dropdown */
        .workspace-dropdown {
            position: absolute;
            top: calc(100% + 0.75rem);
            left: 0;
            background: #1e293b;
            border: 1px solid #334155;
            border-radius: 1.25rem;
            padding: 0.625rem;
            z-index: 100;
            min-width: 15rem;
            box-shadow: 0 20px 40px rgba(0,0,0,0.45);
            display: none;
            animation: dropdown-fade-in 200ms ease-out;
        }
        @keyframes dropdown-fade-in {
            from { opacity: 0; transform: translateY(-10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .workspace-dropdown.open { display: block; }

        /* Sprint 4: Integration card connected state */
        .intg-connected { border-color: #10b981 !important; background: #f0fdf4 !important; }
        .intg-connected .intg-btn { background: #d1fae5; color: #065f46; pointer-events: none; border: none; }

        /* Sprint 4: Pricing card highlight */
        .pricing-highlighted {
            background: #ffffff;
            border: 2px solid #84CAFF;
            box-shadow: 0 4px 12px rgba(132, 202, 255, 0.15);
            z-index: 20;
        }
        @media (min-width: 640px) {
            .pricing-highlighted {
            background: #ffffff;
            border: 2px solid #84CAFF;
            box-shadow: 0 4px 12px rgba(132, 202, 255, 0.15);
            z-index: 20;
        }
        }

        /* Sprint 4: Email notify modal */
        #notify-modal-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(15,23,42,0.6);
            backdrop-filter: blur(4px);
            z-index: 9999;
            align-items: center;
            justify-content: center;
        }
        #notify-modal-overlay.open { display: flex; }

        /* Mobile Scroll & Virtual Keyboard Fixes */
        #chat-box {
            overscroll-behavior-y: contain;
            -webkit-overflow-scrolling: touch;
            overflow-anchor: auto;
            touch-action: pan-y;
        }

        @media (max-width: 767px) {
            /* NOTE: `body.chat-open` is dead CSS (no JS in the codebase ever toggles that class
               on <body>). Three previous "iOS blank-page" round-trip fixes targeted it for
               nothing. The actual fix lives on `#chat-view` below — promoted to a fixed-
               position overlay sized via --app-vh (set from visualViewport.height in main.js).
               `body.sidebar-open` IS toggled by toggleMobileSidebar in utils.js — its
               overflow:hidden prevents the dashboard from scrolling under the open drawer. */
            body.chat-open {
                overflow: hidden;
                touch-action: none;
                overscroll-behavior: none;
            }
            body.sidebar-open { overflow: hidden; }

            #chat-view {
                /* iOS Safari + virtual keyboard: pin the chat view to the visual viewport
                   instead of relying on the parent flex container. The CSS height-cascade
                   (100dvh fallback → var(--app-vh)) lets older browsers fall back gracefully. */
                height: 100dvh;
                height: var(--app-vh, 100dvh);
                position: fixed;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
                z-index: 40;
                /* Ensure touch events are captured correctly on mobile */
                -webkit-tap-highlight-color: transparent;
            }

            /* Pin the chat input to the bottom of the visual viewport (above the keyboard).
               Without this, iOS Safari translates the position:fixed #chat-view upward when
               the input is focused (its native "scroll focused input into view" behavior),
               which pushes the chat header off-screen and exposes a blank area below. By
               making .chat-input-container itself position:fixed bottom:0, iOS sees the
               input as already visible and skips the auto-shift. The padding-bottom on
               #chat-box leaves room so messages don't render behind the fixed input. */
            .chat-input-container {
                position: fixed;
                bottom: 0;
                left: 0;
                right: 0;
                z-index: 41;
                padding-bottom: max(0.5rem, env(safe-area-inset-bottom)) !important;
                padding-top: 0.5rem !important;
            }
            #chat-box {
                padding-bottom: 12rem; /* clearance for the fixed chat-input-container */
            }

            /* Point 7: Pixel office — reduce height on mobile */
            #pixel-office {
                height: 280px !important;
            }

            /* Point 9: Payment modal — reduce padding on mobile */
            #payment-modal-overlay > div {
                padding: 1.25rem !important;
                padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
            }

            /* Point 10: Global search pills — allow wrapping, smaller text */
            #global-search {
                font-size: 0.9375rem;
                padding-top: 0.75rem;
                padding-bottom: 0.75rem;
            }

            /* Point 6: Ensure touch targets have min-width too */
            button:not(.toggle-slider):not(.toggle-switch):not(.skill-tag) {
                min-height: 44px;
            }

            /* Point 3: Chat messages full width */
            .message-bubble-agent {
                width: 100%;
                max-width: 100%;
            }
        }
    
        @media (max-width: 767px) {
            #mic-btn { display: none !important; }
            #chat-agent-avatar { width: 2.25rem !important; height: 2.25rem !important; font-size: 0.875rem !important; line-height: 2.25rem !important; }
            #chat-agent-name { font-size: 1rem !important; }
            #t-send-btn { padding: 0.5rem !important; width: 2.75rem !important; height: 2.75rem !important; display: flex !important; align-items: center !important; justify-content: center !important; }
            #t-send-btn span { display: none !important; }
            .chat-bubble, .bg-brand\/10, .bg-white { max-width: 92% !important; word-break: break-word; }
            .chat-input-container { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }
            #chat-input { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; font-size: 16px !important; } /* 16px prevents iOS zoom */
        }

        /* ============================================================
           RESPONSIVE MOBILE — Sprint 6 (grid-view / dashboard)
           Targets: 375px (iPhone SE) → 767px
           Desktop (768px+) is NOT affected.
        ============================================================ */
        @media (max-width: 767px) {

            /* 1. Dashboard grid-view wrapper — no horizontal overflow */
            #grid-view {
                padding: 1rem !important;
                overflow-x: hidden;
            }

            /* 2. Top header bar — tighter on mobile */
            #grid-view > div:first-child {
                gap: 0.75rem !important;
                margin-bottom: 1.25rem !important;
            }
            /* Dashboard title: don't truncate, allow wrap */
            .dashboard-title {
                font-size: 1.25rem !important;
                white-space: normal !important;
                overflow-wrap: break-word;
                word-break: break-word;
                flex: 1 1 0;
                min-width: 0;
            }
            /* Language selector — shrink on mobile */
            #lang-switcher-main {
                padding: 0.5rem 0.5rem !important;
                font-size: 0.8125rem !important;
                width: auto !important;
            }
            /* Login button — compact */
            #dashboard-login-btn {
                padding: 0.5rem 0.75rem !important;
                font-size: 0.8125rem !important;
            }

            /* 3. Global search — full-width, comfy on mobile */
            #global-search {
                font-size: 0.9375rem !important;
                padding: 0.75rem 0.75rem 0.75rem 2.75rem !important;
            }
            /* Suggestion pills — wrap to next line, no overflow */
            #global-search ~ div,
            #grid-view .flex.flex-wrap.gap-2.mt-3 {
                flex-wrap: wrap !important;
                overflow-x: hidden !important;
            }
            #grid-view .flex.flex-wrap.gap-2.mt-3 button {
                font-size: 0.75rem !important;
                padding: 0.375rem 0.75rem !important;
            }

            /* 4. Pricing section — already grid-cols-1 sm:grid-cols-3, just add breathing room */
            #pricing-section {
                padding: 1.25rem !important;
                border-radius: 1.25rem !important;
            }
            #pricing-section h2 {
                font-size: 1.125rem !important;
            }

            /* 5. Brain card — reduce fixed height, smaller emoji/title */
            #grid-view [onclick="openBrain()"] {
                height: auto !important;
                min-height: 10rem !important;
                padding: 1.25rem !important;
                border-radius: 1.25rem !important;
            }
            #grid-view [onclick="openBrain()"] .text-5xl {
                font-size: 2rem !important;
                margin-bottom: 0.5rem !important;
            }
            #grid-view [onclick="openBrain()"] h2 {
                font-size: 1.25rem !important;
            }
            #grid-view [onclick="openBrain()"] p {
                font-size: 0.8125rem !important;
            }

            /* 6. Agent cards — reduce fixed height, readable text */
            .agent-card {
                height: auto !important;
                min-height: 20rem !important;
                border-radius: 1.25rem !important;
            }
            .agent-card h3 {
                font-size: 1.125rem !important;
            }

            /* 7. Section headers — smaller on mobile */
            #grid-view h2.text-2xl,
            #grid-view h3.text-2xl {
                font-size: 1.125rem !important;
                overflow-wrap: break-word;
            }
            #grid-view h2.text-xl,
            #grid-view h3.text-xl {
                font-size: 1rem !important;
            }

            /* 8. Stats KPI cards — 2 columns on mobile */
            #automations-view .grid.sm\:grid-cols-2.xl\:grid-cols-4,
            #integrations-view .grid.md\:grid-cols-4,
            #reports-view .grid.md\:grid-cols-4 {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }

            /* 9. Brain modal — full-screen sheet on mobile */
            #brain-modal-overlay {
                padding: 0.5rem !important;
                align-items: flex-end !important;
            }
            .brain-modal-shell {
                max-height: 100dvh !important;
                max-height: 100vh !important; /* fallback */
                overflow-y: auto !important;
                border-radius: 1.5rem 1.5rem 0 0 !important;
                padding: 1.25rem !important;
                padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
            }
            /* Brain modal textareas — shorter on mobile */
            .brain-modal-shell textarea {
                height: 5rem !important;
            }

            /* 10. Auth / admin / create-agent modals — full-screen on mobile */
            #auth-modal-overlay,
            #admin-modal-overlay,
            #create-agent-modal-overlay,
            #digitalize-colleague-modal-overlay {
                padding: 0.5rem !important;
                align-items: flex-end !important;
            }
            #auth-modal-overlay > div,
            #admin-modal-overlay > div,
            #create-agent-modal-overlay > div,
            #digitalize-colleague-modal-overlay > div {
                max-height: 95dvh !important;
                max-height: 95vh !important;
                overflow-y: auto !important;
                border-radius: 1.5rem 1.5rem 0.75rem 0.75rem !important;
                padding-bottom: max(1.25rem, env(safe-area-inset-bottom)) !important;
            }

            /* 11. Safe area — bottom padding for notch / home indicator */
            #grid-view {
                padding-bottom: max(1.5rem, env(safe-area-inset-bottom)) !important;
            }

            /* 12. Prevent any horizontal scroll from orphaned wide elements */
            #grid-view * {
                max-width: 100%;
                box-sizing: border-box;
            }

            /* 13. Fixed toast — clear home indicator / notch */
            #sprint4-toast {
                bottom: max(1rem, env(safe-area-inset-bottom)) !important;
            }
        }

        /* Tiny phones (< 400px) — even tighter */
        @media (max-width: 399px) {
            #grid-view {
                padding: 0.75rem !important;
            }
            .agent-card {
                border-radius: 1rem !important;
            }
            #pricing-section {
                border-radius: 1rem !important;
            }
        }

        /* ============================================================
           Open Space — 3x3 workstation grid (.pixel-desk) + per-agent
           live activity states (.pixel-agent). Driven by /openspace/stream.
           Each manager sits at a fixed desk; when the agent is thinking or
           responding, BOTH the avatar and its desk monitor light up.
        ============================================================ */
        .pixel-desk {
            position: absolute;
            transform: translate(-50%, -50%);
            width: 112px;
            height: 68px;
            pointer-events: none;
            transition: filter 0.4s ease;
        }
        .pixel-desk .pixel-desk-surface {
            position: absolute;
            left: 0;
            right: 0;
            top: 30%;
            bottom: 0;
            background: linear-gradient(180deg, #b45309 0%, #92400e 100%);
            border: 2px solid #78350f;
            border-radius: 6px;
            box-shadow: inset 0 2px 0 rgba(255,255,255,0.15);
        }
        .pixel-desk .pixel-desk-monitor {
            position: absolute;
            left: 50%;
            top: 0;
            transform: translateX(-50%);
            width: 44px;
            height: 32px;
            background: #0f172a;
            border: 2px solid #1e293b;
            border-radius: 4px;
            box-shadow: inset 0 0 0 2px #1e3a8a;
            transition: box-shadow 0.4s ease, background-color 0.4s ease;
        }
        .pixel-desk .pixel-desk-monitor::after {
            content: "";
            position: absolute;
            left: 50%;
            top: 100%;
            transform: translateX(-50%);
            width: 14px;
            height: 6px;
            background: #0f172a;
            border-radius: 0 0 2px 2px;
        }
        .pixel-desk .pixel-desk-label {
            position: absolute;
            left: 50%;
            bottom: -14px;
            transform: translateX(-50%);
            font-size: 9px;
            font-weight: 700;
            color: #78350f;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0.75;
        }
        .pixel-desk.is-thinking {
            filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.6));
        }
        .pixel-desk.is-thinking .pixel-desk-monitor {
            box-shadow: inset 0 0 0 2px #8b5cf6,
                        0 0 12px rgba(139, 92, 246, 0.8);
            background: #3b0764;
        }
        .pixel-desk.is-responding {
            filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.6));
        }
        .pixel-desk.is-responding .pixel-desk-monitor {
            box-shadow: inset 0 0 0 2px #10b981,
                        0 0 12px rgba(16, 185, 129, 0.9);
            background: #064e3b;
        }
        .pixel-agent img {
            animation: pixel-breathe 3.6s ease-in-out infinite;
            transition: box-shadow 0.3s ease;
        }
        .pixel-agent .pixel-bubble {
            position: absolute;
            top: -26px;
            left: 50%;
            transform: translateX(-50%) scale(0);
            background: #ffffff;
            border-radius: 9999px;
            padding: 2px 8px;
            font-size: 14px;
            line-height: 1.2;
            color: #1e293b;
            box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
            white-space: nowrap;
            opacity: 0;
            transition: transform 0.25s ease, opacity 0.25s ease;
            pointer-events: none;
            z-index: 10;
        }
        .pixel-agent.is-thinking img {
            box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.65),
                        0 6px 18px rgba(139, 92, 246, 0.35);
            animation: pixel-pulse-purple 1.2s ease-in-out infinite;
        }
        .pixel-agent.is-responding img {
            box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.7),
                        0 6px 18px rgba(16, 185, 129, 0.4);
            animation: pixel-pulse-green 0.85s ease-in-out infinite;
        }
        .pixel-agent.is-thinking .pixel-bubble,
        .pixel-agent.is-responding .pixel-bubble {
            transform: translateX(-50%) scale(1);
            opacity: 1;
        }
        .pixel-agent .pixel-status {
            transition: background-color 0.3s ease;
        }
        .pixel-agent.is-thinking .pixel-status {
            background-color: #8b5cf6 !important; /* purple */
        }
        .pixel-agent.is-responding .pixel-status {
            background-color: #10b981 !important; /* emerald */
        }
        @keyframes pixel-breathe {
            0%, 100% { transform: scale(1); }
            50%      { transform: scale(1.03); }
        }
        @keyframes pixel-pulse-purple {
            0%, 100% { transform: scale(1); }
            50%      { transform: scale(1.1); }
        }
        @keyframes pixel-pulse-green {
            0%, 100% { transform: scale(1); }
            50%      { transform: scale(1.14); }
        }

        /* ADHD / Focus Mode */
        body.adhd-mode * {
            animation-duration: 0s !important;
            transition-duration: 0s !important;
        }
        body.adhd-mode [class*="bg-gradient"] {
            background-image: none !important;
            background-color: #3b82f6 !important;
        }
        body.adhd-mode .bg-white[class*="bg-gradient"],
        body.adhd-mode .page-card[class*="bg-gradient"] {
            background-color: #ffffff !important;
        }
        body.adhd-mode *:focus {
            outline: 3px solid #3b82f6 !important;
            outline-offset: 2px !important;
        }
        body.adhd-mode .shadow-lg,
        body.adhd-mode .shadow-xl,
        body.adhd-mode .shadow-2xl {
            box-shadow: 0 0 0 1px rgba(0,0,0,0.1) !important;
        }

        /* ======================================================================
           GEEKY FRONTEND POLISH PASS — 2026-04-17
           Desktop-only refinements. ALL mobile layouts preserved via @media.
           Based on ui-ux-pro-max SaaS AI dashboard & chat-app research.
           ====================================================================== */

        /* Desktop typography stack upgrade — Inter on top of Montserrat */
        @media (min-width: 768px) {
            body {
                font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
                font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
                letter-spacing: -0.01em;
                text-rendering: optimizeLegibility;
                -webkit-font-smoothing: antialiased;
            }
            h1, h2, h3, .font-black {
                letter-spacing: -0.02em;
            }
            /* Tighter numeric displays */
            .tabular-nums,
            [class*="text-3xl"],
            [class*="text-2xl"] {
                font-feature-settings: 'tnum', 'cv01';
            }
        }

        /* Desktop chat polish — bubble differentiation + user gradient
           Mobile keeps the existing flat bubbles for readability on small screens. */
        @media (min-width: 768px) {
            #chat-view {
                background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
                /* Sidebar offset — mirrors the md:left-64 md:w-auto Tailwind utilities
                   on #chat-view, which the precompiled tailwind.css bundle (built
                   2026-04-29) does not include. Without this, fixed inset-0 makes the
                   chat span the full viewport and the sidebar (fixed left:0 w-64 z-50)
                   overlays its leftmost 16rem, clipping the header / messages / input. */
                left: 16rem;
                width: auto;
            }
            .message-bubble {
                max-width: min(680px, 72%);
                transition: transform 220ms ease, box-shadow 220ms ease;
                animation: chatBubbleIn 260ms cubic-bezier(0.16, 1, 0.3, 1) both;
            }
            .message-bubble-user {
                background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
                box-shadow: 0 4px 14px rgba(37, 99, 235, 0.18), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
                border-bottom-right-radius: 0.5rem !important;
            }
            .message-bubble-agent {
                background: #ffffff !important;
                border-color: rgba(226, 232, 240, 0.8) !important;
                box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 18px rgba(15, 23, 42, 0.05) !important;
                border-bottom-left-radius: 0.5rem !important;
            }
            .message-bubble:hover {
                transform: translateY(-1px);
                box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08) !important;
            }
            #chat-box {
                scroll-behavior: smooth;
            }
            /* Chat input container — subtle elevation on focus-within */
            .chat-input-container {
                transition: box-shadow 220ms ease, border-color 220ms ease;
            }
            .chat-input-container:focus-within {
                box-shadow: 0 -8px 24px -8px rgba(37, 99, 235, 0.12);
            }
            #chat-input:focus {
                box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12) !important;
            }
            /* Typing indicator polish */
            .typing-dot {
                animation: typingBounce 1.2s ease-in-out infinite;
            }
        }

        @keyframes chatBubbleIn {
            from { opacity: 0; transform: translateY(6px); }
            to   { opacity: 1; transform: translateY(0); }
        }
        @keyframes typingBounce {
            0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
            30% { transform: translateY(-4px); opacity: 1; }
        }
        @keyframes shimmer {
            0% { background-position: -400px 0; }
            100% { background-position: 400px 0; }
        }

        /* Skeleton loader shimmer — used on async grids */
        .skeleton-shimmer {
            background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
            background-size: 800px 100%;
            animation: shimmer 1.6s linear infinite;
        }

        /* Desktop agent card micro-interactions — subtle glow on hover */
        @media (min-width: 768px) {
            .agent-card {
                transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1),
                            box-shadow 260ms cubic-bezier(0.16, 1, 0.3, 1),
                            border-color 260ms ease;
            }
            .agent-card:hover {
                transform: translateY(-8px) scale(1.005);
                box-shadow:
                    0 24px 48px -18px rgba(15, 23, 42, 0.22),
                    0 0 0 1px rgba(59, 130, 246, 0.15);
            }
            /* Active pressed state */
            .agent-card:active {
                transform: translateY(-4px) scale(1.002);
                transition-duration: 80ms;
            }
        }

        /* Desktop sidebar polish — cleaner active state */
        @media (min-width: 768px) {
            #sidebar-view {
                box-shadow: 1px 0 0 rgba(226, 232, 240, 0.6);
            }
            .sidebar-item {
                border-radius: 0.625rem;
            }
            .sidebar-item:hover {
                background-color: rgba(59, 130, 246, 0.06);
            }
            .sidebar-item.active,
            .sidebar-item[aria-current="page"] {
                background-color: rgba(59, 130, 246, 0.1);
                color: #1d4ed8;
            }
        }

        /* Desktop scrollbars — thin modern track, never on mobile (iOS handles it natively) */
        @media (min-width: 768px) and (hover: hover) {
            * {
                scrollbar-width: thin;
                scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
            }
            *::-webkit-scrollbar {
                width: 10px;
                height: 10px;
            }
            *::-webkit-scrollbar-track {
                background: transparent;
            }
            *::-webkit-scrollbar-thumb {
                background-color: rgba(148, 163, 184, 0.35);
                border-radius: 8px;
                border: 2px solid transparent;
                background-clip: padding-box;
                transition: background-color 200ms ease;
            }
            *::-webkit-scrollbar-thumb:hover {
                background-color: rgba(100, 116, 139, 0.6);
                background-clip: padding-box;
            }
        }

        /* Desktop button polish — pressable feel on primary CTAs */
        @media (min-width: 768px) {
            button[type="submit"],
            .bg-blue-600,
            .bg-brand {
                transition: transform 150ms ease, box-shadow 200ms ease, background-color 200ms ease;
            }
            button[type="submit"]:not(:disabled):active,
            .bg-blue-600:not(:disabled):active {
                transform: translateY(1px);
            }
            #t-send-btn {
                box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
            }
            #t-send-btn:hover {
                box-shadow: 0 6px 18px rgba(37, 99, 235, 0.32);
            }
        }

        /* Desktop focus rings — accessible + modern inset glow */
        @media (min-width: 768px) {
            button:focus-visible,
            a:focus-visible,
            [role="button"]:focus-visible {
                outline: 2px solid #3b82f6;
                outline-offset: 2px;
                border-radius: inherit;
            }
            input:focus-visible,
            textarea:focus-visible,
            select:focus-visible {
                outline: none;
            }
        }

        /* Honor prefers-reduced-motion — no animations for anyone who asks */
        @media (prefers-reduced-motion: reduce) {
            *, *::before, *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }
        /* === END GEEKY POLISH PASS === */

        /* ═══ Create-Agent modal: avatar + vibe + tools + skills ═══ */
        #create-agent-modal-overlay .pill-soft { transition: all .12s ease; }
        #create-agent-modal-overlay .pill-soft:hover { background: #f8fafc; }
        #create-agent-modal-overlay .pill-soft.selected { background: #1570EF; color: #fff; border-color: #1570EF; }
        #create-agent-modal-overlay .tool-row { transition: all .12s ease; }
        #create-agent-modal-overlay .tool-row:hover { border-color: #BAE0FE; }
        #create-agent-modal-overlay .tool-row.on { background: #1570EF; color: #fff; border-color: #1570EF; }
        #create-agent-modal-overlay .tool-row.on .tool-icon { background: #175CD3; }
        #create-agent-modal-overlay .tool-row.on .tool-desc { color: rgba(255,255,255,.85); }
        #create-agent-modal-overlay .ca-integration-tile { transition: all .12s ease; }
        #create-agent-modal-overlay .ca-integration-tile.on { background: #1570EF; border-color: #1570EF; }
        #create-agent-modal-overlay .ca-integration-tile.on span { color: #fff; }
        #create-agent-modal-overlay .tool-icon { width: 2.25rem; height: 2.25rem; border-radius: 0.75rem; background: #1570EF; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; transition: background .12s ease; }
        #create-agent-modal-overlay .toggle-switch {
            position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0;
            background: #CBD5E1; border-radius: 24px; cursor: pointer; transition: background .15s ease;
        }
        #create-agent-modal-overlay .toggle-switch.on { background: #1570EF; }
        #create-agent-modal-overlay .toggle-switch::after {
            content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
            background: #fff; border-radius: 50%; transition: transform .15s ease; box-shadow: 0 1px 3px rgba(0,0,0,.2);
        }
        #create-agent-modal-overlay .toggle-switch.on::after { transform: translateX(18px); }
        #digitalize-colleague-modal-overlay .dc-source-card { transition: all .12s ease; }
        #digitalize-colleague-modal-overlay .dc-source-card:has(input:checked) {
            background: #EFF6FF;
            border-color: #1570EF;
            box-shadow: 0 0 0 3px rgba(21,112,239,.12);
        }
