#uviazto-ai-root {
  --uvai-green: #5a8e35;
  --uvai-green-bright: #73a94a;
  --uvai-panel: #292929;
  --uvai-panel-soft: #323232;
  --uvai-black: #080808;
  --uvai-text: #f5f5f3;
  --uvai-muted: #b9b9b5;
  --uvai-line: #555553;
  font-family: inherit;
  position: relative;
  z-index: 999999;
}

#uviazto-ai-root * { box-sizing: border-box; }

.uvai-icon,
.uvai-icon svg { display: block; width: 24px; height: 24px; }
.uvai-icon svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.uvai-avatar .uvai-icon svg { fill: currentColor; stroke: none; }

.uvai-launcher {
  position: fixed;
  left: 24px;
  bottom: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 228px;
  height: 66px;
  padding: 6px 24px 6px 7px;
  border: 2px solid #37651f;
  border-radius: 36px;
  background: #050505;
  color: #fff;
  box-shadow: 0 12px 35px rgb(0 0 0 / 32%);
  cursor: pointer;
  font: inherit;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}
.uvai-launcher:hover { transform: translateY(-2px); box-shadow: 0 16px 42px rgb(0 0 0 / 40%); }
.uvai-launcher[aria-expanded="true"] { opacity: 0; pointer-events: none; transform: translateY(8px); }

.uvai-avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--uvai-green);
  color: #fff;
}
.uvai-avatar .uvai-icon,
.uvai-avatar .uvai-icon svg { width: 27px; height: 27px; }

.uvai-panel {
  position: fixed;
  left: 24px;
  bottom: 22px;
  display: grid;
  grid-template-rows: 84px 1fr auto;
  width: min(480px, calc(100vw - 48px));
  height: min(720px, calc(100vh - 44px));
  overflow: hidden;
  border: 1px solid #626260;
  border-radius: 24px;
  background: var(--uvai-panel);
  box-shadow: 0 24px 80px rgb(0 0 0 / 40%);
  color: var(--uvai-text);
  transition: width .2s ease, height .2s ease;
}
.uvai-panel[hidden] { display: none; }
.uvai-panel.is-expanded { width: min(620px, calc(100vw - 48px)); height: min(820px, calc(100vh - 44px)); }

.uvai-header {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 14px 20px;
  border-bottom: 1px solid #30302f;
  background: var(--uvai-panel);
}
.uvai-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.uvai-brand strong { overflow: hidden; font-size: 18px; font-weight: 750; letter-spacing: -.02em; text-overflow: ellipsis; white-space: nowrap; }
.uvai-brand .uvai-avatar { width: 48px; height: 48px; }

.uvai-actions { display: flex; align-items: center; gap: 4px; }
.uvai-action,
.uvai-reaction {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.uvai-action:hover { background: #3a3a39; }
.uvai-more { font-size: 30px; line-height: 1; }
.uvai-close .uvai-icon,
.uvai-close .uvai-icon svg { width: 28px; height: 28px; }

.uvai-menu {
  position: absolute;
  z-index: 10;
  top: 72px;
  right: 62px;
  padding: 7px;
  border: 1px solid var(--uvai-line);
  border-radius: 12px;
  background: #202020;
  box-shadow: 0 12px 30px rgb(0 0 0 / 35%);
}
.uvai-menu[hidden] { display: none; }
.uvai-menu button { min-height: 42px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; color: #fff; cursor: pointer; font: inherit; }
.uvai-menu button:hover { background: #383838; }

.uvai-messages {
  overflow-x: hidden;
  overflow-y: auto;
  padding: 24px 28px 18px;
  background: var(--uvai-panel);
  scrollbar-color: #727270 transparent;
  scrollbar-width: thin;
}
.uvai-messages::-webkit-scrollbar { width: 8px; }
.uvai-messages::-webkit-scrollbar-thumb { border-radius: 8px; background: #727270; }

.uvai-message { display: flex; flex-direction: column; align-items: flex-start; margin: 0 0 28px; }
.uvai-user { align-items: flex-end; margin-top: 8px; }
.uvai-bubble {
  max-width: 100%;
  color: var(--uvai-text);
  font-size: 16px;
  line-height: 1.48;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.uvai-user .uvai-bubble {
  max-width: 82%;
  padding: 13px 18px;
  border-radius: 22px 22px 5px 22px;
  background: var(--uvai-black);
  box-shadow: 0 4px 12px rgb(0 0 0 / 22%);
}
.uvai-assistant .uvai-bubble { width: 100%; }
.uvai-bubble h3 { margin: 5px 0 10px; color: #fff; font-size: 20px; line-height: 1.25; letter-spacing: -.02em; }
.uvai-bubble p { margin: 0 0 13px; }
.uvai-bubble p:last-child { margin-bottom: 0; }
.uvai-eyebrow { display: block; color: var(--uvai-green-bright); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.uvai-summary { padding: 12px 14px; border-left: 3px solid var(--uvai-green); border-radius: 0 9px 9px 0; background: #333a30; color: #f7f7f4; }
.uvai-question { color: #fff; font-weight: 650; }

.uvai-products { width: 100%; margin-top: 15px; display: grid; gap: 9px; }
.uvai-product {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  min-height: 76px;
  padding: 8px 10px 8px 8px;
  border: 1px solid #4b4b49;
  border-radius: 14px;
  background: #313130;
  color: #fff;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}
.uvai-product:hover { border-color: var(--uvai-green-bright); background: #363a34; transform: translateY(-1px); }
.uvai-product img,
.uvai-product-placeholder { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; }
.uvai-product-placeholder { display: grid; place-items: center; background: #456f2c; }
.uvai-product-placeholder .uvai-icon { width: 25px; height: 25px; }
.uvai-product-info { min-width: 0; }
.uvai-product-info strong { display: block; overflow: hidden; font-size: 15px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.uvai-product-info small { display: block; }
.uvai-product-role { margin-bottom: 3px; color: #8fbe69; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.uvai-product-price { margin-top: 4px; color: #c4c4bf; font-size: 13px; line-height: 1.25; }
.uvai-product-arrow { color: #9f9f9b; font-size: 27px; }

.uvai-reactions { display: flex; gap: 4px; margin-top: 12px; }
.uvai-reaction { width: 38px; height: 38px; color: #fff; }
.uvai-reaction .uvai-icon,
.uvai-reaction .uvai-icon svg { width: 21px; height: 21px; }
.uvai-reaction:hover,
.uvai-reaction.is-active { background: #3a3a39; color: #8fbe69; }

.uvai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; margin-top: 13px; }
.uvai-chip {
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid #696967;
  border-radius: 22px;
  background: transparent;
  color: #f5f5f2;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  line-height: 1.2;
  transition: border-color .15s ease, background .15s ease;
}
.uvai-chip:hover { border-color: #8ebd68; background: #343d30; }

.uvai-sources { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 12px; padding-top: 10px; border-top: 1px solid #424240; }
.uvai-sources small { width: 100%; color: #a9aaa5; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.uvai-sources a { color: #a7d284; font-size: 12px; text-decoration: underline; text-underline-offset: 2px; }
.uvai-sources a:hover { color: #c9eba9; }

.uvai-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: end;
  padding: 14px 18px 18px;
  border-top: 1px solid #333332;
  background: var(--uvai-panel);
}
.uvai-form textarea {
  width: 100%;
  min-height: 54px;
  max-height: 112px;
  resize: none;
  padding: 15px 17px;
  overflow-y: auto;
  border: 1px solid #646462;
  border-radius: 28px;
  outline: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 15px;
  line-height: 1.45;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.uvai-form textarea::placeholder { color: #a5a5a2; }
.uvai-form textarea:focus { border-color: #8a8a86; box-shadow: 0 0 0 1px #8a8a86; }
.uvai-send {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 3px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--uvai-green);
  color: #fff;
  cursor: pointer;
}
.uvai-send:hover { background: #69a13f; }
.uvai-send:disabled { opacity: .45; cursor: wait; }
.uvai-send .uvai-icon,
.uvai-send .uvai-icon svg { width: 22px; height: 22px; }

.is-loading .uvai-bubble { color: #d6d6d2; }
.uvai-dots { display: inline-block; min-width: 32px; margin-left: 7px; color: #8fbe69; letter-spacing: 3px; animation: uvai-pulse 1.1s infinite ease-in-out; }

@media (max-width: 600px) {
  .uvai-launcher { left: 12px; bottom: 12px; min-width: 0; height: 60px; padding-right: 19px; font-size: 15px; }
  .uvai-launcher .uvai-avatar { width: 46px; height: 46px; }
  .uvai-panel,
  .uvai-panel.is-expanded { inset: 8px; width: auto; height: auto; border-radius: 20px; grid-template-rows: 76px 1fr auto; }
  .uvai-header { padding: 12px 10px 12px 14px; }
  .uvai-brand { gap: 10px; }
  .uvai-brand strong { font-size: 16px; }
  .uvai-brand .uvai-avatar { width: 44px; height: 44px; }
  .uvai-actions { gap: 0; }
  .uvai-action { width: 38px; height: 42px; }
  .uvai-expand,
  .uvai-more { display: none; }
  .uvai-messages { padding: 20px 18px 12px; }
  .uvai-message { margin-bottom: 23px; }
  .uvai-bubble { font-size: 15px; }
  .uvai-bubble h3 { font-size: 19px; }
  .uvai-user .uvai-bubble { max-width: 88%; }
  .uvai-form { padding: 11px 12px 14px; }
  .uvai-product { grid-template-columns: 52px minmax(0, 1fr) 16px; gap: 9px; }
  .uvai-product img,
  .uvai-product-placeholder { width: 52px; height: 52px; }
}

@media (max-width: 380px) {
  .uvai-launcher > span:last-child { display: none; }
  .uvai-launcher { width: 60px; padding: 6px; }
  .uvai-product-price { font-size: 12px; }
}

@media (prefers-reduced-motion: no-preference) {
  .uvai-panel { animation: uvai-in .2s ease-out; }
  @keyframes uvai-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }
  @keyframes uvai-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
}
