/* DimeWell Assistant - chat bubble. Uses the site's design tokens when present. */
.dwc {
  --c-brand: var(--dw-brand, #008751);
  --c-brand-dark: var(--dw-brand-dark, #006b40);
  --c-ink: var(--dw-ink, #1a202c);
  --c-muted: var(--dw-muted, #5b6676);
  --c-line: var(--dw-line, #e2e8f0);
  --c-surface: var(--dw-surface, #ffffff);
  --c-soft: var(--dw-surface-2, #f4f6f8);
  position: fixed; right: 20px; bottom: 20px; z-index: 1040;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--c-ink);
}
.dwc[hidden], .dwc [hidden] { display: none !important; }

.dwc__launcher {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 18px;
  background: var(--c-brand); color: #fff; font-weight: 600; font-size: 15px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .22); cursor: pointer;
}
.dwc__launcher:hover { background: var(--c-brand-dark); }
.dwc__launcher:focus-visible, .dwc__icon-btn:focus-visible, .dwc__send:focus-visible,
.dwc__chip:focus-visible, .dwc__fb:focus-visible { outline: 3px solid #f6c445; outline-offset: 2px; }
.dwc__svg { display: block; flex: 0 0 auto; }
.dwc .visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.dwc.is-open .dwc__launcher { display: none; }

.dwc__panel {
  display: flex; flex-direction: column;
  width: 380px; max-width: calc(100vw - 24px); height: 560px; max-height: calc(100vh - 40px);
  background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .28); overflow: hidden;
}
.dwc__panel[hidden] { display: none; }

.dwc__head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 8px;
  padding: 14px 14px 12px 16px; background: var(--c-brand); color: #fff;
}
.dwc__title { margin: 0; font-family: inherit; font-size: 16px; font-weight: 700; line-height: 1.2; color: #fff; }
.dwc__sub { margin: 4px 0 0; font-size: 12px; line-height: 1.35; opacity: .92; }
.dwc__head-actions { display: flex; gap: 2px; }
.dwc__icon-btn {
  width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent;
  color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.dwc__icon-btn:hover { background: rgba(255, 255, 255, .18); }

.dwc__log { flex: 1 1 auto; overflow-y: auto; padding: 14px; background: var(--c-soft); }
.dwc__row { display: flex; flex-direction: column; margin-bottom: 10px; }
.dwc__row--user { align-items: flex-end; }
.dwc__bubble {
  max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.dwc__row--bot .dwc__bubble { background: var(--c-surface); border: 1px solid var(--c-line); border-bottom-left-radius: 4px; }
.dwc__row--user .dwc__bubble { background: var(--c-brand); color: #fff; border-bottom-right-radius: 4px; }
.dwc__bubble a { color: inherit; text-decoration: underline; }

.dwc__fbrow { display: flex; gap: 4px; margin: 3px 0 0 4px; }
.dwc__fb {
  border: 0; background: transparent; color: var(--c-muted); cursor: pointer;
  padding: 3px 6px; border-radius: 6px; display: inline-flex; align-items: center;
}
.dwc__fb:hover { background: var(--c-line); }
.dwc__fb.is-on { color: var(--c-brand); }

.dwc__typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.dwc__typing span {
  width: 7px; height: 7px; border-radius: 50%; background: #9aa5b4; animation: dwcBlink 1.2s infinite;
}
.dwc__typing span:nth-child(2) { animation-delay: .2s; }
.dwc__typing span:nth-child(3) { animation-delay: .4s; }
@keyframes dwcBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.dwc__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; background: var(--c-surface); }
.dwc__chips:empty { display: none; }
.dwc__chip {
  border: 1px solid var(--c-brand); color: var(--c-brand); background: var(--c-surface);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.dwc__chip:hover { background: var(--c-brand); color: #fff; }

.dwc__form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; background: var(--c-surface); }
.dwc__input {
  flex: 1 1 auto; resize: none; max-height: 110px; padding: 9px 12px; font: inherit; font-size: 14.5px;
  border: 1px solid var(--c-line); border-radius: 12px; background: var(--c-surface); color: var(--c-ink);
}
.dwc__input:focus { outline: 2px solid var(--c-brand); outline-offset: 0; border-color: var(--c-brand); }
.dwc__send {
  flex: 0 0 auto; width: 42px; height: 42px; border: 0; border-radius: 12px;
  background: var(--c-brand); color: #fff; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.dwc__send:hover { background: var(--c-brand-dark); }
.dwc__send:disabled, .dwc__input:disabled { opacity: .55; cursor: not-allowed; }
.dwc__foot { margin: 0; padding: 0 14px 10px; font-size: 11.5px; color: var(--c-muted); background: var(--c-surface); }

@media (max-width: 575.98px) {
  .dwc { right: 12px; bottom: 12px; }
  .dwc__launcher-label { display: none; }
  .dwc__launcher { padding: 14px; }
  .dwc.is-open { right: 0; bottom: 0; left: 0; }
  .dwc__panel { width: 100vw; max-width: 100vw; height: 86vh; max-height: 86vh; border-radius: 16px 16px 0 0; }
}
@media (prefers-reduced-motion: reduce) { .dwc__typing span { animation: none; opacity: .7; } }
@media print { .dwc { display: none !important; } }
