* { box-sizing: border-box; margin: 0; padding: 0; font-family: "Segoe UI", Helvetica Neue, Arial, sans-serif; }
body { background: #f0f2f5; color: #1c1e21; font-size: 13px; }

.app-container { display: flex; height: 100vh; overflow: hidden; }
.sidebar { width: 220px; background: #111b21; color: #fff; padding: 15px 10px; display: flex; flex-direction: column; gap: 8px; }
.sidebar a { color: #aebac1; text-decoration: none; padding: 8px 12px; border-radius: 6px; font-weight: 500; }
.sidebar a:hover, .sidebar a.active { background: #2a3942; color: #00a884; }

.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; padding: 15px; }

/* Dashboard Header & Tools */
.panel-card { background: #fff; border-radius: 6px; padding: 12px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.toolbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.search-input { width: 300px; padding: 6px 10px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; outline: none; }

/* Lista Horizontal Ultra Densa */
.client-list { display: flex; flex-direction: column; gap: 3px; }
.client-row { display: grid; grid-template-columns: 30px 1.5fr 1fr 1.2fr 1.5fr 1fr 1.5fr 120px; align-items: center; background: #fff; border: 1px solid #e9edef; padding: 4px 8px; border-radius: 4px; font-size: 12px; }
.client-row.header { background: #f0f2f5; font-weight: bold; border-color: #d1d7de; color: #54656f; }
.client-row:hover:not(.header) { background: #f5f6f6; }

.badge { display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 10px; font-weight: bold; text-transform: uppercase; }
.badge-disparo { background: #d1e7dd; color: #0f5132; }
.badge-espera { background: #fff3cd; color: #664d03; }
.badge-blacklist { background: #f8d7da; color: #842029; }

.btn { padding: 5px 10px; border: none; border-radius: 4px; cursor: pointer; font-size: 12px; font-weight: 600; }
.btn-primary { background: #00a884; color: white; }
.btn-danger { background: #ea4335; color: white; }
.btn-secondary { background: #6c757d; color: white; }

.obs-cell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; color: #667781; font-style: italic; }

/* =========================================================================
   LAYOUT DO PAINEL DE CHAT (HISTÓRICO) - ESTILO WHATSAPP WEB
   ========================================================================= */

.chat-container {
    background: #efeae2; /* Fundo padrão do WhatsApp Web */
    border: 1px solid #ccc;
    border-radius: 8px;
    height: 500px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #00a884;
    color: white;
    padding: 15px 20px;
    font-weight: bold;
    font-size: 15px;
}

.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px; /* Reduzido o espaçamento entre os balões */
    background-image: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png'); /* Padrão de fundo do WhatsApp */
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: local;
}

.chat-bubble {
    max-width: 65%; /* Limite de largura */
    width: fit-content; /* Ajusta ao tamanho do texto */
    padding: 8px 12px; /* Padding ajustado */
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 1px rgba(0,0,0,0.15);
    white-space: pre-wrap;
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    font-family: "Segoe UI", Helvetica Neue, Arial, sans-serif;
}

.chat-bubble.received {
    background: #ffffff; /* Fundo branco para recebidas */
    align-self: flex-start;
    border-radius: 0px 8px 8px 8px; /* Bordas arredondadas (sem rabo no topo esquerdo) */
}

.chat-bubble.sent {
    background: #d9fdd3; /* Verde padrão para enviadas */
    align-self: flex-end;
    border-radius: 8px 0px 8px 8px; /* Bordas arredondadas (sem rabo no topo direito) */
}

.chat-text {
    margin: 0;
    padding: 0;
}

.chat-time {
    font-size: 11px; /* Fonte menor */
    color: #667781;
    text-align: right;
    margin-top: 4px;
    align-self: flex-end; /* Alinhado à direita inferior */
    opacity: 0.85; /* Opacidade reduzida */
    display: inline-block;
}

/* Layout Mensagens (Lado a Lado) */
.messages-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.messages-left {
    flex: 1;
    min-width: 400px;
}
.messages-right {
    flex: 1.5;
    min-width: 400px;
}

/* Estilos para Truncar Texto na Lista de Conversas Recebidas */
.truncate-msg {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#processingCards .panel-card{margin:12px 0;border-left:4px solid #00a884}


/* =========================================================================
   PROCESSANDO - Cards por Template
   ========================================================================= */

#processingCards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
    width: 100%;
}

.processing-card {
    background: #ffffff;
    border-radius: 10px;
    padding: 16px;
    border: 1px solid #e9edef;
    box-shadow: 0 2px 6px rgba(0,0,0,.08);
    transition: .2s ease;
}

.processing-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.processing-card-header {
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:10px;
    margin-bottom:12px;
}

.processing-title {
    font-size:15px;
    font-weight:700;
    color:#111b21;
}

.processing-id {
    font-size:11px;
    color:#667781;
}

.processing-status {
    display:inline-flex;
    padding:4px 10px;
    border-radius:20px;
    font-size:11px;
    font-weight:700;
}

.processing-status.active {
    background:#d1e7dd;
    color:#0f5132;
}

.processing-status.inactive {
    background:#f8d7da;
    color:#842029;
}

.processing-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:10px;
    margin:12px 0;
}

.processing-item {
    background:#f5f6f6;
    border-radius:6px;
    padding:8px;
}

.processing-item-label {
    display:block;
    font-size:11px;
    color:#667781;
}

.processing-item-value {
    display:block;
    font-size:15px;
    font-weight:700;
    color:#111b21;
}

.processing-actions {
    display:flex;
    gap:8px;
    margin-top:12px;
}

.processing-actions .btn {
    flex:1;
}

.btn-processing-clear {
    background:#6c757d;
    color:#fff;
}

@media(max-width:700px){
    #processingCards {
        grid-template-columns:1fr;
    }

    .processing-grid {
        grid-template-columns:1fr;
    }

    .processing-actions {
        flex-direction:column;
    }
}
