.cevt {
	--cevt-accent: #1d4e89;
	--cevt-accent-ink: #ffffff;
	--cevt-ink: #1c2430;
	--cevt-muted: #4f5b6b;
	--cevt-line: #d3d9e0;
	--cevt-weekend: #f5f7f9;
	--cevt-chip: #e6eef8;
	--cevt-chip-ink: #0f2742;
	color: var(--cevt-ink);
	font-size: 16px;
	line-height: 1.4;
	margin: 1.5em 0;
}
.cevt *, .cevt *::before, .cevt *::after { box-sizing: border-box; }

/* Intestazione */
.cevt-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 12px;
	flex-wrap: wrap;
}
.cevt-title {
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	font-size: 1.5em;
	line-height: 1.2;
	text-align: center;
	text-transform: capitalize;
	color: var(--cevt-ink);
}
.cevt button {
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	margin: 0;
	cursor: pointer;
}
.cevt-nav {
	min-width: 44px;
	min-height: 44px;
	padding: 6px 14px;
	border: 1px solid var(--cevt-accent);
	border-radius: 4px;
	background: #fff;
	color: var(--cevt-accent);
	font-weight: 600;
	line-height: 1;
}
.cevt-nav:hover { background: var(--cevt-accent); color: var(--cevt-accent-ink); }
.cevt button:focus-visible,
.cevt a:focus-visible {
	outline: 3px solid #f2a900;
	outline-offset: 2px;
}
.cevt-status { min-height: 1.4em; margin: 0 0 8px; color: var(--cevt-muted); text-align: center; }
.cevt-status.is-error { color: #a4161a; font-weight: 600; }
.cevt[aria-busy="true"] .cevt-grid { opacity: .55; }

/* Griglia */
.cevt-grid {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	border: 1px solid var(--cevt-line);
	margin: 0;
	background: #fff;
}
.cevt-grid th {
	padding: 8px 4px;
	background: var(--cevt-accent);
	color: var(--cevt-accent-ink);
	font-weight: 600;
	text-align: center;
	border: 1px solid var(--cevt-accent);
}
.cevt-grid td {
	height: 112px;
	padding: 4px;
	vertical-align: top;
	border: 1px solid var(--cevt-line);
	background: #fff;
	overflow: hidden;
}
.cevt-grid td.cevt-we { background: var(--cevt-weekend); }
.cevt-grid td.cevt-pad { background: #fafbfc; }
.cevt-grid td.cevt-today { box-shadow: inset 0 0 0 2px var(--cevt-accent); }
.cevt-date { display: block; margin-bottom: 3px; font-weight: 700; color: var(--cevt-muted); }
.cevt-today .cevt-date { color: var(--cevt-accent); }
.cevt-wd { display: none; margin-left: .4em; font-weight: 400; text-transform: capitalize; }

/* Eventi */
.cevt-list { list-style: none; margin: 0; padding: 0; }
.cevt-list li { margin: 0 0 3px; padding: 0; list-style: none; }
.cevt-ev {
	display: block;
	width: 100%;
	padding: 3px 5px;
	border: 0;
	border-left: 3px solid var(--cevt-accent);
	border-radius: 2px;
	background: var(--cevt-chip);
	color: var(--cevt-chip-ink);
	text-align: left;
	font-size: .82em;
	line-height: 1.3;
}
.cevt-ev:hover { background: #d4e3f6; }
.cevt-ev-time { display: block; font-weight: 600; }
.cevt-ev-t { display: block; font-weight: 700; overflow-wrap: anywhere; }
.cevt-ev-x { display: block; margin-top: 1px; font-weight: 400; overflow-wrap: anywhere; }
.cevt-ev.is-cont .cevt-ev-t::before { content: "\21AA\00a0"; }

/* Finestra di dettaglio */
.cevt-dialog {
	width: min(92vw, 520px);
	max-height: 85vh;
	padding: 24px;
	border: 0;
	border-radius: 6px;
	background: #fff;
	color: var(--cevt-ink);
	box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
	overflow: auto;
}
.cevt-dialog::backdrop { background: rgba(10, 20, 35, .55); }
.cevt-dialog h3 { margin: 0 0 8px; font-size: 1.3em; line-height: 1.25; color: var(--cevt-ink); }
.cevt-dialog p { margin: 0 0 10px; }
.cevt-dialog .cevt-when { color: var(--cevt-muted); font-weight: 600; }
.cevt-dialog .cevt-body { white-space: pre-line; overflow-wrap: anywhere; }
.cevt-dialog a { color: var(--cevt-accent); text-decoration: underline; }
.cevt-close {
	margin-top: 6px;
	min-height: 44px;
	padding: 8px 18px;
	border: 1px solid var(--cevt-accent);
	border-radius: 4px;
	background: var(--cevt-accent);
	color: var(--cevt-accent-ink);
	font-weight: 600;
}

/* Mobile: vista a elenco */
@media (max-width: 720px) {
	.cevt-grid, .cevt-grid tbody, .cevt-grid tr, .cevt-grid td { display: block; width: auto; }
	.cevt-grid { border: 0; background: transparent; }
	.cevt-grid thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
	}
	.cevt-grid td { height: auto; margin-bottom: 6px; border: 1px solid var(--cevt-line); }
	.cevt-grid td.cevt-empty:not(.cevt-today) { display: none; }
	.cevt-wd { display: inline; }
	.cevt-ev { font-size: .95em; padding: 8px 10px; }
	.cevt-title { font-size: 1.25em; order: -1; flex-basis: 100%; }
	.cevt-nav { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: no-preference) {
	.cevt-grid { transition: opacity .15s ease; }
}
