/* Intmedia AI — pływający asystent (lewy-dolny róg; czat jest w prawym). */
.crm-ai {
	position: fixed;
	left: 20px;
	bottom: 20px;
	z-index: 9998;
	font-family: inherit;
}

.crm-ai__launcher {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 0;
	padding: 0;
	cursor: pointer;
	/* granat → niebieski z jaśniejszym odblaskiem u góry, cienka jasna obwódka */
	background: radial-gradient(circle at 30% 22%, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 46%), linear-gradient(150deg, var(--crm-primary, #2563eb) 0%, #0b1f4d 100%);
	color: #fff;
	box-shadow: 0 10px 26px rgba(11, 31, 77, .42), inset 0 0 0 1px rgba(255, 255, 255, .22);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.crm-ai__launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(37, 99, 235, .48); filter: brightness(1.05); }
.crm-ai__launcher:active { transform: translateY(0); }
.crm-ai__ic { width: 28px; height: 28px; display: block; }
.crm-ai__ic-mini { color: #7dd3fc; }
.crm-ai__launcher .crm-ai__ic { animation: crm-ai-twinkle 4s ease-in-out infinite; }
@keyframes crm-ai-twinkle { 0%, 82%, 100% { transform: scale(1) rotate(0); } 90% { transform: scale(1.12) rotate(12deg); } }
@media (prefers-reduced-motion: reduce) { .crm-ai__launcher .crm-ai__ic { animation: none; } }
.crm-ai__badge { display: inline-flex; vertical-align: -4px; margin-right: 2px; }
.crm-ai__ic--sm { width: 18px; height: 18px; }
.crm-ai__emoji { font-size: 26px; line-height: 1; }
.crm-ai.is-open .crm-ai__launcher { display: none; }

.crm-ai__panel {
	width: min(340px, calc(100vw - 40px));
	max-height: min(460px, calc(100vh - 120px));
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 18px 50px rgba(15, 23, 42, .28);
}
.crm-ai__panel[hidden] { display: none; }

.crm-ai__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 12px 8px 12px 14px;
	background: var(--crm-primary, #2563eb);
	color: #fff;
}
.crm-ai__title { font-weight: 700; font-size: .98rem; }
.crm-ai__x {
	border: 0;
	background: transparent;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 2px 8px;
	border-radius: 8px;
}
.crm-ai__x:hover { background: rgba(255, 255, 255, .18); }

.crm-ai__hello {
	margin: 0;
	padding: 14px 14px 6px;
	color: var(--crm-muted, #64748b);
	font-size: .9rem;
}

.crm-ai__tips {
	list-style: none;
	margin: 0;
	padding: 8px 14px 16px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.crm-ai__tip {
	display: flex;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 12px;
	background: #f1f5f9;
}
.crm-ai__tip.is-good { background: #e7f7ef; }
.crm-ai__tip-emoji { font-size: 1.15rem; line-height: 1.3; }
.crm-ai__tip-body { flex: 1; }
.crm-ai__tip-text { font-size: .9rem; color: #0f172a; }
.crm-ai__tip-act {
	margin-top: 6px;
	border: 0;
	background: transparent;
	color: var(--crm-primary, #2563eb);
	font-weight: 600;
	font-size: .86rem;
	cursor: pointer;
	padding: 0;
}
.crm-ai__tip-act:hover { text-decoration: underline; }

/* Dynamiczna („na żywo") podpowiedź — z realnych danych konta. */
.crm-ai__tip.is-live { background: #fff7ed; box-shadow: inset 0 0 0 1px #fed7aa; }
.crm-ai__tip.is-live .crm-ai__tip-text::after {
	content: "NA ŻYWO";
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 999px;
	background: #ea580c;
	color: #fff;
	font-size: .58rem;
	font-weight: 700;
	letter-spacing: .04em;
	vertical-align: middle;
}

/* Mini-FAQ (akordeon). */
.crm-ai__faq { display: flex; flex-direction: column; gap: 3px; padding-top: 6px; margin-top: 2px; border-top: 1px solid #e5e7eb; }
.crm-ai__faq-q {
	text-align: left;
	border: 0;
	background: transparent;
	color: #1d4ed8;
	font: inherit;
	font-weight: 600;
	font-size: .88rem;
	cursor: pointer;
	padding: 6px 6px;
	border-radius: 8px;
}
.crm-ai__faq-q:hover { background: #f1f5f9; }
.crm-ai__faq-q::before { content: "＋ "; color: #94a3b8; }
.crm-ai__faq-q.is-open::before { content: "－ "; }
.crm-ai__faq-a { padding: 2px 8px 8px 20px; font-size: .84rem; color: #334155; line-height: 1.45; }

/* „Pisze…" — trzy pulsujące kropki przy otwarciu. */
.crm-ai__typing { display: flex; gap: 5px; padding: 12px 14px; }
.crm-ai__typing span {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--crm-primary, #2563eb);
	opacity: .35;
	animation: crm-ai-typing 1s infinite ease-in-out;
}
.crm-ai__typing span:nth-child(2) { animation-delay: .15s; }
.crm-ai__typing span:nth-child(3) { animation-delay: .3s; }
@keyframes crm-ai-typing { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* Zachęta dla gościa (pierwsza wizyta): puls launchera + dymek. */
.crm-ai__launcher--pulse { animation: crm-ai-pulse 1.8s ease-out infinite; }
@keyframes crm-ai-pulse {
	0%   { box-shadow: 0 8px 24px rgba(15,23,42,.22), 0 0 0 0 rgba(37,99,235,.5); }
	70%  { box-shadow: 0 8px 24px rgba(15,23,42,.22), 0 0 0 16px rgba(37,99,235,0); }
	100% { box-shadow: 0 8px 24px rgba(15,23,42,.22), 0 0 0 0 rgba(37,99,235,0); }
}

.crm-ai__teaser {
	position: absolute;
	left: 0;
	bottom: 70px;
	max-width: 240px;
	text-align: left;
	background: #fff;
	color: #0f172a;
	border: 0;
	border-radius: 14px;
	padding: 12px 14px;
	font: inherit;
	font-size: .9rem;
	line-height: 1.35;
	cursor: pointer;
	box-shadow: 0 12px 34px rgba(15, 23, 42, .22);
	animation: crm-ai-teaser-in .3s ease-out both;
}
.crm-ai__teaser::after {
	content: "";
	position: absolute;
	left: 22px;
	bottom: -7px;
	width: 14px;
	height: 14px;
	background: #fff;
	transform: rotate(45deg);
	box-shadow: 3px 3px 6px rgba(15, 23, 42, .06);
}
.crm-ai__teaser.is-hiding { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
@keyframes crm-ai-teaser-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 640px) {
	.crm-ai { left: 12px; bottom: 12px; }
	.crm-ai__teaser { max-width: 200px; }
}
