/* Albo Pretorio Digitale - stili frontend.
   Tipografia ereditata dal tema; personalizzabile con le variabili qui sotto. */
.albo-wrap {
	--albo-accent: #1f5f99;
	--albo-accent-dark: #174a78;
	--albo-panel: #f2f7f6;
	--albo-panel-border: #2a9d8f;
	--albo-line: #d6dee6;
	--albo-muted: #5b6672;
	--albo-radius: 10px;
	color: inherit;
	line-height: 1.5;
	margin: 1.5em 0;
}
.albo-wrap *,
.albo-wrap *::before,
.albo-wrap *::after { box-sizing: border-box; }

.albo-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0; border: 0;
	overflow: hidden; clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* Opzione larghezza="ampia": esce dalla colonna stretta di alcuni temi a blocchi */
.albo-wide {
	width: min(1180px, calc(100vw - 3rem));
	max-width: none;
	position: relative;
	left: 50%;
	transform: translateX(-50%);
}

/* ---------- Ricerca e filtri ---------- */
.albo-filters {
	background: var(--albo-panel);
	border: 2px solid var(--albo-panel-border);
	border-radius: var(--albo-radius);
	padding: 16px;
	margin: 0 0 18px;
}
.albo-search { display: flex; gap: 8px; }
.albo-search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	padding: 10px 14px;
	border: 1px solid var(--albo-line);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	color: #1a1a1a;
}
.albo-btn-primary {
	padding: 10px 22px;
	border: 0;
	border-radius: 8px;
	background: var(--albo-accent);
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.albo-btn-primary:hover { background: var(--albo-accent-dark); }

.albo-options {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 18px;
	align-items: end;
	margin-top: 14px;
}
.albo-options label {
	display: flex;
	flex-direction: column;
	gap: 4px;
	font-size: .9em;
	font-weight: 600;
}
.albo-options select,
.albo-options input[type="date"] {
	padding: 8px 10px;
	border: 1px solid var(--albo-line);
	border-radius: 8px;
	background: #fff;
	font: inherit;
	font-weight: 400;
	color: #1a1a1a;
	min-width: 9.5em;
}
.albo-reset { align-self: center; font-size: .9em; }

.albo-btn-primary:focus-visible,
.albo-filters input:focus-visible,
.albo-filters select:focus-visible,
.albo-wrap .albo-download:focus-visible,
.albo-pagination a:focus-visible {
	outline: 3px solid #f5a623;
	outline-offset: 2px;
}

.albo-count { margin: 0 0 8px; color: var(--albo-muted); font-size: .95em; }

/* ---------- Tabella ---------- */
.albo-table {
	width: 100%;
	border-collapse: separate;
	border-spacing: 0 6px;
	margin: 0;
}
.albo-table thead th {
	padding: 4px 14px;
	text-align: left;
	font-weight: 600;
	font-size: .9em;
	color: var(--albo-muted);
	border: 0;
	background: transparent;
}
.albo-table td {
	padding: 9px 14px;
	vertical-align: middle;
	border: 0;
	border-top: 1px solid var(--albo-line);
	border-bottom: 1px solid var(--albo-line);
	background: #f8f9fb;
}
.albo-row td {
	background: color-mix(in srgb, var(--albo-cat, #6c757d) 8%, #ffffff);
	border-color: color-mix(in srgb, var(--albo-cat, #6c757d) 22%, #ffffff);
}
.albo-table td:first-child {
	border-left: 4px solid var(--albo-cat, #6c757d);
	border-radius: 10px 0 0 10px;
}
.albo-table td:last-child {
	border-right: 1px solid var(--albo-line);
	border-radius: 0 10px 10px 0;
}

.albo-col-data { width: 7.5em; white-space: nowrap; }
.albo-date { display: block; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.albo-meta { display: block; font-size: .82em; line-height: 1.3; color: var(--albo-muted); font-variant-numeric: tabular-nums; }

.albo-col-oggetto { line-height: 1.35; }
.albo-estremi { font-weight: 700; }
.albo-desc { display: block; margin-top: 2px; font-size: .92em; color: var(--albo-muted); }
.albo-note {
	display: block;
	margin-top: 6px;
	padding: 4px 10px;
	font-size: .88em;
	border-left: 3px solid var(--albo-accent);
	background: rgba(255, 255, 255, .7);
}
.albo-note-annullato { border-left-color: #b3261e; }
.albo-flag {
	display: block;
	width: max-content;
	margin: 0 0 3px;
	padding: 1px 8px;
	border-radius: 4px;
	font-size: .8em;
	font-weight: 700;
}
.albo-flag-annullato { background: #b3261e; color: #fff; }
.albo-flag-scaduto { background: #e3e7eb; color: #3d4650; }
.albo-stato-annullato .albo-oggetto { text-decoration: line-through; text-decoration-thickness: 1px; }

.albo-col-cat { width: 1%; white-space: nowrap; }
.albo-badge {
	display: inline-block;
	white-space: nowrap;
	padding: 2px 12px;
	border-radius: 999px;
	font-size: .85em;
	font-weight: 700;
	line-height: 1.4;
}

.albo-col-dl { width: 1%; white-space: nowrap; text-align: center; }
.albo-wrap .albo-download {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 6px 14px;
	border: 1px solid var(--albo-accent);
	border-radius: 8px;
	background: #fff;
	color: var(--albo-accent);
	font-size: .88em;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}
.albo-wrap .albo-download svg { width: 18px; height: 18px; flex: none; }
.albo-wrap .albo-download:hover,
.albo-wrap .albo-download:focus-visible {
	background: var(--albo-accent);
	color: #fff;
}

/* ---------- Paginazione ---------- */
.albo-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	justify-content: center;
	margin-top: 18px;
}
.albo-pag-info { color: var(--albo-muted); font-size: .92em; }
.albo-pagination ul {
	display: flex;
	gap: 4px;
	align-items: center;
	margin: 0; padding: 0;
	list-style: none;
}
.albo-pagination li { margin: 0; }
.albo-pagination a,
.albo-pag-current {
	display: inline-block;
	min-width: 2.2em;
	padding: 4px 8px;
	text-align: center;
	border-radius: 6px;
	text-decoration: none;
}
.albo-pagination a:hover { background: rgba(31, 95, 153, .1); }
.albo-pag-current { background: var(--albo-accent); color: #fff; font-weight: 700; }
.albo-pag-gap { padding: 0 4px; color: var(--albo-muted); }

/* ---------- Mobile: ogni atto diventa una scheda ---------- */
@media (max-width: 760px) {
	.albo-search { flex-direction: column; }
	.albo-options label,
	.albo-options select,
	.albo-options input[type="date"] { width: 100%; }
	.albo-options label { flex: 1 1 100%; }
	.albo-options label.albo-field-date { flex: 1 1 calc(50% - 9px); }

	.albo-table,
	.albo-table tbody,
	.albo-table tr,
	.albo-table td { display: block; width: 100%; }
	.albo-table thead {
		position: absolute; width: 1px; height: 1px;
		overflow: hidden; clip: rect(0, 0, 0, 0);
	}
	.albo-table tr { margin: 0 0 12px; }
	.albo-table td,
	.albo-table td:first-child,
	.albo-table td:last-child {
		border-radius: 0;
		border: 0;
		border-left: 4px solid var(--albo-cat, #6c757d);
		width: 100%;
		padding: 7px 14px;
	}
	.albo-table tr td:first-child { border-radius: 10px 10px 0 0; }
	.albo-table tr td:last-child { border-radius: 0 0 10px 10px; }
	.albo-col-data,
	.albo-col-cat,
	.albo-col-dl { width: 100%; text-align: left; white-space: normal; }
	.albo-col-data .albo-date,
	.albo-col-data .albo-meta { display: inline; margin-right: 10px; }
	.albo-table td::before {
		content: attr(data-label);
		display: block;
		font-size: .78em;
		font-weight: 600;
		color: var(--albo-muted);
	}
	.albo-badge { white-space: normal; }
}

@media (prefers-reduced-motion: no-preference) {
	.albo-wrap .albo-download, .albo-btn-primary { transition: background-color .15s ease; }
}
