body.has-support-chat {
  --support-chat-size: 68px;
  --support-chat-right: max(24px, env(safe-area-inset-right));
  --support-chat-bottom: max(28px, env(safe-area-inset-bottom));
  --support-chat-panel-right: max(clamp(14px, 1.4vw, 28px), env(safe-area-inset-right));
  --support-chat-panel-bottom: max(11dvh, calc(env(safe-area-inset-bottom) + 12px));
}

.support-chat {
  position: fixed;
  right: var(--support-chat-right);
  bottom: var(--support-chat-bottom);
  z-index: 25;
  color: #2b2122;
  --support-chat-red: #dd001b;
}

body.is-opening .support-chat,
#page[inert] .support-chat { visibility: hidden; }

.support-chat__launcher {
  display: grid;
  place-items: center;
  width: var(--support-chat-size);
  height: var(--support-chat-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #c53735;
  background: transparent;
  transition: color .18s ease, transform .18s ease;
}

.support-chat[data-on-color] .support-chat__launcher { color: #fff; }

.support-chat__launcher:hover {
  transform: translateY(-2px);
}

.support-chat__launcher:disabled { opacity: .7; cursor: wait; }
.support-chat__mark { display: block; width: 98%; height: 98%; }
.support-chat[data-on-color] .support-chat__mark {
  filter: drop-shadow(0 1px 1px rgba(38, 24, 24, .46)) drop-shadow(0 3px 5px rgba(38, 24, 24, .24));
}
.support-chat__launcher[aria-expanded="true"] { display: none; }

.support-chat__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(clamp(320px, 26vw, 560px), calc(100dvw - var(--support-chat-panel-right) - 12px));
  height: 75dvh;
  max-height: calc(100dvh - var(--support-chat-panel-bottom) - max(8px, env(safe-area-inset-top)));
  overflow: hidden;
  border: 1px solid #eee4e4;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(31, 17, 22, .24);
}

.support-chat:has(.support-chat__launcher[aria-expanded="true"]) {
  z-index: 31;
  right: var(--support-chat-panel-right);
  bottom: var(--support-chat-panel-bottom);
}

.support-chat__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #f0e6e6;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.support-chat[data-dragging] .support-chat__header { cursor: grabbing; }

.support-chat__close {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: -7px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--support-chat-red);
  touch-action: manipulation;
}
.support-chat__close:hover { background: #fff0f3; }
.support-chat__close svg { width: 22px; height: 22px; }

.support-chat__brand {
  grid-column: 1;
  color: var(--support-chat-red);
  font: 900 13px/1.25 var(--fomomy-font);
  letter-spacing: .08em;
}

.support-chat__header h2 { grid-column: 1; margin: 0; font-size: 21px; letter-spacing: -.035em; }
.support-chat__header h2:focus-visible { outline: 2px solid #b9142d; outline-offset: 3px; }
.support-chat__body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.support-chat__log { display: grid; gap: 9px; }

.support-chat__message {
  justify-self: start;
  max-width: 94%;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #f6f1f1;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.support-chat__message--own {
  justify-self: end;
  border-radius: 14px 14px 4px 14px;
  background: #fce3e8;
}

.support-chat__message a { display: block; margin-top: 7px; color: #a5112a; font-weight: 650; text-underline-offset: 2px; }
.support-chat__prompts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.support-chat__prompts button {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #e8d7d9;
  border-radius: 999px;
  color: #612e36;
  background: #fff;
  font-size: 12px;
}

.support-chat__prompts button:hover { background: #fff0f3; }
.support-chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #f0e6e6; }
.support-chat__form input {
  min-width: 0;
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #e8d7d9;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;
  color: inherit;
}

.support-chat__form button {
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: #b9142d;
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}

.support-chat :is(button, a, input):focus-visible { outline: 2px solid #b9142d; outline-offset: 3px; }

@media (min-width: 1101px) {
  body.has-support-chat .hero-actions { right: calc(var(--support-chat-right) + var(--support-chat-size) + 16px); }
}

@media (min-width: 681px) and (max-width: 1100px) {
  body.has-support-chat .hero-actions { bottom: calc(var(--support-chat-bottom) + var(--support-chat-size) + 20px); }
}

@media (max-width: 680px) {
  body.has-support-chat {
    --support-chat-size: 62px;
    --support-chat-right: max(16px, env(safe-area-inset-right));
    --support-chat-bottom: max(18px, env(safe-area-inset-bottom));
    --support-chat-panel-right: max(12px, env(safe-area-inset-right));
    --support-chat-panel-bottom: calc(12px + env(safe-area-inset-bottom));
  }

  .support-chat__panel {
    width: min(420px, calc(100dvw - var(--support-chat-panel-right) - max(12px, env(safe-area-inset-left))));
  }

  body.has-support-chat .hero-actions { right: calc(var(--support-chat-right) + var(--support-chat-size) + 12px); }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat__launcher { transition: none; }
}

/* AI assistant replies */
.support-chat__message--ai { display: grid; gap: 6px; }
.support-chat__text { display: grid; gap: 6px; }
.support-chat__text p { margin: 0; }
.support-chat__list { margin: 0; padding-left: 18px; display: grid; gap: 3px; }
.support-chat__list li::marker { color: #a5112a; }
.support-chat__sources { margin: 2px 0 0; padding: 6px 0 0 18px; border-top: 1px solid rgba(165, 17, 42, .14); font-size: 12px; line-height: 1.4; color: #6b5a5c; }
.support-chat__sources li + li { margin-top: 2px; }
.support-chat__message .support-chat__sources a { display: inline; margin: 0; font-weight: 500; color: inherit; text-decoration: underline; }
.support-chat__thinking { display: flex; align-items: center; gap: 8px; color: #6b5a5c; }
.support-chat__dots { display: inline-flex; gap: 3px; }
.support-chat__dots i { width: 5px; height: 5px; border-radius: 50%; background: #a5112a; opacity: .35; animation: support-chat-bounce 1.2s infinite ease-in-out; }
.support-chat__dots i:nth-child(2) { animation-delay: .15s; }
.support-chat__dots i:nth-child(3) { animation-delay: .3s; }
.support-chat__step {
  background: linear-gradient(90deg, #8a7a7c 0%, #8a7a7c 40%, #d9c7c9 50%, #8a7a7c 60%, #8a7a7c 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: support-chat-shine 1.6s linear infinite; transition: opacity .2s;
}
.support-chat__step.is-changing { opacity: 0; }
@keyframes support-chat-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes support-chat-shine { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  .support-chat__dots i, .support-chat__step { animation: none; }
  .support-chat__step { color: #6b5a5c; background: none; }
}
.support-chat__form button[type="submit"]:disabled { opacity: .55; cursor: progress; }
