.psm-chat-widget {
  --psm-chat-border: #d9e2ec;
  --psm-chat-muted: #627386;
  --psm-chat-text: #142033;
  --psm-chat-surface: #ffffff;
  --psm-chat-soft: #f6f8fb;
  --psm-chat-primary: #2563eb;
  --psm-chat-primary-dark: #1d4ed8;
  --psm-chat-primary-soft: #dbeafe;
  --psm-chat-error: #b91c1c;
  --psm-chat-error-soft: #fee2e2;
  border: 1px solid var(--psm-chat-border);
  border-radius: 16px;
  padding: 18px;
  margin-top: 18px;
  background: var(--psm-chat-surface);
  box-shadow: 0 16px 34px rgba(20, 32, 51, 0.08);
  color: var(--psm-chat-text);
}

.psm-chat-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.psm-chat-kicker,
.psm-chat-intro,
.psm-chat-status,
.psm-chat-empty {
  margin: 0;
}

.psm-chat-kicker {
  color: var(--psm-chat-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.psm-chat-title {
  color: var(--psm-chat-text);
  font-size: 20px;
  line-height: 1.25;
  margin: 2px 0 0;
}

.psm-chat-badge {
  background: var(--psm-chat-primary-soft);
  border-radius: 999px;
  color: var(--psm-chat-primary-dark);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 10px;
  white-space: nowrap;
}

.psm-chat-intro {
  color: var(--psm-chat-muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 14px;
}

.psm-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.psm-chat-suggestion {
  background: var(--psm-chat-soft);
  border: 1px solid var(--psm-chat-border);
  border-radius: 999px;
  color: var(--psm-chat-text);
  cursor: pointer;
  font-size: 13px;
  padding: 7px 11px;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.psm-chat-suggestion:hover,
.psm-chat-suggestion:focus {
  background: var(--psm-chat-primary-soft);
  border-color: #93c5fd;
  color: var(--psm-chat-primary-dark);
  outline: none;
}

.psm-chat-panel {
  margin-bottom: 12px;
}

.psm-chat-messages {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--psm-chat-border);
  border-radius: 14px;
  max-height: 300px;
  min-height: 160px;
  overflow-y: auto;
  padding: 12px;
}

.psm-chat-empty {
  color: var(--psm-chat-muted);
  font-size: 14px;
  padding: 32px 10px;
  text-align: center;
}

.psm-chat-message {
  border-radius: 14px;
  box-shadow: 0 8px 16px rgba(20, 32, 51, 0.06);
  line-height: 1.45;
  margin: 8px 0;
  max-width: 88%;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.psm-chat-message-visitor {
  background: var(--psm-chat-primary);
  color: #ffffff;
  margin-left: auto;
}

.psm-chat-message-assistant {
  background: #ffffff;
  border: 1px solid var(--psm-chat-border);
  color: var(--psm-chat-text);
  margin-right: auto;
}

.psm-chat-streaming::after {
  animation: psm-chat-pulse 1s infinite;
  content: " ...";
}

.psm-chat-status {
  color: var(--psm-chat-muted);
  font-size: 13px;
  min-height: 20px;
  padding: 7px 2px 0;
}

.psm-chat-status-loading {
  color: var(--psm-chat-primary-dark);
}

.psm-chat-status-error {
  color: var(--psm-chat-error);
}

.psm-chat-form {
  align-items: flex-end;
  display: flex;
  gap: 10px;
}

.psm-chat-label {
  flex: 1;
  margin: 0;
}

.psm-chat-label-text {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.psm-chat-input {
  border: 1px solid var(--psm-chat-border);
  border-radius: 12px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.psm-chat-input:focus {
  border-color: var(--psm-chat-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  outline: none;
}

.psm-chat-submit {
  background: var(--psm-chat-primary);
  border: 1px solid var(--psm-chat-primary);
  border-radius: 12px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

.psm-chat-submit:hover,
.psm-chat-submit:focus {
  background: var(--psm-chat-primary-dark);
  border-color: var(--psm-chat-primary-dark);
  outline: none;
}

.psm-chat-submit:disabled,
.psm-chat-input:disabled {
  cursor: wait;
  opacity: 0.65;
}

@keyframes psm-chat-pulse {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

@media (max-width: 575px) {
  .psm-chat-widget {
    border-radius: 12px;
    padding: 14px;
  }

  .psm-chat-header,
  .psm-chat-form {
    align-items: stretch;
    flex-direction: column;
  }

  .psm-chat-badge,
  .psm-chat-submit {
    align-self: stretch;
    text-align: center;
  }

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