.foureck-ai-widget {
  --foureck-ai-primary: #1565c0;
  --foureck-ai-panel-bg: #fff;
  --foureck-ai-assistant-bg: #eef6ff;
  --foureck-ai-border: #dbe7f4;
  --foureck-ai-soft-bg: #f8fbff;
  --foureck-ai-panel-width: 380px;
  --foureck-ai-panel-height: 580px;
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

.foureck-ai-widget,
.foureck-ai-widget * {
  box-sizing: border-box;
}

.foureck-ai-widget.in-position-bottom_left {
  right: auto;
  left: 20px;
}

.foureck-ai-widget.in-panel-compact {
  --foureck-ai-panel-width: 340px;
  --foureck-ai-panel-height: 500px;
}

.foureck-ai-widget.in-panel-large {
  --foureck-ai-panel-width: 460px;
  --foureck-ai-panel-height: 680px;
}

.foureck-ai-toggle {
  width: 66px;
  height: 66px;
  min-width: 66px;
  border: 0;
  border-radius: 24px;
  background: transparent;
  color: #fff;
  box-shadow: none;
  cursor: pointer;
  font-weight: 700;
  font: 700 14px/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-align: center;
  display: inline-grid;
  place-items: center;
  padding: 0;
  appearance: none;
  transition: border-radius 160ms ease;
}

.foureck-ai-toggle:hover,
.foureck-ai-toggle:focus {
  box-shadow: none;
  outline: none;
  transform: none;
}

.foureck-ai-toggle:focus-visible {
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.16);
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-toggle {
  width: auto;
  min-width: 110px;
  height: 58px;
  background: var(--foureck-ai-primary);
  box-shadow: 0 16px 34px rgba(21, 101, 192, 0.26);
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 10px;
  padding: 0 16px 0 12px;
  border-radius: 24px;
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-toggle-art,
.foureck-ai-widget.in-launcher-pill .foureck-ai-launcher-svg {
  width: 42px;
  height: 42px;
  filter: none;
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-toggle-art.is-avatar {
  background: rgba(255, 255, 255, 0.16);
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-launcher-shape {
  fill: rgba(255, 255, 255, 0.16);
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-launcher-symbol {
  fill: #fff;
}

.foureck-ai-toggle-art {
  position: relative;
  display: block;
  width: 64px;
  height: 64px;
  border: 0;
  filter: none;
}

.foureck-ai-toggle-art.is-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2d7dd2);
  overflow: hidden;
}

.foureck-ai-launcher-avatar {
  display: block;
  width: 53px;
  height: 53px;
  object-fit: contain;
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-launcher-avatar {
  width: 35px;
  height: 35px;
}

.foureck-ai-launcher-svg {
  display: block;
  width: 64px;
  height: 64px;
  overflow: visible;
}

.foureck-ai-launcher-shape {
  fill: var(--foureck-ai-primary);
}

.foureck-ai-launcher-symbol {
  fill: #fff;
}

.foureck-ai-launcher-dot {
  fill: var(--foureck-ai-primary);
}

.foureck-ai-toggle-label {
  display: none;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foureck-ai-widget.in-launcher-pill .foureck-ai-toggle-label {
  display: inline-block;
}

.foureck-ai-chat {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(var(--foureck-ai-panel-width), calc(100vw - 32px));
  height: min(var(--foureck-ai-panel-height), calc(100vh - 120px));
  min-height: 320px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  background: linear-gradient(180deg, var(--foureck-ai-panel-bg), var(--foureck-ai-soft-bg));
  border: 1px solid var(--foureck-ai-border);
  border-radius: 18px;
  box-shadow: 0 24px 72px rgba(12, 40, 82, 0.18);
  color: #172033;
  isolation: isolate;
}

.foureck-ai-widget.in-position-bottom_left .foureck-ai-chat {
  right: auto;
  left: 0;
}

.foureck-ai-chat[hidden] {
  display: none;
}

.foureck-ai-panel-header {
  position: static;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: auto;
  min-width: 0;
  max-width: none;
  height: auto;
  min-height: 0;
  padding: 14px;
  background: linear-gradient(135deg, #fbfdff 0%, #eef6ff 100%);
  border-bottom: 1px solid #e2edf8;
  color: #172033;
  font: 700 14px/1.3 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transform: none;
  z-index: auto;
}

.foureck-ai-panel-brand {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.foureck-ai-panel-icon,
.foureck-ai-message-avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
}

.foureck-ai-panel-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2e80d8);
  color: #fff;
  box-shadow: 0 10px 24px rgba(21, 101, 192, 0.2);
}

.foureck-ai-panel-icon.has-avatar {
  overflow: hidden;
}

.foureck-ai-panel-avatar-image,
.foureck-ai-message-avatar-image {
  display: block;
  object-fit: contain;
}

.foureck-ai-panel-avatar-image {
  width: 31px;
  height: 31px;
}

.foureck-ai-panel-icon svg,
.foureck-ai-message-avatar svg,
.foureck-ai-close svg,
.foureck-ai-send svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.foureck-ai-message-avatar svg {
  width: 16px;
  height: 16px;
}

.foureck-ai-panel-header strong {
  display: block;
  min-width: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.foureck-ai-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid #dbe8f5;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: #303847;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  appearance: none;
  box-shadow: 0 4px 12px rgba(12, 40, 82, 0.06);
}

.foureck-ai-close:hover,
.foureck-ai-close:focus {
  border-color: #c7d7e8;
  color: var(--foureck-ai-primary);
  outline: none;
}

.foureck-ai-messages {
  overflow-y: auto;
  min-height: 0;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6faff 100%);
}

.foureck-ai-message-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  width: 100%;
}

.foureck-ai-message-row.is-user {
  flex-direction: row-reverse;
}

.foureck-ai-message {
  max-width: calc(88% - 36px);
  padding: 10px 13px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.foureck-ai-message-avatar {
  width: 28px;
  height: 28px;
  margin-bottom: 2px;
}

.foureck-ai-message-avatar.is-assistant {
  background: #eaf4ff;
  color: var(--foureck-ai-primary);
  border: 1px solid #d9e9fb;
}

.foureck-ai-message-avatar.is-assistant.has-avatar {
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2d7dd2);
  border: 0;
  overflow: hidden;
  box-shadow: 0 7px 18px rgba(21, 101, 192, 0.18);
}

.foureck-ai-message-avatar-image {
  width: 24px;
  height: 24px;
}

.foureck-ai-message-avatar.is-user {
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2d7dd2);
  color: #fff;
}

.foureck-ai-message.is-user {
  color: #fff;
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2d7dd2);
  border-bottom-right-radius: 7px;
  white-space: pre-wrap;
  box-shadow: 0 8px 20px rgba(21, 101, 192, 0.18);
}

.foureck-ai-message.is-assistant {
  color: #172033;
  background: var(--foureck-ai-assistant-bg);
  border: 1px solid #dbeafb;
  border-bottom-left-radius: 7px;
  box-shadow: 0 4px 16px rgba(12, 40, 82, 0.06);
}

.foureck-ai-widget .foureck-ai-message p,
.foureck-ai-widget .foureck-ai-message ul,
.foureck-ai-widget .foureck-ai-message li {
  font: inherit !important;
  letter-spacing: inherit !important;
}

.foureck-ai-message p {
  margin: 0 0 8px;
}

.foureck-ai-message p:last-child,
.foureck-ai-message ul:last-child {
  margin-bottom: 0;
}

.foureck-ai-message ul {
  margin: 8px 0;
  padding-left: 18px;
}

.foureck-ai-message li {
  margin: 4px 0;
}

.foureck-ai-sources {
  margin-top: 10px;
  font-size: inherit;
}

.foureck-ai-widget .foureck-ai-sources,
.foureck-ai-widget .foureck-ai-sources strong,
.foureck-ai-widget .foureck-ai-sources ul,
.foureck-ai-widget .foureck-ai-sources li,
.foureck-ai-widget .foureck-ai-sources a {
  font-family: inherit !important;
  font-size: inherit !important;
  line-height: inherit !important;
  letter-spacing: inherit !important;
}

.foureck-ai-sources ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.foureck-ai-sources a {
  color: #145ea8;
}

.foureck-ai-feedback {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}

.foureck-ai-feedback button {
  border: 1px solid #c8ccd0;
  background: #fff;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 12px;
}

.foureck-ai-progress {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-top: 1px solid #e2edf8;
  background: #f8fbff;
  color: #35506c;
  font-size: 13px;
}

.foureck-ai-progress[hidden] {
  display: none;
}

.foureck-ai-progress-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.foureck-ai-progress-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--foureck-ai-primary);
  opacity: 0.35;
  animation: foureck-ai-pulse 1s ease-in-out infinite;
}

.foureck-ai-progress-dots span:nth-child(2) {
  animation-delay: 140ms;
}

.foureck-ai-progress-dots span:nth-child(3) {
  animation-delay: 280ms;
}

@keyframes foureck-ai-pulse {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.foureck-ai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  align-items: center;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 12px 14px 14px;
  border-top: 1px solid #e2edf8;
  background: rgba(255, 255, 255, 0.92);
}

.foureck-ai-form textarea {
  display: block;
  width: 100%;
  height: 44px;
  resize: none;
  min-height: 46px;
  max-height: 120px;
  border: 1px solid #d6e3f0;
  border-radius: 18px;
  padding: 11px 14px;
  margin: 0;
  background: #fff;
  color: #172033;
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  outline: none;
  overflow-y: auto;
  appearance: none;
  box-shadow: inset 0 1px 2px rgba(12, 40, 82, 0.04);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.foureck-ai-form textarea:focus {
  border-color: rgba(21, 101, 192, 0.48);
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.12);
}

.foureck-ai-form button {
  align-self: center;
  flex: 0 0 auto;
  width: 46px;
  min-width: 46px;
  min-height: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: linear-gradient(145deg, var(--foureck-ai-primary), #2d7dd2);
  color: #fff;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  appearance: none;
  box-shadow: 0 10px 22px rgba(21, 101, 192, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.foureck-ai-form button:hover,
.foureck-ai-form button:focus {
  box-shadow: 0 12px 26px rgba(21, 101, 192, 0.28);
  outline: none;
  transform: translateY(-1px);
}

.foureck-ai-form button:focus-visible {
  box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.16), 0 12px 26px rgba(21, 101, 192, 0.28);
}

.foureck-ai-form button:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.foureck-ai-send-icon {
  display: inline-grid;
  place-items: center;
}

.foureck-ai-send svg {
  width: 19px;
  height: 19px;
}

.foureck-ai-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 480px) {
  .foureck-ai-widget {
    right: 12px;
    bottom: 12px;
  }

  .foureck-ai-chat {
    right: -4px;
    bottom: 68px;
  }

  .foureck-ai-widget.in-position-bottom_left .foureck-ai-chat {
    right: auto;
    left: -4px;
  }
}
