.th-toast-stack {
	position: fixed;
	top: max(16px, env(safe-area-inset-top));
	right: max(16px, env(safe-area-inset-right));
	left: auto;
	z-index: 99999;
	display: flex;
	flex-direction: column;
	gap: 12px;
	pointer-events: none;
	max-width: min(420px, calc(100vw - 32px));
	width: 100%;
}

.th-toast {
	pointer-events: auto;
	position: relative;
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: start;
	gap: 12px;
	padding: 14px 14px 14px 16px;
	background: #fff;
	color: #1a2330;
	border-radius: 12px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, .14), 0 2px 6px rgba(0, 0, 0, .08);
	border-left: 4px solid #1d4422;
	font: 500 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	overflow: hidden;
	cursor: pointer;
	opacity: 0;
	transform: translate3d(20px, -8px, 0) scale(.96);
	transition: opacity .25s ease, transform .25s cubic-bezier(.22, 1.2, .36, 1);
}

.th-toast.is-visible {
	opacity: 1;
	transform: translate3d(0, 0, 0) scale(1);
}

.th-toast.is-leaving {
	animation: th-toast-out .22s ease forwards;
}

.th-toast.is-updating {
	animation: th-toast-pulse .35s ease;
}

@keyframes th-toast-pulse {
	0%   { transform: translate3d(0, 0, 0) scale(1); }
	40%  { transform: translate3d(0, 0, 0) scale(1.04); }
	100% { transform: translate3d(0, 0, 0) scale(1); }
}

.th-toast-icon { transition: background-color .25s ease; }
.th-toast { transition: opacity .25s ease, transform .25s cubic-bezier(.22, 1.2, .36, 1), border-left-color .25s ease, color .25s ease; }

@keyframes th-toast-out {
	to {
		opacity: 0;
		transform: translate3d(20px, -8px, 0) scale(.96);
	}
}

.th-toast-icon {
	display: inline-flex;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: #fff;
}

.th-toast-msg {
	min-width: 0;
	word-wrap: break-word;
	hyphens: auto;
	padding: 5px 0;
}

.th-toast-close {
	background: transparent;
	border: 0;
	cursor: pointer;
	font-size: 22px;
	line-height: 1;
	color: #98a2b3;
	padding: 4px 8px;
	margin: -4px -4px 0 0;
	border-radius: 6px;
	font-family: inherit;
	transition: all .15s;
}

.th-toast-close:hover {
	color: #1a2330;
	background: rgba(0, 0, 0, .05);
}

.th-toast-progress {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 3px;
	width: 100%;
	background: currentColor;
	opacity: .35;
	transform-origin: left;
	animation: th-toast-progress linear forwards;
}

@keyframes th-toast-progress {
	from { transform: scaleX(1); }
	to   { transform: scaleX(0); }
}

/* Variante semantice */
.th-toast--success { border-left-color: #1d4422; color: #14532d; }
.th-toast--success .th-toast-icon { background: #1d4422; }
.th-toast--success .th-toast-progress { color: #1d4422; }

.th-toast--error { border-left-color: #dc2626; color: #7f1d1d; }
.th-toast--error .th-toast-icon { background: #dc2626; }
.th-toast--error .th-toast-progress { color: #dc2626; }

.th-toast--warning { border-left-color: #d97706; color: #78350f; }
.th-toast--warning .th-toast-icon { background: #d97706; }
.th-toast--warning .th-toast-progress { color: #d97706; }

.th-toast--info { border-left-color: #1d76d8; color: #1e3a8a; }
.th-toast--info .th-toast-icon { background: #1d76d8; }
.th-toast--info .th-toast-progress { color: #1d76d8; }

/* Mobile */
@media (max-width: 640px) {
	.th-toast-stack {
		top: max(12px, env(safe-area-inset-top));
		right: 12px;
		left: 12px;
		max-width: none;
	}
	.th-toast {
		padding: 12px 12px 12px 14px;
		font-size: 13px;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.th-toast,
	.th-toast.is-leaving,
	.th-toast-progress {
		transition: none !important;
		animation: none !important;
	}
}
