.sanda-chatbot {
  --sanda-ink: #1c2228;
  --sanda-accent: #d4e5f8;
  --sanda-accent-dark: #4f6f8f;
  --sanda-pale: #f3f6f9;
  --sanda-paper: #fff;
  --sanda-line: #d9e0e7;
  --sanda-muted: #6f7982;
  --sanda-brand-bg: #d4e5f8;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 999999;
  color: var(--sanda-ink);
  font-family: inherit;
}

.sanda-chatbot *,
.sanda-chatbot *::before,
.sanda-chatbot *::after { box-sizing: border-box; }

.sanda-chatbot__launch-group {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
  animation: sanda-chatbot-bounce 2.8s ease-in-out infinite;
}

.sanda-chatbot__launcher-label {
  position: relative;
  padding: 9px 12px;
  border: 1px solid var(--sanda-line);
  border-radius: 0;
  color: var(--sanda-ink);
  background: #fff;
  box-shadow: 0 4px 14px rgba(22, 29, 36, 0.08);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  direction: rtl;
}

.sanda-chatbot__launcher-label::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -6px;
  width: 11px;
  height: 11px;
  border-top: 1px solid var(--sanda-line);
  border-right: 1px solid var(--sanda-line);
  background: #fff;
  transform: translateY(-50%) rotate(45deg);
}

.sanda-chatbot__launcher {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: transform 160ms ease;
}

.sanda-chatbot .sanda-chatbot__launcher {
  padding: 0 !important;
  overflow: visible;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.sanda-chatbot__launcher img { display: block; width: 60px; height: 60px; }

.sanda-chatbot__launcher:hover,
.sanda-chatbot__launcher:focus-visible { transform: translateY(-2px); }
.sanda-chatbot--open .sanda-chatbot__launch-group { visibility: hidden; pointer-events: none; animation: none; }

@keyframes sanda-chatbot-bounce {
  0%, 82%, 100% { transform: translateY(0); }
  88% { transform: translateY(-9px); }
  94% { transform: translateY(-3px); }
}

.sanda-chatbot__panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  width: min(390px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 48px));
  overflow: hidden;
  border: 1px solid var(--sanda-line);
  border-radius: 0;
  background: #fff;
  box-shadow: 0 14px 38px rgba(22, 29, 36, 0.16);
  transform-origin: bottom right;
  animation: sanda-chatbot-open 180ms ease-out;
}

.sanda-chatbot__panel[hidden] { display: none; }

@keyframes sanda-chatbot-open {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.sanda-chatbot__header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  padding: 7px 14px 8px;
  border-bottom: 1px solid #1c2228;
  background: #fff;
}

.sanda-chatbot__identity { min-width: 0; text-align: right; }
.sanda-chatbot__title-row { display: block; min-width: 0; }
.sanda-chatbot__identity strong { display: block; color: #111; font-size: 14px; font-weight: 700; line-height: 1.35; }

.sanda-chatbot__status { display: flex; align-items: center; justify-content: flex-start; margin-top: 3px; color: #567162; font-size: 9px; font-weight: 500; line-height: 1; white-space: nowrap; }
.sanda-chatbot__status::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-left: 4px; border-radius: 50%; background: #63a66d; }
.sanda-chatbot__actions { display: flex; flex: 0 0 auto; align-items: center; gap: 2px; }

.sanda-chatbot__new,
.sanda-chatbot__close {
  display: grid;
  width: 30px;
  height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: var(--sanda-ink);
  background: transparent;
  font: inherit;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sanda-chatbot__new:hover,
.sanda-chatbot__close:hover { color: #000; background: #f1f4f7; }

.sanda-chatbot__new:disabled { opacity: 0.55; cursor: wait; }

.sanda-chatbot__new svg,
.sanda-chatbot__close svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sanda-chatbot__new {
  color: var(--sanda-ink);
}

.sanda-chatbot__new:hover { color: #000; }

.sanda-chatbot__messages {
  overflow-y: auto;
  padding: 14px;
  background: #f7f9fb;
}

.sanda-chatbot__message {
  width: fit-content;
  max-width: 86%;
  margin: 0 0 8px;
  padding: 10px 12px;
  border-radius: 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.75;
}

.sanda-chatbot__message--assistant { margin-left: auto; border: 1px solid var(--sanda-line); background: #fff; }
.sanda-chatbot__message--user { margin-right: auto; color: var(--sanda-ink); background: var(--sanda-brand-bg); }
.sanda-chatbot__message--error { margin-left: auto; color: #8b1e1e; background: #fff0f0; }

.sanda-chatbot__typing {
  display: flex;
  width: 48px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  direction: ltr;
}

.sanda-chatbot__typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #71879a;
  animation: sanda-chatbot-typing 1.1s ease-in-out infinite;
}

.sanda-chatbot__typing-dot:nth-child(2) { animation-delay: 140ms; }
.sanda-chatbot__typing-dot:nth-child(3) { animation-delay: 280ms; }

@keyframes sanda-chatbot-typing {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.sanda-chatbot__prompt-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  border-top: 1px solid rgba(213, 237, 245, 0.7);
  background: #fff;
  scrollbar-width: thin;
  scrollbar-color: var(--sanda-accent) transparent;
}

.sanda-chatbot__prompt-strip[hidden] { display: none; }

.sanda-chatbot__prompt-strip button {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--sanda-line);
  border-radius: 0;
  color: var(--sanda-ink);
  background: #fff;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.sanda-chatbot .sanda-chatbot__prompt-strip button {
  min-height: 32px;
  padding: 7px 10px !important;
  border: 1px solid var(--sanda-line) !important;
  border-radius: 0 !important;
  color: var(--sanda-ink) !important;
  font-size: 11px !important;
  font-weight: 500 !important;
  line-height: 1.4 !important;
}

.sanda-chatbot__prompt-strip button:hover { border-color: #8fa2b4; background: #f6f8fa; }

.sanda-chatbot__products { display: grid; gap: 8px; margin: 0 0 12px; }

.sanda-chatbot__product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--sanda-line);
  border-radius: 0;
  color: inherit;
  background: #fff;
  text-decoration: none;
}

.sanda-chatbot__product:hover { border-color: var(--sanda-accent); }
.sanda-chatbot__product img { width: 58px; height: 72px; flex: 0 0 auto; border-radius: 0; object-fit: cover; background: var(--sanda-pale); }
.sanda-chatbot__product-copy { min-width: 0; }
.sanda-chatbot__product-copy strong,
.sanda-chatbot__product-copy small { display: block; overflow: hidden; text-overflow: ellipsis; }
.sanda-chatbot__product-copy small { margin-top: 4px; color: var(--sanda-muted); font-size: 10px; }

.sanda-chatbot__composer {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "send input";
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-top: 1px solid var(--sanda-line);
  background: #fff;
  direction: ltr;
}

.sanda-chatbot__credit {
  margin: 0;
  padding: 0 12px 8px;
  color: #71879a;
  background: #fff;
  font-size: 9px;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
}

.sanda-chatbot__prompt {
  grid-area: input;
  width: 100%;
  min-height: 44px;
  max-height: 110px;
  margin: 0;
  padding: 11px 13px;
  resize: none;
  border: 1px solid #bcc7d1;
  border-radius: 0;
  color: var(--sanda-ink);
  background: #fff;
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  direction: rtl;
}

.sanda-chatbot__prompt:focus { outline: 2px solid rgba(79, 111, 143, 0.12); border-color: #71879a; }

.sanda-chatbot__send {
  grid-area: send;
  display: grid;
  min-width: 68px;
  height: 44px;
  padding: 0 15px;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: #fff;
  background: #1c2228;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  direction: rtl;
}

.sanda-chatbot .sanda-chatbot__send {
  padding: 0 15px !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: #fff !important;
  background: #1c2228 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

.sanda-chatbot__send:hover { background: #000; }
.sanda-chatbot__send:disabled { opacity: 0.55; cursor: wait; }

.sanda-chatbot__login-modal { position: fixed; inset: 0; z-index: 1000000; display: grid; place-items: center; padding: 20px; background: rgba(13, 43, 61, 0.42); backdrop-filter: blur(7px); animation: sanda-chatbot-fade 160ms ease-out; }
.sanda-chatbot__login-modal[hidden] { display: none; }
.sanda-chatbot__login-card { position: relative; width: min(390px, calc(100vw - 32px)); padding: 32px 28px 28px; border: 1px solid var(--sanda-line); border-radius: 0; background: #fff; box-shadow: 0 18px 52px rgba(22, 29, 36, 0.22); text-align: center; direction: rtl; }
.sanda-chatbot__login-icon { display: grid; width: 72px; height: 72px; margin: 0 auto 14px; place-items: center; border-radius: 0; background: var(--sanda-brand-bg); }
.sanda-chatbot__login-icon img { display: block; width: 64px; height: 64px; }
.sanda-chatbot__login-card h2 { margin: 0 0 10px; color: var(--sanda-ink); font-size: 21px; line-height: 1.5; }
.sanda-chatbot__login-card p { margin: 0 0 22px; color: var(--sanda-muted); font-size: 15px; line-height: 1.9; }
.sanda-chatbot__login-close { position: absolute; top: 13px; left: 13px; width: 34px; height: 34px; padding: 0; border: 1px solid var(--sanda-line); border-radius: 0; color: var(--sanda-ink); background: #fff; font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.sanda-chatbot__login-button,
.sanda-chatbot .sanda-chatbot__login-button { display: flex; min-height: 50px; align-items: center; justify-content: center; padding: 10px 18px; border: 0 !important; border-radius: 0 !important; color: #fff !important; background: #1c2228 !important; box-shadow: none; font-size: 15px; font-weight: 800; text-decoration: none !important; }
.sanda-chatbot__login-button:hover { background: #000 !important; }

@keyframes sanda-chatbot-fade { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 520px) {
  .sanda-chatbot { right: 12px; bottom: 12px; }
  .sanda-chatbot__launcher { width: 60px; height: 60px; }
  .sanda-chatbot__launcher img { width: 51px; height: 51px; }
  .sanda-chatbot__launcher-label { max-width: 205px; padding: 9px 11px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; }
  .sanda-chatbot__panel { width: calc(100vw - 24px); height: min(600px, calc(100vh - 24px)); border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sanda-chatbot__panel { animation: none; }
  .sanda-chatbot__login-modal { animation: none; }
  .sanda-chatbot__launch-group { animation: none; }
  .sanda-chatbot__typing-dot { animation: none; opacity: 0.65; }
  .sanda-chatbot * { transition: none !important; }
}
