.ai-widget {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 28px));
  z-index: 70;
}

.assistant-panel {
  margin-bottom: 10px;
  background: var(--surface, #ffffff);
  border: 1px solid #dedfe7;
  border-radius: 24px;
  box-shadow: var(--shadow, 0 22px 60px rgba(32, 29, 52, 0.15));
  max-height: min(610px, calc(100vh - 130px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform-origin: bottom center;
  animation: nomi-pop 0.18s ease-out;
}

@keyframes nomi-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.assistant-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line, #e4e6ed);
}

.assistant-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.assistant-avatar {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand, #6d4aff), var(--brand-2, #cf42f4));
}

.assistant-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: #f1f2f6;
  color: #555b68;
  display: grid;
  place-items: center;
}

.icon-btn:hover {
  background: #e8e9ef;
}

.assistant-context {
  padding: 9px 18px;
  background: #fbfaff;
  border-bottom: 1px solid var(--line, #e4e6ed);
  color: var(--muted, #6f7481);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.suggestions {
  padding: 12px 12px 14px;
  overflow: auto;
}

.suggestion-title {
  padding: 5px 8px 10px;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted, #6f7481);
}

.suggestion {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 11px 12px;
  border-radius: 11px;
  color: var(--text, #191b22);
}

.suggestion:hover {
  background: #f4f2ff;
  color: #4d31c6;
}

.chat-log {
  padding: 16px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
  min-height: 180px;
}

.message {
  max-width: 88%;
  border-radius: 17px;
  padding: 12px 14px;
  line-height: 1.48;
  font-size: 14px;
}

.message.user {
  align-self: flex-end;
  background: #ece9ff;
  color: #2d2853;
  border-bottom-right-radius: 5px;
}

.message.bot {
  align-self: flex-start;
  background: #f3f4f7;
  border-bottom-left-radius: 5px;
}

.message.bot.status-warn {
  background: #fff8eb;
}

.message.bot.status-error {
  background: #fff0f2;
}

.clarification-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.clarification-option {
  border: 1px solid #d7dae2;
  border-radius: 999px;
  background: #fff;
  padding: 7px 10px;
  cursor: pointer;
  font: inherit;
}

.message .msg-caption {
  font-size: 11px;
  color: var(--muted, #6f7481);
  margin-bottom: 5px;
  font-weight: 800;
}

.message-feedback {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 11px;
  color: var(--muted, #6f7481);
  font-size: 12px;
}

.message-feedback-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #d7dae2;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  line-height: 1;
}

.message-feedback-button:hover:not(:disabled),
.message-feedback-button.selected {
  border-color: #9c8bfa;
  background: #ece9ff;
}

.message-feedback-button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  min-width: 58px;
}

.typing i {
  width: 6px;
  height: 6px;
  background: #9297a4;
  border-radius: 50%;
  animation: nomi-bounce 1s infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.12s;
}

.typing i:nth-child(3) {
  animation-delay: 0.24s;
}

@keyframes nomi-bounce {
  50% {
    transform: translateY(-4px);
    opacity: 0.55;
  }
}

.chat-product {
  margin-top: 10px;
  border: 1px solid #dedfe7;
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: 0.15s ease;
}

a.chat-product:hover {
  border-color: #c8c0ef;
  box-shadow: 0 8px 20px rgba(30, 28, 48, 0.08);
}

.chat-product-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.chat-product h4 {
  margin: 0 0 5px;
  font-size: 14px;
}

.chat-price {
  font-weight: 850;
  white-space: nowrap;
}

.chat-meta {
  color: var(--muted, #6f7481);
  font-size: 12px;
  margin: 0 0 6px;
}

.chat-reason {
  color: var(--muted, #6f7481);
  font-size: 12px;
  margin: 8px 0 0;
}

.chat-reason ul {
  margin: 4px 0 0;
  padding-left: 1.1em;
}

.chat-has-more {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted, #6f7481);
}

.widget-input-shell {
  padding: 2px;
  border-radius: 19px;
  background: linear-gradient(90deg, #ff1c75, #9d26ef, #315dff);
  box-shadow: 0 10px 30px rgba(63, 45, 164, 0.21);
}

.widget-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 17px;
  padding: 8px 9px 8px 15px;
  background: var(--surface, #ffffff);
}

.widget-input-row input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text, #191b22);
  padding: 4px 0;
}

.spark-btn {
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  border-radius: 13px;
  border: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand, #6d4aff), var(--brand-2, #cf42f4));
  font-size: 18px;
}

.spark-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 580px) {
  .assistant-panel {
    max-height: calc(100vh - 112px);
    border-radius: 20px;
  }

  .chat-log {
    min-height: 150px;
  }

  .message {
    max-width: 96%;
  }
}
