.sfevt-calendar-root {
	max-width: 1050px;
	margin: 20px auto;
	font-family: 'Exo 2', Arial, sans-serif;
	color: #222;
	border: 1px solid #d8d8d8;
	border-radius: 0;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

/* Header */
.sfevt-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	background: #e42313;
}
.sfevt-header h2 { margin: 0; font-size: 1.3em; font-weight: 700; color: #fff; }
.sfevt-header-controls { display: flex; align-items: center; gap: 8px; position: relative; }
.sfevt-nav-btn, .sfevt-today-btn {
	background: rgba(255,255,255,.15);
	color: #fff;
	border: 1px solid rgba(255,255,255,.4);
	border-radius: 5px;
	padding: 7px 14px;
	cursor: pointer;
	font-size: .9em;
	font-weight: 600;
}
.sfevt-nav-btn:hover, .sfevt-today-btn:hover { background: rgba(255,255,255,.3); }
.sfevt-nav-btn:disabled,
.sfevt-nav-btn:disabled:hover {
	background: rgba(255,255,255,.08);
	border-color: rgba(255,255,255,.2);
	color: rgba(255,255,255,.4);
	cursor: default;
}

/* Icon-only "jump to date" button, same look as the other nav buttons. */
.sfevt-goto-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 6px 9px;
}
.sfevt-goto-btn svg { display: block; }
/* The actual date input is native but invisible - the icon button opens it
   via showPicker()/click(), and it never takes up visible space itself. */
.sfevt-goto-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
	border: 0;
	padding: 0;
}

/* Weekday row */
.sfevt-weekdays {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	background: #f7f5f3;
	border-bottom: 1px solid #e0dcd8;
}
.sfevt-daylabel {
	text-align: center;
	font-weight: 700;
	font-size: .78em;
	color: #7a7570;
	padding: 10px 0;
	text-transform: uppercase;
}

/* Grid */
.sfevt-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	background: #e0dcd8;
	gap: 1px;
}
.sfevt-day {
	position: relative;
	min-height: 74px;
	padding: 5px 6px 6px;
	background: #fff;
	display: flex;
	flex-direction: column;
}
.sfevt-day.sfevt-empty { background: #fafafa; }
.sfevt-day.sfevt-has-events { cursor: pointer; }
.sfevt-day.sfevt-has-events:hover { background: #fff8f7; }
.sfevt-day.sfevt-today .sfevt-daynum { background: #e42313; color: #fff; }
.sfevt-day.sfevt-weekend { background: #fcfbfa; }

.sfevt-daynum {
	align-self: flex-start;
	font-weight: 600;
	font-size: .85em;
	color: #444;
	width: 20px;
	height: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	margin-bottom: 3px;
}

.sfevt-chip-list { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.sfevt-chip {
	font-size: .72em;
	font-weight: 600;
	padding: 2px 6px;
	border-radius: 3px;
	border-left: 3px solid #ccc;
	white-space: normal;
	overflow-wrap: break-word;
	word-break: break-word;
	background: #f2f2f2;
	color: #555;
}
/* Colors for upcoming/ongoing chips are set inline per event, driven by
   the event's type color. Finished (past) events always fall back to
   this plain grey - overriding any inline color - but stay fully
   clickable, same as any other day. */
.sfevt-chip.status-finished { background: #ececec !important; color: #777 !important; border-left-color: #aaa !important; }

/* Events happening right now stand out from upcoming/finished ones:
   bigger, bolder, thicker accent border. */
.sfevt-chip.status-ongoing {
	font-size: .8em;
	font-weight: 800;
	padding: 3px 7px;
	border-left-width: 5px;
}

.sfevt-chip-more { font-size: .7em; color: #999; padding-left: 4px; }

/* Legend: one entry per distinct event-type color active in the
   currently-shown month, plus a grey "Завршено" entry if the month
   has any past events. Rebuilt on every render, so it only ever
   lists what's actually on screen. */
.sfevt-legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	padding: 12px 20px;
	border-top: 1px solid #e0dcd8;
	background: #faf9f8;
}
.sfevt-legend-item {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: .8em;
	color: #555;
	font-weight: 600;
}
.sfevt-legend-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	border: 1px solid rgba(0,0,0,.12);
	flex-shrink: 0;
}

/* Modal */
.sfevt-modal-overlay {
	position: fixed; inset: 0; background: rgba(0,0,0,.6);
	display: flex; align-items: center; justify-content: center;
	z-index: 99999; padding: 20px;
	font-family: 'Exo 2', Arial, sans-serif;
	color: #222;
}
.sfevt-modal {
	background: #fff; border-radius: 8px; max-width: 760px; width: 100%;
	max-height: 92vh; overflow-y: auto; position: relative;
}
.sfevt-modal-close {
	position: absolute; top: 10px; right: 14px; background: none; border: none;
	font-size: 1.6em; cursor: pointer; color: #fff; z-index: 2;
	text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.sfevt-modal-event + .sfevt-modal-event { border-top: 4px solid #f2f2f2; }
.sfevt-modal-image { width: 100%; max-height: 480px; height: auto; object-fit: contain; background: #111; display: block; }
.sfevt-gallery-strip { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; background: #111; }
.sfevt-gallery-thumb {
	width: 56px; height: 56px; object-fit: cover; border-radius: 4px;
	cursor: pointer; opacity: .55; flex-shrink: 0; display: block;
}
.sfevt-gallery-thumb:hover { opacity: .85; }
.sfevt-gallery-thumb.active { opacity: 1; outline: 2px solid #fff; outline-offset: -2px; }
.sfevt-modal-body { padding: 16px 20px 20px; }
.sfevt-modal-body h3 { margin: 0 0 6px; color: #e42313; font-size: 1.2em; }

/* Day-list popover: shown first when a day has more than one event,
   so a busy day doesn't dump every event's full detail at once. */
.sfevt-day-list-modal { max-width: 420px; padding: 20px; }
.sfevt-day-list-modal .sfevt-modal-close {
	color: #888; text-shadow: none; top: 12px; right: 12px;
}
.sfevt-day-list-heading { margin: 0 0 12px; padding-right: 24px; color: #222; font-size: 1.1em; }
.sfevt-day-list { display: flex; flex-direction: column; gap: 8px; }
.sfevt-day-list-item {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	width: 100%; text-align: left; background: #f7f6f5; border: none;
	border-left: 4px solid #2f6fce; border-radius: 4px;
	padding: 10px 12px; cursor: pointer; font-family: inherit;
}
.sfevt-day-list-item:hover { background: #efedeb; }
.sfevt-day-list-item.status-finished { border-left-color: #bbb; color: #777; }
.sfevt-day-list-item.status-ongoing { border-left-width: 6px; font-weight: 700; }
.sfevt-day-list-item.status-ongoing .sfevt-day-list-title { font-weight: 800; }
.sfevt-day-list-title { font-weight: 600; }
.sfevt-day-list-status { font-size: .78em; color: #777; white-space: nowrap; }

.sfevt-status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin-bottom: 8px;
}

.sfevt-badge {
	display: inline-block;
	font-size: .72em;
	line-height: 1;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .4px;
	padding: 4px 8px;
	border-radius: 20px;
}
.sfevt-badge.status-upcoming { background: #e3edfb; color: #1a4d99; }
.sfevt-badge.status-ongoing  { background: #e2f5e5; color: #1e7a34; }
.sfevt-badge.status-finished { background: #ececec; color: #777; }

.sfevt-type-list {
	display: inline-flex;
	flex-wrap: wrap;
	gap: 6px;
}
.sfevt-type-pill {
	display: inline-block;
	font-size: .72em;
	line-height: 1;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .4px;
	padding: 4px 8px;
	border-radius: 20px;
}

.sfevt-convivium-badge {
	display: inline-block;
	font-size: .72em;
	line-height: 1;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .4px;
	padding: 4px 8px;
	border-radius: 20px;
	background: #fdeee9;
	color: #b23a1f;
}

.sfevt-modal-meta { font-size: .9em; color: #555; margin-bottom: 10px; line-height: 1.6; }
.sfevt-modal-meta strong { color: #222; }
.sfevt-modal-desc { margin-bottom: 14px; line-height: 1.55; }

.sfevt-rich p { margin: 0 0 10px; }
.sfevt-rich p:last-child,
.sfevt-rich ul:last-child,
.sfevt-rich ol:last-child { margin-bottom: 0; }
.sfevt-rich ul,
.sfevt-rich ol {
	margin: 0 0 10px;
	padding-left: 22px;
}
.sfevt-rich ul { list-style: disc outside; }
.sfevt-rich ol { list-style: decimal outside; }
.sfevt-rich li {
	margin: 0 0 6px;
	padding: 0;
	line-height: 1.5;
}
.sfevt-rich li:last-child { margin-bottom: 0; }
.sfevt-rich li::marker { color: #e42313; }
.sfevt-rich ul ul,
.sfevt-rich ol ol,
.sfevt-rich ul ol,
.sfevt-rich ol ul { margin: 6px 0 0; }
.sfevt-rich strong,
.sfevt-rich b { font-weight: 700; color: #222; }
.sfevt-rich a { color: #e42313; text-decoration: underline; }
.sfevt-rich a:hover { color: #b31b0e; }

.sfevt-reg-box {
	background: #fff8e6;
	border: 1px solid #f0dfa8;
	border-radius: 6px;
	padding: 10px 12px;
	font-size: .87em;
	margin-bottom: 14px;
}
.sfevt-reg-details { margin-top: 6px; }

.sfevt-link-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.sfevt-link-row a {
	display: inline-block; padding: 6px 12px; border-radius: 4px;
	background: #f0f0f0; color: #333; text-decoration: none;
	font-size: .85em; font-weight: 600;
}
.sfevt-link-row a:hover { background: #e42313; color: #fff; }
.sfevt-link-row a.sfevt-article-link { background: #222; color: #fff; }
.sfevt-link-row a.sfevt-article-link:hover { background: #e42313; }

@media (max-width: 700px) {
	.sfevt-day { min-height: 78px; padding: 4px; }
	.sfevt-chip { font-size: .62em; padding: 1px 4px; }
	.sfevt-daynum { width: 18px; height: 18px; font-size: .75em; }
	.sfevt-daylabel { font-size: .68em; padding: 6px 0; }
	.sfevt-header h2 { font-size: 1.05em; }
	.sfevt-modal-body { padding: 14px 16px 18px; }
	.sfevt-modal-desc { font-size: .95em; }
}
@media (max-width: 480px) {
	.sfevt-day { min-height: 56px; }
	.sfevt-chip-list { display: none; }
	.sfevt-modal-overlay { padding: 10px; }
	.sfevt-rich ul,
	.sfevt-rich ol { padding-left: 18px; }
	.sfevt-day.sfevt-has-events::after {
		content: ''; display: block; width: 6px; height: 6px;
		border-radius: 50%; background: #e42313; margin-top: 2px;
	}
}
