[x-cloak] {
	display: none !important;
}

.toast-region {
	position: fixed;
	top: 1.5rem;
	right: 1.5rem;
	z-index: 10000;
	width: min(360px, calc(100vw - 2rem));
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	box-sizing: border-box;
	pointer-events: none;
}

div.toast {
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	width: 100%;
	min-height: 80px;
	padding: 1rem 1rem 0.85rem 1.25rem;
	border-radius: 14px;
	background: #ffffff;
	color: #0f172a;
	font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	box-shadow: 0 10px 25px -3px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
	animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
	pointer-events: auto;
}

.toast-content {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: flex-start;
	gap: 0.75rem;
}

.toast-content p {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr);
	align-items: start;
	gap: 0.5rem;
	min-width: 0;
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.5;
	font-weight: 500;
}

.toast-message {
	display: block;
	min-width: 0;
	overflow-wrap: anywhere;
}

.toast-close {
	width: 28px;
	height: 28px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: #64748b;
	cursor: pointer;
	font-size: 1rem;
	font-weight: 800;
	line-height: 1;
	transition: background 0.2s ease, color 0.2s ease;
}

.toast-close:hover {
	background: #f1f5f9;
	color: #0f172a;
}

/* Success */
div.toast.success {
	border-left: 4px solid #10b981;
}

.toast-status-icon::before {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	font-size: 11px;
	font-weight: 700;
}

div.toast.success .toast-status-icon::before {
	content: '✓';
	background: #d1fae5;
	color: #10b981;
}

/* Error */
div.toast.error {
	border-left: 4px solid #ef4444;
}

div.toast.error .toast-status-icon::before {
	content: '✕';
	background: #fee2e2;
	color: #ef4444;
}

/* Info */
div.toast.info {
	border-left: 4px solid #3b82f6;
}

div.toast.info .toast-status-icon::before {
	content: 'ℹ';
	background: #dbeafe;
	color: #3b82f6;
}

/* Warning */
div.toast.warning {
	border-left: 4px solid #f59e0b;
}

div.toast.warning .toast-status-icon::before {
	content: '!';
	background: #fef3c7;
	color: #f59e0b;
	font-size: 12px;
}

/* Progress */
.progress {
	width: 100%;
	height: 4px;
	background: #f1f5f9;
	border-radius: 2px;
	overflow: hidden;
	margin-top: 12px;
}

.progress-bar {
	height: 100%;
	width: 100%;
	transition: width 0.3s ease;
}

.toast.success .progress-bar {
	background: #10b981;
}

.toast.error .progress-bar {
	background: #ef4444;
}

.toast.info .progress-bar {
	background: #3b82f6;
}

.toast.warning .progress-bar {
	background: #f59e0b;
}

.animate {
	animation: progressDrain linear forwards;
}

@keyframes progressDrain {
	from { width: 100%; }
	to { width: 0%; }
}

@keyframes slideIn {
	from {
		opacity: 0;
		transform: translateX(100%) scale(0.95);
	}
	to {
		opacity: 1;
		transform: translateX(0) scale(1);
	}
}

@media (max-width: 480px) {
	.toast-region {
		top: max(0.75rem, env(safe-area-inset-top));
		bottom: auto;
		right: 0.75rem;
		left: 0.75rem;
		width: auto;
		max-height: calc(100dvh - 1.5rem);
		gap: 0.5rem;
		overflow-y: auto;
	}

	div.toast {
		min-height: 0;
		padding: 0.75rem 0.75rem 0.65rem 0.85rem;
		border-radius: 10px;
		box-shadow: 0 16px 30px -12px rgb(15 23 42 / 0.28), 0 8px 12px -10px rgb(15 23 42 / 0.2);
	}

	.toast-content {
		grid-template-columns: minmax(0, 1fr) 32px;
		align-items: center;
		gap: 0.5rem;
	}

	.toast-content p {
		font-size: 0.88rem;
		line-height: 1.35;
	}

	.toast-close {
		width: 32px;
		height: 32px;
		border-radius: 8px;
	}

	.progress {
		height: 3px;
		margin-top: 0.6rem;
	}

	@keyframes slideIn {
		from {
			opacity: 0;
			transform: translateY(-100%);
		}
		to {
			opacity: 1;
			transform: translateY(0);
		}
	}
}
