.borey-calendar-page #container {
	width: 1002px;
	max-width: calc(100% - 20px);
}

.borey-calendar-page #content {
	width: auto;
	float: none;
	margin: 0 20px;
}

.borey-calendar-page #sidebar {
	display: none;
}

.borey-calendar-page #container .borey-calendar {
	display: block !important;
	width: auto;
	margin: 18px 20px 32px;
}

.borey-calendar {
	--calendar-border: #dddcd7;
	--calendar-muted: #77756f;
	--calendar-ink: #282b2d;
	--calendar-day: #ffffff;
	--calendar-muted-day: #f0f2f3;
	--calendar-accent: #16b8d4;
	position: relative;
	color: var(--calendar-ink);
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	line-height: 1.45;
}

.borey-calendar *,
.borey-calendar *::before,
.borey-calendar *::after {
	box-sizing: border-box;
}

.borey-calendar button,
.borey-calendar input {
	font: inherit;
}

.borey-calendar__views {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 14px;
}

.borey-calendar__views button {
	padding: 6px 12px;
	border: 1px solid var(--calendar-border);
	border-radius: 0;
	background: var(--calendar-day);
	color: var(--calendar-muted);
	cursor: pointer;
}

.borey-calendar__views button:hover,
.borey-calendar__views button:focus-visible,
.borey-calendar__views button.is-active {
	border-color: var(--calendar-accent);
	background: var(--calendar-accent);
	color: #fff;
	outline: none;
}

.borey-calendar__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	margin-bottom: 14px;
}

.borey-calendar__navigation,
.borey-calendar__tools {
	display: flex;
	align-items: center;
	gap: 8px;
}

.borey-calendar__title {
	min-width: 290px;
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--calendar-ink);
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	text-transform: capitalize;
}

.borey-calendar__nav,
.borey-calendar__today {
	height: 34px;
	border: 1px solid var(--calendar-border);
	border-radius: 0;
	background: #fff;
	color: var(--calendar-ink);
	cursor: pointer;
	transition: background .15s, border-color .15s;
}

.borey-calendar__nav {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	padding: 0;
	border-color: #7b8b93;
	background: #7b8b93;
	color: #fff;
	line-height: 1;
}

.borey-calendar__nav::before {
	content: '';
	width: 8px;
	height: 8px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: rotate(135deg);
}

.borey-calendar__nav[data-calendar-next]::before {
	transform: rotate(-45deg);
}

.borey-calendar__today {
	padding: 0 12px;
}

.borey-calendar__nav:hover,
.borey-calendar__nav:focus-visible {
	border-color: #5f6d74;
	background: #5f6d74;
	color: #fff;
	outline: none;
}

.borey-calendar__today:hover,
.borey-calendar__today:focus-visible {
	border-color: var(--calendar-accent);
	background: var(--calendar-accent);
	color: #fff;
	outline: none;
}

.borey-calendar__tools input,
.borey-calendar__tools select {
	height: 34px;
	padding: 0 7px;
	border: 1px solid var(--calendar-border);
	border-radius: 0;
	background: var(--calendar-day);
	color: var(--calendar-ink);
}

.borey-calendar__tools select {
	width: 112px;
}

.borey-calendar__tools input {
	width: 70px;
}

.borey-calendar__legend {
	display: flex;
	flex-wrap: wrap;
	gap: 5px 14px;
	margin: 0 0 14px;
}

.borey-calendar__legend:empty {
	display: none;
}

.borey-calendar__filter {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 3px 0;
	border: 0;
	border-bottom: 1px solid transparent;
	background: transparent;
	color: var(--calendar-muted);
	cursor: pointer;
}

.borey-calendar__filter:hover,
.borey-calendar__filter:focus-visible,
.borey-calendar__filter.is-active {
	border-bottom-color: currentColor;
	color: var(--calendar-ink);
	outline: none;
}

.borey-calendar__filter.is-muted {
	opacity: .4;
}

.borey-calendar__dot {
	width: 8px;
	height: 8px;
	flex: 0 0 8px;
	border-radius: 50%;
	background: var(--dot-color, #527588);
}

.borey-calendar__grid {
	display: grid;
	grid-template-columns: repeat(var(--calendar-columns, 3), minmax(0, 1fr));
	gap: 18px;
	align-items: start;
}

.borey-calendar__month {
	min-width: 0;
}

.borey-calendar__month-title {
	margin: 0 0 8px;
	padding: 0 0 7px;
	border-bottom: 1px solid var(--calendar-border);
	color: var(--calendar-ink);
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 18px;
	font-weight: 400;
	line-height: 1.2;
	text-align: center;
	text-transform: capitalize;
}

.borey-calendar__weekdays,
.borey-calendar__days {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
}

.borey-calendar__weekdays {
	border: 1px solid var(--calendar-border);
	border-bottom: 0;
	background: var(--calendar-muted-day);
}

.borey-calendar__weekdays span {
	padding: 5px 1px;
	color: var(--calendar-muted);
	font-size: 9px;
	text-align: center;
	text-transform: uppercase;
}

.borey-calendar__days {
	border-top: 1px solid var(--calendar-border);
	border-left: 1px solid var(--calendar-border);
}

.borey-calendar__day {
	position: relative;
	min-width: 0;
	aspect-ratio: 1;
	border-right: 1px solid var(--calendar-border);
	border-bottom: 1px solid var(--calendar-border);
	background: var(--calendar-day);
	transition: background .15s, box-shadow .15s;
}

.borey-calendar__day.is-outside {
	background: var(--calendar-muted-day);
}

.borey-calendar__day.is-outside .borey-calendar__date,
.borey-calendar__day.is-outside .borey-calendar__event {
	opacity: .35;
}

.borey-calendar__day.is-today {
	background: var(--calendar-muted-day);
	box-shadow: inset 0 0 0 1px var(--calendar-accent);
}

.borey-calendar__day.has-events {
	cursor: pointer;
}

.borey-calendar__day.has-events:hover,
.borey-calendar__day.has-events:focus-visible,
.borey-calendar__day.is-open,
.borey-calendar__day.is-event-highlighted {
	background: var(--calendar-muted-day);
	outline: none;
}

.borey-calendar__date {
	position: absolute;
	z-index: 2;
	top: 3px;
	left: 4px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	color: #55534e;
	font-size: 10px;
	line-height: 1;
	pointer-events: none;
}

.borey-calendar__day.is-today .borey-calendar__date {
	background: var(--calendar-accent);
	color: #fff;
	font-weight: 700;
}

.borey-calendar__event {
	position: absolute;
	z-index: 3;
	display: block;
	background: linear-gradient(90deg, var(--event-colors, #527588));
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
	transition: transform .15s, box-shadow .15s, opacity .15s;
}

.borey-calendar__event.is-range {
	right: 0;
	left: 0;
	height: 4px;
}

.borey-calendar__event.is-range:not(.is-continuation) {
	left: 4px;
	border-top-left-radius: 2px;
	border-bottom-left-radius: 2px;
}

.borey-calendar__event.is-range:not(.is-continued) {
	right: 4px;
	border-top-right-radius: 2px;
	border-bottom-right-radius: 2px;
}

.borey-calendar__event.is-single {
	left: 50%;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	transform: translateX(-50%);
}

.borey-calendar__event.is-highlighted {
	z-index: 5;
	box-shadow: 0 0 0 2px #fff, 0 0 0 3px #363a3b;
}

.borey-calendar__event.is-single.is-highlighted {
	transform: translateX(-50%) scale(1.35);
}

.borey-calendar__event.is-range.is-highlighted {
	transform: scaleY(1.6);
}

.borey-calendar__more {
	position: absolute;
	right: 3px;
	bottom: 2px;
	color: var(--calendar-muted);
	font-size: 8px;
	pointer-events: none;
}

.borey-calendar[data-view="year"] .borey-calendar__grid {
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}

.borey-calendar[data-view="year"] .borey-calendar__month-title {
	font-size: 15px;
}

.borey-calendar[data-view="year"] .borey-calendar__date {
	font-size: 9px;
}

.borey-calendar[data-view="heatmap"] .borey-calendar__grid {
	grid-template-columns: minmax(0, 1fr);
}

.borey-calendar__heatmap {
	padding: 18px 0;
	background: var(--calendar-day);
}

.borey-calendar__heatmap-labels {
	position: relative;
	width: 898px;
	height: 22px;
	color: var(--calendar-muted);
	font-size: 10px;
}

.borey-calendar__heatmap-labels span {
	position: absolute;
	left: calc(var(--week) * 17px);
}

.borey-calendar__heatmap-scroll {
	padding: 2px 0 10px;
	overflow-x: auto;
}

.borey-calendar__heatmap-grid {
	display: grid;
	grid-template-rows: repeat(7, 16px);
	grid-auto-flow: column;
	grid-auto-columns: 16px;
	gap: 2px;
	min-width: max-content;
}

.borey-calendar__heat-day {
	position: relative;
	width: 16px;
	height: 16px;
	border-radius: 2px;
	background: var(--calendar-muted-day);
	box-shadow: inset 0 0 0 1px rgba(27, 31, 32, .06);
	transition: opacity .15s;
}

.borey-calendar__heat-day.is-empty {
	visibility: hidden;
}

.borey-calendar__heat-day.has-events {
	cursor: pointer;
	opacity: var(--calendar-map-opacity, 1);
}

/* Полоса события внутри дня: у дня с несколькими событиями их несколько.
   В широкой карте дни одного события сшиваются в непрерывную полосу,
   скруглены только её начало и конец. */
.borey-calendar__heat-lane {
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	display: block;
	height: var(--lane-h, 100%);
}

@media (min-width: 1022px) {
	.borey-calendar__heat-lane.is-start { border-radius: 3px 3px 0 0; }
	.borey-calendar__heat-lane.is-end { border-radius: 0 0 3px 3px; }
	.borey-calendar__heat-lane.is-bridged { height: calc(var(--lane-h, 100%) + 2px); }
	.borey-calendar__heat-lane.is-start.is-end { border-radius: 2px; }
}

/* Вертикальная карта: дни идут вправо, поэтому и торцы, и сшивка — по
   горизонтали (как в широкой карте, только повёрнуто на 90°). */
@media (max-width: 1021px) {
	.borey-calendar__heat-lane.is-start { border-radius: 3px 0 0 3px; }
	.borey-calendar__heat-lane.is-end { border-radius: 0 3px 3px 0; }
	.borey-calendar__heat-lane.is-start.is-end { border-radius: 2px; }
	.borey-calendar__heat-lane.is-bridged { right: -2px; }
}

.borey-calendar__heat-day.level-1 { opacity: calc(var(--calendar-map-opacity, 1) * .5); }
.borey-calendar__heat-day.level-2 { opacity: calc(var(--calendar-map-opacity, 1) * .65); }
.borey-calendar__heat-day.level-3 { opacity: calc(var(--calendar-map-opacity, 1) * .82); }
.borey-calendar__heat-day.level-4 { opacity: var(--calendar-map-opacity, 1); }

.borey-calendar__heat-day.is-today {
	position: relative;
	z-index: 1;
	opacity: 1;
	box-shadow: 0 0 0 2px var(--calendar-ink), inset 0 0 0 1px #fff;
}

.borey-calendar__heat-day.has-events:focus-visible,
.borey-calendar__heat-day.is-open {
	opacity: 1;
	outline: 2px solid var(--calendar-ink);
	outline-offset: 1px;
}

.borey-calendar__heat-day.is-highlighted {
	opacity: 1;
	outline: none;
}

.borey-calendar.is-event-focus .borey-calendar__heat-day.has-events:not(.is-highlighted) {
	opacity: .16;
}

.borey-calendar__heatmap-scale {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	margin-top: 8px;
	color: var(--calendar-muted);
	font-size: 10px;
}

.borey-calendar__heatmap-scale .borey-calendar__heat-day {
	width: 12px;
	height: 12px;
}

.borey-calendar__heatmap-scale .level-1,
.borey-calendar__heatmap-scale .level-2,
.borey-calendar__heatmap-scale .level-3,
.borey-calendar__heatmap-scale .level-4 {
	background: var(--calendar-accent);
}

@media (max-width: 1021px) {
	.borey-calendar__heatmap {
		padding: 14px 10px;
	}

	.borey-calendar__heatmap-scroll {
		display: flex;
		align-items: stretch;
		justify-content: center;
		gap: 8px;
		padding: 2px 0 4px;
		overflow-x: hidden;
	}

	.borey-calendar__heatmap-labels {
		position: relative;
		flex: 0 0 64px;
		width: 64px !important;
		height: auto;
		text-align: right;
	}

	.borey-calendar__heatmap-labels span {
		left: auto;
		right: 0;
		top: calc(var(--week) * 20px);
	}

	.borey-calendar__heatmap-grid {
		width: auto !important;
		min-width: 0;
		grid-template-columns: repeat(7, 18px);
		grid-template-rows: none;
		grid-auto-flow: row;
		grid-auto-rows: 18px;
		gap: 2px;
		justify-content: start;
	}

	.borey-calendar__heatmap-grid .borey-calendar__heat-day {
		width: 18px;
		height: 18px;
		border-radius: 3px;
	}
}

.borey-calendar__status {
	margin: 12px 0 0;
	color: var(--calendar-muted);
	font-size: 11px;
	text-align: center;
}

.borey-calendar__status:empty {
	display: none;
}

.borey-calendar__popover {
	position: fixed;
	z-index: 100000;
	width: 370px;
	max-width: calc(100vw - 20px);
	max-height: min(590px, calc(100vh - 30px));
	padding: 16px;
	overflow-y: auto;
	border: 1px solid #d2d0c9;
	border-radius: 7px;
	background: #fff;
	box-shadow: 0 12px 38px rgba(27, 31, 32, .2);
	color: var(--calendar-ink);
}

.borey-calendar__popover[hidden] {
	display: none;
}

/* Карта года на десктопе: поповер стоит под картой, карточки событий — в ряд. */
.borey-calendar__popover.is-map-below {
	padding: 14px 16px 16px;
}

.borey-calendar__popover.is-map-below .borey-calendar__popover-cards {
	display: flex;
	gap: 18px;
	padding-bottom: 2px;
	overflow-x: auto;
}

.borey-calendar__popover.is-map-below .borey-calendar__card {
	flex: 1 1 250px;
	min-width: 250px;
	padding: 0 0 0 18px;
	border-top: 0;
	border-left: 1px solid #eceae5;
}

.borey-calendar__popover.is-map-below .borey-calendar__card:first-child {
	padding-left: 0;
	border-left: 0;
}

/* Под картой поповер низкий: картинка мельче, анонс — в две строки. */
.borey-calendar__popover.is-map-below .borey-calendar__card {
	grid-template-columns: 64px 1fr;
	gap: 10px;
}

.borey-calendar__popover.is-map-below .borey-calendar__card-image {
	width: 64px;
	height: 64px;
}

.borey-calendar__popover.is-map-below .borey-calendar__card-excerpt {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.borey-calendar__popover-date {
	margin: 0 25px 12px 0;
	color: var(--calendar-muted);
	font-size: 11px;
	letter-spacing: .07em;
	text-transform: uppercase;
}

.borey-calendar__popover-close {
	position: absolute;
	top: 8px;
	right: 9px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #77756f;
	font-size: 22px;
	cursor: pointer;
}

.borey-calendar__card {
	display: grid;
	grid-template-columns: 82px 1fr;
	gap: 12px;
	padding: 12px 0;
	border-top: 1px solid #eceae5;
}

.borey-calendar__card-image {
	display: block;
	visibility: visible !important;
	width: 82px;
	height: 82px;
	border-radius: 4px;
	background: #eeece7;
	object-fit: cover;
}

.borey-calendar__card-category {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 3px;
	margin-bottom: 4px;
	color: var(--calendar-muted);
	font-size: 10px;
}

.borey-calendar__card-category .borey-calendar__dot + .borey-calendar__dot {
	margin-left: -5px;
	box-shadow: 0 0 0 1px #fff;
}

.borey-calendar__card-category .borey-calendar__dot:last-of-type {
	margin-right: 4px;
}

.borey-calendar__card-title {
	display: block;
	margin: 0 0 4px;
	color: var(--calendar-ink);
	font-family: Georgia, 'Times New Roman', serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.25;
	text-decoration: none;
}

.borey-calendar__card-title:hover,
.borey-calendar__card-title:focus-visible {
	color: var(--calendar-accent);
	text-decoration: underline;
}

.borey-calendar__card-range {
	margin: 0 0 5px;
	color: var(--calendar-muted);
	font-size: 10px;
}

.borey-calendar__card-excerpt {
	grid-column: 1 / -1;
	margin: -2px 0 0;
	color: #66645f;
	font-size: 12px;
	line-height: 1.45;
}

.borey-calendar__card-link {
	grid-column: 1 / -1;
	justify-self: end;
	display: inline-block;
	padding: 7px 14px;
	border-radius: 0;
	background: var(--calendar-accent);
	color: #fff;
	font-size: 11px;
	letter-spacing: .02em;
	text-decoration: none;
	transition: background .15s, opacity .15s;
}

.borey-calendar__card-link:hover,
.borey-calendar__card-link:focus-visible {
	background: var(--calendar-ink);
	color: #fff;
	text-decoration: none;
}

@media (max-width: 1050px) {
	.borey-calendar__grid,
	.borey-calendar[data-view="year"] .borey-calendar__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 1002px) {
	.borey-calendar-page #container {
		width: calc(100% - 20px);
	}
}

@media (max-width: 739px) {
	.borey-calendar-page #wrapper {
		width: 100%;
	}

	.borey-calendar-page #container {
		width: calc(100% - 20px);
	}

	.borey-calendar-page #container .borey-calendar {
		margin-right: 10px;
		margin-left: 10px;
	}

	.borey-calendar-page #content {
		margin: 0 10px;
	}

	.borey-calendar__toolbar {
		align-items: flex-start;
		flex-direction: column;
	}

	.borey-calendar__navigation {
		width: 100%;
		justify-content: space-between;
	}

	.borey-calendar__title {
		min-width: 0;
		font-size: 20px;
	}

	.borey-calendar__tools {
		width: 100%;
		flex-wrap: wrap;
	}

	.borey-calendar__tools .borey-calendar__today {
		flex: 1 0 100%;
	}

	.borey-calendar__tools input {
		flex: 1;
	}

	.borey-calendar__grid,
	.borey-calendar[data-view="year"] .borey-calendar__grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 22px;
	}

	.borey-calendar__month-title {
		font-size: 17px;
	}

	.borey-calendar__popover {
		top: auto !important;
		right: 10px !important;
		bottom: 10px !important;
		left: 10px !important;
		width: auto;
		max-height: 70vh;
	}
}

@media (max-width: 478px) {
	.borey-calendar__card {
		grid-template-columns: 64px 1fr;
	}

	.borey-calendar__card-image {
		width: 64px;
		height: 64px;
	}
}

/* 14.11.2026: мягкое появление событий — маркеры и закраска дней плавно
   проявляются, когда данные REST пришли (скелет календаря рисуется сразу) */
@keyframes borey-cal-in {
	from { opacity: 0; }
	to { opacity: 1; }
}
@keyframes borey-cal-map-in {
	from { filter: opacity(0); }
	to { filter: opacity(1); }
}
.borey-calendar__event {
	animation: borey-cal-in 0.28s ease-out both;
}
.borey-calendar__heat-day.has-events {
	animation: borey-cal-map-in 0.28s ease-out both;
}
@media (prefers-reduced-motion: reduce) {
	.borey-calendar__event,
	.borey-calendar__heat-day.has-events {
		animation: none;
	}
}

/* 14.11.2026: стрелки навигации — на 1px ближе к центру кнопки
   (влево-стрелка вправо, вправо-стрелка влево) */
.borey-calendar__nav[data-calendar-prev]::before {
	margin-left: 1px;
}
.borey-calendar__nav[data-calendar-next]::before {
	margin-left: -1px;
}
