        :root { --banner-height: 40px; }
        .dashboard-header { top: var(--banner-height) !important; }
        .tab-nav { top: calc(60px + var(--safe-top) + var(--banner-height)) !important; }
        .screen-content { top: calc(108px + var(--safe-top) + var(--banner-height)) !important; }

        :root {
            --primary: #7c3aed;
            --primary-dark: #5b21b6;
            --primary-light: #a78bfa;
            --dark: #0f0f23;
            --dark-card: #1a1a2e;
            --dark-hover: #252540;
            --gray: #9ca3af;
            --light-gray: #e5e7eb;
            --white: #ffffff;
            --green: #10b981;
            --yellow: #f59e0b;
            --red: #ef4444;
            --blue: #3b82f6;
            --safe-top: env(safe-area-inset-top, 0px);
            --safe-bottom: env(safe-area-inset-bottom, 0px);
            --safe-left: env(safe-area-inset-left, 0px);
            --safe-right: env(safe-area-inset-right, 0px);
        }
        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        html, body { height: 100%; overflow: hidden; }
        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            font-size: 16px;
            background: var(--dark);
            color: var(--white);
            -webkit-font-smoothing: antialiased;
            -webkit-overflow-scrolling: touch;
        }

        /* ============================================ */
        /* HEADER                                       */
        /* ============================================ */
        .header {
            position: fixed;
            top: 0; left: 0; right: 0;
            height: calc(60px + var(--safe-top));
            padding-top: var(--safe-top);
            background: rgba(15, 15, 35, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-bottom: 1px solid rgba(124, 58, 237, 0.2);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding-left: max(1rem, var(--safe-left));
            padding-right: max(1rem, var(--safe-right));
            z-index: 1000;
        }
        .logo { display: flex; align-items: center; gap: 0.75rem; }
        .logo img { width: 40px; height: 40px; border-radius: 50%; }
        .logo-text {
            font-size: 1.25rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--primary), #a78bfa);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .hamburger {
            display: none;
            width: 44px; height: 44px;
            background: transparent; border: none; cursor: pointer;
            padding: 10px; z-index: 10002; position: relative;
        }
        .hamburger span {
            display: block; width: 24px; height: 2px;
            background: var(--white); margin: 5px 0;
            transition: transform 0.3s, opacity 0.3s; border-radius: 2px;
        }
        .hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
        .hamburger.active span:nth-child(2) { opacity: 0; }
        .hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }
        .header-actions { display: flex; align-items: center; gap: 1rem; }
        .customize-btn {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            border: none; color: white; padding: 0.5rem 1rem;
            border-radius: 8px; font-size: 0.875rem; font-weight: 500;
            cursor: pointer; min-height: 44px; min-width: 44px;
            display: flex; align-items: center; gap: 0.5rem;
        }
        .tour-btn {
            background: rgba(124, 58, 237, 0.2);
            border: 1px solid var(--primary);
            color: var(--primary-light); padding: 0.5rem 1rem;
            border-radius: 8px; font-size: 0.875rem; cursor: pointer;
            min-height: 44px; display: flex; align-items: center; gap: 0.5rem;
        }
        /* Beta feedback button (replaces the old beta banner) — sits next to Tour. */
        .beta-feedback-btn { white-space: nowrap; }
        @media (max-width: 720px) {
            /* Collapse the long label to just the emoji on small screens. */
            .beta-feedback-btn span { display: none; }
        }
        .user-avatar {
            width: 36px; height: 36px; border-radius: 50%;
            background: var(--primary);
            display: flex; align-items: center; justify-content: center;
            font-weight: 600; cursor: pointer; min-height: 44px; min-width: 44px;
            position: relative;
        }
        .user-menu-container { position: relative; display: inline-block; }
        .user-dropdown {
            display: none; position: absolute; top: 100%; right: 0;
            margin-top: 0.5rem; background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.3); border-radius: 12px;
            min-width: 200px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
            z-index: 2000; overflow: hidden;
        }
        .user-dropdown.show { display: block; }
        .user-dropdown-header {
            padding: 1rem; border-bottom: 1px solid rgba(124, 58, 237, 0.2); text-align: center;
        }
        .user-dropdown-header .user-name { font-weight: 600; color: var(--white); margin-bottom: 0.25rem; }
        .user-dropdown-header .user-email { font-size: 0.75rem; color: var(--gray); }
        .user-dropdown-item {
            display: flex; align-items: center; gap: 0.75rem;
            padding: 0.875rem 1rem; color: var(--light-gray);
            cursor: pointer; transition: background 0.2s; text-decoration: none;
        }
        .user-dropdown-item:hover { background: var(--dark-hover); }
        .user-dropdown-item.logout { border-top: 1px solid rgba(124, 58, 237, 0.2); color: var(--red); }
        .user-dropdown-item.logout:hover { background: rgba(239, 68, 68, 0.1); }

        /* ============================================ */
        /* TAB NAVIGATION BAR                          */
        /* ============================================ */
        .tab-bar {
            position: fixed;
            top: calc(60px + var(--safe-top));
            left: 0; right: 0;
            height: 48px;
            background: var(--dark-card);
            border-bottom: 1px solid rgba(124, 58, 237, 0.2);
            display: flex;
            align-items: stretch;
            justify-content: center;
            padding: 0 max(1rem, var(--safe-left));
            z-index: 999;
        }
        .tab-item {
            flex: 0 1 220px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0 1rem;
            font-size: 0.875rem;
            font-weight: 500;
            color: var(--gray);
            cursor: pointer;
            border-bottom: 3px solid transparent;
            transition: color 0.2s, border-color 0.2s;
            user-select: none;
            white-space: nowrap;
        }
        .tab-item:hover { color: var(--light-gray); }
        .tab-item.active {
            color: var(--primary-light);
            border-bottom-color: var(--primary);
            font-weight: 600;
        }
        .tab-icon { font-size: 1rem; }
        .tab-label { }

        /* ============================================ */
        /* SCREEN CONTAINER                            */
        /* ============================================ */
        .screen {
            display: none;
            position: fixed;
            top: calc(144px + var(--safe-top));
            left: 0; right: 0;
            bottom: 0;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .screen.active { display: block; }

        /* ============================================ */
        /* SCREEN 1: WIDGETS                           */
        /* ============================================ */
        .stats-bar {
            background: var(--dark-card);
            border-bottom: 1px solid rgba(124, 58, 237, 0.2);
            display: flex; align-items: center; justify-content: space-around;
            padding: 0.75rem max(1rem, var(--safe-left));
            height: 50px;
        }
        .stat-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
        .stat-value { font-size: 1rem; font-weight: 700; color: var(--primary-light); }
        .stat-label { font-size: 0.65rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }

        /* Quick Actions Bar */
        .quick-actions { display: none; }
        .qa-btn {
            display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
            padding: 0.5rem 0.75rem; background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.25); border-radius: 12px;
            color: var(--light-gray); cursor: pointer; min-width: 64px; min-height: 52px;
            transition: all 0.2s; flex-shrink: 0;
        }
        .qa-btn:hover, .qa-btn:active {
            background: var(--primary); border-color: var(--primary); color: white; transform: scale(1.05);
        }
        .qa-icon { font-size: 1.25rem; }
        .qa-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }

        .widgets-content { padding: 0; }

        /* Cards Panel */
        .cards-panel {
            background: var(--dark-card);
            overflow-y: auto; -webkit-overflow-scrolling: touch;
        }
        .panel-header {
            padding: 1rem;
            border-bottom: 1px solid rgba(124, 58, 237, 0.2);
            font-weight: 600;
            display: flex; align-items: center; justify-content: space-between;
        }
        .collapsible-card { border-bottom: 1px solid rgba(124, 58, 237, 0.1); }
        .card-header {
            padding: 1rem;
            display: flex; align-items: center; justify-content: space-between;
            cursor: pointer; min-height: 56px; transition: background 0.2s;
            touch-action: manipulation; -webkit-tap-highlight-color: rgba(124, 58, 237, 0.3); user-select: none; -webkit-user-select: none;
        }
        .card-header:hover { background: var(--dark-hover); }
        .card-header:active { transform: scale(0.99); }
        .card-title { display: flex; align-items: center; gap: 0.75rem; }
        .card-icon { font-size: 1.25rem; }
        .card-badge {
            background: var(--primary); color: white;
            font-size: 0.7rem; padding: 2px 6px; border-radius: 10px; margin-left: 0.5rem;
        }
        .card-arrow { transition: transform 0.3s ease; color: var(--gray); font-size: 0.8rem; }
        .collapsible-card.expanded .card-arrow { transform: rotate(180deg); }
        .card-content {
            max-height: 0; overflow: hidden;
            transition: max-height 0.3s ease;
            background: rgba(0, 0, 0, 0.2);
        }
        .collapsible-card.expanded .card-content { max-height: 2000px; overflow-y: auto; }

        /* ===== Tile grid (rows of module tiles) ===== */
        #widgetContainer.module-tile-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
            gap: 0.85rem;
            padding: 0.5rem 0;
        }
        .module-tile {
            display: flex; flex-direction: column; gap: 0.35rem;
            background: var(--card-bg, rgba(124,58,237,0.06));
            border: 1px solid rgba(124,58,237,0.18);
            border-radius: 14px; padding: 1rem; cursor: pointer;
            transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
            min-height: 96px;
        }
        .module-tile:hover {
            transform: translateY(-2px);
            border-color: var(--primary);
            box-shadow: 0 6px 18px rgba(124,58,237,0.18);
        }
        .module-tile-top { display: flex; align-items: center; gap: 0.5rem; }
        .module-tile-icon { font-size: 1.5rem; }
        .module-tile-name { font-weight: 600; font-size: 0.98rem; }
        .module-tile-badge {
            margin-left: auto; background: var(--primary); color: #fff;
            border-radius: 999px; font-size: 0.7rem; padding: 1px 8px; min-width: 20px; text-align: center;
        }
        .module-tile-desc { font-size: 0.8rem; color: var(--gray); line-height: 1.35; }

        /* ===== Full-screen module page ===== */
        .module-page { display: flex; flex-direction: column; min-height: 100%; }
        .module-topbar {
            display: flex; align-items: center; gap: 0.75rem;
            padding: 0.5rem 0 0.85rem; border-bottom: 1px solid rgba(124,58,237,0.12); margin-bottom: 0.85rem;
        }
        .module-back-btn {
            background: rgba(124,58,237,0.15); border: 1px solid var(--primary);
            color: var(--primary-light); padding: 0.45rem 0.9rem; border-radius: 8px;
            cursor: pointer; font-size: 0.85rem; min-height: 40px;
        }
        .module-title { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
        .module-body { flex: 1; }
        /* In the module page the content is always expanded and the embedded card
           header (collapse arrow + remove button) is hidden — the page has its own header. */
        #screen-module .collapsible-card { border-bottom: none; }
        #screen-module .collapsible-card .card-header { display: none; }
        #screen-module .collapsible-card .card-content { max-height: none !important; overflow: visible; }
        /* Per-module chat box */
        /* Contacts — auto-built rows with signature-pulled phone/email */
        .contact-lines { display: flex; flex-wrap: wrap; gap: 0.25rem 0.85rem; margin-top: 0.25rem; }
        .contact-line { font-size: 0.78rem; color: var(--gray, #9ca3af); text-decoration: none; }
        .contact-line:hover { color: var(--primary-light, #a78bfa); }
        .contact-badge {
            font-size: 0.6rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
            background: rgba(124,58,237,0.15); color: var(--primary-light, #a78bfa);
            border-radius: 4px; padding: 1px 5px; margin-left: 5px; vertical-align: middle;
        }

        /* Per-module preferences (controls + PREFS + chat) */
        .module-prefs { margin-top: 1rem; }
        .module-prefs-box {
            border: 1px solid rgba(124,58,237,0.18); border-radius: 10px;
            background: rgba(124,58,237,0.04); padding: 0.4rem 0.85rem;
        }
        .module-prefs-box > summary {
            cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--gray);
            list-style: none; padding: 0.35rem 0; user-select: none;
        }
        .module-prefs-box > summary::-webkit-details-marker { display: none; }
        .mpref-saved {
            font-size: 0.72rem; color: #22c55e; font-weight: 500; margin-left: 0.4rem;
            opacity: 0; transition: opacity 0.3s;
        }
        .mpref-fields { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.5rem 0 0.7rem; }
        .mpref-row {
            display: flex; align-items: center; justify-content: space-between; gap: 1rem;
            font-size: 0.85rem; color: var(--text, #e5e7eb);
        }
        .mpref-row > span { flex: 1; }
        .mpref-row select {
            background: rgba(255,255,255,0.04); border: 1px solid rgba(124,58,237,0.25);
            border-radius: 7px; color: inherit; padding: 0.3rem 0.5rem; font-size: 0.82rem; min-width: 160px;
        }
        .mpref-toggle input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
        .mpref-multi { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
        .mpref-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
        .mpref-chip {
            display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem;
            background: rgba(255,255,255,0.04); border: 1px solid rgba(124,58,237,0.22);
            border-radius: 999px; padding: 0.25rem 0.6rem; cursor: pointer;
        }
        .mpref-chip input { accent-color: var(--primary); cursor: pointer; }

        .module-chat {
            margin-top: 1rem; border-top: 1px solid rgba(124,58,237,0.12); padding-top: 0.85rem;
        }
        .module-chat-header { font-size: 0.85rem; color: var(--gray); margin-bottom: 0.5rem; }
        .module-chat-messages { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.6rem; }
        .module-chat-input-bar { display: flex; gap: 0.5rem; }
        .module-chat-input-bar .chat-text-input { flex: 1; }
        .card-inner { padding: 1rem; }
        .empty-state { text-align: center; padding: 2rem 1rem; color: var(--gray); }
        .empty-state .icon { font-size: 2rem; margin-bottom: 0.5rem; }
        .empty-state .title { font-size: 0.9rem; margin-bottom: 0.25rem; }
        .empty-state .subtitle { font-size: 0.8rem; }
        .empty-state .action-btn {
            margin-top: 1rem; padding: 0.5rem 1rem; background: var(--primary);
            border: none; border-radius: 8px; color: white; cursor: pointer; font-size: 0.85rem;
        }
        .calendar-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
        .calendar-tab {
            flex: 1; padding: 0.5rem; background: var(--dark);
            border: 1px solid rgba(124, 58, 237, 0.3); color: var(--gray); border-radius: 8px;
            cursor: pointer; font-size: 0.8rem; min-height: 44px; transition: all 0.2s;
        }
        .calendar-tab.active { background: var(--primary); color: white; border-color: var(--primary); }
        .event-item {
            padding: 0.75rem; background: var(--dark); border-radius: 8px;
            margin-bottom: 0.5rem; border-left: 3px solid var(--primary);
        }
        .event-time { font-size: 0.75rem; color: var(--primary-light); margin-bottom: 0.25rem; }
        .event-title { font-weight: 500; }
        .task-item {
            display: flex; align-items: center; gap: 0.75rem;
            padding: 0.75rem; background: var(--dark); border-radius: 8px; margin-bottom: 0.5rem;
        }
        .task-checkbox {
            width: 20px; height: 20px; border: 2px solid var(--primary); border-radius: 4px;
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            min-width: 44px; min-height: 44px;
        }
        .task-checkbox.done { background: var(--green); border-color: var(--green); }
        .person-card {
            display: flex; gap: 0.75rem; padding: 0.75rem;
            background: var(--dark); border-radius: 8px; margin-bottom: 0.5rem;
        }
        .person-avatar {
            width: 40px; height: 40px; border-radius: 50%; background: var(--primary);
            display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0;
        }
        .person-info { flex: 1; min-width: 0; }
        .person-name { font-weight: 500; margin-bottom: 0.25rem; }
        .person-personality { font-size: 0.75rem; color: var(--gray); font-style: italic; }
        .activity-item {
            display: flex; gap: 0.75rem; padding: 0.5rem 0;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-top: 6px; }
        .activity-text { font-size: 0.85rem; color: var(--light-gray); }
        .activity-time { font-size: 0.7rem; color: var(--gray); margin-top: 0.25rem; }
        .cf-value.negative { color: var(--red); }
        .add-widget-btn {
            display: flex; align-items: center; justify-content: center; gap: 0.5rem;
            padding: 1rem; margin: 0.75rem 1rem;
            background: rgba(124, 58, 237, 0.08); border: 2px dashed rgba(124, 58, 237, 0.3);
            border-radius: 12px; color: var(--primary-light); cursor: pointer;
            font-size: 0.9rem; font-weight: 500; transition: all 0.2s;
        }
        .add-widget-btn:hover { background: rgba(124, 58, 237, 0.15); border-color: var(--primary); }
        .widget-remove-btn {
            opacity: 0; transition: opacity 0.2s; background: none; border: none;
            color: var(--gray); cursor: pointer; font-size: 1rem; padding: 4px 8px;
            border-radius: 4px; min-width: 32px; min-height: 32px;
            display: flex; align-items: center; justify-content: center;
        }
        .widget-remove-btn:hover { color: var(--red); background: rgba(239, 68, 68, 0.1); }
        .card-header:hover .widget-remove-btn { opacity: 1; }

        /* Widget Picker Modal */
        .widget-picker-overlay {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
            z-index: 10010; display: flex; align-items: center; justify-content: center; padding: 1rem;
        }
        .widget-picker-modal {
            background: var(--dark-card); border: 1px solid rgba(124, 58, 237, 0.3);
            border-radius: 16px; width: 100%; max-width: 500px; max-height: 80vh;
            overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
        }
        .widget-picker-header {
            display: flex; align-items: center; justify-content: space-between;
            padding: 1.25rem 1.5rem; border-bottom: 1px solid rgba(124, 58, 237, 0.2);
        }
        .widget-picker-header h3 { font-size: 1.1rem; color: var(--white); margin: 0; }
        .widget-picker-header button {
            background: none; border: none; color: var(--gray); font-size: 1.5rem;
            cursor: pointer; min-width: 44px; min-height: 44px;
            display: flex; align-items: center; justify-content: center;
        }
        .widget-picker-grid { padding: 1rem; display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
        .widget-picker-item {
            display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
            padding: 1.25rem 0.75rem; background: var(--dark);
            border: 1px solid rgba(124, 58, 237, 0.15); border-radius: 12px;
            cursor: pointer; transition: all 0.2s; text-align: center;
        }
        .widget-picker-item:hover {
            background: var(--dark-hover); border-color: var(--primary); transform: translateY(-2px);
        }
        .widget-picker-item .wp-icon { font-size: 1.75rem; }
        .widget-picker-item .wp-name { font-size: 0.85rem; font-weight: 600; color: var(--white); }
        .widget-picker-item .wp-desc { font-size: 0.7rem; color: var(--gray); line-height: 1.3; }

        /* Notes widget */
        .notes-textarea {
            width: 100%; min-height: 100px; background: var(--dark);
            border: 1px solid rgba(124, 58, 237, 0.2); border-radius: 8px;
            color: var(--white); padding: 0.75rem; font-family: inherit;
            font-size: 0.85rem; resize: vertical; outline: none;
        }
        .notes-textarea:focus { border-color: var(--primary); }
        .notes-save-hint { font-size: 0.7rem; color: var(--gray); margin-top: 0.5rem; text-align: right; }

        /* Cashflow summary */
        .cashflow-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
        .cf-stat { background: var(--dark); padding: 0.75rem; border-radius: 8px; text-align: center; }
        .cf-value { font-size: 1.1rem; font-weight: 700; color: var(--green); }
        .cf-label { font-size: 0.7rem; color: var(--gray); margin-top: 0.25rem; }

        /* Phone Number Bar */
        .phone-bar {
            background: rgba(15, 15, 35, 0.95);
            border-bottom: 1px solid rgba(124, 58, 237, 0.15);
            display: flex; align-items: center; gap: 1.5rem;
            padding: 8px max(1rem, var(--safe-left));
            overflow-x: auto; -webkit-overflow-scrolling: touch;
        }
        .phone-bar:empty { display: none; }
        .agent-contact-bar {
            background: rgba(15, 15, 35, 0.95);
            border-bottom: 1px solid rgba(124, 58, 237, 0.15);
            padding: 8px max(1rem, var(--safe-left));
            display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
        }
        .agent-contact-bar:empty { display: none; }
        .agent-contact-bar .phone-bar {
            background: none; border: none; padding: 0;
        }
        .agent-email-bar { display: flex; align-items: center; gap: 0.75rem; }
        .agent-email-bar:empty { display: none; }
        .agent-email-item {
            display: flex; align-items: center; gap: 0.5rem; white-space: nowrap;
            font-size: 0.8rem; color: var(--light-gray); background: rgba(0, 210, 230, 0.08);
            padding: 6px 14px; border-radius: 10px; border: 1px solid rgba(0, 210, 230, 0.15);
        }
        .agent-email-item .email-icon { font-size: 0.9rem; }
        .agent-email-item .email-address { font-weight: 600; font-size: 0.85rem; color: var(--white); letter-spacing: 0.02em; }
        .agent-email-item .email-label { font-size: 0.7rem; color: var(--gray); }
        .phone-item {
            display: flex; align-items: center; gap: 0.75rem; white-space: nowrap;
            font-size: 0.8rem; color: var(--light-gray); background: rgba(124, 58, 237, 0.08);
            padding: 6px 14px; border-radius: 10px; border: 1px solid rgba(124, 58, 237, 0.15);
        }
        .phone-number { font-weight: 600; font-size: 0.85rem; color: var(--white); letter-spacing: 0.02em; }
        .phone-label { font-size: 0.7rem; color: var(--gray); margin-left: -0.4rem; }
        .phone-statuses { display: flex; align-items: center; gap: 0.5rem; }
        .status-indicator {
            display: flex; align-items: center; gap: 3px;
            font-size: 0.65rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.05em;
        }
        .status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
        .status-dot.green { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
        .status-dot.yellow { background: #f59e0b; box-shadow: 0 0 6px rgba(245, 158, 11, 0.5); }
        .status-dot.red { background: #ef4444; box-shadow: 0 0 6px rgba(239, 68, 68, 0.5); }
        .status-dot.gray { background: #6b7280; }

        /* ============================================ */
        /* SCREEN 2: CHAT                              */
        /* ============================================ */
        .chat-screen-content {
            display: flex;
            flex-direction: column;
            height: 100%;
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
            -webkit-overflow-scrolling: touch;
        }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
        .chat-bubble {
            max-width: 80%;
            padding: 1rem;
            border-radius: 1rem;
            animation: fadeIn 0.3s ease;
            line-height: 1.5;
            word-wrap: break-word;
        }
        .chat-bubble.agent {
            background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.3);
            align-self: flex-start;
            border-bottom-left-radius: 4px;
        }
        .chat-bubble.user {
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            align-self: flex-end;
            border-bottom-right-radius: 4px;
        }
        .agent-bubble-header {
            display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.5rem;
        }
        .agent-bubble-avatar {
            width: 28px; height: 28px; border-radius: 50%;
        }
        .agent-bubble-name { font-size: 0.75rem; color: var(--primary-light); font-weight: 600; }
        .chat-input-bar {
            padding: 1rem;
            padding-bottom: calc(1rem + var(--safe-bottom));
            padding-left: max(1rem, var(--safe-left));
            padding-right: max(1rem, var(--safe-right));
            background: rgba(15, 15, 35, 0.95);
            backdrop-filter: blur(20px);
            border-top: 1px solid rgba(124, 58, 237, 0.2);
            display: flex; gap: 0.75rem;
        }
        .chat-text-input {
            flex: 1; background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.3);
            border-radius: 24px; padding: 0.75rem 1.25rem;
            color: var(--white); font-size: 16px; outline: none; min-height: 48px;
            font-family: inherit;
        }
        .chat-text-input:focus { border-color: var(--primary); }
        .chat-text-input::placeholder { color: var(--gray); }
        .chat-send-btn {
            width: 48px; height: 48px; border-radius: 50%; border: none; cursor: pointer;
            display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
            min-width: 48px; background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white;
            transition: transform 0.15s;
        }
        .chat-send-btn:active { transform: scale(0.93); }
        .loading-dots { text-align: center; padding: 0.5rem; color: var(--gray); }
        .loading-dots::after { content: '...'; animation: dots 1.5s infinite; }
        @keyframes dots { 0%, 20% { content: '.'; } 40% { content: '..'; } 60%, 100% { content: '...'; } }

        /* ============================================ */
        /* SCREEN 3: YOUR AI JOURNEY                   */
        /* ============================================ */
        .journey-content {
            padding: 1.5rem;
            padding-left: max(1.5rem, var(--safe-left));
            padding-right: max(1.5rem, var(--safe-right));
            padding-bottom: calc(2rem + var(--safe-bottom));
            max-width: 700px;
            margin: 0 auto;
        }
        .journey-section {
            background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.15);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 1.25rem;
        }
        .journey-section-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--white);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .journey-section-subtitle {
            font-size: 0.75rem;
            color: var(--gray);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 0.75rem;
            font-weight: 600;
        }
        /* Progress Bar */
        .progress-bar-container {
            width: 100%;
            height: 12px;
            background: var(--dark);
            border-radius: 6px;
            overflow: hidden;
            margin-bottom: 0.5rem;
        }
        .progress-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--primary-light));
            border-radius: 6px;
            transition: width 0.8s ease;
        }
        .progress-percent {
            font-size: 0.8rem;
            color: var(--primary-light);
            font-weight: 600;
            text-align: right;
            margin-bottom: 1rem;
        }
        /* Checklist items */
        .checklist-item {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem;
            background: var(--dark);
            border-radius: 10px;
            margin-bottom: 0.5rem;
            transition: all 0.2s;
        }
        .checklist-item:hover { background: var(--dark-hover); }
        .checklist-icon {
            font-size: 1.25rem;
            min-width: 28px;
            text-align: center;
        }
        .checklist-info { flex: 1; min-width: 0; }
        .checklist-title {
            font-size: 0.9rem;
            font-weight: 500;
            color: var(--white);
        }
        .checklist-title.done {
            color: var(--gray);
            text-decoration: line-through;
        }
        .checklist-desc {
            font-size: 0.75rem;
            color: var(--gray);
            margin-top: 2px;
        }
        .checklist-action-btn {
            padding: 0.4rem 0.8rem;
            background: var(--primary);
            border: none;
            border-radius: 6px;
            color: white;
            font-size: 0.75rem;
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.2s;
        }
        .checklist-action-btn:hover { background: var(--primary-dark); }

        /* Weekly Goals */
        .goal-card {
            background: var(--dark);
            border-radius: 10px;
            padding: 0.75rem 1rem;
            margin-bottom: 0.5rem;
        }
        .goal-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.5rem;
        }
        .goal-title {
            font-size: 0.85rem;
            font-weight: 500;
            color: var(--white);
        }
        .goal-status {
            font-size: 0.75rem;
            color: var(--primary-light);
            font-weight: 600;
        }
        .goal-progress-bar {
            width: 100%;
            height: 6px;
            background: rgba(124, 58, 237, 0.15);
            border-radius: 3px;
            overflow: hidden;
        }
        .goal-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--green));
            border-radius: 3px;
            transition: width 0.5s ease;
        }
        .goal-checkbox-row {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            padding: 0.6rem 0;
            border-bottom: 1px solid rgba(255,255,255,0.04);
            cursor: pointer;
        }
        .goal-checkbox-row:last-child { border-bottom: none; }
        .goal-check {
            width: 22px; height: 22px;
            border: 2px solid var(--primary);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            transition: all 0.2s;
            flex-shrink: 0;
        }
        .goal-check.checked {
            background: var(--green);
            border-color: var(--green);
            color: white;
        }
        .goal-check-label {
            font-size: 0.85rem;
            color: var(--light-gray);
        }
        .goal-check.checked + .goal-check-label {
            text-decoration: line-through;
            color: var(--gray);
        }
        .streak-banner {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
            padding: 0.75rem;
            background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(239, 68, 68, 0.1));
            border: 1px solid rgba(124, 58, 237, 0.25);
            border-radius: 12px;
            margin-bottom: 1rem;
            font-size: 1rem;
            font-weight: 700;
            color: var(--yellow);
        }

        /* Achievement Badges */
        .badges-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
            gap: 0.75rem;
        }
        .badge-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.5rem;
            padding: 1rem 0.5rem;
            background: var(--dark);
            border-radius: 12px;
            border: 1px solid rgba(124, 58, 237, 0.1);
            text-align: center;
            transition: all 0.3s;
        }
        .badge-item.unlocked {
            border-color: rgba(124, 58, 237, 0.4);
            background: rgba(124, 58, 237, 0.08);
        }
        .badge-item.locked { opacity: 0.4; filter: grayscale(100%); }
        .badge-emoji {
            font-size: 2rem;
            width: 56px;
            height: 56px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--dark-card);
            border-radius: 50%;
            border: 2px solid transparent;
        }
        .badge-item.unlocked .badge-emoji {
            border-color: var(--primary);
            box-shadow: 0 0 12px rgba(124, 58, 237, 0.3);
        }
        .badge-name {
            font-size: 0.7rem;
            font-weight: 600;
            color: var(--light-gray);
        }
        .badge-item.locked .badge-name { color: var(--gray); }

        /* ============================================ */
        /* SCREEN 4: SETTINGS                          */
        /* ============================================ */
        .settings-content {
            padding: 1.5rem;
            padding-left: max(1.5rem, var(--safe-left));
            padding-right: max(1.5rem, var(--safe-right));
            padding-bottom: calc(2rem + var(--safe-bottom));
            max-width: 600px;
            margin: 0 auto;
        }
        .settings-section {
            background: var(--dark-card);
            border: 1px solid rgba(124, 58, 237, 0.15);
            border-radius: 16px;
            padding: 1.5rem;
            margin-bottom: 1.25rem;
        }
        .settings-card {
            padding: 1.5rem;
            padding-bottom: calc(6rem + env(safe-area-inset-bottom, 0px));
            max-width: 600px;
            margin: 0 auto;
            overflow-y: auto;
            -webkit-overflow-scrolling: touch;
        }
        .settings-avatar-row {
            display: flex;
            align-items: center;
            gap: 1rem;
            margin-bottom: 1.5rem;
            padding-bottom: 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.06);
        }
        .settings-section-title {
            font-size: 0.75rem;
            font-weight: 600;
            color: var(--primary-light);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            margin-bottom: 1rem;
        }
        .settings-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.75rem 0;
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .settings-row:last-child { border-bottom: none; }

        /* Voice Picker Styles */
        .voice-gender-toggle { display: flex; gap: 0; border-radius: 12px; overflow: hidden; border: 1px solid rgba(124,58,237,0.3); margin-bottom: 1.5rem; }
        .voice-gender-btn { flex: 1; padding: 10px 0; text-align: center; font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: all 0.3s; background: rgba(255,255,255,0.03); color: var(--gray); border: none; }
        .voice-gender-btn.active { background: linear-gradient(135deg, #8a5cff, #00d2e6); color: #fff; }
        .voice-gender-btn:hover:not(.active) { background: rgba(124,58,237,0.1); color: var(--light-gray); }
        .voice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
        @media (max-width: 600px) { .voice-grid { grid-template-columns: 1fr; } }
        .voice-card { background: rgba(255,255,255,0.03); border: 2px solid rgba(124,58,237,0.15); border-radius: 16px; padding: 1rem; cursor: pointer; transition: all 0.3s; position: relative; }
        .voice-card:hover { border-color: rgba(124,58,237,0.4); background: rgba(124,58,237,0.06); transform: translateY(-2px); }
        .voice-card.selected { border-color: #8a5cff; background: rgba(124,58,237,0.1); box-shadow: 0 0 20px rgba(124,58,237,0.2); }
        .voice-card.selected::after { content: "✓"; position: absolute; top: 8px; right: 12px; font-size: 1.2rem; color: #8a5cff; font-weight: 700; }
        .voice-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
        .voice-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(124,58,237,0.3); }
        .voice-info h4 { margin: 0; font-size: 1rem; color: var(--white); }
        .voice-info span { font-size: 0.75rem; color: var(--gray); }
        .voice-desc { font-size: 0.8rem; color: var(--light-gray); margin-bottom: 0.75rem; line-height: 1.4; }
        .voice-preview-btn { display: flex; align-items: center; gap: 0.5rem; background: rgba(0,210,230,0.1); border: 1px solid rgba(0,210,230,0.25); color: #00d2e6; padding: 8px 16px; border-radius: 10px; cursor: pointer; font-size: 0.8rem; font-weight: 600; transition: all 0.3s; width: 100%; justify-content: center; }
        .voice-preview-btn:hover { background: rgba(0,210,230,0.2); }
        .voice-preview-btn.playing { background: rgba(0,210,230,0.25); color: #fff; }
        .voice-save-btn { display: block; width: 100%; padding: 14px; margin-top: 1.5rem; background: linear-gradient(135deg, #8a5cff, #6c3ce0); color: #fff; border: none; border-radius: 14px; font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.3s; }
        .voice-save-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(124,58,237,0.4); }
        .voice-save-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        .settings-section-title { font-size: 1.1rem; font-weight: 700; color: var(--white); margin: 2rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid rgba(124,58,237,0.15); }
        .settings-edit-input { background: rgba(255,255,255,0.05); border: 1px solid rgba(124,58,237,0.2); color: var(--white); padding: 8px 12px; border-radius: 8px; font-size: 0.9rem; width: 100%; }
        .settings-edit-input:focus { outline: none; border-color: #8a5cff; box-shadow: 0 0 8px rgba(124,58,237,0.2); }
        .settings-toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%) translateY(100px); background: linear-gradient(135deg, #8a5cff, #00d2e6); color: #fff; padding: 12px 24px; border-radius: 12px; font-weight: 600; z-index: 9999; transition: transform 0.4s ease; }
        .settings-toast.show { transform: translateX(-50%) translateY(0); }
        .settings-row-label { font-size: 0.85rem; color: var(--gray); }
        .settings-row-value { font-size: 0.9rem; font-weight: 500; color: var(--white); text-align: right; }
        .theme-toggle-btn {
            padding: 0.5rem 1rem;
            background: var(--dark);
            border: 1px solid rgba(124, 58, 237, 0.3);
            border-radius: 8px;
            color: var(--light-gray);
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .theme-toggle-btn:hover { border-color: var(--primary); color: var(--white); }
        .notif-toggle {
            width: 48px; height: 26px;
            background: var(--dark);
            border: 2px solid rgba(124, 58, 237, 0.3);
            border-radius: 13px;
            cursor: pointer;
            position: relative;
            transition: all 0.3s;
        }
        .notif-toggle.on { background: var(--primary); border-color: var(--primary); }
        .notif-toggle::after {
            content: '';
            width: 18px; height: 18px;
            background: white;
            border-radius: 50%;
            position: absolute;
            top: 2px; left: 2px;
            transition: transform 0.3s;
        }
        .notif-toggle.on::after { transform: translateX(22px); }

        /* Email widget notifications toggle (checkbox-based switch, dark theme) */
        .email-notify-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 6px 0 10px;
            margin-bottom: 6px;
            border-bottom: 1px solid rgba(124, 58, 237, 0.12);
        }
        .email-notify-label {
            font-size: 0.82rem;
            color: var(--white);
            cursor: pointer;
            user-select: none;
        }
        .email-notify-status {
            font-size: 0.72rem;
            color: var(--gray);
            margin-left: auto;
            min-width: 1px;
        }
        .switch {
            position: relative;
            display: inline-block;
            width: 40px;
            height: 22px;
            flex: 0 0 auto;
        }
        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
            position: absolute;
        }
        .switch .switch-slider {
            position: absolute;
            inset: 0;
            background: var(--dark);
            border: 2px solid rgba(124, 58, 237, 0.3);
            border-radius: 11px;
            cursor: pointer;
            transition: all 0.3s;
        }
        .switch .switch-slider::after {
            content: '';
            position: absolute;
            top: 1px;
            left: 1px;
            width: 16px;
            height: 16px;
            background: #fff;
            border-radius: 50%;
            transition: transform 0.3s;
        }
        .switch input:checked + .switch-slider {
            background: var(--primary);
            border-color: var(--primary);
        }
        .switch input:checked + .switch-slider::after { transform: translateX(18px); }
        .switch input:disabled + .switch-slider { opacity: 0.5; cursor: progress; }
        .switch input:focus-visible + .switch-slider {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        .logout-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.75rem;
            width: 100%;
            padding: 1rem;
            background: rgba(239, 68, 68, 0.12);
            border: 2px solid var(--red);
            border-radius: 12px;
            color: var(--red);
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            min-height: 56px;
        }
        .logout-btn:hover { background: rgba(239, 68, 68, 0.25); }
        .version-info {
            text-align: center;
            padding: 1.5rem 0 1rem;
            font-size: 0.75rem;
            color: var(--gray);
        }

        /* ============================================ */
        /* MOBILE MENU (hamburger)                     */
        /* ============================================ */
        .mobile-menu {
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(15, 15, 35, 0.98); z-index: 10001;
            display: none; flex-direction: column;
            padding: calc(80px + var(--safe-top)) 2rem calc(2rem + var(--safe-bottom));
        }
        .mobile-menu.active { display: flex; }
        .mobile-menu-item {
            padding: 1rem 0; font-size: 1.25rem; color: var(--white);
            border-bottom: 1px solid rgba(124, 58, 237, 0.2);
            cursor: pointer; min-height: 56px;
            display: flex; align-items: center; gap: 1rem;
        }

        /* Intro.js custom styling */
        .introjs-tooltip { background: var(--dark-card); border: 1px solid var(--primary); }
        .introjs-tooltip-title { color: var(--primary-light); }
        .introjs-tooltiptext { color: var(--white); }
        .introjs-button { background: var(--primary); color: white; border: none; }
        .introjs-button:hover { background: var(--primary-dark); }
        .introjs-helperLayer { background: rgba(124, 58, 237, 0.1); }

        /* ============================================ */
        /* MOBILE RESPONSIVE                           */
        /* ============================================ */
        @media (max-width: 768px) {
            html, body { height: auto !important; overflow-y: auto !important; overflow-x: hidden !important; }
            body { padding-top: calc(108px + var(--safe-top)); }

            .hamburger { display: flex; flex-direction: column; justify-content: center; }
            .header-actions { display: none; }
            .header { position: fixed; z-index: 1001; }

            /* Tab bar full width on mobile */
            .tab-bar { padding: 0; }
            .tab-item {
                flex: 1;
                font-size: 0.75rem;
                padding: 0 0.25rem;
                gap: 0.2rem;
            }
            .tab-label { display: none; }

            /* Quick actions visible on mobile */
            .quick-actions {
                display: flex !important;
                align-items: center; justify-content: flex-start;
                gap: 0.5rem; padding: 0.5rem;
                background: var(--dark);
                border-bottom: 1px solid rgba(124, 58, 237, 0.15);
                overflow-x: auto; -webkit-overflow-scrolling: touch;
            }
            .qa-btn { min-width: 56px; padding: 0.4rem 0.5rem; }

            .stats-bar {
                overflow-x: auto; justify-content: flex-start; gap: 1.5rem; padding: 0.75rem 1rem;
            }
            .stat-item { min-width: fit-content; }

            /* Chat bubbles wider on mobile */
            .chat-bubble { max-width: 90%; }

            /* Settings & Journey full width */
            .settings-content, .journey-content { padding: 1rem; }

            /* Badges smaller on mobile */
            .badges-grid { grid-template-columns: repeat(auto-fill, minmax(75px, 1fr)); gap: 0.5rem; }
            .badge-emoji { width: 48px; height: 48px; font-size: 1.5rem; }

            /* Mobile scrolling fix: screens become normal-flow elements */
            .screen {
                position: relative !important;
                top: auto !important;
                left: auto !important;
                right: auto !important;
                bottom: auto !important;
                min-height: calc(100vh - 108px - var(--safe-top));
                overflow: visible !important;
            }

            /* Chat screen: keep fixed for message scrolling + input bar */
            #screen-chat.active {
                position: fixed !important;
                top: calc(108px + var(--safe-top)) !important;
                left: 0 !important;
                right: 0 !important;
                bottom: 0 !important;
                overflow-y: auto !important;
                -webkit-overflow-scrolling: touch;
            }

            /* Bottom padding for scrollable screens */
            .journey-content, .settings-content {
                padding-bottom: calc(2rem + var(--safe-bottom) + 60px) !important;
            }

            /* Fixed chat input bar on mobile */
            .chat-input-bar {
                position: fixed !important;
                bottom: 0 !important;
                left: 0 !important;
                right: 0 !important;
                z-index: 100;
            }

            /* Chat messages padding for fixed input bar */
            .chat-messages {
                padding-bottom: calc(80px + var(--safe-bottom)) !important;
            }
        }
            /* === Mobile Touch Fixes === */
            .tab-item, .qa-btn, .card-header, .btn, button, a, .nav-links a {
                touch-action: manipulation;
                -webkit-tap-highlight-color: rgba(124, 58, 237, 0.3);
                cursor: pointer;
            }
            .tab-item {
                min-height: 44px;
                display: flex;
                align-items: center;
                justify-content: center;
            }
            .card-header {
                min-height: 44px;
            }
            /* Ensure no invisible overlays block taps */
            .hamburger, .header-actions { pointer-events: auto; }


        /* ============================================ */
        /* JOURNEY V3 - PATH SELECTION & ONBOARDING    */
        /* ============================================ */
        .journey-path-selection {
            text-align: center;
            padding: 1rem 0 0.5rem;
        }
        .journey-path-selection h2 {
            font-size: 1.5rem;
            font-weight: 700;
            margin-bottom: 0.25rem;
            background: linear-gradient(135deg, var(--primary), var(--primary-light));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        .journey-path-selection p {
            color: var(--gray);
            font-size: 0.85rem;
            margin-bottom: 1.25rem;
        }
        .path-cards {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .path-card {
            background: rgba(26, 26, 46, 0.85);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(124, 58, 237, 0.15);
            border-radius: 16px;
            padding: 1.25rem;
            text-align: left;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        .path-card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 3px;
            border-radius: 16px 16px 0 0;
        }
        .path-card.observer::before { background: linear-gradient(90deg, #10b981, #34d399); }
        .path-card.assistant::before { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
        .path-card.operator::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
        .path-card:hover {
            border-color: rgba(124, 58, 237, 0.4);
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        }
        .path-card-header {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 0.5rem;
        }
        .path-card-icon {
            font-size: 1.5rem;
            width: 44px; height: 44px;
            display: flex; align-items: center; justify-content: center;
            border-radius: 12px;
        }
        .observer .path-card-icon { background: rgba(16, 185, 129, 0.15); }
        .assistant .path-card-icon { background: rgba(59, 130, 246, 0.15); }
        .operator .path-card-icon { background: rgba(124, 58, 237, 0.15); }
        .path-card-title {
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--white);
        }
        .path-card-desc {
            font-size: 0.8rem;
            color: var(--gray);
            line-height: 1.5;
            margin-bottom: 0.75rem;
        }
        .path-card-features {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin-bottom: 1rem;
        }
        .path-feature-tag {
            font-size: 0.7rem;
            padding: 0.25rem 0.6rem;
            border-radius: 20px;
            font-weight: 500;
            background: rgba(255,255,255,0.06);
            color: var(--light-gray);
        }
        .path-card-btn {
            width: 100%;
            padding: 0.7rem;
            border: none;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            color: white;
        }
        .observer .path-card-btn { background: linear-gradient(135deg, #10b981, #059669); }
        .assistant .path-card-btn { background: linear-gradient(135deg, #3b82f6, #2563eb); }
        .operator .path-card-btn { background: linear-gradient(135deg, #7c3aed, #5b21b6); }
        .path-card-btn:hover { opacity: 0.9; transform: scale(1.01); }

        /* Timeline / Journey Map */
        .journey-timeline-wrapper {
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
            padding-bottom: 0.5rem;
            scrollbar-width: thin;
            scrollbar-color: var(--primary) var(--dark);
        }
        .journey-timeline {
            display: flex;
            min-width: 580px;
            position: relative;
            padding: 1rem 0 0.5rem;
        }
        .timeline-phase {
            flex: 1;
            text-align: center;
            position: relative;
            padding: 0 0.5rem;
        }
        .timeline-phase::before {
            content: '';
            position: absolute;
            top: 22px;
            left: 0; right: 0;
            height: 3px;
            background: rgba(124, 58, 237, 0.2);
        }
        .timeline-phase:first-child::before { left: 50%; }
        .timeline-phase:last-child::before { right: 50%; }
        .timeline-dot {
            width: 16px; height: 16px;
            border-radius: 50%;
            background: var(--dark-card);
            border: 3px solid rgba(124, 58, 237, 0.3);
            margin: 14px auto 0.75rem;
            position: relative;
            z-index: 2;
            transition: all 0.3s;
        }
        .timeline-phase.active .timeline-dot {
            background: var(--primary);
            border-color: var(--primary-light);
            box-shadow: 0 0 16px rgba(124, 58, 237, 0.6), 0 0 32px rgba(124, 58, 237, 0.3);
        }
        .timeline-phase.completed .timeline-dot {
            background: var(--green);
            border-color: var(--green);
        }
        .timeline-phase-label {
            font-size: 0.65rem;
            color: var(--gray);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            font-weight: 600;
            margin-bottom: 0.25rem;
        }
        .timeline-phase.active .timeline-phase-label { color: var(--primary-light); }
        .timeline-phase.completed .timeline-phase-label { color: var(--green); }
        .timeline-phase-title {
            font-size: 0.8rem;
            font-weight: 700;
            color: var(--white);
            margin-bottom: 0.25rem;
        }
        .timeline-milestone {
            font-size: 0.7rem;
            color: var(--gray);
            font-style: italic;
        }
        .timeline-phase.active .timeline-milestone { color: var(--primary-light); }

        /* Today's Focus Card */
        .focus-card {
            background: rgba(26, 26, 46, 0.85);
            backdrop-filter: blur(16px);
            -webkit-backdrop-filter: blur(16px);
            border: 1px solid rgba(124, 58, 237, 0.25);
            border-radius: 16px;
            padding: 1.5rem;
            position: relative;
            overflow: hidden;
        }
        .focus-card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 3px;
            background: linear-gradient(90deg, var(--primary), var(--primary-light), #06b6d4);
        }
        .focus-card-day {
            font-size: 0.7rem;
            color: var(--primary-light);
            text-transform: uppercase;
            letter-spacing: 0.1em;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }
        .focus-card h3 {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--white);
            margin-bottom: 0.5rem;
        }
        .focus-card p {
            font-size: 0.85rem;
            color: var(--gray);
            line-height: 1.6;
            margin-bottom: 0.75rem;
        }
        .focus-prompts {
            list-style: none;
            padding: 0;
            margin: 0.75rem 0;
        }
        .focus-prompts li {
            font-size: 0.8rem;
            color: var(--light-gray);
            padding: 0.4rem 0;
            padding-left: 1.25rem;
            position: relative;
        }
        .focus-prompts li::before {
            content: '→';
            position: absolute;
            left: 0;
            color: var(--primary-light);
        }
        .focus-outputs {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }
        .focus-output-tag {
            font-size: 0.75rem;
            padding: 0.3rem 0.7rem;
            background: rgba(16, 185, 129, 0.12);
            color: var(--green);
            border-radius: 20px;
            font-weight: 500;
        }
        .focus-actions {
            display: flex;
            gap: 0.75rem;
            margin-top: 1rem;
        }
        .focus-btn-primary {
            flex: 1;
            padding: 0.7rem;
            border: none;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            background: linear-gradient(135deg, var(--primary), var(--primary-dark));
            color: white;
            transition: all 0.2s;
        }
        .focus-btn-primary:hover { opacity: 0.9; }
        .focus-btn-secondary {
            flex: 1;
            padding: 0.7rem;
            border: 1px solid rgba(124, 58, 237, 0.3);
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            background: transparent;
            color: var(--gray);
            transition: all 0.2s;
        }
        .focus-btn-secondary:hover { border-color: var(--primary); color: var(--white); }

        /* Achievement Badge V3 enhancements */
        .badge-item.unlocked .badge-emoji {
            animation: badgeGlow 2s ease-in-out infinite alternate;
        }
        @keyframes badgeGlow {
            0% { box-shadow: 0 0 8px rgba(124, 58, 237, 0.3); }
            100% { box-shadow: 0 0 18px rgba(6, 182, 212, 0.4); }
        }
        .badge-date {
            font-size: 0.6rem;
            color: var(--gray);
            margin-top: 2px;
        }
        .badge-item.locked .badge-lock-label {
            font-size: 0.55rem;
            color: var(--gray);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        /* Trust Anchors */
        .trust-anchors {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 0.5rem 1.5rem;
            padding: 1rem 0 0.5rem;
            opacity: 0.5;
            transition: opacity 0.3s;
        }
        .trust-anchors:hover { opacity: 0.8; }
        .trust-anchor-item {
            font-size: 0.7rem;
            color: var(--gray);
            display: flex;
            align-items: center;
            gap: 0.35rem;
        }
        .trust-anchor-item::before {
            content: '🔒';
            font-size: 0.6rem;
        }

        /* Toast notification */
        .journey-toast {
            position: fixed;
            top: calc(70px + var(--safe-top));
            left: 50%;
            transform: translateX(-50%) translateY(-20px);
            background: rgba(16, 185, 129, 0.95);
            backdrop-filter: blur(12px);
            color: white;
            padding: 0.75rem 1.5rem;
            border-radius: 12px;
            font-size: 0.85rem;
            font-weight: 600;
            z-index: 9999;
            opacity: 0;
            transition: all 0.4s ease;
            pointer-events: none;
            white-space: nowrap;
        }
        .journey-toast.show {
            opacity: 1;
            transform: translateX(-50%) translateY(0);
        }

        /* Current path indicator */
        .current-path-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
            padding: 0.35rem 0.8rem;
            border-radius: 20px;
            font-size: 0.75rem;
            font-weight: 600;
            margin-bottom: 1rem;
        }
        .current-path-badge.observer { background: rgba(16, 185, 129, 0.15); color: #34d399; }
        .current-path-badge.assistant { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
        .current-path-badge.operator { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }

        /* Responsive adjustments */
        @media (max-width: 600px) {
            .path-cards { gap: 0.75rem; }
            .path-card { padding: 1rem; }
            .focus-actions { flex-direction: column; }
            .trust-anchors { flex-direction: column; align-items: center; gap: 0.4rem; }
        }


        /* Beta Feedback Banner */
        .beta-banner {
            background: linear-gradient(90deg, #7c3aed, #00d2e6);
            text-align: center;
            padding: 8px 16px;
            font-size: 0.85rem;
            font-weight: 600;
            color: #fff;
            cursor: pointer;
            letter-spacing: 0.3px;
            position: relative;
            z-index: 100;
            transition: opacity 0.2s;
        }
        .beta-banner:hover { opacity: 0.9; }
        .beta-banner span.beta-tag {
            background: rgba(255,255,255,0.2);
            padding: 2px 8px;
            border-radius: 4px;
            margin-right: 8px;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        /* Feedback Modal */
        .feedback-overlay {
            display: none;
            position: fixed; top: 0; left: 0; right: 0; bottom: 0;
            background: rgba(0,0,0,0.7);
            z-index: 9999;
            align-items: center; justify-content: center;
        }
        .feedback-overlay.active { display: flex; }
        .feedback-modal {
            background: #1a1a2e;
            border: 1px solid rgba(124,58,237,0.3);
            border-radius: 12px;
            padding: 2rem;
            max-width: 500px;
            width: 90%;
            position: relative;
        }
        .feedback-modal h3 {
            color: #fff;
            margin: 0 0 0.5rem 0;
            font-size: 1.2rem;
        }
        .feedback-modal p {
            color: #a0a0b8;
            font-size: 0.85rem;
            margin: 0 0 1.5rem 0;
            line-height: 1.5;
        }
        .feedback-modal select,
        .feedback-modal textarea {
            width: 100%;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(124,58,237,0.3);
            border-radius: 8px;
            padding: 0.75rem;
            color: #fff;
            font-size: 0.9rem;
            font-family: inherit;
            resize: vertical;
            margin-bottom: 1rem;
            box-sizing: border-box;
        }
        .feedback-modal select option { background: #1a1a2e; color: #fff; }
        .feedback-modal textarea { min-height: 120px; }
        .feedback-modal textarea::placeholder { color: #666; }
        .feedback-modal textarea:focus,
        .feedback-modal select:focus { outline: none; border-color: #7c3aed; }
        .feedback-actions {
            display: flex; gap: 0.75rem; justify-content: flex-end;
        }
        .feedback-actions button {
            padding: 0.6rem 1.5rem;
            border-radius: 8px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all 0.2s;
        }
        .btn-cancel {
            background: rgba(255,255,255,0.1);
            color: #a0a0b8;
        }
        .btn-cancel:hover { background: rgba(255,255,255,0.15); }
        .btn-submit-feedback {
            background: linear-gradient(135deg, #7c3aed, #00d2e6);
            color: #fff;
        }
        .btn-submit-feedback:hover { opacity: 0.9; }
        .btn-submit-feedback:disabled { opacity: 0.5; cursor: not-allowed; }
        .feedback-success {
            text-align: center;
            padding: 1rem 0;
        }
        .feedback-success .check { font-size: 3rem; margin-bottom: 0.75rem; }
        .feedback-success h3 { color: #00d2e6; }
        .feedback-close {
            position: absolute; top: 1rem; right: 1rem;
            background: none; border: none; color: #666;
            font-size: 1.5rem; cursor: pointer; padding: 0; line-height: 1;
        }
        .feedback-close:hover { color: #fff; }

        /* Beta Feedback Chat */
        .feedback-chat-modal { display: flex; flex-direction: column; max-height: 80vh; }
        .feedback-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
        .feedback-chat-header h3 { margin: 0 0 0.4rem 0; }
        .feedback-chat-header p { margin: 0 0 1rem 0; }
        .feedback-messages {
            flex: 1;
            overflow-y: auto;
            min-height: 220px;
            max-height: 45vh;
            padding: 0.25rem;
            margin-bottom: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }
        .beta-msg { display: flex; }
        .beta-msg-user { justify-content: flex-end; }
        .beta-msg-dev { justify-content: flex-start; }
        .beta-bubble {
            max-width: 80%;
            padding: 0.6rem 0.85rem;
            border-radius: 12px;
            font-size: 0.9rem;
            line-height: 1.45;
            color: #fff;
            white-space: pre-wrap;
            word-wrap: break-word;
        }
        .beta-msg-user .beta-bubble {
            background: linear-gradient(135deg, #7c3aed, #00d2e6);
            border-bottom-right-radius: 4px;
        }
        .beta-msg-dev .beta-bubble {
            background: rgba(255,255,255,0.07);
            border: 1px solid rgba(124,58,237,0.3);
            border-bottom-left-radius: 4px;
            color: #e6e6f0;
        }
        .beta-typing { display: inline-flex; gap: 4px; align-items: center; }
        .beta-typing span {
            width: 6px; height: 6px; border-radius: 50%;
            background: #a0a0b8; display: inline-block;
            animation: betaBlink 1.2s infinite ease-in-out both;
        }
        .beta-typing span:nth-child(2) { animation-delay: 0.2s; }
        .beta-typing span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes betaBlink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
        .feedback-chat-input textarea {
            width: 100%; box-sizing: border-box;
            background: rgba(255,255,255,0.05);
            border: 1px solid rgba(124,58,237,0.3);
            border-radius: 8px;
            padding: 0.65rem;
            color: #fff; font-size: 0.9rem; font-family: inherit;
            resize: vertical; margin-bottom: 0.75rem;
        }
        .feedback-chat-input textarea:focus { outline: none; border-color: #7c3aed; }
        .feedback-chat-input textarea::placeholder { color: #666; }
        .feedback-chat-actions { display: flex; gap: 0.75rem; justify-content: space-between; }
        .feedback-chat-actions button {
            padding: 0.6rem 1.4rem; border-radius: 8px; font-size: 0.85rem;
            font-weight: 600; cursor: pointer; border: none; transition: all 0.2s;
        }
        .feedback-chat-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

        /* EDITABLE PROFILE ROWS */
        .editable-row {
            cursor: pointer;
            position: relative;
            transition: background 0.2s;
        }
        .editable-row:hover {
            background: rgba(124, 58, 237, 0.08);
            border-radius: 8px;
        }
        .editable-row .edit-icon {
            font-size: 0.75rem;
            opacity: 0;
            transition: opacity 0.2s;
            position: absolute;
            right: 0.5rem;
        }
        .editable-row:hover .edit-icon {
            opacity: 0.6;
        }
        .settings-row-edit {
            padding: 0.75rem 0;
            border-bottom: 1px solid rgba(124, 58, 237, 0.1);
        }
        .edit-save-btn {
            background: linear-gradient(135deg, var(--primary), var(--accent));
            border: none;
            color: white;
            padding: 8px 20px;
            border-radius: 8px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: opacity 0.2s;
        }
        .edit-save-btn:hover { opacity: 0.85; }
        .edit-cancel-btn {
            background: transparent;
            border: 1px solid rgba(124, 58, 237, 0.3);
            color: var(--gray);
            padding: 8px 20px;
            border-radius: 8px;
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
        }
        .edit-cancel-btn:hover { border-color: var(--primary); color: var(--white); }

        /* Fix: Ensure settings content not hidden by fixed header */
        #screen-settings {
            padding-top: 1rem;
        }
        .settings-card {
            position: relative;
            z-index: 1;
        }

        /* Fix: Agent email bar visibility */
        .agent-email-bar {
            position: relative;
            z-index: 1;
        }

        /* LEVEL & XP BAR */
        .journey-level-bar {
            display: flex;
            align-items: center;
            gap: 1rem;
            background: linear-gradient(135deg, rgba(124,58,237,0.15), rgba(0,210,230,0.1));
            border: 1px solid rgba(124,58,237,0.3);
            border-radius: 16px;
            padding: 1rem 1.25rem;
            margin-bottom: 1.5rem;
        }
        .level-badge {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary), var(--accent));
            flex-shrink: 0;
        }
        .level-number {
            font-size: 1.4rem;
            font-weight: 800;
            color: white;
            line-height: 1;
        }
        .level-label {
            font-size: 0.55rem;
            font-weight: 700;
            color: rgba(255,255,255,0.8);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }
        .level-progress-area {
            flex: 1;
            min-width: 0;
        }
        .level-title-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.4rem;
        }
        .level-title {
            font-weight: 700;
            font-size: 0.95rem;
            color: var(--white);
        }
        .level-xp {
            font-size: 0.75rem;
            color: var(--accent);
            font-weight: 600;
        }
        .xp-bar-container {
            height: 8px;
            background: rgba(124,58,237,0.15);
            border-radius: 4px;
            overflow: hidden;
            margin-bottom: 0.4rem;
        }
        .xp-bar-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--primary), var(--accent));
            border-radius: 4px;
            transition: width 0.6s ease;
        }
        .level-stats {
            display: flex;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .level-stat {
            font-size: 0.75rem;
            color: var(--gray);
        }

        /* ONBOARDING INTERVIEW */
        .interview-card {
            background: var(--dark-card);
            border: 1px solid rgba(124,58,237,0.2);
            border-radius: 12px;
            padding: 1.5rem;
        }
        .interview-q {
            margin-bottom: 1rem;
        }
        .interview-q label {
            display: block;
            font-size: 0.9rem;
            font-weight: 600;
            color: var(--white);
            margin-bottom: 0.4rem;
        }
        .interview-q select {
            width: 100%;
        }
        .tool-chips {
            display: flex;
            flex-wrap: wrap;
            gap: 0.5rem;
        }
        .tool-chip {
            display: inline-block;
            padding: 6px 14px;
            border-radius: 20px;
            border: 1px solid rgba(124,58,237,0.3);
            background: rgba(124,58,237,0.08);
            color: var(--gray);
            font-size: 0.85rem;
            cursor: pointer;
            transition: all 0.2s;
            user-select: none;
        }
        .tool-chip:hover {
            border-color: var(--primary);
            color: var(--white);
        }
        .tool-chip.selected {
            background: linear-gradient(135deg, var(--primary), var(--accent));
            border-color: transparent;
            color: white;
            font-weight: 600;
        }

        /* Mobile responsive for level bar */
        @media (max-width: 600px) {
            .journey-level-bar {
                flex-direction: column;
                text-align: center;
                gap: 0.75rem;
            }
            .level-title-row {
                flex-direction: column;
                gap: 0.25rem;
            }
            .level-stats {
                justify-content: center;
            }
        }

        /* ============================================ */
        /* SMALL MOBILE                                */
        /* ============================================ */
        @media (max-width: 480px) {
            .header {
                padding-left: 0.75rem;
                padding-right: 0.75rem;
            }
            .journey-content, .settings-content {
                padding-left: 0.75rem !important;
                padding-right: 0.75rem !important;
            }
            .focus-card {
                padding: 1rem;
            }
            .path-card {
                padding: 0.875rem;
            }
            .feedback-modal {
                width: 95%;
                padding: 1.5rem;
            }
        }
