:root {
  --shm-chat-brand: #E87722;
  --shm-chat-brand-dark: #cf6618;
  --shm-chat-bg: #ffffff;
  --shm-chat-muted: #6b7280;
  --shm-chat-border: #e8e6e1;
  --shm-chat-shadow: 0 18px 50px rgba(17, 24, 39, 0.18);
}

.shm-chatbot-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99999;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, sans-serif;
}

.shm-chatbot-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--shm-chat-brand);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shm-chat-shadow);
  transition: transform .18s ease, background .18s ease;
}

.shm-chatbot-launcher:hover {
  transform: translateY(-2px);
  background: var(--shm-chat-brand-dark);
}

.shm-chatbot-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(390px, calc(100vw - 24px));
  height: min(640px, calc(100vh - 110px));
  background: var(--shm-chat-bg);
  border-radius: 20px;
  box-shadow: var(--shm-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--shm-chat-border);
}

.shm-chatbot-panel[hidden] {
  display: none !important;
}

.shm-chatbot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, #fff7f0, #fff);
  border-bottom: 1px solid var(--shm-chat-border);
}

.shm-chatbot-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shm-chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff url("../img/shm-avatar.png") center / cover no-repeat;
  color: transparent;
  display: grid;
  place-items: center;
  font-size: 0;
  font-weight: 700;
  overflow: hidden;
  border: 1px solid var(--shm-chat-border);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.06);
  flex-shrink: 0;
  padding: 0;
}

.shm-chatbot-avatar img,
.shm-chatbot-launcher-icon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shm-chatbot-launcher-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #fff;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.shm-chatbot-launcher-icon svg {
  display: none;
}

.shm-chatbot-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.shm-chatbot-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--shm-chat-muted);
}

.shm-chatbot-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  color: #6b7280;
  cursor: pointer;
}

.shm-chatbot-bottom-bar {
  border-top: 1px solid var(--shm-chat-border);
  background: linear-gradient(180deg, #fff 0%, #faf9f7 100%);
  padding: 10px 14px 8px;
}

.shm-chatbot-mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: #efece7;
  box-shadow: inset 0 1px 2px rgba(17, 24, 39, 0.06);
}

.shm-chatbot-mode {
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #5b6470;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.shm-chatbot-mode:hover:not(.is-active) {
  color: #111827;
}

.shm-chatbot-mode.is-active {
  background: var(--shm-chat-brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(232, 119, 34, 0.35);
}

.shm-chatbot-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.shm-chatbot-step {
  flex: 1;
  overflow: auto;
  padding: 16px;
}

.shm-chatbot-lead {
  margin: 0 0 14px;
  font-size: 14px;
  color: #374151;
  line-height: 1.5;
}

.shm-chatbot-intake label {
  display: block;
  margin-bottom: 12px;
}

.shm-chatbot-intake span {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.shm-chatbot-intake input,
.shm-chatbot-intake textarea {
  width: 100%;
  border: 1px solid var(--shm-chat-border);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  box-sizing: border-box;
}

.shm-chatbot-intake input:focus,
.shm-chatbot-intake textarea:focus {
  outline: none;
  border-color: var(--shm-chat-brand);
  box-shadow: 0 0 0 3px rgba(232, 119, 34, 0.12);
}

.shm-chatbot-btn {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
}

.shm-chatbot-btn-primary {
  width: 100%;
  padding: 12px 16px;
  background: var(--shm-chat-brand);
  color: #fff;
  font-weight: 600;
}

.shm-chatbot-btn-primary:hover {
  background: var(--shm-chat-brand-dark);
}

.shm-chatbot-messages {
  flex: 1;
  overflow: auto;
  padding: 4px 2px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shm-chatbot-bubble {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.5;
}

.shm-chatbot-bubble p {
  margin: 0 0 8px;
}

.shm-chatbot-bubble p:last-child {
  margin-bottom: 0;
}

.shm-chatbot-bubble.is-user {
  align-self: flex-end;
  background: var(--shm-chat-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.shm-chatbot-bubble.is-bot {
  align-self: flex-start;
  background: #f6f4f1;
  color: #111827;
  border-bottom-left-radius: 4px;
}

.shm-chatbot-bubble.is-support {
  align-self: flex-start;
  background: #eef6ff;
  color: #1e3a5f;
  border-bottom-left-radius: 4px;
}

.shm-chatbot-bubble.is-system {
  align-self: center;
  background: #fff8f2;
  color: #5f5e5a;
  font-size: 13px;
  text-align: center;
  max-width: 92%;
  border: 1px solid #f0e0cc;
}

.shm-team-joined {
  margin: 0;
  font-style: italic;
}

.shm-chat-cta {
  color: var(--shm-chat-brand);
  font-weight: 600;
  text-decoration: none;
}

.shm-chat-cta:hover {
  text-decoration: underline;
}

.shm-chatbot-bubble a:not(.shm-chat-cta) {
  color: var(--shm-chat-brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.shm-chat-link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff7f0, #fff);
  border: 1px solid #f0d4b8;
  box-shadow: 0 4px 14px rgba(232, 119, 34, 0.08);
}

.shm-chat-link-card.is-summary {
  background: #faf9f7;
  border-color: var(--shm-chat-border);
  box-shadow: none;
}

.shm-chat-link-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9a4d12;
}

.shm-chat-link-card .shm-chat-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--shm-chat-brand);
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none !important;
  box-shadow: 0 6px 16px rgba(232, 119, 34, 0.28);
}

.shm-chat-link-card .shm-chat-cta:hover {
  background: var(--shm-chat-brand-dark);
  text-decoration: none !important;
}

.shm-chat-link-hint {
  font-size: 11px;
  color: var(--shm-chat-muted);
  line-height: 1.4;
}

.shm-chat-summary {
  font-size: 12px;
  color: #374151;
  line-height: 1.5;
}

.shm-chat-summary ul {
  margin: 0;
  padding-left: 18px;
}

.shm-chat-alt-option {
  margin: 8px 0 0;
  font-size: 12px;
  color: #5b6470;
}

.shm-chatbot-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
}

.shm-chatbot-chip {
  border: 1px solid #f0d4b8;
  background: #fff8f2;
  color: #9a4d12;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.shm-chatbot-compose {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--shm-chat-border);
}

.shm-chatbot-compose input {
  border: 1px solid var(--shm-chat-border);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
  min-width: 0;
}

.shm-chatbot-btn-send,
.shm-chatbot-btn-mic,
.shm-chatbot-btn-voice-toggle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.shm-chatbot-btn-send {
  background: var(--shm-chat-brand);
  color: #fff;
}

.shm-chatbot-btn-mic,
.shm-chatbot-btn-voice-toggle {
  border: 1px solid var(--shm-chat-border);
  background: #fff;
  color: #5b6470;
}

.shm-chatbot-btn-mic.is-listening {
  background: #fee2e2;
  border-color: #ef4444;
  color: #b91c1c;
  animation: shm-chat-mic-pulse 1.2s ease-in-out infinite;
}

.shm-chatbot-btn-voice-toggle .shm-chatbot-ico-speaker-off {
  display: none;
}

.shm-chatbot-btn-voice-toggle:not(.is-on) .shm-chatbot-ico-speaker {
  display: none;
}

.shm-chatbot-btn-voice-toggle:not(.is-on) .shm-chatbot-ico-speaker-off {
  display: block;
}

.shm-chatbot-btn-voice-toggle.is-on {
  color: var(--shm-chat-brand);
  border-color: #f0d4b8;
  background: #fff8f2;
}

.shm-chatbot-btn-mic:disabled,
.shm-chatbot-btn-voice-toggle:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shm-chatbot-voice-status {
  margin: 6px 2px 0;
  font-size: 11px;
  color: var(--shm-chat-muted);
  min-height: 14px;
}

.shm-chatbot-voice-status.is-listening {
  color: #b91c1c;
  font-weight: 600;
}

@keyframes shm-chat-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

@media (max-width: 480px) {
  .shm-chatbot-compose {
    grid-template-columns: 1fr auto auto auto;
    gap: 6px;
  }
  .shm-chatbot-btn-send,
  .shm-chatbot-btn-mic,
  .shm-chatbot-btn-voice-toggle {
    width: 38px;
    height: 38px;
  }
}

.shm-chatbot-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px 2px;
  border-top: 0;
  font-size: 11px;
  color: var(--shm-chat-muted);
}

.shm-chatbot-step-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.shm-chatbot-typing {
  font-size: 12px;
  color: var(--shm-chat-muted);
  padding: 4px 2px 8px;
}

.shm-chatbot-typing.is-team-waiting {
  font-style: italic;
}

@media (max-width: 480px) {
  .shm-chatbot-root {
    right: 12px;
    bottom: 12px;
  }
  .shm-chatbot-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 96px);
  }
  .shm-chatbot-launcher-text {
    display: none;
  }
}
