:root {
  --sae-purple: #762397;
  --sae-purple-dark: #501568;
  --sae-yellow: #f7b500;
  --sae-ink: #23182a;
  --sae-muted: #6f6675;
  --sae-line: #e9e2ed;
  --sae-soft: #f8f4fa;
  --sae-danger: #a61b29;
}

.sae-hide-legacy-chat #samanban-chat-bubble,
.sae-hide-legacy-chat #samanban-chat-window {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

.sae-root,
.sae-root * {
  box-sizing: border-box;
}

.sae-root {
  direction: rtl;
  text-align: right;
  font-family: "Dana", Tahoma, Arial, sans-serif !important;
  color: var(--sae-ink);
  position: relative;
  z-index: 999999;
}

.sae-root button,
.sae-root input,
.sae-root textarea,
.sae-root select {
  font: inherit !important;
}

.sae-launcher {
  position: fixed;
  z-index: 999999;
  left: 18px;
  bottom: 18px;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #8b35ad, var(--sae-purple-dark));
  box-shadow: 0 10px 28px rgba(64, 16, 82, .3);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}

.sae-launcher:hover,
.sae-launcher:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 13px 32px rgba(64, 16, 82, .38);
}

.sae-launcher:focus-visible,
.sae-root button:focus-visible,
.sae-root a:focus-visible,
.sae-root input:focus-visible,
.sae-root textarea:focus-visible,
.sae-root select:focus-visible {
  outline: 3px solid rgba(247, 181, 0, .62) !important;
  outline-offset: 2px;
}

.sae-launcher-ring {
  position: absolute;
  inset: -4px;
  border: 2px solid rgba(118, 35, 151, .22);
  border-radius: inherit;
  animation: sae-pulse 2.8s ease-out infinite;
  pointer-events: none;
}

.sae-launcher-icon {
  width: 27px;
  height: 27px;
}


.sae-panel {
  position: fixed;
  z-index: 999998;
  left: 18px;
  bottom: 86px;
  width: min(390px, calc(100vw - 28px));
  height: min(670px, calc(100vh - 106px));
  height: min(670px, calc(100dvh - 106px));
  max-height: 670px;
  min-height: 430px;
  border: 1px solid rgba(89, 42, 105, .14);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 22px 68px rgba(35, 14, 43, .24);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px) scale(.97);
  transform-origin: bottom left;
  transition: opacity .2s ease, visibility .2s ease, transform .2s ease;
}

.sae-panel.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.sae-header {
  min-height: 68px;
  padding: 11px 13px;
  background: linear-gradient(120deg, var(--sae-purple-dark), var(--sae-purple));
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.sae-brand-mark {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-size: 22px;
  font-weight: 900;
  color: var(--sae-purple-dark);
  background: var(--sae-yellow);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.35);
}

.sae-heading {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  line-height: 1.45;
}

.sae-heading strong {
  font-size: 15px;
  font-weight: 800;
}

.sae-heading span {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: rgba(255,255,255,.78);
}

.sae-heading i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64df91;
  box-shadow: 0 0 0 3px rgba(100,223,145,.17);
}

.sae-icon-button {
  width: 32px;
  height: 32px;
  padding: 6px;
  border: 0;
  border-radius: 9px;
  background: rgba(255,255,255,.1);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sae-icon-button:hover { background: rgba(255,255,255,.2); }
.sae-icon-button svg { width: 19px; height: 19px; }

.sae-mode {
  padding: 8px 11px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  border-bottom: 1px solid var(--sae-line);
  background: #fff;
  flex: 0 0 auto;
}

.sae-mode button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid var(--sae-line);
  border-radius: 10px;
  background: #fff;
  color: var(--sae-muted);
  font-size: 12px !important;
  cursor: pointer;
}

.sae-mode button[aria-pressed="true"] {
  color: var(--sae-purple-dark);
  border-color: rgba(118,35,151,.25);
  background: #f6ecfa;
  font-weight: 800;
}

.sae-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 12px 8px;
  background:
    radial-gradient(circle at 15% 0, rgba(247,181,0,.07), transparent 33%),
    #fbfafc;
  scrollbar-width: thin;
  scrollbar-color: #cfc3d4 transparent;
}

.sae-message {
  display: flex;
  margin: 0 0 10px;
  animation: sae-message-in .18s ease-out both;
}

.sae-message-bubble {
  max-width: 88%;
  padding: 10px 11px;
  border-radius: 16px 16px 5px 16px;
  background: #fff;
  border: 1px solid var(--sae-line);
  box-shadow: 0 3px 13px rgba(52, 25, 61, .045);
}

.sae-user { justify-content: flex-end; }
.sae-user .sae-message-bubble {
  color: #fff;
  background: var(--sae-purple);
  border-color: var(--sae-purple);
  border-radius: 16px 16px 16px 5px;
}

.sae-message-text {
  margin: 0 !important;
  color: inherit !important;
  font-size: 13px !important;
  line-height: 1.85 !important;
  white-space: pre-line;
  overflow-wrap: anywhere;
  text-align: right !important;
}

.sae-sources {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--sae-line);
  font-size: 11px;
}

.sae-sources summary {
  color: var(--sae-purple);
  cursor: pointer;
  font-weight: 700;
}

.sae-sources ul {
  margin: 7px 17px 0 0 !important;
  padding: 0 !important;
}

.sae-sources li { margin: 4px 0; line-height: 1.55; }
.sae-sources a { color: var(--sae-purple-dark) !important; text-decoration: underline; }

.sae-feedback {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--sae-muted);
  font-size: 10px;
}

.sae-feedback button {
  padding: 2px 7px;
  border: 1px solid var(--sae-line);
  border-radius: 8px;
  color: var(--sae-muted);
  background: #fff;
  font-size: 10px !important;
  cursor: pointer;
}

.sae-primary-action,
.sae-secondary-action,
.sae-link-action {
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 12px !important;
  cursor: pointer;
}

.sae-primary-action {
  margin-top: 9px;
  border: 1px solid var(--sae-purple);
  color: #fff;
  background: var(--sae-purple);
  font-weight: 700;
}

.sae-primary-action:hover { background: var(--sae-purple-dark); }
.sae-primary-action:disabled { opacity: .55; cursor: not-allowed; }

.sae-secondary-action {
  margin-top: 9px;
  border: 1px solid #cdbfd3;
  color: var(--sae-purple-dark);
  background: #fff;
}

.sae-link-action {
  margin-top: 9px;
  border: 0;
  color: var(--sae-muted);
  background: transparent;
  text-decoration: underline;
}

.sae-consent-actions,
.sae-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sae-notice {
  width: fit-content;
  max-width: 92%;
  margin: 8px auto 12px;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--sae-muted);
  background: #f1edf3;
  font-size: 10px;
  line-height: 1.6;
  text-align: center;
}

.sae-soft-nudge {
  margin: 9px 0 12px;
  padding: 9px 10px;
  border: 1px dashed rgba(118,35,151,.28);
  border-radius: 12px;
  background: #f8f1fa;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  color: var(--sae-purple-dark);
  font-size: 11px;
}

.sae-soft-nudge button {
  flex: 0 0 auto;
  border: 0;
  border-radius: 9px;
  padding: 6px 8px;
  color: #fff;
  background: var(--sae-purple);
  font-size: 10px !important;
  cursor: pointer;
}

.sae-typing {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 3px 13px 5px;
  padding: 8px 12px;
  border: 1px solid var(--sae-line);
  border-radius: 13px;
  background: #fff;
}

.sae-typing[hidden] { display: none !important; }
.sae-typing span {
  width: 6px;
  height: 6px;
  margin: 0 2px;
  border-radius: 50%;
  background: #9a7ca6;
  display: inline-block;
  animation: sae-dot 1.1s infinite ease-in-out;
}
.sae-typing span:nth-child(2) { animation-delay: .12s; }
.sae-typing span:nth-child(3) { animation-delay: .24s; }

.sae-suggestions {
  flex: 0 0 auto;
  padding: 4px 10px 7px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  background: #fbfafc;
  scrollbar-width: none;
}
.sae-suggestions::-webkit-scrollbar { display: none; }

.sae-suggestion {
  flex: 0 0 auto;
  max-width: 240px;
  padding: 6px 9px;
  border: 1px solid rgba(118,35,151,.2);
  border-radius: 999px;
  color: var(--sae-purple-dark);
  background: #fff;
  font-size: 10.5px !important;
  white-space: nowrap;
  cursor: pointer;
}

.sae-suggestion:hover { background: #f6ecfa; }

.sae-composer {
  flex: 0 0 auto;
  padding: 8px 9px;
  border-top: 1px solid var(--sae-line);
  background: #fff;
  display: flex;
  gap: 7px;
  align-items: flex-end;
}

.sae-composer textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 40px;
  max-height: 96px;
  resize: none;
  padding: 9px 11px !important;
  border: 1px solid #dcd2e0 !important;
  border-radius: 12px !important;
  color: var(--sae-ink) !important;
  background: #fcfbfd !important;
  box-shadow: none !important;
  font-size: 13px !important;
  line-height: 1.6 !important;
}

.sae-composer textarea:focus { border-color: var(--sae-purple) !important; }
.sae-composer button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  padding: 9px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--sae-purple);
  cursor: pointer;
}
.sae-composer button:disabled { opacity: .5; cursor: not-allowed; }
.sae-composer svg { width: 21px; height: 21px; fill: none; }
.sae-composer svg path { stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

.sae-panel::after {
  content: "اطلاعات تماس فقط با تأیید شما ثبت می‌شود";
  flex: 0 0 auto;
  display: block;
  padding: 3px 10px 5px;
  color: #8a808f;
  background: #fff;
  font-size: 9px;
  text-align: center;
}

.sae-lead-card .sae-message-bubble,
.sae-lead-review .sae-message-bubble {
  width: 100%;
  max-width: 100%;
}

.sae-form-title {
  display: block;
  color: var(--sae-purple-dark);
  font-size: 14px;
  margin-bottom: 3px;
}

.sae-form-help {
  margin: 0 0 9px !important;
  color: var(--sae-muted) !important;
  font-size: 10.5px !important;
  line-height: 1.65 !important;
}

.sae-lead-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sae-lead-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
  color: var(--sae-ink);
  font-size: 10.5px;
}

.sae-lead-field input,
.sae-lead-field textarea,
.sae-lead-field select,
.sae-lead-form > .sae-lead-field select {
  width: 100%;
  min-height: 36px;
  padding: 6px 8px !important;
  border: 1px solid #dcd2e0 !important;
  border-radius: 9px !important;
  color: var(--sae-ink) !important;
  background: #fff !important;
  box-shadow: none !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

.sae-lead-field textarea { min-height: 72px; resize: vertical; }
.sae-full { grid-column: 1 / -1; width: 100%; }

.sae-check-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: -1px 0 9px;
  color: var(--sae-muted);
  font-size: 10px;
  line-height: 1.55;
}
.sae-check-row input { width: 15px; height: 15px; margin: 1px 0 0; accent-color: var(--sae-purple); }

.sae-optional-fields {
  margin-top: 2px;
  padding: 7px 8px;
  border: 1px solid var(--sae-line);
  border-radius: 10px;
}
.sae-optional-fields summary { color: var(--sae-purple); font-size: 11px; cursor: pointer; }
.sae-optional-fields .sae-lead-grid { margin-top: 9px; }

.sae-honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
}

.sae-form-error {
  margin-top: 7px;
  color: var(--sae-danger);
  font-size: 10px;
  line-height: 1.55;
}
.sae-form-error:empty { display: none; }

.sae-review-list {
  margin: 8px 0 !important;
  padding: 0;
  border: 1px solid var(--sae-line);
  border-radius: 10px;
  overflow: hidden;
}
.sae-review-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 7px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--sae-line);
  font-size: 10.5px;
  line-height: 1.55;
}
.sae-review-row:last-child { border-bottom: 0; }
.sae-review-row dt { color: var(--sae-muted); }
.sae-review-row dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }

.sae-security {
  margin-top: 8px;
  padding: 7px;
  border-radius: 10px;
  background: var(--sae-soft);
  overflow: hidden;
}
.sae-security p { margin: 0 0 6px !important; color: var(--sae-muted) !important; font-size: 10px !important; }
.sae-security-status { display: block; margin-top: 4px; color: var(--sae-muted); font-size: 9.5px; }
.sae-turnstile { min-height: 64px; direction: ltr; }

.sae-fallback-link {
  margin: 8px 0 0 !important;
  padding: 7px;
  border-radius: 9px;
  background: #fff5d8;
  color: #5d4914 !important;
  font-size: 10.5px !important;
}
.sae-fallback-link a { color: var(--sae-purple-dark) !important; text-decoration: underline; font-weight: 700; }
.sae-lead-review.is-submitted .sae-review-list { opacity: .7; }

.sae-prefill-notice {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid rgba(118,35,151,.22);
  border-right: 4px solid var(--sae-purple);
  border-radius: 9px;
  color: #3c2944;
  background: #f8f1fa;
  font-size: 14px;
  line-height: 1.8;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

@keyframes sae-pulse {
  0% { transform: scale(.9); opacity: .8; }
  70%, 100% { transform: scale(1.25); opacity: 0; }
}
@keyframes sae-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: .45; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes sae-message-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {

  #sae-launcher {
  bottom: 55px !important;
    left:15px !important;
    width: 44px;
    height: 44px;
  }
  .sae-launcher-icon { width: 21px; height: 21px; }
  .sae-panel {
    left: max(7px, env(safe-area-inset-left));
    bottom: max(59px, calc(env(safe-area-inset-bottom) + 55px));
    width: calc(100vw - 14px);
    height: min(680px, calc(100vh - 69px));
    height: min(680px, calc(100dvh - 69px));
    min-height: 370px;
    border-radius: 18px;
  }
  .sae-message-bubble { max-width: 92%; }
  .sae-lead-card .sae-message-bubble,
  .sae-lead-review .sae-message-bubble { max-width: 100%; }
  .sae-composer textarea { font-size: 16px !important; }
}

@media (max-width: 360px) {
  .sae-header { padding-inline: 9px; }
  .sae-brand-mark { width: 35px; height: 35px; }
  .sae-messages { padding-inline: 8px; }
  .sae-lead-grid { grid-template-columns: 1fr; }
  .sae-turnstile { transform: scale(.88); transform-origin: top right; min-height: 58px; width: 114%; }
}

@media (prefers-reduced-motion: reduce) {
  .sae-root *,
  .sae-root *::before,
  .sae-root *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

