#pwc-root {
	--pwc-colore: #2b6cb0;
	--pwc-testo: #1f2933;
	--pwc-bordo: #e3e6ea;
	--pwc-sfondo: #ffffff;
	--pwc-cliente: #eef3f9;

	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
	color: var(--pwc-testo);
}

#pwc-root * {
	box-sizing: border-box;
}

.pwc-bolla {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 0;
	background: var(--pwc-colore);
	color: #fff;
	cursor: pointer;
	box-shadow: 0 6px 20px rgba(15, 30, 50, 0.22);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-left: auto;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.pwc-bolla:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 26px rgba(15, 30, 50, 0.28);
}

.pwc-bolla svg {
	width: 26px;
	height: 26px;
	fill: currentColor;
}

.pwc-aperto .pwc-bolla {
	transform: scale(0.92);
}

/* display:flex vincerebbe sull'attributo hidden: il pannello resterebbe
   sempre aperto e il pulsante di chiusura non avrebbe effetto. */
.pwc-pannello[hidden] {
	display: none;
}

.pwc-pannello {
	width: 370px;
	max-width: calc(100vw - 32px);
	height: 520px;
	max-height: calc(100vh - 120px);
	background: var(--pwc-sfondo);
	border: 1px solid var(--pwc-bordo);
	border-radius: 14px;
	box-shadow: 0 18px 48px rgba(15, 30, 50, 0.2);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	margin-bottom: 12px;
	animation: pwc-entra 0.18s ease;
}

@keyframes pwc-entra {
	from {
		opacity: 0;
		transform: translateY(8px);
	}
}

.pwc-testata {
	background: var(--pwc-colore);
	color: #fff;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-shrink: 0;
}

.pwc-titolo {
	font-weight: 600;
	font-size: 15px;
}

.pwc-sottotitolo {
	font-size: 12px;
	opacity: 0.85;
}

.pwc-chiudi {
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	padding: 4px 6px;
	border-radius: 6px;
	opacity: 0.85;
}

.pwc-chiudi:hover {
	opacity: 1;
	background: rgba(255, 255, 255, 0.15);
}

.pwc-messaggi {
	flex: 1;
	overflow-y: auto;
	padding: 16px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	background: #fafbfc;
}

.pwc-msg {
	display: flex;
}

.pwc-msg-cliente {
	justify-content: flex-end;
}

.pwc-msg-testo {
	max-width: 85%;
	padding: 10px 13px;
	border-radius: 14px;
	white-space: normal;
	word-wrap: break-word;
	overflow-wrap: anywhere;
}

.pwc-msg-assistente .pwc-msg-testo {
	background: #fff;
	border: 1px solid var(--pwc-bordo);
	border-bottom-left-radius: 4px;
}

.pwc-msg-cliente .pwc-msg-testo {
	background: var(--pwc-cliente);
	border-bottom-right-radius: 4px;
}

.pwc-msg-testo a {
	color: var(--pwc-colore);
	text-decoration: underline;
}

.pwc-punti {
	display: inline-flex;
	gap: 4px;
	align-items: center;
	height: 12px;
}

.pwc-punti i {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #9aa5b1;
	animation: pwc-salta 1.1s infinite ease-in-out;
}

.pwc-punti i:nth-child(2) {
	animation-delay: 0.15s;
}

.pwc-punti i:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes pwc-salta {
	0%, 60%, 100% {
		transform: translateY(0);
		opacity: 0.5;
	}
	30% {
		transform: translateY(-4px);
		opacity: 1;
	}
}

.pwc-form {
	display: flex;
	gap: 8px;
	padding: 12px;
	border-top: 1px solid var(--pwc-bordo);
	background: #fff;
	flex-shrink: 0;
	align-items: flex-end;
}

.pwc-campo {
	flex: 1;
	resize: none;
	border: 1px solid var(--pwc-bordo);
	border-radius: 10px;
	padding: 10px 12px;
	font: inherit;
	color: inherit;
	max-height: 120px;
	min-height: 42px;
}

.pwc-campo:focus {
	outline: 2px solid var(--pwc-colore);
	outline-offset: -1px;
	border-color: transparent;
}

.pwc-invia {
	border: 0;
	background: var(--pwc-colore);
	color: #fff;
	border-radius: 10px;
	width: 42px;
	height: 42px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.pwc-invia:disabled {
	opacity: 0.5;
	cursor: default;
}

.pwc-invia svg {
	width: 18px;
	height: 18px;
	fill: currentColor;
}

.pwc-nota {
	font-size: 11px;
	color: #7b8794;
	text-align: center;
	padding: 0 12px 10px;
	background: #fff;
}

@media (max-width: 600px) {
	#pwc-root {
		right: 12px;
		bottom: 12px;
		left: 12px;
	}

	.pwc-bolla {
		margin-left: auto;
	}

	/* A schermo intero, con l'area di chiusura sempre in alto e visibile. */
	.pwc-aperto .pwc-pannello {
		position: fixed;
		inset: 0;
		width: 100%;
		max-width: none;
		height: 100%;
		max-height: none;
		margin: 0;
		border: 0;
		border-radius: 0;
	}

	.pwc-aperto .pwc-bolla {
		display: none;
	}

	.pwc-testata {
		padding-top: max(14px, env(safe-area-inset-top));
	}

	.pwc-chiudi {
		font-size: 28px;
		padding: 6px 10px;
	}

	.pwc-form {
		padding-bottom: max(12px, env(safe-area-inset-bottom));
	}

	.pwc-msg-testo {
		max-width: 92%;
	}
}

.pwc-nota .pwc-contatti {
	display: block;
	margin-top: 4px;
}

.pwc-nota a {
	color: var(--pwc-colore);
	text-decoration: none;
	font-weight: 600;
}

.pwc-nota a:hover {
	text-decoration: underline;
}

.pwc-nota .pwc-orari {
	display: block;
	opacity: 0.8;
}
