* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 5px;
        }

        .container {
            background: white;
            border-radius: 20px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
            overflow: hidden;
            max-width: 1200px;
            width: 100%;
        }

        /* Login Screen */
        #loginScreen {
            padding: 60px;
            text-align: center;
        }

        .logo {
            font-size: 48px;
            margin-bottom: 20px;
        }

        h1 {
            color: #333;
            margin-bottom: 10px;
            font-size: 32px;
        }

        .subtitle {
            color: #666;
            margin-bottom: 40px;
            font-size: 16px;
        }

        .form-group {
            margin-bottom: 25px;
            text-align: left;
        }

        label {
            display: block;
            margin-bottom: 8px;
            color: #555;
            font-weight: 500;
        }

        input {
            width: 100%;
            padding: 15px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 16px;
            transition: all 0.3s;
        }

        input:focus {
            outline: none;
            border-color: #667eea;
        }

        .btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.2s;
        }

        .btn:hover {
            transform: translateY(-2px);
        }

        .btn:active {
            transform: translateY(0);
        }

        .error-message {
            background: #ff4444;
            color: white;
            padding: 15px 20px;
            border-radius: 10px;
            margin-bottom: 20px;
            display: none;
            font-weight: 600;
            text-align: center;
            box-shadow: 0 4px 12px rgba(255, 68, 68, 0.3);
            animation: shake 0.5s;
        }
        
        @keyframes shake {
            0%, 100% { transform: translateX(0); }
            25% { transform: translateX(-10px); }
            75% { transform: translateX(10px); }
        }

        /* Dashboard */
        #dashboard {
            display: none;
        }

        .dashboard-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .user-avatar {
            width: 40px;
            height: 40px;
            background: white;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 20px;
        }

        .logout-btn, .refresh-btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid white;
            padding: 8px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s;
            font-size: 14px;
        }

        .logout-btn:hover, .refresh-btn:hover {
            background: white;
            color: #667eea;
        }

        .refresh-btn.paused {
            background: rgba(255, 100, 100, 0.3);
            border-color: #ff6b6b;
        }

        .last-update-time {
            background: rgba(255, 255, 255, 0.15);
            color: white;
            padding: 6px 16px;
            border-radius: 8px;
            font-size: 12px;
            font-weight: 500;
            border: 1px solid rgba(255, 255, 255, 0.3);
            white-space: nowrap;
        }

        .refresh-btn.paused:hover {
            background: #ff6b6b;
            color: white;
        }

        .dashboard-content {
            padding: 5px;
        }

        .tabs {
            display: flex;
            gap: 10px;
            margin-bottom: 5px;
            border-bottom: 2px solid #e0e0e0;
            overflow-x: auto;
            -webkit-overflow-scrolling: touch;
        }

        .tab {
            padding: 10px 20px;
            background: none;
            border: none;
            border-bottom: 3px solid transparent;
            cursor: pointer;
            font-size: 15px;
            font-weight: 600;
            color: #666;
            transition: all 0.3s;
            white-space: nowrap;
        }

        .tab.active {
            color: #667eea;
            border-bottom-color: #667eea;
        }

        /* Sub-tabs para Visão Geral */
        .sub-tab {
            padding: 8px 16px;
            background: none;
            border: none;
            border-bottom: 3px solid transparent;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            color: #666;
            transition: all 0.3s;
        }

        .sub-tab:hover {
            color: #667eea;
        }

        .sub-tab.active {
            color: #667eea;
            border-bottom-color: #667eea;
        }

        .overview-subtab {
            display: none;
        }

        .overview-subtab.active {
            display: block;
        }

        /* Gráficos */
        .charts-container {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
            gap: 25px;
            margin-top: 20px;
        }

        .chart-card {
            background: white;
            padding: 25px;
            border-radius: 15px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
            height: 400px;
            display: flex;
            flex-direction: column;
            overflow-x: auto;
        }

        .chart-card h3 {
            margin-bottom: 20px;
            color: #333;
            font-size: 16px;
            font-weight: 600;
            flex-shrink: 0;
        }

        .chart-card canvas {
            flex: 1;
            min-height: 0;
            min-width: 100%;
        }
        
        /* Scroll horizontal quando necessário */
        .chart-card > div {
            overflow-x: auto;
            overflow-y: hidden;
        }

        .tab-content {
            display: none;
        }

        .tab-content.active {
            display: block;
        }

        /* Stats Cards */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }

        .stat-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            border-radius: 15px;
            box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 10px;
            overflow: hidden;
            word-wrap: break-word;
            min-width: 0;
        }
        
        .stat-card:has(.stat-icon) {
            flex-direction: row;
            align-items: center;
            gap: 20px;
        }
        
        .stat-icon {
            font-size: 48px;
            line-height: 1;
        }
        
        .stat-info {
            flex: 1;
            min-width: 0;
        }

        .stat-card h3 {
            font-size: 24px;
            font-weight: bold;
            margin: 0 0 5px 0;
            word-wrap: break-word;
            overflow-wrap: break-word;
            white-space: normal;
            line-height: 1.2;
        }

        .stat-card p {
            font-size: 14px;
            opacity: 0.9;
            margin: 0;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        .stat-card .value {
            font-size: 36px;
            font-weight: bold;
            margin-bottom: 10px;
            word-wrap: break-word;
            overflow-wrap: break-word;
        }

        .stat-card .label {
            font-size: 12px;
            opacity: 0.8;
            word-wrap: break-word;
            overflow-wrap: break-word;
            white-space: normal;
            line-height: 1.4;
        }

        /* Progress Bar */
        .progress-bar {
            background: rgba(255, 255, 255, 0.2);
            height: 8px;
            border-radius: 10px;
            overflow: hidden;
            margin-top: 10px;
        }

        .progress-fill {
            height: 100%;
            background: white;
            transition: width 0.3s;
        }

        /* Table */
        .table-container {
            background: white;
            border-radius: 15px;
            overflow: hidden;
            box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
        }

        table {
            width: 100%;
            border-collapse: collapse;
        }

        thead {
            background: #f8f9fa;
        }

        th {
            padding: 20px;
            text-align: left;
            font-weight: 600;
            color: #555;
            text-transform: uppercase;
            font-size: 12px;
            letter-spacing: 1px;
        }

        td {
            padding: 20px;
            border-top: 1px solid #e0e0e0;
        }

        tbody tr:hover {
            background: #f8f9fa;
        }

        .status-badge {
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            display: inline-block;
            border: 2px solid;
            min-width: 100px;
            text-align: center;
        }

        .status-enviado, .status-entregue, .status-lido { 
            background: #d4edda; 
            color: #155724; 
            border-color: #28a745;
        }
        .status-pendente { 
            background: #cfe2ff; 
            color: #084298; 
            border-color: #0d6efd;
        }
        .status-processando {
            background: #d1ecf1;
            color: #0c5460;
            border-color: #17a2b8;
        }
        .status-erro, .status-falha { 
            background: #f8d7da; 
            color: #721c24; 
            border-color: #dc3545;
        }
        .status-cancelada { 
            background: #e2e3e5; 
            color: #383d41; 
            border-color: #6c757d;
        }
        .status-processando {
            background: #fff3cd;
            color: #856404;
            border-color: #ffc107;
        }

        /* Botões de ação da tabela */
        .action-buttons {
            display: flex;
            gap: 5px;
            justify-content: center;
        }

        .btn-action {
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 12px;
            font-weight: 600;
            transition: all 0.2s;
        }

        .btn-editar {
            background: #fd7e14;
            color: white;
        }

        .btn-editar:hover {
            background: #e8590c;
            transform: translateY(-2px);
        }

        .btn-reenviar {
            background: #0d6efd;
            color: white;
        }

        .btn-reenviar:hover {
            background: #0b5ed7;
            transform: translateY(-2px);
        }

        .btn-cancelar {
            background: #dc3545;
            color: white;
        }

        .btn-cancelar:hover {
            background: #bb2d3b;
            transform: translateY(-2px);
        }

        .btn-info {
            background: #17a2b8;
            color: white;
        }

        .btn-info:hover {
            background: #138496;
            transform: translateY(-2px);
        }

        /* Campo de pesquisa */
        .search-box {
            margin-bottom: 20px;
            display: flex;
            gap: 10px;
            align-items: center;
            flex-wrap: wrap;
        }

        .search-box input {
            flex: 1;
            min-width: 200px;
            margin-left: 5px;
            padding: 12px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 14px;
        }

        .search-box input:focus {
            outline: none;
            border-color: #667eea;
        }

        .search-box select {
            padding: 12px 20px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 14px;
            cursor: pointer;
            background: white;
        }

        .search-box select:focus {
            outline: none;
            border-color: #667eea;
        }

        .search-box button {
            padding: 12px 24px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
        }

        .search-box button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        /* Paginação */
        .pagination {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 20px;
            background: #f8f9fa;
            border-radius: 10px;
            margin-top: 20px;
        }

        .pagination button {
            padding: 10px 20px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
        }

        .pagination button:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
        }

        .pagination button:disabled {
            background: #ccc;
            cursor: not-allowed;
            opacity: 0.6;
        }

        .pagination span {
            font-weight: 600;
            color: #667eea;
        }

        /* Admin Section */
        .admin-section {
            background: #f8f9fa;
            padding: 30px;
            border-radius: 15px;
            margin-top: 30px;
        }

        .btn-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 14px 30px;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
            margin-bottom: 20px;
            transition: all 0.3s ease;
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: white;
            padding: 40px;
            border-radius: 20px;
            max-width: 500px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
        }

        /* Estilo da barra de scroll do modal */
        .modal-content::-webkit-scrollbar {
            width: 8px;
        }

        .modal-content::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 10px;
        }

        .modal-content::-webkit-scrollbar-thumb {
            background: #667eea;
            border-radius: 10px;
        }

        .modal-content::-webkit-scrollbar-thumb:hover {
            background: #5568d3;
        }

        .modal h2 {
            margin-bottom: 20px;
            color: #333;
        }

        .modal-buttons {
            display: flex;
            gap: 15px;
            justify-content: flex-end;
            margin-top: 20px;
        }

        .modal-buttons button {
            flex: 1;
            min-width: 140px;
            height: 50px;
            padding: 0 30px;
            font-size: 15px;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-secondary {
            background: #e0e0e0;
            color: #333;
            padding: 14px 30px;
            border: none;
            border-radius: 10px;
            cursor: pointer;
            font-weight: 600;
        }

        .btn-secondary:hover {
            background: #d0d0d0;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .loading {
            display: none;
            text-align: center;
            padding: 40px;
        }

        .loading.active {
            display: block;
        }

        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #667eea;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 0 auto;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Responsividade */
        @media (max-width: 768px) {
            .modal-content {
                padding: 20px;
                width: 95%;
                max-width: 95%;
                max-height: 85vh;
                overflow-y: auto;
            }

            .modal-content h2 {
                font-size: 20px;
            }

            .form-group {
                margin-bottom: 15px;
            }

            .form-group label {
                font-size: 13px;
            }

            .form-group input,
            .form-group select {
                padding: 10px;
                font-size: 14px;
            }

            .modal-buttons {
                flex-direction: column;
                gap: 12px;
            }

            .modal-buttons button {
                width: 100%;
                min-width: auto;
                padding: 16px 30px;
                font-size: 16px;
            }

            .tabs {
                overflow-x: auto;
                -webkit-overflow-scrolling: touch;
            }

            .tab {
                white-space: nowrap;
                font-size: 13px;
                padding: 12px 15px;
            }

            .stats-grid {
                grid-template-columns: 1fr;
                gap: 15px;
            }
            
            .charts-container {
                grid-template-columns: 1fr;
                gap: 20px;
            }
            
            .stat-card {
                padding: 20px;
                gap: 15px;
            }
            
            .stat-icon {
                font-size: 36px;
            }
            
            .stat-card h3 {
                font-size: 28px;
            }
            
            .stat-card p {
                font-size: 12px;
            }

            .dashboard-header {
                flex-direction: column;
                gap: 10px;
                text-align: center;
            }

            .action-buttons {
                flex-direction: column;
            }

            .btn-action {
                width: 100%;
                padding: 8px;
            }

            .search-box {
                flex-direction: column;
            }

            .search-box input,
            .search-box select,
            .search-box button {
                width: 100%;
            }

            /* Transformar tabela em cards no mobile */
            .table-container {
                overflow-x: visible;
            }

            table, thead, tbody, th, td, tr {
                display: block;
            }

            thead {
                display: none;
            }

            tr {
                margin-bottom: 15px;
                border: 1px solid #e0e0e0;
                border-radius: 10px;
                padding: 15px;
                background: white;
            }

            td {
                padding: 8px 0;
                border: none;
                text-align: left;
                position: relative;
                padding-left: 50%;
            }

            td:before {
                content: attr(data-label);
                position: absolute;
                left: 0;
                width: 45%;
                padding-left: 10px;
                font-weight: 600;
                color: #555;
                font-size: 12px;
            }

            .pagination {
                flex-direction: column;
                gap: 15px;
                text-align: center;
            }

            .pagination button {
                width: 100%;
            }

            /* Cards de campanhas responsivos */
            .template-card {
                padding: 15px;
            }

            .template-header {
                flex-direction: column;
                gap: 10px;
            }

            .template-title {
                font-size: 16px;
            }

            .template-meta {
                font-size: 12px;
            }

            .template-body {
                padding: 12px;
                font-size: 13px;
                max-height: 100px;
                overflow-y: auto;
            }

            .template-footer {
                flex-direction: column;
                gap: 15px;
                align-items: stretch;
            }

            .template-stats {
                flex-wrap: wrap;
                gap: 8px;
                font-size: 12px;
            }

            .template-stats span {
                flex: 0 0 calc(50% - 4px);
                white-space: nowrap;
                overflow: hidden;
                text-overflow: ellipsis;
            }

            .template-actions {
                width: 100%;
                flex-wrap: wrap;
                gap: 8px;
            }

            .template-actions button {
                flex: 1;
                min-width: calc(50% - 4px);
                padding: 10px 8px;
                font-size: 13px;
            }

            .btn-icon {
                padding: 10px 12px;
                font-size: 13px;
            }

            /* Modal de histórico responsivo */
            .modal-content[style*="max-width: 900px"] {
                max-width: 95% !important;
                padding: 15px;
            }

            .modal-content table {
                font-size: 11px;
            }

            .modal-content th,
            .modal-content td {
                padding: 8px 4px;
                font-size: 11px;
            }

            .modal-content th {
                font-size: 10px;
            }

            /* Destinatários responsivos */
            .destinatario-item {
                flex-direction: column;
                align-items: flex-start;
                gap: 12px;
                padding: 12px;
            }

            .destinatario-item > div:first-child {
                width: 100%;
            }

            .destinatario-item > div:last-child {
                width: 100%;
                display: flex;
                gap: 8px;
            }

            .destinatario-item button {
                flex: 1;
                padding: 10px 12px;
                font-size: 13px;
                white-space: nowrap;
            }

            /* Informações da Campanha responsivo */
            #campanhaDetailsContent div[style*="grid-template-columns: repeat(2, 1fr)"] {
                grid-template-columns: 1fr !important;
                gap: 12px !important;
            }

            #campanhaDetailsContent div[style*="display: flex; gap: 10px"] {
                flex-direction: column;
                gap: 10px !important;
            }

            #campanhaDetailsContent button {
                width: 100%;
                text-align: center;
            }

            #campanhaDetailsContent h3 {
                font-size: 16px;
            }

            #campanhaDetailsContent > div {
                padding: 15px !important;
            }
        }

        @media (max-width: 480px) {
            .modal-content {
                padding: 15px;
                border-radius: 15px;
                max-height: 85vh;
                width: 98%;
            }

            .modal-content h2 {
                font-size: 18px;
                margin-bottom: 5px;
            }

            .modal-content p {
                font-size: 12px;
                margin-bottom: 20px;
            }

            .form-group label {
                font-size: 12px;
            }

            .form-group input {
                padding: 8px;
                font-size: 13px;
            }

            /* Cards ainda menores em telas muito pequenas */
            .template-card {
                padding: 12px;
            }

            .template-title {
                font-size: 15px;
            }

            .template-body {
                font-size: 12px;
                padding: 10px;
            }

            .template-stats span {
                flex: 0 0 100%;
                font-size: 11px;
            }

            .template-actions button {
                min-width: 100%;
                padding: 12px;
            }

            .form-group small {
                font-size: 11px;
            }

            .btn-primary,
            .btn-secondary {
                padding: 10px 20px;
                font-size: 14px;
            }
        }

        /* Templates & Campanhas Styles */
        .filter-btn {
            padding: 10px 20px;
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            color: #666;
            transition: all 0.3s;
        }

        .filter-btn:hover {
            border-color: #667eea;
            color: #667eea;
        }

        .filter-btn.active {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .template-card {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 15px;
            transition: all 0.3s;
        }

        .template-card:hover {
            border-color: #667eea;
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
        }

        .template-header {
            display: flex;
            justify-content: space-between;
            align-items: start;
            margin-bottom: 15px;
        }

        .template-title {
            font-size: 18px;
            font-weight: 600;
            color: #333;
            margin-bottom: 5px;
        }

        .template-meta {
            font-size: 13px;
            color: #666;
        }

        .template-body {
            background: #f8f9fa;
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            font-family: monospace;
            white-space: pre-wrap;
            color: #333;
        }

        .template-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .template-stats {
            display: flex;
            gap: 15px;
            font-size: 13px;
            color: #666;
        }

        .template-actions {
            display: flex;
            gap: 10px;
        }

        .btn-icon {
            padding: 8px 15px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            transition: all 0.3s;
        }

        .btn-edit {
            background: #ffd93d;
            color: #333;
        }

        .btn-edit:hover {
            background: #ffcd00;
        }

        .btn-delete {
            background: #ff6b6b;
            color: white;
        }

        .btn-delete:hover {
            background: #ff5252;
        }

        .btn-view {
            background: #667eea;
            color: white;
        }

        .btn-view:hover {
            background: #5568d3;
        }

        .btn-activate {
            background: #51cf66;
            color: white;
        }

        .btn-activate:hover {
            background: #40c057;
        }

        .btn-pause {
            background: #ffa94d;
            color: white;
        }

        .btn-pause:hover {
            background: #ff922b;
        }

        .campanha-card {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            padding: 20px;
            margin-bottom: 15px;
            transition: all 0.3s;
        }

        .campanha-card:hover {
            border-color: #667eea;
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
        }

        .campanha-card.ativa {
            border-color: #51cf66;
            background: #f0fdf4;
        }

        .campanha-card.pausada {
            border-color: #ffa94d;
            background: #fffbf0;
        }

        .status-badge {
            display: inline-block;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
        }

        .status-ativa {
            background: #51cf66;
            color: white;
        }

        .status-pausada {
            background: #ffa94d;
            color: white;
        }

        .status-aguardando {
            background: #74c0fc;
            color: white;
        }

        .status-concluida {
            background: #adb5bd;
            color: white;
        }

        .recorrencia-badge {
            display: inline-block;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: 600;
            background: #e7f5ff;
            color: #1864ab;
        }

        textarea {
            width: 100%;
            padding: 15px;
            border: 2px solid #e0e0e0;
            border-radius: 10px;
            font-size: 14px;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            resize: vertical;
            min-height: 120px;
            transition: all 0.3s;
        }

        textarea:focus {
            outline: none;
            border-color: #667eea;
        }

        .parameter-input {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            padding: 15px;
            border-radius: 10px;
            margin-bottom: 15px;
        }

        .parameter-input h4 {
            margin-bottom: 10px;
            color: #333;
        }

        .add-btn {
            background: #51cf66;
            color: white;
            border: none;
            padding: 10px 20px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 600;
            transition: all 0.3s;
        }

        .add-btn:hover {
            background: #40c057;
        }

        .remove-btn {
            background: #ff6b6b;
            color: white;
            border: none;
            padding: 5px 10px;
            border-radius: 5px;
            cursor: pointer;
            font-size: 12px;
        }

        .remove-btn:hover {
            background: #ff5252;
        }

        .destinatario-item {
            background: white;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
            margin-bottom: 10px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        /* =================================================================
           CONVERSAS - Layout Principal
           ================================================================= */
        .conversas-container {
            display: flex;
            height: calc(102vh - 200px);
            gap: 10px;
            background: #f5f5f5;
            border-radius: 12px;
            overflow: hidden;
        }

        .conversas-sidebar {
            width: 350px;
            background: white;
            display: flex;
            flex-direction: column;
            border-right: 1px solid #e0e0e0;
        }

        .conversas-header {
            padding: 12px 15px;
            border-bottom: 2px solid #e0e0e0;
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
            color: white;
        }

        .conversas-header h3 {
            font-size: 16px;
            margin: 0;
        }

        .btn-refresh {
            background: rgba(255, 255, 255, 0.2);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 16px;
            transition: all 0.3s;
        }

        .btn-refresh:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: rotate(180deg);
        }

        .conversas-search {
            padding: 5px 15px;
            border-bottom: 1px solid #e0e0e0;
        }

        .conversas-search input {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 20px;
            font-size: 14px;
            outline: none;
            transition: all 0.3s;
        }

        .conversas-search input:focus {
            border-color: #25D366;
            box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.1);
        }

        .conversas-filtros {
            padding: 5px 15px;
            border-bottom: 1px solid #e0e0e0;
        }

        .filtro-select {
            width: 100%;
            padding: 10px 15px;
            border: 1px solid #ddd;
            border-radius: 8px;
            font-size: 14px;
            background: white;
            cursor: pointer;
            outline: none;
            transition: all 0.3s;
            color: #333;
            font-weight: 500;
        }

        .filtro-select option {
            padding: 8px;
        }

        .filtro-select:hover {
            border-color: #25D366;
        }

        .filtro-select:focus {
            border-color: #25D366;
            box-shadow: 0 0 0 2px rgba(37, 211, 102, 0.1);
        }

        .filtro-btn {
            background: #f5f5f5;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.3s;
            color: #666;
        }

        .filtro-btn:hover {
            background: #e0e0e0;
        }

        .filtro-btn.active {
            background: #25D366;
            color: white;
        }

        .conversas-lista {
            flex: 1;
            overflow-y: auto;
            padding: 10px;
        }

        .conversa-item {
            padding: 15px;
            border-bottom: 1px solid #f0f0f0;
            cursor: pointer;
            transition: background 0.2s;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .conversa-item:hover {
            background: #f9f9f9;
        }

        .conversa-item.active {
            background: #e8f5e9;
            border-left: 4px solid #25D366;
        }

        .conversa-item-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .conversa-nome {
            font-weight: 600;
            color: #333;
            font-size: 15px;
        }

        .conversa-badge {
            background: #ff5252;
            color: white;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: bold;
        }

        .conversa-status {
            font-size: 12px;
            padding: 4px 10px;
            border-radius: 12px;
            display: inline-block;
        }

        .conversa-status.aguardando_empresa {
            background: #fff3cd;
            color: #856404;
        }

        .conversa-status.em_atendimento {
            background: #d1ecf1;
            color: #0c5460;
        }

        .conversa-status.nao_atribuida {
            background: #f8d7da;
            color: #721c24;
        }

        .conversa-status.ia-ativa {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            font-weight: 600;
            animation: pulse-ia 2s ease-in-out infinite;
        }

        @keyframes pulse-ia {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.8; }
        }

        .conversa-preview {
            font-size: 13px;
            color: #666;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .conversa-atendente {
            font-size: 11px;
            font-weight: 500;
            padding: 4px 10px;
            border-radius: 12px;
            display: inline-block;
            margin-top: 4px;
        }
        
        .conversa-atendente.outro-atendente {
            color: #FF9800;
            background: #FFF3E0;
            border: 1px solid #FFE0B2;
        }
        
        .conversa-atendente.meu-atendimento {
            color: #4CAF50;
            background: #E8F5E9;
            border: 1px solid #C8E6C9;
        }
        
        /* Card quando outro usuário está atendendo */
        .conversa-item.em-atendimento-outro {
            border-left: 3px solid #FF9800;
            background: #FFFBF5;
        }
        
        .conversa-item.em-atendimento-outro:hover {
            background: #FFF8ED;
        }

        .conversa-time {
            font-size: 11px;
            color: #999;
        }

        /* =================================================================
           CHAT - Área de Mensagens
           ================================================================= */
        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            background: #e5ddd5;
        }

        .chat-vazio {
            flex: 1;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            color: #999;
        }

        .chat-vazio-icon {
            font-size: 80px;
            margin-bottom: 20px;
            opacity: 0.3;
        }

        .chat-vazio h3 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .chat-vazio p {
            font-size: 14px;
        }

        .chat-ativo {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            position: relative;
        }

        .chat-header {
            background: #18a277;
            color: white;
            padding: 7px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
        }

        /* Botão Voltar (escondido por padrão, visível em mobile) */
        .btn-voltar-mobile {
            display: none;
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 24px;
            font-weight: bold;
            transition: all 0.3s;
            align-items: center;
            justify-content: center;
            padding: 0;
            margin-right: 10px;
        }

        .btn-voltar-mobile:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .chat-header-info h4 {
            margin: 0;
            font-size: 18px;
        }

        .chat-header-status {
            font-size: 13px;
            opacity: 0.9;
        }

        .chat-header-actions {
            display: flex;
            gap: 10px;
            align-items: center; /* Alinha verticalmente os botões */
        }

        /* Botões gerais (campanhas, etc) */
        .btn-icon {
            background: #667eea;
            border: none;
            color: white;
            padding: 8px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 5px;
        }

        .btn-icon:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
        }

        /* Botões específicos do chat (circulares) */
        .chat-header-actions .btn-icon {
            background: rgba(255, 255, 255, 0.2);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            padding: 0;
            font-size: 16px;
        }

        .chat-header-actions .btn-icon:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: none;
            box-shadow: none;
        }

        #btnTransferirHumano {
            background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%) !important;
            color: white;
        }

        #btnTransferirHumano:hover {
            background: linear-gradient(135deg, #ee5a6f 0%, #ff6b6b 100%) !important;
            transform: scale(1.05);
        }



        .chat-mensagens {
            margin-top: 20px;
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            display: flex;
            flex-direction: column;
            gap: 15px;
            position: relative;
            transition: background-color 0.2s, border 0.2s;
        }
        
        /* Estilo quando arrastar arquivo sobre a área de chat */
        .chat-mensagens.drag-over {
            background-color: rgba(37, 211, 102, 0.1);
            border: 2px dashed #25D366;
            border-radius: 10px;
        }
        
        .chat-mensagens.drag-over::before {
            content: "📎 Solte o arquivo aqui para enviar";
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            background: white;
            padding: 20px 40px;
            border-radius: 10px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            font-size: 16px;
            font-weight: 600;
            color: #25D366;
            z-index: 1000;
            pointer-events: none;
        }

        .chat-conversas-antigas-area {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            z-index: 100;
            background: linear-gradient(to bottom, #f0f2f5 70%, rgba(240,242,245,0));
            padding: 8px;
            display: flex;
            justify-content: center;
            pointer-events: none;
            margin-top: 60px;
        }
        
        .btn-carregar-antigas {
            background: #25D366;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 600;
            box-shadow: 0 2px 5px rgba(0,0,0,0.1);
            transition: all 0.2s;
            pointer-events: auto;
        }

        .btn-carregar-antigas:hover {
            background: #20bd5a;
            transform: scale(1.05);
            box-shadow: 0 3px 8px rgba(0,0,0,0.15);
        }

        .btn-carregar-antigas:active {
            transform: scale(0.98);
        }

        .conversa-anterior-separador {
            margin: 20px 0;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .conversa-anterior-separador .separador-linha {
            flex: 1;
            height: 1px;
            background: linear-gradient(to right, transparent, #ddd, transparent);
        }

        .conversa-anterior-separador .separador-info {
            padding: 8px 16px;
            background: #f0f0f0;
            border-radius: 20px;
            font-size: 12px;
            color: #666;
            font-weight: 600;
            white-space: nowrap;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .mensagem-item {
            display: flex;
            margin-bottom: 10px;
        }

        .mensagem-item.cliente {
            justify-content: flex-start;
        }

        .mensagem-item.empresa,
        .mensagem-item.sistema {
            justify-content: flex-end;
        }

        .mensagem-bubble {
            max-width: 65%;
            padding: 10px 15px;
            border-radius: 12px;
            box-shadow: 0 1px 2px rgba(0,0,0,0.1);
        }

        .mensagem-item.cliente .mensagem-bubble {
            background: white;
            border-bottom-left-radius: 4px;
        }

        .mensagem-item.empresa .mensagem-bubble {
            background: #dcf8c6;
            border-bottom-right-radius: 4px;
        }

        .mensagem-item.sistema .mensagem-bubble {
            background: #fff9c4;
            border-radius: 8px;
            max-width: 80%;
        }

        .mensagem-texto {
            color: #333;
            font-size: 14px;
            line-height: 1.5;
            word-wrap: break-word;
        }

        .mensagem-meta {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 5px;
            font-size: 11px;
            color: #999;
        }

        .mensagem-time {
            font-size: 11px;
            color: #999;
        }

        .template-badge {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 10px;
            font-weight: 600;
            margin-bottom: 8px;
            display: inline-block;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        .chat-input {
            background: #f0f0f0;
            padding: 8px 20px;
            display: flex;
            align-items: center;
        }

        .chat-input-wrapper {
            flex: 1;
            display: flex;
            align-items: center;
            background: white;
            border-radius: 25px;
            border: 1px solid #e0e0e0;
            padding: 8px 12px;
            gap: 8px;
            transition: all 0.3s;
        }

        .chat-input-wrapper:focus-within {
            border-color: #25D366;
            box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
        }

        .chat-input textarea {
            flex: 1;
            border: none;
            background: transparent;
            padding: 8px 12px;
            font-size: 15px;
            resize: none;
            font-family: inherit;
            min-height: 44px;
            max-height: 150px;
            line-height: 1.5;
            outline: none;
        }

        .btn-anexar-inline {
            background: transparent;
            border: none;
            color: #54656f;
            cursor: pointer;
            font-size: 24px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            flex-shrink: 0;
            padding: 0;
        }

        .btn-anexar-inline:hover {
            background: #f0f0f0;
            transform: scale(1.1);
        }

        .btn-gravar-audio {
            background: #ff0000;
            border: none;
            color: #000000;
            cursor: pointer;
            font-size: 20px;
            min-width: 32px;
            height: 32px;
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            flex-shrink: 0;
            padding: 0 8px;
            position: relative;
            gap: 4px;
        }

        .btn-gravar-audio .icon-mic {
            margin-bottom: -1px;
            margin-left: -1px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-gravar-audio .icon-stop {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .btn-gravar-audio svg {
            flex-shrink: 0;
        }

        .btn-gravar-audio .recording-time {
            font-size: 11px;
            font-weight: 600;
            margin-left: 2px;
            white-space: nowrap;
        }

        .btn-gravar-audio:hover {
            background: #cc0000;
            transform: scale(1.1);
        }

        .btn-gravar-audio.gravando {
            background: #ff0000;
            color: white;
            animation: pulse 1.5s ease-in-out infinite;
            box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
        }

        .btn-gravar-audio.gravando:hover {
            background: #cc0000;
            box-shadow: 0 0 15px rgba(255, 0, 0, 0.7);
        }

        .btn-enviar-inline {
            background: transparent;
            border: none;
            color: #25D366;
            cursor: pointer;
            font-size: 24px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            flex-shrink: 0;
            padding: 0;
        }

        .btn-enviar-inline:hover {
            background: #f0f2f5;
            transform: scale(1.1);
        }

        .btn-enviar-inline:active {
            transform: scale(0.95);
        }

        /* Estilos para inputs desabilitados em conversas resolvidas */
        #chatInputTexto:disabled {
            background: #f5f5f5;
            color: #999;
            cursor: not-allowed;
        }

        .btn-anexar-inline:disabled,
        .btn-gravar-audio:disabled,
        .btn-enviar-inline:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            pointer-events: none;
        }

        /* Manter botões antigos para compatibilidade com outras telas */
        .btn-enviar {
            background: #25D366;
            color: white;
            border: none;
            padding: 12px 25px;
            border-radius: 20px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s;
            flex-shrink: 0;
            align-self: flex-end;
            min-height: 50px;
        }

        .btn-enviar:hover {
            background: #20b858;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
        }

        .btn-enviar:active {
            transform: translateY(0);
        }

        .btn-anexar {
            background: #f0f0f0;
            color: #666;
            border: none;
            width: 45px;
            height: 45px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.3s;
            flex-shrink: 0;
            align-self: flex-end;
        }

        .btn-anexar:hover {
            background: #e0e0e0;
            transform: scale(1.1);
        }

        .file-preview {
            background: #f8f8f8;
            padding: 10px 20px;
            border-top: 1px solid #e0e0e0;
        }

        .file-preview-content {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
        }

        .file-preview-content span {
            font-size: 13px;
            color: #666;
            flex: 1;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .btn-cancelar-arquivo {
            background: #ff4444;
            color: white;
            border: none;
            width: 24px;
            height: 24px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            flex-shrink: 0;
        }

        .btn-cancelar-arquivo:hover {
            background: #cc0000;
            transform: scale(1.1);
        }

        /* Mensagens com Mídia */
        .mensagem-imagem,
        .mensagem-video,
        .mensagem-documento,
        .mensagem-audio {
            margin-bottom: 8px;
        }

        .chat-imagem {
            max-width: 300px;
            max-height: 400px;
            border-radius: 8px;
            cursor: pointer;
            display: block;
            transition: transform 0.2s;
        }

        .chat-imagem:hover {
            transform: scale(1.02);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .media-placeholder {
            background: rgba(0, 0, 0, 0.05);
            padding: 15px;
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 10px;
        }

        .media-placeholder span {
            font-size: 14px;
            color: #666;
        }

        .btn-baixar-midia {
            background: #25D366;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            transition: all 0.2s;
        }

        .btn-baixar-midia:hover {
            background: #20b858;
            transform: translateY(-1px);
        }

        /* Modal de Imagem */
        .modal-imagem {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .modal-imagem-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.9);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }

        .modal-imagem-conteudo {
            position: relative;
            max-width: 90%;
            max-height: 90%;
            cursor: default;
        }

        .modal-imagem-conteudo img {
            max-width: 100%;
            max-height: 90vh;
            border-radius: 8px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        }

        .modal-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: none;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            font-size: 20px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }

        .modal-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .btn-download-modal {
            position: absolute;
            bottom: -50px;
            left: 50%;
            transform: translateX(-50%);
            background: #25D366;
            color: white;
            padding: 12px 24px;
            border-radius: 8px;
            text-decoration: none;
            font-size: 14px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.2s;
            box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
        }

        .btn-download-modal:hover {
            background: #20b858;
            transform: translateX(-50%) translateY(-2px);
            box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
        }

        /* Loading states */
        .loading-small {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            padding: 40px;
            color: #999;
        }

        .loading-older-messages {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 10px;
            color: #999;
            font-size: 13px;
            gap: 8px;
        }

        .loading-older-messages .spinner-small {
            width: 20px;
            height: 20px;
            border-width: 2px;
            margin-bottom: 0;
        }

        .spinner-small {
            border: 3px solid #f3f3f3;
            border-top: 3px solid #25D366;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            animation: spin 1s linear infinite;
            margin-bottom: 10px;
        }

        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }

        /* Scrollbar customizado para conversas */
        .conversas-lista::-webkit-scrollbar,
        .chat-mensagens::-webkit-scrollbar {
            width: 6px;
        }

        .conversas-lista::-webkit-scrollbar-track,
        .chat-mensagens::-webkit-scrollbar-track {
            background: #f1f1f1;
        }

        .conversas-lista::-webkit-scrollbar-thumb,
        .chat-mensagens::-webkit-scrollbar-thumb {
            background: #888;
            border-radius: 3px;
        }

        .conversas-lista::-webkit-scrollbar-thumb:hover,
        .chat-mensagens::-webkit-scrollbar-thumb:hover {
            background: #555;
        }

        /* =================================================================
           RESPONSIVIDADE - Media Queries
           ================================================================= */

        /* Tablets e telas menores (até 1024px) */
        @media (max-width: 1024px) {
            .conversas-sidebar {
                width: 300px;
            }

            .mensagem-bubble {
                max-width: 75%;
            }

            .chat-header-info h4 {
                font-size: 16px;
            }

            .chat-header-actions .btn-icon {
                width: 32px;
                height: 32px;
                font-size: 14px;
            }
        }

        /* Mobile landscape e tablets pequenos (até 768px) */
        @media (max-width: 768px) {
            .conversas-container {
                flex-direction: column;
                height: calc(100vh - 150px);
            }

            .conversas-sidebar {
                width: 100%;
                height: 100%; /* Ocupa tela inteira por padrão */
                border-right: none;
                border-bottom: 2px solid #e0e0e0;
            }

            /* ESCONDE área de chat vazio em mobile */
            .chat-vazio {
                display: none !important;
            }

            /* Chat container escondido por padrão em mobile */
            .chat-container {
                display: none;
            }

            /* Quando chat está ativo, mostra container e esconde sidebar */
            .conversas-container.chat-aberto .conversas-sidebar {
                display: none;
            }

            .conversas-container.chat-aberto .chat-container {
                display: flex;
                height: 100%;
            }

            /* Mostra botão Voltar em mobile */
            .btn-voltar-mobile {
                display: flex !important;
            }

            /* Esconde botão fechar X em mobile (usa o voltar) */
            .btn-fechar-desktop {
                display: none !important;
            }

            .conversas-header h3 {
                font-size: 16px;
            }

            .btn-refresh {
                padding: 6px 10px;
                font-size: 14px;
            }

            .filtro-btn {
                padding: 6px 12px;
                font-size: 12px;
            }

            .conversa-item {
                padding: 12px;
            }

            .conversa-nome {
                font-size: 14px;
            }

            .chat-header {
                padding: 12px 15px;
            }

            .chat-mensagens {
                padding: 15px;
            }

            .mensagem-bubble {
                max-width: 85%;
            }

            .chat-input {
                padding: 10px;
            }

            .chat-input-wrapper {
                padding: 6px 10px;
            }

            .chat-input textarea {
                font-size: 15px;
                padding: 10px 14px;
                min-height: 50px;
            }

            .btn-anexar-inline,
            .btn-enviar-inline {
                width: 38px;
                height: 38px;
                font-size: 22px;
            }

            .btn-anexar,
            .btn-enviar {
                padding: 10px 15px;
            }
        }

        /* Mobile portrait (até 480px) */
        @media (max-width: 480px) {
            .conversas-container {
                gap: 0;
                border-radius: 0;
            }

            /* Lista ocupa tela inteira por padrão */
            .conversas-sidebar {
                height: 100%;
            }

            /* Chat também ocupa tela inteira quando aberto */
            .conversas-container.chat-aberto .chat-container {
                height: 100%;
            }

            .conversas-header {
                padding: 15px;
            }

            .conversas-header h3 {
                font-size: 15px;
            }

            .conversas-filtros {
                padding: 10px;
                gap: 6px;
            }

            .filtro-btn {
                padding: 5px 10px;
                font-size: 11px;
            }

            .conversa-item {
                padding: 10px;
            }

            .conversa-nome {
                font-size: 13px;
            }

            .conversa-status {
                font-size: 11px;
                padding: 3px 8px;
            }

            .conversa-preview {
                font-size: 12px;
            }

            .chat-header {
                padding: 10px 12px;
            }

            .chat-header-info h4 {
                font-size: 14px;
            }

            .chat-header-status {
                font-size: 12px;
            }

            .chat-header-actions .btn-icon {
                width: 30px;
                height: 30px;
                font-size: 13px;
            }

            .btn-voltar-mobile {
                width: 36px;
                height: 36px;
                font-size: 20px;
                margin-right: 8px;
            }

            .chat-header-actions {
                gap: 8px;
            }

            .chat-mensagens {
                padding: 10px;
                gap: 10px;
            }

            .mensagem-bubble {
                max-width: 90%;
                padding: 8px 12px;
                font-size: 14px;
            }

            .mensagem-time {
                font-size: 10px;
            }

            .chat-input {
                padding: 8px;
            }

            .chat-input-wrapper {
                padding: 6px 8px;
                border-radius: 22px;
            }

            .chat-input textarea {
                font-size: 16px;
                padding: 10px 12px;
                min-height: 60px;
                max-height: 180px;
            }

            .btn-anexar-inline,
            .btn-enviar-inline {
                width: 42px;
                height: 42px;
                font-size: 24px;
            }

            /* Ajusta preview de arquivo em mobile */
            .file-preview {
                padding: 8px;
            }

            .file-preview-content {
                font-size: 12px;
            }

            /* Ajusta modal de imagem em mobile */
            .modal-imagem-conteudo {
                width: 95%;
                max-width: none;
            }

            .btn-close-modal {
                top: 10px;
                right: 10px;
                width: 35px;
                height: 35px;
                font-size: 20px;
            }

            .btn-download-modal {
                padding: 10px 20px;
                font-size: 13px;
            }
        }

        /* Mobile muito pequeno (até 360px) */
        @media (max-width: 360px) {
            .conversas-header h3 {
                font-size: 14px;
            }

            .btn-refresh {
                padding: 5px 8px;
                font-size: 12px;
            }

            .conversa-nome {
                font-size: 12px;
            }

            .chat-header-info h4 {
                font-size: 13px;
            }

            .chat-header-actions .btn-icon {
                width: 28px;
                height: 28px;
                font-size: 12px;
            }

            .btn-voltar-mobile {
                width: 34px;
                height: 34px;
                font-size: 18px;
                margin-right: 6px;
            }

            .chat-header-actions {
                gap: 6px;
            }

            .mensagem-bubble {
                font-size: 13px;
                padding: 7px 10px;
            }

            .chat-input-wrapper {
                padding: 5px 8px;
            }

            .chat-input textarea {
                font-size: 15px;
                min-height: 50px;
            }

            .btn-anexar-inline,
            .btn-enviar-inline {
                width: 36px;
                height: 36px;
                font-size: 20px;
            }
        }

        /* Animação para gravação de áudio */
        @keyframes pulse {
            0%, 100% {
                opacity: 1;
            }
            50% {
                opacity: 0.5;
            }
        }

        /* =============================================================================
           CONFIGURAÇÃO IA - TOGGLE SWITCHES E COMPONENTES
           ============================================================================= */

        .ia-config-section {
            background: #f8f9fa;
            padding: 30px;
            border-radius: 15px;
        }

        .toggle-container {
            margin-bottom: 10px;
        }

        .toggle-label {
            display: flex;
            align-items: center;
            cursor: pointer;
            position: relative;
            user-select: none;
        }

        .toggle-label input[type="checkbox"] {
            position: absolute;
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: relative;
            display: inline-block;
            width: 56px;
            height: 28px;
            background-color: #ccc;
            border-radius: 28px;
            transition: background-color 0.3s ease;
            margin-right: 12px;
            flex-shrink: 0;
        }

        .toggle-slider:before {
            content: "";
            position: absolute;
            height: 22px;
            width: 22px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            border-radius: 50%;
            transition: transform 0.3s ease;
            box-shadow: 0 2px 4px rgba(0,0,0,0.2);
        }

        .toggle-label input[type="checkbox"]:checked + .toggle-slider {
            background-color: #3a7bd5;
        }

        .toggle-label input[type="checkbox"]:checked + .toggle-slider:before {
            transform: translateX(28px);
        }

        .toggle-label:hover .toggle-slider {
            opacity: 0.9;
        }

        .toggle-text {
            font-size: 16px;
            font-weight: 600;
            color: #333;
        }

        /* Form groups dentro da config IA */
        .ia-config-section .form-group {
            margin-bottom: 15px;
        }

        .ia-config-section .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 600;
            color: #555;
            font-size: 14px;
        }

        .ia-config-section .form-group input[type="text"],
        .ia-config-section .form-group input[type="number"],
        .ia-config-section .form-group textarea {
            width: 100%;
            padding: 12px 15px;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 14px;
            transition: border-color 0.3s ease;
            font-family: inherit;
        }

        .ia-config-section .form-group input:focus,
        .ia-config-section .form-group textarea:focus {
            outline: none;
            border-color: #3a7bd5;
            box-shadow: 0 0 0 3px rgba(58, 123, 213, 0.1);
        }

        .ia-config-section .form-group textarea {
            resize: vertical;
            min-height: 100px;
        }

        /* Badges de status */
        .ia-welcome {
            animation: fadeInUp 0.5s ease;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* =============================================================================
           GERENCIAR COTAS
           ============================================================================= */
        
        .quota-management-container {
            padding: 30px;
        }

        .quota-management-container h2 {
            color: #667eea;
            margin-bottom: 10px;
            font-size: 28px;
        }

        .quota-management-container .table-container {
            margin-top: 20px;
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        }

        .quota-management-container table {
            width: 100%;
            border-collapse: collapse;
        }

        .quota-management-container table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
            font-size: 14px;
        }

        .quota-management-container table td {
            padding: 15px;
            border-bottom: 1px solid #f0f0f0;
            font-size: 14px;
        }

        .quota-management-container table tr:hover {
            background-color: #f8f9fa;
        }

        .quota-management-container .badge {
            display: inline-block;
            padding: 6px 12px;
            border-radius: 20px;
            font-size: 13px;
            font-weight: 600;
        }

        .quota-management-container .badge-info {
            background: #e3f2fd;
            color: #1976d2;
        }

        .quota-management-container .badge-success {
            background: #e8f5e9;
            color: #388e3c;
        }

        /* Versão Mobile para Gerenciar Cotas */
        @media (max-width: 768px) {
            .quota-management-container {
                padding: 15px;
            }

            .quota-management-container h2 {
                font-size: 22px;
            }

            .quota-management-container p {
                color: #333 !important;
                font-size: 14px;
            }

            .quota-management-container .table-container {
                background: transparent;
                box-shadow: none;
            }

            .quota-management-container table {
                display: block;
            }

            .quota-management-container thead {
                display: none;
            }

            .quota-management-container tbody {
                display: block;
            }

            .quota-management-container tr {
                display: block;
                background: white;
                border-radius: 12px;
                margin-bottom: 15px;
                padding: 15px;
                box-shadow: 0 2px 8px rgba(0,0,0,0.15);
            }

            .quota-management-container td {
                display: block;
                padding: 8px 0;
                border-bottom: 1px solid #f0f0f0;
                text-align: left;
            }

            .quota-management-container td:first-child {
                font-size: 16px;
                font-weight: 600;
                padding-bottom: 12px;
                border-bottom: 2px solid #667eea;
                margin-bottom: 10px;
            }

            .quota-management-container td:last-child {
                border-bottom: none;
                text-align: center;
                padding-top: 15px;
                margin-top: 10px;
            }

            .quota-management-container td::before {
                content: attr(data-label);
                font-weight: 600;
                color: #667eea;
                display: block;
                margin-bottom: 5px;
                font-size: 12px;
            }

            .quota-management-container td:first-child::before,
            .quota-management-container td:last-child::before {
                display: none;
            }

            .quota-management-container td:nth-child(2) {
                font-size: 13px;
                color: #666;
                padding-bottom: 12px;
                margin-bottom: 10px;
            }

            .quota-management-container .badge {
                font-size: 14px;
                padding: 8px 16px;
                display: inline-block;
            }

            .quota-management-container .btn-icon {
                padding: 12px 24px;
                background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
                color: white;
                border: none;
                border-radius: 8px;
                font-size: 16px;
                cursor: pointer;
                box-shadow: 0 2px 4px rgba(0,0,0,0.2);
            }

            .quota-management-container .btn-icon:active {
                transform: scale(0.95);
            }
        }


