.pavlov-popup {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	width: 560px;
	max-width: calc(100vw - 40px);
	max-height: calc(100vh - 40px);
	overflow-y: auto;
	background: #ffffff;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	color: #222;
	transform: translateY(30px) scale(0.96);
	transform-origin: bottom right;
	opacity: 0;
	pointer-events: none;
	transition: transform 0.35s ease, opacity 0.35s ease;
}

.pavlov-popup.is-visible {
	transform: translateY(0) scale(1);
	opacity: 1;
	pointer-events: auto;
}

/* After closing, the popup shrinks into the bottom-right corner, where the
   round launcher icon takes its place. */
.pavlov-popup.is-minimized {
	transform: scale(0.1);
	opacity: 0;
	visibility: hidden;
	transition: transform 0.35s ease, opacity 0.3s ease, visibility 0s linear 0.35s;
}

.pavlov-popup-launcher {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99998;
	width: 56px;
	height: 56px;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border: none;
	border-radius: 50%;
	background: #f2ae2f;
	color: #ffffff;
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	opacity: 0;
	visibility: hidden;
	transform: scale(0.4);
	pointer-events: none;
	transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.15s ease, visibility 0s linear 0.25s;
}

.pavlov-popup-launcher.is-visible {
	opacity: 1;
	visibility: visible;
	transform: scale(1);
	pointer-events: auto;
	/* Appears once the popup has mostly shrunk away. */
	transition: transform 0.3s ease 0.2s, opacity 0.3s ease 0.2s, background-color 0.15s ease, visibility 0s linear 0s;
}

.pavlov-popup-launcher.is-visible:hover {
	background: #dc9a1e;
	transform: scale(1.06);
	transition: transform 0.15s ease, background-color 0.15s ease;
}

.pavlov-popup-launcher:focus-visible {
	outline: 3px solid #ffffff;
	box-shadow: 0 0 0 6px #f2ae2f, 0 6px 20px rgba(0, 0, 0, 0.25);
}

.pavlov-popup-launcher svg {
	display: block;
}

.pavlov-popup__close {
	position: absolute;
	top: 14px;
	right: 14px;
	width: 34px;
	height: 34px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #ffffff;
	border: 1px solid #ececec;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
	color: #555;
	padding: 0;
	z-index: 10;
}

.pavlov-popup__close:hover {
	color: #111;
	border-color: #ddd;
}

.pavlov-popup__urgent {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	padding: 56px 28px 26px 28px;
}

.pavlov-popup__urgent-icon {
	flex: 0 0 auto;
	display: flex;
	color: #c0392b;
	margin-top: 2px;
}

.pavlov-popup__urgent-body {
	display: flex;
	flex-direction: column;
	gap: 8px;
	min-width: 0;
}

.pavlov-popup__urgent-title {
	font-size: 22px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: #1a1a1a;
}

.pavlov-popup__urgent--important .pavlov-popup__urgent-title {
	color: #a5281c;
}

.pavlov-popup__urgent-text {
	font-size: 16px;
	line-height: 1.6;
	color: #555;
	font-weight: 400;
}

.pavlov-popup__divider {
	border: none;
	border-top: 1px solid #e5e5e5;
	margin: 0;
}

.pavlov-popup__events-section {
	padding: 20px;
}

/* The events section renders right after the close button only when there's
   no urgent message above it - give it room so it clears the button. */
.pavlov-popup__close + .pavlov-popup__events-section {
	padding-top: 56px;
}

.pavlov-popup__events-title {
	margin: 0 0 16px;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.01em;
	color: #1a1a1a;
}

/*
 * Flexbox instead of a fixed-column grid: tiles on each row grow to fill
 * the full width, so 1, 2, 4 or 5 events never leave empty space the way a
 * fixed 3-column grid would (e.g. 4 items = 3 + 1 leftover cell).
 */
.pavlov-popup__events {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.pavlov-popup__event {
	flex: 1 1 150px;
	display: flex;
	flex-direction: column;
	text-decoration: none !important;
	color: inherit;
	overflow: hidden;
	background: #f7f7f7;
	border: 1px solid #ececec;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.pavlov-popup__event:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.pavlov-popup__event-title,
.pavlov-popup__event-date {
	text-decoration: none !important;
}

a.pavlov-popup__event:hover .pavlov-popup__event-title,
a.pavlov-popup__event:hover .pavlov-popup__event-date {
	text-decoration: underline !important;
}

.pavlov-popup__event-thumb {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #e2e2e2;
	overflow: hidden;
}

.pavlov-popup__event-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
}

a.pavlov-popup__event:hover .pavlov-popup__event-thumb img {
	transform: scale(1.06);
}

.pavlov-popup__event-body {
	display: flex;
	flex-direction: column;
	padding: 10px;
	gap: 3px;
	flex: 1;
}

.pavlov-popup__event-title {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
}

.pavlov-popup__event-date {
	font-size: 13px;
	color: #777;
}

/* A single event still uses the same photo-on-top, text-below layout, just
   full width with a wider (less square) photo and roomier text underneath. */
.pavlov-popup__event:only-child .pavlov-popup__event-thumb {
	aspect-ratio: 16 / 9;
}

.pavlov-popup__event:only-child .pavlov-popup__event-body {
	padding: 16px 18px;
}

.pavlov-popup__event:only-child .pavlov-popup__event-title {
	font-size: 19px;
}

@media (max-width: 600px) {
	.pavlov-popup {
		right: 10px;
		left: 10px;
		bottom: 10px;
		width: auto;
		max-width: none;
	}

	.pavlov-popup-launcher {
		right: 12px;
		bottom: 12px;
		width: 50px;
		height: 50px;
	}

	/* Stacked list instead of wrapped tiles: one row per event, small photo
	   left, title + date right - takes up much less vertical space. */
	.pavlov-popup__events {
		flex-direction: column;
		flex-wrap: nowrap;
	}

	.pavlov-popup__event {
		flex: 0 0 auto;
		width: 100%;
		flex-direction: row;
		align-items: center;
	}

	.pavlov-popup__event-thumb,
	.pavlov-popup__event:only-child .pavlov-popup__event-thumb {
		width: 60px;
		height: 60px;
		flex: 0 0 60px;
		aspect-ratio: 1 / 1;
	}

	.pavlov-popup__event-body,
	.pavlov-popup__event:only-child .pavlov-popup__event-body {
		padding: 8px 12px;
		justify-content: center;
	}

	.pavlov-popup__event-title,
	.pavlov-popup__event:only-child .pavlov-popup__event-title {
		font-size: 14px;
	}

	.pavlov-popup__event-date {
		font-size: 12px;
	}
}
