:root {
  --gat-chat-ink: #050714;
  --gat-chat-panel: #0d1229;
  --gat-chat-white: #f8fafc;
  --gat-chat-muted: #adb6d5;
  --gat-chat-pink: #ff2fb3;
  --gat-chat-violet: #8b5cf6;
  --gat-chat-cyan: #22d3ee;
  --gat-chat-line: rgba(255, 255, 255, 0.14);
}

body.gat-chat-open { overflow: hidden; }

.gat-chat-modal {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: none;
  justify-content: flex-end;
  padding: 14px;
  color: var(--gat-chat-white);
  font-family: Arial, Helvetica, sans-serif;
}

.gat-chat-modal.is-open { display: flex; }

.gat-chat-scrim {
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 12, 0.76);
  backdrop-filter: blur(9px);
  animation: gatChatFade 180ms ease both;
}

.gat-chat-drawer {
  position: relative;
  z-index: 1;
  width: min(100%, 490px);
  height: 100%;
  overflow: auto;
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: 26px;
  background: radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.12), transparent 34%), var(--gat-chat-panel);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.4);
  animation: gatChatSlide 260ms ease both;
}

.gat-chat-close {
  position: absolute;
  z-index: 3;
  top: 20px;
  right: 22px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--gat-chat-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 25px;
  cursor: pointer;
}

.gat-chat-auth { padding: 58px 42px 38px; }
.gat-chat-logo,
.gat-chat-avatar {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff197d, var(--gat-chat-violet), var(--gat-chat-cyan));
  color: white;
  font-weight: 900;
}
.gat-chat-logo { width: 66px; height: 66px; margin-bottom: 28px; border-radius: 22px; }
.gat-chat-eyebrow { margin: 0 0 8px; color: var(--gat-chat-cyan); font-size: 10px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.gat-chat-auth h2 { margin: 0; color: white; font-size: 40px; letter-spacing: -.055em; line-height: 1; }
.gat-chat-muted { margin: 20px 0 26px; color: var(--gat-chat-muted); line-height: 1.65; }

.gat-chat-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 22px;
  padding: 5px;
  border: 1px solid var(--gat-chat-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}
.gat-chat-tabs button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--gat-chat-muted); font-weight: 780; cursor: pointer; }
.gat-chat-tabs button.is-active { color: white; background: rgba(139, 92, 246, 0.2); box-shadow: inset 0 0 0 1px rgba(139, 92, 246, 0.36); }

.gat-chat-error { margin: 0 0 16px; padding: 12px 14px; border: 1px solid rgba(255, 94, 135, 0.42); border-radius: 11px; background: rgba(255, 31, 100, 0.1); color: #ffacc8; font-size: 13px; line-height: 1.5; }
.gat-chat-form { display: grid; gap: 16px; }
.gat-chat-form label { display: grid; gap: 8px; color: #e7ebfa; font-size: 12px; font-weight: 750; }
.gat-chat-form label small { color: var(--gat-chat-muted); font-weight: 500; }
.gat-chat-form input,
.gat-chat-composer textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--gat-chat-line); outline: 0; background: rgba(255, 255, 255, 0.055); color: white; font: inherit; }
.gat-chat-form input { min-height: 50px; padding: 0 15px; border-radius: 12px; }
.gat-chat-form input:focus,
.gat-chat-composer textarea:focus { border-color: var(--gat-chat-cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.gat-chat-consent { grid-template-columns: auto 1fr !important; align-items: start; color: var(--gat-chat-muted) !important; font-weight: 500 !important; line-height: 1.5; }
.gat-chat-consent input { width: 18px; min-height: 18px; margin-top: 1px; accent-color: var(--gat-chat-pink); }
.gat-chat-primary { min-height: 54px; border: 0; border-radius: 13px; background: linear-gradient(135deg, #ff197d, #e31bdb); color: white; font: inherit; font-weight: 800; cursor: pointer; }
.gat-chat-primary:disabled,
.gat-chat-composer button:disabled { opacity: .5; cursor: wait; }

.gat-chat-inbox { display: grid; min-height: 100%; grid-template-rows: auto auto 1fr auto; overflow: hidden; }
.gat-chat-inbox[hidden],
.gat-chat-auth[hidden],
.gat-chat-code[hidden] { display: none !important; }
.gat-chat-inbox > header { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 23px 26px 18px; border-bottom: 1px solid var(--gat-chat-line); }
.gat-chat-avatar { width: 47px; height: 47px; border-radius: 15px; font-size: 12px; }
.gat-chat-inbox header h2 { margin: 0; color: white; font-size: 20px; letter-spacing: -.035em; }
.gat-chat-inbox header .gat-chat-eyebrow { margin-bottom: 3px; font-size: 9px; }
.gat-chat-inbox header span { display: flex; align-items: center; gap: 6px; margin-top: 4px; color: var(--gat-chat-muted); font-size: 11px; }
.gat-chat-inbox header span i { width: 6px; height: 6px; border-radius: 50%; background: #28eab8; }
.gat-chat-inbox header > button { border: 0; background: transparent; color: var(--gat-chat-muted); font-size: 11px; font-weight: 700; cursor: pointer; }

.gat-chat-code { margin: 18px 22px 0; padding: 18px; border: 1px solid rgba(34, 211, 238, 0.35); border-radius: 16px; background: linear-gradient(135deg, rgba(34, 211, 238, 0.1), rgba(139, 92, 246, 0.12)); text-align: center; }
.gat-chat-code > span { display: block; color: var(--gat-chat-cyan); font-size: 10px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.gat-chat-code strong { display: block; margin: 9px 0 5px; color: white; font-family: monospace; font-size: 23px; letter-spacing: .05em; }
.gat-chat-code p { margin: 0 0 12px; color: var(--gat-chat-muted); font-size: 12px; line-height: 1.5; }
.gat-chat-code button { padding: 8px 12px; border: 1px solid var(--gat-chat-cyan); border-radius: 8px; background: transparent; color: white; cursor: pointer; }

.gat-chat-messages { display: flex; min-height: 280px; flex-direction: column; gap: 10px; overflow-y: auto; padding: 22px; }
.gat-chat-bubble { width: fit-content; max-width: 84%; padding: 13px 15px 10px; box-sizing: border-box; border: 1px solid var(--gat-chat-line); border-radius: 16px 16px 16px 4px; background: rgba(255, 255, 255, 0.06); }
.gat-chat-bubble.is-member { align-self: flex-end; border-color: rgba(255, 47, 179, 0.3); border-radius: 16px 16px 4px 16px; background: linear-gradient(135deg, rgba(255, 25, 125, 0.18), rgba(139, 92, 246, 0.18)); }
.gat-chat-bubble.is-broadcast { width: 100%; max-width: 100%; border-color: rgba(34, 211, 238, 0.32); background: linear-gradient(135deg, rgba(34, 211, 238, 0.08), rgba(139, 92, 246, 0.11)); }
.gat-chat-bubble > span { color: var(--gat-chat-cyan); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.gat-chat-bubble.is-member > span { color: var(--gat-chat-pink); }
.gat-chat-bubble p { margin: 6px 0 7px; color: #f4f6ff; font-size: 14px; line-height: 1.48; white-space: pre-wrap; }
.gat-chat-bubble time { display: block; color: #737d9c; font-size: 9px; }
.gat-chat-composer { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px 20px 20px; border-top: 1px solid var(--gat-chat-line); }
.gat-chat-composer textarea { min-height: 54px; max-height: 120px; resize: vertical; padding: 15px; border-radius: 14px; }
.gat-chat-composer button { align-self: end; min-height: 54px; padding: 0 18px; border: 0; border-radius: 13px; background: linear-gradient(135deg, #ff197d, #e31bdb); color: white; font: inherit; font-weight: 800; cursor: pointer; }

@keyframes gatChatFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gatChatSlide { from { opacity: 0; transform: translateX(36px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 600px) {
  .gat-chat-modal { padding: 0; }
  .gat-chat-drawer { width: 100%; border-radius: 0; }
  .gat-chat-auth { padding: 56px 22px 28px; }
  .gat-chat-inbox > header { padding: 18px 20px; }
  .gat-chat-messages { padding-inline: 16px; }
  .gat-chat-composer { padding: 12px 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .gat-chat-scrim,
  .gat-chat-drawer { animation: none; }
}
