/* cartorio-agente.css — widget Lulinha/Bubu/Will — v20260617p */
.cartorio-agente-root { font-family: -apple-system, "Segoe UI", Roboto, sans-serif; }

/* bolha flutuante */
.cartorio-agente-bubble {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid #f0c75e;
  background: linear-gradient(135deg, #fff4d4 0%, #ffd76b 100%);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(0,0,0,.25);
  z-index: 99998;
  padding: 0;
  transition: transform .15s;
}
.cartorio-agente-bubble:hover { transform: scale(1.05); }
.cartorio-agente-bubble img { width: 52px; height: 52px; border-radius: 50%; }

/* painel */
.cartorio-agente-panel {
  width: 1140px;
  max-width: 95vw;
  height: 560px;
  max-height: 88vh;
  background: #1a1d24;
  color: #e6e9ef;
  border: 1px solid #353a44;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  flex-direction: column;
  z-index: 99999;
  overflow: hidden;
}

/* header */
.cartorio-agente-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 10px;
  background: linear-gradient(180deg, #232732 0%, #1a1d24 100%);
  border-bottom: 1px solid #353a44;
}
.cartorio-agente-header-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid #f0c75e;
  background: #fff4d4;
  flex-shrink: 0;
}
.cartorio-agente-header-name {
  font-weight: 600; color: #f5d77a;
  min-width: 56px;
  font-size: 13px;
}
.cartorio-agente-header-nome {
  flex: 1;
  font-size: 11px;
  color: #9aa4b3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 110px;
}
.cartorio-agente-tipo-select,
.cartorio-agente-agent-select {
  background: #2a2f3a;
  color: #e6e9ef;
  border: 1px solid #3a4050;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  cursor: pointer;
}
.cartorio-agente-tipo-select { max-width: 78px; }
.cartorio-agente-agent-select { max-width: 88px; }
.cartorio-agente-tipo-select option:disabled,
.cartorio-agente-agent-select option:disabled {
  color: #555;
}
.cartorio-agente-close {
  background: transparent; color: #888; border: none;
  font-size: 22px; cursor: pointer; padding: 0 4px;
}
.cartorio-agente-close:hover { color: #fff; }

/* botao minimizar (mesmo estilo do fechar) */
.cartorio-agente-min {
  background: transparent; color: #888; border: none;
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.cartorio-agente-min:hover { color: #fff; }

/* minimizado: mostra so a barra do topo (header), esconde o resto */
.cartorio-agente-panel.ca-collapsed .cartorio-agente-messages,
.cartorio-agente-panel.ca-collapsed .cartorio-agente-input-row,
.cartorio-agente-panel.ca-collapsed .cartorio-agente-att-bar {
  display: none !important;
}
.cartorio-agente-panel.ca-collapsed {
  height: auto !important;
  min-height: 0 !important;
  resize: none !important;
}

/* messages */
.cartorio-agente-messages {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #14171d;
}
.cartorio-agente-msg {
  margin: 6px 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  animation: caFade .15s;
}
@keyframes caFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.cartorio-agente-msg.user {
  justify-content: flex-end;
}
.cartorio-agente-msg.user .ca-msg-body {
  background: #2c5be8;
  color: #fff;
  border-radius: 12px 12px 4px 12px;
  padding: 8px 12px;
  max-width: 78%;
  word-break: break-word;
}
.cartorio-agente-msg.agente .ca-msg-body {
  background: #232732;
  color: #e6e9ef;
  border-radius: 12px 12px 12px 4px;
  padding: 8px 12px;
  max-width: 78%;
  word-break: break-word;
  white-space: pre-wrap;
}
.cartorio-agente-msg.system {
  justify-content: center;
  color: #6a7080;
  font-size: 11px;
  font-style: italic;
  margin: 8px 0;
}
.ca-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid #f0c75e;
  background: #fff4d4;
  flex-shrink: 0;
}
.ca-spinner {
  display: inline-block;
  width: 8px; height: 8px;
  background: #888;
  border-radius: 50%;
  animation: caBlink 1s infinite;
}
@keyframes caBlink { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* input row */
.cartorio-agente-input-row {
  display: flex;
  gap: 6px;
  padding: 8px;
  border-top: 1px solid #353a44;
  background: #1a1d24;
}
.cartorio-agente-input {
  flex: 1;
  background: #2a2f3a;
  color: #e6e9ef;
  border: 1px solid #3a4050;
  border-radius: 6px;
  padding: 6px 8px;
  resize: none;
  font-family: inherit;
  font-size: 13px;
}
.cartorio-agente-send {
  background: linear-gradient(135deg, #f0c75e 0%, #d4a82e 100%);
  color: #1a1d24;
  border: none;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 600;
  cursor: pointer;
}
.cartorio-agente-send:hover { filter: brightness(1.08); }

/* tool confirm */
.cartorio-agente-confirm {
  background: #2a2f3a;
  border: 1px solid #f0c75e;
  border-radius: 8px;
  padding: 8px;
  margin: 6px 0;
  font-size: 12px;
}
.cartorio-agente-confirm button {
  margin: 6px 4px 0 0;
  padding: 4px 10px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.cartorio-agente-confirm .cac-ok { background: #2c8a3a; color: #fff; }
.cartorio-agente-confirm .cac-no { background: #5a5a5a; color: #fff; }

/* toast */
.ca-toast {
  position: fixed;
  bottom: 100px;
  left: 24px;
  background: rgba(0,0,0,.85);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 99999;
  animation: caFade .2s;
}

/* anexos */
.cartorio-agente-clip, .cartorio-agente-cap {
  background: #2a2f3a;
  color: #f0c75e;
  border: 1px solid #3a4050;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.cartorio-agente-clip:hover, .cartorio-agente-cap:hover {
  background: #353a44;
  color: #fff;
}
.cartorio-agente-att-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  background: #14171d;
  border-top: 1px solid #353a44;
}
.ca-att-thumb {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #3a4050;
}
.ca-att-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.ca-att-rm {
  position: absolute;
  top: 0; right: 0;
  background: rgba(0,0,0,.7);
  color: #fff;
  border: none;
  width: 18px; height: 18px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 0 0 0 4px;
  line-height: 1;
}
.ca-user-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  margin: 4px 0;
  display: block;
  border: 1px solid #3a4050;
}
/* ---------- anexo PDF (espelho do DUT) ---------- */
.ca-att-pdf {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #e6e9ef;
  background: #2a3140;
  text-align: center;
}
.ca-user-pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  margin: 4px 0;
  padding: 6px 10px;
  border-radius: 6px;
  background: #2a3140;
  color: #e6e9ef;
  font-size: 12px;
  border: 1px solid #3a4050;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- modal de login CPF ---------- */
.cartorio-agente-login-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 14, .72);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: caFade .15s;
  backdrop-filter: blur(2px);
}
.cartorio-agente-login-modal .cal-box {
  width: min(380px, 92vw);
  background: #1a1d24;
  border: 1px solid #353a44;
  border-radius: 14px;
  padding: 24px 26px 22px;
  box-shadow: 0 24px 48px rgba(0,0,0,.55);
  color: #e6e9ef;
}
.cartorio-agente-login-modal .cal-title {
  font-size: 18px;
  font-weight: 700;
  color: #f5d77a;
  margin-bottom: 4px;
}
.cartorio-agente-login-modal .cal-sub {
  font-size: 12px;
  color: #9aa4b3;
  margin-bottom: 16px;
}
.cartorio-agente-login-modal .cal-input {
  width: 100%;
  background: #10131a;
  border: 1px solid #3a4050;
  color: #e6e9ef;
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 22px;
  letter-spacing: 4px;
  font-weight: 600;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cartorio-agente-login-modal .cal-input:focus {
  outline: none;
  border-color: #f0c75e;
  box-shadow: 0 0 0 2px rgba(240, 199, 94, .18);
}
.cartorio-agente-login-modal .cal-err {
  color: #ff8b8b;
  font-size: 12px;
  min-height: 16px;
  margin-top: 8px;
}
.cartorio-agente-login-modal .cal-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}
.cartorio-agente-login-modal .cal-ok,
.cartorio-agente-login-modal .cal-cancel {
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-weight: 700;
  cursor: pointer;
  font-size: 13px;
}
.cartorio-agente-login-modal .cal-ok {
  background: linear-gradient(135deg, #f0c75e 0%, #d4a82e 100%);
  color: #1a1d24;
}
.cartorio-agente-login-modal .cal-ok:disabled { opacity: .6; cursor: not-allowed; }
.cartorio-agente-login-modal .cal-cancel {
  background: #2a2f3a;
  color: #e6e9ef;
  border: 1px solid #3a4050;
}
.cartorio-agente-login-modal .cal-cancel:hover { background: #353a44; }

.cartorio-agente-login-tipo {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #2a2f3a;
  color: #e6e9ef;
  border: 1px solid #3a4050;
  border-radius: 6px;
  font-size: 14px;
}

.cartorio-agente-finalizar {
  background: #5a3a3a;
  color: #ffd0d0;
  border: 1px solid #8a4040;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  margin-right: 4px;
}
.cartorio-agente-finalizar:hover {
  background: #7a3030;
  color: #fff;
}


/* === Cards de arquivos dentro da bolha do agente === */
.ca-files-holder {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.ca-file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.ca-file-card:hover { background: rgba(255,255,255,.12); }
.ca-file-icon { font-size: 22px; }
.ca-file-name { font-weight: 600; font-size: 13px; }
.ca-file-sub { font-size: 11px; opacity: .7; }

/* === Popup full-screen com iframe === */
.ca-file-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.82);
  z-index: 100050;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.ca-file-popup-box {
  width: 90vw;
  height: 90vh;
  max-width: 1200px;
  background: #16181d;
  border: 1px solid #353a44;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ca-file-popup-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #20242c;
  border-bottom: 1px solid #2c313b;
}
.ca-file-popup-title {
  color: #f5d77a;
  font-weight: 600;
  font-size: 14px;
}
.ca-file-popup-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ca-file-popup-btn {
  background: #2c5be8;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
}
.ca-file-popup-btn-download { background: #1f7a3a; }
.ca-file-popup-btn:hover { filter: brightness(1.12); }
.ca-file-popup-close {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  padding: 0 6px;
}
.ca-file-popup-iframe {
  flex: 1;
  width: 100%;
  border: 0;
  background: #fff;
}


/* Bolha estilo balao de chat */
.cartorio-agente-bubble {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  width: 80px !important;
  height: 80px !important;
  padding: 0 !important;
  position: relative;
}
.ca-bubble-balao {
  width: 80px;
  height: 80px;
  display: block;
  transition: transform .15s;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,.35));
}
.cartorio-agente-bubble:hover .ca-bubble-balao {
  transform: scale(1.06) rotate(-3deg);
}
.ca-bubble-avatar {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: #fff;
}


/* Primeiro acesso - texto grande e explicativo */
.cartorio-agente-login-modal .cal-title-big {
  font-size: 26px;
  color: #ffd76b;
  text-align: center;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.cartorio-agente-login-modal .cal-sub-big {
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
  color: #e6e9ef;
  margin-bottom: 16px;
}
.cartorio-agente-login-modal .cal-sub-big b { color: #ffd76b; }

/* empurra os botoes do header pra direita (Finalizar/-/X sempre visiveis) */
.cartorio-agente-finalizar { margin-left: auto; }
.cartorio-agente-header-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 160px; }

/* bolha fechada: so o balao, sem a carinha do agente */
.ca-bubble-avatar { display: none !important; }
