/* Nissolino Gare – usa i colori del tema Leverage (con fallback) */
.ng-home, .ng-cal, .ng-single, .ng-cards {
	--ng-primary: var(--primary-color, #941349);
	--ng-primary-dark: var(--secondary-color, #7a0b40);
	--ng-navy: var(--primary-p-color, #091f34);
	--ng-bg: #ffffff;
	--ng-line: #e6e8ec;
	--ng-muted: #6b7682;
	--ng-ok: #2e8b57;
	font-family: var(--p-font, Poppins, sans-serif);
	color: var(--ng-navy);
	box-sizing: border-box;
}
.ng-home *, .ng-cal *, .ng-single *, .ng-cards * { box-sizing: border-box; }

/* ---------- Anteprima home ---------- */
.ng-home {
	background: var(--ng-navy);
	color: #fff;
	max-width: 520px;
	box-shadow: 0 10px 30px rgba(9, 31, 52, .18);
}
.ng-home__head { display: flex; align-items: stretch; border-bottom: 1px solid rgba(255,255,255,.12); }
.ng-home__icon {
	display: flex; align-items: center; justify-content: center;
	width: 64px; background: var(--ng-primary); color: #fff; flex: 0 0 64px;
}
.ng-home__title { margin: 0; padding: 16px 20px; font-family: var(--h1-font, Gilroy, sans-serif); font-weight: 900; font-size: 1.5rem; line-height: 1.2; }
.ng-home__title a { color: #fff; text-decoration: none; }
.ng-home__list { list-style: none; margin: 0; padding: 0; }
.ng-home__item a {
	display: flex; align-items: stretch; gap: 0; color: #fff; text-decoration: none;
	border-bottom: 1px solid rgba(255,255,255,.08);
	transition: background .15s ease;
}
.ng-home__item a:hover, .ng-home__item a:focus-visible { background: rgba(255,255,255,.06); }
.ng-home__date {
	flex: 0 0 64px; display: flex; flex-direction: column; align-items: center; justify-content: center;
	background: rgba(255,255,255,.06); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; padding: 10px 0;
}
.ng-home__date strong { font-size: 1.25rem; line-height: 1; font-weight: 700; color: #fff; }
.ng-home__text { display: flex; flex-direction: column; justify-content: center; padding: 12px 20px; min-width: 0; }
.ng-home__name { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.ng-home__meta { font-size: .8rem; opacity: .7; margin-top: 2px; }
.ng-home__meta em { font-style: normal; color: #ff8fb3; font-weight: 600; }
.ng-home__item.ng-is-annullata .ng-home__name { text-decoration: line-through; opacity: .7; }
.ng-home__note { margin: 0; padding: 14px 20px; font-size: .9rem; opacity: .8; }
.ng-home__more {
	display: block; padding: 14px 20px 16px 84px; color: #fff; font-weight: 600; text-decoration: none; font-size: .95rem;
}
.ng-home__more:hover { color: #fff; text-decoration: underline; }

/* ---------- Pagina calendario ---------- */
.ng-cal { margin: 0 auto; container-type: inline-size; container-name: ngcal; }
.ng-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 2px solid var(--ng-line); margin-bottom: 20px; }
.ng-tab {
	padding: 12px 22px; font-weight: 600; color: var(--ng-muted); text-decoration: none;
	border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.ng-tab:hover { color: var(--ng-navy); text-decoration: none; }
.ng-tab.is-active { color: var(--ng-primary); border-bottom-color: var(--ng-primary); }

.ng-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.ng-filters label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 600; color: var(--ng-muted); }
.ng-filters select {
	min-width: 140px; height: 42px; padding: 0 10px; border: 1px solid var(--ng-line); border-radius: 2px;
	background: #fff; color: var(--ng-navy); font: inherit; font-size: .95rem;
}
.ng-filters button {
	height: 42px; padding: 0 22px; border: 0; border-radius: 2px; cursor: pointer;
	background: var(--ng-primary); color: #fff; font: inherit; font-weight: 600;
}
.ng-filters button:hover { background: var(--ng-primary-dark); }
.ng-reset { align-self: center; color: var(--ng-muted); font-size: .9rem; }
.ng-hint { font-size: .78rem; color: var(--ng-muted); margin: 6px 0 18px; }

.ng-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ng-table-wrap { width: 100%; overflow-x: auto; }
.ng-table { width: 100%; border-collapse: collapse; background: var(--ng-bg); font-size: .95rem; }
.ng-table th {
	text-align: left; background: var(--ng-navy); color: #fff; font-weight: 600;
	padding: 12px 14px; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em;
}
.ng-table td { padding: 14px 12px; border-bottom: 1px solid var(--ng-line); vertical-align: top; }
.ng-table tbody tr:nth-child(even) td { background: #fafbfc; }
.ng-table tbody tr:hover td { background: #f3f4f7; }
.ng-col-stato { width: 36px; text-align: center; }
.ng-col-data { white-space: nowrap; font-weight: 700; }
.ng-col-gara { min-width: 160px; }
.ng-col-gara a { color: var(--ng-navy); font-weight: 600; text-decoration: none; }
.ng-col-gara a:hover { color: var(--ng-primary); text-decoration: underline; }
.ng-col-link { white-space: nowrap; }
.ng-is-annullata .ng-col-gara a { text-decoration: line-through; color: var(--ng-muted); }

.ng-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--ng-primary); vertical-align: middle; }
.ng-is-conclusa .ng-dot, .ng-dot--conclusa { background: #9aa3ad; }
.ng-is-annullata .ng-dot, .ng-dot--annullata { background: transparent; border: 2px solid #c0392b; }
.ng-dot--programma { background: var(--ng-primary); }

.ng-badge {
	display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 2px;
	background: #fdecea; color: #c0392b; font-size: .72rem; font-weight: 700; text-transform: uppercase;
}
.ng-btn {
	display: inline-block; padding: 6px 14px; border-radius: 2px; background: var(--ng-primary);
	color: #fff !important; font-size: .85rem; font-weight: 600; text-decoration: none !important;
}
.ng-btn:hover { background: var(--ng-primary-dark); }
.ng-btn--ghost { background: transparent; color: var(--ng-primary) !important; border: 1px solid var(--ng-primary); }
.ng-btn--ghost:hover { background: var(--ng-primary); color: #fff !important; }

.ng-legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; font-size: .8rem; color: var(--ng-muted); }
.ng-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.ng-empty { padding: 30px 20px; text-align: center; background: #fff; border: 1px dashed var(--ng-line); color: var(--ng-muted); }

/* Contenitore stretto (mobile o colonna stretta): tabella a schede */
@container ngcal (max-width: 680px) {
	.ng-table { min-width: 0; }
	.ng-table thead { display: none; }
	.ng-table, .ng-table tbody, .ng-table tr, .ng-table td { display: block; width: 100%; }
	.ng-table tr { position: relative; background: #fff; border: 1px solid var(--ng-line); border-left: 4px solid var(--ng-primary); margin-bottom: 12px; padding: 10px 12px; }
	.ng-table tr.ng-is-conclusa { border-left-color: #9aa3ad; }
	.ng-table tr.ng-is-annullata { border-left-color: #c0392b; }
	.ng-table tbody tr:nth-child(even) td, .ng-table tbody tr:hover td { background: transparent; }
	.ng-table td { border: 0; padding: 3px 0; }
	.ng-table td:empty { display: none; }
	.ng-table td[data-label]:not(.ng-col-gara):not(.ng-col-data):not(.ng-col-link)::before {
		content: attr(data-label) ": "; color: var(--ng-muted); font-size: .8rem;
	}
	.ng-col-stato { display: none !important; }
	.ng-col-data { font-size: .85rem; color: var(--ng-primary); }
	.ng-col-gara { font-size: 1rem; }
	.ng-col-link { padding-top: 8px !important; }
	.ng-filters select { min-width: 0; width: 100%; }
	.ng-filters label { flex: 1 1 40%; }
	.ng-tab { padding: 10px 14px; font-size: .9rem; }
}
@media (max-width: 480px) { .ng-home__title { font-size: 1.25rem; } }

/* ---------- Pagina singola gara ---------- */
.ng-single { background: #fff; border-left: 4px solid var(--ng-primary); padding: 18px 22px; margin: 0 0 28px; box-shadow: 0 4px 18px rgba(9,31,52,.08); }
.ng-single.ng-is-conclusa { border-left-color: #9aa3ad; }
.ng-single.ng-is-annullata { border-left-color: #c0392b; }
.ng-single dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 24px; margin: 0; }
.ng-single dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ng-muted); font-weight: 600; margin: 0 0 2px; }
.ng-single dd { margin: 0; font-weight: 600; }
.ng-single__link { margin: 16px 0 0; }

/* ---------- Banner anteprima (solo utenti loggati, sezione non pubblica) ---------- */
.ng-preview {
	margin: 0 0 14px; padding: 10px 14px; background: #fff8e5; border-left: 4px solid #f0b400;
	color: #5a4300; font-size: .85rem; font-family: var(--p-font, Poppins, sans-serif);
}
.ng-preview a { color: #5a4300; font-weight: 600; text-decoration: underline; }

/* ---------- Variante card (sezioni a sfondo scuro) ---------- */
.ng-cards { max-width: 1110px; margin: 0 auto; }
.ng-cards__grid {
	list-style: none; margin: 0; padding: 0;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 340px)); justify-content: center; gap: 30px;
}
.ng-card { margin: 0; }
.ng-card__link {
	display: flex; flex-direction: column; height: 100%; text-decoration: none !important;
	background: #f5f5f5; color: var(--ng-navy);
	box-shadow: 0 6px 20px rgba(0,0,0,.18); transition: transform .15s ease, box-shadow .15s ease;
}
.ng-card__link:hover, .ng-card__link:focus-visible { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
.ng-card__date {
	display: flex; align-items: baseline; gap: 8px; padding: 12px 18px;
	background: var(--ng-primary); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .05em;
}
.ng-card__date strong { font-size: 1.6rem; line-height: 1; font-weight: 700; }
.ng-card__body { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px 18px; flex: 1; }
.ng-card__name { font-weight: 600; font-size: 1rem; line-height: 1.35; color: var(--ng-navy); }
.ng-card__place { font-size: .85rem; color: var(--ng-muted); }
.ng-card__more { margin-top: auto; padding-top: 10px; font-size: .85rem; font-weight: 600; color: var(--ng-primary); }
.ng-card.ng-is-conclusa .ng-card__date { background: #5d6b78; }
.ng-card.ng-is-annullata .ng-card__date { background: #8a8f95; }
.ng-card.ng-is-annullata .ng-card__name { text-decoration: line-through; color: var(--ng-muted); }
.ng-card .ng-badge { align-self: flex-start; margin: auto 0 0; }
.ng-cards__note { color: #fff; opacity: .85; text-align: center; margin: 0 0 16px; }
.ng-cards__all { text-align: center; margin: 28px 0 0; }
.ng-cards__all .ng-btn { padding: 12px 26px; font-size: .95rem; }
