.gts-ai-chat-root,
.gts-ai-chat-root * {
  box-sizing: border-box;
}

.gts-ai-chat-root {
  --gts-ai-ink: #1d1b16;
  --gts-ai-body: #4d493f;
  --gts-ai-muted: #777066;
  --gts-ai-line: rgba(29, 27, 22, .12);
  --gts-ai-panel: #fffefa;
  --gts-ai-panel-soft: #f7f5ef;
  --gts-ai-accent: #ffcd11;
  --gts-ai-accent-ink: #292313;
  --gts-ai-user: #24211a;
  --gts-ai-user-text: #fff7d8;
  --gts-ai-shadow: 0 22px 70px rgba(24, 21, 14, .22);
  position: fixed;
  right: max(18px, env(safe-area-inset-right, 0px));
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  z-index: 2147482600;
  display: grid;
  justify-items: end;
  gap: 12px;
  color: var(--gts-ai-ink);
  font: 500 14px/1.42 Manrope, Inter, Arial, sans-serif;
  letter-spacing: 0;
  pointer-events: none;
}

body.has-mobile-dock .gts-ai-chat-root,
.cr-page.has-mobile-dock .gts-ai-chat-root {
  bottom: calc(var(--cr-dock-safe-bottom, 96px) + 12px);
}

.gts-ai-chat-root button,
.gts-ai-chat-root textarea {
  font: inherit;
  letter-spacing: 0;
}

.gts-ai-chat-panel {
  pointer-events: auto;
  width: min(392px, calc(100vw - 24px));
  height: min(596px, calc(100vh - 112px));
  min-height: 420px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid var(--gts-ai-line);
  border-radius: 8px;
  background: var(--gts-ai-panel);
  box-shadow: var(--gts-ai-shadow);
}

.gts-ai-chat-panel[hidden] {
  display: none;
}

.gts-ai-chat-header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px 12px 16px;
  border-bottom: 1px solid var(--gts-ai-line);
  background: linear-gradient(180deg, #ffffff, #fbfaf5);
}

.gts-ai-chat-title-wrap {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.gts-ai-chat-title {
  color: var(--gts-ai-ink);
  font-size: 15px;
  font-weight: 850;
  line-height: 1.2;
}

.gts-ai-chat-status {
  color: var(--gts-ai-muted);
  font-size: 12px;
  font-weight: 700;
}

.gts-ai-chat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  display: inline-block;
  border-radius: 50%;
  background: #25a55b;
  vertical-align: 1px;
}

.gts-ai-chat-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.gts-ai-chat-icon-btn,
.gts-ai-chat-send,
.gts-ai-chat-bubble {
  appearance: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.gts-ai-chat-icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--gts-ai-muted);
}

.gts-ai-chat-icon-btn:hover,
.gts-ai-chat-icon-btn:focus-visible {
  border-color: var(--gts-ai-line);
  background: var(--gts-ai-panel-soft);
  color: var(--gts-ai-ink);
}

.gts-ai-chat-root svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gts-ai-chat-feed {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 205, 17, .08), rgba(255, 255, 255, 0) 110px),
    var(--gts-ai-panel);
}

.gts-ai-chat-message {
  display: flex;
}

.gts-ai-chat-message--assistant {
  justify-content: flex-start;
}

.gts-ai-chat-message--user {
  justify-content: flex-end;
}

.gts-ai-chat-message-body {
  max-width: min(82%, 300px);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--gts-ai-line);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--gts-ai-body);
  background: #fff;
  box-shadow: 0 6px 18px rgba(24, 21, 14, .06);
}

.gts-ai-chat-message--user .gts-ai-chat-message-body {
  border-color: rgba(36, 33, 26, .22);
  color: var(--gts-ai-user-text);
  background: var(--gts-ai-user);
}

.gts-ai-chat-message[data-loading="1"] .gts-ai-chat-message-body::after {
  content: "";
  width: 16px;
  height: 4px;
  margin-left: 7px;
  display: inline-block;
  border-radius: 999px;
  background:
    radial-gradient(circle, currentColor 1.7px, transparent 2px) 0 50% / 6px 4px repeat-x;
  opacity: .55;
  vertical-align: 2px;
  animation: gts-ai-chat-pulse 1s ease-in-out infinite;
}

.gts-ai-chat-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 14px 0;
  background: var(--gts-ai-panel);
}

.gts-ai-chat-chip {
  min-height: 36px;
  flex: 0 0 auto;
  border: 1px solid var(--gts-ai-line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--gts-ai-ink);
  background: var(--gts-ai-panel-soft);
  font-weight: 800;
  cursor: pointer;
}

.gts-ai-chat-chip:hover,
.gts-ai-chat-chip:focus-visible {
  border-color: rgba(255, 205, 17, .7);
  background: #fff7d8;
}

.gts-ai-chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: end;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--gts-ai-line);
  background: var(--gts-ai-panel);
}

.gts-ai-chat-input {
  width: 100%;
  min-height: 46px;
  max-height: 118px;
  resize: none;
  border: 1px solid var(--gts-ai-line);
  border-radius: 8px;
  padding: 12px 13px;
  overflow: auto;
  color: var(--gts-ai-ink);
  background: #fff;
  outline: none;
}

.gts-ai-chat-input:focus {
  border-color: rgba(255, 205, 17, .8);
  box-shadow: 0 0 0 3px rgba(255, 205, 17, .22);
}

.gts-ai-chat-send {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  color: var(--gts-ai-accent-ink);
  background: var(--gts-ai-accent);
  box-shadow: 0 8px 18px rgba(255, 205, 17, .24);
}

.gts-ai-chat-send:hover,
.gts-ai-chat-send:focus-visible {
  filter: brightness(.98);
  box-shadow: 0 10px 24px rgba(255, 205, 17, .32);
}

.gts-ai-chat-send:disabled,
.gts-ai-chat-form.is-sending .gts-ai-chat-send {
  cursor: wait;
  opacity: .62;
}

.gts-ai-chat-bubble {
  pointer-events: auto;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  color: var(--gts-ai-accent-ink);
  background: var(--gts-ai-accent);
  box-shadow: 0 14px 36px rgba(24, 21, 14, .26);
}

.gts-ai-chat-bubble:hover,
.gts-ai-chat-bubble:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 42px rgba(24, 21, 14, .3);
}

.gts-ai-chat-bubble svg {
  width: 28px;
  height: 28px;
}

.gts-ai-chat-root.is-open .gts-ai-chat-bubble {
  display: none;
}

@keyframes gts-ai-chat-pulse {
  0%,
  100% {
    opacity: .32;
  }
  50% {
    opacity: .78;
  }
}

@media (max-width: 560px) {
  .gts-ai-chat-root {
    right: 10px;
    left: 10px;
    justify-items: end;
  }

  .gts-ai-chat-panel {
    width: 100%;
    height: min(620px, calc(100vh - 104px));
    min-height: 380px;
  }

  .gts-ai-chat-message-body {
    max-width: 88%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gts-ai-chat-bubble,
  .gts-ai-chat-message[data-loading="1"] .gts-ai-chat-message-body::after {
    animation: none;
    transition: none;
  }
}
