.mrtc {
	--c-brand: #0d7fbc;
	--c-brand-600: #0a6697;
	--c-ink: #0b2239;
	--c-ink-2: #33475e;
	--c-muted: #62748a;
	--c-line: #e2e9f0;
	--c-soft: #eef3f7;
	--c-wa: #1c9d52;
	--c-on: #22c07a;
	position: fixed; right: 20px; bottom: 20px; z-index: 9990;
	display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
	font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-size: 15px; line-height: 1.5; color: var(--c-ink-2);
}
.mrtc *, .mrtc *::before, .mrtc *::after { box-sizing: border-box; }
.mrtc [hidden] { display: none !important; }
.mrtc button { font-family: inherit; }

/* ---------- Floating buttons ---------- */
.mrtc-wa {
	position: relative; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%;
	background: var(--c-wa); color: #fff; text-decoration: none; box-shadow: 0 12px 30px -10px rgba(28, 157, 82, .7);
	transition: transform .2s;
}
.mrtc-wa:hover { transform: translateY(-2px) scale(1.04); color: #fff; }
.mrtc-wa::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 0 rgba(28, 157, 82, .5); animation: mrtc-ring 2.6s infinite; }
@keyframes mrtc-ring { 0% { box-shadow: 0 0 0 0 rgba(28, 157, 82, .45); } 70%, 100% { box-shadow: 0 0 0 16px rgba(28, 157, 82, 0); } }
.mrtc-tip {
	position: absolute; right: calc(100% + 12px); top: 50%; transform: translate(6px, -50%); padding: 7px 12px; border-radius: 10px;
	background: var(--c-ink); color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; transition: .2s;
}
.mrtc-wa:hover .mrtc-tip { opacity: 1; transform: translate(0, -50%); }
.mrtc.is-open .mrtc-wa { display: none; }

.mrtc-launcher {
	position: relative; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 10px 0 8px;
	border: 0; border-radius: 999px; background: #fff; color: var(--c-ink); cursor: pointer; text-align: left;
	box-shadow: 0 18px 40px -14px rgba(11, 34, 57, .45), 0 0 0 1px rgba(11, 34, 57, .06); transition: transform .2s, box-shadow .2s;
}
.mrtc-launcher:hover { transform: translateY(-2px); box-shadow: 0 22px 46px -14px rgba(11, 34, 57, .5), 0 0 0 1px rgba(11, 34, 57, .08); }
.mrtc-launcher__av, .mrtc-avatar, .mrtc-teaser__av {
	position: relative; flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
	background: linear-gradient(140deg, #0b2239, #0d5e8f); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .04em;
}
.mrtc-launcher__av i, .mrtc-avatar i, .mrtc-teaser__av i {
	position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: #9aa9b8; border: 2.5px solid #fff;
}
.mrtc[data-online="1"] .mrtc-launcher__av i, .mrtc[data-online="1"] .mrtc-avatar i, .mrtc[data-online="1"] .mrtc-teaser__av i { background: var(--c-on); }
.mrtc-launcher__txt { display: grid; line-height: 1.25; }
.mrtc-launcher__txt strong { font-size: 15px; }
.mrtc-launcher__txt small { font-size: 12.5px; color: var(--c-muted); }
.mrtc-launcher__ico { display: grid; place-items: center; width: 44px; height: 44px; margin-left: 6px; border-radius: 50%; background: var(--c-brand); color: #fff; }
.mrtc-badge {
	position: absolute; top: -3px; left: 38px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
	background: #e5484d; color: #fff; font-size: 12px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid #fff;
}

/* ---------- Teaser ---------- */
.mrtc-teaser {
	position: relative; display: flex; gap: 10px; width: 300px; padding: 14px 16px; border-radius: 18px 18px 6px 18px; background: #fff; cursor: pointer;
	box-shadow: 0 20px 50px -18px rgba(11, 34, 57, .45), 0 0 0 1px rgba(11, 34, 57, .06);
	opacity: 0; transform: translateY(10px) scale(.97); transform-origin: bottom right; transition: opacity .25s, transform .25s;
}
.mrtc-teaser.is-in { opacity: 1; transform: none; }
.mrtc-teaser__av { width: 38px; height: 38px; font-size: 10px; }
.mrtc-teaser__av i { width: 11px; height: 11px; }
.mrtc-teaser__body strong { display: block; font-size: 13px; color: var(--c-ink); }
.mrtc-teaser__body p { margin: 2px 0 0; font-size: 14px; color: var(--c-ink-2); }
.mrtc-teaser__x { position: absolute; top: -10px; left: -10px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: #fff; color: var(--c-muted); box-shadow: 0 2px 8px rgba(11, 34, 57, .2); cursor: pointer; }
.mrtc-teaser__x svg { width: 14px; height: 14px; }

/* ---------- Panel ---------- */
.mrtc-panel {
	position: absolute; right: 0; bottom: 80px; width: 390px; height: min(640px, calc(100vh - 130px));
	display: flex; flex-direction: column; overflow: hidden; background: #fff; border-radius: 22px;
	box-shadow: 0 40px 90px -24px rgba(11, 34, 57, .5), 0 0 0 1px rgba(11, 34, 57, .06);
	opacity: 0; transform: translateY(14px) scale(.97); transform-origin: bottom right; transition: opacity .22s, transform .22s;
}
.mrtc-panel.is-in { opacity: 1; transform: none; }

.mrtc-head {
	display: flex; align-items: center; gap: 12px; padding: 16px 12px 16px 16px; color: #fff;
	background: radial-gradient(260px 120px at 100% 0%, rgba(92, 192, 238, .35), transparent 70%), linear-gradient(140deg, #0b2239, #0e3b5e);
}
.mrtc-avatar { width: 44px; height: 44px; background: #fff; color: var(--c-ink); }
.mrtc-avatar i { border-color: #0e3354; }
.mrtc-head__txt { flex: 1; min-width: 0; display: grid; }
.mrtc-head__txt strong { font-size: 15.5px; }
.mrtc-status { display: block; min-width: 0; overflow: hidden; font-size: 12.5px; color: #b9cfe0; }
.mrtc-status em { font-style: normal; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mrtc-hcall, .mrtc-x { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; text-decoration: none; }
.mrtc-hcall:hover, .mrtc-x:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.mrtc-x { background: transparent; }

.mrtc-body {
	flex: 1; overflow-y: auto; padding: 14px 14px 18px; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px;
	background: linear-gradient(#f5f8fb, #eef3f7);
}
.mrtc-day { align-self: center; margin: 2px 0 6px; padding: 3px 10px; border-radius: 999px; background: rgba(11, 34, 57, .06); color: var(--c-muted); font-size: 11.5px; font-weight: 600; }
.mrtc-msg { display: flex; flex-direction: column; max-width: 86%; animation: mrtc-in .28s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes mrtc-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mrtc-msg--visitor { align-self: flex-end; align-items: flex-end; }
.mrtc-bubble { padding: 10px 14px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; line-height: 1.5; }
.mrtc-msg--agent .mrtc-bubble { background: #fff; color: var(--c-ink); border-bottom-left-radius: 6px; box-shadow: 0 1px 2px rgba(11, 34, 57, .08); }
.mrtc-msg--visitor .mrtc-bubble { background: var(--c-brand); color: #fff; border-bottom-right-radius: 6px; }
.mrtc-meta { display: inline-flex; align-items: center; gap: 3px; margin-top: 3px; padding: 0 6px; font-size: 11px; color: var(--c-muted); }
.mrtc-tick { display: inline-flex; color: var(--c-brand); }
.mrtc-msg.is-sending { opacity: .6; }
.mrtc-msg.is-sending .mrtc-tick { color: var(--c-muted); }
.mrtc-msg.is-failed .mrtc-bubble { background: #fbe3e4; color: #8d1f23; }
.mrtc-msg.is-failed .mrtc-meta { color: #b3261e; }
.mrtc-msg--typing .mrtc-bubble { padding: 13px 16px; }
.mrtc-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.mrtc-dots i { width: 7px; height: 7px; border-radius: 50%; background: #8fa1b3; animation: mrtc-dot 1.1s infinite; }
.mrtc-dots i:nth-child(2) { animation-delay: .15s; }
.mrtc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes mrtc-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.mrtc-quick { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin-top: 2px; animation: mrtc-in .3s .1s both; }
.mrtc-chip {
	padding: 9px 14px; border-radius: 16px 16px 6px 16px; border: 1.5px solid #bcdcee; background: #fff; color: var(--c-brand-600);
	font-weight: 600; font-size: 13.5px; line-height: 1.3; text-align: right; cursor: pointer; transition: .15s;
}
.mrtc-chip:hover { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }

.mrtc-call { display: grid; gap: 8px; margin: 4px 0 2px; animation: mrtc-in .3s both; }
.mrtc-call__main {
	position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; text-decoration: none;
	background: linear-gradient(135deg, #0d7fbc, #0a5f91); color: #fff; box-shadow: 0 12px 24px -12px rgba(13, 127, 188, .8); overflow: hidden;
}
.mrtc-call__main::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .25) 50%, transparent 70%); transform: translateX(-100%); animation: mrtc-shine 2.8s 1s infinite; }
@keyframes mrtc-shine { 60%, 100% { transform: translateX(100%); } }
.mrtc-call__main:hover { color: #fff; filter: brightness(1.05); }
.mrtc-call__ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .18); animation: mrtc-wiggle 2.8s 1.5s infinite; }
@keyframes mrtc-wiggle { 0%, 88%, 100% { transform: rotate(0); } 90% { transform: rotate(-14deg); } 93% { transform: rotate(12deg); } 96% { transform: rotate(-8deg); } }
.mrtc-call__main strong { display: block; font-size: 15px; }
.mrtc-call__main small { font-size: 13px; opacity: .9; }
.mrtc-call__wa { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; border-radius: 14px; background: #fff; color: var(--c-wa); font-weight: 700; font-size: 13.5px; text-decoration: none; box-shadow: 0 1px 2px rgba(11, 34, 57, .08); }
.mrtc-call__wa:hover { background: #e9f7ef; color: var(--c-wa); }
.mrtc-call__cb { padding: 8px; border: 0; background: none; color: var(--c-brand-600); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.mrtc-card { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(11, 34, 57, .08); animation: mrtc-in .3s both; }
.mrtc-card p { margin: 0 0 4px; color: var(--c-ink); font-size: 14px; }
.mrtc-card input { width: 100%; height: 46px; padding: 0 12px; border: 1.5px solid #d3dde7; border-radius: 12px; font: inherit; font-size: 16px; color: var(--c-ink); background: #fff; }
.mrtc-card input:focus { outline: 0; border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(13, 127, 188, .12); }
.mrtc-card button { height: 46px; border: 0; border-radius: 12px; background: var(--c-brand); color: #fff; font-weight: 700; font-size: 15px; cursor: pointer; }
.mrtc-card button:disabled { opacity: .7; }
.mrtc-card small { font-size: 11.5px; color: var(--c-muted); }
.mrtc-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.mrtc-err { padding: 8px 10px; border-radius: 8px; background: #fbe3e4; color: #8d1f23; font-size: 13px; }

.mrtc-compose { display: flex; align-items: flex-end; gap: 8px; padding: 10px 10px 10px 16px; border-top: 1px solid var(--c-line); background: #fff; }
.mrtc-compose textarea {
	flex: 1; min-height: 44px; max-height: 120px; padding: 11px 0; border: 0; outline: 0; resize: none;
	font: inherit; font-size: 16px; color: var(--c-ink); background: transparent;
}
.mrtc-compose button { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--c-brand); color: #fff; cursor: pointer; transition: background .15s, transform .15s; }
.mrtc-compose button:hover { background: var(--c-brand-600); transform: scale(1.05); }

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
	.mrtc-has-mbar .mrtc-wa, .mrtc-has-mbar .mrtc-launcher, .mrtc-has-mbar .mrtc-teaser { display: none !important; }
	.mrtc-has-mbar .mrtc { bottom: calc(72px + env(safe-area-inset-bottom)); right: 14px; }
}
@media (max-width: 767px) {
	.mrtc { right: 14px; bottom: 14px; }
	.mrtc-launcher { height: 60px; padding: 0 6px; }
	.mrtc-launcher__txt, .mrtc-launcher__ico { display: none; }
	.mrtc.is-open { inset: 0; }
	.mrtc-panel {
		position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0;
		padding-bottom: env(safe-area-inset-bottom); transform: translateY(24px);
	}
	.mrtc-head { padding-top: calc(14px + env(safe-area-inset-top)); }
	.mrtc.is-open .mrtc-launcher { display: none; }
	html.mrtc-lock, html.mrtc-lock body { overflow: hidden; }
	.mrtc-teaser { width: min(300px, calc(100vw - 28px)); }
}
@media (prefers-reduced-motion: reduce) {
	.mrtc *, .mrtc-panel { transition: none !important; animation: none !important; }
}
