:root {
            --primary: #1a2636;
            --primary-dark: #121a24;
            --primary-light: #233246;
            --accent: #F05A50;
            --accent-dark: #d94a41;
            --accent-light: #ff7a6f;
            --success: #0d9b8a;
            --warning: #d99216;
            --danger: #e24b4b;
            --info: #3d7ea6;
            --dark: #1c2430;
            --light: #ffffff;
            --paper: #ffffff;
            --line: #e6e1dc;
            --gray-50: #ffffff;
            --gray-100: #ffffff;
            --gray-200: #e6e1dc;
            --gray-300: #d4cdc4;
            --gray-400: #222222;
            --gray-500: #111111;
            --gray-600: #111111;
            --gray-700: #000000;
            --shadow-sm: 0 1px 2px rgba(26,38,54,.04);
            --shadow-md: 0 8px 20px rgba(26,38,54,.06);
            --shadow-lg: 0 12px 28px rgba(26,38,54,.1);
            --radius-sm: 6px;
            --radius-md: 8px;
            --radius-lg: 10px;
            --radius-xl: 12px;
            --radius-2xl: 16px;
            --sidebar-width: 196px;
        }

        * { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
        html, body { max-width: 100%; overflow-x: hidden; background: #ffffff; }
        body { font-family: 'Montserrat', system-ui, sans-serif; background: #ffffff; color: var(--dark); font-size: 12px; line-height: 1.4; overflow-x: hidden; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
        button, input, select, textarea { font-family: inherit; }
        
        ::-webkit-scrollbar { width: 5px; height: 5px; }
        ::-webkit-scrollbar-track { background: var(--gray-100); border-radius: 10px; }
        ::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 10px; }
        
        .app-container { display: flex; min-height: 100vh; background: #ffffff; }
        
        /* Sidebar */
        .boot-overlay { position: fixed; inset: 0; background: var(--paper); display: flex; align-items: center; justify-content: center; z-index: 20000; }
        .boot-overlay.hidden { display: none; }
        .boot-spinner { width: 36px; height: 36px; border: 3px solid rgba(238,86,75,0.2); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }
        .form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
        .file-drop-zone { border: 2px dashed var(--gray-300); border-radius: var(--radius-lg); padding: 18px; text-align: center; cursor: pointer; }
        .file-drop-zone i { font-size: 28px; color: var(--accent); margin-bottom: 8px; display: block; }
        .file-drop-zone h3 { font-size: 13px; font-weight: 600; color: var(--gray-600); }

        .main-content { flex: 1; margin-left: var(--sidebar-width); padding: 12px 14px; min-height: 100vh; max-width: calc(100% - var(--sidebar-width)); background: #ffffff; }
        
        /* Header */
        .header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: nowrap; gap: 8px; }
        .header-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
        .welcome-section h1 { font-size: 18px; font-weight: 750; color: var(--primary); letter-spacing: -.02em; margin-bottom: 2px; }
        .welcome-section p { font-size: 11px; color: var(--gray-500); }
        
        .header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 0 1 auto; justify-content: flex-end; }
        .header-logo-right {
            height: 36px !important;
            width: 36px !important;
            max-height: 36px !important;
            max-width: 36px !important;
            object-fit: cover;
            margin-left: 8px;
            flex: 0 0 auto;
            display: block;
            border-radius: 10px;
        }
        .btn { padding: 8px 12px; border-radius: 9px; font-weight: 650; font-size: 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; border: none; transition: all 0.2s; min-height: 36px; }
        .btn-primary { background: var(--accent); color: white; }
        .btn-primary:hover { background: var(--accent-dark); }
        .btn-outline { background: var(--light); color: var(--primary); border: 1px solid var(--line); }
        .btn-outline:hover { border-color: var(--primary); }
        .btn-danger { background: var(--accent); color: white; }
        
        .stats-grid { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
        .stat-card { background: var(--light); border-radius: var(--radius-lg); padding: 10px 12px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden; min-height: 72px; flex: 1 1 0; min-width: 100px; display: flex; flex-direction: column; justify-content: center; gap: 8px; }
        .stat-card::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; width: auto; background: var(--accent); }
        .stat-card:nth-child(1)::after { background: var(--info); }
        .stat-card:nth-child(2)::after { background: #3b82f6; }
        .stat-card:nth-child(3)::after { background: #64748b; }
        .stat-card:nth-child(4)::after { background: #2563eb; }
        .stat-card:nth-child(5)::after { background: var(--warning); }
        .stat-card:nth-child(6)::after { background: #6b5b95; }
        .stat-card:nth-child(7)::after { background: var(--success); }
        .stat-card:nth-child(8)::after { background: var(--accent); }
        .stat-card:nth-child(9)::after { background: var(--primary); }
        .stat-card:nth-child(10)::after { background: var(--primary-light); }
        .stat-card[data-card="today"]::after { background: var(--info) !important; }
        .stat-card[data-card="followup"]::after { background: #3b82f6 !important; }
        .stat-card[data-card="my"]::after { background: var(--primary) !important; }
        .stat-card[data-card="total"]::after { background: var(--primary-light) !important; }
        .stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--line); }
        .stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
        .stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
        .stat-title { font-size: 10px; color: var(--gray-500); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
        .stat-icon { width: 28px; height: 28px; border-radius: 8px; background: #fff1f0; color: var(--accent); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
        .stat-value { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -.03em; text-align: right; }
        
        .quick-filters { background: var(--light); padding: 10px 12px; border-radius: var(--radius-lg); margin-bottom: 8px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
        .platform-card { background: var(--gray-50); padding: 8px 12px; border-radius: 999px; cursor: pointer; border: 1px solid var(--line); transition: all 0.2s; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; min-height: 36px; }
        .platform-card:hover { border-color: var(--primary); background: white; }
        .platform-card.active { background: var(--primary); color: white; border-color: var(--primary); }
        .qf-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
        .qf-label { flex: 0 0 88px; font-size: 11px; font-weight: 700; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.3px; display: flex; align-items: center; gap: 6px; }
        .platform-cards { display: flex; flex-wrap: wrap; gap: 8px; max-height: none; overflow: visible; flex: 1; }
        .platform-number { font-weight: 800; font-size: 14px; }
        .platform-label { font-size: 12px; font-weight: 600; text-transform: capitalize; }
        .table-header-actions { display: flex; align-items: center; gap: 10px; }
        .col-check { width: 36px; cursor: default !important; }
        .col-check input { cursor: pointer; width: 15px; height: 15px; }
        tr.row-selected { background: rgba(238,86,75,0.06); }
        .alert-popup .modal-header h3 { font-size: 15px; }
        .qf-label i { color: var(--accent); }
        
        /* Filters */
        .filters-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; background: var(--light); padding: 10px 12px; border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
        .filter-group { display: flex; flex-direction: column; gap: 5px; }
        .filter-label { font-weight: 600; color: var(--gray-600); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
        .filter-input { padding: 6px 8px; border: 1px solid var(--gray-300); border-radius: var(--radius-md); font-size: 11px; background: white; transition: all 0.2s; }
        .filter-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(238,86,75,0.1); }
        
        /* Action Buttons */
        .action-buttons { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; align-items: center; }
        .action-btn { padding: 6px 14px; border-radius: var(--radius-md); font-size: 11px; font-weight: 500; display: flex; align-items: center; gap: 6px; background: white; border: 1px solid var(--gray-200); cursor: pointer; transition: all 0.2s; }
        .action-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
        .view-toggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; position: relative; z-index: 2; }
        .view-toggle-btn { border: 0; background: transparent; min-height: 40px; padding: 0 14px; font-size: 12px; font-weight: 650; color: var(--gray-500); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; -webkit-tap-highlight-color: transparent; }
        .view-toggle-btn.on { background: var(--primary); color: #fff; }
        #leadsWorkspace[data-view="table"] #kanbanBoard,
        #leadsWorkspace[data-view="archive"] #kanbanBoard { display: none !important; }
        #leadsWorkspace[data-view="kanban"] #leadsTableWrap { display: none !important; }
        #leadsWorkspace[data-view="kanban"] #kanbanBoard { display: flex !important; }
        .kanban-board { display: none; gap: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; padding: 2px 2px 12px; margin-bottom: 8px; }
        .kanban-col { flex: 0 0 min(78vw, 280px); scroll-snap-align: start; background: #fafafa; border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; max-height: min(68vh, 640px); min-height: 220px; }
        .kanban-col-h { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); background: #fff; border-radius: 12px 12px 0 0; }
        .kanban-col-h strong { font-size: 12px; color: var(--primary); display: flex; align-items: center; gap: 6px; }
        .kanban-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
        .kanban-col[data-status="new"] .kanban-dot { background: #94a3b8; }
        .kanban-col[data-status="contacted"] .kanban-dot { background: #3b82f6; }
        .kanban-col[data-status="interested"] .kanban-dot { background: #F05A50; }
        .kanban-col[data-status="proposal"] .kanban-dot { background: #1a2636; }
        .kanban-col[data-status="converted"] .kanban-dot { background: #16a34a; }
        .kanban-col[data-status="lost"] .kanban-dot { background: #dc2626; }
        .kanban-col[data-status="did_not_pick"] .kanban-dot { background: #64748b; }
        .kanban-count { font-size: 10px; font-weight: 700; background: #fff; border: 1px solid var(--line); color: var(--gray-500); border-radius: 999px; padding: 2px 7px; }
        .kanban-list { overflow-y: auto; padding: 8px; flex: 1; -webkit-overflow-scrolling: touch; min-height: 80px; }
        .kanban-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: grab; touch-action: pan-y; box-shadow: 0 1px 2px rgba(26,38,54,.04); }
        .kanban-card:active { cursor: grabbing; }
        .kanban-card h4 { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
        .kanban-card p { font-size: 11px; color: var(--gray-500); margin: 0 0 6px; word-break: break-word; }
        .kanban-card .kb-meta { display: flex; justify-content: space-between; gap: 6px; font-size: 10px; color: var(--gray-500); }
        .kanban-ghost { opacity: .45; }
        .kanban-drag { box-shadow: 0 10px 24px rgba(26,38,54,.14); transform: rotate(1deg); }
        .kanban-empty { text-align: center; color: var(--gray-400); font-size: 11px; padding: 28px 8px; }
        @media (max-width: 768px) {
            .view-toggle-btn { min-height: 44px; padding: 0 16px; }
            .kanban-col { flex-basis: min(84vw, 300px); max-height: min(62dvh, 560px); }
        }
        
        /* Table */
        .table-container { background: var(--light); border-radius: var(--radius-lg); overflow-x: auto; border: 1px solid var(--line); box-shadow: var(--shadow-sm); -webkit-overflow-scrolling: touch; }
        .table-header { background: var(--gray-50); padding: 8px 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
        .table-header h2 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
        .results-count { font-size: 11px; color: var(--gray-500); background: var(--gray-100); padding: 3px 12px; border-radius: 20px; }
        .page-size { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gray-500); font-weight: 600; }
        .page-size select { border: 1px solid var(--gray-300); background: #fff; color: var(--gray-700); border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
        table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 1250px; }
        th, td { padding: 7px 8px; text-align: left; border-bottom: 1px solid var(--gray-200); }
        th { background-color: var(--gray-50); font-weight: 600; font-size: 12px; color: var(--gray-600); text-transform: uppercase; letter-spacing: 0.5px; cursor: pointer; user-select: none; }
        th:hover { background-color: var(--gray-100); }
        th.sort-asc::after { content: ' ↑'; color: var(--accent); font-size: 11px; }
        th.sort-desc::after { content: ' ↓'; color: var(--accent); font-size: 11px; }
        tr:hover { background-color: var(--gray-50); }
        
        .lead-link { color: var(--accent); text-decoration: none; font-weight: 600; cursor: pointer; font-size: 13px; }
        .lead-link:hover { text-decoration: underline; }
        
        .delete-btn { background: none; border: none; color: var(--danger); cursor: pointer; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12px; transition: all 0.2s; }
        .delete-btn:hover { background: var(--danger); color: white; transform: scale(1.05); }
        .restore-btn { background: none; border: none; color: #0d9b8a; cursor: pointer; padding: 5px 8px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; }
        .restore-btn:hover { background: #0d9b8a; color: white; }
        
        .status { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
        .status-new { background: #dbeafe; color: #1e40af; }
        .status-contacted { background: rgba(238,86,75,0.1); color: var(--accent-dark); }
        .status-interested { background: #fef3c7; color: #b45309; }
        .status-proposal, .status-demo { background: #e0e7ff; color: #4338ca; }
        .status-converted { background: #d1fae5; color: #065f46; }
        .status-lost { background: #fee2e2; color: #991b1b; }
        .status-did_not_pick { background: #e2e8f0; color: #334155; }
        
        .assigned-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 10px; font-weight: 500; background: rgba(238,86,75,0.1); color: var(--accent-dark); border: 1px solid var(--accent); }
        .assigned-badge.self { background: #d1fae5; color: #065f46; border-color: #10b981; }
        
        .assign-btn-small, .edit-assign-btn { background: var(--accent); color: white; border: none; padding: 3px 8px; border-radius: 4px; font-size: 10px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; transition: all 0.2s; }
        .assign-btn-small:hover, .edit-assign-btn:hover { background: var(--accent-dark); transform: translateY(-1px); }
        .compact-upload-btn { background: var(--info); color: white; border: none; padding: 3px 8px; border-radius: 4px; font-size: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
        .compact-email-btn { background: var(--primary); color: white; border: none; padding: 3px 8px; border-radius: 4px; font-size: 10px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
        .compact-email-btn:hover { background: var(--primary-dark); }
        #composeEmailModal { z-index: 2500; }
        .compose-modal { max-width: 640px; }
        .compose-row { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); padding: 6px 0; }
        .compose-row label { font-size: 11px; font-weight: 700; color: var(--gray-500); }
        .compose-row input { border: 0; outline: none; font-size: 13px; padding: 4px 0; width: 100%; background: transparent; }
        .compose-editor-wrap { border: 1px solid var(--line); border-radius: 8px; margin-top: 10px; overflow: hidden; }
        .compose-toolbar { display: flex; gap: 2px; padding: 6px 8px; background: var(--gray-50); border-bottom: 1px solid var(--line); }
        .compose-toolbar button { border: 0; background: transparent; width: 28px; height: 28px; border-radius: 6px; cursor: pointer; color: var(--primary); }
        .compose-toolbar button:hover { background: #fff; }
        .compose-body { min-height: 180px; padding: 10px 12px; font-size: 13px; line-height: 1.5; outline: none; }
        .compose-body:empty:before { content: attr(data-placeholder); color: var(--gray-400); }
        .compose-attach { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
        .compose-attach-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--primary); cursor: pointer; }
        .compose-attach-btn input { display: none; }
        .compose-file-list { display: flex; flex-wrap: wrap; gap: 6px; }
        .compose-file { font-size: 11px; background: var(--gray-50); border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; display: inline-flex; align-items: center; gap: 6px; }
        .compose-file button { border: 0; background: none; cursor: pointer; color: var(--danger); font-size: 11px; }
        .compose-hint { font-size: 10px; color: var(--gray-500); margin-top: 6px; }
        .compose-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
        .voice-btn.recording { background: var(--danger) !important; }
        .voice-btn .fa-stop { font-size: 12px; }
        .status-super_admin { background: #1a2636; color: #fff; }
        .status-admin { background: #233246; color: #fff; }
        .status-manager { background: #e0e7ff; color: #3730a3; }
        .status-sales_head { background: #fef3c7; color: #92400e; }
        .status-sales_executive { background: #dbeafe; color: #1e40af; }
        .users-modal { max-width: 980px; width: min(980px, 96vw); }
        .users-modal .modal-header { padding: 12px 16px; }
        .users-modal .modal-header h3 { font-size: 15px; }
        .users-modal .modal-body { padding: 12px 16px 16px; }
        .users-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
        .users-title { margin: 0; padding: 0 0 3px; border: 0; border-bottom: 2px solid var(--accent); flex: 0 0 auto; font-size: 13px; }
        .users-toolbar .filter-input { flex: 0 0 140px; height: 32px; font-size: 11px; padding: 4px 8px; min-width: 0; }
        .users-toolbar select.filter-input { flex: 0 0 88px; }
        .users-toolbar #addUserBtn { margin-left: auto; min-height: 32px; padding: 6px 12px; font-size: 12px; }
        .users-table-wrap { overflow: auto; max-height: min(56vh, 480px); }
        .users-table { width: 100%; border-collapse: collapse; table-layout: auto; font-size: 12px; }
        .users-table th {
            text-align: left; font-size: 10px; font-weight: 700; text-transform: uppercase;
            letter-spacing: .04em; color: var(--primary); padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line);
            white-space: nowrap; background: #fff; position: sticky; top: 0; z-index: 1;
        }
        .users-table td { padding: 10px 10px 10px 0; border-bottom: 1px solid #eee; vertical-align: middle; white-space: nowrap; color: var(--dark); }
        .users-table th:last-child, .users-table td:last-child { padding-right: 0; }
        .users-table td.id, .users-table td.name, .users-table td.email, .users-table td.role, .users-table td.st, .users-table td.act { width: 1%; }
        .users-table td.name { font-weight: 700; color: #111; }
        .users-table td.email { padding-right: 6px; }
        .users-table th:nth-child(4), .users-table td.role { padding-left: 2px; }
        .users-table td.act:last-child { width: 100%; }
        .users-table tbody tr:hover { background: #fafafa; }
        .users-empty { text-align: center; color: var(--gray-500); padding: 22px 8px !important; font-size: 12px; }
        .user-link {
            background: none; border: 0; padding: 0; font: inherit; font-size: 11px; font-weight: 650;
            cursor: pointer; color: var(--accent);
        }
        .user-link:hover:not(:disabled) { text-decoration: underline; }
        .user-link.del { color: var(--danger); }
        .user-link.login { color: var(--info); }
        .user-link:disabled { opacity: .35; cursor: not-allowed; text-decoration: none; }
        .user-form-card { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
        .user-form-card .card-title { margin-bottom: 8px; padding-bottom: 6px; font-size: 12px; }
        .user-form-card .form-grid-2 { gap: 8px 10px; }
        .user-form-card .form-group { margin-bottom: 0; }
        .user-form-card input, .user-form-card select { width: 100%; height: 32px; padding: 4px 8px; font-size: 12px; border: 1px solid var(--gray-300); border-radius: 6px; }
        .user-form-card small { display: block; color: var(--gray-500); font-size: 9px; margin-top: 3px; }
        .user-form-card .confirm-actions { margin-top: 10px !important; gap: 6px; }
        .user-form-card .btn { min-height: 32px; padding: 6px 10px; font-size: 11px; }
        .pill-on { background: #d1fae5; color: #065f46; }
        .pill-off { background: #fee2e2; color: #991b1b; }
        @media (max-width: 700px) {
            .users-toolbar { flex-wrap: wrap; }
            .users-title { flex: 1 1 100%; }
            .users-toolbar #addUserBtn { margin-left: 0; }
        }
        
        .platform-badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 10px; background: var(--gray-100); color: var(--gray-600); }
        
        /* Pagination */
        .pagination { display: flex; justify-content: center; align-items: center; padding: 16px; gap: 8px; }
        .pagination-btn { background: white; border: 1px solid var(--gray-300); padding: 5px 10px; border-radius: var(--radius-md); font-size: 11px; cursor: pointer; min-width: 34px; transition: all 0.2s; }
        .pagination-btn:hover:not(:disabled) { background: var(--accent); color: white; border-color: var(--accent); }
        .pagination-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
        .pagination-btn:disabled { opacity: 0.4; cursor: not-allowed; }
        .pagination-info { font-size: 11px; margin: 0 8px; }
        
        /* Modal */
        .modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all 0.2s; }
        .modal-overlay.active { opacity: 1; visibility: visible; }
        #alertModal { z-index: 3000; }
        .modal { background: white; border-radius: var(--radius-xl); width: 95%; max-width: 950px; max-height: 85vh; overflow-y: auto; box-shadow: 0 10px 25px rgba(0,0,0,0.1); animation: modalSlideIn 0.2s ease; }
        @keyframes modalSlideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        .modal-header { padding: 16px 24px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, rgba(238,86,75,0.03), white); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
        .modal-header h3 { font-size: 16px; font-weight: 600; color: var(--primary); }
        .close-btn { background: var(--gray-100); border: none; width: 32px; height: 32px; border-radius: var(--radius-md); font-size: 18px; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; justify-content: center; }
        .close-btn:hover { background: var(--accent); color: white; transform: rotate(90deg); }
        .modal-body { padding: 24px; }
        
        /* Confirmation Modal */
        .confirm-modal { max-width: 400px; text-align: center; }
        .confirm-modal .modal-body { text-align: center; }
        .confirm-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

        .inbox-bell { position: relative; min-width: 40px; padding: 8px 10px; }
        .inbox-badge {
            position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
            background: var(--accent); color: #fff; border-radius: 999px;
            font-size: 9px; font-weight: 800; display: none; align-items: center; justify-content: center;
            padding: 0 4px; line-height: 1;
        }
        .inbox-badge.on { display: flex; }
        .inbox-modal { max-width: min(920px, 96vw); }
        .inbox-intro { font-size: 12px; color: var(--gray-500); margin-bottom: 12px; text-align: left; }
        .inbox-count { font-size: 11px; font-weight: 700; color: var(--accent); }
        .inbox-table-wrap { max-height: 52vh; overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 10px; }
        .inbox-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 640px; }
        .inbox-table th, .inbox-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--gray-200); white-space: nowrap; }
        .inbox-table th { background: var(--gray-50); font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--gray-600); position: sticky; top: 0; }
        .inbox-table tbody tr { cursor: pointer; }
        .inbox-table tbody tr:hover { background: rgba(240,90,80,.06); }
        .inbox-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; text-align: left; }
        .inbox-item {
            width: 100%; border: 1px solid var(--line); background: var(--gray-50); border-radius: 10px;
            padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
        }
        .inbox-item:hover { border-color: var(--accent); background: #fff; }
        .inbox-item h4 { font-size: 13px; font-weight: 700; color: var(--primary); margin-bottom: 3px; }
        .inbox-item p { font-size: 11px; color: var(--gray-500); }
        .inbox-item .tag { font-size: 10px; font-weight: 700; color: var(--accent); background: rgba(240,90,80,.1); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
        .inbox-actions { flex-wrap: wrap; }
        .inbox-empty { text-align: center; padding: 24px 8px; color: var(--gray-500); font-size: 12px; }
        
        /* Profile Grid */
        .profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 24px; }
        .info-card { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); padding: 20px; background: white; }
        .card-title { font-size: 13px; font-weight: 600; margin-bottom: 16px; color: var(--primary); display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--gray-200); }
        .card-title i { color: var(--accent); font-size: 14px; }
        .info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
        .info-item { margin-bottom: 8px; }
        .info-label { font-size: 9px; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; font-weight: 600; }
        .info-value { font-size: 12px; font-weight: 500; color: var(--dark); word-break: break-word; }
        
        /* Forms */
        .form-group { margin-bottom: 16px; }
        .form-group label { display: block; margin-bottom: 5px; font-weight: 500; color: var(--gray-700); font-size: 12px; }
        .form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-md); font-size: 12px; transition: all 0.2s; background: white; }
        .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(238,86,75,0.1); }
        .lead-sync-options { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
        .lead-sync-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0; padding: 10px 12px; border: 1px solid var(--gray-200, #e5e7eb); border-radius: 10px; background: #f8fafc; cursor: pointer; }
        .lead-sync-option span { font-size: 13px; font-weight: 600; color: var(--gray-800, #1f2937); line-height: 1.35; }
        .lead-sync-option input[type="checkbox"] { width: 18px; height: 18px; min-width: 18px; margin: 0; padding: 0; flex: 0 0 18px; accent-color: var(--accent, #ee564b); cursor: pointer; }
        
        /* Timeline */
        .profile-split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; align-items: start; }
        .profile-split-col { min-width: 0; }
        .profile-split .timeline-section { margin-top: 16px; }
        .profile-split .timeline-section:first-child { margin-top: 0; }
        .profile-split .documents-grid { grid-template-columns: 1fr; }
        .email-history-wrap { overflow-x: auto; overflow-y: scroll; max-height: 320px; border: 1px solid var(--line); border-radius: 8px; }
        .email-history-table { width: 100%; border-collapse: collapse; font-size: 11px; }
        .email-history-table th { text-align: left; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-500); padding: 8px 8px; background: var(--gray-50); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
        .email-history-table td { padding: 0; border-bottom: 1px solid #f0ebe6; vertical-align: top; }
        .email-history-table td:last-child { padding: 8px; white-space: nowrap; }
        .email-history-link { display: block; padding: 8px; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
        .email-history-link:hover { color: var(--accent); }
        .email-history-link .meta { font-weight: 500; text-decoration: none; }
        .email-history-table tr:last-child td { border-bottom: 0; }
        .email-history-table .subj { font-weight: 650; color: var(--primary); }
        .email-history-table .meta { color: var(--gray-500); font-size: 10px; }
        .email-history-empty, .email-history-table td.email-history-empty { text-align: center; color: var(--gray-500); padding: 28px 10px; }
        .email-history-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
        .lead-reply-box { margin-top: 10px; }
        #emailHistoryModal { z-index: 1200; }
        #emailHistoryRead { max-height: min(70vh, 640px); overflow: auto; }
        .mail-thread { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
        .mail-thread.on { border-color: #f0a39e; background: #fff6f5; }
        .mail-thread h3 { margin: 8px 0 4px; font-size: 15px; }
        .inbox-mail { margin-bottom: 12px; }
        .inbox-mail-h { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-500); margin-bottom: 6px; }
        .inbox-mail-row { width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; }
        .inbox-mail-row strong { font-size: 12.5px; color: var(--primary); white-space: nowrap; }
        .inbox-mail-row span:last-child { color: var(--gray-500); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .timeline { position: relative; padding-left: 28px; margin-top: 14px; }
        #timeline.timeline { max-height: 360px; overflow-y: auto; padding-left: 4px; }
        #timeline.timeline::before { display: none; }
        .timeline-scroll { position: relative; padding-left: 28px; }
        .timeline::before, .timeline-scroll::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: linear-gradient(to bottom, var(--accent), var(--primary)); }
        .timeline-item { position: relative; margin-bottom: 18px; }
        .timeline-item::before { content: ''; position: absolute; left: -21px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid white; box-shadow: 0 0 0 1px var(--accent); }
        .timeline-date { font-size: 10px; color: var(--gray-500); margin-bottom: 4px; }
        .timeline-content { background: var(--gray-50); border-radius: var(--radius-md); padding: 12px 14px; border-left: 2px solid var(--accent); font-size: 11px; }
        
        /* Documents */
        .documents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 14px; }
        .document-card { background: var(--gray-50); border-radius: var(--radius-md); padding: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--gray-200); transition: all 0.2s; cursor: pointer; }
        .document-card:hover { transform: translateY(-2px); border-color: var(--accent); background: white; box-shadow: var(--shadow-sm); }
        .document-icon { font-size: 28px; color: var(--accent); min-width: 40px; text-align: center; }
        .document-info { flex: 1; }
        .document-name { font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--dark); word-break: break-all; }
        .document-meta { font-size: 10px; color: var(--gray-500); }
        .document-actions { display: flex; gap: 8px; }
        .document-btn { background: none; border: none; cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); color: var(--gray-500); transition: all 0.2s; font-size: 14px; }
        .document-btn:hover { background: var(--accent); color: white; }
        .document-btn.download:hover { background: var(--success); }
        
        /* Assignment History */
        .assignment-item { background: var(--gray-50); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 12px; border-left: 2px solid var(--accent); }
        .assignment-header { display: flex; justify-content: space-between; margin-bottom: 6px; flex-wrap: wrap; gap: 6px; }
        .assignment-from, .assignment-to { font-weight: 600; font-size: 11px; }
        .assignment-date { font-size: 9px; color: var(--gray-500); }
        .assignment-notes { font-size: 10px; color: var(--gray-600); margin-top: 6px; font-style: italic; }
        
        /* Action Row */
        .action-row { display: flex; gap: 12px; margin-top: 18px; padding: 12px; background: var(--gray-50); border-radius: var(--radius-md); flex-wrap: wrap; }
        .action-item { display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: white; border-radius: var(--radius-md); border: 1px solid var(--gray-200); font-size: 11px; }
        .action-label { font-size: 9px; font-weight: 600; text-transform: uppercase; color: var(--gray-500); }
        
        /* Voice Recorder */
        .voice-recorder { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
        .voice-btn { background: var(--accent); color: white; border: none; border-radius: 50%; width: 34px; height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 14px; transition: all 0.2s; }
        .voice-btn:hover { transform: scale(1.05); }
        .voice-btn.recording { background: var(--success); animation: pulse 1.5s infinite; }
        @keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
        
        /* Login Modal */
        .login-modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(160deg, #1a2636 0%, #233246 55%, #F05A50 160%); display: none; align-items: center; justify-content: center; z-index: 10000; padding: 16px; }
        .login-modal-overlay.visible { display: flex; }
        .login-modal { background: white; border-radius: var(--radius-xl); padding: 32px; width: 90%; max-width: 360px; text-align: center; }
        .login-logo-image { width: 88px; height: 88px; margin: 0 auto 16px; background: transparent; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 0; overflow: hidden; }
        .login-logo-image img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 22px; }
        .login-modal h2 { font-size: 20px; color: var(--primary); margin-bottom: 6px; }
        .login-modal p { font-size: 11px; color: var(--gray-500); margin-bottom: 24px; }
        .login-btn { width: 100%; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: white; border: none; padding: 10px; border-radius: var(--radius-md); cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.2s; }
        .login-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
        .login-btn:disabled { opacity: .65; cursor: wait; transform: none; }
        .login-link { display: block; width: fit-content; margin: 12px auto 0; text-align: center; font-size: 12px; font-weight: 600; color: var(--accent); text-decoration: none; }
        .login-link:hover { text-decoration: underline; }
        .login-modal .fp-sub { margin: 0 0 14px; font-size: 12px; }
        .fp-msg { margin-top: 12px; padding: 8px 10px; border-radius: var(--radius-md); font-size: 12px; font-weight: 600; text-align: left; }
        .fp-msg.err { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
        .fp-msg.ok { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
        
        /* Notification */
        .notification { position: fixed; bottom: 20px; right: 20px; background: white; padding: 10px 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 10000; font-size: 12px; font-weight: 500; border-left: 3px solid var(--accent); animation: slideUp 0.2s ease; display: flex; align-items: center; gap: 8px; }
        @keyframes slideUp { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
        .notification.success { border-left-color: var(--success); }
        .notification.error { border-left-color: var(--danger); }
        .notification.warning { border-left-color: var(--warning); }
        
        .loading { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(238,86,75,0.2); border-radius: 50%; border-top-color: var(--accent); animation: spin 0.6s linear infinite; }
        @keyframes spin { to { transform: rotate(360deg); } }
        
        .empty-state { text-align: center; padding: 40px; color: var(--gray-500); }
        .date-recent { color: var(--success); font-weight: 500; }
        .date-week { color: var(--warning); font-weight: 500; }
        .date-old { color: var(--danger); font-weight: 500; }
        
        .mobile-menu-btn { display: none; background: none; border: none; font-size: 18px; cursor: pointer; padding: 6px; color: var(--dark); min-width: 40px; min-height: 40px; }
        
        @media (max-width: 1000px) { .stats-grid { flex-wrap: nowrap; } }
        @media (max-width: 768px) {
            .form-grid-2 { grid-template-columns: 1fr; }
            .main-content { margin-left: 0; padding: 12px; max-width: 100%; }
            .stats-grid { flex-wrap: nowrap; gap: 6px; }
            .stat-card { flex: 0 0 120px; min-width: 120px; }
            .filters-row { grid-template-columns: 1fr 1fr; gap: 8px; }
            .profile-grid { grid-template-columns: 1fr; gap: 12px; }
            .profile-split { grid-template-columns: 1fr; }
            .header { align-items: flex-start; }
            .header-actions { width: 100%; }
            .header-actions .btn { min-height: 40px; }
            .header { flex-wrap: wrap; }
            .header-logo-right { height: 32px !important; width: 32px !important; max-height: 32px !important; max-width: 32px !important; margin-left: auto; border-radius: 9px; }
            .platform-cards { gap: 6px; }
            .platform-card { min-height: 40px; }
            .info-grid { grid-template-columns: 1fr; }
            .modal { width: 96%; max-height: 88dvh; }
            .mobile-menu-btn { display: block; }
            .login-modal { width: 92%; padding: 24px 18px; }
            .notification { right: 10px; left: 10px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
        }
        @media (max-width: 480px) {
            .filters-row { grid-template-columns: 1fr; }
            .stats-grid { flex-wrap: nowrap; }
            .welcome-section h1 { font-size: 16px; }
        }
        @media (min-width: 769px) { .mobile-menu-btn { display: none; } }
        
        .collapsed { max-height: 0 !important; overflow: hidden !important; padding: 0 !important; margin: 0 !important; }

        html { scroll-behavior: smooth; }
        .btn, .stat-card, .platform-card, .action-btn, .filter-input, .kanban-card, .pagination-btn, .login-btn {
            transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, color .18s ease;
        }
        .btn:active, .action-btn:active, .login-btn:active { transform: translateY(0) scale(.98); }
        .stat-card:active { transform: translateY(0); }
        .login-form { text-align: left; }
        .login-form .form-group { margin-bottom: 12px; }
        .login-form .form-group label { font-size: 11px; font-weight: 650; color: var(--gray-600); }
        .login-form .form-group input { min-height: 42px; border-radius: 10px; }
        .login-form .input-icon { position: relative; display: flex; align-items: center; }
        .login-form .input-icon > i { position: absolute; left: 12px; color: var(--gray-400); font-size: 13px; pointer-events: none; z-index: 1; }
        .login-form .input-icon input { width: 100%; padding-left: 36px; padding-right: 40px; }
        .login-form .input-icon input:not([type="password"]):not(.has-eye) { padding-right: 12px; }
        .login-form .pw-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--gray-500); cursor: pointer; width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
        .login-form .pw-eye:hover { color: var(--accent); background: #fff1f0; }
        .login-modal { box-shadow: 0 18px 48px rgba(26,38,54,.22); }
        .login-btn { min-height: 42px; border-radius: 10px; }
        .kanban-card { transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
        .kanban-card:hover { border-color: #cfc8c0; box-shadow: var(--shadow-md); }
        .modal-overlay { transition: opacity .22s ease, visibility .22s ease; }
        table tbody tr { transition: background .15s ease; }
        .status { letter-spacing: .02em; }
        @media (prefers-reduced-motion: reduce) {
            html { scroll-behavior: auto; }
            .btn, .stat-card, .platform-card, .action-btn, .filter-input, .kanban-card, .pagination-btn, .login-btn, .modal-overlay {
                transition: none;
            }
        }

        body.mail-focus .stats-grid,
        body.mail-focus .quick-filters,
        body.mail-focus .filters-row,
        body.mail-focus .action-buttons,
        body.mail-focus #leadsTableWrap,
        body.mail-focus #kanbanBoard,
        body.mail-focus .page-bar { display: none !important; }
        body.mail-focus .mail-desk { display: flex !important; min-height: calc(100vh - 120px); }
        .mail-desk { display: none; gap: 12px; align-items: stretch; margin-bottom: 16px; }
        #leadsWorkspace[data-view="email"] .mail-desk { display: flex; }
        #leadsWorkspace[data-view="email"] #leadsTableWrap,
        #leadsWorkspace[data-view="email"] #kanbanBoard { display: none !important; }
        .mail-side { width: 240px; flex: 0 0 240px; background: #f4f6f8; border: 1px solid var(--line); border-radius: 14px; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; }
        .mail-brand { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; color: var(--primary); display: flex; align-items: center; gap: 8px; }
        .mail-side-sub { margin: 0 0 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--gray-500); }
        .mail-side .mail-kicker { margin: 12px 4px 4px; }
        .mail-range { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px 10px 10px; margin: 6px 0 2px; }
        .mail-range .mail-btn { width: 100%; margin-top: 8px; }
        .mail-dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
        .mail-dash-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.03em; color: var(--primary); }
        .mail-dash-head .mail-kicker { margin: 0 0 2px; }
        .mail-main-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
        .mail-main-head h2 { margin: 0; font-size: 22px; letter-spacing: -0.03em; color: var(--primary); }
        .mail-main-head .mail-kicker { margin: 0 0 2px; }
        .mail-head-dates { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
        .mail-head-dates .mail-label { margin: 0; }
        .mail-head-dates .mail-input { width: 148px; min-height: 36px; }
        .mail-probe-pop { position: fixed; inset: 0; z-index: 12000; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(26, 38, 54, .45); }
        .mail-probe-pop[hidden] { display: none; }
        .mail-probe-card { width: min(420px, 100%); background: #fff; border-radius: 16px; padding: 22px; box-shadow: 0 18px 48px rgba(26, 38, 54, .22); }
        .mail-probe-card h3 { margin: 4px 0 8px; font-size: 18px; color: var(--primary); }
        .mail-probe-card p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: #374151; }
        .mail-probe-card .ok { color: #0d9b8a; }
        .mail-probe-card .bad { color: #d94a41; }
        .mail-probe-to { font-weight: 700; color: var(--primary); }
        .mail-range-pill { margin: 0; border: 1px solid var(--line); background: #f4f6f8; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--gray-600); white-space: nowrap; }
        .mail-card.tone-sent { border-top: 3px solid #0d9b8a; }
        .mail-card.tone-in { border-top: 3px solid #c4a35a; }
        .mail-card.tone-wait { border-top: 3px solid #3d7ea6; }
        .mail-card.tone-bad { border-top: 3px solid #d94a41; }
        .mail-card.tone-all { border-top: 3px solid #1a2636; }
        .mail-nav { border: 1px solid transparent; background: transparent; border-radius: 9px; min-height: 36px; padding: 0 10px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--gray-600); cursor: pointer; text-align: left; }
        .mail-nav em { margin-left: auto; font-style: normal; font-size: 11px; color: var(--gray-400); }
        .mail-nav.on { background: #fff6f5; border-color: #f0a39e; color: #d94a41; }
        .mail-nav.on em { color: #d94a41; }
        .mail-mode { margin: 12px 0 0; font-size: 11px; line-height: 1.45; color: var(--gray-500); }
        .mail-sync { margin-top: 10px; width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 9px; min-height: 34px; padding: 0 10px; display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; color: var(--gray-700); cursor: pointer; }
        .mail-sync:disabled { opacity: .6; cursor: wait; }
        .mail-thread-list { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 14px; }
        .mail-thread-list h4 { margin: 2px 0 6px; font-size: 14px; }
        .mail-main { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
        .mail-pane { animation: mailIn .18s ease; }
        @keyframes mailIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
        .mail-cards { display: flex; flex-wrap: nowrap; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
        .mail-cards .stat-card { flex: 1 1 0; font: inherit; text-align: left; color: inherit; }
        .mail-lead { font-size: 13px; color: var(--gray-600); margin: 0 0 12px; line-height: 1.5; }
        .mail-templates { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; }
        .mail-chip { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px; cursor: pointer; text-align: left; min-width: 140px; }
        .mail-chip b { display: block; font-size: 12px; color: var(--primary); }
        .mail-chip small { display: block; font-size: 10.5px; color: var(--gray-500); margin-top: 2px; }
        .mail-chip.on { background: #fff6f5; border-color: #f0a39e; }
        .mail-label { display: block; font-size: 11px; font-weight: 700; color: var(--gray-500); margin: 8px 0 4px; }
        .mail-input { width: 100%; border: 1px solid var(--line); border-radius: 9px; min-height: 36px; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--primary); background: #fff; }
        .mail-body { min-height: 180px; resize: vertical; line-height: 1.5; }
        .mail-hint { margin: 6px 0; font-size: 11px; color: var(--gray-500); }
        .mail-preview { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; background: #fafafa; white-space: pre-wrap; font-size: 13px; line-height: 1.55; color: var(--primary); min-height: 72px; }
        .mail-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
        .mail-btn { border: 1px solid var(--line); background: #fff; color: var(--primary); border-radius: 9px; min-height: 36px; padding: 0 12px; font-size: 12.5px; font-weight: 650; cursor: pointer; }
        .mail-btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
        .mail-btn:disabled { opacity: .55; cursor: default; }
        .mail-status { min-height: 18px; font-size: 12px; color: var(--gray-600); margin: 0; }
        .mail-people { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 10px; }
        .mail-people-h { display: flex; gap: 10px; align-items: center; }
        .mail-people-h .mail-input { max-width: 240px; }
        .mail-check { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--primary); }
        .mail-recipients { max-height: 280px; overflow: auto; margin-top: 6px; }
        .mail-person { display: flex; gap: 8px; align-items: flex-start; padding: 7px 4px; border-bottom: 1px solid #f3f1ef; font-size: 12.5px; }
        .mail-person b { display: block; color: var(--primary); }
        .mail-person span { color: var(--gray-500); }
        .mail-split { display: flex; gap: 12px; min-height: 460px; }
        .mail-list { width: 320px; flex: 0 0 320px; overflow: auto; max-height: 70vh; border-right: 1px solid var(--line); }
        .mail-row { width: 100%; border: 0; border-bottom: 1px solid #f3f1ef; background: transparent; text-align: left; padding: 10px 10px; cursor: pointer; }
        .mail-row.on { background: #fff6f5; }
        .mail-row b { display: block; font-size: 12.5px; color: var(--primary); }
        .mail-row span, .mail-row small { display: block; font-size: 11px; color: var(--gray-500); }
        .mail-read { flex: 1; min-width: 0; overflow: auto; max-height: 70vh; padding: 4px 4px 8px 8px; }
        .mail-read h3 { margin: 0 0 4px; font-size: 16px; color: var(--primary); }
        .mail-read .mail-letter { white-space: pre-wrap; font-size: 14px; line-height: 1.6; color: var(--primary); margin: 12px 0; }
        .mail-empty { color: var(--gray-500); font-size: 13px; padding: 12px; }
        .mail-pill { display: inline-block; border-radius: 99px; padding: 2px 8px; font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: #f4f4f5; color: var(--gray-600); }
        .mail-pill.sent { background: #e8f6f3; color: #0d9b8a; }
        .mail-pill.bounced, .mail-pill.failed { background: #fff1f0; color: #d94a41; }
        .mail-pill.scheduled { background: #eef5fa; color: #3d7ea6; }
        .mail-pill.received { background: #f6f3ea; color: #8a6a2f; }
        .mail-reply { width: 100%; min-height: 88px; margin-top: 8px; }
        .mail-row { display: flex; gap: 10px; align-items: flex-start; border-radius: 10px; margin: 0 6px 2px; width: calc(100% - 12px); }
        .mail-row.on { box-shadow: inset 3px 0 0 #d94a41; }
        .mail-avatar { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px; background: #f4f6f8; color: #1a2636; border: 1px solid #e6e8eb; font-size: 13px; display: grid; place-items: center; margin-top: 2px; }
        .mail-row .mail-avatar { color: #1a2636; font-size: 13px; }
        .mail-row .mail-avatar i { font-size: 13px; line-height: 1; }
        .mail-row.on .mail-avatar { background: #fff1f0; border-color: #f0c2be; color: #d94a41; }
        .mail-row-copy { min-width: 0; flex: 1; }
        .mail-row .mail-row-top { display: flex; align-items: baseline; gap: 8px; }
        .mail-row .mail-row-top b { flex: 1; min-width: 0; }
        .mail-row .mail-row-top time { flex: 0 0 auto; font-size: 10px; color: var(--gray-500); white-space: nowrap; }
        .mail-row .mail-row-subject { color: var(--gray-600); }
        .mail-row-copy b, .mail-row-copy span, .mail-row-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .mail-read-icon { font-size: 14px; color: #d94a41; margin-right: 6px; }
        .mail-row-copy small .mail-pill { display: inline-block; margin-right: 6px; vertical-align: middle; font-size: 10px; }
        .mail-row .mail-pill.received { background: #f6f3ea; color: #8a6a2f; }
        .mail-row .mail-pill.sent { background: #e8f6f3; color: #0d9b8a; }
        .mail-read-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
        .mail-read-head h3 { margin-top: 6px; }
        .mail-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
        .mail-btn.danger { color: #d94a41; border-color: #f0c2be; background: #fff8f7; }
        .mail-btn.danger:hover { background: #fff1f0; }
        .mail-compose-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; background: #fafafa; margin-top: 8px; }
        .mail-kicker { margin: 12px 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-500); }
        .mail-thread.in { border-left: 3px solid #c4a35a; background: #fffdf8; }
        .mail-thread.out { background: #fff; }
        .mail-thread .mail-letter { margin: 6px 0 0; }
        .mail-empty-state { min-height: 220px; display: grid; place-items: center; }
        .mail-cards .stat-card:hover { transform: translateY(-1px); }
        .mail-nav:hover { background: #fafafa; }
        @media (max-width: 900px) {
            .mail-desk { flex-direction: column; }
            .mail-side { width: auto; flex: none; flex-direction: row; flex-wrap: wrap; }
            .mail-brand, .mail-mode, .mail-range, .mail-side-sub { width: 100%; }
            .mail-main-head { align-items: flex-start; }
            .mail-head-dates { width: 100%; }
            .mail-cards { flex-wrap: nowrap; }
            .mail-split { flex-direction: column; }
            .mail-list { width: auto; flex: none; max-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
        }
        @media (prefers-reduced-motion: reduce) {
            .mail-pane { animation: none; }
        }
