* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

/* ========== LOGIN ========== */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #2c3e50;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    margin-bottom: 30px;
    color: #2c3e50;
    font-size: 28px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: none;
    border-bottom: 2px solid #ddd;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-bottom-color: #3498db;
}

.password-input {
    position: relative;
}

.password-input input {
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.forgot-password {
    color: #3498db;
    text-decoration: none;
}

.error-message {
    background-color: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-primary:hover {
    background-color: #2980b9;
}

/* ========== LOGIN RÁPIDO ========== */
.quick-login-section {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #ecf0f1;
}

.quick-login-divider {
    text-align: center;
    margin-bottom: 20px;
    color: #7f8c8d;
    font-size: 14px;
}

.quick-login-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quick-login-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    width: 100%;
}

.quick-login-btn:hover {
    border-color: #3498db;
    background-color: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.quick-login-btn.admin:hover {
    border-color: #e74c3c;
}

.quick-login-btn.financeiro:hover {
    border-color: #f39c12;
}

.quick-login-btn.atendente:hover {
    border-color: #27ae60;
}

.quick-login-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.quick-login-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.quick-login-info strong {
    color: #2c3e50;
    font-size: 14px;
}

.quick-login-info small {
    color: #7f8c8d;
    font-size: 12px;
}

/* ========== APLICAÇÃO PRINCIPAL ========== */
.app-screen {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h2 {
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-logout {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-logout:hover {
    background-color: #c0392b;
}

.app-nav {
    background-color: #ecf0f1;
    padding: 0 30px;
    display: flex;
    gap: 0;
    border-bottom: 2px solid #bdc3c7;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 20px;
    text-decoration: none;
    color: #555;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.nav-item:hover {
    background-color: #d5dbdb;
    color: #2c3e50;
}

.nav-item.active {
    background-color: #d5dbdb;
    color: #2c3e50;
    border-bottom-color: #3498db;
}

.nav-icon {
    font-size: 18px;
}

.app-main {
    flex: 1;
    padding: 30px;
    background-color: #f5f5f5;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h2 {
    color: #2c3e50;
    font-size: 28px;
}

/* ========== DASHBOARD ========== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-card h3 {
    color: #7f8c8d;
    font-size: 14px;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.dashboard-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #2c3e50;
}

.dashboard-card .value.total { color: #3498db; }
.dashboard-card .value.concluido { color: #27ae60; }
.dashboard-card .value.finalizar { color: #f39c12; }
.dashboard-card .value.estorno { color: #e74c3c; }

/* ========== TICKETS ========== */
.tickets-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: #2c3e50;
}

.tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* PARTE 2.1 e 3: Toolbar estável e fixa */
.tickets-toolbar {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
    padding: 0;
}

.tickets-toolbar-search {
    width: auto;
    max-width: 350px;
    flex-shrink: 0;
}

.tickets-toolbar-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.tickets-toolbar-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
}

/* Contador profissional de tickets */
.counter-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid;
    min-width: 180px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.counter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.counter-card.counter-aberto {
    border-left-color: #6c757d;
}

.counter-card.counter-atendimento {
    border-left-color: #ffc107;
}

.counter-icon {
    font-size: 28px;
    line-height: 1;
}

.counter-content {
    flex: 1;
}

.counter-label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.counter-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.counter-card.counter-aberto .counter-value {
    color: #6c757d;
}

.counter-card.counter-atendimento .counter-value {
    color: #ffc107;
}

/* PARTE 3: Botão Adicionar ticket pequeno (nunca full-width) */
.btn-add-ticket {
    width: auto !important;
    min-width: 160px;
    max-width: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Garantir que botão dentro de toolbar não seja full-width */
.tickets-toolbar-actions .btn-primary {
    width: auto !important;
    max-width: none !important;
}

/* Compatibilidade com código antigo */
.search-bar {
    margin-bottom: 20px;
}

.search-bar input {
    width: 100%;
    max-width: 400px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.table-container {
    background: white;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: visible;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

/* PARTE 1: Garantir que células da tabela não cortem dropdown */
.data-table td {
    overflow: visible;
    position: relative;
}

.data-table thead {
    background-color: #ecf0f1;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #bdc3c7;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #ecf0f1;
}

.data-table tbody tr {
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* AMARELO - Atribuído/Em atendimento */
/* CORREÇÃO DEFINITIVA: Cores por status (ignorar flags residuais) */

/* AMARELO - Em atendimento (com operador) */
.data-table tbody tr.em-atendimento {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

/* ROXO - Aguardando dados / Aguardando resposta do cliente */
.data-table tbody tr.aguardando-dados {
    background-color: #e9d5ff;
    border-left: 4px solid #9d4edd;
}

.data-table tbody tr.aguardando-dados:hover {
    background-color: #e0c3ff;
}

/* AZUL - Financeiro */
.data-table tbody tr.financeiro {
    background-color: #cce5ff;
    border-left: 4px solid #007bff;
}

.data-table tbody tr.financeiro:hover {
    background-color: #b3d9ff;
}

/* VERDE CLARO - Concluído */
.data-table tbody tr.concluido {
    background-color: #d1f2eb;
    border-left: 4px solid #2ecc71;
}

.data-table tbody tr.concluido:hover {
    background-color: #a8e6cf;
}

/* CINZA - Em aberto */
.data-table tbody tr.em-aberto {
    background-color: #e8e8e8;
    border-left: 4px solid #95a5a6;
}

.data-table tbody tr.em-aberto:hover {
    background-color: #d5d5d5;
}

/* CORES DE DESTAQUE POR PRIORIDADE */

/* CINZA - Prioridade Padrão */
.data-table tbody tr.prioridade-padrao {
    background-color: #e8e8e8;
    border-left: 4px solid #999;
}

/* AMARELO - Prioridade Prioritário (cor vibrante da imagem) */
.data-table tbody tr.prioridade-prioritario {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
}

/* VERDE - Prioridade Premium (cor vibrante da imagem) */
.data-table tbody tr.prioridade-premium {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
}

/* Hover effects para prioridades */
.data-table tbody tr.prioridade-padrao:hover {
    background-color: #d8d8d8;
}

.data-table tbody tr.prioridade-prioritario:hover {
    background-color: #ffd9b3;
}

.data-table tbody tr.prioridade-premium:hover {
    background-color: #c3e6cb;
}

.data-table tbody tr.prioridade-prioritario:hover {
    background-color: #ffeaa7;
}

/* em_aberto (sem operador) → SEM cor (neutro) - não precisa classe */

.action-menu {
    position: relative;
    overflow: visible;
}

.action-menu button {
    overflow: visible;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 5px;
    color: #555;
}

/* PARTE 1: Dropdown via portal (fix definitivo) */
.action-menu-dropdown-portal {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    min-width: 180px;
    z-index: 10001;
    max-height: 400px;
    overflow-y: auto;
}

.action-menu-dropdown-portal button {
    width: 100%;
    padding: 12px 15px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    display: block;
    white-space: nowrap;
}

.action-menu-dropdown-portal button:last-child {
    border-bottom: none;
}

.action-menu-dropdown-portal button:hover {
    background-color: #f5f5f5;
}

.action-menu-dropdown-portal button:disabled {
    color: #999;
    cursor: not-allowed;
    background-color: #fafafa;
}

/* ========== MODAL ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

/* PARTE 7.1: Modal com scroll até o final */
.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh; /* PARTE 7.1: max-height 85vh */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden; /* Não permitir scroll no container principal */
}

.modal-md {
    max-width: 600px;
}

.modal-sm {
    max-width: 450px;
}

.modal-large {
    max-width: 900px;
}

/* Modal específico para ALTERAR TICKET - mais largo e organizado */
.modal-alterar-ticket {
    max-width: 750px;
    width: 90%;
}

.modal-alterar-ticket .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.modal-alterar-ticket .form-row-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 10px;
}

.modal-alterar-ticket .form-group {
    margin-bottom: 15px;
}

.modal-alterar-ticket .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
}

.modal-alterar-ticket .form-group input[type="text"],
.modal-alterar-ticket .form-group input[type="email"],
.modal-alterar-ticket .form-group select,
.modal-alterar-ticket .form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.modal-alterar-ticket .form-group textarea {
    resize: vertical;
}

.modal-alterar-ticket .checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

/* CORREÇÃO: Checkbox ANTES do texto */
.modal-alterar-ticket .checkbox-label input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-right: 0;
    cursor: pointer;
    order: -1; /* Coloca checkbox antes do texto */
}

.modal-alterar-ticket .checkbox-label span {
    color: #333;
    font-size: 14px;
    user-select: none;
}

.modal-alterar-ticket .form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

/* CORREÇÃO: Botões do mesmo tamanho, alinhados lado a lado */
.modal-alterar-ticket .form-actions .btn-primary,
.modal-alterar-ticket .form-actions .btn-secondary {
    min-width: 160px;
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
    flex: 0 0 auto;
}

.modal-alterar-ticket small {
    color: #666;
    font-size: 11px;
    display: block;
    margin-top: 5px;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .modal-alterar-ticket .form-row,
    .modal-alterar-ticket .form-row-checkboxes {
        grid-template-columns: 1fr;
    }
}

.modal-file {
    max-width: 80%;
}

/* HOTFIX (.9): Estilos para modal de anexo - tela cheia com zoom */
.attachment-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.attachment-modal-content {
    background: white;
    border-radius: 8px;
    width: 95vw;
    height: 95vh;
    max-width: 1200px;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

.attachment-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #f8f9fa;
}

.attachment-modal-header-info h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

.attachment-modal-header-info p {
    margin: 4px 0 0 0;
    color: #7f8c8d;
    font-size: 13px;
}

.attachment-modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #555;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.attachment-modal-close:hover {
    color: #e74c3c;
    background: #fee;
}

/* Toolbar com controles */
.attachment-modal-toolbar {
    padding: 10px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: #fafafa;
}

.attachment-modal-toolbar-left {
    display: flex;
    gap: 8px;
}

.attachment-modal-toolbar-right {
    display: flex;
    gap: 10px;
}

.attachment-zoom-btn {
    background: white;
    border: 1px solid #ddd;
    color: #555;
    cursor: pointer;
    padding: 6px 12px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 4px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.attachment-zoom-btn:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.attachment-modal-preview {
    flex: 1;
    overflow: auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e8e8e8;
    position: relative;
    min-height: 0; /* Permite flex shrink */
}

.attachment-modal-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}

.attachment-modal-preview iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.attachment-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
    background: #fafafa;
}

.attachment-modal-footer button,
.attachment-modal-toolbar button {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    font-weight: 500;
    transition: all 0.2s;
}

.attachment-modal-close-btn {
    background: #95a5a6;
    color: white;
}

.attachment-modal-close-btn:hover {
    background: #7f8c8d;
}

.attachment-modal-download-btn,
.attachment-modal-download-btn-footer {
    background: #3498db;
    color: white;
}

.attachment-modal-download-btn:hover,
.attachment-modal-download-btn-footer:hover {
    background: #2980b9;
}

/* Responsividade mobile */
@media (max-width: 768px) {
    .attachment-modal-content {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .attachment-modal-header {
        padding: 12px 15px;
    }
    
    .attachment-modal-header-info h3 {
        font-size: 16px;
    }
    
    .attachment-modal-header-info p {
        font-size: 12px;
    }
    
    .attachment-modal-toolbar {
        padding: 8px 15px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .attachment-modal-footer {
        padding: 12px 15px;
        flex-direction: column;
    }
    
    .attachment-modal-footer button {
        width: 100%;
    }
    
    .attachment-modal-preview {
        padding: 0;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ecf0f1;
}

.modal-header h3 {
    color: #2c3e50;
    font-size: 24px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
}

.modal-close:hover {
    color: #333;
}

.modal-tabs {
    display: flex;
    border-bottom: 2px solid #ecf0f1;
    padding: 0 20px;
}

.modal-tab-btn {
    padding: 15px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    transition: all 0.3s;
}

.modal-tab-btn:hover {
    color: #2c3e50;
}

.modal-tab-btn.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* PARTE 7.1: Corpo do modal com scroll */
.modal-body {
    padding: 20px;
    overflow-y: auto; /* PARTE 7.1: overflow-y auto para scroll */
    flex: 1; /* Ocupar espaço disponível */
    max-height: calc(85vh - 140px); /* PARTE 7.1: altura máxima menos header/footer */
}

.modal-content {
    overflow: visible;
}

/* PARTE 7.1: Footer do modal fixo no final */
.modal-footer {
    padding: 20px;
    border-top: 1px solid #ecf0f1;
    background: #fff;
    position: sticky;
    bottom: 0;
    z-index: 10;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 20px;
    overflow: visible;
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

.dados-section {
    margin-bottom: 30px;
}

.dados-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.dado-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.dado-item label {
    font-weight: 600;
    color: #555;
    flex: 0 0 200px;
}

.dado-item .dado-value {
    flex: 1;
    color: #333;
}

.dado-item .copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: #3498db;
    padding: 5px;
    margin-left: 10px;
}

.dado-item .copy-btn:hover {
    color: #2980b9;
}

.interacao-section {
    margin-bottom: 30px;
}

.interacao-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

/* ========== LAYOUT INTERAÇÕES (VERTICAL) ========== */
.interacao-layout-vertical {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-top: 20px;
}

.interacao-form-section {
    display: flex;
    flex-direction: column;
}

.interacao-form-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.interacao-form-section form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.interacao-form-section textarea {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
}

.interacao-form-section select {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
}

.interacao-historico-section {
    display: flex;
    flex-direction: column;
}

.interacao-historico-section h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.historico-container {
    max-height: 400px;
    overflow-y: auto;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

.checkbox-label-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label-inline input[type="checkbox"] {
    width: auto;
    margin: 0;
    cursor: pointer;
}

.checkbox-label-inline span {
    color: #555;
    font-size: 14px;
    user-select: none;
}

.historico-item {
    background: white;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 12px;
    border-left: 4px solid #3498db;
    border: 1px solid #e0e0e0;
    border-left-width: 4px;
    transition: box-shadow 0.2s;
}

.historico-item:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.historico-item-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 12px;
    color: #7f8c8d;
}

.historico-item-status {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.historico-item-mensagem {
    color: #555;
    margin-bottom: 10px;
}

.historico-item-anexo {
    margin-top: 10px;
}

.historico-item-anexo a {
    color: #3498db;
    text-decoration: none;
    font-size: 14px;
}

.historico-item-anexo a:hover {
    text-decoration: underline;
}

.resposta-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.resposta-item-texto {
    flex: 1;
    color: #333;
    margin-right: 15px;
}

#novaRespostaTexto {
    min-height: 200px;
    resize: vertical;
    font-family: inherit;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
}

.resposta-item-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    padding: 8px 16px;
    background-color: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

/* ========== FILTROS ========== */
.filters-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filters-card h3 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.filter-group input,
.filter-group select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* CORREÇÃO: Alinhar botão Gerar corretamente nos filtros */
.filter-group button {
    margin-top: auto;
    align-self: flex-start;
}

.relatorio-resultado {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 4px;
}

.relatorio-resultado table {
    width: 100%;
    border-collapse: collapse;
}

.relatorio-resultado th,
.relatorio-resultado td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.relatorio-resultado th {
    background-color: #ecf0f1;
    font-weight: 600;
}

/* ========== ESTATÍSTICAS ========== */
.estatisticas-bloco {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.estatisticas-bloco h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ecf0f1;
}

.producao-resultado,
.filtro-resultado {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
}

.producao-resultado table,
.filtro-resultado table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.producao-resultado th,
.producao-resultado td,
.filtro-resultado th,
.filtro-resultado td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.producao-resultado th,
.filtro-resultado th {
    background-color: #ecf0f1;
    font-weight: 600;
    color: #2c3e50;
}

.producao-resultado tr:hover,
.filtro-resultado tr:hover {
    background-color: #f0f0f0;
}

.estatisticas-numeros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.estatistica-numero {
    background: white;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #3498db;
}

.estatistica-numero h4 {
    color: #7f8c8d;
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.estatistica-numero .valor {
    font-size: 28px;
    font-weight: bold;
    color: #2c3e50;
}

.estatistica-numero.total { border-left-color: #3498db; }
.estatistica-numero.geral { border-left-color: #95a5a6; }
.estatistica-numero.operacao { border-left-color: #3498db; }
.estatistica-numero.concluido { border-left-color: #27ae60; }
.estatistica-numero.hoje { border-left-color: #f39c12; }
.estatistica-numero.sem-atribuicao { border-left-color: #e74c3c; }

/* ========== UTILITÁRIOS ========== */
.admin-only {
    display: none;
}

/* ========== PAINEL DE DIAGNÓSTICO (PARTE 1.1) ========== */
.diagnostico-panel {
    background: #fff;
    border: 2px solid #3498db;
    border-radius: 8px;
    margin: 15px 0;
    padding: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.diagnostico-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #3498db;
    color: white;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
}

.diagnostico-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.diagnostico-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 18px;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.diagnostico-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.diagnostico-content {
    padding: 15px;
    font-size: 12px;
}

.diagnostico-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.diagnostico-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.diagnostico-item {
    flex: 1;
    min-width: 150px;
}

.diagnostico-item strong {
    color: #2c3e50;
    display: block;
    margin-bottom: 4px;
}

.diagnostico-item code {
    background: #ecf0f1;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.diagnostico-breakdown {
    margin-top: 5px;
    padding-left: 10px;
}

.diagnostico-breakdown div {
    margin: 2px 0;
    color: #555;
}

.admin-financeiro-only {
    display: none;
}

.admin-atendente-only {
    display: none;
}

.show-admin-only {
    display: table-cell !important;
}

.show-admin-financeiro-only {
    display: block !important;
}

.show-admin-atendente-only {
    display: block !important;
}

/* ========== TOAST NOTIFICATION ========== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: white;
    padding: 12px 20px;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.toast.success {
    border-left: 4px solid #27ae60;
}

.toast.error {
    border-left: 4px solid #e74c3c;
}

.toast.info {
    border-left: 4px solid #3498db;
}

.toast-message {
    flex: 1;
    color: #2c3e50;
    font-size: 14px;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.toast.fade-out {
    animation: slideOutRight 0.3s ease-out forwards;
}

/* Responsividade */
@media (max-width: 768px) {
    .app-nav {
        flex-wrap: wrap;
    }

    .nav-item {
        padding: 10px 15px;
        font-size: 14px;
    }

    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .filters-grid {
        grid-template-columns: 1fr;
    }

    .interacao-layout-vertical {
        gap: 20px;
    }

    .historico-container {
        max-height: 300px;
    }
    
    .interacao-form-section textarea {
        min-height: 150px;
    }
}

/* ========== PROMPT .8 - BADGES DE STATUS ========== */
.badge {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 12px;
    line-height: 1;
}

.badge-em-aberto {
    background: #eef1f4;
    color: #2b2f33;
}

.badge-em-atendimento {
    background: #f1c40f;
    color: #1f1f1f;
}

.badge-concluido {
    background: #2ecc71;
    color: #0b2a16;
}

.badge-financeiro {
    background: #007bff;
    color: #ffffff;
    font-weight: 600;
}

.badge-aguardando-dados {
    background: #9b59b6;
    color: #ffffff;
    font-weight: 600;
}

.badge-precisa-dados {
    background: #dc3545;
    color: #ffffff;
    font-weight: 600;
}

/* Badges de Prioridade - Cores vibrantes baseadas na imagem */
.badge-prioridade-premium {
    background-color: #28a745;
    color: #fff;
    font-weight: 600;
}

.badge-prioridade-prioritario {
    background-color: #ffc107;
    color: #333;
    font-weight: 600;
}

.badge-prioridade-padrao {
    background-color: #6c757d;
    color: #fff;
    font-weight: 500;
}

/* ========== MENU DE AÇÕES COM DELEGAÇÃO DE EVENTOS ========== */
.ticket-actions-menu {
    position: fixed;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10001;
    min-width: 180px;
    padding: 4px 0;
}

.ticket-actions-menu.hidden {
    display: none;
}

.ticket-actions-menu button {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #333;
    transition: background-color 0.2s;
}

.ticket-actions-menu button:hover {
    background-color: #f5f5f5;
}

.ticket-actions-menu button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ticket-actions-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    color: #666;
    transition: color 0.2s;
}

.ticket-actions-btn:hover {
    color: #333;
}

/* ========== SUPORTE EMAIL ========== */
.email-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 20px;
    height: calc(100vh - 200px);
    margin-top: 20px;
}

/* Filtros e Busca */
.email-filters {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.search-box input:focus {
    outline: none;
    border-color: #3498db;
}

.filter-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-btn {
    padding: 10px 16px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    transition: all 0.3s;
    text-align: left;
}

.filter-btn:hover {
    background: #f5f5f5;
    border-color: #3498db;
}

.filter-btn.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

/* Lista de Emails */
.email-list-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.email-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.email-item {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 16px;
}

.email-item:hover {
    background-color: #f8f9fa;
}

.email-item.unread {
    background-color: #f0f7ff;
    font-weight: 600;
}

.email-item.unread:hover {
    background-color: #e6f2ff;
}

.email-item.read {
    background-color: white;
}

.email-item.read:hover {
    background-color: #f8f9fa;
}

.email-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #3498db;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
    flex-shrink: 0;
}

.email-item-content {
    flex: 1;
    min-width: 0;
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.email-item-remetente {
    font-weight: 600;
    color: #333;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-item-data {
    font-size: 12px;
    color: #999;
    flex-shrink: 0;
    margin-left: 12px;
}

.email-item-assunto {
    font-size: 14px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.email-item-preview {
    font-size: 13px;
    color: #999;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.email-item-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.email-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.email-badge.respondido {
    background: #d4edda;
    color: #155724;
}

.email-badge.anexo {
    background: #fff3cd;
    color: #856404;
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: #999;
}

.empty-state p {
    font-size: 16px;
    margin: 0;
}

/* Visualizador de Email */
.email-viewer {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    grid-column: 1 / -1;
}

.email-viewer-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.btn-back {
    padding: 10px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-back:hover {
    background: #5a6268;
}

.email-actions {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-action:hover {
    background: #2980b9;
}

.btn-action.btn-danger {
    background: #e74c3c;
}

.btn-action.btn-danger:hover {
    background: #c0392b;
}

.email-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

.email-content-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.email-content-assunto {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
}

.email-content-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
    color: #666;
}

.email-content-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.email-content-meta-label {
    font-weight: 600;
    color: #999;
}

.email-content-body {
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 30px;
}

.email-content-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.email-attachments {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.email-attachments-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
}

.email-attachment-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.email-attachment-icon {
    width: 40px;
    height: 40px;
    background: #3498db;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.email-attachment-name {
    flex: 1;
    font-size: 14px;
    color: #333;
}

.email-attachment-size {
    font-size: 12px;
    color: #999;
}

/* Modal de Novo Email */
.email-compose-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.email-compose-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.email-compose-header {
    padding: 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.email-compose-header h2 {
    margin: 0;
    font-size: 20px;
    color: #333;
}

.email-compose-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.email-compose-close:hover {
    background: #f0f0f0;
    color: #333;
}

.email-compose-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.email-compose-form-group {
    margin-bottom: 20px;
}

.email-compose-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.email-compose-form-group input,
.email-compose-form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.email-compose-form-group input:focus,
.email-compose-form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.email-compose-form-group textarea {
    min-height: 200px;
    resize: vertical;
}

.email-compose-editor {
    min-height: 300px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.email-compose-footer {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.email-compose-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background-color 0.3s;
}

.email-compose-btn-primary {
    background: #3498db;
    color: white;
}

.email-compose-btn-primary:hover {
    background: #2980b9;
}

.email-compose-btn-secondary {
    background: #6c757d;
    color: white;
}

.email-compose-btn-secondary:hover {
    background: #5a6268;
}

.email-compose-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Loading States */
.email-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px;
}

.email-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsividade */
@media (max-width: 768px) {
    .email-container {
        grid-template-columns: 1fr;
    }
    
    .email-filters {
        order: 2;
    }
    
    .email-list-container {
        order: 1;
    }
    
    .email-viewer {
        grid-column: 1;
    }
    
    .email-compose-content {
        width: 95%;
        max-height: 95vh;
    }
}

