.sf-ai-assistant {
  position: fixed;
  right: 22px;
  bottom: 18px;
  z-index: 100100;
  max-width: calc(100vw - 24px);
  font-family: "Manrope", Arial, sans-serif;
  color: #141414;
}

.sf-ai-assistant.is-open {
  bottom: 18px;
}

.sf-ai-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 18px 0 14px;
  color: #fff;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  box-shadow: 0 18px 42px rgba(16, 16, 16, 0.18);
  font: inherit;
  font-size: 0.96rem;
  font-weight: 900;
  cursor: pointer;
}

.sf-ai-trigger-dot {
  width: 30px;
  height: 30px;
  background:
    radial-gradient(circle at 42% 38%, #fff 0 3px, transparent 4px),
    linear-gradient(135deg, #ff9b1a, #ee7900);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.sf-ai-assistant.is-open .sf-ai-trigger {
  display: none;
}

.sf-ai-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(420px, calc(100vw - 28px));
  height: min(720px, calc(100vh - 40px));
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.12);
  border-radius: 8px;
  box-shadow: 0 24px 68px rgba(16, 16, 16, 0.22);
}

.sf-ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 18px 16px;
  color: #fff;
  background:
    radial-gradient(circle at 16% 0%, rgba(238, 121, 0, 0.34), transparent 36%),
    linear-gradient(135deg, #151515, #202020);
}

.sf-ai-intro {
  margin: 0;
  padding: 14px 18px;
  color: #4b5563;
  background: #fff;
  border-bottom: 1px solid rgba(16, 16, 16, 0.08);
  font-size: 0.92rem;
  font-weight: 760;
  line-height: 1.45;
}

.sf-ai-assistant.has-conversation .sf-ai-intro,
.sf-ai-assistant.has-conversation .sf-ai-quick-label,
.sf-ai-assistant.has-conversation .sf-ai-quick {
  display: none;
}

.sf-ai-header span {
  display: block;
  margin-bottom: 4px;
  color: #ffad46;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.sf-ai-header strong {
  display: block;
  color: #fff;
  font-size: 1.34rem;
  line-height: 1;
  letter-spacing: -0.02em;
}

.sf-ai-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font: inherit;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.sf-ai-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 auto;
  min-height: 150px;
  overflow-y: auto;
  padding: 14px 16px 12px;
  background: #fbfaf7;
  scroll-behavior: smooth;
}

.sf-ai-assistant.has-conversation .sf-ai-messages {
  min-height: 0;
}

.sf-ai-message {
  width: fit-content;
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.94rem;
  line-height: 1.45;
}

.sf-ai-message.is-bot {
  width: 100%;
  max-width: 100%;
  color: #303743;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.08);
}

.sf-ai-message.is-user {
  align-self: flex-end;
  color: #fff;
  background: #1a1a1a;
}

.sf-ai-message.is-thinking {
  color: #6b7280;
  font-style: italic;
}

.sf-ai-message-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin: 2px 0 2px;
  padding: 10px 12px;
  color: #141414;
  background: #fff;
  border: 1px solid rgba(238, 121, 0, 0.38);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 950;
  text-decoration: none;
}

.sf-ai-message-cta svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sf-ai-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: -2px;
}

.sf-ai-followups button {
  min-height: 32px;
  padding: 7px 10px;
  color: #303743;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.1);
  border-radius: 999px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 780;
  line-height: 1.1;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.sf-ai-followups button:hover {
  color: #141414;
  background: #fff8ef;
  border-color: rgba(238, 121, 0, 0.38);
  transform: translateY(-1px);
}

.sf-ai-quick-label {
  margin: 0;
  padding: 12px 16px 0;
  color: #ee7900;
  background: #fbfaf7;
  border-top: 1px solid rgba(16, 16, 16, 0.06);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sf-ai-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 14px;
  background: #fbfaf7;
}

.sf-ai-quick button {
  min-height: 36px;
  padding: 8px 11px;
  color: #202020;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.1);
  border-radius: 8px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease;
}

.sf-ai-quick button:hover {
  border-color: rgba(238, 121, 0, 0.38);
  transform: translateY(-1px);
}

.sf-ai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid rgba(16, 16, 16, 0.08);
  flex: 0 0 auto;
}

.sf-ai-form textarea {
  width: 100%;
  min-height: 46px;
  max-height: 96px;
  resize: none;
  overflow-y: auto;
  padding: 12px 13px;
  color: #141414;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.16);
  border-radius: 8px;
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.35;
}

.sf-ai-form button {
  align-self: stretch;
  min-width: 66px;
  color: #fff;
  background: #ee7900;
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 950;
  cursor: pointer;
}

.sf-ai-form button:disabled,
.sf-ai-form textarea:disabled {
  opacity: 0.64;
  cursor: wait;
}

.sf-ai-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 0 16px 10px;
  background: #fff;
  flex: 0 0 auto;
}

.sf-ai-actions a {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 34px;
  padding: 7px 11px;
  color: #141414;
  background: #fff;
  border: 1px solid rgba(16, 16, 16, 0.12);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.1;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.sf-ai-actions a:hover {
  color: #141414;
  background: #fff8ef;
  border-color: rgba(238, 121, 0, 0.34);
  transform: translateY(-1px);
}

.sf-ai-actions .sf-ai-action-primary {
  color: #fff;
  background: #141414;
  border-color: #141414;
}

.sf-ai-actions .sf-ai-action-primary:hover {
  color: #fff;
  background: #ee7900;
  border-color: #ee7900;
}

.sf-ai-assistant .sf-ai-note {
  margin: 0;
  padding: 0 18px 14px;
  color: #6b7280;
  background: #fff;
  font-size: 11px !important;
  font-weight: 600;
  line-height: 1.25 !important;
  text-align: center;
  flex: 0 0 auto;
}

@media (max-width: 680px) {
  .sf-ai-assistant {
    right: auto;
    left: 10px;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .sf-ai-assistant.is-open {
    right: 8px;
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: none;
  }

  .sf-ai-trigger {
    width: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    font-size: 0.9rem;
  }

  .sf-ai-trigger-dot {
    width: 28px;
    height: 28px;
  }

  .sf-ai-trigger span:not(.sf-ai-trigger-dot) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .sf-ai-panel {
    position: fixed;
    right: 8px;
    left: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    height: auto;
    max-height: min(84dvh, calc(var(--sf-ai-vh, 100vh) - 18px));
    border-radius: 14px;
  }

  .sf-ai-assistant.has-conversation .sf-ai-panel {
    height: min(82dvh, calc(var(--sf-ai-vh, 100vh) - 18px));
    max-height: 640px;
  }

  .sf-ai-assistant.is-keyboard .sf-ai-panel {
    height: calc(var(--sf-ai-vh, 100vh) - 10px);
    max-height: none;
    bottom: 5px;
  }

  .sf-ai-header {
    padding: 12px 14px 11px;
  }

  .sf-ai-header span {
    margin-bottom: 3px;
    font-size: 0.64rem;
  }

  .sf-ai-header strong {
    font-size: 1.02rem;
  }

  .sf-ai-messages {
    flex: 0 0 auto;
    min-height: 0;
    max-height: 148px;
    padding: 9px 10px 8px;
  }

  .sf-ai-assistant:not(.has-conversation) .sf-ai-messages {
    display: none !important;
    flex: 0 0 auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
  }

  .sf-ai-assistant:not(.has-conversation) .sf-ai-panel {
    height: auto !important;
    max-height: calc(var(--sf-ai-vh, 100vh) - 18px);
  }

  .sf-ai-intro {
    padding: 9px 12px;
    font-size: 0.82rem;
    line-height: 1.34;
  }

  .sf-ai-assistant.has-conversation .sf-ai-messages {
    flex: 1 1 auto;
    max-height: none;
    padding: 10px;
  }

  .sf-ai-message {
    max-width: 96%;
    padding: 10px 11px;
    font-size: 0.86rem;
    line-height: 1.42;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .sf-ai-message.is-bot {
    max-width: 100%;
  }

  .sf-ai-message.is-user {
    max-width: 88%;
  }

  .sf-ai-quick-label {
    padding: 8px 10px 0;
    font-size: 0.62rem;
  }

  .sf-ai-quick {
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: visible;
    padding: 7px 10px 9px;
    scrollbar-width: none;
  }

  .sf-ai-quick::-webkit-scrollbar {
    display: none;
  }

  .sf-ai-quick button {
    flex: 0 1 auto;
    min-height: 34px;
    max-width: 100%;
    padding: 7px 9px;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .sf-ai-followups {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .sf-ai-followups::-webkit-scrollbar {
    display: none;
  }

  .sf-ai-followups button {
    flex: 0 0 auto;
    max-width: 190px;
    white-space: nowrap;
  }

  .sf-ai-form {
    grid-template-columns: minmax(0, 1fr) 54px;
    gap: 6px;
    padding: 8px 10px;
  }

  .sf-ai-form textarea {
    min-height: 42px;
    max-height: 86px;
    padding: 9px 10px;
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .sf-ai-form button {
    min-height: 42px;
    min-width: 54px;
    font-size: 0.72rem;
  }

  .sf-ai-actions {
    gap: 6px;
    padding: 0 10px 7px;
  }

  .sf-ai-actions a {
    min-height: 32px;
    padding: 7px 9px;
    font-size: 0.74rem;
  }

  .sf-ai-assistant .sf-ai-note {
    padding: 0 12px 9px;
    font-size: 9.5px !important;
    line-height: 1.22 !important;
  }
}
