:root {
  --protolin-navy: #103b72;
  --protolin-blue: #1976bd;
  --protolin-cyan: #29b8d6;
  --protolin-ink: #142033;
  --protolin-muted: #65758b;
  --protolin-border: #dce4ee;
  --protolin-bg: #f5f8fc;
  --protolin-white: #fff;
}

.protolin-ai,
.protolin-ai * {
  box-sizing: border-box;
}

.protolin-ai {
  position: fixed;
  right: max(22px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 2147483000;
  color: var(--protolin-ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

.protolin-ai__invite {
  position: absolute;
  right: 0;
  bottom: calc(100% + 11px);
  display: grid;
  width: max-content;
  max-width: min(280px, calc(100vw - 28px));
  gap: 1px;
  padding: 11px 15px;
  border: 1px solid rgba(16, 59, 114, .14);
  border-radius: 15px;
  color: var(--protolin-ink);
  background: var(--protolin-white);
  box-shadow: 0 12px 34px rgba(20, 32, 51, .18);
  cursor: pointer;
  font: inherit;
  line-height: 1.28;
  text-align: left;
  animation: protolin-ai-invite-in .28s ease-out;
}

.protolin-ai__invite::after {
  position: absolute;
  right: 24px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-right: 1px solid rgba(16, 59, 114, .14);
  border-bottom: 1px solid rgba(16, 59, 114, .14);
  background: var(--protolin-white);
  content: "";
  transform: rotate(45deg);
}

.protolin-ai__invite span {
  color: var(--protolin-muted);
  font-size: 13px;
}

.protolin-ai__invite strong {
  color: var(--protolin-navy);
  font-size: 15px;
  font-weight: 750;
}

.protolin-ai__invite:hover,
.protolin-ai__invite:focus-visible {
  border-color: rgba(41, 184, 214, .55);
  outline: 3px solid rgba(41, 184, 214, .2);
  outline-offset: 2px;
}

.protolin-ai[data-open="true"] .protolin-ai__invite {
  display: none;
}

@keyframes protolin-ai-invite-in {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.protolin-ai__launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 18px 9px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--protolin-white);
  background: linear-gradient(135deg, var(--protolin-navy), var(--protolin-blue) 60%, var(--protolin-cyan));
  box-shadow: 0 12px 32px rgba(16, 59, 114, .28);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: -.01em;
  transition: transform .18s ease, box-shadow .18s ease;
}

.protolin-ai__launcher:hover,
.protolin-ai__launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 15px 38px rgba(16, 59, 114, .34);
  outline: 3px solid rgba(41, 184, 214, .28);
  outline-offset: 3px;
}

.protolin-ai[data-open="true"] .protolin-ai__launcher {
  display: none;
}

.protolin-ai__launcher-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .16);
}

.protolin-ai__launcher-icon svg,
.protolin-ai__send svg {
  width: 23px;
  height: 23px;
  fill: currentColor;
}

.protolin-ai__panel {
  display: flex;
  width: min(390px, calc(100vw - 32px));
  height: min(650px, calc(100vh - 50px));
  min-height: 470px;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid rgba(16, 59, 114, .12);
  border-radius: 22px;
  background: var(--protolin-white);
  box-shadow: 0 25px 70px rgba(20, 32, 51, .24);
  transform-origin: bottom right;
  animation: protolin-ai-in .2s ease-out;
}

.protolin-ai__panel[hidden] {
  display: none !important;
}

@keyframes protolin-ai-in {
  from { opacity: 0; transform: scale(.96) translateY(9px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.protolin-ai__header {
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 11px;
  padding: 14px 14px 14px 16px;
  color: var(--protolin-white);
  background: linear-gradient(125deg, #0d396e, #166eb0 62%, #27abc9);
}

.protolin-ai__brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .32);
  border-radius: 13px;
  background: rgba(255, 255, 255, .15);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.04em;
  overflow: hidden;
}

.protolin-ai__brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.protolin-ai__heading {
  min-width: 0;
  flex: 1;
}

.protolin-ai__heading h2,
.protolin-ai__heading p {
  margin: 0;
  color: inherit;
}

.protolin-ai__heading h2 {
  font-size: 16px;
  font-weight: 750;
  line-height: 1.25;
}

.protolin-ai__heading p {
  margin-top: 3px;
  font-size: 12px;
  opacity: .88;
}

.protolin-ai__status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  background: #70e0a0;
  box-shadow: 0 0 0 3px rgba(112, 224, 160, .16);
}

.protolin-ai__clear,
.protolin-ai__close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 23px;
}

.protolin-ai__clear {
  font-size: 19px;
}

.protolin-ai__clear:hover,
.protolin-ai__close:hover,
.protolin-ai__clear:focus-visible,
.protolin-ai__close:focus-visible {
  background: rgba(255, 255, 255, .16);
  outline: 2px solid rgba(255, 255, 255, .4);
}

.protolin-ai__messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 15px 8px;
  background:
    radial-gradient(circle at 100% 0, rgba(41, 184, 214, .08), transparent 32%),
    var(--protolin-bg);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.protolin-ai__message {
  display: flex;
  margin: 0 0 13px;
  flex-direction: column;
  align-items: flex-start;
}

.protolin-ai__message--user {
  align-items: flex-end;
}

.protolin-ai__bubble {
  max-width: 86%;
  padding: 11px 13px;
  border: 1px solid var(--protolin-border);
  border-radius: 5px 16px 16px 16px;
  color: var(--protolin-ink);
  background: var(--protolin-white);
  box-shadow: 0 2px 7px rgba(20, 32, 51, .05);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.protolin-ai__message--assistant .protolin-ai__bubble a {
  color: #0b6f9f;
  font-weight: 700;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.protolin-ai__message--assistant .protolin-ai__bubble a:hover,
.protolin-ai__message--assistant .protolin-ai__bubble a:focus-visible {
  color: #084e72;
}

.protolin-ai__message--user .protolin-ai__bubble {
  border-color: transparent;
  border-radius: 16px 5px 16px 16px;
  color: var(--protolin-white);
  background: linear-gradient(135deg, var(--protolin-blue), #159ec2);
}

.protolin-ai__whatsapp {
  display: inline-flex;
  margin-top: 6px;
  padding: 7px 10px;
  border: 1px solid #bfe5ce;
  border-radius: 999px;
  color: #126b37 !important;
  background: #edfff4;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none !important;
}

.protolin-ai__whatsapp:hover,
.protolin-ai__whatsapp:focus-visible {
  background: #dcf8e7;
  outline: 2px solid rgba(18, 107, 55, .18);
}

.protolin-ai__quick-questions {
  display: flex;
  overflow-x: auto;
  gap: 7px;
  padding: 8px 13px 10px;
  border-top: 1px solid rgba(220, 228, 238, .6);
  background: var(--protolin-bg);
  scrollbar-width: none;
}

.protolin-ai__quick-questions:empty {
  display: none;
}

.protolin-ai__quick-questions::-webkit-scrollbar {
  display: none;
}

.protolin-ai__quick-question {
  min-width: max-content;
  padding: 7px 10px;
  border: 1px solid #bad6ec;
  border-radius: 999px;
  color: var(--protolin-navy);
  background: var(--protolin-white);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
}

.protolin-ai__quick-question:hover,
.protolin-ai__quick-question:focus-visible {
  border-color: var(--protolin-blue);
  background: #edf7ff;
  outline: none;
}

/* A mouse has no natural swipe gesture. Show every shortcut in a compact
   two-column layout on desktop while keeping horizontal swipe on phones. */
@media (min-width: 521px) {
  .protolin-ai__quick-questions {
    overflow-x: visible;
    flex-wrap: wrap;
    align-content: flex-start;
  }

  .protolin-ai__quick-question {
    min-width: calc(50% - 4px);
    flex: 1 1 calc(50% - 4px);
    white-space: normal;
    text-align: center;
    line-height: 1.3;
  }
}

.protolin-ai__typing {
  display: flex;
  min-height: 33px;
  align-items: center;
  gap: 4px;
  padding: 5px 16px;
  color: var(--protolin-muted);
  background: var(--protolin-bg);
  font-size: 11px;
}

.protolin-ai__typing[hidden] {
  display: none;
}

.protolin-ai__typing span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--protolin-blue);
  animation: protolin-ai-dot 1.1s infinite ease-in-out;
}

.protolin-ai__typing span:nth-child(2) { animation-delay: .15s; }
.protolin-ai__typing span:nth-child(3) { animation-delay: .3s; }
.protolin-ai__typing b { margin-left: 4px; font-weight: 500; }

@keyframes protolin-ai-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-3px); opacity: 1; }
}

.protolin-ai__form {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  padding: 12px 13px 9px;
  border-top: 1px solid var(--protolin-border);
  background: var(--protolin-white);
}

.protolin-ai__input {
  width: 100%;
  min-height: 43px;
  max-height: 112px;
  resize: none;
  flex: 1;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #cdd8e5;
  border-radius: 13px;
  color: var(--protolin-ink);
  background: #fbfdff;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
}

.protolin-ai__input:focus {
  border-color: var(--protolin-blue);
  box-shadow: 0 0 0 3px rgba(25, 118, 189, .12);
  outline: 0;
}

.protolin-ai__send {
  display: grid;
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 13px;
  color: var(--protolin-white);
  background: linear-gradient(135deg, var(--protolin-blue), var(--protolin-cyan));
  cursor: pointer;
}

.protolin-ai__send:hover,
.protolin-ai__send:focus-visible {
  filter: brightness(.95);
  outline: 3px solid rgba(41, 184, 214, .22);
}

.protolin-ai__send:disabled,
.protolin-ai__input:disabled {
  cursor: wait;
  opacity: .62;
}

.protolin-ai__website {
  position: fixed !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.protolin-ai__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px 9px;
  color: var(--protolin-muted);
  background: var(--protolin-white);
  font-size: 10px;
}

.protolin-ai__privacy {
  color: var(--protolin-blue) !important;
  text-decoration: none !important;
}

.protolin-ai .screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  white-space: nowrap !important;
}

@media (max-width: 520px) {
  .protolin-ai {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }

  .protolin-ai:not([data-open="true"]) {
    bottom: max(88px, calc(env(safe-area-inset-bottom) + 78px));
  }

  .protolin-ai__launcher-text {
    display: none;
  }

  .protolin-ai__launcher {
    width: 58px;
    padding: 9px;
  }

  .protolin-ai__invite {
    max-width: min(245px, calc(100vw - 88px));
    padding: 10px 13px;
  }

  .protolin-ai__invite span {
    font-size: 12px;
  }

  .protolin-ai__invite strong {
    font-size: 14px;
  }

  .protolin-ai__panel {
    width: calc(100vw - 20px);
    height: min(720px, calc(100dvh - 20px));
    min-height: 0;
    border-radius: 19px;
  }

  .protolin-ai__bubble {
    max-width: 91%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .protolin-ai__panel,
  .protolin-ai__launcher,
  .protolin-ai__invite,
  .protolin-ai__typing span {
    animation: none !important;
    transition: none !important;
  }
}
