/* Painéis funil encomenda dentro do shell LP (#chat-log) */

.chat-panel--funnel {
  display: flex;
  flex-direction: column;
  max-width: min(100%, 520px);
  margin: 0 auto;
  min-height: 0;
}

.chat-panel--funnel .chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.chat-panel--funnel .chat-quick {
  flex-shrink: 0;
}

.chat-panel--funnel .chat-form {
  flex-shrink: 0;
}

.chat-panel--funnel .chat-msg--panel:has(.chat-pix-pay) {
  margin-bottom: 0.25rem;
}

main.chat-main:has(.chat-panel--funnel) {
  justify-content: flex-start;
  align-items: stretch;
  min-height: 0;
  flex: 1;
  width: 100%;
}

@media (max-width: 768px) {
  .chat-panel--funnel {
    margin: 0;
    border-radius: 8px;
  }

  .chat-panel--funnel .chat-quick {
    max-height: min(34vh, 240px);
  }

  body:has(.chat-panel--funnel) footer.chat-site-footer {
    font-size: 0.72rem;
  }

  #chat-log .chat-pix-pay {
    font-size: 0.78rem;
  }

  #chat-log .chat-pix-composicao-table {
    font-size: 0.75rem;
  }
}

@media (min-width: 769px) {
  main.chat-main:has(.chat-panel--funnel) {
    padding: 1rem 1.25rem 1rem 0;
  }

  .chat-panel--funnel {
    max-width: min(820px, 100%);
    min-height: min(720px, calc(100dvh - var(--header-h) - 7rem));
    max-height: calc(100dvh - var(--header-h) - 5.5rem);
  }

  .chat-panel--funnel .chat-log {
    flex: 1;
    max-height: none;
    min-height: 300px;
  }

  .chat-panel--funnel .chat-quick {
    max-height: min(36vh, 340px);
    overflow-y: auto;
  }
}

#chat-log .chat-msg--panel {
  max-width: 100%;
  width: 100%;
  align-self: stretch;
  padding: 0;
  background: transparent;
  border-radius: 0;
  line-height: 1.45;
}

#chat-log .chat-msg--panel .msg {
  margin: 0;
  max-width: 100%;
  box-sizing: border-box;
}

#chat-log .msg--dados-cartao {
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(0, 99, 153, 0.08) 0%, rgba(0, 49, 87, 0.04) 100%);
  border: 1px solid rgba(0, 49, 87, 0.14);
}

#chat-log .msg--dados-cartao__texto {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #1a2332;
}

#chat-log .msg-banner-alfandega {
  text-align: center;
  overflow: hidden;
  border-radius: 12px;
}

/* Painéis funil — centralizados no chat (loader, identidade, pagamento) */
#chat-log .chat-msg--bot:has(.co-id-verify) {
  align-self: center;
  max-width: min(100%, 440px);
  width: 100%;
  padding: 0.3rem 0.45rem;
  background: transparent;
}

#chat-log .co-funnel-panel.co-id-verify {
  width: 100%;
  box-sizing: border-box;
}

/* Verificação de identidade / processamento PIX */
#chat-log .co-id-verify--loading .co-id-loader,
#chat-log .co-id-verify--loading .chat-loader-wrap.co-id-loader {
  text-align: center;
  padding: 22px 18px;
  background: #fff;
  border: 1px solid #e8e4df;
  border-radius: 10px;
  margin: 0 auto;
}

#chat-log .chat-loader {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  border: 3px solid #e8e4df;
  border-top-color: #006399;
  border-radius: 50%;
  animation: co-spin-loader 0.85s linear infinite;
}

@keyframes co-spin-loader {
  to {
    transform: rotate(360deg);
  }
}

#chat-log .co-id-loader p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #003157;
}

#chat-log .co-id-loader .chat-loader-sub {
  display: block;
  margin: 8px auto 0;
  max-width: 320px;
  font-size: 12px;
  color: #72706e;
  line-height: 1.45;
  text-align: center;
}

#chat-log .co-id-progress {
  margin-top: 14px;
  height: 4px;
  background: #eceae6;
  border-radius: 999px;
  overflow: hidden;
}

#chat-log .co-id-progress-bar {
  display: block;
  height: 100%;
  width: 35%;
  background: linear-gradient(90deg, #006399, #ffd400);
  border-radius: 999px;
  animation: co-id-progress 2.8s ease-in-out forwards;
}

@keyframes co-id-progress {
  0% {
    width: 8%;
    margin-left: 0;
  }
  50% {
    width: 55%;
    margin-left: 20%;
  }
  100% {
    width: 100%;
    margin-left: 0;
  }
}

#chat-log .co-id-verify--success {
  width: 100%;
}

#chat-log .co-id-success-card {
  background: #fff;
  border: 1px solid #cfe8f5;
  border-radius: 10px;
  overflow: hidden;
  animation: co-id-success-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  box-shadow: 0 4px 16px rgba(0, 99, 153, 0.1);
  margin: 0 auto;
}

@keyframes co-id-success-in {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

#chat-log .co-pay-success-topbar {
  background: linear-gradient(90deg, #006399 0%, #0a7a3e 55%, #10b981 100%);
}

#chat-log .co-pay-success-badge {
  background: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}

#chat-log .co-pay-success-card {
  border-color: #a7f3d0;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
}

#chat-log .co-id-success-topbar {
  height: 3px;
  background: linear-gradient(90deg, #ffd400 0%, #006399 50%, #059669 100%);
}

#chat-log .co-id-success-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #ecfdf5;
  border-bottom: 1px solid #bbf7d0;
}

#chat-log .co-id-success-title {
  display: block;
  font-size: 14px;
  color: #065f46;
}

#chat-log .co-id-success-sub {
  display: block;
  font-size: 11px;
  color: #047857;
  margin-top: 2px;
}

#chat-log .co-id-success-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  border-bottom: 1px solid #eceae6;
}

#chat-log .co-id-success-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  font-size: 13px;
  border-bottom: 1px solid #f3f1ee;
}

#chat-log .co-id-success-item:last-child {
  border-bottom: none;
}

#chat-log .co-id-success-item span {
  color: #72706e;
  flex-shrink: 0;
}

#chat-log .co-id-success-item strong {
  color: #003157;
  text-align: right;
  word-break: break-word;
}

#chat-log .co-id-success-badge {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #065f46;
  background: #f0fdf4;
}

#chat-log .co-id-success-foot {
  padding: 8px 14px 10px;
  font-size: 11px;
  color: #72706e;
  background: #fafafa;
  border-top: 1px solid #eceae6;
}

#chat-log .co-id-success-foot strong {
  color: #003157;
}

#chat-log .etiqueta-banner-img,
#chat-log .etiqueta-encomenda-img {
  display: block;
  max-width: 100%;
  width: 100%;
  height: auto;
  max-height: min(42vh, 240px);
  object-fit: contain;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 49, 87, 0.12);
}

#chat-log .msg-encomenda .etiqueta-encomenda-wrap {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: 12px;
}

#chat-log .etiqueta-campo {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  color: #0d47a1;
  pointer-events: none;
  font-family: "Segoe Print", "Bradley Hand", cursive;
  line-height: 1.25;
}

#chat-log .etiqueta-encomenda-wrap--1 .etiqueta-campo-destinatario {
  top: 41.8%;
  left: 22.2%;
  right: 53.4%;
}

#chat-log .etiqueta-encomenda-wrap--1 .etiqueta-campo-dni {
  top: 49.3%;
  left: 26.6%;
  right: 56.7%;
}

#chat-log .etiqueta-encomenda-wrap--2 .etiqueta-campo {
  font-size: 11px;
  transform: rotate(-8deg);
}

#chat-log .etiqueta-encomenda-wrap--2 .etiqueta-campo-destinatario {
  top: 56.6%;
  left: 36.9%;
  right: 35.4%;
}

#chat-log .etiqueta-encomenda-wrap--3 .etiqueta-campo {
  font-size: 0.62rem;
}

#chat-log .etiqueta-encomenda-wrap--3 .etiqueta-campo-destinatario {
  top: 38%;
  left: 12%;
}

#chat-log .etiqueta-encomenda-wrap--3 .etiqueta-campo-dni {
  top: 52%;
  left: 12%;
}

#chat-log .etiqueta-encomenda-wrap--2 .etiqueta-campo-dni {
  top: 66.8%;
  left: 27.6%;
  right: 54.3%;
}

#chat-log .chat-msg--bot:has(.msg-comprovante) {
  align-self: center;
  max-width: min(100%, 400px);
  width: 100%;
  padding: 0.3rem 0.45rem;
  background: transparent;
}

#chat-log .msg-comprovante {
  width: 100%;
  margin-bottom: 0.35rem;
}

#chat-log .comprovante-oficial {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid #d8dee6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 49, 87, 0.07);
  font-size: 13px;
  line-height: 1.45;
}

#chat-log .comprovante-oficial strong {
  color: #1e293b;
  font-weight: 600;
}

#chat-log .comprovante-oficial .comprovante-doc-titulo {
  color: #003157;
  font-size: 14px;
}

#chat-log .comprovante-header-text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

#chat-log .comprovante-topbar {
  height: 3px;
  background: linear-gradient(90deg, #ffd400 0%, #006399 50%, #ffd400 100%);
}

#chat-log .comprovante-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #faf9f7;
  border-bottom: 1px solid #eceae6;
}

#chat-log .comprovante-logo {
  height: 20px;
  width: auto;
  max-width: 60px;
  flex-shrink: 0;
}

#chat-log .comprovante-doc-titulo {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #003157;
}

#chat-log .comprovante-doc-sub {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
}

#chat-log .comprovante-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-bottom: 1px solid #eceae6;
  background: #fafbfc;
}

#chat-log .comprovante-meta-item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 8px 14px;
  font-size: 12px;
  border-bottom: 1px solid #eceae6;
}

#chat-log .comprovante-meta-item:last-child {
  border-bottom: none;
}

#chat-log .comprovante-meta-item span {
  color: #64748b;
  font-size: 11px;
  flex-shrink: 0;
}

#chat-log .comprovante-meta-item strong {
  font-size: 12px;
  color: #0f172a;
  text-align: left;
  word-break: break-word;
  line-height: 1.35;
}

#chat-log .comprovante-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 14px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #92400e;
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
}

#chat-log .comprovante-status-badge .badge-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25);
}

#chat-log .comprovante-body {
  padding: 12px 14px 14px;
}

#chat-log .comprovante-section-title {
  margin: 14px 0 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #006399;
  padding-bottom: 4px;
  border-bottom: 1px solid #eef2f6;
}

#chat-log .comprovante-section-title:first-child {
  margin-top: 0;
}

#chat-log .comprovante-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid #f1f5f9;
}

#chat-log .comprovante-row:last-of-type {
  border-bottom: none;
}

#chat-log .comprovante-row span {
  color: #64748b;
  font-size: 12px;
}

#chat-log .comprovante-row strong {
  text-align: left;
  word-break: break-word;
  line-height: 1.35;
  color: #0f172a;
  font-size: 13px;
}

#chat-log .comprovante-rastreio-box {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: center;
}

#chat-log .comprovante-rastreio-box > span {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 8px;
}

#chat-log .comprovante-rastreio-codigo {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #003157;
  letter-spacing: 0.08em;
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace;
  line-height: 1.35;
  word-break: break-all;
}

#chat-log .comprovante-barcode {
  height: 20px;
  margin-top: 6px;
  opacity: 0.35;
  background: repeating-linear-gradient(
    90deg,
    #003157 0,
    #003157 2px,
    transparent 2px,
    transparent 5px
  );
}

#chat-log .comprovante-alert {
  padding: 8px 12px;
  font-size: 10px;
  line-height: 1.4;
  color: #991b1b;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
}

#chat-log .comprovante-alert strong {
  color: #b91c1c;
}

#chat-log .comprovante-footer {
  padding: 8px 14px;
  font-size: 10px;
  color: #8a8884;
  text-align: center;
  background: #fafafa;
  border-top: 1px solid #eceae6;
}

/* Resumo de remessa (leve — sem “documento oficial”) */
#chat-log .co-remessa-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8f9fb;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
}

#chat-log .co-remessa-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

#chat-log .co-remessa-card-num {
  font-weight: 600;
  color: #003157;
  font-size: 13px;
}

#chat-log .co-remessa-card-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
}

#chat-log .co-remessa-card-rast {
  margin: 0 0 6px;
  font-size: 13px;
}

#chat-log .co-remessa-card-rast strong {
  font-family: ui-monospace, "Cascadia Code", "Courier New", monospace;
  letter-spacing: 0.04em;
  color: #0f172a;
}

#chat-log .co-remessa-card-meta {
  margin: 0;
  font-size: 12px;
  color: #64748b;
}

#chat-log .co-remessa-card-meta strong {
  font-weight: 600;
  color: #475569;
}

#chat-log .resumo-taxa-oficial {
  background: #fff;
  border: 1px solid #e8e4df;
  border-radius: 8px;
  overflow: hidden;
}

#chat-log .resumo-taxa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #006399;
  color: #fff;
  font-size: 13px;
}

#chat-log .resumo-taxa-header strong,
#chat-log .resumo-taxa-header span {
  color: #fff;
}

#chat-log .resumo-taxa-linha {
  display: flex;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}

#chat-log .resumo-taxa-total {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  background: #f5f3f0;
  font-weight: 700;
  color: #003157;
  border-top: 2px solid #ffd400;
}

#chat-log .resumo-taxa-note {
  margin: 0;
  padding: 10px 16px;
  font-size: 11px;
  color: #72706e;
  background: #fafafa;
}

#chat-log .co-chat-audio {
  padding: 12px 14px;
  border-radius: 10px;
  background: #f8f7f5;
  border: 1px solid #e8e6e2;
}

#chat-log .co-chat-audio--only {
  padding: 6px 8px;
  background: transparent;
  border: none;
  max-width: 100%;
  position: relative;
  z-index: 2;
  margin-bottom: 6px;
}

#chat-log .co-chat-audio--only audio {
  width: min(280px, 100%);
  min-height: 40px;
  height: 36px;
  display: block;
  position: relative;
  z-index: 3;
  pointer-events: auto;
}

.chat-panel.is-busy #chat-log .co-chat-audio--only audio {
  pointer-events: auto;
}

#chat-log .chat-typing--recording .chat-typing-rec {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c0392b;
  flex-shrink: 0;
  animation: co-rec-pulse 1.1s ease-in-out infinite;
}

@keyframes co-rec-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.45;
    transform: scale(0.88);
  }
}

#chat-log .co-chat-audio-note {
  margin: 0 0 8px !important;
  font-size: 12px;
  color: #6e6e6e;
}

#chat-log .co-chat-audio p {
  margin: 0 0 8px;
  font-size: 13px;
}

@media (max-width: 400px) {
  #chat-log .comprovante-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  #chat-log .comprovante-row strong {
    text-align: left;
  }

  #chat-log .comprovante-meta-item strong {
    text-align: left;
  }
}

@media (max-width: 480px) {
  #chat-log .etiqueta-banner-img,
  #chat-log .etiqueta-encomenda-img {
    max-height: min(36vh, 200px);
  }
}
