#jumana-chat-root {
  --jumana-primary: #0e595a;
  --jumana-primary-dark: #083f40;
  --jumana-orange: #f28c28;
  --jumana-whatsapp: #1fa855;
  --jumana-soft: #eff7f6;
  --jumana-text: #172324;
  --jumana-border: #d8e3e2;
  position: fixed;
  z-index: 999999;
  right: max(92px, calc(env(safe-area-inset-right) + 84px));
  bottom: max(18px, env(safe-area-inset-bottom));
  direction: rtl;
  font-family: inherit;
  color: var(--jumana-text);
}

#jumana-chat-root [hidden] { display: none !important; }

.jumana-launcher {
  width: 64px;
  height: 64px;
  padding: 0;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--jumana-primary);
  color: #fff;
  box-shadow: 0 10px 30px rgba(6, 48, 49, .28);
  cursor: pointer;
  font-size: 24px;
  transition: transform .18s ease, background .18s ease;
}

.jumana-launcher:hover { transform: translateY(-2px); background: var(--jumana-primary-dark); }
.jumana-launcher.is-open { border-radius: 50%; transform: rotate(-8deg); }
.jumana-launcher-avatar { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }

.jumana-proactive {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: min(310px, calc(100vw - 36px));
  background: #fff;
  border: 1px solid var(--jumana-border);
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 14px 40px rgba(20, 47, 48, .2);
  animation: jumana-in .25s ease both;
}

.jumana-proactive-text {
  width: 100%;
  padding: 19px 20px 18px 38px;
  border: 0;
  background: transparent;
  color: var(--jumana-text);
  text-align: right;
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
  cursor: pointer;
}

.jumana-proactive-close,
.jumana-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  line-height: 1;
}

.jumana-proactive-close { position: absolute; top: 8px; left: 9px; color: #617172; font-size: 22px; }

.jumana-panel {
  position: fixed;
  right: 0;
  bottom: 150px;
  display: flex;
  flex-direction: column;
  width: min(430px, 100vw);
  height: min(620px, 56vh);
  height: min(620px, 56dvh);
  min-height: 360px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--jumana-border);
  border-radius: 22px 0 0 22px;
  box-shadow: -18px 0 55px rgba(20, 47, 48, .2);
  animation: jumana-drawer-in .2s ease both;
}

.jumana-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--jumana-primary);
  border-bottom: 3px solid var(--jumana-orange);
  color: #fff;
}

.jumana-identity { display: flex; align-items: center; gap: 10px; }
.jumana-identity div { display: flex; flex-direction: column; gap: 2px; }
.jumana-identity strong { font-size: 17px; }
.jumana-identity small { color: rgba(255,255,255,.78); font-size: 11px; }
.jumana-avatar { display: grid; place-items: center; width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; background: #fff; color: var(--jumana-primary); font-weight: 800; }
.jumana-avatar-image { object-fit: cover; padding: 0; box-sizing: border-box; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--jumana-orange); }
.jumana-close { color: #fff; font-size: 28px; padding: 8px; }

.jumana-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px;
  background: #f4f0e8;
  overscroll-behavior: contain;
}

.jumana-message-row { display: flex; margin: 0 0 11px; }
.jumana-message-row.jumana-visitor { justify-content: flex-start; }
.jumana-message-row.jumana-ai,
.jumana-message-row.jumana-human,
.jumana-message-row.jumana-system { justify-content: flex-end; }
.jumana-bubble { max-width: 84%; padding: 10px 13px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.65; box-shadow: 0 1px 2px rgba(20,47,48,.1); }
.jumana-ai .jumana-bubble { background: #fff; border: 1px solid rgba(14,89,90,.1); border-bottom-left-radius: 4px; }
.jumana-human .jumana-bubble { background: #e7f3ee; border: 1px solid #c6dfd3; border-bottom-left-radius: 5px; }
.jumana-visitor .jumana-bubble { background: #d9eee7; color: #173c3d; border: 1px solid rgba(14,89,90,.12); border-bottom-right-radius: 4px; }
.jumana-system .jumana-bubble { width: 100%; max-width: 100%; background: #fff4df; color: #694910; text-align: center; font-size: 12px; }

.jumana-status { padding: 9px 14px; background: #fff8e7; color: #745312; border-top: 1px solid #f3e3b6; font-size: 12px; text-align: center; }
.jumana-typing { padding: 5px 16px 8px; color: #6b797a; font-size: 12px; }
.jumana-human, .jumana-new { margin: 8px 14px 0; padding: 8px 11px; background: transparent; color: var(--jumana-primary); border: 1px solid var(--jumana-primary); border-radius: 10px; cursor: pointer; font: inherit; font-size: 12px; }
.jumana-contact-actions { display: flex; align-items: stretch; align-self: center; width: min(300px, calc(100% - 32px)); margin: 8px auto 0; overflow: hidden; border: 1px solid var(--jumana-primary); border-radius: 10px; background: #fff; }
.jumana-contact-actions .jumana-human { flex: 1; min-height: 40px; margin: 0; border: 0; border-radius: 0; background: transparent; }
.jumana-contact-actions .jumana-human:disabled { color: #607071; cursor: default; }

.jumana-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; background: #fff; border-top: 1px solid var(--jumana-border); }
.jumana-form textarea { flex: 1; min-height: 44px; max-height: 100px; resize: none; border: 1px solid var(--jumana-border); border-radius: 22px; padding: 10px 14px; color: var(--jumana-text); background: #fff; font: inherit; font-size: 14px; line-height: 1.5; outline: none; }
.jumana-form textarea:focus { border-color: var(--jumana-primary); box-shadow: 0 0 0 2px rgba(14, 89, 90, .1); }
.jumana-send { display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 0; border-radius: 50%; background: var(--jumana-orange); color: #fff; cursor: pointer; transform: rotate(180deg); }
.jumana-send:disabled { opacity: .5; cursor: wait; }
.jumana-whatsapp { display: grid; place-items: center; width: 46px; min-height: 40px; flex: 0 0 46px; border-right: 1px solid rgba(14,89,90,.2); background: #edf8f1; color: #168447; text-decoration: none; transition: background .16s ease, color .16s ease, box-shadow .16s ease; }
.jumana-whatsapp:hover, .jumana-whatsapp:focus { color: #fff; background: var(--jumana-whatsapp); }
.jumana-whatsapp.is-urgent { color: #fff; background: var(--jumana-whatsapp); box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.jumana-whatsapp svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.jumana-footer { padding: 0 14px 10px; color: #7a8687; text-align: center; font-size: 9px; line-height: 1.45; }

@keyframes jumana-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes jumana-drawer-in { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }

@media (max-width: 520px) {
	#jumana-chat-root { right: 76px; bottom: 10px; }
	.jumana-panel { right: 12px; left: auto; bottom: 102px; width: min(340px, calc(100vw - 44px)); height: min(430px, 48dvh); min-height: 300px; border: 1px solid var(--jumana-border); border-radius: 18px; box-shadow: 0 14px 38px rgba(20, 47, 48, .2); }
	.jumana-launcher { box-sizing: border-box; width: 52px; height: 52px; }
	.jumana-launcher.is-open { transform: none; }
	.jumana-header { padding: 9px 11px; }
	.jumana-identity { gap: 8px; }
	.jumana-identity strong { font-size: 15px; }
	.jumana-identity small { font-size: 10px; }
	.jumana-avatar { width: 42px; height: 42px; flex-basis: 42px; }
	.jumana-avatar-image { width: 42px; height: 42px; border-width: 2px; }
	.jumana-close { padding: 5px; font-size: 24px; }
	.jumana-messages { padding: 11px 9px; }
	.jumana-message-row { margin-bottom: 7px; }
	.jumana-bubble { max-width: 88%; padding: 8px 10px; font-size: 13px; line-height: 1.55; }
	.jumana-contact-actions { width: min(260px, calc(100% - 24px)); margin-top: 6px; }
	.jumana-contact-actions .jumana-human { min-height: 34px; padding: 6px 8px; font-size: 11px; }
	.jumana-whatsapp { width: 40px; min-height: 34px; flex-basis: 40px; }
	.jumana-form { gap: 6px; padding: 7px 8px; }
	.jumana-form textarea { font-size: 16px; }
	.jumana-send { width: 40px; height: 40px; flex-basis: 40px; }
	.jumana-footer { padding: 0 10px 7px; font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .jumana-panel, .jumana-proactive { animation: none; }
  .jumana-launcher { transition: none; }
}
