:root {
  --srb-accent: var(--wp--preset--color--primary, #5b3df5);
  --srb-accent-2: var(--wp--preset--color--secondary, #7c64ff);
  --srb-text: var(--wp--preset--color--contrast, #17181d);
  --srb-muted: #666f7a;
  --srb-border: #d9dee7;
  --srb-surface: #ffffff;
  --srb-surface-soft: #f6f8fc;
  --srb-surface-alt: #eef2f8;
  --srb-shadow: 0 28px 60px rgba(17, 24, 39, 0.18);
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.srb-shell,
.srb-shell *,
.srb-shell *::before,
.srb-shell *::after {
  box-sizing: border-box;
}

.srb-shell {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  width: min(420px, calc(100vw - 24px));
}

.srb-overlay {
  position: absolute;
  right: 0;
  bottom: calc(100% + 14px);
  width: 100%;
  pointer-events: none;
}

.srb-shell[data-open="true"] .srb-overlay {
  bottom: 0;
  pointer-events: auto;
}

.srb-shell[data-open="true"] .srb-launcher {
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
}

.srb-widget {
  background: var(--srb-surface);
  color: var(--srb-text);
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 28px;
  box-shadow: var(--srb-shadow);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transform-origin: bottom right;
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.srb-shell[data-open="true"] .srb-widget {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.srb-launcher {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px 10px 12px;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 18px 36px rgba(91, 61, 245, 0.28);
  background: linear-gradient(135deg, var(--srb-accent), var(--srb-accent-2));
}

.srb-launcher__icon {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-block;
  object-fit: cover;
}

.srb-launcher__icon--static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--srb-accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.srb-launcher__label {
  font-size: 1.1rem;
  line-height: 1;
}

.srb-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  position: relative;
  z-index: 3;
  background: var(--srb-surface);
  border-bottom: 1px solid rgba(17, 24, 39, 0.06);
}

.srb-widget__brand {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.srb-widget__header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.srb-widget__toggle {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.srb-widget__toggle:hover {
  background: var(--srb-surface-soft);
}

.srb-widget__toggle-icon {
  font-size: 1.55rem;
  line-height: 1;
}

.srb-widget__expand-icon {
  font-size: 1.25rem;
}

.srb-widget__reset .srb-widget__toggle-icon {
  font-size: 1.3rem;
}

.srb-shell:not([data-has-conversation="true"]) .srb-widget__reset {
  display: none;
}

.srb-shell[data-expanded="true"] .srb-widget__expand-icon::after {
  content: "⛶";
}

.srb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 99998;
}

.srb-backdrop--visible {
  display: block;
}

.srb-shell[data-expanded="true"] {
  position: fixed;
  inset: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.srb-shell[data-expanded="true"] .srb-overlay {
  position: static;
  width: 75vw;
  max-width: 900px;
  height: 80vh;
  pointer-events: auto;
}

.srb-shell[data-expanded="true"][data-open="true"] .srb-overlay {
  bottom: auto;
}

.srb-shell[data-expanded="true"] .srb-widget {
  width: 100%;
  height: 100%;
  max-height: 100%;
  border-radius: 22px;
  transform-origin: center center;
}

.srb-shell[data-expanded="true"][data-open="true"] .srb-widget {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.srb-shell[data-expanded="true"][data-has-conversation="true"] .srb-widget {
  height: 100%;
}

.srb-shell[data-expanded="true"] .srb-launcher {
  display: none;
}

.srb-widget__body {
  padding: 0 24px 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
  background: var(--srb-surface-soft);
  overflow-y: auto;
}

.srb-widget__hero {
  text-align: center;
  padding: 4px 0 18px;
}

.srb-widget__avatar {
  width: 62px;
  height: 62px;
  margin: 0 auto 10px;
  border-radius: 999px;
  display: block;
  object-fit: cover;
}

.srb-widget__avatar--static {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--srb-accent) 14%, #fff);
  color: var(--srb-accent);
  font-size: 1rem;
  font-weight: 800;
}

.srb-widget__hello {
  margin: 0 0 6px;
  font-size: 2.3rem;
  font-weight: 800;
  line-height: 1.1;
}

.srb-widget__intro {
  margin: 0;
  font-size: 1.05rem;
}

.srb-widget__suggestions {
  border-top: 1px solid var(--srb-border);
  border-bottom: 1px solid var(--srb-border);
}

.srb-suggestion {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--srb-border);
  background: transparent;
  padding: 18px 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.srb-suggestion:last-child {
  border-bottom: 0;
}

.srb-suggestion__arrow {
  flex: 0 0 auto;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--srb-text);
}

.srb-suggestion:hover {
  color: var(--srb-accent);
}

.srb-widget__messages {
  margin-top: 8px;
  padding: 14px;
  border-radius: 22px;
  background: transparent;
  overflow: visible;
  overscroll-behavior: contain;
  display: none;
}

.srb-widget__footer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 0 24px 20px;
  background: var(--srb-surface-soft);
  border-top: 1px solid rgba(17, 24, 39, 0.06);
}

.srb-shell[data-has-conversation="true"] .srb-widget {
  height: calc(100vh - 60px);
}

.srb-shell[data-has-conversation="true"] .srb-widget__hero,
.srb-shell[data-has-conversation="true"] .srb-widget__suggestions,
.srb-shell[data-has-conversation="true"] .srb-widget__details {
  display: none !important;
}

.srb-shell[data-has-conversation="true"] .srb-widget__body {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.srb-shell[data-has-conversation="true"] .srb-widget__messages {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 14px;
  border: 1px solid var(--srb-border);
  border-radius: 22px;
  background: var(--srb-surface-alt);
  overflow-y: auto;
}

.srb-message {
  display: flex;
  margin-bottom: 12px;
}

.srb-message p {
  margin: 0;
  max-width: 90%;
  padding: 11px 14px;
  border-radius: 18px;
  line-height: 1.45;
  white-space: pre-line;
  border: 1px solid rgba(17, 24, 39, 0.05);
}

.srb-message--assistant p {
  background: var(--srb-surface);
}

.srb-message--user {
  justify-content: flex-end;
}

.srb-message--user p {
  background: color-mix(in srgb, var(--srb-accent) 16%, #fff);
  border-color: color-mix(in srgb, var(--srb-accent) 16%, var(--srb-border));
}

.srb-message--pending p {
  color: var(--srb-muted);
  background: color-mix(in srgb, var(--srb-accent) 8%, #fff);
  border-style: dashed;
}

.srb-widget__form {
  margin-top: 12px;
  padding-top: 14px;
  padding-bottom: 4px;
  background: transparent;
}

.srb-widget__label {
  display: block;
  margin: 0 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--srb-muted);
}

.srb-widget__textarea {
  width: 100%;
  border: 1px solid var(--srb-border);
  border-radius: 28px;
  padding: 16px 18px;
  font: inherit;
  min-height: 88px;
  resize: none;
  background: var(--srb-surface);
  box-shadow: inset 0 1px 0 rgba(17, 24, 39, 0.03);
}

.srb-widget__textarea::placeholder {
  color: #8a8f98;
}

.srb-widget__textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--srb-accent) 28%, transparent);
  border-color: color-mix(in srgb, var(--srb-accent) 35%, var(--srb-border));
}

.srb-widget__details {
  margin-top: 10px;
  border-radius: 14px;
  border: 1px solid var(--srb-border);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.68);
}

.srb-widget__details summary {
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--srb-muted);
}

.srb-widget__captcha {
  margin-top: 0;
  min-height: 0;
}

.srb-widget__captcha:not(:empty):has(iframe[style*="height"]) {
  margin-top: 10px;
}

.srb-widget__textarea--job {
  margin-top: 8px;
  min-height: 110px;
  border-radius: 18px;
}

.srb-widget__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.srb-widget__status-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 1.2em;
}

.srb-widget__status {
  margin: 0;
  font-size: 0.82rem;
  font-style: italic;
  color: #9da3ad;
}

.srb-widget__status:not(:empty) ~ .srb-widget__disclaimer {
  visibility: hidden;
}

.srb-widget__shortcut {
  font-size: 0.72rem;
  color: #b0b5be;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex: 0 0 auto;
}

.srb-widget__shortcut kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid #d4d8df;
  border-radius: 4px;
  background: #f0f2f5;
  font: inherit;
  font-size: 0.7rem;
  line-height: 1.4;
  color: #8a8f98;
  box-shadow: 0 1px 0 #d4d8df;
}

.srb-widget__submit {
  width: 50px;
  height: 50px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(145deg, var(--srb-accent), var(--srb-accent-2));
}

.srb-widget__submit[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.srb-widget__disclaimer {
  margin: 0;
  font-size: 0.78rem;
  color: #b0b5be;
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.srb-widget__protected {
  position: relative;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  cursor: help;
  outline: none;
}

.srb-widget__protected[hidden] {
  display: none;
}

.srb-widget__protected-icon {
  width: 14px;
  height: 14px;
  display: block;
}

.srb-widget__protected-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  background: #1f2937;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: normal;
  width: max-content;
  max-width: min(220px, calc(100vw - 56px));
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.srb-widget__protected-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 8px;
  border: 4px solid transparent;
  border-top-color: #1f2937;
}

.srb-widget__protected:hover .srb-widget__protected-tooltip,
.srb-widget__protected:focus-visible .srb-widget__protected-tooltip,
.srb-widget__protected:focus .srb-widget__protected-tooltip {
  opacity: 1;
}

@media (max-width: 782px) {
  .srb-shell {
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
  }

  .srb-overlay {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 76px;
    width: auto;
  }

  .srb-widget {
    border-radius: 24px;
    max-height: calc(100vh - 88px);
  }

  .srb-widget__header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .srb-widget__body {
    padding-left: 18px;
    padding-right: 18px;
    overflow-y: auto;
  }

  .srb-widget__footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .srb-shell[data-has-conversation="true"] .srb-widget {
    height: calc(100vh - 88px);
    max-height: none;
  }

  .srb-shell[data-has-conversation="true"] .srb-widget__body {
    overflow: hidden;
  }

  .srb-widget__hello {
    font-size: 2rem;
  }

  .srb-launcher {
    width: 100%;
    justify-content: center;
  }

  .srb-shell[data-expanded="true"] .srb-overlay {
    width: calc(100vw - 24px);
    height: calc(100vh - 24px);
    max-width: none;
  }

  .srb-widget__expand {
    display: none;
  }
}
