:root {
  --sm-bg-widget: rgba(11, 14, 23, 0.94);
  --sm-bg-surface: rgba(22, 27, 43, 0.94);
  --sm-bg-elevated: rgba(30, 37, 58, 0.96);
  --sm-border: rgba(255, 255, 255, 0.11);
  --sm-border-bright: rgba(139, 92, 246, 0.48);
  --sm-accent: #7c5cff;
  --sm-accent-2: #5b54f6;
  --sm-accent-glow: rgba(124, 92, 255, 0.36);
  --sm-text: #f6f8fc;
  --sm-text-muted: #9aa5c4;
  --sm-radius-lg: 18px;
  --sm-radius-md: 13px;
  --sm-shadow: 0 28px 70px rgba(0, 0, 0, 0.65);
  --sm-font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sm-hidden { display: none !important; }
.sm-panel, .sm-panel *, .sm-launcher-btn, .sm-launcher-btn * { box-sizing: border-box; }
.sm-panel button, .sm-panel input, .sm-launcher-btn { margin: 0; text-transform: none; letter-spacing: normal; line-height: 1.35; box-shadow: none; }

button.sm-launcher-btn[type="button"] {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  height: auto;
  margin: 0;
  padding: 13px 22px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sm-accent) 0%, #4f46e5 100%);
  color: #ffffff;
  font-family: var(--sm-font);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.35;
  cursor: pointer;
  box-shadow: 0 14px 36px var(--sm-accent-glow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.sm-launcher-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 44px var(--sm-accent-glow);
}

.sm-launcher-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  flex-shrink: 0;
}

.sm-panel {
  position: fixed;
  right: 24px;
  bottom: 84px;
  z-index: 99999;
  width: 396px;
  max-width: calc(100vw - 32px);
  height: 556px;
  max-height: calc(100vh - 110px);
  display: flex;
  flex-direction: column;
  background: var(--sm-bg-widget);
  backdrop-filter: blur(22px);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius-lg);
  box-shadow: var(--sm-shadow);
  font-family: var(--sm-font);
  color: var(--sm-text);
  overflow: hidden;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.sm-panel-embedded {
  position: relative;
  right: auto;
  bottom: auto;
  z-index: 5;
  width: 100%;
  max-width: 404px;
  height: 506px;
  max-height: none;
  box-shadow: 0 24px 64px rgba(3, 6, 16, 0.84), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.sm-panel-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(0.98);
}

.sm-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  background: linear-gradient(180deg, rgba(32, 39, 62, 0.96) 0%, rgba(17, 22, 36, 0.96) 100%);
  border-bottom: 1px solid var(--sm-border);
}

.sm-header-left { display: flex; align-items: center; gap: 10px; min-width: 0; }

.sm-avatar {
  width: 33px;
  height: 33px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(124, 92, 255, 0.4);
  flex-shrink: 0;
}

.sm-header-brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.sm-header-title {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sm-header-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--sm-text-muted);
}

.sm-live-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.38);
  color: #6ee7b7;
}

.sm-panel button.sm-close-btn {
  height: auto;
  margin: 0;
  background: transparent;
  border: none;
  color: var(--sm-text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.sm-panel button.sm-close-btn:hover { background: rgba(255, 255, 255, 0.08); color: #ffffff; }

.sm-messages {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.sm-msg {
  max-width: 91%;
  padding: 10px 13px;
  border-radius: var(--sm-radius-md);
  font-size: 12.8px;
  line-height: 1.48;
}

.sm-msg-bot {
  align-self: flex-start;
  background: var(--sm-bg-surface);
  border: 1px solid var(--sm-border);
  color: var(--sm-text);
}

.sm-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--sm-accent) 0%, var(--sm-accent-2) 100%);
  color: #ffffff;
  font-weight: 500;
}

.sm-msg-thinking { display: inline-flex; align-items: center; gap: 8px; color: #c4b5fd; }

.sm-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #a78bfa;
  animation: smPulse 1s infinite ease-in-out;
}

@keyframes smPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.sm-cards-wrap { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.sm-prod-card { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--sm-bg-elevated); border: 1px solid var(--sm-border); border-radius: 12px; text-decoration: none; color: var(--sm-text); transition: border-color 0.18s ease, transform 0.18s ease; }
.sm-prod-card:hover { border-color: var(--sm-border-bright); transform: translateX(2px); }
.sm-prod-img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: #090c14; flex-shrink: 0; }
.sm-prod-meta { flex: 1; min-width: 0; }
.sm-prod-title { font-size: 12.2px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sm-prod-price-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 11.5px; }
.sm-prod-price { font-weight: 700; color: #c4b5fd; }
.sm-prod-stock { font-size: 10.8px; font-weight: 600; color: #34d399; }

.sm-chips-row { flex-shrink: 0; display: flex; flex-wrap: wrap; gap: 6px; padding: 7px 13px 8px; background: rgba(11, 14, 23, 0.96); border-top: 1px solid rgba(255, 255, 255, 0.05); }
.sm-chips-row:empty { display: none; }
.sm-panel button.sm-chip { height: auto; margin: 0; background: rgba(124, 92, 255, 0.14); border: 1px solid rgba(124, 92, 255, 0.34); color: #e2dcff; border-radius: 999px; padding: 5px 10px; font-family: var(--sm-font); font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: normal; line-height: 1.35; cursor: pointer; transition: background 0.15s ease; }
.sm-panel button.sm-chip:hover { background: rgba(124, 92, 255, 0.28); }

.sm-input-bar { flex-shrink: 0; display: flex; align-items: center; gap: 8px; padding: 9px 11px; background: rgba(18, 23, 37, 0.98); border-top: 1px solid var(--sm-border); }
.sm-panel input.sm-input[type="text"] { flex: 1 1 auto; min-width: 0; width: auto; height: 38px; min-height: 38px; margin: 0; background: #090c15; border: 1px solid var(--sm-border); border-radius: 10px; padding: 8px 11px; color: var(--sm-text); font-family: var(--sm-font); font-size: 12.5px; line-height: 1.35; outline: none; box-shadow: none; }
.sm-panel input.sm-input[type="text"]:focus { border-color: var(--sm-accent); }
.sm-panel button.sm-send-btn[type="submit"] { flex-shrink: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 38px; min-height: 38px; margin: 0; background: linear-gradient(135deg, var(--sm-accent) 0%, var(--sm-accent-2) 100%); color: #ffffff; border: none; border-radius: 10px; padding: 0 13px; font-family: var(--sm-font); font-size: 12.5px; font-weight: 600; text-transform: none; letter-spacing: normal; line-height: 1.35; cursor: pointer; }
.sm-panel button.sm-send-btn[type="submit"]:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 640px) {
  .sm-panel-embedded { max-width: 100%; height: 540px; }
}
