:root {
  --barza-ai-primary: #6f2c91;
  --barza-ai-text: #24202a;
  --barza-ai-muted: #746f79;
  --barza-ai-border: #e9e5eb;
  --barza-ai-bg: #ffffff;
  --barza-ai-soft: #f7f3f9;
}

.barza-ai-launcher,
.barza-ai-panel,
.barza-ai-panel * {
  box-sizing: border-box;
  font-family: inherit;
}

.barza-ai-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px 8px 8px;
  background: var(--barza-ai-primary);
  color: #fff;
  box-shadow: 0 10px 35px rgba(40, 18, 53, 0.24);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  transition: transform .2s ease, opacity .2s ease;
}

.barza-ai-launcher:hover { transform: translateY(-2px); }
.barza-ai-launcher.is-hidden { opacity: 0; pointer-events: none; transform: translateY(8px); }
.barza-ai-launcher-icon,
.barza-ai-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: var(--barza-ai-primary);
  font-weight: 800;
}

.barza-ai-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  width: min(410px, calc(100vw - 28px));
  height: min(680px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid var(--barza-ai-border);
  border-radius: 22px;
  background: var(--barza-ai-bg);
  box-shadow: 0 20px 70px rgba(35, 18, 45, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(.98);
  transform-origin: right bottom;
  transition: opacity .2s ease, transform .2s ease;
}

.barza-ai-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.barza-ai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--barza-ai-border);
}

.barza-ai-brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.barza-ai-avatar { width: 42px; height: 42px; background: var(--barza-ai-primary); color: #fff; flex: 0 0 auto; }
.barza-ai-titles { display: grid; gap: 2px; min-width: 0; }
.barza-ai-titles strong { color: var(--barza-ai-text); font-size: 15px; line-height: 1.2; }
.barza-ai-titles span { color: var(--barza-ai-muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barza-ai-header-actions { display: flex; align-items: center; gap: 2px; }
.barza-ai-reset, .barza-ai-close { border: 0; background: transparent; color: #6e6872; line-height: 1; cursor: pointer; padding: 4px 6px; }
.barza-ai-reset { font-size: 18px; }
.barza-ai-close { font-size: 28px; }

.barza-ai-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  background: linear-gradient(180deg, #fff 0%, #fdfbfd 100%);
}

.barza-ai-messages { display: flex; flex-direction: column; gap: 10px; }
.barza-ai-message { display: flex; }
.barza-ai-message.is-user { justify-content: flex-end; }
.barza-ai-bubble {
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 16px 16px 16px 5px;
  background: #f2eef4;
  color: var(--barza-ai-text);
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.barza-ai-message.is-user .barza-ai-bubble {
  border-radius: 16px 16px 5px 16px;
  background: var(--barza-ai-primary);
  color: #fff;
}

.barza-ai-quick { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.barza-ai-chip {
  border: 1px solid color-mix(in srgb, var(--barza-ai-primary) 28%, #fff);
  border-radius: 999px;
  padding: 8px 11px;
  background: #fff;
  color: var(--barza-ai-primary);
  font-size: 12px;
  line-height: 1.25;
  cursor: pointer;
}
.barza-ai-chip:hover { background: var(--barza-ai-soft); }

.barza-ai-product-card {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--barza-ai-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(32, 18, 39, .05);
}
.barza-ai-product-card img { width: 74px; height: 74px; object-fit: contain; border-radius: 10px; background: #fafafa; }
.barza-ai-product-content { min-width: 0; }
.barza-ai-badge { display: inline-block; margin-bottom: 4px; color: var(--barza-ai-primary); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.barza-ai-product-name { display: block; color: var(--barza-ai-text); font-size: 13px; line-height: 1.3; }
.barza-ai-product-reason { margin: 5px 0 8px; color: var(--barza-ai-muted); font-size: 11px; line-height: 1.4; }
.barza-ai-product-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.barza-ai-price { color: var(--barza-ai-text); font-size: 12px; font-weight: 800; }
.barza-ai-product-link { color: var(--barza-ai-primary); font-size: 11px; font-weight: 800; text-decoration: none; }

.barza-ai-notice {
  margin-top: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fff8e8;
  color: #6c5620;
  font-size: 11px;
  line-height: 1.4;
}

.barza-ai-footer { padding: 12px 14px 10px; border-top: 1px solid var(--barza-ai-border); background: #fff; }
.barza-ai-form { display: flex; align-items: flex-end; gap: 8px; }
.barza-ai-input {
  flex: 1;
  resize: none;
  max-height: 104px;
  min-height: 43px;
  border: 1px solid var(--barza-ai-border);
  border-radius: 14px;
  padding: 11px 12px;
  outline: none;
  color: var(--barza-ai-text);
  background: #fff;
  font-size: 13px;
  line-height: 1.4;
}
.barza-ai-input:focus { border-color: color-mix(in srgb, var(--barza-ai-primary) 50%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--barza-ai-primary) 10%, #fff); }
.barza-ai-send {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  border: 0;
  border-radius: 13px;
  background: var(--barza-ai-primary);
  color: #fff;
  font-size: 23px;
  line-height: 1;
  cursor: pointer;
}
.barza-ai-send:disabled { opacity: .5; cursor: not-allowed; }
.barza-ai-disclaimer { margin-top: 7px; text-align: center; color: #9a949d; font-size: 9.5px; }

.barza-ai-typing { display: flex; gap: 4px; width: 48px; }
.barza-ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9c94a0; animation: barza-ai-bounce 1s infinite ease-in-out; }
.barza-ai-typing i:nth-child(2) { animation-delay: .12s; }
.barza-ai-typing i:nth-child(3) { animation-delay: .24s; }
@keyframes barza-ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

@media (max-width: 600px) {
  .barza-ai-launcher { right: 14px; bottom: 14px; }
  .barza-ai-launcher-label { display: none; }
  .barza-ai-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: min(100dvh, 760px);
    max-height: 100dvh;
    border-radius: 20px 20px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
}
