/* ============================================================
   BRChina — Chat de cadastro (overlay)
   ============================================================ */
.chat-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(12, 36, 23, 0.45);
  backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.chat-overlay.open { opacity: 1; pointer-events: auto; }

.chat-panel {
  width: min(440px, 100%);
  height: min(680px, calc(100vh - 40px));
  background: var(--cream);
  border-radius: var(--r-lg);
  box-shadow: 0 30px 80px -20px rgba(8, 20, 13, 0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: translateY(24px) scale(0.98);
  transition: transform 0.4s var(--ease);
}
.chat-overlay.open .chat-panel { transform: none; }
@media (max-width: 560px) {
  .chat-overlay { padding: 0; }
  .chat-panel { width: 100%; height: 100%; border-radius: 0; }
}

/* ---- header ---- */
.chat-head {
  background: var(--green-dark); color: #fff;
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.chat-head .av {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 800; font-size: 1.05rem;
  position: relative; flex-shrink: 0;
}
.chat-head .av::after {
  content: ""; position: absolute; right: -1px; bottom: -1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #6ee59a; border: 2px solid var(--green-dark);
}
.chat-head .ch-name { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.chat-head .ch-sub { font-size: 0.78rem; color: #a8bdaf; }
.chat-head .ch-close {
  margin-left: auto; background: rgba(255,255,255,0.12); border: 0; color: #fff;
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 1.2rem;
  line-height: 1; transition: background 0.25s;
}
.chat-head .ch-close:hover { background: rgba(255,255,255,0.25); }

/* ---- progress ---- */
.chat-prog { height: 4px; background: rgba(12,36,23,0.08); flex-shrink: 0; }
.chat-prog .bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--green), #6ee59a);
  transition: width 0.5s var(--ease);
  border-radius: 0 4px 4px 0;
}

/* ---- thread ---- */
.chat-thread {
  flex: 1; overflow-y: auto;
  padding: 20px 18px 12px;
  display: flex; flex-direction: column; gap: 12px;
  scroll-behavior: smooth;
}
.msg { display: flex; flex-direction: column; max-width: 88%; }
.msg.bot { align-self: flex-start; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .bub {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.95rem; line-height: 1.5;
  animation: msgIn 0.35s var(--ease);
}
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg.bot .bub { background: #fff; border-bottom-left-radius: 6px; box-shadow: 0 4px 14px -6px rgba(21,33,26,0.12); }
.msg.user .bub { background: var(--green); color: #fff; border-bottom-right-radius: 6px; }
.msg .bub b { font-weight: 700; }
.msg .bub .hint { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.msg.user .edit-link {
  font-size: 0.75rem; color: var(--muted); margin-top: 4px; cursor: pointer;
  background: none; border: 0; font-family: var(--f-body); padding: 2px 4px;
}
.msg.user .edit-link:hover { color: var(--ink); text-decoration: underline; }

/* typing dots */
.typing { display: inline-flex; gap: 5px; padding: 14px 18px; }
.typing i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2);
  animation: tdot 1.1s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tdot { 0%, 60%, 100% { transform: none; opacity: 0.4; } 30% { transform: translateY(-5px); opacity: 1; } }

/* recap card */
.recap {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md);
  padding: 6px 16px; font-size: 0.9rem;
  animation: msgIn 0.35s var(--ease);
}
.recap .rrow {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
}
.recap .rrow:last-child { border-bottom: 0; }
.recap .rk { color: var(--muted); flex-shrink: 0; }
.recap .rv { font-weight: 700; text-align: right; }

/* esteira badge */
.lane-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-soft); color: var(--green-deep);
  border-radius: var(--r-pill); padding: 8px 14px;
  font-size: 0.85rem; font-weight: 700;
  animation: msgIn 0.35s var(--ease);
}
.lane-badge .d { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* ---- input dock ---- */
.chat-dock { padding: 12px 16px 16px; flex-shrink: 0; background: var(--cream); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--f-body); font-weight: 600; font-size: 0.9rem;
  background: #fff; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: 11px 18px; cursor: pointer;
  transition: all 0.22s var(--ease);
  animation: msgIn 0.4s var(--ease) backwards;
}
.chip:nth-child(2) { animation-delay: 0.06s; }
.chip:nth-child(3) { animation-delay: 0.12s; }
.chip:nth-child(4) { animation-delay: 0.18s; }
.chip:nth-child(5) { animation-delay: 0.24s; }
.chip:hover { border-color: rgba(21, 33, 26, 0.4); color: var(--ink); background: #fff; }
.chip.alt { border-style: dashed; color: var(--muted); }
.chip:disabled { opacity: 0.5; cursor: default; }

.chat-form { display: flex; gap: 8px; align-items: stretch; }
.chat-form input {
  flex: 1; font-family: var(--f-body); font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-pill);
  padding: 13px 20px; outline: none; min-width: 0;
  transition: border-color 0.25s;
}
.chat-form input:focus { border-color: var(--green); }
.chat-form.err input { border-color: var(--red); background: var(--red-soft); }
.chat-form .send {
  width: 50px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  transition: background 0.25s, transform 0.25s;
  flex-shrink: 0;
}
.chat-form .send:hover { background: var(--green-deep); transform: scale(1.05); }
.dock-err {
  font-size: 0.8rem; color: var(--red-deep); padding: 6px 8px 0;
  display: none;
}
.dock-err.show { display: block; animation: msgIn 0.3s var(--ease); }
.dock-skip {
  background: none; border: 0; font-family: var(--f-body);
  font-size: 0.82rem; color: var(--muted); cursor: pointer;
  padding: 8px 8px 0; text-decoration: underline;
}
.dock-skip:hover { color: var(--ink); }
