.sc-root {
  position: fixed;
  inset: 0;
  z-index: 10040;
  pointer-events: none;
}
.sc-root[hidden] { display: none !important; }
.sc-root.is-open { pointer-events: auto; }

.sc-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sc-root.is-open .sc-backdrop { opacity: 1; }

.sc-panel {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: min(320px, calc(100vw - 24px));
  height: min(512px, calc(100vh - 32px));
  display: flex;
  flex-direction: column;
  background: #fff;
  color: #1a1a1a;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  opacity: 0;
  transform: translateY(22px) scale(0.96);
  transform-origin: 100% 100%;
  transition: transform 0.36s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.28s ease;
}
.sc-root.is-open .sc-panel {
  opacity: 1;
  transform: none;
}
.sc-panel button,
.sc-panel textarea {
  margin: 0;
  box-sizing: border-box;
  font-family: inherit;
  outline: none;
  box-shadow: none;
}

.sc-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 11px 8px;
  background: #fff;
}
.sc-head__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #00b352;
  color: #041208;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
.sc-head__copy { min-width: 0; flex: 1; }
.sc-head__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #161616;
}
.sc-head__status {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 1px;
  color: #8a8f98;
  font-size: 11px;
}
.sc-head__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #00b352;
}
.sc-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7078;
  cursor: pointer;
}
.sc-close:hover { background: #f3f4f6; }

.sc-prompts { display: none; }
.sc-prompts-off {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 11px 8px;
  scrollbar-width: none;
}
.sc-prompts::-webkit-scrollbar { display: none; }
.sc-chip {
  flex: 0 0 auto;
  border: 0;
  background: #f3f4f6;
  color: #2a2a2a;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}
.sc-chip--op { background: #00b352; color: #041208; font-weight: 700; }
.sc-chip--op:hover { background: #00c45c; }
.sc-chip:hover { background: #e8eaee; }
.sc-chip:disabled { opacity: 0.5; cursor: default; }

.sc-log {
  flex: 1;
  overflow-y: auto;
  padding: 8px 11px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
}
.sc-empty {
  margin: auto;
  max-width: 200px;
  text-align: center;
  color: #8a8f98;
  font-size: 13px;
  line-height: 1.4;
}
.sc-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  gap: 2px;
}
.sc-msg--user { align-self: flex-end; align-items: flex-end; }
.sc-msg--staff,
.sc-msg--bot { align-self: flex-start; align-items: flex-start; }
.sc-msg.is-new { animation: sc-msg-in 0.32s ease both; }
.sc-msg__who {
  font-size: 10px;
  color: #8a8f98;
  padding: 0 4px;
}
.sc-bubble {
  padding: 8px 10px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.35;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sc-bubble__text {
  white-space: pre-wrap;
  word-break: break-word;
}
.sc-quote {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  border-left: 3px solid rgba(0, 0, 0, 0.25);
  background: rgba(0, 0, 0, 0.06);
  min-width: 0;
}
.sc-msg--user .sc-quote {
  border-left-color: rgba(4, 18, 8, 0.45);
  background: rgba(4, 18, 8, 0.1);
}
.sc-msg--staff .sc-quote,
.sc-msg--bot .sc-quote {
  border-left-color: #00b352;
  background: rgba(0, 179, 82, 0.08);
}
.sc-quote__thumb {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}
.sc-quote__copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sc-quote__author {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}
.sc-quote__text {
  display: block;
  font-size: 11px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-msg--user .sc-bubble {
  background: #00b352;
  color: #041208;
  border-bottom-right-radius: 5px;
}
.sc-msg--staff .sc-bubble,
.sc-msg--bot .sc-bubble {
  background: #f3f4f6;
  color: #1a1a1a;
  border-bottom-left-radius: 5px;
}
.sc-msg__file {
  display: block;
  margin-top: 6px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 180px;
}
.sc-msg__file img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 144px;
  object-fit: cover;
}
.sc-msg__pdf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
}
.sc-msg__time {
  font-size: 10px;
  color: #9aa0a8;
  padding: 0 4px;
}

.sc-error {
  min-height: 0;
  margin: 0 11px;
  color: #d14343;
  font-size: 12px;
}
.sc-error:empty { display: none; }
.sc-compose.is-locked { display: none; }
.sc-note {
  align-self: center;
  max-width: 240px;
  margin: 8px auto;
  text-align: center;
  color: #6b7078;
  font-size: 13px;
  line-height: 1.4;
}
.sc-note.is-new { animation: sc-msg-in 0.32s ease both; }
.sc-menu {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.sc-menu__info {
  background: #f3f4f6;
  color: #1a1a1a;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.4;
}
.sc-menu__btn {
  width: 100%;
  border: 0;
  background: #f3f4f6;
  color: #1a1a1a;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}
.sc-menu__btn:hover { background: #e8eaee; }
.sc-menu__btn:disabled { opacity: 0.5; cursor: default; }
.sc-menu__btn--op { background: #00b352; color: #041208; }
.sc-menu__btn--op:hover { background: #00c45c; }
.sc-compose {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px calc(10px + env(safe-area-inset-bottom));
  background: #fff;
}
.sc-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 10px 4px;
  padding: 6px 8px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #333;
  font-size: 12px;
}
.sc-file[hidden] { display: none; }
.sc-file button {
  border: 0;
  background: transparent;
  color: #6b7078;
  cursor: pointer;
}
.sc-field {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 2px;
  background: #f3f4f6;
  border-radius: 18px;
  padding: 0 2px 0 12px;
}
.sc-field textarea {
  flex: 1;
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  background: transparent;
  color: #1a1a1a;
  font-size: 13px;
  line-height: 18px;
  height: 36px;
  min-height: 36px;
  max-height: 96px;
  padding: 9px 0;
  margin: 0;
}
.sc-field textarea::placeholder { color: #9aa0a8; }
.sc-attach,
.sc-send {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  align-self: center;
}
.sc-attach { background: transparent; color: #6b7078; }
.sc-attach:hover { background: rgba(0, 0, 0, 0.05); }
.sc-attach:disabled { opacity: 0.35; cursor: default; }
.sc-send {
  background: #00b352;
  color: #041208;
}
.sc-send:disabled { opacity: 0.45; cursor: default; }
.sc-input-file { display: none; }

.has-support-unread { position: relative; }
[data-support-open].has-support-unread::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00b352;
  box-shadow: 0 0 0 2px #111;
}

@keyframes sc-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 640px) {
  .sc-backdrop { background: rgba(0, 0, 0, 0.28); }
  .sc-panel {
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
  }
  .sc-root.is-open .sc-panel { transform: none; }
  .sc-head { padding-top: calc(10px + env(safe-area-inset-top)); }
}

@media (prefers-reduced-motion: reduce) {
  .sc-panel,
  .sc-backdrop,
  .sc-msg.is-new {
    transition: none;
    animation: none;
  }
}
