.support-chat {
  --chat-red: var(--red, var(--b1, #e30613));
  --chat-red-dark: var(--red-dark, var(--b2, #b8000b));
  --chat-ink: var(--ink, #141416);
  --chat-muted: var(--muted, #65656d);
  --chat-line: var(--line, #e9e9ed);
  --chat-soft: var(--soft, var(--surface2, #f7f7f8));
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 1000;
  font-family: Inter, "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--chat-ink);
  line-height: 1.45;
}

.support-chat *, .support-chat *::before, .support-chat *::after { box-sizing: border-box; }
.support-chat button, .support-chat input, .support-chat select, .support-chat textarea { font: inherit; }

.support-chat-launcher {
  position: relative;
  display: grid;
  width: 62px;
  height: 62px;
  margin-left: auto;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--chat-red), var(--chat-red-dark));
  border: 0;
  border-radius: 50%;
  box-shadow: 0 14px 36px rgba(184, 0, 11, .34);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.support-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(184, 0, 11, .4); }
.support-chat-launcher:focus-visible, .support-chat-close:focus-visible, .support-chat button:focus-visible,
.support-chat input:focus-visible, .support-chat select:focus-visible, .support-chat textarea:focus-visible {
  outline: 3px solid rgba(227, 6, 19, .24);
  outline-offset: 3px;
}
.support-chat-launcher svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.support-chat-online {
  position: absolute;
  top: 2px;
  right: 1px;
  width: 14px;
  height: 14px;
  background: #26bd69;
  border: 3px solid #fff;
  border-radius: 50%;
}

.support-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 30px));
  max-height: min(680px, calc(100vh - 112px));
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(20, 20, 22, .1);
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(20, 20, 22, .22);
  transform-origin: right bottom;
  animation: support-chat-in .2s ease-out;
}
.support-chat-panel[hidden] { display: none; }
@keyframes support-chat-in { from { opacity: 0; transform: translateY(12px) scale(.97); } }

.support-chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--chat-red), var(--chat-red-dark));
}
.support-chat-avatar {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: -.04em;
  color: var(--chat-red);
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
}
.support-chat-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.support-chat-title { min-width: 0; flex: 1; }
.support-chat-title strong { display: block; font-size: 15px; font-weight: 800; }
.support-chat-title span { display: flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11px; opacity: .88; }
.support-chat-title span::before { content: ""; width: 7px; height: 7px; background: #7ef0ad; border-radius: 50%; }
.support-chat-close {
  display: grid;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 11px;
  cursor: pointer;
}
.support-chat-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.support-chat-body { padding: 18px; overflow-y: auto; background: var(--chat-soft); }
.support-chat-greeting, .support-chat-bubble {
  width: fit-content;
  max-width: 88%;
  padding: 11px 13px;
  font-size: 13px;
  color: #303038;
  background: #fff;
  border: 1px solid var(--chat-line);
  border-radius: 4px 16px 16px;
  box-shadow: 0 5px 18px rgba(20,20,22,.05);
}
.support-chat-greeting { margin-bottom: 14px; }
.support-chat-form {
  padding: 16px;
  background: #fff;
  border: 1px solid var(--chat-line);
  border-radius: 18px;
}
.support-chat-field { display: block; margin-bottom: 12px; }
.support-chat-field > span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 750; color: #303038; }
.support-chat-field input, .support-chat-field select, .support-chat-field textarea {
  display: block;
  width: 100%;
  padding: 11px 12px;
  color: var(--chat-ink);
  background: #fff;
  border: 1px solid #dcdce2;
  border-radius: 10px;
  outline: 0;
}
.support-chat-field textarea { min-height: 94px; resize: vertical; }
.support-chat-field input:focus, .support-chat-field select:focus, .support-chat-field textarea:focus { border-color: var(--chat-red); box-shadow: 0 0 0 3px rgba(227,6,19,.09); }
.support-chat-privacy { margin: 1px 0 13px; font-size: 10.5px; line-height: 1.5; color: var(--chat-muted); }
.support-chat-submit {
  display: inline-flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  background: var(--chat-red);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}
.support-chat-submit:hover { background: var(--chat-red-dark); }
.support-chat-submit:disabled { cursor: wait; opacity: .65; }

.support-chat-conversation[hidden], .support-chat-form[hidden] { display: none; }
.support-chat-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 9px 11px;
  font-size: 11px;
  color: var(--chat-muted);
  background: #fff;
  border: 1px solid var(--chat-line);
  border-radius: 12px;
}
.support-chat-identity strong { display: block; overflow: hidden; color: var(--chat-ink); text-overflow: ellipsis; white-space: nowrap; }
.support-chat-identity button { padding: 4px 7px; color: var(--chat-red); background: transparent; border: 0; font-size: 11px; font-weight: 800; cursor: pointer; }
.support-chat-thread { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.support-chat-bubble--user { align-self: flex-end; color: #fff; background: var(--chat-red); border: 0; border-radius: 16px 4px 16px 16px; }
.support-chat-bubble--system strong { display: block; margin-top: 5px; color: var(--chat-red); font-size: 11px; }
.support-chat-status { min-height: 17px; margin-top: 9px; font-size: 11px; color: var(--chat-muted); }
.support-chat-status.is-error { color: #b8000b; }
.support-chat-status.is-success { color: #17864a; }
.support-chat-foot { padding: 9px 16px 11px; text-align: center; color: var(--chat-muted); background: #fff; border-top: 1px solid var(--chat-line); font-size: 10px; }
.support-chat-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

@media (max-width: 480px) {
  .support-chat { right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); }
  .support-chat-launcher { width: 58px; height: 58px; }
  .support-chat-panel { position: fixed; right: 10px; bottom: 80px; left: 10px; width: auto; max-height: calc(100dvh - 94px); border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat-panel { animation: none; }
  .support-chat-launcher { transition: none; }
}
