/* DND AI widgets — public + dashboard */

.dnd-support-widgets {
  --dnd-chat-z: 2147483000;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: var(--dnd-chat-z);
}

.dnd-whatsapp-widget,
.dnd-chat-launcher,
.dnd-chat-panel {
  pointer-events: auto;
}

body.dnd-chat-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  left: 0;
  right: 0;
}

.dnd-whatsapp-widget {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: calc(var(--dnd-chat-z) + 1);
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  background: #25d366;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 10px 28px rgba(37, 211, 102, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dnd-whatsapp-widget:hover {
  color: #fff;
  transform: translateY(-2px);
}

.dnd-chat-launcher {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: calc(var(--dnd-chat-z) + 2);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: #082f75;
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.2s ease;
}

.dnd-chat-launcher:hover {
  transform: translateY(-2px);
}

.dnd-chat-launcher__bubble {
  display: flex;
  flex-shrink: 0;
  line-height: 0;
  filter: drop-shadow(0 10px 22px rgba(8, 47, 117, 0.28));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.dnd-chat-launcher:hover .dnd-chat-launcher__bubble {
  transform: scale(1.04);
  filter: drop-shadow(0 12px 26px rgba(8, 47, 117, 0.34));
}

.dnd-chat-launcher__label {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: #fff;
  color: #082f75;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 18px rgba(8, 47, 117, 0.14);
  border: 1px solid rgba(8, 47, 117, 0.08);
}

/* Robot bubble icon */
.dnd-ai-bot-icon--solid .dnd-ai-bot-icon__bubble {
  fill: #2563eb;
}

.dnd-ai-bot-icon--solid .dnd-ai-bot-icon__smile {
  stroke: #2563eb;
}

.dnd-ai-bot-icon--outline {
  color: #2563eb;
}

html.dark .dnd-ai-bot-icon--solid .dnd-ai-bot-icon__bubble {
  fill: #0f172a;
}

html.dark .dnd-ai-bot-icon--solid .dnd-ai-bot-icon__smile {
  stroke: #0f172a;
}

html.dark .dnd-ai-bot-icon--outline {
  color: #e2e8f0;
}

html.dark .dnd-chat-launcher__label {
  background: #1e293b;
  color: #f8fafc;
  border-color: rgba(248, 250, 252, 0.1);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

html.dark .dnd-chat-launcher {
  color: #f8fafc;
}

.dnd-chat-panel {
  position: fixed;
  right: 1rem;
  bottom: 5rem;
  z-index: calc(var(--dnd-chat-z) + 3);
  width: min(24rem, calc(100vw - 2rem));
  height: min(34rem, calc(100vh - 6rem));
  max-height: calc(100vh - 6rem);
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(8, 47, 117, 0.12);
  border-radius: 1.1rem;
  box-shadow: 0 20px 50px rgba(8, 47, 117, 0.2);
  overflow: hidden;
}

.dnd-chat-panel[hidden] {
  display: none !important;
}

.dnd-chat-panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, rgba(8, 47, 117, 0.08), rgba(183, 6, 27, 0.05));
  border-bottom: 1px solid rgba(8, 47, 117, 0.08);
  flex-shrink: 0;
}

.dnd-chat-panel__head-main {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.dnd-chat-panel__ai-mark {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.dnd-chat-panel__eyebrow {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
}

.dnd-chat-panel__title {
  margin: 0;
  font-size: 0.98rem;
  color: #082f75;
}

.dnd-chat-panel__close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: #64748b;
  cursor: pointer;
}

.dnd-chat-metrics {
  flex-shrink: 0;
  padding: 0.65rem 0.75rem 0;
  border-bottom: 1px solid rgba(8, 47, 117, 0.06);
  max-height: 9rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.dnd-chat-metrics__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.dnd-chat-metrics__chip {
  background: #f8fafc;
  border: 1px solid rgba(8, 47, 117, 0.08);
  border-radius: 0.65rem;
  padding: 0.4rem 0.55rem;
}

.dnd-chat-metrics__chip span {
  display: block;
  font-size: 0.68rem;
  color: #64748b;
}

.dnd-chat-metrics__chip strong {
  font-size: 0.95rem;
  color: #082f75;
}

.dnd-chat-finance__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #082f75;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dnd-chat-finance__toggle {
  border: none;
  background: transparent;
  color: #082f75;
  cursor: pointer;
  padding: 0.15rem;
  border-radius: 0.35rem;
}

.dnd-chat-finance__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.dnd-chat-finance__grid div {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 0.55rem;
  padding: 0.35rem 0.45rem;
}

.dnd-chat-finance__grid span {
  display: block;
  font-size: 0.62rem;
  color: #9a3412;
}

.dnd-chat-finance__grid strong {
  font-size: 0.82rem;
  color: #7c2d12;
}

.dnd-chat-finance__grid--masked strong {
  letter-spacing: 0.12em;
  color: #94a3b8;
}

.dnd-chat-panel__messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: #f8fafc;
}

.dnd-chat-bubble {
  max-width: 92%;
  padding: 0.7rem 0.85rem;
  border-radius: 0.9rem;
  font-size: 0.88rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.dnd-chat-bubble--bot {
  align-self: flex-start;
  background: #fff;
  border: 1px solid rgba(8, 47, 117, 0.1);
  color: #1e293b;
}

.dnd-chat-bubble--bot a {
  color: #082f75;
  font-weight: 600;
  text-decoration: underline;
  word-break: break-all;
}

.dnd-chat-bubble--bot a:hover {
  color: #b7061b;
}

.dnd-chat-bubble--user {
  align-self: flex-end;
  background: #082f75;
  color: #fff;
}

.dnd-chat-bubble--typing {
  color: #64748b;
  font-style: italic;
}

.dnd-chat-bubble--actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: transparent;
  border: none;
  padding: 0;
}

.dnd-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-self: flex-start;
  max-width: 100%;
}

.dnd-chat-suggestions__label {
  width: 100%;
  font-size: 0.68rem;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.1rem;
}

.dnd-chat-suggestion {
  border: 1px solid rgba(8, 47, 117, 0.18);
  background: #fff;
  color: #082f75;
  border-radius: 999px;
  padding: 0.38rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.dnd-chat-suggestion:hover {
  background: rgba(8, 47, 117, 0.06);
  border-color: rgba(8, 47, 117, 0.35);
}

.dnd-chat-whatsapp-cta,
.dnd-chat-mail-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.dnd-chat-whatsapp-cta {
  background: #25d366;
  color: #fff !important;
}

.dnd-chat-mail-cta {
  background: #082f75;
  color: #fff !important;
}

.dnd-chat-panel__form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid rgba(8, 47, 117, 0.08);
  background: #fff;
  flex-shrink: 0;
}

.dnd-chat-panel__form textarea {
  resize: none;
  border: 1px solid rgba(8, 47, 117, 0.15);
  border-radius: 0.75rem;
  padding: 0.65rem 0.75rem;
  font: inherit;
  min-height: 2.75rem;
  max-height: 6rem;
}

.dnd-chat-panel__send {
  border: none;
  border-radius: 0.75rem;
  padding: 0 1rem;
  background: #b7061b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.dnd-chat-panel__foot {
  margin: 0;
  padding: 0 0.75rem 0.75rem;
  font-size: 0.7rem;
  color: #64748b;
  background: #fff;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.dnd-support-widgets--public .dnd-chat-launcher {
  bottom: 6.25rem;
  right: 1rem;
}

.dnd-support-widgets--public .dnd-chat-panel {
  bottom: 11.25rem;
}

.dnd-support-widgets--dashboard .dnd-chat-launcher {
  bottom: 1.25rem;
  right: 1.25rem;
}

@media (max-width: 480px) {
  .dnd-whatsapp-widget__text,
  .dnd-chat-launcher__label {
    display: none;
  }

  .dnd-whatsapp-widget {
    width: 3.35rem;
    height: 3.35rem;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  .dnd-chat-launcher {
    width: auto;
    height: auto;
    padding: 0;
    justify-content: center;
    border-radius: 0;
  }

  .dnd-chat-launcher__bubble .dnd-ai-bot-icon {
    width: 3.35rem !important;
    height: auto !important;
  }

  .dnd-chat-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: 4.5rem;
    height: min(32rem, calc(100vh - 5.5rem));
  }

  .dnd-support-widgets--public .dnd-chat-launcher {
    bottom: 5.25rem;
  }

  .dnd-support-widgets--public .dnd-chat-panel {
    bottom: 9.5rem;
    height: min(30rem, calc(100vh - 10.5rem));
  }
}
