/* Assistente Privia — página /agent/chat (view dentro do layout padrão: sidebar + header) */
.agente-widget--full {
    position: static;
    z-index: auto;
    flex: 1;
    height: 100%;
    display: flex;
    box-sizing: border-box;
}

.ag-voltar-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 15px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1f4e8c;
    text-decoration: none;
    border: 1px solid #d5deea;
    background: #fff;
    box-shadow: 0 1px 3px rgba(16, 33, 61, .07);
    transition: all .15s ease;
}
.ag-voltar-link:hover {
    background: #f0f5fc;
    border-color: #1f4e8c;
    color: #16375f;
    text-decoration: none;
}

.agent-chat-card {
    display: flex;
    height: calc(100vh - 200px);
    min-height: 420px;
    max-height: 920px;
    background: #fff;
    border: 1px solid #e8edf5;
    border-radius: 16px;
    box-shadow: 0 8px 28px rgba(16, 33, 61, .10);
    overflow: hidden;
}

.agent-chat-card .agente-widget--full .ag-painel {
    position: static;
    width: 100%;
    max-width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.agent-chat-card .agente-widget--full .ag-painel:not([hidden]) {
    display: flex;
}

/* Área das mensagens */
.agent-chat-card .agente-widget--full .ag-body {
    flex: 1;
    overflow-y: auto;
    padding: 22px 26px;
    gap: 10px;
    background: linear-gradient(180deg, #f7f9fc 0%, #f2f5fa 100%);
}

.agent-chat-card .agente-widget--full .ag-msg {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 15px;
    line-height: 1.55;
    box-shadow: 0 1px 4px rgba(16, 33, 61, .05);
}

.agent-chat-card .agente-widget--full .ag-msg-usuario {
    align-self: flex-end;
    background: linear-gradient(135deg, #1f4e8c 0%, #2a62b0 100%);
    color: #fff;
    border: none;
    border-radius: 14px 14px 4px 14px;
    box-shadow: 0 2px 8px rgba(31, 78, 140, .22);
}

.agent-chat-card .agente-widget--full .ag-msg-agente {
    background: #fff;
    border: 1px solid #e2e8f2;
    border-radius: 14px 14px 14px 4px;
}

.agent-chat-card .agente-widget--full .ag-msg-sistema {
    background: #e9eef7;
    border: none;
    border-radius: 20px;
    color: #40506d;
    padding: 10px 16px;
    box-shadow: none;
}

.agent-chat-card .agente-widget--full .ag-msg-texto {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.agent-chat-card .ag-msg-texto .ag-tabela {
    border-collapse: collapse;
    width: 100%;
    min-width: 360px;
    margin: 6px 0;
    font-size: 12px;
}
.agent-chat-card .ag-msg-texto .ag-tabela th,
.agent-chat-card .ag-msg-texto .ag-tabela td {
    border: 1px solid #ccd4e0;
    padding: 4px 6px;
    text-align: left;
    word-wrap: break-word;
}
.agent-chat-card .ag-msg-texto .ag-tabela thead th {
    background: #1f4e8c;
    color: #fff;
    font-weight: 600;
}
.agent-chat-card .ag-msg-texto .ag-tabela tbody tr:nth-child(even) {
    background: #f4f6fa;
}
/* larguras vêm do <colgroup> criado por padronizaLarguraTabelas (agent-chat-core.js) */
.agent-chat-card .ag-msg-texto .ag-tabela-padrao {
    table-layout: fixed;
}
.agent-chat-card .ag-msg-texto .ag-lista {
    margin: 4px 0 4px 18px;
    padding: 0;
}
.agent-chat-card .ag-msg-texto .ag-hr {
    border: 0;
    border-top: 1px solid #ccd4e0;
    margin: 8px 0;
}
.agent-chat-card .ag-msg-texto .ag-par {
    margin: 4px 0;
}
.agent-chat-card .ag-msg-texto .ag-mkd-h1,
.agent-chat-card .ag-msg-texto .ag-mkd-h2,
.agent-chat-card .ag-msg-texto .ag-mkd-h3,
.agent-chat-card .ag-msg-texto .ag-mkd-h4 {
    margin: 8px 0 4px;
    font-weight: 600;
    color: #16406d;
}

/* Anexos (arquivos gerados pelo agente) */
.agent-chat-card .agente-widget--full .ag-anexos {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}
.agent-chat-card .agente-widget--full .ag-msg-agente .ag-anexos {
    padding-top: 2px;
}
.agent-chat-card .agente-widget--full .ag-anexo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #16375f;
    text-decoration: none;
    background: #eef4fb;
    border: 1px solid #d2e0f2;
    transition: all .15s ease;
    max-width: 100%;
}
.agent-chat-card .agente-widget--full .ag-anexo:hover {
    background: #e0ecf9;
    border-color: #1f4e8c;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(31, 78, 140, .15);
}
.agent-chat-card .agente-widget--full .ag-msg-usuario .ag-anexos {
    display: none;
}

.agent-chat-card .agente-widget--full .ag-msg-data {
    font-size: 11px;
    opacity: .7;
}

/* Rodapé com entrada */
.agent-chat-card .agente-widget--full .ag-rodape {
    padding: 14px 18px;
    gap: 10px;
    background: #fff;
    border-top: 1px solid #eef2f8;
}

.agent-chat-card .agente-widget--full #ag-input {
    font-size: 15px;
    padding: 11px 14px;
    max-height: 140px;
    border-radius: 10px;
    border: 1px solid #d5deea;
    background: #fbfcfe;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.agent-chat-card .agente-widget--full #ag-input:focus {
    outline: none;
    border-color: #1f4e8c;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(31, 78, 140, .12);
}

.agent-chat-card .agente-widget--full .ag-enviar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1f4e8c 0%, #2a62b0 100%);
    box-shadow: 0 2px 8px rgba(31, 78, 140, .25);
    transition: transform .12s ease, box-shadow .12s ease;
}
.agent-chat-card .agente-widget--full .ag-enviar:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(31, 78, 140, .32);
}

.agent-chat-card .agente-widget--full .ag-status {
    font-size: 12px;
    padding: 8px 18px;
}

@media (max-width: 768px) {
    .agent-chat-card {
        height: calc(100vh - 180px);
        min-height: 300px;
        max-height: none;
    }
    .agent-chat-card .agent-chat-head { font-size: 20px; }
    .agent-chat-card .agente-widget--full .ag-body { padding: 14px; }
    .agent-chat-card .agente-widget--full .ag-msg { max-width: 92%; }
}