.rscai-widget-root {
  --rscai-green: #168a55;
  --rscai-dark: #15382b;
  --rscai-bg: #ffffff;
  --rscai-border: #dce7e1;
  --rscai-text: #19231f;
  --rscai-muted: #61736a;
  font-family: inherit;
  color: var(--rscai-text);
  position: relative;
  z-index: 99999;
}

.rscai-widget-root *,
.rscai-widget-root *::before,
.rscai-widget-root *::after {
  box-sizing: border-box;
}

.rscai-launcher-wrap {
  align-items: center;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: fixed;
  right: 22px;
  z-index: 100000;
}

.rscai-launcher {
  align-items: center;
  background: var(--rscai-green);
  border: 0;
  border-radius: 50%;
  box-shadow: 0 4px 18px rgba(20, 72, 49, .28);
  color: #fff;
  cursor: pointer;
  display: flex;
  height: 48px;
  justify-content: center;
  position: relative;
  width: 48px;
}

.rscai-launcher:hover,
.rscai-launcher:focus-visible {
  background: #116d43;
  outline: 3px solid rgba(22, 138, 85, .25);
  outline-offset: 3px;
}

.rscai-launcher svg {
  height: 23px;
  width: 23px;
}

.rscai-launcher-status {
  background: rgba(255, 255, 255, .94);
  border-radius: 999px;
  box-shadow: 0 2px 7px rgba(20, 72, 49, .18);
  color: #287652;
  display: block;
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  padding: 1px 6px;
}

.rscai-panel {
  background: var(--rscai-bg);
  border: 1px solid var(--rscai-border);
  border-radius: 16px;
  bottom: 96px;
  box-shadow: 0 12px 44px rgba(21, 56, 43, .2);
  display: flex;
  flex-direction: column;
  height: min(620px, calc(100vh - 130px));
  max-height: 720px;
  overflow: hidden;
  position: fixed;
  right: 22px;
  width: min(380px, calc(100vw - 28px));
  z-index: 99999;
}

.rscai-panel[hidden] {
  display: none;
}

.rscai-header {
  align-items: center;
  background: linear-gradient(135deg, #f4fbf7 0%, #e8f5ed 100%);
  border-bottom: 1px solid var(--rscai-border);
  display: flex;
  gap: 12px;
  min-height: 84px;
  padding: 14px 16px;
}

.rscai-avatar {
  align-items: center;
  background: linear-gradient(145deg, #168755 0%, #0d6c51 100%);
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(13, 108, 81, 0.2);
  color: #fff;
  display: flex;
  flex: 0 0 42px;
  font-size: 17px;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  line-height: 1;
  width: 42px;
}

.rscai-heading-group {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.rscai-title {
  color: var(--rscai-dark);
  font-size: 17px;
  font-weight: 750;
  line-height: 1.25;
}

.rscai-brand-line {
  color: #287652;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
  line-height: 1.3;
}

.rscai-close {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(30, 98, 68, 0.14);
  border-radius: 999px;
  color: #40584c;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 11px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.rscai-clear {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #52645a;
  cursor: pointer;
  flex: 0 0 auto;
  font: inherit;
  font-size: 12px;
  min-height: 34px;
  padding: 6px 4px;
  transition: background-color 160ms ease, color 160ms ease;
}

.rscai-clear:hover,
.rscai-clear:focus-visible {
  background: rgba(255, 255, 255, .8);
  color: #183f2f;
  outline: 2px solid rgba(22, 138, 85, .2);
  outline-offset: 1px;
}

.rscai-clear:disabled {
  cursor: wait;
  opacity: .55;
}

.rscai-close:hover,
.rscai-close:focus-visible {
  background: #fff;
  border-color: rgba(30, 98, 68, 0.3);
  color: #183f2f;
}

.rscai-messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 16px 13px;
  overscroll-behavior: contain;
}

.rscai-row {
  display: flex;
  width: 100%;
}

.rscai-assistant-row {
  justify-content: flex-start;
}

.rscai-user-row {
  justify-content: flex-end;
}

.rscai-bubble {
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 92%;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}

.rscai-assistant-bubble {
  background: #f1f5f2;
  border-bottom-left-radius: 4px;
  color: var(--rscai-text);
}

.rscai-user-bubble {
  background: #dff3e7;
  border-bottom-right-radius: 4px;
  color: #15382b;
  white-space: pre-wrap;
}

.rscai-reply-text,
.rscai-reason,
.rscai-disclosure {
  margin: 0;
}

.rscai-recommendation {
  border-top: 1px solid #d7e4db;
  margin-top: 10px;
  padding-top: 9px;
}

.rscai-product-name {
  display: block;
  margin-bottom: 3px;
}

.rscai-reason {
  color: #34483d;
  font-size: 13px;
  margin-bottom: 8px;
}

.rscai-affiliate-link,
.rscai-support-link {
  background: var(--rscai-green);
  border-radius: 7px;
  color: #fff !important;
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  text-decoration: none !important;
}

.rscai-affiliate-link:hover,
.rscai-support-link:hover {
  background: #116d43;
}

.rscai-disclosure {
  color: #506158;
  font-size: 11px;
  margin-top: 7px;
}

.rscai-disclosure a,
.rscai-support-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.rscai-support {
  border-top: 1px solid #d7e4db;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 9px;
  padding-top: 7px;
}

.rscai-support-link {
  font-size: 12px;
}

.rscai-typing {
  align-items: center;
  color: var(--rscai-muted);
  display: inline-flex;
  gap: 4px;
  font-size: 12px;
}

.rscai-dot {
  animation: rscai-pulse 1s infinite ease-in-out;
  background: #71917e;
  border-radius: 50%;
  height: 4px;
  width: 4px;
}

.rscai-dot:nth-of-type(2) { animation-delay: .15s; }
.rscai-dot:nth-of-type(3) { animation-delay: .3s; }

@keyframes rscai-pulse {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.rscai-form {
  align-items: flex-end;
  border-top: 1px solid var(--rscai-border);
  display: flex;
  gap: 8px;
  padding: 10px 11px 7px;
}

.rscai-input {
  background: #fff;
  border: 1px solid #bdcec3;
  border-radius: 9px;
  color: var(--rscai-text);
  flex: 1;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 105px;
  min-height: 42px;
  padding: 9px 10px;
  resize: vertical;
}

.rscai-input:focus {
  border-color: var(--rscai-green);
  box-shadow: 0 0 0 2px rgba(22, 138, 85, .16);
  outline: none;
}

.rscai-send {
  background: var(--rscai-green);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  min-height: 42px;
  padding: 0 12px;
}

.rscai-send:disabled {
  cursor: wait;
  opacity: .65;
}

@media (max-width: 480px) {
  .rscai-launcher-wrap {
    bottom: calc(10px + env(safe-area-inset-bottom));
    right: 14px;
  }

  .rscai-launcher {
    height: 48px;
    width: 48px;
  }

  .rscai-panel {
    border-radius: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    height: min(72dvh, 620px);
    right: 10px;
    width: calc(100vw - 20px);
  }

  .rscai-header { gap: 9px; min-height: 74px; padding: 10px 12px; }
  .rscai-avatar { flex-basis: 38px; font-size: 15px; height: 38px; width: 38px; }
  .rscai-title { font-size: 15px; }
  .rscai-brand-line { font-size: 10px; }
  .rscai-close { font-size: 11px; padding: 6px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .rscai-dot { animation: none; }
}
