.support-chat {
  position: fixed;
  inset: auto 0 0;
  display: none;
  width: min(100vw, 480px);
  max-width: min(100vw, 480px);
  height: min(92dvh, 760px);
  max-height: calc(var(--support-viewport-height, 100dvh) - 8px);
  min-height: min(480px, calc(var(--support-viewport-height, 100dvh) - 8px));
  margin: 0 auto;
  padding: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e8e8e8;
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: #fff;
  color: #343434;
  box-shadow: 0 -10px 35px #0002;
}

.support-chat[open] { display: flex; }
.support-chat::backdrop { background: rgb(0 0 0 / 58%); }

.support-chat-header {
  display: flex;
  flex: 0 0 66px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #ededed;
  background: #fff;
}

.support-chat-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 5px;
  background: #000;
  object-fit: contain;
}

.support-chat-branding { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 3px; }
.support-chat-branding strong { color: #303030; font-size: 15px; font-weight: 750; }
.support-chat-status { display: flex; align-items: center; gap: 5px; color: #258a44; font-size: 12px; }
.support-chat-status[hidden] { display: none; }
.support-chat-status::before { width: 7px; height: 7px; border-radius: 50%; background: #20a34a; content: ""; }

.support-chat-close {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #777;
  cursor: pointer;
}

.support-chat-close:hover { background: #f4f4f4; }
.support-chat-close svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.5; }

.support-chat-messages {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 14px 20px;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
}

.support-message {
  display: flex;
  width: fit-content;
  max-width: min(84%, 390px);
  padding: 11px 13px;
  border: 1px solid #ededed;
  border-radius: 15px;
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.support-message-agent { align-self: flex-start; border-top-left-radius: 5px; background: #f7f7f7; color: #555; }
.support-message-user { align-self: flex-end; border-color: #ff2b55; border-top-right-radius: 5px; background: #ff2b55; color: #fff; }
.support-message-user[data-receipt="true"] { align-items: flex-end; gap: 5px; }
.support-message-text { min-width: 0; }
.support-read-receipt { flex: 0 0 auto; align-self: flex-end; margin-bottom: 1px; color: #1689ff; font-size: 10px; font-weight: 800; letter-spacing: -2px; line-height: 1; white-space: nowrap; }
.support-welcome { margin-bottom: 1px; }
.support-welcome strong { color: #343434; font-weight: 750; }

.support-chat-questions {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  max-height: 36vh;
  overflow-y: auto;
  padding: 9px 14px 10px;
  border-top: 1px solid #f0f0f0;
  background: #fff;
  overscroll-behavior: contain;
}

.support-question {
  min-width: 0;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid #e8e8e8;
  border-radius: 999px;
  background: #fafafa;
  color: #414141;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
  transition: border-color 120ms ease, background-color 120ms ease, transform 120ms ease;
}

.support-question:hover, .support-question:focus-visible { border-color: #ff9caf; background: #fff5f7; outline: none; }
.support-question:active { background: #ffedf1; transform: scale(.99); }

.support-chat-composer {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid #ededed;
  background: #fff;
}

.support-chat-composer input {
  width: 100%;
  min-width: 0;
  height: 42px;
  flex: 1;
  padding: 0 14px;
  border: 1px solid #e5e5e5;
  border-radius: 999px;
  background: #fafafa;
  color: #333;
  font: inherit;
  font-size: 14px;
  outline: none;
}

.support-chat-composer input:focus { border-color: #ff8298; background: #fff; }
.support-chat-composer input::placeholder { color: #999; }

.support-chat-send {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #ff2b55;
  color: #fff;
  cursor: pointer;
}

.support-chat-send:hover { background: #e71d46; }
.support-chat-send svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }

@media (min-width: 700px) {
  .support-chat { inset: 0; height: min(78dvh, 760px); min-height: min(480px, calc(100dvh - 32px)); margin: auto; border-bottom: 1px solid #e8e8e8; border-radius: 22px; }
}

@media (max-height: 560px) {
  .support-chat { min-height: 0; height: calc(100dvh - 8px); }
  .support-chat-questions { max-height: 24dvh; }
}

@media (max-width: 380px) {
  .support-chat { height: 94dvh; max-height: calc(100dvh - 6px); border-radius: 19px 19px 0 0; }
  .support-chat-header { flex-basis: 62px; padding-right: 12px; padding-left: 12px; }
  .support-chat-messages { padding-right: 11px; padding-left: 11px; }
  .support-chat-questions { gap: 5px; padding-right: 10px; padding-left: 10px; }
  .support-question { min-height: 39px; padding: 8px 11px; font-size: 13px; }
  .support-chat-composer { gap: 7px; padding-right: 10px; padding-left: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat-messages { scroll-behavior: auto; }
}
