:root{
  --ostty-accent:#0f766e;
  --ostty-accent-2:#115e59;
  --ostty-surface:#fff;
  --ostty-ink:#0f172a;
  --ostty-muted:#64748b;
  --ostty-shadow:0 18px 50px rgba(15,23,42,.18);
}
.ostty-fab{
  position:fixed; z-index:85;
  /* فوق أيقونة واتساب مباشرة (نفس الجهة) */
  bottom:calc(26px + 58px + 14px);
  inset-inline-end:26px;
  inset-inline-start:auto;
  width:58px; height:58px; border-radius:18px;
  border:none; cursor:pointer; color:#fff;
  background:linear-gradient(145deg,var(--ostty-accent),var(--ostty-accent-2));
  box-shadow:0 12px 28px rgba(15,118,110,.35);
  display:flex; align-items:center; justify-content:center;
  transition:transform .2s ease, box-shadow .2s ease;
}
.ostty-fab:hover{ transform:translateY(-2px) scale(1.03); }
.ostty-fab svg{ width:26px; height:26px; }
.ostty-panel{
  position:fixed; z-index:86;
  bottom:calc(26px + 58px + 14px + 58px + 12px);
  inset-inline-end:26px;
  inset-inline-start:auto;
  width:min(380px, calc(100vw - 28px));
  height:min(560px, calc(100vh - 160px));
  background:var(--ostty-surface);
  border-radius:22px;
  box-shadow:var(--ostty-shadow);
  border:1px solid rgba(148,163,184,.25);
  display:none; flex-direction:column; overflow:hidden;
  opacity:0; transform:translateY(12px) scale(.98);
  transition:opacity .22s ease, transform .22s ease;
}
.ostty-panel.open{ display:flex; opacity:1; transform:none; }
.ostty-head{
  padding:14px 16px;
  background:linear-gradient(135deg,#0f766e 0%,#134e4a 100%);
  color:#fff; display:flex; align-items:center; gap:12px;
}
.ostty-avatar{
  width:40px; height:40px; border-radius:14px;
  background:rgba(255,255,255,.18);
  display:grid; place-items:center; font-weight:800;
}
.ostty-head h3{ margin:0; font-size:1rem; font-weight:800; }
.ostty-head small{ opacity:.85; }
.ostty-close{
  margin-inline-start:auto; background:transparent; border:0; color:#fff;
  width:32px; height:32px; border-radius:10px; cursor:pointer;
}
.ostty-msgs{
  flex:1; overflow:auto; padding:14px; display:flex; flex-direction:column; gap:10px;
  background:
    radial-gradient(circle at 10% 0%, rgba(15,118,110,.06), transparent 40%),
    linear-gradient(180deg,#f8fafc,#fff);
}
.ostty-bubble{
  max-width:88%; padding:10px 12px; border-radius:16px; font-size:.92rem; line-height:1.55;
  white-space:pre-wrap; word-break:break-word;
}
.ostty-bubble-body{ white-space:pre-wrap; word-break:break-word; }
.ostty-bubble .ostty-link{
  color:#0f766e; font-weight:700; text-decoration:underline; text-underline-offset:2px;
  word-break:break-all; cursor:pointer;
}
.ostty-bubble.user .ostty-link{ color:#ecfdf5; }
.ostty-bubble .ostty-link--wa{ color:#128c7e; }
.ostty-bubble .ostty-link--tel{ color:#0369a1; }
.ostty-bubble .ostty-link--mail{ color:#7c3aed; }
.ostty-bubble .ostty-link--product{ color:#c2410c; }
.ostty-bubble.user .ostty-link--wa,
.ostty-bubble.user .ostty-link--tel,
.ostty-bubble.user .ostty-link--mail,
.ostty-bubble.user .ostty-link--product{ color:#fff; }
.ostty-bubble.bot{
  align-self:flex-start;
  background:#fff; border:1px solid #e2e8f0; color:var(--ostty-ink);
  border-end-start-radius:6px;
}
.ostty-bubble.user{
  align-self:flex-end;
  background:#0f766e; color:#fff;
  border-end-end-radius:6px;
}
.ostty-feedback{ display:flex; gap:6px; margin-top:6px; }
.ostty-feedback button{
  border:1px solid #e2e8f0; background:#fff; border-radius:999px;
  font-size:.72rem; padding:2px 8px; color:var(--ostty-muted); cursor:pointer;
}
.ostty-typing{ font-size:.8rem; color:var(--ostty-muted); padding:0 4px; }
.ostty-form{
  border-top:1px solid #e2e8f0; padding:10px; display:flex; gap:8px; background:#fff;
}
.ostty-form textarea{
  flex:1; resize:none; min-height:42px; max-height:110px;
  border:1px solid #e2e8f0; border-radius:14px; padding:10px 12px; font:inherit;
}
.ostty-form button{
  border:0; border-radius:14px; padding:0 14px; font-weight:700; color:#fff; cursor:pointer;
  background:linear-gradient(145deg,var(--ostty-accent),var(--ostty-accent-2));
}
.ostty-lead{
  margin:0 14px 10px; padding:10px; border:1px dashed #99f6e4; border-radius:14px; background:#f0fdfa;
  display:none; gap:6px; flex-direction:column;
}
.ostty-lead.open{ display:flex; }
.ostty-lead input{
  border:1px solid #ccfbf1; border-radius:10px; padding:8px 10px; font:inherit;
}
@media (max-width:640px){
  /* واتساب على الموبايل: bottom ≈ 82px + safe — البوت فوقه */
  .ostty-fab{
    bottom:calc(82px + 50px + 14px + env(safe-area-inset-bottom,0));
    inset-inline-end:16px;
    width:52px; height:52px;
  }
  .ostty-panel{
    inset-inline-end:12px;
    bottom:calc(82px + 50px + 14px + 52px + 12px + env(safe-area-inset-bottom,0));
    height:min(62vh,480px);
  }
}
