/* PMeLa chat widget */
.pmela, .pmela-launcher {
  --pmela-accent: #2b7a78;
  --pmela-ink: #1d2327;
  --pmela-muted: #5f6b73;
  --pmela-line: #dfe4e8;
  --pmela-bg: #ffffff;
  --pmela-soft: #f3f6f8;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--pmela-ink);
  box-sizing: border-box;
}
.pmela *, .pmela *::before, .pmela *::after { box-sizing: border-box; }

.pmela {
  display: flex;
  flex-direction: column;
  background: var(--pmela-bg);
  border: 1px solid var(--pmela-line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(16, 24, 40, .08);
}
.pmela[hidden] { display: none; }
.pmela--inline {
  /* Fill the content column and the visible screen height (minus the site header). */
  width: 100%;
  max-width: var(--pmela-width, none);
  height: var(--pmela-height, calc(100vh - 150px));
  height: var(--pmela-height, calc(100dvh - 150px));
  min-height: 440px;
  max-height: 1000px;
  margin: 0 auto 1.5em;
}

.pmela__head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--pmela-accent);
  color: #fff;
}
.pmela__avatar {
  flex: 0 0 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .18);
  border: 2px solid rgba(255, 255, 255, .55);
  font-weight: 700; font-size: 17px; letter-spacing: .5px;
}
.pmela__who { flex: 1 1 auto; min-width: 0; }
.pmela__name { font-weight: 700; font-size: 16px; line-height: 1.2; }
.pmela__tag { font-size: 12.5px; opacity: .88; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmela__reset, .pmela__close {
  background: rgba(255, 255, 255, .14); color: #fff; border: 0; cursor: pointer;
  border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; line-height: 1.2;
}
.pmela__close { font-size: 20px; padding: 2px 10px; }
.pmela__reset:hover, .pmela__close:hover { background: rgba(255, 255, 255, .26); }
.pmela__reset:focus-visible, .pmela__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.pmela__log { flex: 1 1 auto; overflow-y: auto; padding: 16px 14px 8px; background: var(--pmela-bg); scroll-behavior: smooth; }
.pmela__msg { display: flex; margin: 0 0 12px; }
.pmela__msg--user { justify-content: flex-end; }
.pmela__bubble {
  max-width: min(86%, 46rem); /* keep lines readable on wide screens */
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--pmela-soft);
  overflow-wrap: anywhere;
}
.pmela__msg--assistant .pmela__bubble { border-top-left-radius: 4px; }
.pmela__msg--user .pmela__bubble {
  background: var(--pmela-accent); color: #fff; border-top-right-radius: 4px; white-space: pre-wrap;
}
.pmela__bubble p { margin: 0 0 .6em; }
.pmela__bubble p:last-child, .pmela__bubble ul:last-child, .pmela__bubble ol:last-child { margin-bottom: 0; }
.pmela__bubble ul, .pmela__bubble ol { margin: 0 0 .6em; padding-left: 1.25em; }
.pmela__bubble li > ul { margin: .3em 0 0; }
.pmela__bubble li { margin: 0 0 .35em; }
.pmela__bubble a { color: var(--pmela-accent); text-decoration: underline; text-underline-offset: 2px; word-break: break-word; }
.pmela__bubble strong { font-weight: 650; }

.pmela__dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.pmela__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--pmela-muted); opacity: .35; animation: pmela-blink 1.2s infinite; }
.pmela__dots i:nth-child(2) { animation-delay: .2s; }
.pmela__dots i:nth-child(3) { animation-delay: .4s; }
.pmela__status { margin-left: 10px; color: var(--pmela-muted); font-size: 13px; }
@keyframes pmela-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pmela__dots i { animation: none; opacity: .6; } .pmela__log { scroll-behavior: auto; } }

.pmela__starters { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 14px 12px; }
.pmela__starters[hidden] { display: none; }
.pmela__chip {
  border: 1px solid var(--pmela-line); background: #fff; color: var(--pmela-ink);
  border-radius: 999px; padding: 7px 12px; font: inherit; font-size: 13.5px; line-height: 1.3;
  cursor: pointer; text-align: left;
}
.pmela__chip:hover { border-color: var(--pmela-accent); color: var(--pmela-accent); }
.pmela__chip:focus-visible { outline: 2px solid var(--pmela-accent); outline-offset: 2px; }

.pmela__form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; border-top: 1px solid var(--pmela-line); background: #fff; }
.pmela__input {
  flex: 1 1 auto; resize: none; min-height: 42px; max-height: 140px;
  border: 1px solid var(--pmela-line); border-radius: 10px; padding: 10px 12px;
  font: inherit; color: var(--pmela-ink); background: #fff; line-height: 1.4;
}
.pmela__input:focus { outline: none; border-color: var(--pmela-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pmela-accent) 18%, transparent); }
.pmela__send {
  flex: 0 0 auto; height: 42px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--pmela-accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer;
}
.pmela__send:disabled { opacity: .55; cursor: default; }
.pmela__send:focus-visible { outline: 2px solid var(--pmela-ink); outline-offset: 2px; }
.pmela__foot { padding: 0 14px 10px; font-size: 11.5px; color: var(--pmela-muted); background: #fff; }

/* Floating bubble */
.pmela--bubble {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  width: 390px; height: min(640px, calc(100vh - 40px));
}
.pmela-launcher {
  position: fixed; right: 20px; bottom: 20px; z-index: 99999;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 8px; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--pmela-accent); color: #fff; font-weight: 600;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .22);
}
.pmela-launcher[hidden] { display: none; }
.pmela-launcher__dot {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .6); font-weight: 700;
}
.pmela-launcher:focus-visible { outline: 3px solid var(--pmela-ink); outline-offset: 3px; }

@media (max-width: 520px) {
  .pmela--bubble { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .pmela--inline { height: var(--pmela-height, calc(100dvh - 90px)); min-height: 420px; border-radius: 10px; }
  .pmela__tag { display: none; }
  .pmela__bubble { max-width: 92%; }
  .pmela-launcher { right: 14px; bottom: 14px; }
}

/* Link button with a teaser message */
.pmela-teaser { position: fixed; right: 20px; bottom: 20px; z-index: 99998; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; font-family: inherit; }
.pmela-teaser[hidden] { display: none; }
.pmela-teaser .pmela-launcher { position: static; text-decoration: none; }
.pmela-teaser__msg {
  position: relative; display: flex; align-items: center; gap: 6px;
  max-width: 260px; padding: 10px 12px 10px 14px;
  background: #fff; color: #1d2327; border-radius: 12px; border-bottom-right-radius: 4px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18); font-size: 15px; line-height: 1.35;
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s ease;
}
.pmela-teaser--show .pmela-teaser__msg { opacity: 1; transform: none; }
.pmela-teaser__msg[hidden] { display: none; }
.pmela-teaser__msg a { color: inherit; text-decoration: none; }
.pmela-teaser__msg a:hover { color: var(--pmela-accent); }
.pmela-teaser__x { border: 0; background: transparent; color: #5f6b73; font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.pmela-teaser__x:hover { background: #f3f6f8; }
@media (prefers-reduced-motion: reduce) { .pmela-teaser__msg { transition: none; } }
@media (max-width: 520px) {
  .pmela-teaser { right: 14px; bottom: 14px; }
  .pmela-teaser__msg { max-width: 220px; font-size: 14px; }
}
