/* ==========================================================================
   Chat do assistente DMT12 — mesma linguagem do site: papel, grafite, um azul
   ========================================================================== */

.dchat { --dchat-w: 392px; position: fixed; right: 28px; bottom: 24px; z-index: 70; font-family: var(--f-sans); }

/* botão de abrir: uma "tecla" pequena */
.dchat__launcher {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 10px;
  border: 0; border-radius: 12px;
  background: var(--ink); color: var(--paper);
  box-shadow: 0 5px 0 #000, 0 18px 30px -14px rgba(20, 23, 28, .55);
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), opacity .3s;
}
.dchat__launcher:hover { transform: translateY(2px); box-shadow: 0 3px 0 #000, 0 14px 24px -14px rgba(20, 23, 28, .55); }
.dchat__launcher:active { transform: translateY(5px); box-shadow: 0 0 0 #000, 0 8px 14px -10px rgba(20, 23, 28, .5); }
.dchat__launcher:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
.dchat__cube {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--blue); border-radius: 8px;
}
.dchat__cube svg { width: 24px; height: 24px; --cube-top: #9BBBFF; --cube-left: #FFFFFF; --cube-right: #D6E2FF; }
.dchat__launch-text { display: flex; flex-direction: column; text-align: left; line-height: 1.15; }
.dchat__launch-text b { font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.dchat__launch-text small {
  font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10px; text-transform: uppercase; letter-spacing: .03em;
  color: rgba(236, 235, 230, .62); margin-top: 3px;
}
.dchat__online {
  position: absolute; left: 40px; top: 6px; width: 10px; height: 10px; border-radius: 50%;
  background: #3DDC84; box-shadow: 0 0 0 2px var(--ink);
}
.dchat[data-aberto="1"] .dchat__launcher { opacity: 0; pointer-events: none; transform: translateY(8px); }

/* convite discreto */
.dchat__teaser {
  position: absolute; right: 0; bottom: calc(100% + 14px);
  display: flex; align-items: flex-start; gap: 4px;
  width: 260px; padding: 12px 8px 12px 14px;
  background: var(--paper-3); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 18px 30px -20px rgba(20, 23, 28, .45);
  animation: dchat-in .45s var(--ease) both;
}
.dchat__teaser[hidden] { display: none; }
.dchat__teaser::after {
  content: ""; position: absolute; right: 28px; bottom: -7px; width: 12px; height: 12px;
  background: var(--paper-3); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.dchat__teaser-body { flex: 1; border: 0; background: none; padding: 0; text-align: left; font: 600 14px/1.35 var(--f-sans); color: inherit; cursor: pointer; }
.dchat__teaser-x { border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px; }

/* painel */
.dchat__panel {
  position: absolute; right: 0; bottom: 0;
  width: var(--dchat-w); height: min(640px, calc(100svh - 110px));
  display: flex; flex-direction: column;
  background: var(--paper-3); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -30px rgba(20, 23, 28, .55), 0 2px 0 rgba(20, 23, 28, .04);
  transform-origin: bottom right;
  animation: dchat-open .38s var(--ease) both;
}
.dchat__panel[hidden] { display: none; }
.dchat__panel::before, .dchat__panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 0 solid var(--blue); pointer-events: none;
}
.dchat__panel::before { left: -1px; top: -1px; border-left-width: 2px; border-top-width: 2px; }
.dchat__panel::after { right: -1px; bottom: -1px; border-right-width: 2px; border-bottom-width: 2px; }

@keyframes dchat-open { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes dchat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dchat__head {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
}
.dchat__kicker { color: var(--blue); margin: 0 0 6px; font-size: 10.5px; }
.dchat__head h2 { margin: 0; font-size: 20px; font-weight: 780; letter-spacing: -0.03em; line-height: 1.1; }
.dchat__sub { margin: 4px 0 0; font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.dchat__sub::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #2DBF6E; flex: none; }
.dchat__close {
  align-self: flex-start;
  width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; color: var(--ink-2);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 3px;
}
.dchat__close:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.dchat__log {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 18px 16px 8px;
  display: flex; flex-direction: column; gap: 6px;
  background-image:
    linear-gradient(var(--line-2) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-2) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: local;
}

.dchat__msg {
  max-width: 86%;
  padding: 10px 13px;
  font-size: 15px; line-height: 1.45;
  overflow-wrap: anywhere;
  animation: dchat-in .3s var(--ease) both;
}
.dchat__msg--agente { align-self: flex-start; background: #FFFFFF; border: 1px solid var(--line); border-radius: 2px 12px 12px 12px; }
.dchat__msg--cliente { align-self: flex-end; background: var(--ink); color: var(--paper); border-radius: 12px 2px 12px 12px; }
.dchat__msg--agente + .dchat__msg--agente, .dchat__msg--cliente + .dchat__msg--cliente { margin-top: -2px; }
.dchat__msg--cliente + .dchat__msg--agente, .dchat__msg--agente + .dchat__msg--cliente { margin-top: 10px; }
.dchat__msg strong { font-weight: 700; }
.dchat__msg a { color: var(--blue); }
.dchat__msg--cliente a { color: #A9C3FF; }
.dchat__msg--erro { border-color: #E3B7AE; background: #FFF4F1; }

/* "digitando…": três teclinhas azuis */
.dchat__typing {
  align-self: flex-start;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px;
  background: #FFFFFF; border: 1px solid var(--line); border-radius: 2px 12px 12px 12px;
  font-family: var(--f-mono); font-stretch: 87.5%; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-3);
}
.dchat__typing i { display: inline-block; width: 7px; height: 7px; background: var(--blue); animation: dchat-key 1.1s ease-in-out infinite; }
.dchat__typing i:nth-child(2) { animation-delay: .15s; }
.dchat__typing i:nth-child(3) { animation-delay: .3s; }
.dchat__typing span { display: flex; gap: 4px; }
@keyframes dchat-key { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }

.dchat__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 16px 12px; }
.dchat__chips:empty { display: none; }
.dchat__chip {
  padding: 7px 11px; border: 1px solid var(--line); background: #FFFFFF; color: var(--ink-2);
  font: 500 13px/1.2 var(--f-sans); cursor: pointer; border-radius: 999px;
  transition: border-color .2s, color .2s, background .2s;
}
.dchat__chip:hover { border-color: var(--blue); color: var(--blue); }

.dchat__form {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 12px 10px;
  border-top: 1px solid var(--line);
  background: var(--paper-3);
}
.dchat__form textarea {
  flex: 1; resize: none; max-height: 120px;
  padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #FFFFFF; color: var(--ink);
  font: 15px/1.4 var(--f-sans);
}
.dchat__form textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31, 95, 224, .14); }
.dchat__send {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: 8px; background: var(--blue); color: #fff; cursor: pointer;
  box-shadow: 0 3px 0 var(--blue-deep);
  transition: transform .12s, box-shadow .12s, opacity .2s;
}
.dchat__send:active { transform: translateY(3px); box-shadow: 0 0 0 var(--blue-deep); }
.dchat__send:disabled { opacity: .45; cursor: default; }

.dchat__foot {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 0 14px 12px;
  font-size: 9.5px; color: var(--ink-3);
}
.dchat__foot a { color: var(--blue); text-decoration: none; white-space: nowrap; }
.dchat__foot a:hover { text-decoration: underline; }

/* a régua lateral fica atrás do chat */
@media (min-width: 1101px) { .dchat { right: 40px; } }

/* abre espaço no palco para o botão do chat não cobrir legendas */
.tem-chat .hero__foot { padding-right: 230px; }
.tem-chat .figcap { bottom: 96px; }
@media (max-width: 860px) {
  .tem-chat .hero__foot { padding-right: 64px; }
}

@media (max-width: 860px) {
  .dchat { right: 14px; bottom: 14px; }
  .dchat__launcher { padding: 8px; border-radius: 12px; }
  .dchat__launch-text { display: none; }
  .dchat__online { left: auto; right: -3px; top: -3px; }
  .dchat__teaser { width: min(260px, calc(100vw - 40px)); }
  .dchat[data-aberto="1"] { inset: 0; right: 0; bottom: 0; }
  .dchat[data-aberto="1"] .dchat__launcher, .dchat[data-aberto="1"] .dchat__teaser { display: none; }
  .dchat__panel { position: fixed; inset: 0; width: auto; height: 100%; height: 100dvh; border: 0; }
  .dchat__msg { font-size: 15.5px; }
}

.reduced .dchat__panel, .reduced .dchat__msg, .reduced .dchat__teaser { animation: none; }
.reduced .dchat__typing i { animation: none; opacity: .8; }

.dchat__foot span a { color: var(--blue); }
