/* Assistente Privia — floating widget */
.agente-widget { position: fixed; right: 20px; bottom: 20px; z-index: 9999; font-family: inherit; }
#ag-bubble {
    width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer; color: #fff;
    background: #1f4e8c; box-shadow: 0 4px 14px rgba(0,0,0,.28); display: flex; align-items: center; justify-content: center;
}
#ag-bubble:hover { background: #16375f; }
.ag-painel {
    position: absolute; right: 0; bottom: 64px; width: 360px; max-width: calc(100vw - 24px); height: 460px;
    background: #fff; border: 1px solid #d3d9e2; border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.22);
    display: flex; flex-direction: column; overflow: hidden;
}
.ag-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #1f4e8c; color: #fff; }
.ag-header strong { font-size: 14px; }
.ag-acoes { display: flex; align-items: center; gap: 2px; }
.ag-expandir {
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; border-radius: 6px; background: none; border: none;
    color: #fff; font-size: 15px; cursor: pointer; text-decoration: none; line-height: 1;
}
.ag-expandir:hover { background: rgba(255,255,255,.18); }
.ag-fechar { background: none; border: none; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; width: 24px; height: 24px; border-radius: 6px; }
.ag-fechar:hover { background: rgba(255,255,255,.18); }
.ag-body { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; background: #f5f7fa; }
.ag-msg { max-width: 86%; padding: 8px 10px; border-radius: 10px; font-size: 13px; line-height: 1.45; word-wrap: break-word; }
.ag-msg-texto { white-space: pre-wrap; word-wrap: break-word; overflow-x: auto; }
  .ag-msg-texto .ag-tabela { border-collapse: collapse; width: 100%; min-width: 360px; margin: 6px 0; font-size: 12px; }
  .ag-msg-texto .ag-tabela th, .ag-msg-texto .ag-tabela td { border: 1px solid #ccd4e0; padding: 4px 6px; text-align: left; word-wrap: break-word; }
  .ag-msg-texto .ag-tabela thead th { background: #1f4e8c; color: #fff; font-weight: 600; }
  .ag-msg-texto .ag-tabela tbody tr:nth-child(even) { background: #f4f6fa; }
  .ag-msg-texto .ag-tabela-padrao { table-layout: fixed; }
  .ag-msg-texto .ag-lista { margin: 4px 0 4px 18px; padding: 0; }
  .ag-msg-texto .ag-hr { border: 0; border-top: 1px solid #ccd4e0; margin: 8px 0; }
  .ag-msg-texto .ag-par { margin: 4px 0; }
  .ag-msg-texto .ag-mkd-h1, .ag-msg-texto .ag-mkd-h2, .ag-msg-texto .ag-mkd-h3, .ag-msg-texto .ag-mkd-h4 { margin: 8px 0 4px; font-weight: 600; color: #16406d; }
.ag-anexos { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ag-msg-usuario .ag-anexos { display: none; }
.ag-anexo {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 9px; border-radius: 8px; font-size: 12px; font-weight: 600;
    color: #16375f; text-decoration: none; background: #eef4fb; border: 1px solid #d2e0f2;
    transition: all .15s ease; max-width: 100%;
}
.ag-anexo:hover { background: #e0ecf9; border-color: #1f4e8c; text-decoration: none; }
.ag-msg-data { margin-top: 3px; font-size: 10px; opacity: 0.75; text-align: right; }
.ag-divisor-dia {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 92%;
    margin: 2px 0;
    font-size: 11px;
    color: #8a97ab;
}
.ag-divisor-dia::before,
.ag-divisor-dia::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #d4dbe6;
}
.ag-msg-usuario { align-self: flex-end; background: #1f4e8c; color: #fff; }
.ag-msg-agente { align-self: flex-start; background: #fff; border: 1px solid #e2e7ef; }
.ag-msg-sistema { align-self: flex-start; background: #eef2f7; color: #40506d; font-style: italic; }
.ag-erro { align-self: flex-start; background: #fdecea; color: #b02a2a; border: 1px solid #f3c3c0; }
.ag-rodape { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #e4e9f1; background: #fff; }
#ag-input {
    flex: 1; resize: none; border: 1px solid #cfd7e3; border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px;
    max-height: 96px;
}
#ag-input:focus { outline: none; border-color: #1f4e8c; }
.ag-voz {
    flex: 0 0 38px; width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #d5dce7; border-radius: 50%;
    background: #f4f7fb; color: #41506b; cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .2s ease, transform .1s ease;
}
.ag-voz svg { width: 18px; height: 18px; pointer-events: none; }
.ag-voz:hover { background: #e7eef7; border-color: #b9c8db; color: #1f4e8c; }
.ag-voz:active { transform: scale(.94); }
.ag-voz:focus-visible { outline: 2px solid #1f4e8c; outline-offset: 2px; }
.ag-voz.ag-voz-ativo {
    background: #c62828; border-color: #c62828; color: #fff;
    animation: ag-pulsar 1.2s ease-out infinite;
}
@keyframes ag-pulsar {
    0% { box-shadow: 0 0 0 0 rgba(198, 40, 40, .5); }
    100% { box-shadow: 0 0 0 10px rgba(198, 40, 40, 0); }
}
.ag-enviar {
    width: 40px; border: none; border-radius: 8px; background: #1f4e8c; color: #fff; cursor: pointer; font-size: 16px;
}
.ag-enviar:disabled { background: #aab6c6; cursor: not-allowed; }
.ag-loading { display: flex; align-items: center; justify-content: center; padding: 12px; }
.ag-spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid rgba(31,78,140,.18);
    border-top-color: #1f4e8c;
    animation: ag-girar 0.7s linear infinite;
}
@keyframes ag-girar { to { transform: rotate(360deg); } }
.ag-status { padding: 4px 12px; font-size: 11px; color: #6b7a90; min-height: 18px; }
.ag-status.ag-status-ativo { color: #1f7a3d; }
.ag-status.ag-status-erro { color: #b02a2a; }

.ag-feedback { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.ag-fb-botao {
    width: 26px; height: 26px; border: 1px solid #d3dbe6; border-radius: 50%; background: #fff;
    cursor: pointer; font-size: 13px; line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.ag-fb-botao:hover { border-color: #1f4e8c; background: #f0f5fc; }
.ag-fb-botao:disabled { opacity: 0.45; cursor: not-allowed; }
.ag-fb-correcao { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.ag-fb-correcao[hidden] { display: none; }
.ag-fb-texto {
    width: 100%; resize: vertical; border: 1px solid #cfd7e3; border-radius: 8px; padding: 6px 8px;
    font: inherit; font-size: 12px; box-sizing: border-box;
}
.ag-fb-texto:focus { outline: none; border-color: #1f4e8c; }
.ag-fb-enviar {
    align-self: flex-end; border: none; border-radius: 8px; background: #1f4e8c; color: #fff;
    padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.ag-fb-enviar:disabled { background: #aab6c6; cursor: not-allowed; }
.ag-fb-feito { opacity: 0.55; }