:root {
  --carlo-blue: #094770;
  --carlo-cyan: #2a97be;
  --carlo-orange: #e8811a;
  --carlo-ink: #17202e;
  --carlo-muted: #667085;
  --carlo-line: #d8e1eb;
  --carlo-soft: #f5f8fb;
  --carlo-assistant: #fffaf4;
  --carlo-user: #eef3f7;
  --carlo-danger: #b42318;
}

.carlo-teaser {
  position: fixed;
  right: 18px;
  bottom: 0;
  z-index: 999999;
  width: 254px;
  height: 230px;
  direction: rtl;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.carlo-teaser__link {
  position: absolute;
  inset: 0;
  display: block;
  color: inherit;
  text-decoration: none;
}

.carlo-teaser__image {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 176px;
  height: 220px;
  object-fit: contain;
  object-position: bottom center;
}

.carlo-teaser__avatar {
  display: none;
}

.carlo-teaser__bubble {
  position: absolute;
  right: 136px;
  top: 16px;
  width: 118px;
  padding: 9px 13px;
  border: 1px solid #d7e0ea;
  border-radius: 16px 16px 4px 16px;
  background: #fff;
  color: var(--carlo-blue);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 750;
  text-align: right;
  box-shadow: 0 10px 24px rgba(20, 31, 45, 0.12);
  white-space: pre-line;
}

.carlo-teaser__bubble::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 10px;
  height: 10px;
  background: #fff;
  border-top: 1px solid #d7e0ea;
  border-right: 1px solid #d7e0ea;
  transform: translateY(-50%) rotate(45deg);
}

.carlo-type-cursor {
  display: inline-block;
  width: 1px;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: -0.12em;
  background: var(--carlo-blue);
  animation: carloCursorBlink 0.8s steps(1) infinite;
}

@keyframes carloCursorBlink {
  50% {
    opacity: 0;
  }
}

.carlo-page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 16px 32px;
  direction: rtl;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.carlo-ad-slot {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.carlo-ad-slot-top {
  margin-bottom: 16px;
}

.carlo-ad-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.carlo-chat {
  width: min(760px, 100%);
  min-height: 620px;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid #b9c8da;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 22px 58px rgba(20, 31, 45, 0.14);
  color: var(--carlo-ink);
}

.carlo-chat__header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--carlo-line);
  background: linear-gradient(180deg, #fff, #f8fafc);
}

.carlo-chat__brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.carlo-chat__avatar,
.carlo-thinking__avatar {
  overflow: hidden;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 7px rgba(9, 71, 112, 0.18);
}

.carlo-chat__avatar {
  width: 42px;
  height: 42px;
}

.carlo-chat__avatar img,
.carlo-thinking__avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.carlo-chat__name {
  font-size: 15px;
  font-weight: 850;
}

.carlo-chat__subtitle {
  color: var(--carlo-muted);
  font-size: 12px;
}

.carlo-chat__reset {
  width: 36px;
  height: 36px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #445166;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.carlo-chat__reset:hover {
  border-color: var(--carlo-line);
  background: var(--carlo-soft);
}

.carlo-chat__messages {
  min-height: 0;
  overflow-y: auto;
  padding: 18px 16px;
  background: linear-gradient(180deg, #fff, #fbfcfe);
}

.carlo-message {
  display: flex;
  margin-bottom: 12px;
  direction: rtl;
}

.carlo-message--user {
  justify-content: flex-end;
}

.carlo-message--assistant {
  justify-content: flex-start;
}

.carlo-bubble {
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 14px;
  line-height: 1.52;
  white-space: pre-wrap;
  font-size: 15px;
  overflow-wrap: anywhere;
  direction: rtl;
  text-align: right;
}

.carlo-bubble strong {
  display: block;
  margin: 6px 0 3px;
  color: var(--carlo-blue);
  font-weight: 900;
}

.carlo-message--user .carlo-bubble {
  background: var(--carlo-user);
  border-bottom-left-radius: 4px;
}

.carlo-message--assistant .carlo-bubble {
  border: 1px solid #f0d2ad;
  border-bottom-right-radius: 4px;
  background: var(--carlo-assistant);
}

.carlo-bubble--thinking {
  border: 0 !important;
  background: transparent !important;
  padding: 6px 2px;
}

.carlo-thinking {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--carlo-blue);
  font-size: 13px;
  font-weight: 750;
}

.carlo-thinking__avatar {
  width: 24px;
  height: 24px;
}

.carlo-thinking__dots {
  display: inline-flex;
  gap: 3px;
}

.carlo-thinking__dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--carlo-orange);
  animation: carloDotBounce 1s ease-in-out infinite;
}

.carlo-thinking__dots span:nth-child(2) {
  animation-delay: 0.14s;
}

.carlo-thinking__dots span:nth-child(3) {
  animation-delay: 0.28s;
}

@keyframes carloDotBounce {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  35% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.carlo-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  padding: 11px 14px 13px;
  border-top: 1px solid var(--carlo-line);
  background: #fbfcfd;
}

.carlo-chip {
  min-height: 34px;
  border: 1px solid #c9d6e4;
  border-radius: 999px;
  background: #fff;
  color: var(--carlo-blue);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.carlo-chat__composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--carlo-line);
  background: #fff;
}

.carlo-chat__input {
  width: 100%;
  min-height: 46px;
  max-height: 110px;
  resize: none;
  border: 1px solid #b9c8da;
  border-radius: 22px;
  padding: 11px 16px;
  color: var(--carlo-ink);
  font: inherit;
  font-size: 15px;
  line-height: 1.4;
  direction: rtl;
  text-align: right;
}

.carlo-chat__input:focus {
  outline: 2px solid rgba(42, 151, 190, 0.22);
  border-color: var(--carlo-cyan);
}

.carlo-chat__send {
  min-width: 78px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(9, 71, 112, 0.18);
  border-radius: 12px;
  background: #f8fbfd;
  color: var(--carlo-blue);
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  box-shadow: inset 0 -2px 0 rgba(42, 151, 190, 0.08);
}

.carlo-chat__send:hover {
  color: #fff;
  border-color: var(--carlo-blue);
  background: var(--carlo-blue);
}

.carlo-chat__send:disabled,
.carlo-chat__input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.carlo-bubble--error {
  color: var(--carlo-danger);
  border-color: #fecdca !important;
  background: #fffbfa !important;
}

.carlo-lead {
  max-width: 86%;
  margin: 12px 0 14px auto;
  padding: 13px;
  border: 1px solid #c9d6e4;
  border-radius: 14px;
  background: #f8fbfd;
  direction: rtl;
  text-align: right;
}

.carlo-lead__title {
  margin-bottom: 10px;
  color: var(--carlo-blue);
  font-size: 14px;
  font-weight: 850;
}

.carlo-lead__form {
  display: grid;
  gap: 8px;
}

.carlo-lead__input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #b9c8da;
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--carlo-ink);
  font: inherit;
  font-size: 14px;
  direction: rtl;
  text-align: right;
}

.carlo-lead__input:focus {
  outline: 2px solid rgba(42, 151, 190, 0.2);
  border-color: var(--carlo-cyan);
}

.carlo-lead__consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  color: var(--carlo-muted);
  font-size: 12px;
  line-height: 1.45;
}

.carlo-lead__consent input {
  margin-top: 3px;
}

.carlo-lead__consent a {
  color: var(--carlo-blue);
  font-weight: 750;
}

.carlo-lead__submit {
  min-height: 38px;
  border: 1px solid rgba(9, 71, 112, 0.18);
  border-radius: 10px;
  background: var(--carlo-blue);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

.carlo-lead__submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.carlo-lead__status {
  min-height: 18px;
  color: var(--carlo-blue);
  font-size: 12px;
  font-weight: 750;
}

@media (max-width: 1024px) {
  .carlo-teaser {
    right: 10px;
    bottom: 127px;
    width: auto;
    height: auto;
  }

  .carlo-teaser__link {
    position: static;
    display: flex;
    align-items: center;
    gap: 8px;
    direction: ltr;
  }

  .carlo-teaser__image {
    display: none;
  }

  .carlo-teaser__avatar {
    display: block;
    position: static;
    width: 56px;
    height: 56px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-sizing: border-box;
    object-fit: cover;
    flex: 0 0 auto;
    box-shadow: 0 8px 20px rgba(20, 31, 45, 0.22);
  }

  .carlo-teaser__bubble {
    position: static;
    right: auto;
    top: auto;
    width: auto;
    max-width: 150px;
    direction: rtl;
  }

  .carlo-teaser__bubble::after {
    display: none;
  }
}

@media (max-width: 760px) {
  .carlo-page-shell {
    padding-inline: 10px;
  }

  .carlo-chat {
    min-height: 620px;
  }

  .carlo-ad-grid {
    grid-template-columns: 1fr;
  }
}
