.aia-root {
	--aia-color: #2563eb;
	--aia-radius: 18px;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color: #0f172a;
	box-sizing: border-box;
}

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

.aia-floating {
	position: fixed;
	z-index: 99999;
	bottom: 20px;
	right: 20px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 12px;
}

.aia-floating.aia-bottom-left {
	right: auto;
	left: 20px;
	align-items: flex-start;
}

.aia-launcher {
	width: 60px;
	height: 60px;
	border: 0;
	border-radius: 50%;
	background: var(--aia-color);
	color: #fff;
	box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.aia-launcher:hover,
.aia-launcher:focus-visible {
	transform: scale(1.06);
	box-shadow: 0 14px 32px rgba(15, 23, 42, 0.3);
	outline: none;
}

.aia-panel[hidden] {
	display: none !important;
}

.aia-panel {
	width: min(380px, calc(100vw - 24px));
	height: min(720px, calc(100vh - 90px));
	background: #fff;
	border-radius: var(--aia-radius);
	box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid #e2e8f0;
}

.aia-inline .aia-panel[hidden] {
	display: none !important;
}

.aia-panel {
	width: 100%;
	max-width: 480px;
	height: 680px;
	margin: 0 auto;
}

.aia-header {
	background: var(--aia-color);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.aia-header-main {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.aia-logo,
.aia-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
	background: rgba(255, 255, 255, 0.18);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-weight: 700;
	flex-shrink: 0;
}

.aia-name {
	margin: 0;
	font-weight: 700;
	font-size: 15px;
}

.aia-status {
	margin: 2px 0 0;
	font-size: 12px;
	opacity: 0.9;
}

.aia-header-actions {
	display: flex;
	align-items: center;
	gap: 4px;
}

.aia-action {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 8px;
	color: #fff;
	cursor: pointer;
}

.aia-action:hover,
.aia-action:focus-visible {
	background: rgba(255, 255, 255, 0.18);
}

.aia-close {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
	padding: 0 4px;
}


.aia-quick-replies {
	flex-shrink: 0;
	max-height: 104px;
	overflow-y: auto;
	padding: 10px 12px 8px;
	background: #f8fafc;
	display: flex;
	flex-wrap: wrap;
	gap: 7px;
	border-bottom: 1px solid #e2e8f0;
}

.aia-quick-reply {
	border: 1px solid #cbd5e1;
	background: #fff;
	color: #334155;
	border-radius: 9px;
	padding: 7px 10px;
	font-size: 12px;
	line-height: 1.25;
	cursor: pointer;
}

.aia-quick-reply:hover,
.aia-quick-reply:focus-visible {
	border-color: var(--aia-color);
	color: var(--aia-color);
	outline: none;
}

.aia-quick-reply:disabled { opacity: .55; cursor: wait; }

.aia-messages {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	padding: 16px;
	background: #f8fafc;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.aia-msg {
	display: flex;
	max-width: 85%;
}

.aia-msg-assistant {
	align-self: flex-start;
}

.aia-msg-user {
	align-self: flex-end;
}

.aia-bubble {
	padding: 10px 12px;
	border-radius: 14px;
	line-height: 1.45;
	font-size: 14px;
	white-space: pre-wrap;
	word-break: break-word;
}

.aia-msg-assistant .aia-bubble {
	background: #fff;
	border: 1px solid #e2e8f0;
}

.aia-msg-user .aia-bubble {
	background: var(--aia-color);
	color: #fff;
}

.aia-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid #e2e8f0;
	background: #fff;
}

.aia-input {
	flex: 1;
	resize: none;
	border: 1px solid #cbd5e1;
	border-radius: 12px;
	padding: 10px 12px;
	font: inherit;
	min-height: 44px;
	max-height: 110px;
}

.aia-input:focus {
	outline: 2px solid color-mix(in srgb, var(--aia-color) 40%, white);
	border-color: var(--aia-color);
}

.aia-send {
	border: 0;
	border-radius: 12px;
	background: var(--aia-color);
	color: #fff;
	padding: 0 14px;
	font-weight: 600;
	cursor: pointer;
}

.aia-send:disabled {
	opacity: 0.6;
	cursor: wait;
}

.aia-typing {
	font-size: 12px;
	color: #64748b;
	padding-left: 4px;
}

/* Telefon (wąski ekran) i telefon poziomo (niski ekran): czat na cały ekran. Tablet zostaje w oknie o ograniczonym rozmiarze. */
@media (max-width: 640px), (max-height: 480px) {
	.aia-floating {
		bottom: 12px;
		right: 12px;
		left: 12px;
		align-items: stretch;
	}

	.aia-floating.aia-bottom-left {
		left: 12px;
		right: 12px;
	}

	.aia-floating .aia-launcher {
		align-self: flex-end;
	}

	.aia-floating.aia-bottom-left .aia-launcher {
		align-self: flex-start;
	}

	.aia-floating.aia-open {
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		gap: 0;
	}

	.aia-floating.aia-open .aia-launcher {
		display: none;
	}

	.aia-floating.aia-open .aia-panel {
		width: 100%;
		max-width: none;
		height: 100vh;
		height: 100dvh;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	.aia-floating.aia-open .aia-header {
		padding-top: calc(14px + env(safe-area-inset-top, 0px));
	}

	.aia-floating.aia-open .aia-form {
		padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	}

	/* 16 px: iOS nie powiększa strony po kliknięciu w pole. */
	.aia-floating.aia-open .aia-input {
		font-size: 16px;
	}

	html.aia-lock,
	html.aia-lock body {
		overflow: hidden;
	}

	.aia-inline .aia-panel {
		width: 100%;
		height: min(88vh, 760px);
	}
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}


.aia-answer-tiles {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin-top: 12px;
}
.aia-answer-tile {
	min-width: 0;
	padding: 8px;
	border: 1px solid rgba(0,0,0,.10);
	border-radius: 10px;
	background: rgba(255,255,255,.72);
}
.aia-answer-tile-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	min-height: 38px;
	padding: 8px 13px;
	border: 0;
	border-radius: 8px;
	background: var(--aia-color);
	color: #fff !important;
	font-weight: 600;
	text-decoration: none !important;
	cursor: pointer;
}
.aia-answer-tile-button:hover,
.aia-answer-tile-button:focus-visible { filter: brightness(.94); }
.aia-answer-tile-button:disabled { opacity: .6; cursor: wait; }

@media (max-width: 420px) { .aia-answer-tiles { grid-template-columns: 1fr; } }

.aia-privacy {
	margin: 0;
	padding: 6px 14px 10px;
	font-size: 11px;
	line-height: 1.4;
	color: #64748b;
	background: #fff;
}
.aia-privacy a {
	color: inherit;
	text-decoration: underline;
}
