/*
 * ept-tabelle.css — stile comune delle tabelle di ameconvienegreen (ept-dati 1.4.0; 1.4.3: bollini a tutta riga sulle schede), dal mockup approvato da Paolo il 25/10
 * (tabelle-green.html). Si carica in tutte le pagine del front-end.
 *
 * Classi (da usare in ogni tool e pagina, compresa la pagina noleggio):
 *   .ept-tab-box   riquadro intorno alla tabella (bordo, angoli arrotondati)
 *   .ept-tab       tabella: testata navy, prima colonna (tbody th) su verde chiaro, righe alterne, linee sottili, numeri tabellari
 *   .ept-tab.schede  forza la tabella a schede anche su schermi larghi (sotto i 640 px lo e sempre)
 *   th/td .num     numero allineato a destra;  .u unita piccola e grigia;  .nota spiegazione sotto, grigia;  .forte grassetto
 *   tr.gruppo > th[colspan]  riga di gruppo (es. il gestore) invece di ripetere il nome in ogni riga
 *   td.meglio      il valore migliore della colonna (calcolato dai dati, mai a mano)
 *   .chip.ok / .chip.neutro / .chip.att  etichette: incluso o a favore / a parte / limite o rischio
 *   .legenda       riga dei bollini sopra una tabella (1.4.2): <div class="legenda"><span class="chip ok">…</span> …</div>
 *   data-col="…"   etichetta della cella nella scheda su telefono (se manca, la mette ept-tabelle.js dalla testata)
 * Tabelle generiche dentro il contenuto (autopilot, vecchie pagine: <table> diretta nel contenuto, blocco tabella di
 * WordPress, .tabelle-responsive): stile di base uguale, senza classi. Le tabelle dei tool annidate in altri elementi e le
 * tabelle fuori dal contenuto non si toccano.
 * Il tema Bricks sotto i 400 px impone «table{width:400px !important}» e «table *{font-size:14px !important}»: qui selettori
 * piu specifici con !important dove serve. Misure in px (il tema ha html{font-size:62.5%}).
 */

.legenda,
.ept-tab-box,
.ept-tab,
.brxe-post-content > table,
.brxe-post-content figure.wp-block-table table,
.brxe-post-content .tabelle-responsive > table,
.entry-content > table,
.entry-content figure.wp-block-table table,
.entry-content .tabelle-responsive > table {
	--ept-navy: #0a3249;
	--ept-verde: #8ab729;
	--ept-verde-scuro: #5e7f1c;
	--ept-fondo: #ffffff;
	--ept-riga: #f7f9f3;
	--ept-linea: #e1e6d8;
	--ept-testo: #2b3238;
	--ept-tenue: #66707a;
	--ept-prima: #f1f5ea;
	--ept-meglio: #e8f3d3;
	--ept-chip-ok: #e8f3d3;
	--ept-chip-ok-t: #3f5a0f;
	--ept-chip-neutro: #eef1f4;
	--ept-chip-neutro-t: #46525c;
	--ept-chip-att: #fdf0d9;
	--ept-chip-att-t: #7a4b00;
	--ept-head: var(--font-heading, "Montserrat"), "Montserrat", system-ui, sans-serif;
	--ept-body: var(--font-body, "Inter"), "Inter", system-ui, sans-serif;
}

/* ---------- riquadro ---------- */
.ept-tab-box,
.brxe-post-content figure.wp-block-table,
.brxe-post-content .tabelle-responsive,
.entry-content figure.wp-block-table,
.entry-content .tabelle-responsive {
	background: #ffffff;
	border: 1px solid #e1e6d8;
	border-radius: 12px;
	overflow-x: auto;
	overflow-y: hidden;
	margin: 0 0 20px;
	max-width: 100%;
}
.brxe-post-content figure.wp-block-table .tabelle-responsive,
.entry-content figure.wp-block-table .tabelle-responsive { border: 0; border-radius: 0; margin: 0; }
/* Il sito avvolge ogni tabella del contenuto in .tabelle-responsive (anche le nostre): dentro .ept-tab-box non e un altro riquadro. */
.ept-tab-box .tabelle-responsive { border: 0; border-radius: 0; margin: 0; background: transparent; overflow: visible; }

/* ---------- tabella ---------- */
.ept-tab,
.brxe-post-content > table:not(.ept-tab),
.brxe-post-content figure.wp-block-table table:not(.ept-tab),
.brxe-post-content .tabelle-responsive > table:not(.ept-tab),
.entry-content > table:not(.ept-tab),
.entry-content figure.wp-block-table table:not(.ept-tab),
.entry-content .tabelle-responsive > table:not(.ept-tab) {
	width: 100% !important;
	max-width: 100%;
	margin: 0;
	border: 0;
	border-collapse: separate;
	border-spacing: 0;
	font-family: var(--ept-body);
	font-size: 14.72px !important;
	line-height: 1.55;
	font-variant-numeric: tabular-nums;
	color: var(--ept-testo);
	overflow: visible;
}
/* La tabella generica diretta nel contenuto non ha un riquadro: bordo e angoli sulla tabella. */
.brxe-post-content > table:not(.ept-tab),
.entry-content > table:not(.ept-tab) {
	border: 1px solid #e1e6d8;
	border-radius: 12px;
	margin: 0 0 20px;
}

.ept-tab thead th,
.brxe-post-content > table:not(.ept-tab) thead th,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) thead th,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) thead th,
.entry-content > table:not(.ept-tab) thead th,
.entry-content figure.wp-block-table table:not(.ept-tab) thead th,
.entry-content .tabelle-responsive > table:not(.ept-tab) thead th {
	background: var(--ept-navy);
	color: #ffffff;
	font-family: var(--ept-head);
	font-weight: 600;
	font-size: 13.12px !important;
	line-height: 1.3;
	text-align: left;
	padding: 12px 14px;
	vertical-align: bottom;
	border: 0;
}
.ept-tab thead th:first-child,
.brxe-post-content > table:not(.ept-tab) thead th:first-child,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) thead th:first-child,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) thead th:first-child,
.entry-content > table:not(.ept-tab) thead th:first-child,
.entry-content figure.wp-block-table table:not(.ept-tab) thead th:first-child,
.entry-content .tabelle-responsive > table:not(.ept-tab) thead th:first-child { border-top-left-radius: 11px; }
.ept-tab thead th:last-child,
.brxe-post-content > table:not(.ept-tab) thead th:last-child,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) thead th:last-child,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) thead th:last-child,
.entry-content > table:not(.ept-tab) thead th:last-child,
.entry-content figure.wp-block-table table:not(.ept-tab) thead th:last-child,
.entry-content .tabelle-responsive > table:not(.ept-tab) thead th:last-child { border-top-right-radius: 11px; }

.ept-tab td,
.ept-tab tbody th,
.brxe-post-content > table:not(.ept-tab) td,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) td,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) td,
.entry-content > table:not(.ept-tab) td,
.entry-content figure.wp-block-table table:not(.ept-tab) td,
.entry-content .tabelle-responsive > table:not(.ept-tab) td {
	padding: 12px 14px;
	border: 0;
	border-top: 1px solid var(--ept-linea);
	vertical-align: top;
	text-align: left;
	font-size: 14.72px !important;
	background: transparent;
}
.ept-tab tbody tr:nth-child(even) td,
.brxe-post-content > table:not(.ept-tab) tbody tr:nth-child(even) td,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody tr:nth-child(even) td,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody tr:nth-child(even) td,
.entry-content > table:not(.ept-tab) tbody tr:nth-child(even) td,
.entry-content figure.wp-block-table table:not(.ept-tab) tbody tr:nth-child(even) td,
.entry-content .tabelle-responsive > table:not(.ept-tab) tbody tr:nth-child(even) td { background: var(--ept-riga); }

/* Prima colonna: il th di riga nelle nostre tabelle, la prima cella nelle tabelle generiche. */
.ept-tab tbody th,
.brxe-post-content > table:not(.ept-tab) tbody td:first-child,
.brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child,
.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child,
.entry-content > table:not(.ept-tab) tbody td:first-child,
.entry-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child,
.entry-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child {
	font-family: var(--ept-head);
	font-weight: 600;
	font-size: 14.4px !important;
	line-height: 1.35;
	color: var(--ept-testo);
	background: var(--ept-prima) !important;
	min-width: 120px;
}
.ept-tab tbody th { width: 16%; }

.ept-tab .num { text-align: right; white-space: nowrap; }
.ept-tab .u { color: var(--ept-tenue); font-size: 0.8em !important; margin-left: 2px; }
.ept-tab .nota { display: block; color: var(--ept-tenue); font-family: var(--ept-body); font-weight: 400; font-size: 13.12px !important; line-height: 1.4; margin-top: 4px; }
.ept-tab .forte { font-weight: 600; }
.ept-tab tr.gruppo th {
	background: transparent !important;
	font-family: var(--ept-body);
	font-weight: 700;
	font-size: 12.8px !important;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ept-verde-scuro);
	padding: 16px 14px 6px;
	border-top: 1px solid var(--ept-linea);
	width: auto;
}
.ept-tab td.meglio { background: var(--ept-meglio) !important; }

/* Legenda dei bollini sopra una tabella (mockup: flex, gap 8 x 14 px, grigio, .82rem = 13,12 px). */
.legenda {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	align-items: center;
	color: #66707a;
	font-size: 13.12px;
}

.ept-tab .chip,
.ept-tab-box .chip,
.legenda .chip {
	display: inline-block;
	font-family: var(--ept-body);
	font-weight: 600;
	font-size: 11.84px !important;
	line-height: 1;
	padding: 5px 8px;
	border-radius: 999px;
	white-space: nowrap;
}
.ept-tab .chip.ok, .ept-tab-box .chip.ok, .legenda .chip.ok { background: var(--ept-chip-ok); color: var(--ept-chip-ok-t); }
.ept-tab .chip.neutro, .ept-tab-box .chip.neutro, .legenda .chip.neutro { background: var(--ept-chip-neutro); color: var(--ept-chip-neutro-t); }
.ept-tab .chip.att, .ept-tab-box .chip.att, .legenda .chip.att { background: var(--ept-chip-att); color: var(--ept-chip-att-t); }

/* ---------- schede (forzate con .schede, sempre sotto i 640 px) ---------- */
.ept-tab.schede thead { display: none; }
.ept-tab.schede, .ept-tab.schede tbody, .ept-tab.schede tr, .ept-tab.schede td, .ept-tab.schede tbody th { display: block; width: auto !important; }
.ept-tab.schede tr { border: 1px solid var(--ept-linea); border-radius: 10px; background: var(--ept-fondo); margin: 0 0 10px; overflow: hidden; }
.ept-tab.schede tbody tr:nth-child(even) td { background: transparent; }
.ept-tab.schede tbody th { background: var(--ept-navy) !important; color: #ffffff; border-top: 0; padding: 10px 12px; min-width: 0; }
.ept-tab.schede td { border-top: 1px solid var(--ept-linea); padding: 9px 12px; display: grid; grid-template-columns: 42% 1fr; gap: 10px; text-align: left; }
.ept-tab.schede td::before { content: attr(data-col); font-family: var(--ept-body); font-weight: 600; font-size: 11.84px !important; line-height: 1.3; color: var(--ept-tenue); }
.ept-tab.schede td.num { white-space: normal; }
.ept-tab.schede tr.gruppo { border: 0; background: transparent; margin: 14px 0 6px; }
.ept-tab.schede tr.gruppo th { background: transparent !important; color: var(--ept-verde-scuro); padding: 0 2px; }
.ept-tab.schede td.meglio { background: var(--ept-meglio) !important; }
/* Sulle schede un bollino da solo e un elemento della griglia e prende tutta la riga; con una nota finisce in span.ept-v e
   restava compatto. Come nel mockup: tutti a tutta riga (1.4.3). */
.ept-tab.schede td .ept-v > .chip { display: block; }
.ept-v > .chip + .chip { margin-top: 4px; }

@media (max-width: 640px) {
	.ept-tab-box:has(.ept-tab),
	.brxe-post-content figure.wp-block-table,
	.brxe-post-content .tabelle-responsive,
	.entry-content figure.wp-block-table,
	.entry-content .tabelle-responsive { border: 0; background: transparent; overflow: visible; }

	.ept-tab thead,
	.brxe-post-content > table:not(.ept-tab) thead,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) thead,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) thead,
	.entry-content > table:not(.ept-tab) thead,
	.entry-content figure.wp-block-table table:not(.ept-tab) thead,
	.entry-content .tabelle-responsive > table:not(.ept-tab) thead { display: none; }

	.ept-tab, .ept-tab tbody, .ept-tab tr, .ept-tab td, .ept-tab tbody th,
	.brxe-post-content > table:not(.ept-tab), .brxe-post-content > table:not(.ept-tab) tbody, .brxe-post-content > table:not(.ept-tab) tr, .brxe-post-content > table:not(.ept-tab) td,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab), .brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody, .brxe-post-content figure.wp-block-table table:not(.ept-tab) tr, .brxe-post-content figure.wp-block-table table:not(.ept-tab) td,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab), .brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody, .brxe-post-content .tabelle-responsive > table:not(.ept-tab) tr, .brxe-post-content .tabelle-responsive > table:not(.ept-tab) td,
	.entry-content > table:not(.ept-tab), .entry-content > table:not(.ept-tab) tbody, .entry-content > table:not(.ept-tab) tr, .entry-content > table:not(.ept-tab) td,
	.entry-content figure.wp-block-table table:not(.ept-tab), .entry-content figure.wp-block-table table:not(.ept-tab) tbody, .entry-content figure.wp-block-table table:not(.ept-tab) tr, .entry-content figure.wp-block-table table:not(.ept-tab) td,
	.entry-content .tabelle-responsive > table:not(.ept-tab), .entry-content .tabelle-responsive > table:not(.ept-tab) tbody, .entry-content .tabelle-responsive > table:not(.ept-tab) tr, .entry-content .tabelle-responsive > table:not(.ept-tab) td {
		display: block;
		width: auto !important;
	}
	.brxe-post-content > table:not(.ept-tab), .entry-content > table:not(.ept-tab) { border: 0; }

	.ept-tab tr,
	.brxe-post-content > table:not(.ept-tab) tr,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) tr,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tr,
	.entry-content > table:not(.ept-tab) tr,
	.entry-content figure.wp-block-table table:not(.ept-tab) tr,
	.entry-content .tabelle-responsive > table:not(.ept-tab) tr {
		border: 1px solid var(--ept-linea);
		border-radius: 10px;
		background: var(--ept-fondo);
		margin: 0 0 10px;
		overflow: hidden;
	}
	.ept-tab tbody tr:nth-child(even) td,
	.brxe-post-content > table:not(.ept-tab) tbody tr:nth-child(even) td,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody tr:nth-child(even) td,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody tr:nth-child(even) td,
	.entry-content > table:not(.ept-tab) tbody tr:nth-child(even) td,
	.entry-content figure.wp-block-table table:not(.ept-tab) tbody tr:nth-child(even) td,
	.entry-content .tabelle-responsive > table:not(.ept-tab) tbody tr:nth-child(even) td { background: transparent; }

	.ept-tab tbody th,
	.brxe-post-content > table:not(.ept-tab) tbody td:first-child,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child,
	.entry-content > table:not(.ept-tab) tbody td:first-child,
	.entry-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child,
	.entry-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child {
		background: var(--ept-navy) !important;
		color: #ffffff;
		border-top: 0;
		padding: 10px 12px;
		min-width: 0;
		display: block;
	}
	.brxe-post-content > table:not(.ept-tab) tbody td:first-child *,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child *,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child *,
	.entry-content > table:not(.ept-tab) tbody td:first-child *,
	.entry-content figure.wp-block-table table:not(.ept-tab) tbody td:first-child *,
	.entry-content .tabelle-responsive > table:not(.ept-tab) tbody td:first-child * { color: #ffffff; }

	.ept-tab td,
	.brxe-post-content > table:not(.ept-tab) td:not(:first-child),
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) td:not(:first-child),
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) td:not(:first-child),
	.entry-content > table:not(.ept-tab) td:not(:first-child),
	.entry-content figure.wp-block-table table:not(.ept-tab) td:not(:first-child),
	.entry-content .tabelle-responsive > table:not(.ept-tab) td:not(:first-child) {
		border-top: 1px solid var(--ept-linea);
		padding: 9px 12px;
		display: grid;
		grid-template-columns: 42% 1fr;
		gap: 10px;
		text-align: left;
	}
	.ept-tab td::before,
	.brxe-post-content > table:not(.ept-tab) td:not(:first-child)::before,
	.brxe-post-content figure.wp-block-table table:not(.ept-tab) td:not(:first-child)::before,
	.brxe-post-content .tabelle-responsive > table:not(.ept-tab) td:not(:first-child)::before,
	.entry-content > table:not(.ept-tab) td:not(:first-child)::before,
	.entry-content figure.wp-block-table table:not(.ept-tab) td:not(:first-child)::before,
	.entry-content .tabelle-responsive > table:not(.ept-tab) td:not(:first-child)::before {
		content: attr(data-col);
		font-family: var(--ept-body);
		font-weight: 600;
		font-size: 11.84px !important;
		line-height: 1.3;
		color: var(--ept-tenue);
	}
	.ept-tab td.num { white-space: normal; text-align: left; }
	.ept-tab tr.gruppo { border: 0; background: transparent; margin: 14px 0 6px; }
	.ept-tab tr.gruppo th { background: transparent !important; color: var(--ept-verde-scuro); padding: 0 2px; }
	.ept-tab td.meglio { background: var(--ept-meglio) !important; }
	.ept-tab td .ept-v > .chip { display: block; }
}
