/* =====================================================================
 * Documenti firmati (11/9): anteprima del documento, riquadro della firma,
 * schede nel profilo e KPI per l'amministrazione.
 * ===================================================================== */

.tbp-firma-doc {
	margin: 26px 0 8px;
	text-align: left;
}

.tbp-firma-doc__title {
	margin: 0 0 6px !important;
	color: #084828 !important;
	font: 800 20px/1.2 Manrope, "DM Sans", sans-serif !important;
	letter-spacing: -0.01em;
	text-transform: none !important;
}

.tbp-firma-doc__intro {
	margin: 0 0 14px !important;
	color: #5d786b !important;
	font-size: 14.5px !important;
	line-height: 1.5 !important;
}

/* Il documento: un foglio che scorre. */
.tbp-firma-doc__paper {
	max-height: 440px;
	overflow-y: auto;
	padding: 22px 20px;
	border: 1px solid #dfe7e2;
	border-radius: 16px;
	background: #fff;
	box-shadow: inset 0 -18px 24px -22px rgba(8, 72, 40, 0.25);
	-webkit-overflow-scrolling: touch;
	/* Arrivati in fondo al foglio il dito deve poter continuare a scorrere la
	   pagina: con «contain» restava intrappolato dentro il contratto (12/9). */
	overscroll-behavior: auto;
}

.tbp-firma-doc [hidden] {
	display: none !important;
}

.tbp-firma-doc__wait {
	margin: 0 !important;
	padding: 18px 4px;
	color: #5d786b !important;
	font-size: 14px !important;
	font-weight: 700;
	text-align: center !important;
}

/* Nel percorso a schermate il titolo lo porta la domanda. */
html body.wcfm-store-setup.tbp-onb-flow .tbp-firma-doc > .tbp-firma-doc__title {
	display: none !important;
}

html body.wcfm-store-setup.tbp-onb-flow .tbp-firma-doc {
	margin-top: 4px;
}

/* Telefono: foglio piu' basso, cosi' il riquadro della firma sta sopra i
 * pulsanti senza scorrere. */
@media (max-width: 849px) {
	html body.wcfm-store-setup.tbp-onb-flow .tbp-firma-doc__paper {
		max-height: min(340px, 38vh);
		padding: 16px;
	}

	html body.wcfm-store-setup.tbp-onb-flow .tbp-firma-doc__pdf {
		margin-top: 8px !important;
	}

	html body.wcfm-store-setup.tbp-onb-flow .tbp-firma {
		margin-top: 12px;
	}

	html body.wcfm-store-setup.tbp-onb-flow .tbp-firma__box {
		height: 172px;
	}
}

.tbp-firma-doc__paper:focus-visible {
	outline: 3px solid rgba(201, 162, 39, 0.4);
	outline-offset: 2px;
}

.tbp-doc {
	color: #123326;
	font: 400 13px/1.55 Manrope, "DM Sans", sans-serif;
}

.tbp-doc p {
	margin: 0 0 9px !important;
	font-size: 13px !important;
	line-height: 1.55 !important;
	color: #123326 !important;
	text-align: left !important;
}

.tbp-doc__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 12px;
	padding: 0 0 12px;
	border-bottom: 1.5px solid #c9a227;
}

.tbp-doc__brand img {
	width: 44px;
	height: 44px;
	object-fit: contain;
}

.tbp-doc .tbp-doc__wordmark {
	margin: 0 !important;
	font: 800 19px/1 Oxanium, Manrope, sans-serif !important;
}

.tbp-doc__wordmark span:first-child {
	color: #145e3f;
}

.tbp-doc__wordmark span:last-child {
	color: #d0161a;
}

.tbp-doc .tbp-doc__claim {
	margin: 3px 0 0 !important;
	color: #084828 !important;
	font-size: 10.5px !important;
	line-height: 1.35 !important;
}

.tbp-doc .tbp-doc__title {
	margin: 6px 0 2px !important;
	color: #084828 !important;
	font: 800 17px/1.25 Manrope, sans-serif !important;
}

.tbp-doc .tbp-doc__subtitle {
	margin: 0 0 2px !important;
	color: #5d786b !important;
	font-weight: 800 !important;
}

.tbp-doc .tbp-doc__meta {
	color: #5d786b !important;
	font-size: 11px !important;
}

.tbp-doc .tbp-doc__h {
	margin: 14px 0 4px !important;
	color: #084828 !important;
	font-weight: 800 !important;
}

.tbp-doc__list {
	margin: 0 0 9px 0 !important;
	padding: 0 0 0 18px !important;
	list-style: none !important;
}

.tbp-doc__list li {
	position: relative;
	margin: 0 0 5px !important;
	font-size: 13px;
	line-height: 1.5;
}

.tbp-doc__list li::before {
	content: "";
	position: absolute;
	top: 0.6em;
	left: -13px;
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: #c9a227;
}

.tbp-doc__live {
	padding: 0 3px;
	border-radius: 4px;
	background: #fff5cc;
	font-weight: 700;
}

.tbp-doc__live.is-empty {
	color: #a8821c;
}

.tbp-doc__sign {
	margin: 16px 0 0;
	padding: 12px 0 0;
	border-top: 1px dashed #d5ddd8;
}

.tbp-doc__sign-cols {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
}

.tbp-doc__sign-cols div {
	display: flex;
	flex-direction: column;
	gap: 3px;
	font-size: 12px;
}

.tbp-doc__sign-cols strong {
	color: #084828;
}

.tbp-doc__sign-cols em {
	color: #5d786b;
	font-style: italic;
}

.tbp-firma-doc__pdf {
	margin: 10px 0 0 !important;
	font-size: 14px !important;
}

.tbp-firma-doc__pdf a {
	color: #084828 !important;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Il riquadro della firma. */
.tbp-firma {
	margin: 16px 0 0;
}

.tbp-firma__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 0 8px;
}

.tbp-firma__label {
	color: #084828;
	font: 800 15px/1.2 Manrope, sans-serif;
}

html body .tbp-firma button.tbp-firma__clear {
	min-height: 34px !important;
	margin: 0 !important;
	padding: 0 14px !important;
	border: 1.5px solid #d5ddd8 !important;
	border-radius: 999px !important;
	background: #fff !important;
	box-shadow: none !important;
	color: #084828 !important;
	font: 700 13px/1 Manrope, sans-serif !important;
	text-transform: none !important;
	cursor: pointer;
}

.tbp-firma__box {
	position: relative;
	height: 190px;
	border: 2px dashed #c9d2cc;
	border-radius: 18px;
	background: #fff;
	overflow: hidden;
}

.tbp-firma.has-signature .tbp-firma__box {
	border-style: solid;
	border-color: #c9a227;
}

.tbp-firma__pad {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: block;
	width: 100%;
	height: 100%;
	cursor: crosshair;
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

.tbp-firma__hint {
	position: absolute;
	top: 50%;
	left: 0;
	right: 0;
	z-index: 1;
	color: #a9b8af;
	font: 600 14px/1.3 Manrope, sans-serif;
	text-align: center;
	transform: translateY(-50%);
	pointer-events: none;
	transition: opacity 0.2s ease;
}

.tbp-firma.has-signature .tbp-firma__hint,
.tbp-firma.is-drawing .tbp-firma__hint {
	opacity: 0;
}

.tbp-firma__line {
	position: absolute;
	left: 22px;
	right: 22px;
	bottom: 38px;
	z-index: 1;
	height: 1.5px;
	background: #dfe7e2;
	pointer-events: none;
}

.tbp-firma__status {
	min-height: 18px;
	margin: 8px 0 0 !important;
	color: #5d786b !important;
	font-size: 13px !important;
	font-weight: 700;
}

.tbp-firma.is-valid .tbp-firma__status {
	color: #1f7a45 !important;
}

.tbp-firma__note {
	margin: 4px 0 0 !important;
	color: #5D786B !important; /* 23/9: #7d9488 faceva 3,25:1 sul bianco */
	font-size: 12.5px !important;
	line-height: 1.45 !important;
}

/* Documenti firmati nel profilo. */
.tbp-doc-cards {
	margin: 24px 0;
}

.tbp-doc-cards__title {
	margin: 0 0 10px !important;
	color: #084828 !important;
	font: 800 17px/1.2 Manrope, sans-serif !important;
}

.tbp-doc-card {
	display: grid;
	grid-template-columns: 44px minmax(0, 1fr) auto;
	align-items: center;
	gap: 12px;
	margin: 0 0 10px;
	padding: 14px 16px;
	border: 1px solid #dfe7e2;
	border-radius: 16px;
	background: #fff;
	text-align: left;
}

.tbp-doc-card__icon {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	border-radius: 12px;
	background: #eef6f1;
	color: #084828;
}

.tbp-doc-card__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.tbp-doc-card__text strong {
	color: #084828;
	font-size: 15px;
}

.tbp-doc-card__text small {
	color: #5d786b;
	font-size: 12.5px;
	overflow-wrap: anywhere;
}

html body a.tbp-doc-card__btn {
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 0 16px;
	border-radius: 999px;
	background: linear-gradient(135deg, #f0be00 0%, #a8821c 100%);
	color: #fff !important;
	font-weight: 800;
	font-size: 14px;
	text-decoration: none !important;
	white-space: nowrap;
	text-shadow: 0 1px 2px rgb(74 53 0 / 45%);
}

@media (max-width: 560px) {
	.tbp-doc-card {
		grid-template-columns: 40px minmax(0, 1fr);
	}

	html body a.tbp-doc-card__btn {
		grid-column: 1 / -1;
		justify-content: center;
	}
}

/* KPI: contratti firmati ed enti aderenti. */
.tbp-kpi-wcfm {
	margin: 0 0 20px;
	padding: 16px 18px;
	border-radius: 18px;
	background: #fff;
	box-shadow: 0 6px 18px rgba(8, 72, 40, 0.06);
}

.tbp-kpi-wcfm h2 {
	margin: 0 0 12px !important;
	color: #084828 !important;
	font: 800 17px/1.2 Manrope, sans-serif !important;
}

.tbp-kpi-cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 12px;
	margin: 12px 0;
}

.tbp-kpi-card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
	border: 1px solid #dfe7e2;
	border-radius: 16px;
	background: #fbfdfc;
}

.tbp-kpi-card__label {
	color: #5d786b;
	font-size: 13px;
	font-weight: 700;
}

.tbp-kpi-card__value {
	color: #084828;
	font: 800 30px/1 Manrope, sans-serif;
}

.tbp-kpi-card__value small {
	color: #5d786b;
	font-size: 16px;
	font-weight: 700;
}

.tbp-kpi-card__bar {
	display: block;
	height: 8px;
	overflow: hidden;
	border-radius: 999px;
	background: #e6ede8;
}

.tbp-kpi-card__bar span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: linear-gradient(90deg, #c9a227, #e8b400);
}

.tbp-kpi-card__foot {
	color: #5d786b;
	font-size: 12.5px;
}

.tbp-kpi-link {
	margin: 4px 0 0;
	font-weight: 700;
}

/* ------------------------------------------------------------------
 * I documenti firmati come un registro (12/9): una riga per documento,
 * voce a sinistra e valore a destra, il PDF in fondo. Sul telefono si
 * legge in colonna senza tabelle che escono dallo schermo.
 * ------------------------------------------------------------------ */
.tbp-doc-tabella {
	display: grid;
	gap: 12px;
}

.tbp-doc-riga {
	overflow: hidden;
	border: 1px solid #dfe7e2;
	border-radius: 16px;
	background: #fff;
	text-align: left;
}

.tbp-doc-riga__testa {
	display: grid;
	grid-template-columns: 34px minmax(0, 1fr) auto;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid #eef3f0;
	background: #f7faf8;
}

.tbp-doc-riga__icona {
	width: 34px;
	height: 34px;
	object-fit: contain;
}

.tbp-doc-cards .tbp-doc-riga__nome {
	margin: 0 !important;
	color: #084828 !important;
	font: 800 15px/1.25 Manrope, sans-serif !important;
	overflow-wrap: anywhere;
}

.tbp-doc-riga__stato {
	padding: 3px 10px;
	border-radius: 999px;
	background: rgba(31, 122, 69, 0.12);
	color: #1f7a45;
	font-size: 12px;
	font-weight: 800;
	white-space: nowrap;
}

.tbp-doc-riga__dati {
	margin: 0 !important;
	padding: 4px 14px 10px;
}

.tbp-doc-riga__dati > div {
	display: grid;
	grid-template-columns: 92px minmax(0, 1fr);
	gap: 10px;
	padding: 7px 0;
	border-bottom: 1px dashed #eef3f0;
}

.tbp-doc-riga__dati > div:last-child {
	border-bottom: 0;
}

.tbp-doc-cards .tbp-doc-riga__dati dt {
	margin: 0 !important;
	color: #5D786B !important; /* 23/9: #7d9488 faceva 3,25:1 sul bianco */
	font-size: 12.5px !important;
	font-weight: 700 !important;
	line-height: 1.35 !important;
}

.tbp-doc-cards .tbp-doc-riga__dati dd {
	margin: 0 !important;
	color: #123326 !important;
	font-size: 13.5px !important;
	line-height: 1.35 !important;
	overflow-wrap: anywhere;
}

html body a.tbp-doc-riga__btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 0 14px 14px;
	min-height: 44px;
	border: 2px solid var(--tbp-green-dark, #06381f);
	border-radius: 12px;
	background: var(--tbp-cta-gold, linear-gradient(135deg, #f0be00 0%, #a8821c 100%));
	color: var(--tbp-gold-label, #fff) !important;
	font-weight: 800;
	font-size: 14.5px;
	text-decoration: none !important;
	text-shadow: var(--tbp-gold-label-shadow, 0 1px 2px rgba(74, 53, 0, 0.55));
}

@media (min-width: 700px) {
	.tbp-doc-riga__dati > div {
		grid-template-columns: 130px minmax(0, 1fr);
	}

	html body a.tbp-doc-riga__btn {
		justify-self: start;
		width: max-content;
		padding: 0 22px;
	}
}

/* Archivio dei documenti firmati, lato amministrazione (12/9). */
.tbp-doc-archivio__cerca {
	margin: 18px 0 6px;
}

.tbp-doc-archivio__cerca input[type="search"] {
	min-width: 320px;
	max-width: 100%;
}

.tbp-doc-archivio__titolo {
	margin-top: 28px;
	padding-top: 14px;
	border-top: 1px solid #e0e4e2;
}

.tbp-doc-archivio__titolo .count {
	color: #667;
	font-weight: 400;
}

.tbp-doc-archivio table code {
	font-size: 0.82rem;
}

.tbp-doc-archivio table small {
	color: #667;
	line-height: 1.4;
}

/* Navigation only: does not acknowledge terms or complete the signature. */
.tbp-firma-doc .tbp-firma-doc__jump {
	display: inline-flex; align-items: center; min-height: 44px;
	padding: 10px 14px; margin: 0 0 12px; border: 1px solid var(--tbp-night-line, #c4d1c9);
	border-radius: 12px; background: var(--tbp-night-surface, #fff);
	color: var(--tbp-night-text, #084828); font-family: inherit; font-size: 14px; font-weight: 700; line-height: 1.4;
	text-transform: none; letter-spacing: normal; cursor: pointer;
}
.tbp-firma-doc .tbp-firma-doc__jump:focus-visible { outline: 3px solid #b18a17; outline-offset: 3px; }

/* ------------------------------------------------------------------ */
/* Lettore a pulsanti (29/9): il contratto non scorre col dito, con la
 * rotella o col trackpad; si legge con ↑ ↓ e «Vai in fondo» sotto il
 * riquadro (js/tbp-lettore.js). Senza script tutto resta com'era. */
html body [data-tbp-lettore-attivo][data-tbp-lettore-attivo][tabindex] {
	overflow: hidden !important;
	overscroll-behavior: contain !important;
	scrollbar-width: none !important;
	-ms-overflow-style: none;
}

html body [data-tbp-lettore-attivo][data-tbp-lettore-attivo][tabindex]::-webkit-scrollbar {
	display: none !important;
	width: 0 !important;
	height: 0 !important;
}

html body .tbp-lettore {
	display: flex;
	align-items: stretch;
	gap: 8px;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	margin: 10px 0 0;
}

html body .tbp-lettore[hidden] {
	display: none !important;
}

html body .tbp-lettore .tbp-lettore__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	min-width: 56px;
	min-height: 52px;
	margin: 0;
	padding: 0 14px;
	border: 1.5px solid var(--tbp-night-text, #084828);
	border-radius: 14px;
	background: var(--tbp-night-surface, #fff);
	color: var(--tbp-night-text, #084828);
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	touch-action: manipulation;
	transition: background-color 140ms ease, color 140ms ease, opacity 140ms ease, transform 120ms ease;
}

html body .tbp-lettore .tbp-lettore__btn svg {
	flex: 0 0 auto;
	display: block;
}

html body .tbp-lettore .tbp-lettore__btn--fondo {
	flex: 1 1 auto;
	min-width: 0;
	background: #084828;
	border-color: #084828;
	color: #fff;
}

html body .tbp-lettore .tbp-lettore__btn--fondo span {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

@media (hover: hover) {
	html body .tbp-lettore .tbp-lettore__btn--freccia:not(:disabled):hover {
		background: rgba(8, 72, 40, 0.08);
	}

	html body .tbp-lettore .tbp-lettore__btn--fondo:not(:disabled):hover {
		background: #0a5a33;
	}
}

html body .tbp-lettore .tbp-lettore__btn:not(:disabled):active {
	transform: translateY(1px) scale(0.98);
}

html body .tbp-lettore .tbp-lettore__btn:focus-visible {
	outline: 3px solid #b18a17;
	outline-offset: 2px;
}

html body .tbp-lettore .tbp-lettore__btn:disabled,
html body .tbp-lettore .tbp-lettore__btn[aria-disabled="true"] {
	opacity: 0.38;
	cursor: default;
	transform: none;
}

/* In fondo: «Vai in fondo» si spegne e diventa chiaro come le frecce. */
html body .tbp-lettore.is-fondo .tbp-lettore__btn--fondo {
	background: var(--tbp-night-surface, #fff);
	color: var(--tbp-night-text, #084828);
}

@media (prefers-reduced-motion: reduce) {
	html body .tbp-lettore .tbp-lettore__btn {
		transition: none;
	}
}

/* Il vecchio salto in cima al riquadro lascia il posto alla barra sotto. */
html body .tbp-onboarding-terms__jump,
html body .tbp-firma-doc__jump {
	display: none !important;
}

html body .tbp-lettore + .screen-reader-text {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0, 0, 0, 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

/* Nel percorso del profilo la barra resta a portata di pollice: appiccicata
 * al fondo dell'area che scorre, sopra Indietro/Avanti. */
html body.wcfm-store-setup .tbp-lettore {
	position: sticky;
	bottom: 0;
	z-index: 4;
	margin-top: 0;
	padding: 10px 0 8px;
	background: var(--tbp-night-bg, #fff);
}

@media (max-width: 782px) {
	/* Riquadro + barra stanno insieme sullo schermo del telefono. */
	html body.wcfm-store-setup .tbp-onboarding-terms__scroll[data-tbp-lettore-attivo] {
		height: min(50vh, 440px);
		max-height: min(50vh, 440px);
	}
}
