/**
 * CHAT - Sistema de Atendimento
 * Estilos Principais
 */

/* ===== RESET & VARIÁVEIS ===== */
:root {
    --primary: #25D366;
    --primary-dark: #128C7E;
    --primary-light: #DCF8C6;

    --secondary: #075E54;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --white: #ffffff;
    --black: #000000;

    --sidebar-width: 340px;
    --painel-width: 300px;
    --header-height: 64px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    --radius-sm: 4px;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --transition: all 0.2s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
}

/* ===== TELA DE LOGIN ===== */
.auth-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 20px;
    overflow: auto;
}

.auth-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

.auth-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.auth-header p {
    color: var(--gray-500);
    font-size: 14px;
}

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

.auth-form label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.auth-form input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 13px;
}

/* ===== BOTÕES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #059669;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-100);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    background: transparent;
    border: none;
    padding: 8px;
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--gray-100);
}

.btn-icon.btn-logout {
    color: var(--gray-500);
}

.btn-icon.btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* ===== LAYOUT PRINCIPAL ===== */
html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.app-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.app-container {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ===== NAV LATERAL (icones) ===== */
.nav-lateral {
    width: 56px;
    height: 100%;
    background: var(--gray-900);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    flex-shrink: 0;
    border-right: 1px solid var(--gray-800);
}

.nav-lateral-top,
.nav-lateral-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: var(--gray-400);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    position: relative;
}

.nav-btn:hover {
    background: var(--gray-800);
    color: var(--gray-200);
}

.nav-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary);
}

.nav-btn.active:hover {
    background: rgba(59, 130, 246, 0.25);
}

.nav-btn svg {
    flex-shrink: 0;
}

/* Badge de notificacao (nao-lidas por instancia) */
.nav-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    pointer-events: none;
    box-shadow: 0 0 0 2px var(--gray-900);
}

/* Instancia com borda lateral colorida ao ativo */
.nav-btn[data-instancia] .nav-instancia-icone {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-header {
    flex-shrink: 0; /* Não encolhe */
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.user-nome {
    font-size: 13px;
    color: var(--gray-600);
}

.status-select {
    padding: 4px 8px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 12px;
    background: var(--white);
    cursor: pointer;
}

.sidebar-filtros {
    flex-shrink: 0; /* Não encolhe */
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.filtro-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--white);
    cursor: pointer;
}

/* Busca */
.sidebar-busca {
    padding: 0 16px 12px;
}

.busca-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--white);
    color: var(--gray-800);
}

.busca-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.busca-input::placeholder {
    color: var(--gray-400);
}

/* Botão Novo Contato */
.btn-novo-contato {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-novo-contato:hover {
    background: var(--primary-dark);
}

.sidebar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-stats {
    flex-shrink: 0; /* Não encolhe */
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--gray-50);
}

.stat-item.aguardando {
    background: #fef3c7;
}

.stat-item.em-atendimento {
    background: #dbeafe;
}

.stat-valor {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 11px;
    color: var(--gray-500);
    text-transform: uppercase;
}

/* Lista de Conversas */
.conversas-lista {
    flex: 1;
    min-height: 0; /* Importante para flex scroll */
    overflow-y: auto;
    overflow-x: hidden;
}

.lista-vazia {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.lista-vazia span {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
}

.conversa-item {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}

.conversa-item:hover {
    background: var(--gray-50);
}

.conversa-item.ativa {
    background: var(--primary-light);
    border-left: 3px solid var(--primary);
}

.conversa-item.nao-lida {
    background: #fef9e7;
}

.conversa-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.conversa-info {
    flex: 1;
    min-width: 0;
}

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

.conversa-nome {
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversa-hora {
    font-size: 11px;
    color: var(--gray-400);
    flex-shrink: 0;
}

.conversa-preview {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.conversa-ultima-msg {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.conversa-badge {
    background: var(--primary);
    color: var(--white);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-left: 8px;
}

.conversa-meta {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.instancia-badge {
    font-size: 9px;
    padding: 1px 5px;
    border-radius: var(--radius-sm);
    color: var(--white);
    white-space: nowrap;
}

.setor-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--white);
}

.status-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.status-badge.aguardando {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.em_atendimento {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge.resolvida {
    background: #d1fae5;
    color: #065f46;
}

.sidebar-footer {
    flex-shrink: 0; /* Não encolhe */
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== ÁREA DO CHAT ===== */
.chat-area {
    flex: 1;
    min-width: 0; /* Importante para flex */
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #e5ddd5;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c5beb5' fill-opacity='0.15'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    overflow: hidden;
}

.chat-placeholder {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-content {
    text-align: center;
    color: var(--gray-500);
}

.placeholder-icon {
    font-size: 72px;
    display: block;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.chat-ativo {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header do Chat */
.chat-header {
    flex-shrink: 0;
    background: var(--white);
    padding: 10px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
    flex: 1 0 200px;
}

.contato-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.contato-dados {
    min-width: 0;
}

.contato-dados h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contato-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.canal-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.canal-badge.whatsapp {
    background: #dcf8c6;
    color: #075e54;
}

.canal-badge.instagram {
    background: #fce7f3;
    color: #9d174d;
}

.contato-telefone {
    font-size: 12px;
    color: var(--gray-500);
}

.chat-header-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

/* Mensagens */
.chat-mensagens {
    flex: 1;
    min-height: 0; /* Importante para flex scroll */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Scrollbar customizada */
.chat-mensagens::-webkit-scrollbar {
    width: 6px;
}

.chat-mensagens::-webkit-scrollbar-track {
    background: transparent;
}

.chat-mensagens::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.chat-mensagens::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.mensagem {
    max-width: 65%;
    padding: 8px 12px;
    border-radius: var(--radius);
    position: relative;
    word-wrap: break-word;
}

.mensagem.entrada {
    background: var(--white);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.mensagem.saida {
    background: var(--primary-light);
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.mensagem-conteudo {
    font-size: 14px;
    line-height: 1.4;
    color: var(--gray-800);
}

.mensagem-meta {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.mensagem-hora {
    font-size: 11px;
    color: var(--gray-400);
}

.mensagem-status {
    font-size: 12px;
}

.mensagem-remetente {
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-dark);
    margin-bottom: 2px;
}

.mensagem-sistema {
    align-self: center;
    background: rgba(0, 0, 0, 0.1);
    color: var(--gray-600);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    max-width: 80%;
    text-align: center;
}

/* Input de Mensagem */
.chat-input-area {
    flex-shrink: 0; /* Não encolhe */
    background: var(--gray-100);
    padding: 12px 20px;
    border-top: 1px solid var(--gray-200);
    position: relative;
}

.chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    box-shadow: var(--shadow-sm);
}

.btn-anexo {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    opacity: 0.6;
}

.btn-anexo:hover {
    opacity: 1;
}

.input-mensagem {
    flex: 1;
    border: none;
    resize: none;
    font-size: 14px;
    line-height: 1.4;
    max-height: 120px;
    padding: 8px 0;
    font-family: inherit;
}

.input-mensagem:focus {
    outline: none;
}

.btn-enviar {
    background: var(--primary);
    color: var(--white);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-enviar:hover {
    background: var(--primary-dark);
}

.chat-input-info {
    text-align: center;
    margin-top: 8px;
}

.chat-input-info span {
    font-size: 11px;
    color: var(--gray-400);
}

/* ===== PAINEL LATERAL ===== */
.painel-contato {
    width: var(--painel-width);
    height: 100%;
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow: hidden;
}

.painel-header {
    flex-shrink: 0; /* Não encolhe */
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.painel-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.painel-content {
    flex: 1;
    min-height: 0; /* Importante para flex scroll */
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.painel-contato-info {
    text-align: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}

.painel-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px;
}

.painel-contato-info h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.painel-contato-info p {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.painel-section {
    margin-bottom: 20px;
}

.painel-section h5 {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-400);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.painel-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.painel-item .label {
    color: var(--gray-500);
    font-size: 13px;
}

.painel-item .valor {
    font-weight: 500;
    color: var(--gray-800);
    font-size: 13px;
}

.painel-lista {
    font-size: 13px;
    color: var(--gray-500);
}

.painel-acoes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ===== CRM - ABAS E FORMULARIOS ===== */
.crm-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
    padding: 0 16px;
}

.crm-tab {
    flex: 1;
    padding: 10px 8px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    transition: all 0.2s;
}

.crm-tab:hover {
    color: var(--gray-700);
}

.crm-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

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

.crm-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.crm-form .form-group {
    margin-bottom: 0;
}

.crm-form .form-group label {
    font-size: 12px;
    color: var(--gray-600);
    margin-bottom: 4px;
    display: block;
}

.crm-form .form-input,
.crm-form .form-select,
.crm-form .form-textarea {
    font-size: 13px;
    padding: 8px 10px;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

.form-row .form-group:last-child {
    flex: 0 0 60px;
}

/* Avatar com imagem */
.painel-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Badge de anuncio */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 8px;
}

.badge-success {
    background: var(--success-light, #d1fae5);
    color: var(--success, #059669);
}

/* Info box para dados do anuncio */
.info-box {
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: 12px;
}

.info-box strong {
    display: block;
    margin-bottom: 10px;
    font-size: 12px;
}

.info-box .form-group {
    margin-bottom: 8px;
}

.info-box .form-group:last-child {
    margin-bottom: 0;
}

.info-success {
    background: var(--success-light, #d1fae5);
    border: 1px solid var(--success, #059669);
}

/* Cards financeiros */
.financeiro-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.financeiro-card {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    text-align: center;
}

.financeiro-label {
    display: block;
    font-size: 11px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.financeiro-valor {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.valor-destaque {
    color: var(--success, #059669);
    font-weight: 700;
}

/* ROI info */
.roi-info {
    background: var(--gray-50);
    border-radius: var(--radius);
    padding: 12px;
    margin-bottom: 12px;
}

.roi-info .painel-item {
    padding: 4px 0;
    border-bottom: none;
}

/* Info text */
.info-text {
    font-size: 11px;
    color: var(--gray-400);
    font-style: italic;
}

/* Secao fixa no fim */
.painel-section-fixed {
    border-top: 1px solid var(--gray-200);
    padding-top: 16px;
    margin-top: auto;
}

/* Botao pequeno */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* ===== MODAIS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow: hidden;
}

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

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.btn-fechar-modal {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    color: var(--gray-500);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 13px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Config Tabs */
.config-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: 8px;
}

.config-tab {
    background: none;
    border: none;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.config-tab:hover {
    background: var(--gray-100);
}

.config-tab.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.config-tab-content h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--gray-800);
}

.config-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 13px;
}

.status-badge.conectado {
    background: var(--success);
    color: var(--white);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.status-badge.desconectado {
    background: var(--gray-400);
    color: var(--white);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

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

.toast {
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    background: var(--success);
    color: var(--white);
}

.toast.error {
    background: var(--danger);
    color: var(--white);
}

.toast.warning {
    background: var(--warning);
    color: var(--white);
}

.toast.info {
    background: var(--info);
    color: var(--white);
}

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

/* ===== RESPONSIVO ===== */
@media (max-width: 1024px) {
    .painel-contato {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .chat-area {
        width: 100%;
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ===== SETORES ===== */
.setores-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.setores-header h4 {
    margin: 0;
    color: var(--gray-800);
}

.form-setor {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-input-color {
    width: 60px;
    height: 38px;
    padding: 4px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.form-check {
    display: flex;
    align-items: center;
}

.form-check label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin: 0;
}

.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}

.lista-setores {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.setor-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    transition: var(--transition);
}

.setor-item:hover {
    border-color: var(--gray-300);
    box-shadow: var(--shadow-sm);
}

.setor-item.inativo {
    opacity: 0.6;
    background: var(--gray-50);
}

.setor-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.setor-cor {
    width: 16px;
    height: 16px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}

.setor-dados h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
}

.setor-dados p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--gray-500);
}

.setor-acoes {
    display: flex;
    gap: 4px;
}

.setor-acoes button {
    padding: 6px 10px;
    font-size: 12px;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.setor-acoes button:hover {
    background: var(--gray-100);
}

.setor-acoes .btn-editar:hover {
    border-color: var(--info);
    color: var(--info);
}

.setor-acoes .btn-excluir:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* ===== BOTÕES DE MÍDIA ===== */
.input-actions-left {
    display: flex;
    gap: 4px;
}

.btn-media {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    opacity: 0.7;
    transition: var(--transition);
}

.btn-media:hover {
    opacity: 1;
    background: var(--gray-100);
}

.btn-media:active {
    transform: scale(0.95);
}

/* ===== PAINEL DE EMOJIS ===== */
.painel-emoji {
    position: absolute;
    bottom: 100%;
    left: 20px;
    width: 320px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    overflow: hidden;
    z-index: 100;
}

.emoji-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
}

.emoji-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.emoji-tab:hover {
    background: var(--gray-50);
}

.emoji-tab.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 500;
}

.emoji-content {
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
}

.emoji-item {
    font-size: 22px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    border-radius: var(--radius);
    transition: var(--transition);
}

.emoji-item:hover {
    background: var(--gray-100);
    transform: scale(1.2);
}

.figurinhas-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.figurinha-item {
    aspect-ratio: 1;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
}

.figurinha-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.figurinha-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== PAINEL DE RESPOSTAS RÁPIDAS ===== */
.painel-respostas {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    max-width: 500px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    overflow: hidden;
    z-index: 100;
}

.painel-respostas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-200);
}

.painel-respostas-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.painel-respostas-busca {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
}

.painel-respostas-busca input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: 13px;
}

.lista-respostas-rapidas {
    max-height: 300px;
    overflow-y: auto;
}

.resposta-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: var(--transition);
}

.resposta-item:hover {
    background: var(--gray-50);
}

.resposta-item:last-child {
    border-bottom: none;
}

.resposta-titulo {
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.resposta-titulo .atalho {
    font-size: 11px;
    background: var(--gray-200);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    color: var(--gray-600);
}

.resposta-preview {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== GRAVAÇÃO DE ÁUDIO ===== */
.gravacao-audio {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.gravacao-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gravacao-icone {
    font-size: 18px;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.gravacao-tempo {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
    font-family: monospace;
}

.gravacao-actions {
    display: flex;
    gap: 8px;
}

/* ===== MENSAGENS DE MÍDIA ===== */
.mensagem-imagem,
.mensagem-video {
    max-width: 280px;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
}

.mensagem-imagem img,
.mensagem-video video {
    width: 100%;
    display: block;
}

.mensagem-audio {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.mensagem-audio audio {
    max-width: 250px;
}

.mensagem-documento {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--radius);
    cursor: pointer;
}

.mensagem-documento:hover {
    background: var(--gray-200);
}

.doc-icon {
    font-size: 28px;
}

.doc-info {
    flex: 1;
    min-width: 0;
}

.doc-nome {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.doc-tamanho {
    font-size: 12px;
    color: var(--gray-500);
}

.doc-hint {
    font-size: 11px;
    color: var(--gray-400);
    margin-top: 2px;
}

.mensagem-documento:hover .doc-hint {
    color: var(--primary-dark);
}

/* ===== PREVIEW DE UPLOAD ===== */
.upload-preview {
    position: absolute;
    bottom: 100%;
    left: 20px;
    right: 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 8px;
    padding: 16px;
    z-index: 100;
}

.upload-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.upload-preview-header h4 {
    margin: 0;
    font-size: 14px;
}

.upload-preview-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius);
    object-fit: cover;
}

.upload-info {
    flex: 1;
}

.upload-nome {
    font-weight: 500;
    margin-bottom: 4px;
}

.upload-tamanho {
    font-size: 13px;
    color: var(--gray-500);
}

.upload-legenda {
    margin-top: 12px;
}

.upload-legenda input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-200);
}

/* ===== FIXAR CONVERSAS (PIN) ===== */
.conversa-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-pin {
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    opacity: 0.3;
    transition: var(--transition);
    line-height: 1;
}

.btn-pin:hover {
    opacity: 0.7;
    background: var(--gray-100);
}

.btn-pin.ativa {
    opacity: 1;
    transform: rotate(-45deg);
}

.conversa-item.fixada {
    background: linear-gradient(135deg, #fef3c7 0%, #fef9e7 100%);
    border-left: 3px solid #f59e0b;
}

.conversa-item.fixada:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fef3c7 100%);
}

.conversa-item.fixada.ativa {
    background: linear-gradient(135deg, #dcf8c6 0%, #e8fbd8 100%);
    border-left: 3px solid var(--primary);
}

/* ===== RESPOSTA CITADA (REPLY/QUOTE) ===== */
.reply-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.reply-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.reply-icon {
    font-size: 18px;
    opacity: 0.7;
}

.reply-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.reply-nome {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary-dark);
}

.reply-preview {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-cancelar {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius);
    opacity: 0.5;
    transition: var(--transition);
}

.reply-cancelar:hover {
    opacity: 1;
    background: var(--gray-100);
}

/* Quote dentro da mensagem */
.mensagem-quote {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: var(--transition);
}

.mensagem-quote:hover {
    background: rgba(0, 0, 0, 0.08);
}

.mensagem.saida .mensagem-quote {
    background: rgba(0, 0, 0, 0.05);
}

.quote-nome {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary-dark);
    margin-bottom: 2px;
}

.quote-texto {
    font-size: 12px;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Botao de responder na mensagem */
.mensagem {
    position: relative;
}

.btn-responder {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    width: 28px;
    height: 28px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mensagem.entrada .btn-responder {
    right: -36px;
}

.mensagem.saida .btn-responder {
    left: -36px;
}

.mensagem:hover .btn-responder {
    opacity: 1;
}

.btn-responder:hover {
    background: var(--gray-100);
    transform: translateY(-50%) scale(1.1);
}

/* Highlight quando clicar em quote */
.mensagem-highlight {
    animation: highlightPulse 2s ease-out;
}

@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

/* ===== MODAL DE ARQUIVOS/MIDIAS ===== */
.arquivos-filtros {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--gray-200);
}

.filtros-tipo {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.filtro-tipo {
    padding: 6px 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-full);
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.filtro-tipo:hover {
    background: var(--gray-200);
}

.filtro-tipo.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.filtros-fonte {
    font-size: 13px;
    color: var(--gray-600);
}

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

.filtros-fonte input[type="checkbox"] {
    width: 16px;
    height: 16px;
}

.lista-arquivos {
    max-height: 400px;
    overflow-y: auto;
}

.arquivo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin-bottom: 8px;
    transition: var(--transition);
}

.arquivo-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.arquivo-item:last-child {
    margin-bottom: 0;
}

.arquivo-preview {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.arquivo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.arquivo-icone {
    font-size: 28px;
}

.arquivo-info {
    flex: 1;
    min-width: 0;
}

.arquivo-nome {
    font-weight: 500;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.arquivo-meta {
    font-size: 12px;
    color: var(--gray-500);
    display: flex;
    gap: 8px;
}

.arquivo-acoes {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.arquivo-acoes .btn {
    padding: 6px 10px;
    font-size: 14px;
}

.arquivo-acoes a {
    text-decoration: none;
}

/* =========================================
   FASE 1 — FILTROS EXTRAS, PRIORIDADE, POPUP RESPOSTAS
   ========================================= */

/* Filtros extras (segunda linha) */
.sidebar-filtros-extra {
    gap: 4px;
}

.sidebar-filtros-extra .filtro-select {
    font-size: 11px;
    padding: 4px 6px;
    flex: 1;
    min-width: 0;
}

/* Prioridade — indicador na lista de conversas */
.conversa-prioridade {
    width: 4px;
    border-radius: 2px;
    flex-shrink: 0;
    align-self: stretch;
}

.conversa-prioridade.prioridade-baixa { background: var(--gray-600); }
.conversa-prioridade.prioridade-normal { background: #3b82f6; }
.conversa-prioridade.prioridade-alta { background: #f59e0b; }
.conversa-prioridade.prioridade-urgente { background: #ef4444; }

.conversa-item.prioridade-urgente .conversa-nome {
    font-weight: 700;
    color: #ef4444;
}

/* Prioridade dropdown no painel */
.filtro-prioridade-select {
    padding: 2px 6px;
    font-size: 12px;
    border-radius: 4px;
    border: 1px solid var(--gray-600);
    background: var(--gray-800);
    color: var(--gray-200);
}

/* Popup inline de respostas rapidas */
.popup-respostas-inline {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: var(--gray-800);
    border: 1px solid var(--gray-600);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
    z-index: 50;
}

.popup-resposta-item {
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--gray-700);
    transition: background 0.15s;
}

.popup-resposta-item:hover,
.popup-resposta-item.selecionado {
    background: var(--gray-700);
}

.popup-resposta-item:last-child {
    border-bottom: none;
}

.popup-resposta-titulo {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-200);
    display: flex;
    align-items: center;
    gap: 8px;
}

.popup-resposta-titulo .atalho {
    font-size: 11px;
    color: var(--accent);
    background: rgba(59, 130, 246, 0.15);
    padding: 1px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.popup-resposta-preview {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Input area precisa position relative pro popup */
.chat-input-area {
    position: relative;
}

/* CRUD Respostas admin — prefixo do atalho */
.input-prefix-group {
    display: flex;
    align-items: center;
}

.input-prefix {
    background: var(--gray-700);
    border: 1px solid var(--gray-600);
    border-right: none;
    padding: 6px 10px;
    border-radius: 6px 0 0 6px;
    color: var(--accent);
    font-weight: 600;
    font-family: monospace;
    font-size: 14px;
}

.input-prefix-group .form-input {
    border-radius: 0 6px 6px 0;
}

/* Resposta item na lista admin */
.resposta-admin-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px;
    border-bottom: 1px solid var(--gray-700);
}

.resposta-admin-info {
    flex: 1;
    min-width: 0;
}

.resposta-admin-titulo {
    font-weight: 600;
    color: var(--gray-200);
    font-size: 13px;
}

.resposta-admin-atalho {
    font-size: 11px;
    color: var(--accent);
    font-family: monospace;
    margin-left: 8px;
}

.resposta-admin-preview {
    font-size: 12px;
    color: var(--gray-400);
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.resposta-admin-setor {
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 2px;
}

.resposta-admin-acoes {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 12px;
}

.resposta-admin-acoes .btn {
    padding: 4px 8px;
    font-size: 12px;
}

/* =========================================
   PEDIDOS DO CLIENTE (aba CRM)
   ========================================= */

.pedido-card {
    display: flex;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid var(--gray-700);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.pedido-card:hover {
    background: var(--gray-700);
}

.pedido-thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.pedido-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pedido-info {
    flex: 1;
    min-width: 0;
}

.pedido-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

.pedido-codigo {
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-200);
}

.pedido-status {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}

.pedido-status.aberto {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.pedido-status.fechado {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.pedido-nome {
    font-size: 12px;
    color: var(--gray-300);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.pedido-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--gray-500);
    margin-top: 4px;
}

.pedido-meta span {
    white-space: nowrap;
}
