body#dashboard-page {
    height: 100vh;         /* altura EXATA da tela */
    min-height: 0;         /* permite encolher dentro do html */
    overflow: hidden;      /* tira o scroll da página */
    display: flex;
    flex-direction: column;
}


/* Estilos Gerais */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
    color: #333;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    /* height: 100vh; */ /* <- REMOVIDO */
    flex-grow: 1;      /* <- ADICIONADO: Faz o container crescer e ocupar o espaço */
    padding: 1rem;     /* <- ADICIONADO: Cria um espaçamento nas laterais */
    box-sizing: border-box; /* <- ADICIONADO: Garante que o padding não quebre o layout */
}

/* CartÃ£o de Login (Sem alteraÃ§Ãµes) */
.login-card {
    background: #fff;
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}

.login-card h2 {
    text-align: center;
    color: #005a40; /* Verde escuro */
    margin-top: 0;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-sizing: border-box; /* Garante que o padding nÃ£o afete a largura */
}

button {
    width: 100%;
    padding: 0.9rem;
    border: none;
    border-radius: 8px;
    background-color: #008a60; /* Verde AmazÃ´nia */
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

button:hover {
    background-color: #005a40;
}

/* ==================================== */
/* DASHBOARD - NOVOS ESTILOS */
/* ==================================== */

.dashboard-header {
    display: flex;
    justify-content: space-between; /* <-- MUDANÇA AQUI */
    align-items: center;
    padding: 1rem 2rem; 
    background-color: #0C5B42;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: relative; 
}

/* (NOVO) Cria a coluna "invisível" da esquerda */
.dashboard-header::before {
    content: "";
    flex-basis: 33.33%;
    /* Garante que o alinhamento do user-info funcione */
    display: flex;
    justify-content: flex-start;
}

.header-logo {
    /* REMOVIDO: position: absolute; */
    /* REMOVIDO: left: 50%; */
    /* REMOVIDO: top: 50%; */
    /* REMOVIDO: transform: translate(-50%, -50%); */
    
    /* ADICIONADO: Define que a logo ocupa 1/3 do espaço */
    flex-basis: 33.33%;
    display: flex;
    justify-content: center; /* Centraliza a logo no 1/3 dela */
}

.header-logo img {
    height: 50px; /* Aumentado de 40px para 50px */
    width: auto;
}

.dashboard-header h2 {
    margin: 0;
    color: #005a40;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #ffffff;
    font-weight: 600;
    
    /* ADICIONADO: Define que o menu ocupa 1/3 do espaço */
    flex-basis: 33.33%;
    justify-content: flex-end; /* Alinha os itens (Olá, rangel, select...) à direita */
}

.user-info #logout-btn {
    width: auto;
    padding: 0.5rem 1rem;
    background-color: #f44336; /* Vermelho */
    font-size: 0.9rem;
}
.user-info #logout-btn:hover {
    background-color: #d32f2f;
}

.dashboard-container {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    flex: 1 1 auto;   /* ocupa o miolo entre header e footer */
    min-height: 0;    /* <-- permite encolher dentro do body */
    align-items: stretch;
    overflow: hidden;
}


.queue-column {
    flex: 1 1 0;
    min-height: 0;          /* <-- ESSENCIAL pro scroll interno funcionar */
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
}


.queue-column h3 {
    margin-top: 0;
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    color: #333;
    /* ADICIONE AS 3 LINHAS ABAIXO */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==================================== */
/* ESTILO PARA O CONTADOR DA FILA (NOVO)*/
/* ==================================== */
.queue-count-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #eee; /* Fundo cinza claro */
    color: #555;           /* Texto cinza escuro */
    font-size: 0.8rem;
    font-weight: 700;
    border-radius: 50%;     /* CÃ­rculo perfeito */
    min-width: 24px;        /* Largura mÃ­nima */
    height: 24px;           /* Altura */
    padding: 0 4px;         /* EspaÃ§o interno (caso o nÃºmero passe de 9) */
    box-sizing: border-box; /* Garante que o padding nÃ£o afete o tamanho */
}

.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.tab-btn {
    width: auto;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    background-color: transparent;
    color: #777;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    margin-bottom: -2px; /* Alinha com a borda do container */
}

.tab-btn:hover {
    background-color: #f4f4f4;
    color: #333;
}

.tab-btn.active {
    color: #005a40;
    border-bottom-color: #008a60;
    background-color: transparent;
}

.tab-content {
    display: none; /* Esconde listas por padrÃ£o */
}

.tab-content.active {
    display: block; /* Mostra lista ativa */
}

.atendimento-lista {
    list-style-type: none; /* Remove o bullet point */
    padding-left: 0;       /* Remove o recuo padrÃ£o da lista */
    margin: 0;             /* Remove a margem padrÃ£o da lista */
}

.atendimento-lista li {
}

.queue-column .atendimento-lista {
    flex: 1 1 auto;     /* ocupa o espaço que sobra na coluna */
    min-height: 0;      /* deixa a UL encolher se precisar */
    overflow-y: auto;   /* scroll interno aqui */
}


/* coluna 3 (com abas) */
.queue-column .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: none;
    /* NÃO definir overflow aqui */
}

.queue-column .tab-content.active {
    display: block;     /* ou flex, se preferir, mas SEM overflow */
    /* nada de overflow-y aqui */
}



.atendimento-card {
    display: flex;
    align-items: center; 
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #ddd;  /* Uma borda sutil, como #ddd ou #ccc */
    border-radius: 12px;     /* Cantos mais arredondados */
    margin-bottom: 0.6rem;     /* EspaÃ§amento entre os cards */
}
/* Ajuste para o Ãºltimo item */
.atendimento-card:last-child {
    margin-bottom: 0; /* Remove a margem extra do Ãºltimo item */
}

.atendimento-card.chat-item {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.atendimento-card.chat-item:hover {
    background-color: #f0f0f0;
}

.atendimento-card.chat-item.selected {
    background-color: #e0eafc; /* Azul claro para item selecionado */
}


.card-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e0e0e0;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.card-info {
    flex-grow: 1;
    overflow: hidden; /* JÃ¡ existe, mantÃ©m */
    /* ADICIONE AS DUAS LINHAS ABAIXO: */
    white-space: nowrap; /* Garante que o container nÃ£o quebre internamente */
    text-overflow: ellipsis; /* Faz o container aplicar ellipsis ao conteÃºdo */
}

.card-info p{
  margin: 0;
  font-size: 0.85rem;
  color: #555;

  /* permite quebra e limita a 2 linhas com "..." */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: normal;   /* permite quebrar */
}


/* Garanta que o H4 tambÃ©m nÃ£o cause problemas (opcional, mas seguro) */
.card-info h4 {
    margin: 0 0 4px 0;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;     /* MantÃ©m */
    overflow: hidden;        /* MantÃ©m */
    text-overflow: ellipsis; /* MantÃ©m */
}

/* Container para o tempo e o botÃ£o */
.card-right-col {
    display: flex;
    flex-direction: column; /* Empilha o tempo (em cima) e o botÃ£o (embaixo) */
    align-items: flex-end;  /* Alinha os dois Ã  direita */
    flex-shrink: 0;         /* Impede que a coluna encolha */
    margin-left: 0.5rem;    /* Pequeno espaÃ§o para separar da info */
}

.card-time {
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 0.5rem; /* EspaÃ§o entre o tempo e o botÃ£o */
}

.card-action {
    /* NÃ£o precisa mais do flex-shrink aqui, pois estÃ¡ no .card-right-col */
}

.card-action .claim-btn {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background-color: #2196F3; /* Azul */
}

.card-action .claim-btn:hover {
    background-color: #1976D2;
}

footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    color: #888;
    background-color: transparent; 
    /* border-top: 1px solid #eee; */
    /* margin-top: auto; */ /* <-- PROBLEMA REMOVIDO */
}


.chat-column {
    position: fixed;
    top: 65px; 
    left: 2rem; 
    width: 64%; 
    height: 85vh; /* <-- MUDANÃ‡A: Altura aumentada */
    z-index: 900;  
    background: #fff;
    border-radius: 12px; 
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15); 
    display: flex;
    flex-direction: column;
    display: none; 
    animation: slideUp 0.3s ease-out;
    overflow: hidden; /* <-- MUDANÃ‡A: Garante que os filhos respeitem a borda */
}

.chat-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee; /* Borda mais sutil */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-client-name-header {
        /* Remove o 'position: absolute' para evitar sobreposição */
        position: static;
        transform: none;
        /* Coloca-o no fluxo normal */
        flex-grow: 1;
        text-align: center;
        font-size: 1rem;
        padding: 0 0.5rem;
        /* Garante que texto longo não quebre */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        
        /* --- ADICIONE ESTA LINHA --- */
        min-width: 0; 
    }

.chat-close-icon-btn {
    background: #f0f0f0;
    color: #555;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 36px; /* Centraliza o 'x' */
    z-index: 10; /* Garante que fique acima do nome */
}
.chat-close-icon-btn:hover {
    background: #ddd;
}

.chat-header-actions {
    display: flex;
    gap: 0.5rem;
    z-index: 10; /* Garante que fique acima do nome */
}

.header-btn-transfer {
    width: auto;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    background-color: #2196F3; /* Azul do exemplo */
    color: white;
    border: none;
    border-radius: 8px;
}
.header-btn-transfer:hover {
    background-color: #1976D2;
}

/* Ajusta o botÃ£o de encerrar existente */
.header-btn-close {
    width: auto;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    background-color: #f44336; /* Vermelho */
}

.chat-header div {
    display: flex;
    gap: 0.5rem;
}


.chat-history {
    flex-grow: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-placeholder {
    margin: auto;
    color: #999;
    font-style: italic;
}

/* Estilos das mensagens (serÃ£o usados em breve) */
.msg {
    padding: 0.8rem 1rem;
    border-radius: 18px;
    max-width: 75%;
    line-height: 1.4;
}

.msg-cliente {
    background-color: #f1f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
}

.msg-atendente {
    background-color: #008a60; /* Verde AmazÃ´nia */
    color: white;
    border-bottom-right-radius: 4px;
    align-self: flex-end;
}


.chat-input-area {
    display: flex;
    border-top: 1px solid #eee; /* Borda sutil */
    padding: 1rem;
    gap: 0.5rem; /* Menor espaÃ§o */
    align-items: center; 
    background-color: #f9f9f9; /* Fundo levemente cinza */
    /* --- ADICIONE AS 2 LINHAS ABAIXO --- */
    border-bottom-left-radius: 12px;  /* Combina com o radius do modal */
    border-bottom-right-radius: 12px; /* Combina com o radius do modal */
}
.chat-input-area input {
    flex-grow: 1;
    padding: 0.9rem 1.5rem; /* Mais padding interno */
    border: 1px solid #ccc;
    border-radius: 30px; /* Borda arredondada */
    background: #fff; /* Input branco */
}
.chat-input-area input:focus {
    outline: none;
    border-color: #0C5B42; /* Verde ao focar */
}

.chat-input-area button {
    width: auto;
    padding: 0.8rem 1.5rem;
}

/* ==================================== */
/* ESTILOS DOS ÃCONES DE INPUT (CORRIGIDO)
/* ==================================== */

.chat-input-area .chat-icon-btn {
    width: 44px;
    min-width: 44px; /* <-- MUDANÃ‡A: Impede que o botÃ£o estique (width: 100%) */
    height: 44px;
    border-radius: 50%;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    flex-shrink: 0; 
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Estilo para os Ã­cones DENTRO dos botÃµes */
.chat-input-area .chat-icon-btn img {
    width: 24px;
    height: 24px;
}

/* BotÃ£o Enviar (Send) */
.chat-input-area .chat-icon-btn.send-btn {
    background-color: #0C5B42; /* Verde do header */
    border: none;
}

/* Hovers (Efeito ao passar o mouse) */
.chat-input-area .chat-icon-btn:hover {
    background-color: #f0f0f0;
}
.chat-input-area .chat-icon-btn.send-btn:hover {
    background-color: #005a40; /* Verde escuro */
}

/* Estilo para os Ã­cones DENTRO dos botÃµes */
.chat-icon-btn img {
    width: 24px;  /* Tamanho de exibiÃ§Ã£o (512x Ã© muito grande) */
    height: 24px;
}
.chat-icon-btn.send-btn {
    background-color: #0C5B42; /* Verde do header */
    /* color: white;     <-- Removido */
    border: none;
    /* font-size: 1.2rem;  <-- Removido */
    /* padding-left: 3px; <-- Removido */
}
.chat-icon-btn.attach-btn {
    font-size: 1.2rem;
}
.chat-icon-btn.plus-btn {
    font-size: 1.5rem;
}
.chat-icon-btn:hover {
    background-color: #f0f0f0;
}


.header-btn-close {
    width: auto;
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    background-color: #f44336; /* Vermelho */
}
.header-btn-close:hover {
    background-color: #d32f2f;
}

/* ==================================== */
/* ESTILOS PARA O TIMESTAMP NO CHAT */
/* ==================================== */

.msg-timestamp {
    display: block; /* Faz ficar em uma linha abaixo */
    font-size: 0.75rem; /* Tamanho menor */
    color: #888; /* Cinza claro */
    margin-top: 5px; /* EspaÃ§o acima */
    text-align: right; /* Alinha Ã  direita dentro do balÃ£o */
}

/* Ajusta a cor do timestamp para mensagens do atendente */
.msg-atendente .msg-timestamp {
    color: #e0f2f7; /* Um cinza bem claro para contrastar com o verde */
}

/* ==================================== */
/* ESTILOS PARA IMAGEM NO CHAT */
/* ==================================== */

.chat-image {
    width: 100%;
    max-width: 300px; /* Define um tamanho mÃ¡ximo */
    border-radius: 10px; /* Arredonda cantos da imagem */
    margin-bottom: 5px; /* EspaÃ§o caso haja legenda */
}

.chat-text-content {
    /* Garante que o texto (legenda) nÃ£o tenha margens estranhas */
    margin: 0;
    padding: 0;
}

/* Ajusta o parÃ¡grafo de texto quando ele Ã© uma legenda */
.chat-image + .chat-text-content {
    margin-top: 8px; /* Adiciona espaÃ§o entre a imagem e a legenda */
}

/* Ajusta o timestamp para ficar abaixo da legenda/imagem */
.msg .msg-timestamp {
    margin-top: 8px;
}

/* ==================================== */
/* ESTILOS PARA ENVIO DE ARQUIVO */
/* ==================================== */
.chat-attach-btn {
    /* Estilo do botÃ£o de anexo */
    width: auto;
    padding: 0.8rem;
    font-size: 1.2rem; /* Tamanho do emoji */
    background-color: transparent;
    border: 1px solid #ddd;
    color: #555;
    line-height: 1; /* Alinha o emoji */
}

.chat-attach-btn:hover {
    background-color: #f0f0f0;
}

.file-preview-area {
    /* Ãrea que mostra o nome do arquivo */
    font-size: 0.85rem;
    color: #555;
    padding: 0 1rem 0.5rem 1rem; /* EspaÃ§amento */
    display: none; /* ComeÃ§a escondido */
}

.file-preview-area span {
    font-weight: 600;
    cursor: pointer;
    color: #f44336; /* Vermelho para o 'x' */
    margin-left: 8px;
    padding: 2px 5px;
    border-radius: 4px;
}

.file-preview-area span:hover {
    background-color: #ffebee;
}

/* ==================================== */
/* ESTILOS PARA DOCUMENTO NO CHAT */
/* ==================================== */

.msg-documento {
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 10px 15px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Cor para balÃ£o do atendente */
.msg-atendente .msg-documento {
     background-color: rgba(255, 255, 255, 0.2);
     color: white;
     border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Cor para balÃ£o do cliente */
.msg-cliente .msg-documento {
    background-color: #e9e9e9;
    color: #333;
    border: 1px solid #ddd;
}

.msg-documento:hover {
    opacity: 0.8;
}

.doc-icon {
    font-size: 1.5rem;
    margin-right: 10px;
}

.doc-name {
    font-weight: 600;
    font-size: 0.9rem;
    /* Evita que nomes longos quebrem o layout */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

/* ==================================== */
/* ESTILOS PARA ÃUDIO NO CHAT (CORREÃ‡ÃƒO) */
/* ==================================== */

.chat-audio-player {
    width: 300px;      /* Define uma largura fixa de 300px */
    max-width: 100%;   /* Garante que ele encolha se a tela for menor */
    height: 45px;
}

/* ==================================== */
/* ESTILOS RESPOSTAS RÃPIDAS (Modal) */
/* ==================================== */

.modal-overlay {
    position: fixed; /* Cobre a tela inteira */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none; /* ComeÃ§a escondido */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}
/* (NOVO) Faz a textarea do modal usar 100% da largura */
.modal-content .input-group textarea {
    width: 100%;
    box-sizing: border-box; /* Garante que o padding não quebre o layout */
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: auto;
}
.modal-close-btn:hover {
    color: #333;
    background: transparent;
}

.modal-list-container {
    overflow-y: auto;
    max-height: 250px;
    border: 1px solid #eee;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.modal-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f0f0;
}
.modal-list-item:last-child {
    border-bottom: none;
}

.modal-item-title {
    font-weight: normal; /* MUDANÇA: Tira o negrito */
    white-space: normal; /* MUDANÇA: Permite quebra de linha */
    line-height: 1.4;    /* MUDANÇA: Melhora a leitura */
    width: 70%;          /* MUDANÇA: Dá espaço para os botões na direita */
}

.modal-item-actions button {
    width: auto;
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    margin-left: 0.5rem;
}

.modal-item-actions .edit-btn {
    background-color: #2196F3; /* Azul */
}
.modal-item-actions .edit-btn:hover {
    background-color: #1976D2;
}

.modal-item-actions .delete-btn {
    background-color: #f44336; /* Vermelho */
}
.modal-item-actions .delete-btn:hover {
    background-color: #d32f2f;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.modal-actions #modal-clear-btn {
    background-color: #9e9e9e; /* Cinza */
}
.modal-actions #modal-clear-btn:hover {
    background-color: #757575;
}


/* ==================================== */
/* (NOVO) PAINEL RESPOSTAS RÁPIDAS
/* ==================================== */
.quick-message-sidebar {
    position: absolute;
    top: 0;
    right: 0;
    width: 300px; /* Largura do painel lateral */
    height: 100%;
    background-color: #fdfdfd; /* Fundo ligeiramente diferente */
    border-left: 1px solid #eee;
    z-index: 1000; /* Fica por cima do histórico de chat */
    
    display: flex;
    flex-direction: column;

    /* Começa escondido (deslocado para a direita) */
    transform: translateX(100%);
    transition: transform 0.3s ease-out;
    
    /* Garante bordas arredondadas corretas */
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

/* Classe a ser ligada/desligada via JS no .chat-column */
.chat-column.quick-messages-active .quick-message-sidebar {
    transform: translateX(0); /* Entra na tela */
}

.quick-message-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    flex-shrink: 0;
}

.quick-message-sidebar-header h4 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

/* Botão '+' da sidebar */
.sidebar-add-btn {
    background: #0C5B42; /* Verde */
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    min-width: 30px; /* Garante tamanho */
    height: 30px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 30px;
}
.sidebar-add-btn:hover {
    background: #005a40;
}

.quick-message-sidebar-list {
    overflow-y: auto;
    flex-grow: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Estilo do item de mensagem (mostra o texto completo) */
.quick-message-sidebar-item {
    font-size: 0.85rem;
    color: #444;
    background: #f0f0f0;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: normal; /* Permite quebra de linha */
}
.quick-message-sidebar-item:hover {
    background-color: #e0e0e0;
}

/* ==================================== */
/* ESTILOS PARA INPUT COM BOTÃƒO "X" */
/* ==================================== */

.chat-input-wrapper {
    position: relative; /* Contexto para o botÃ£o "X" */
    flex-grow: 1; /* Ocupa o espaÃ§o que o input ocupava */
    display: flex; /* Garante alinhamento interno */
}

/* Precisamos sobrepor o estilo original do input */
.chat-input-wrapper textarea { /* <-- MUDANÇA AQUI */
    flex-grow: 1; /* Input cresce dentro do wrapper */
    
    /* ADICIONA ESPAÇO à direita para o "X" não sobrepor o texto */
    padding-right: 2.5rem; 
    
    /* (Estilos que ele já tinha, para garantir) */
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
    padding-left: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;

    /* --- ADIÇÕES IMPORTANTES PARA TEXTAREA --- */
    resize: none; /* Impede que o usuário redimensione */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; /* Garante a mesma fonte do body */
    font-size: 0.9rem;  /* Garante o mesmo tamanho de fonte */
    line-height: 1.4; /* Melhora a leitura de múltiplas linhas */
    min-height: 44px; /* Altura mínima (semelhante ao input antigo) */
    max-height: 120px; /* Altura máxima (para não quebrar o layout) */
    overflow-y: auto; /* Adiciona scroll SÓ no textarea se passar da altura máxima */
    box-sizing: border-box; /* Garante que o padding não quebre o layout */
}

.clear-text-btn {
    position: absolute; /* Coloca o "X" sobre o wrapper */
    right: 1px;   /* Alinha Ã  direita */
    top: 1px;     /* Alinha ao topo */
    bottom: 1px;  /* Alinha abaixo */
    width: 2.2rem; /* Largura do "X" */
    
    /* Visual e centralizaÃ§Ã£o */
    display: none; /* COMEÃ‡A ESCONDIDO */
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    background-color: #fff; 
    border-radius: 0 8px 8px 0; /* Arredonda cantos direito */
}

.clear-text-btn:hover {
    color: #333;
}

/* Mostra o "X" apenas se o textarea tiver texto */
.chat-input-wrapper textarea:not(:placeholder-shown) + .clear-text-btn { /* <-- MUDANÇA AQUI */
    display: flex;
}

/* ==================================== */
/* ANIMAÃ‡ÃƒO DO MODAL DE CHAT (NOVO)
/* ==================================== */
@keyframes slideUp {
    from {
        transform: translateY(30px); /* ComeÃ§a 30px abaixo */
        opacity: 0;
    }
    to {
        transform: translateY(0);    /* Termina na posiÃ§Ã£o normal */
        opacity: 1;
    }
}

.sidebar-header-buttons {
    display: flex;
    gap: 0.5rem;
}

.sidebar-close-btn {
    background: #f0f0f0;
    color: #555;
    border: none;
    border-radius: 50%;
    width: 30px;
    min-width: 30px;
    height: 30px;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    line-height: 30px;
}
.sidebar-close-btn:hover {
    background: #ddd;
}
/* (NOVO) Estilo dos botões de emoji */
.emoji-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.emoji-btn {
    width: auto;
    padding: 0.2rem 0.6rem;
    font-size: 1rem;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}
.emoji-btn:hover {
    background-color: #e0e0e0;
}

/* (NOVO) Estilos para a página de login */
.login-logo {
    display: block; /* Para poder centralizar com margin */
    margin: 0 auto 1.5rem auto; /* Centraliza e adiciona espaço abaixo */
    height: 60px; /* Ajuste a altura conforme desejar */
    width: auto;
}
/* Adicionado para melhorar a responsividade do login */
@media (max-width: 480px) {
    .login-card {
        padding: 2rem 1.5rem; /* Reduz o padding em telas pequenas */
    }
}

/* ==================================== */
/* (NOVO) MEDIA QUERIES PARA RESPONSIVO */
/* ==================================== */
@media (max-width: 900px) {

    /* 1. Ajusta o container principal */
    .dashboard-container {
        flex-direction: column; /* Empilha as colunas */
        padding: 1rem;          /* Menos padding */
        gap: 1rem;
        align-items: stretch;   /* Garante que colunas ocupem 100% da largura */
    }

    /* 2. Ajusta as colunas empilhadas */
    .queue-column {
        max-height: none; /* Remove a altura máxima no mobile */
        height: auto;     /* Altura automática */
        min-height: 300px; /* Uma altura mínima para não ficar estranho */
    }

    /* 3. Ajusta o modal de chat para TELA CHEIA */
    .chat-column {
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        border-radius: 0;
        z-index: 950; /* Garante que fique acima de tudo, exceto outros modals */
    }

    /* 4. Ajusta o header do chat para mobile */
    .chat-header {
        padding: 0.75rem 1rem;
    }
    
    .chat-client-name-header {
        /* Remove o 'position: absolute' para evitar sobreposição */
        position: static;
        transform: none;
        /* Coloca-o no fluxo normal */
        flex-grow: 1;
        text-align: center;
        font-size: 1rem;
        padding: 0 0.5rem;
        /* Garante que texto longo não quebre */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 5. Ajusta botões do header do chat */
    .chat-header-actions {
        /* Garante que os botões não sejam espremidos */
        flex-shrink: 0;
    }
    .header-btn-transfer,
    .header-btn-close {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }

    /* 6. Ajusta a sidebar de respostas rápidas */
    .quick-message-sidebar {
        width: 280px; /* Um pouco mais estreito */
        max-width: 90%; /* Garante que não vaze da tela */
    }
    
    /* 7. Ajusta o header do dashboard */
    .dashboard-header {
        padding: 1rem;
    }
    .header-logo {
        /* Centralização absoluta pode dar problema; vamos simplificar */
        position: static;
        transform: none;
        margin: 0 auto; /* Centraliza o logo de forma simples */
    }
    .user-info {
        /* Coloca os dados do usuário no canto */
        position: absolute;
        right: 1rem;
        top: 50%;
        transform: translateY(-50%);
    }
}
/* ==================================== */
/* (NOVO) ESTILO TAG SETOR NO CARD
/* ==================================== */
.card-setor-tag {
    display: inline-block; /* Permite aplicar padding */
    font-size: 0.7rem;     /* Texto bem pequeno */
    font-weight: 600;
    color: #555;           /* Cor do texto sutil */
    background-color: #f0f0f0; /* Fundo cinza claro (sutil) */
    padding: 2px 8px;      /* Espaçamento interno */
    border-radius: 10px;   /* Cantos arredondados */
    margin-top: 6px;       /* Espaço entre a tag e a mensagem acima */
}

/* ==================================== */
/* MODAL DE IMAGEM (MELHORIAS DE ZOOM)
/* ==================================== */
#image-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow: hidden; /* Importante para o arrasto funcionar */
}

#image-modal-close-btn {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1002; /* Acima dos controles e da imagem */
}

#image-modal-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    user-select: none;
    transform: scale(1) translate(0px, 0px); /* Inicial: scale 1, sem translate */
    transition: transform 0.2s ease-out; /* Transição suave */
    cursor: default; /* Cursor padrão. O JS vai mudar para grab/grabbing */
}

/* Quando a imagem está com zoom e pode ser arrastada */
#image-modal-img.draggable {
    cursor: grab;
}

#image-modal-img.draggable:active {
    cursor: grabbing;
    transition: none; /* Desabilita transição durante o arrasto */
}

/* ==================================== */
/* (NOVO) ESTILOS PARA "RESPONDER"
/* ==================================== */

/* Faz o balão de mensagem ser o "pai" do botão */
.msg {
    position: relative;
    /* Ajusta o padding para o botão não sobrepor o timestamp */
    padding-bottom: 30px; 
}

/* Botão "Responder" (ícone de seta) */
.msg-reply-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem; /* Tamanho do ícone */
    color: #999;
    opacity: 0; /* Começa invisível */
    transition: opacity 0.2s ease;
    z-index: 5;
}

/* Mostra o botão ao passar o mouse sobre a mensagem */
.msg:hover .msg-reply-btn {
    opacity: 1;
}

/* Cor do ícone no balão do atendente */
.msg-atendente .msg-reply-btn {
    color: #e0f2f7;
}

/* Área de preview (acima do input) */
.reply-preview-area {
    display: none; /* Começa escondido */
    padding: 0.5rem 1rem;
    background-color: #f0f0f0;
    border-top: 1px solid #ddd;
    font-size: 0.85rem;
    color: #555;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.reply-preview-area-text {
    /* Trunca o texto da mensagem de preview */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}

.reply-preview-area .cancel-reply-btn {
    font-size: 1.5rem;
    font-weight: bold;
    color: #777;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: auto; /* Remove o width 100% de botões */
}

.reply-preview-area .cancel-reply-btn:hover {
    background: none; /* Garante que não tenha hover */
    color: #333;
}
/* ==================================== */
/* (NOVO) ESTILOS DE MENSAGEM, RESPOSTA E CITAÇÃO
/* ==================================== */

/* O "embrulho" que segura o balão e o botão */
.msg-wrapper {
    display: flex;
    align-items: center;
    gap: 8px; /* Espaço entre o botão e o balão */
    margin-bottom: 0.25rem; /* Espaço entre as mensagens */
}

/* Alinha o wrapper do cliente à esquerda */
.msg-wrapper-cliente {
    align-self: flex-start;
}

/* Alinha o wrapper do atendente à direita */
.msg-wrapper-atendente {
    align-self: flex-end;
    flex-direction: row-reverse; /* Inverte a ordem */
}

/* O balão de mensagem principal */
.msg {
    position: static; /* Remove o 'relative' antigo */
    margin-bottom: 0; /* O espaçamento agora é no wrapper */
    line-height: 1.4;
    border-radius: 18px;
    padding: 0.8rem 1rem;
    max-width: 75%;
}

/* * CORREÇÃO 1: Balão e Timestamp
 * Define uma largura mínima e posição para o timestamp
*/
.msg-cliente, .msg-atendente {
    position: relative; /* ESSENCIAL para o timestamp */
    min-width: 150px; /* LARGURA MÍNIMA para caber a data */
    padding-bottom: 25px; /* Espaço para o timestamp */
    word-wrap: break-word; /* Quebra palavras longas */
}

.msg-cliente {
    background-color: #f1f0f0;
    color: #333;
    border-bottom-left-radius: 4px;
}

.msg-atendente {
    background-color: #008a60;
    color: white;
    border-bottom-right-radius: 4px;
}

/* O timestamp (data e hora) */
.msg-timestamp {
    position: absolute; /* Posiciona dentro do balão */
    bottom: 5px;
    right: 10px;
    font-size: 0.75rem;
    color: #888;
    white-space: nowrap; /* Impede que a data quebre a linha */
}

.msg-atendente .msg-timestamp {
    color: #e0f2f7; /* Cor mais clara para o balão verde */
}

/* * CORREÇÃO 2: A Seta de Resposta
 * Este é o botão de resposta, que só aparece ao passar o mouse.
*/
.msg-reply-btn {
    position: static;
    opacity: 0; /* Invisível por padrão */
    transition: opacity 0.2s ease;
    
    /* O Círculo */
    width: 28px;
    height: 28px;
    background: #e0e0e0; /* Fundo do círculo */
    border-radius: 50%;
    flex-shrink: 0; /* Impede que o botão encolha */

    /* A Seta (ícone) */
    color: #8a8a8a;
    font-size: 1.2rem;
    font-weight: bold;
    line-height: 28px; /* Centraliza a seta verticalmente */
    text-align: center; /* Centraliza a seta horizontalmente */
    
    cursor: pointer;
    border: none;
    padding: 0;
}
.msg-reply-btn:hover {
    background: #d0d0d0; /* Círculo mais escuro ao passar o mouse */
}

/* Mostra o botão de resposta ao passar o mouse */
.msg-wrapper:hover .msg-reply-btn {
    opacity: 1;
}

/* O Bloco de Citação (Mensagem Respondida) */
.msg-quote {
    background-color: rgba(0, 0, 0, 0.05);
    border-left: 3px solid #008a60;
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.msg-atendente .msg-quote {
    background-color: rgba(255, 255, 255, 0.15);
    border-left-color: #fff;
    color: #f0f0f0;
}

/* ==================================== */
/* (NOVO) ESTILO SELETOR SETOR NO HEADER
/* ==================================== */
.user-info #seletor-setor-atendente {
    margin-left: 8px;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid #ffffff; /* Borda branca sutil */
    background-color: transparent; /* Fundo transparente */
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.user-info #seletor-setor-atendente:hover {
    background-color: rgba(255, 255, 255, 0.1); /* Leve destaque ao passar o mouse */
}

/* Estilo das options (para o fundo escuro do dropdown) */
.user-info #seletor-setor-atendente option {
    color: #333;
    background-color: #fff;
}