.fya-root {
  --fya-primary: #111827;
  --fya-surface: #ffffff;
  --fya-canvas: #f7f8fa;
  --fya-text: #16181d;
  --fya-muted: #727780;
  --fya-border: rgba(17, 24, 39, .09);
  --fya-shadow: 0 24px 70px rgba(15, 23, 42, .18), 0 4px 18px rgba(15, 23, 42, .08);
  position: fixed;
  z-index: 999999;
  right: 24px;
  bottom: 24px;
  direction: rtl;
  color: var(--fya-text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.65;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

.fya-root,
.fya-root *,
.fya-root *::before,
.fya-root *::after { box-sizing: border-box; }

.fya-root button,
.fya-root input,
.fya-root textarea,
.fya-root select { font: inherit; }

.fya-launcher {
  appearance: none;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  min-height: 58px;
  padding: 7px 10px 7px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--fya-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 14px 36px color-mix(in srgb, var(--fya-primary) 30%, transparent);
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.fya-launcher:hover { transform: translateY(-2px); box-shadow: 0 18px 42px color-mix(in srgb, var(--fya-primary) 35%, transparent); }
.fya-launcher:focus-visible { outline: 3px solid color-mix(in srgb, var(--fya-primary) 24%, transparent); outline-offset: 3px; }

.fya-launcher-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  display: grid;
  place-items: center;
}
.fya-launcher-icon svg { width: 22px; height: 22px; display: block; fill: currentColor; }
.fya-launcher-text { font-weight: 700; font-size: 13px; letter-spacing: -.1px; }

.fya-panel {
  position: absolute;
  right: 0;
  bottom: 74px;
  width: min(408px, calc(100vw - 30px));
  height: min(660px, calc(100vh - 116px));
  min-height: 450px;
  overflow: hidden;
  border: 1px solid var(--fya-border);
  border-radius: 24px;
  background: var(--fya-surface);
  box-shadow: var(--fya-shadow);
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(12px) scale(.985);
  transform-origin: bottom right;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.fya-panel.is-open { opacity: 1; visibility: visible; pointer-events: auto; transform: translateY(0) scale(1); }

.fya-header {
  min-height: 76px;
  padding: 13px 14px 13px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--fya-border);
}
.fya-brand { min-width: 0; display: flex; align-items: center; gap: 11px; }
.fya-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--fya-primary);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
.fya-avatar svg { width: 22px; height: 22px; fill: currentColor; }
.fya-brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.fya-title { font-size: 14px; font-weight: 800; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fya-status { display: inline-flex; align-items: center; gap: 6px; color: var(--fya-muted); font-size: 10.5px; line-height: 1.5; }
.fya-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #20a464; box-shadow: 0 0 0 3px rgba(32,164,100,.11); }
.fya-close {
  appearance: none;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.fya-close:hover { background: #f3f4f6; color: #111827; }
.fya-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; fill: none; }

.fya-messages {
  min-height: 0;
  padding: 18px 14px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 100% 0, color-mix(in srgb, var(--fya-primary) 5%, transparent), transparent 34%),
    var(--fya-canvas);
  scrollbar-width: thin;
  scrollbar-color: #d5d8dd transparent;
}
.fya-messages::-webkit-scrollbar { width: 5px; }
.fya-messages::-webkit-scrollbar-thumb { background: #d5d8dd; border-radius: 99px; }

.fya-message {
  width: fit-content;
  max-width: 88%;
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 16px;
  line-height: 1.85;
  font-size: 12.5px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  box-shadow: 0 1px 1px rgba(15,23,42,.02);
  animation: fya-message-in .16s ease both;
}
@keyframes fya-message-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.fya-assistant {
  margin-left: auto;
  background: #fff;
  border: 1px solid var(--fya-border);
  border-top-right-radius: 6px;
  color: var(--fya-text);
}
.fya-user {
  margin-right: auto;
  background: var(--fya-primary);
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--fya-primary) 88%, #000);
  border-top-left-radius: 6px;
}

.fya-typing { display: flex; align-items: center; gap: 4px; min-width: 50px; min-height: 38px; }
.fya-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9ca3af; animation: fya-bounce 1s infinite ease-in-out; }
.fya-typing span:nth-child(2) { animation-delay: .15s; }
.fya-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes fya-bounce { 0%,80%,100% { transform: translateY(0); opacity: .55; } 40% { transform: translateY(-4px); opacity: 1; } }

.fya-items { display: grid; gap: 10px; margin: 4px 0 14px; }
.fya-item {
  background: #fff;
  border: 1px solid var(--fya-border);
  border-radius: 18px;
  padding: 10px;
  display: grid;
  grid-template-columns: 82px minmax(0,1fr);
  gap: 11px;
  box-shadow: 0 6px 20px rgba(15,23,42,.045);
}
.fya-item.fya-no-image { grid-template-columns: 1fr; }
.fya-item-image { width: 82px; height: 82px; object-fit: cover; border-radius: 13px; background: #f1f3f5; }
.fya-item-body { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fya-item-type { color: var(--fya-muted); font-size: 9.5px; }
.fya-item-title { color: var(--fya-text); font-size: 12px; font-weight: 800; text-decoration: none; line-height: 1.65; }
.fya-item-title:hover { color: var(--fya-primary); }
.fya-item-price { color: var(--fya-primary); font-size: 12px; font-weight: 800; }
.fya-item-summary { color: var(--fya-muted); font-size: 10.5px; line-height: 1.7; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.fya-item-actions { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }

.fya-primary-btn,
.fya-secondary-btn {
  appearance: none;
  min-height: 34px;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .14s ease, opacity .14s ease, background .14s ease;
}
.fya-primary-btn { border: 1px solid var(--fya-primary); background: var(--fya-primary); color: #fff; }
.fya-secondary-btn { border: 1px solid var(--fya-border); background: #fff; color: #42464d; }
.fya-primary-btn:hover, .fya-secondary-btn:hover { transform: translateY(-1px); }
.fya-primary-btn:disabled { opacity: .52; cursor: not-allowed; transform: none; }

.fya-variations { display: grid; gap: 7px; margin-top: 5px; }
.fya-variation-field { display: grid; gap: 4px; font-size: 10px; color: var(--fya-muted); }
.fya-variation-field select {
  width: 100%; min-height: 36px; padding: 4px 8px;
  border: 1px solid var(--fya-border); border-radius: 10px;
  background: #fff; color: var(--fya-text); outline: none;
}
.fya-variation-field select:focus { border-color: color-mix(in srgb, var(--fya-primary) 45%, #d1d5db); }

.fya-success {
  border: 1px solid rgba(16,185,129,.22);
  background: #ecfdf5;
  color: #065f46;
  border-radius: 14px;
  padding: 11px 12px;
  margin: 4px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
}
.fya-success a { color: #047857; font-weight: 800; }

.fya-quick-actions {
  padding: 9px 12px;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  border-top: 1px solid var(--fya-border);
  background: #fff;
  scrollbar-width: none;
}
.fya-quick-actions::-webkit-scrollbar { display: none; }
.fya-quick-actions button,
.fya-quick-actions a {
  white-space: nowrap;
  min-height: 34px;
  border: 1px solid var(--fya-border);
  background: #fff;
  color: #4b5058;
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 10.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .15s ease, background .15s ease;
}
.fya-quick-actions button:hover,
.fya-quick-actions a:hover { border-color: color-mix(in srgb, var(--fya-primary) 32%, #d1d5db); background: #fafafa; }

.fya-form {
  border-top: 1px solid var(--fya-border);
  display: grid;
  grid-template-columns: minmax(0,1fr) 44px;
  gap: 8px;
  padding: 10px 12px;
  align-items: end;
  background: #fff;
}
.fya-form textarea {
  display: block;
  resize: none;
  width: 100%;
  height: 44px;
  min-height: 44px;
  max-height: 112px;
  border: 1px solid #dfe2e6;
  border-radius: 14px;
  padding: 10px 11px;
  background: #fafafa;
  color: var(--fya-text);
  font-size: 12.5px;
  line-height: 1.7;
  outline: none;
  direction: rtl;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.fya-form textarea::placeholder { color: #9aa0a8; }
.fya-form textarea:focus { background: #fff; border-color: color-mix(in srgb, var(--fya-primary) 48%, #d1d5db); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fya-primary) 8%, transparent); }
.fya-form button {
  appearance: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 0;
  background: var(--fya-primary);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.fya-form button:hover { transform: translateY(-1px); }
.fya-form button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.fya-form button svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }

.fya-lead-card {
  border: 1px solid var(--fya-border);
  background: #fff;
  border-radius: 18px;
  padding: 13px;
  margin: 5px 0 13px;
  display: grid;
  gap: 10px;
  font-size: 11.5px;
  box-shadow: 0 6px 20px rgba(15,23,42,.04);
}
.fya-lead-form { display: grid; gap: 8px; }
.fya-lead-form input:not([type="checkbox"]),
.fya-lead-form textarea {
  width: 100%;
  min-height: 39px;
  border: 1px solid #dfe2e6;
  border-radius: 11px;
  padding: 8px 9px;
  background: #fafafa;
  color: var(--fya-text);
  font-size: 11.5px;
  direction: rtl;
  outline: none;
}
.fya-lead-form input:focus,
.fya-lead-form textarea:focus { background: #fff; border-color: color-mix(in srgb, var(--fya-primary) 44%, #d1d5db); }
.fya-consent { display: grid; grid-template-columns: 18px 1fr; gap: 7px; align-items: start; color: var(--fya-muted); font-size: 9.5px; line-height: 1.7; }
.fya-consent input { margin-top: 3px; }
.fya-lead-status { min-height: 16px; color: #b45309; font-size: 10px; }
.fya-lead-success { background: #ecfdf5; color: #065f46; border: 1px solid rgba(16,185,129,.22); border-radius: 11px; padding: 10px; line-height: 1.75; }
.fya-hp { position: absolute !important; left: -99999px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }

.fya-footnote {
  color: #a0a5ad;
  font-size: 8.5px;
  line-height: 1.5;
  text-align: center;
  padding: 0 10px 8px;
  background: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .fya-panel, .fya-launcher, .fya-message, .fya-typing span { animation: none !important; transition: none !important; }
}

@media (max-width: 520px) {
  .fya-root { right: 12px; bottom: 12px; }
  .fya-panel {
    position: fixed;
    inset: 8px;
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 22px;
    transform-origin: bottom center;
  }
  .fya-launcher { width: 58px; height: 58px; padding: 7px; justify-content: center; }
  .fya-launcher-text { display: none; }
  .fya-item { grid-template-columns: 72px minmax(0,1fr); }
  .fya-item-image { width: 72px; height: 72px; }
}

/* NIVA positioning and final polish */
.fya-root.is-left { right: auto; left: 24px; }
.fya-root.is-left .fya-panel { right: auto; left: 0; transform-origin: bottom left; }
.fya-root.is-left .fya-launcher { flex-direction: row-reverse; padding: 7px 18px 7px 10px; }
.fya-root.is-open .fya-launcher { opacity: .96; }
.fya-item { transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease; }
.fya-item:hover { transform: translateY(-1px); border-color: rgba(17,24,39,.14); box-shadow: 0 10px 28px rgba(15,23,42,.07); }
.fya-quick-actions { min-height: 53px; }
.fya-quick-actions:empty { display: none; }
.fya-panel a:focus-visible,
.fya-panel button:focus-visible,
.fya-panel textarea:focus-visible,
.fya-panel input:focus-visible,
.fya-panel select:focus-visible { outline: 2px solid var(--fya-primary); outline-offset: 2px; }

@media (max-width: 520px) {
  .fya-root.is-left { left: 12px; right: auto; }
}
.fya-header-actions { display: flex; align-items: center; gap: 4px; }
.fya-reset {
  appearance: none; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 11px; background: transparent; color: #7b818b; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.fya-reset:hover { background: #f3f4f6; color: #111827; }
.fya-reset svg { width: 17px; height: 17px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
