: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: #9aa3b0;
            --gray-500: #5b6778;
            --gray-600: #3d4856;
            --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: 'Inter', 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); }
        
        ::-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: wrap; gap: 8px; }
        .header-left { display: flex; align-items: center; gap: 8px; }
        .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; gap: 6px; }
        .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: 8px 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); transition: all 0.2s; cursor: pointer; position: relative; overflow: hidden; min-height: 68px; flex: 1 1 0; min-width: 88px; }
        .stat-card::after { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; 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:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--line); }
        .stat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
        .stat-title { font-size: 9px; color: var(--gray-500); font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
        .stat-icon { font-size: 12px; color: var(--accent); }
        .stat-value { font-size: 20px; font-weight: 800; color: var(--primary); line-height: 1; letter-spacing: -.03em; }
        
        .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; }
        table { width: 100%; border-collapse: collapse; font-size: 12px; 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: 11px; 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: 10px; }
        th.sort-desc::after { content: ' ↓'; color: var(--accent); font-size: 10px; }
        tr:hover { background-color: var(--gray-50); }
        
        .lead-link { color: var(--accent); text-decoration: none; font-weight: 600; cursor: pointer; font-size: 12px; }
        .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: 10px; 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); }
        
        /* 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: auto; max-height: 520px; 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; }
        .email-history-table td { padding: 8px; border-bottom: 1px solid #f0ebe6; vertical-align: top; }
        .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 { text-align: center; color: var(--gray-500); padding: 28px 10px; }
        .timeline { position: relative; padding-left: 28px; margin-top: 14px; }
        .timeline::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: 72px; height: 72px; margin: 0 auto 16px; background: var(--primary); border-radius: 14px; display: flex; align-items: center; justify-content: center; padding: 10px; }
        .login-logo-image img { width: 100%; height: 100%; object-fit: contain; }
        .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); }
        
        /* 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; }
            .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-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;
            }
        }
