:root {
	--graphite-shell-main-padding-top: calc(var(--mud-appbar-height, 64px) + 1.25rem);
	--graphite-shell-main-padding-x: 1.25rem;
	--graphite-shell-main-padding-bottom: 1.25rem;
	--graphite-shell-content-padding: 1.25rem;
	--graphite-shell-frame-radius: 0.75rem;
	--graphite-shell-bg: var(--mud-palette-background-gray);
	--graphite-shell-bg-dark: var(--mud-palette-background);
	/* ── Nuovo design per i Gradienti di Sfondo (Più morbidi e immersivi) ── */
	--graphite-auth-bg: radial-gradient(circle at top left, color-mix(in srgb, var(--mud-palette-primary) 12%, transparent) 0%, transparent 35%), radial-gradient(circle at bottom right, color-mix(in srgb, var(--mud-palette-secondary) 10%, transparent) 0%, transparent 30%), linear-gradient(145deg, var(--mud-palette-background) 0%, var(--mud-palette-background-gray) 50%, var(--mud-palette-background) 100%);
	--graphite-auth-bg-dark: radial-gradient(circle at top left, color-mix(in srgb, var(--mud-palette-primary) 15%, transparent) 0%, transparent 35%), radial-gradient(circle at bottom right, color-mix(in srgb, var(--mud-palette-secondary) 12%, transparent) 0%, transparent 30%), linear-gradient(145deg, #11141a 0%, var(--mud-palette-background) 50%, #0d0f13 100%);
	--graphite-auth-panel-width: 31.5rem;
	--graphite-auth-logo-width: 22rem;
	--graphite-auth-card-radius: 1.5rem;
	--graphite-auth-card-padding-y: 2.25rem;
	--graphite-auth-card-padding-x: 2rem;
	--graphite-auth-panel-padding-y: 1.5rem;
	--graphite-auth-panel-padding-x: 1.5rem;
	--graphite-auth-card-bg: rgba(255, 255, 255, 0.45);
	--graphite-auth-card-bg-dark: rgba(26, 32, 44, 0.45);
	--graphite-auth-card-border: rgba(255, 255, 255, 0.6);
	--graphite-auth-card-border-dark: rgba(255, 255, 255, 0.07);
	--graphite-auth-panel-bg: rgba(255, 255, 255, 0.34);
	--graphite-auth-panel-bg-dark: rgba(26, 32, 44, 0.45);
	--graphite-auth-panel-border: rgba(255, 255, 255, 0.5);
	--graphite-auth-panel-border-dark: rgba(255, 255, 255, 0.08);
	--graphite-auth-panel-shadow: 0 4px 30px rgba(15, 23, 42, 0.03), 0 30px 70px rgba(15, 23, 42, 0.08);
	--graphite-auth-panel-shadow-dark: 0 4px 30px rgba(0, 0, 0, 0.2), 0 30px 70px rgba(0, 0, 0, 0.4);
	--graphite-panel-border: var(--mud-palette-lines-default);
	--graphite-panel-bg: var(--mud-palette-surface);
	--graphite-panel-bg-dark: var(--mud-palette-surface);
	--graphite-brand-shadow: 0 12px 30px rgba(10, 37, 77, 0.08);
	--graphite-logo-filter: drop-shadow(0 8px 20px rgba(18, 76, 169, 0.12));
	/* ── Layout standard tokens (gx-*) ── */
	--gx-space-0: 0;
	--gx-space-1: 0.25rem;
	--gx-space-2: 0.5rem;
	--gx-space-3: 0.75rem;
	--gx-space-4: 1rem;
	--gx-space-5: 1.25rem;
	--gx-space-6: 1.5rem;
	--gx-space-8: 2rem;
	--gx-page-header-h: 4.5rem;
	--gx-page-header-h-compact: 3.75rem;
	--gx-filterbar-max-h: clamp(3.5rem, 22vh, 8.5rem);
	--gx-filterbar-chips-h: 2.5rem;
	--gx-filterbar-row-h: 3.25rem;
	--gx-surface-radius: 1rem;
	--gx-surface-border: 1px solid var(--mud-palette-lines-default);
	--gx-surface-bg: var(--mud-palette-surface);
	--gx-table-bounded-sm: clamp(12rem, 28vh, 18rem);
	--gx-table-bounded-md: clamp(14rem, 34vh, 22rem);
	--gx-table-bounded-lg: clamp(18rem, 42vh, 28rem);
}

/* ── Layout standard utilities (gx-*) ── */
.gx-fill {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
}

.gx-fill>* {
	min-width: 0;
}

.gx-fill>.gx-fill-grow,
.gx-fill-grow {
	flex: 1 1 0;
	min-height: 0;
}

/* Pulsanti testuali con un bordo leggero: senza, "Annulla", "Chiudi", "Mese corrente"... sembravano testo
   e non si capiva che fossero cliccabili (soprattutto su telefono, dove non c'e' l'hover). */
/* Esclusi: barra di date/time picker (anno, data, cifre), voci dei menu dell'header, avatar (px-0) e nomi
   cliccabili dentro le tabelle, dove il bordo trasformava testo e menu in riquadri impilati. */
.mud-button-root.mud-button-text:not(.mud-icon-button, .mud-button-year, .mud-button-date, .mud-timepicker-button, .graphite-header-menu-action, .px-0) {
	border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
	padding-inline: 12px;
}

.mud-picker-toolbar .mud-button-root.mud-button-text,
td .mud-button-root.mud-button-text {
	border-color: transparent;
}

/* Anche i pulsanti solo icona nei contenuti (azioni di riga, ⋮ delle card, aggiorna) sembravano decorazioni:
   stessa cornice leggera. Fuori: barra in alto e menu (non stanno nel contenuto), icone dei campi, picker,
   chip, schede, intestazioni e paginazione delle tabelle, titoli dei dialog/pannelli, avvisi. Disattivati senza
   cornice, cosi' non sembrano cliccabili. Le varianti Outlined/Filled hanno gia' la loro e le frecce di
   espansione delle righe/gruppi sono comandi di apertura come quelli dei pannelli. */
.graphite-main-content .mud-icon-button:not(:disabled, .mud-button-outlined, .mud-button-filled, .mud-table-row-expander):not(.mud-input-control *, .mud-picker *, .mud-chip *, .mud-tabs-tabbar *, th *, .mud-table-pagination *, .mud-pagination *, .mud-datagrid-group *, .mud-expand-panel-header *, .mud-dialog-title *, .mud-alert *, .mud-snackbar *) {
	border: 1px solid color-mix(in srgb, currentColor 38%, transparent);
}

/* Schede in sentence case come i pulsanti: il maiuscolo di MudTabs tronca le etichette su telefono */
.mud-tab {
	text-transform: none;
}

/* Catena fill standard per pagine operative con MudTabs */
.graphite-main-content>.mud-tabs,
.gx-fill>.mud-tabs,
.graphite-filter-layout__content>.mud-tabs {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
}

.graphite-main-content>.mud-tabs>.mud-tabs-panels,
.gx-fill>.mud-tabs>.mud-tabs-panels,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
}

.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active,
.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
}

.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid,
.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid {
	display: flex;
	flex-direction: column;
	flex: 1 1 0;
	min-height: 0;
}

.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-container,
.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-container,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-container,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-container,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-container,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-container {
	flex: 1 1 0;
	min-height: 0;
	overflow: auto;
}

.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination,
.graphite-main-content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination,
.gx-fill>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tab-panel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination,
.graphite-filter-layout__content>.mud-tabs>.mud-tabs-panels>.mud-tabpanel.mud-active>.mud-table.mud-data-grid>.mud-table-pagination {
	flex: 0 0 auto;
}

html,
body {
	min-height: 100%;
	margin: 0;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	/* Android: tirando in giù in cima a una lista o a una finestra il browser ricaricava l'app e il modulo in corso andava perso */
	overscroll-behavior-y: none;
}

.graphite-shell {
	min-height: 100dvh;
	height: 100dvh;
	background: var(--graphite-shell-bg);
	overflow: hidden;
}

.graphite-shell.graphite-dark {
	background: var(--graphite-shell-bg-dark);
}

.graphite-appbar {
	backdrop-filter: blur(14px);
	border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* Search dentro AppBar */
.graphite-appbar .graphite-appbar-global-search {
	width: min(44vw, 42rem);
	min-width: 18rem;
	max-width: 42rem;
}

/* Sfondo campo */
.graphite-appbar .graphite-appbar-global-search .mud-input-root {
	background: rgba(255, 255, 255, 0.10) !important;
	border-radius: 0.75rem !important;
	color: white !important;
}

/* Bordo outlined */
.graphite-appbar .graphite-appbar-global-search .mud-input-outlined-border {
	border-color: rgba(255, 255, 255, 0.32) !important;
}

/* Focus */
.graphite-appbar .graphite-appbar-global-search:focus-within .mud-input-outlined-border {
	border-color: rgba(255, 255, 255, 0.82) !important;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14) !important;
}

/* Testo digitato */
.graphite-appbar .graphite-appbar-global-search input {
	color: white !important;
	caret-color: white !important;
}

/* Placeholder */
.graphite-appbar .graphite-appbar-global-search input::placeholder {
	color: rgba(255, 255, 255, 0.70) !important;
	opacity: 1;
}

/* Icone: search, clear, adornment */
.graphite-appbar .graphite-appbar-global-search .mud-input-adornment,
.graphite-appbar .graphite-appbar-global-search .mud-input-adornment .mud-icon-root,
.graphite-appbar .graphite-appbar-global-search .mud-icon-button-root,
.graphite-appbar .graphite-appbar-global-search .mud-icon-root {
	color: rgba(255, 255, 255, 0.82) !important;
}

/* Hover */
.graphite-appbar .graphite-appbar-global-search:hover .mud-input-root {
	background: rgba(255, 255, 255, 0.14) !important;
}

.graphite-appbar .graphite-appbar-global-search:hover .mud-input-outlined-border {
	border-color: rgba(255, 255, 255, 0.50) !important;
}

@media (max-width: 1280px) {
	.graphite-appbar .graphite-appbar-global-search {
		width: min(38vw, 28rem);
		min-width: 14rem;
	}
}

.graphite-appbar .graphite-nav-brand {
	min-height: 0;
	height: 3.25rem;
	width: 20.5rem;
	max-width: min(42vw, 20.5rem);
	padding: 0.45rem 1rem;
	border-radius: 0.9rem;
	background: rgba(255, 255, 255, 0.96);
	border: 1px solid rgba(255, 255, 255, 0.72);
	box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
}

.graphite-dark .graphite-appbar .graphite-nav-brand {
	background: color-mix(in srgb, var(--mud-palette-surface) 92%, transparent);
	border-color: var(--mud-palette-lines-default);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.graphite-appbar .graphite-nav-brand-logo {
	width: 100%;
	max-height: 2.15rem;
	object-fit: contain;
}

.graphite-shell-rail {
	position: fixed;
	top: 0.8rem;
	right: 0.9rem;
	z-index: 1250;
	border-radius: 999px;
	padding: 0.2rem;
	backdrop-filter: blur(14px);
	background: color-mix(in srgb, var(--mud-palette-surface) 88%, transparent);
	border: 1px solid var(--mud-palette-lines-default);
	box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.graphite-shell-rail--inline {
	position: static;
	top: auto;
	right: auto;
	z-index: auto;
	margin-left: auto;
	width: max-content;
	max-width: 100%;
}

.graphite-dark .graphite-shell-rail {
	box-shadow: 0 14px 30px rgba(2, 6, 23, 0.30);
}

.graphite-header-menu-panel {
	min-width: 22rem;
	max-width: 24rem;
}

.graphite-header-menu-action {
	justify-content: flex-start;
	padding: 0.75rem 0.25rem;
	text-transform: none;
}

.graphite-header-menu-action .mud-button-label {
	width: 100%;
}

.graphite-brand-mark {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 9rem;
	height: 2.6rem;
	border-radius: 1rem;
	padding: 0.45rem 0.85rem;
	background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(237, 243, 251, 0.92) 100%);
	box-shadow: var(--graphite-brand-shadow);
}

.graphite-brand-logo {
	width: 100%;
	height: auto;
	filter: var(--graphite-logo-filter);
}

.graphite-nav-brand {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 4.25rem;
	padding: 0.85rem 1rem;
	border-radius: 1.1rem;
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-lines-default);
	box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.graphite-dark .graphite-nav-brand {
	background: var(--mud-palette-surface);
	border-color: var(--mud-palette-lines-default);
	box-shadow: 0 14px 34px rgba(2, 6, 23, 0.24);
}

.graphite-nav-brand-logo {
	display: block;
	width: min(100%, 13rem);
	max-width: 100%;
	height: auto;
	filter: none;
}

.graphite-logo-theme-dark {
	display: none;
}

.graphite-dark .graphite-logo-theme-light {
	display: none;
}

.graphite-dark .graphite-logo-theme-dark {
	display: block;
}

.graphite-drawer-head {
	border-radius: 1rem;
	background: var(--mud-palette-surface);
	border: 1px solid var(--mud-palette-lines-default);
}

.graphite-dark .graphite-drawer-head {
	background: var(--mud-palette-surface);
	border-color: var(--mud-palette-lines-default);
}

.graphite-main {
	padding: var(--graphite-shell-main-padding-top) var(--graphite-shell-main-padding-x) var(--graphite-shell-main-padding-bottom);
	height: 100%;
	max-height: 100dvh;
	overflow: hidden;
	box-sizing: border-box;
	/* colonna: l'avviso in cima («Installa app», «Aggiungi alla schermata Home») toglie spazio al riquadro della pagina
	   invece di spingerlo fuori dallo schermo (su telefono sparivano in fondo «Timbra» e «Invia giornata») */
	display: flex;
	flex-direction: column;
}

.graphite-main > .mud-alert {
	flex: 0 0 auto;
}

.graphite-main-frame {
	min-height: 0;
	flex: 1 1 0;
	height: auto;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--graphite-shell-frame-radius);
	background: var(--graphite-panel-bg);
	border: 1px solid var(--graphite-panel-border);
	box-shadow: none;
}

.graphite-dark .graphite-main-frame {
	background: var(--graphite-panel-bg-dark);
	border-color: var(--mud-palette-lines-default);
	box-shadow: none;
}

.graphite-main-content {
	padding: var(--graphite-shell-content-padding);
	flex: 1 1 auto;
	min-height: 0;
	overflow: auto;
	display: flex;
	flex-direction: column;
	container-type: inline-size;
	container-name: gx-page;
}

.graphite-main-content>* {
	min-width: 0;
}

@container gx-page (max-height: 720px) {
	:root {
		--gx-page-header-h: var(--gx-page-header-h-compact);
		--gx-filterbar-max-h: clamp(3rem, 16vh, 6.5rem);
	}
}

.graphite-responsive-data-view {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.graphite-responsive-data-view--fill {
	flex: 1 1 0;
	min-height: 0;
}

.graphite-responsive-data-view--fill>.mud-table.mud-data-grid {
	flex: 1 1 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.graphite-responsive-data-view--fill>.mud-table.mud-data-grid>.mud-table-container {
	flex: 1 1 0;
	min-height: 0;
	height: auto !important;
}

.graphite-responsive-data-view--fill>.mud-table.mud-data-grid>.mud-table-pagination {
	flex: 0 0 auto;
}

.graphite-grid-height-host {
	width: 100%;
	min-height: 0;
	position: relative;
}

.graphite-grid-height-page {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	min-height: 0;
}

.graphite-grid-height-scope {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	min-height: 0;
}

.graphite-grid-height-host>* {
	min-height: 0;
}

.graphite-responsive-data-view-list {
	padding: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	max-height: calc(100dvh - 20rem);
}

.graphite-responsive-data-view--fill .graphite-responsive-data-view-list {
	max-height: none;
	flex: 1 1 0;
	min-height: 0;
}

@media (max-width: 959.98px) {
	.graphite-responsive-data-view--fill .graphite-responsive-data-view-list {
		flex: none;
		max-height: calc(100dvh - 20rem);
	}
}

.graphite-responsive-data-view-list-item {
	display: block;
	padding: 0;
	margin-bottom: 0.85rem;
}

.graphite-responsive-data-view-mobile-pager {
	position: sticky;
	bottom: 0;
	z-index: 1;
	background: color-mix(in srgb, var(--mud-palette-surface) 94%, transparent);
	backdrop-filter: blur(10px);
}

.graphite-responsive-filter-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.graphite-responsive-filter-trigger-button {
	border: 1px solid var(--mud-palette-lines-default);
	background: color-mix(in srgb, var(--mud-palette-surface) 92%, transparent);
	backdrop-filter: blur(10px);
}

.graphite-responsive-filter-drawer {
	width: var(--mud-drawer-width-right, var(--mud-drawer-width, min(92vw, 24rem))) !important;
	max-width: min(92vw, 24rem);
}

.graphite-shell.graphite-shell-compact-height {
	--graphite-shell-main-padding-top: calc(var(--mud-appbar-height, 64px) + 0.85rem);
	--graphite-shell-main-padding-x: 1rem;
	--graphite-shell-main-padding-bottom: 1rem;
	--graphite-shell-content-padding: 1rem;
	--graphite-shell-frame-radius: 1.05rem;
}

.graphite-shell.graphite-shell-tight-ui {
	--graphite-shell-main-padding-top: 0.65rem;
	--graphite-shell-main-padding-x: 0.65rem;
	--graphite-shell-main-padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px) + 0.65rem);
	--graphite-shell-content-padding: 0.75rem;
	--graphite-shell-frame-radius: 0.7rem;
	--gx-space-3: 0.625rem;
	--gx-space-4: 0.875rem;
	--gx-space-5: 1rem;
	--gx-page-header-h: 3.5rem;
	--gx-filterbar-max-h: clamp(3rem, 18vh, 6rem);
	--gx-filterbar-chips-h: 2.15rem;
}

/* La UI stretta scatta anche su desktop bassi (altezza < 760px): li' c'e' la barra in alto e non quella in basso,
   quindi titolo e azioni finivano sotto la barra e restava una fascia vuota in fondo. */
.graphite-shell.graphite-shell-tight-ui.graphite-shell-with-appbar {
	--graphite-shell-main-padding-top: calc(var(--mud-appbar-height, 64px) + 0.65rem);
	--graphite-shell-main-padding-bottom: 0.65rem;
}

.graphite-shell.graphite-shell-16x10:not(.graphite-shell-compact-height) {
	--graphite-shell-main-padding-top: calc(var(--mud-appbar-height, 64px) + 1rem);
	--graphite-shell-content-padding: 1.15rem;
}

.graphite-shell.graphite-shell-standalone:not(.graphite-shell-compact-width) {
	--graphite-shell-main-padding-x: 0.9rem;
	--graphite-shell-main-padding-bottom: 0.9rem;
	--graphite-shell-content-padding: 0.9rem;
	--graphite-shell-frame-radius: 1rem;
}

.graphite-shell.graphite-shell-standalone.graphite-shell-no-appbar:not(.graphite-shell-compact-width) .mud-drawer {
	top: 0 !important;
	height: 100dvh !important;
}

@media (max-width: 1279px) {
	.graphite-responsive-filter-trigger--desktop-only {
		display: none !important;
	}
}

@media (min-width: 1280px) {
	.graphite-responsive-filter-trigger--mobile-only {
		display: none !important;
	}
}

/* ─────────────────────────────────────────────────────────────────────────
   ── OVERHAUL COMPLETO SEZIONE AUTHENTICATION & LOGIN (GLASSMORPHISM) ──
   ───────────────────────────────────────────────────────────────────────── */

.graphite-auth-shell {
	min-height: 100dvh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--graphite-auth-bg);
	padding: 1rem;
	box-sizing: border-box;
}

.graphite-auth-shell.graphite-dark {
	background: var(--graphite-auth-bg-dark);
}

.graphite-auth-shell .mud-main-content {
	width: 100%;
	min-height: 0;
}

.graphite-auth-grid {
	min-height: calc(100dvh - 10rem);
	align-items: center;
}

/* Layout contenitore master del pannello */
.graphite-auth-panel {
	width: min(100%, var(--graphite-auth-panel-width));
	margin-inline: auto;
	perspective: 1000px;
	padding: var(--graphite-auth-panel-padding-y) var(--graphite-auth-panel-padding-x) !important;
	border-radius: var(--graphite-auth-card-radius) !important;
	background: var(--graphite-auth-panel-bg) !important;
	border: 1px solid var(--graphite-auth-panel-border) !important;
	box-shadow: var(--graphite-auth-panel-shadow) !important;
	backdrop-filter: blur(24px) saturate(120%);
	-webkit-backdrop-filter: blur(24px) saturate(120%);
	overflow: hidden;
	animation: graphite-auth-panel-enter 500ms cubic-bezier(0.16, 1, 0.3, 1);
}

.graphite-dark .graphite-auth-panel {
	background: var(--graphite-auth-panel-bg-dark) !important;
	border-color: var(--graphite-auth-panel-border-dark) !important;
	box-shadow: var(--graphite-auth-panel-shadow-dark) !important;
}

.graphite-auth-layout {
	width: 100%;
}

.graphite-auth-layout__header {
	animation: graphite-auth-fade-up 420ms cubic-bezier(0.16, 1, 0.3, 1) backward;
}

.graphite-auth-layout__content,
.graphite-auth-card-container {
	width: 100%;
}

.graphite-auth-brand {
	display: flex;
	align-items: center;
	justify-content: center;
	width: min(100%, var(--graphite-auth-logo-width));
	margin-inline: auto;
}

.graphite-auth-logo {
	width: 100%;
	height: auto;
}

.graphite-logo-theme-light {
	display: block;
}

.graphite-logo-theme-dark {
	display: none;
}

.graphite-dark .graphite-logo-theme-light {
	display: none;
}

.graphite-dark .graphite-logo-theme-dark {
	display: block;
}

/* Card ad effetto "Vetro Sfumato" (Glassmorphism Premium) */
.graphite-auth-card {
	width: 100%;
	background: var(--graphite-auth-card-bg) !important;
	backdrop-filter: blur(24px) saturate(120%);
	-webkit-backdrop-filter: blur(24px) saturate(120%);
	border: 1px solid var(--graphite-auth-card-border) !important;
	border-radius: var(--graphite-auth-card-radius) !important;
	box-shadow: 0 4px 30px rgba(15, 23, 42, 0.03), 0 30px 70px rgba(15, 23, 42, 0.08) !important;
	animation: graphite-auth-panel-enter 500ms cubic-bezier(0.16, 1, 0.3, 1);
	padding: var(--graphite-auth-card-padding-y) var(--graphite-auth-card-padding-x) !important;
	transition: background 0.3s ease, border-color 0.3s ease;
}

/* Adattamento Dark Mode della Card Vetro */
.graphite-dark .graphite-auth-card {
	background: var(--graphite-auth-card-bg-dark) !important;
	border: 1px solid var(--graphite-auth-card-border-dark) !important;
	box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2), 0 30px 70px rgba(0, 0, 0, 0.4) !important;
}

/* Badge del Logo circolare sopra il form */
.graphite-auth-form__header {
	gap: 0.35rem !important;
}

.graphite-auth-form__title {
	font-weight: 700 !important;
	letter-spacing: 0;
	color: var(--mud-palette-text-primary);
	animation: graphite-auth-fade-up 450ms cubic-bezier(0.16, 1, 0.3, 1) backward;
}

.graphite-auth-form__subtitle {
	max-width: 22rem;
	margin-inline: auto;
	line-height: 1.5;
	animation: graphite-auth-fade-up 500ms cubic-bezier(0.16, 1, 0.3, 1) backward;
}

.graphite-auth-form {
	gap: 1rem;
	animation: graphite-auth-fade-up 550ms cubic-bezier(0.16, 1, 0.3, 1) backward;
}

/* Wrapper dei campi per isolare le transizioni di validazione */
.graphite-form-group {
	display: flex;
	flex-direction: column;
	width: 100%;
}

/* ── Overrides sui MudTextField (Look Moderno & Soft Focus) ── */
.graphite-modern-input .mud-input-outlined-border {
	border-radius: 0.75rem !important;
	border-width: 1.5px !important;
	border-color: color-mix(in srgb, var(--mud-palette-lines-default) 80%, transparent) !important;
	transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.graphite-modern-input:focus-within .mud-input-outlined-border {
	border-color: var(--mud-palette-primary) !important;
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--mud-palette-primary) 14%, transparent) !important;
}

.graphite-modern-input .mud-input-slot {
	padding-top: 13px !important;
	padding-bottom: 13px !important;
}

/* ── Pulsante di Login Call to Action con Glow Effetto ── */
.graphite-auth-cta {
	border-radius: 0.75rem !important;
	font-weight: 600 !important;
	letter-spacing: 0;
	text-transform: none !important;
	padding-top: 0.75rem !important;
	padding-bottom: 0.75rem !important;
	font-size: 1rem !important;
	background: linear-gradient(135deg, var(--mud-palette-primary) 0%, color-mix(in srgb, var(--mud-palette-primary) 88%, black) 100%) !important;
	box-shadow: 0 4px 14px color-mix(in srgb, var(--mud-palette-primary) 35%, transparent) !important;
	transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s ease !important;
	border: none !important;
}

.graphite-auth-cta:hover:not(.mud-disabled) {
	transform: translateY(-1.5px);
	box-shadow: 0 6px 22px color-mix(in srgb, var(--mud-palette-primary) 50%, transparent) !important;
}

.graphite-auth-cta:active:not(.mud-disabled) {
	transform: translateY(0.5px);
	box-shadow: 0 2px 8px color-mix(in srgb, var(--mud-palette-primary) 25%, transparent) !important;
}

.graphite-auth-link {
	font-weight: 500;
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.graphite-auth-link:hover {
	opacity: 0.85;
	text-decoration: none !important;
}

/* Modifiche per componenti interni nativi MudCard rimossi padding spuri */
.graphite-auth-card .mud-card-header,
.graphite-auth-card .mud-card-content {
	padding: 0 !important;
}

/* Allineamento degli alert di errore interni */
.graphite-auth-alert {
	border-radius: 0.65rem !important;
}

.graphite-auth-inline-note {
	padding: 1rem;
	border-radius: 1rem;
	background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
	border: 1px solid color-mix(in srgb, var(--mud-palette-primary) 18%, transparent);
}

/* Messaggi di validazione animati */
.graphite-validation-message {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.8rem;
	font-weight: 500;
	color: var(--mud-palette-error);
	padding-left: 0.25rem;
	animation: graphite-validation-slide 0.2s ease-out;
}

/* ── Animazioni Keyframes ── */
@keyframes graphite-auth-panel-enter {
	from {
		opacity: 0;
		transform: translateY(20px) scale(0.97);
	}

	to {
		opacity: 1;
		transform: translateY(0) scale(1);
	}
}

@keyframes graphite-auth-fade-up {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@keyframes graphite-validation-slide {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Adattamenti Responsive */
@media (max-width: 640px) {
	:root {
		--graphite-auth-logo-width: 18rem;
		--graphite-auth-card-radius: 1.25rem;
		--graphite-auth-card-padding-y: 1.75rem;
		--graphite-auth-card-padding-x: 1.25rem;
		--graphite-auth-panel-padding-y: 1rem;
		--graphite-auth-panel-padding-x: 1rem;
	}

	.graphite-auth-card {
		padding: var(--graphite-auth-card-padding-y) var(--graphite-auth-card-padding-x) !important;
		border-radius: var(--graphite-auth-card-radius) !important;
	}

	.graphite-auth-form__title {
		font-size: 1.75rem !important;
	}
}

@media (max-height: 760px) {
	.graphite-auth-shell {
		align-items: flex-start;
	}

	.graphite-auth-grid {
		min-height: auto;
	}
}

/* Restanti utility invariate */
.graphite-route-loader {
	min-height: calc(100vh - 2rem);
	color: var(--mud-palette-text-secondary);
}

.graphite-route-loader .mud-progress-circular {
	color: var(--mud-palette-primary);
}

.graphite-density-compact .mud-table-root .mud-table-cell,
.graphite-density-compact .mud-simple-table table * tr>td,
.graphite-density-compact .mud-simple-table table * tr>th {
	padding-top: 0.45rem !important;
	padding-bottom: 0.45rem !important;
}

.graphite-density-compact .mud-list-item {
	min-height: 2.25rem;
	padding-top: 0.2rem;
	padding-bottom: 0.2rem;
}

.graphite-density-compact .mud-button-root {
	min-height: 2.1rem;
}

.graphite-density-comfortable .mud-table-root .mud-table-cell,
.graphite-density-comfortable .mud-simple-table table * tr>td,
.graphite-density-comfortable .mud-simple-table table * tr>th {
	padding-top: 0.8rem !important;
	padding-bottom: 0.8rem !important;
}

.graphite-density-comfortable .mud-list-item {
	min-height: 2.75rem;
}

.graphite-text-compact {
	--mud-typography-default-size: 0.875rem;
	--mud-typography-body1-size: 0.9375rem;
	--mud-typography-body2-size: 0.8125rem;
	--mud-typography-button-size: 0.8125rem;
	--mud-typography-subtitle1-size: 0.9375rem;
	--mud-typography-subtitle2-size: 0.8125rem;
	--mud-typography-caption-size: 0.75rem;
	--mud-typography-h6-size: 1rem;
}

.graphite-text-standard {
	--mud-typography-default-size: 0.9375rem;
	--mud-typography-body1-size: 1rem;
	--mud-typography-body2-size: 0.875rem;
	--mud-typography-button-size: 0.875rem;
	--mud-typography-subtitle1-size: 1rem;
	--mud-typography-subtitle2-size: 0.875rem;
	--mud-typography-caption-size: 0.75rem;
	--mud-typography-h6-size: 1.1rem;
}

.graphite-text-comfortable {
	--mud-typography-default-size: 1rem;
	--mud-typography-body1-size: 1.0625rem;
	--mud-typography-body2-size: 0.9375rem;
	--mud-typography-button-size: 0.9375rem;
	--mud-typography-subtitle1-size: 1.0625rem;
	--mud-typography-subtitle2-size: 0.9375rem;
	--mud-typography-caption-size: 0.8125rem;
	--mud-typography-h6-size: 1.18rem;
}

@media (max-width: 959.95px) {
	.graphite-main {
		--graphite-shell-main-padding-top: 0;
		--graphite-shell-main-padding-x: 0;
		--graphite-shell-main-padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
		/* iPhone in orizzontale (viewport-fit=cover): il contenuto resta fuori dalla tacca */
		padding-left: env(safe-area-inset-left, 0px);
		padding-right: env(safe-area-inset-right, 0px);
	}

	.graphite-main-frame {
		border-radius: 0;
		border: 0;
	}

	.graphite-main-content {
		--graphite-shell-content-padding: 0.75rem;
		overflow-x: clip;
	}

	.graphite-mobile-menu-backdrop {
		position: fixed;
		inset: 0;
		z-index: 1290;
		background: rgba(15, 23, 42, 0.42);
		backdrop-filter: blur(4px);
		cursor: pointer;
		animation: graphite-mobile-menu-backdrop-in 140ms ease-out;
	}

	.graphite-mobile-menu-sheet {
		position: fixed;
		inset-inline: 0;
		bottom: 0;
		z-index: 1500;
		display: flex;
		flex-direction: column;
		max-height: min(88dvh, 46rem);
		padding: 0.5rem max(0.85rem, env(safe-area-inset-right, 0px)) calc(0.85rem + env(safe-area-inset-bottom, 0px)) max(0.85rem, env(safe-area-inset-left, 0px));
		border-radius: 1.35rem 1.35rem 0 0;
		background: var(--mud-palette-background);
		box-shadow: 0 -1rem 3rem rgba(15, 23, 42, 0.22);
		overflow: hidden;
		animation: graphite-mobile-menu-sheet-in 180ms cubic-bezier(.2, .8, .2, 1);
	}

	/* Durante la ricerca il pannello tiene l'altezza piena: il campo non salta mentre i risultati si riducono */
	.graphite-mobile-menu-sheet:has(.graphite-mobile-nav--searching) {
		height: min(88dvh, 46rem);
	}

	.graphite-mobile-menu-open .graphite-mobile-bottom-nav {
		pointer-events: none;
	}

	.graphite-mobile-menu-handle {
		align-self: center;
		width: 2.75rem;
		height: 0.28rem;
		margin: 0.1rem 0 0.45rem;
		border-radius: 999px;
		background: color-mix(in srgb, var(--mud-palette-text-secondary), transparent 55%);
	}

	.graphite-mobile-menu-header {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.75rem;
		padding: 0.25rem 0 0.65rem;
		border-bottom: 1px solid color-mix(in srgb, var(--mud-palette-lines-default), transparent 25%);
	}

	.graphite-mobile-menu-content {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 0.25rem;
	}
}

@keyframes graphite-mobile-menu-backdrop-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes graphite-mobile-menu-sheet-in {
	from { transform: translateY(100%); }
	to { transform: translateY(0); }
}

/* Menu del telefono: lista compatta icona + nome + freccia, raggruppata per sezione */
.graphite-mobile-nav {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 0 0.1rem 0.75rem;
}

.graphite-mobile-nav-search {
	position: sticky;
	top: 0;
	z-index: 1;
	padding: 0.65rem 0 0.15rem;
	background: var(--mud-palette-background);
}

.graphite-mobile-nav-section {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
}

.graphite-mobile-nav-section-title {
	padding-inline: 0.85rem;
	color: var(--mud-palette-text-secondary);
	line-height: 1.6;
}

.graphite-mobile-nav-empty {
	padding: 0.5rem 0.85rem;
}

.graphite-mobile-nav-list {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default), transparent 20%);
	border-radius: 0.9rem;
	background: var(--mud-palette-surface);
}

.graphite-mobile-menu-content > .graphite-mobile-nav-list {
	margin-inline: 0.1rem;
}

.graphite-mobile-nav-row {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	width: 100%;
	min-height: 3rem;
	padding: 0.35rem 0.6rem 0.35rem 0.9rem;
	border: 0;
	background: none;
	color: var(--mud-palette-text-primary);
	font: inherit;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
}

.graphite-mobile-nav-row + .graphite-mobile-nav-row {
	border-top: 1px solid color-mix(in srgb, var(--mud-palette-lines-default), transparent 35%);
}

.graphite-mobile-nav-row:hover,
.graphite-mobile-nav-row:focus {
	color: var(--mud-palette-text-primary);
	text-decoration: none;
}

.graphite-mobile-nav-row:active {
	background: color-mix(in srgb, var(--mud-palette-primary), transparent 92%);
}

.graphite-mobile-nav-row:focus-visible {
	outline: 2px solid var(--mud-palette-primary);
	outline-offset: -2px;
}

.graphite-mobile-nav-row--active {
	background: color-mix(in srgb, var(--mud-palette-primary), transparent 88%);
}

.graphite-mobile-nav-row--active .graphite-mobile-nav-row-label {
	color: var(--mud-palette-primary);
	font-weight: 700;
}

.graphite-mobile-nav-row-label {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.95rem;
	line-height: 1.25;
}

.graphite-mobile-nav-row-badge {
	flex: 0 0 auto;
	margin: 0;
}

.graphite-mobile-nav-row-chevron {
	flex: 0 0 auto;
	color: var(--mud-palette-text-secondary);
}

.graphite-mobile-nav-row--danger,
.graphite-mobile-nav-row--danger:hover,
.graphite-mobile-nav-row--danger:focus {
	color: var(--mud-palette-error);
	font-weight: 600;
}

@media (max-height: 940px) {
	.graphite-shell {
		--graphite-shell-main-padding-top: calc(var(--mud-appbar-height, 64px) + 0.8rem);
		--graphite-shell-main-padding-x: 0.95rem;
		--graphite-shell-main-padding-bottom: 0.95rem;
		--graphite-shell-content-padding: 0.95rem;
		--graphite-shell-frame-radius: 1rem;
	}
}

@media (min-aspect-ratio: 16/9) and (max-height: 980px) {
	.graphite-shell {
		--graphite-shell-main-padding-x: 0.9rem;
		--graphite-shell-main-padding-bottom: 0.9rem;
		--graphite-shell-content-padding: 0.9rem;
	}
}

/* ── Caricamenti: spinner unico e blocco durante le operazioni (la barra in cima è GxActivityBar) ── */
.gx-spinner.mud-progress-circular.mud-progress-small {
	width: 1rem;
	height: 1rem;
	flex: 0 0 auto;
}

.mud-button-root .gx-spinner {
	margin-inline-end: 0.5rem;
}

.gx-busy-overlay {
	position: absolute;
	inset: 0;
	z-index: 1200;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: inherit;
	cursor: progress;
}

.gx-busy-overlay--fixed {
	position: fixed;
}

/* l'etichetta compare solo se l'operazione dura più di 400 ms: le azioni veloci non lampeggiano */
.gx-busy-overlay__label {
	/* in pannelli più alti dello schermo resta comunque a vista mentre si scorre */
	position: sticky;
	top: 1rem;
	bottom: 1rem;
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	max-width: calc(100% - 2rem);
	padding: 0.55rem 1rem;
	border: 1px solid var(--mud-palette-lines-default);
	border-radius: 999px;
	background: var(--mud-palette-surface);
	color: var(--mud-palette-text-primary);
	box-shadow: var(--mud-elevation-6);
	font-size: 0.875rem;
	opacity: 0;
	animation: gx-busy-label-in 0.2s ease 0.4s forwards;
}

@keyframes gx-busy-label-in {
	from {
		opacity: 0;
		transform: translateY(0.25rem);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

/* ── r6 Intestazione unica su telefono: titolo H6, niente sottotitoli/contesto, una sola azione icona a destra ── */
@media (max-width: 599.98px) {
	.gx-operational-header {
		padding-bottom: 0.35rem !important;
		margin-bottom: 0.5rem !important;
	}

	.gx-operational-header .gx-operational-header__title {
		flex: 1 1 100% !important;
	}

	.gx-operational-header .gx-operational-header__subtitle,
	.gx-operational-header .gx-operational-header__context,
	.gx-operational-header .gx-operational-header__info {
		display: none !important;
	}

	.gx-operational-header .gx-operational-header__heading {
		font-size: 1.125rem !important;
	}

	/* pagine non ancora migrate (piu' azioni): restano in riga sotto il titolo, scorrevoli */
	.gx-operational-header .gx-operational-header__actions {
		width: 100% !important;
		max-width: 100% !important;
		overflow-x: auto !important;
		overflow-y: hidden !important;
		padding-bottom: 0.1rem;
		scrollbar-width: none;
		justify-content: flex-start !important;
		flex-wrap: nowrap !important;
	}

	.gx-operational-header .gx-operational-header__actions::-webkit-scrollbar {
		display: none;
	}

	.gx-operational-header .gx-operational-header__actions .mud-stack-row {
		flex-wrap: nowrap !important;
	}

	.gx-operational-header .gx-operational-header__actions .mud-button-root {
		flex: 0 0 auto;
		min-height: 2.75rem;
		padding-inline: 0.75rem;
		white-space: nowrap;
	}

	.gx-operational-header .gx-operational-header__actions .mud-button-label {
		font-size: 0.8125rem;
		line-height: 1.1;
	}
}

/* ── Telefono: dialog operativi a schermo intero; conferme e dialog MaxWidth.ExtraSmall restano compatti.
   Vale anche quando l'altezza è poca (telefono in orizzontale, 844×390): un dialog centrato non ci starebbe.
   Solo nella shell mobile: una finestra desktop bassa o ingrandita con lo zoom tiene i dialog normali. ── */
@media (max-width: 599.98px), (max-height: 480px) and (max-width: 959.98px) {
	.mud-dialog-container .mud-dialog:not(.gx-dialog-compact, .mud-dialog-width-xs) {
		width: 100vw;
		max-width: 100vw !important;
		height: 100dvh;
		max-height: 100dvh !important;
		margin: 0;
		border-radius: 0;
		display: flex;
		flex-direction: column;
		/* margini sicuri dell'iPhone (tacca in orizzontale); in basso ci pensano le azioni del dialog */
		padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
		/* il drag non ha senso a schermo intero e su touch sposta il dialog fuori vista */
		transform: none !important;
	}

	.mud-dialog-container .mud-dialog:not(.gx-dialog-compact, .mud-dialog-width-xs) .mud-dialog-content {
		flex: 1 1 auto;
		min-height: 0;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.mud-dialog-container .mud-dialog:not(.gx-dialog-compact, .mud-dialog-width-xs) .mud-dialog-actions {
		padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
		border-top: 1px solid var(--mud-palette-lines-default);
	}

	/* senza piede è il contenuto a restare sopra l'indicatore Home dell'iPhone */
	.mud-dialog-container .mud-dialog:not(.gx-dialog-compact, .mud-dialog-width-xs) .mud-dialog-content:last-child {
		padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
	}

	/* con 3-4 azioni la riga sfora: vanno a capo invece di uscire dallo schermo */
	.mud-dialog-container .mud-dialog .mud-dialog-actions {
		flex-wrap: wrap;
		gap: 0.5rem;
	}

	.mud-dialog-container .mud-dialog .mud-dialog-actions > * {
		margin-left: 0 !important;
	}

	.mud-dialog-container .mud-dialog .mud-dialog-actions > .mud-button-root {
		white-space: nowrap;
	}

	.mud-dialog-container .mud-dialog:is(.gx-dialog-compact, .mud-dialog-width-xs) {
		width: min(444px, calc(100vw - 2rem));
		max-width: min(444px, calc(100vw - 2rem)) !important;
	}
}

/* ── Shell mobile con il timer del timesheet acceso (RunningTimerBar, 56px sopra la bottom nav):
   la pagina lascia spazio in fondo ── */
@media (max-width: 959.98px) {
	.graphite-shell:has(.graphite-running-timer-bar) .graphite-main {
		--graphite-shell-main-padding-bottom: calc(116px + env(safe-area-inset-bottom, 0px));
	}
}

/* ── b17 Shell mobile: gli avvisi (snackbar) compaiono in alto. In basso coprivano per 6-8 secondi i pulsanti delle
   azioni («Invia giornata», «Approva parzialmente», «Annulla/Avvia»), la barra del timer e quella di navigazione.
   Su desktop restano in basso a destra. La X per chiuderli è un bersaglio da 44px. ── */
@media (max-width: 959.98px) {
	.mud-snackbar-location-bottom-right,
	.mud-snackbar-location-bottom-center,
	.mud-snackbar-location-bottom-left {
		/* sotto il banner di connessione, la cui altezza comprende già il margine sicuro in alto */
		top: max(env(safe-area-inset-top, 0px), var(--gx-offline-banner-height, 0px)) !important;
		bottom: auto !important;
	}

	/* tra 600 e 959 l'avviso resta a lato: fuori dalla tacca dell'iPhone in orizzontale */
	.mud-snackbar-location-bottom-right {
		right: max(24px, env(safe-area-inset-right, 0px)) !important;
	}

	.mud-snackbar-location-bottom-left {
		left: max(24px, env(safe-area-inset-left, 0px)) !important;
	}

	.mud-snackbar .mud-snackbar-close-button {
		min-width: 2.75rem;
		min-height: 2.75rem;
		/* l'avviso resta alto come prima */
		margin-block: -0.25rem;
	}

	/* in alto l'avviso sta sopra intestazione, freccia indietro e X dei dialog: i tocchi lo attraversano,
	   resta toccabile solo il suo pulsante di chiusura o di azione */
	.mud-snackbar:not(.gx-snackbar-update) {
		pointer-events: none;
	}

	.mud-snackbar:not(.gx-snackbar-update) :is(.mud-snackbar-close-button, .mud-snackbar-action-button) {
		pointer-events: auto;
	}

	/* «Nuova versione disponibile» resta finché non si tocca (MainLayout): in alto coprirebbe l'intestazione per
	   tutto il tempo, quindi sta in basso, sopra la barra di navigazione e quella del timer */
	.mud-snackbar.gx-snackbar-update {
		position: fixed;
		top: auto;
		right: max(0.5rem, env(safe-area-inset-right, 0px));
		bottom: calc(68px + env(safe-area-inset-bottom, 0px));
		margin: 0;
		max-width: min(500px, calc(100vw - 1rem));
	}

	body:has(.graphite-running-timer-bar) .mud-snackbar.gx-snackbar-update {
		bottom: calc(124px + env(safe-area-inset-bottom, 0px));
	}
}

@media (max-width: 599.98px) {
	.mud-snackbar-location-bottom-right,
	.mud-snackbar-location-bottom-left {
		right: max(0.5rem, env(safe-area-inset-right, 0px)) !important;
		left: max(0.5rem, env(safe-area-inset-left, 0px)) !important;
	}

	.mud-snackbar.gx-snackbar-update {
		left: max(0.5rem, env(safe-area-inset-left, 0px));
		max-width: none;
	}
}

/* ── Connessione assente. Desktop: in basso, sotto i dialog MudBlazor. Shell mobile: in alto e sopra i dialog a schermo
   intero, con pagina, dialog e avvisi che gli fanno spazio (in basso copriva la barra del timer e spariva dietro
   i dialog). Classe sul body e --gx-offline-banner-height arrivano da app.js. ── */
.gx-offline-banner {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 1350;
	display: none;
	padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
	background: var(--mud-palette-warning, #c2410c);
	color: var(--mud-palette-warning-text, #fff);
	font-size: 0.875rem;
	font-weight: 600;
	text-align: center;
	box-shadow: 0 0.25rem 1rem rgba(15, 23, 42, 0.25);
}

.gx-offline-banner--visible {
	display: block;
}

@media (min-width: 960px) {
	/* con il banner visibile i toast in basso salgono sopra di lui */
	body.gx-offline-banner-shown :is(.mud-snackbar-location-bottom-right, .mud-snackbar-location-bottom-center, .mud-snackbar-location-bottom-left) {
		bottom: calc(var(--gx-offline-banner-height, 0px) + 0.75rem) !important;
	}
}

@media (max-width: 959.98px) {
	.gx-offline-banner {
		top: 0;
		bottom: auto;
		z-index: 1450;
		padding: calc(0.5rem + env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) 0.5rem max(1rem, env(safe-area-inset-left, 0px));
	}

	body.gx-offline-banner-shown .graphite-main {
		--graphite-shell-main-padding-top: var(--gx-offline-banner-height, 0px);
	}

	/* anche il pannello filtri laterale e la pagina di accesso partono sotto il banner */
	body.gx-offline-banner-shown .mud-drawer.mud-drawer-temporary:is(.mud-drawer-pos-left, .mud-drawer-pos-right) {
		top: var(--gx-offline-banner-height, 0px);
		height: calc(100% - var(--gx-offline-banner-height, 0px));
	}

	body.gx-offline-banner-shown .graphite-auth-shell {
		padding-top: calc(1rem + var(--gx-offline-banner-height, 0px));
	}

	/* fondo del pannello filtri laterale sopra l'indicatore Home dell'iPhone */
	.graphite-responsive-filter-drawer .mud-drawer-content {
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}
}

/* stesse condizioni dei dialog a schermo intero (sopra); da 960 in su il banner è in basso e non serve spazio */
@media (max-width: 599.98px), (max-height: 480px) and (max-width: 959.98px) {
	/* dialog a schermo intero: titolo e X restano sotto il banner, non dietro */
	body.gx-offline-banner-shown .mud-dialog-container .mud-dialog:not(.gx-dialog-compact, .mud-dialog-width-xs) {
		padding-top: var(--gx-offline-banner-height, 0px);
	}
}

/* ── Avvio con sessione valida ma server non raggiungibile (Routes.razor): schermata con "Riprova" al posto del login.
   Sta fuori dai layout, senza tema MudBlazor: colori di sistema, chiari o scuri come il dispositivo. ── */
.gx-startup-unreachable {
	color-scheme: light dark;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 1.5rem;
	box-sizing: border-box;
	background: Canvas;
	color: CanvasText;
	font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	text-align: center;
}

.gx-startup-unreachable__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

.gx-startup-unreachable__text {
	margin: 0;
	max-width: 22rem;
	font-size: 0.95rem;
	line-height: 1.5;
}

.gx-startup-unreachable__retry {
	min-width: 10rem;
	min-height: 2.75rem;
	padding: 0 1.5rem;
	border: 0;
	border-radius: 0.5rem;
	background: #134ca9;
	color: #fff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.gx-startup-unreachable__retry:disabled {
	opacity: 0.6;
	cursor: progress;
}

/* via d'uscita se il collegamento non torna: lascia la sessione di questo dispositivo e va al login */
.gx-startup-unreachable__signin {
	min-height: 2.75rem;
	padding: 0 1rem;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.gx-startup-unreachable :is(.gx-startup-unreachable__retry, .gx-startup-unreachable__signin):focus-visible {
	outline: 2px solid CanvasText;
	outline-offset: 2px;
}

/* ── r3 Chip di stato: palette fissa e tonale (sfondo tenue + testo pieno), uguale in chiaro e scuro ──
   Il testo mescola il tono col colore del testo del tema: piu' scuro in chiaro, piu' chiaro in scuro.
   Funziona anche nei dialog e nei popover, che stanno fuori dalla shell. */
:root {
	--gx-tone-ok: #16a34a;
	--gx-tone-pending: #d97706;
	--gx-tone-error: #dc2626;
	--gx-tone-neutral: #64748b;
	--gx-tone-info: #2563eb;
}

.gx-status-chip--approved { --gx-tone: var(--gx-tone-ok); }
.gx-status-chip--pending { --gx-tone: var(--gx-tone-pending); }
.gx-status-chip--rejected { --gx-tone: var(--gx-tone-error); }
.gx-status-chip--neutral { --gx-tone: var(--gx-tone-neutral); }
.gx-status-chip--info { --gx-tone: var(--gx-tone-info); }

.mud-chip.gx-status-chip {
	height: 26px;
	margin: 0;
	padding-inline: 0.6rem;
	border: 0;
	border-radius: 999px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: color-mix(in srgb, var(--gx-tone) 62%, var(--mud-palette-text-primary));
	background-color: color-mix(in srgb, var(--gx-tone) 18%, transparent);
	--mud-ripple-color: var(--gx-tone) !important;
}

.mud-chip.gx-status-chip .mud-chip-icon {
	color: inherit;
	font-size: 1rem;
	margin-inline-end: 0.25rem;
}

/* ── r5 Dialog standard: X in alto (CloseButton), corpo che scorre, piede "Annulla" a sinistra e verbo a destra ──
   Componente: GxDialogActions dentro <DialogActions>; opzioni: GxDialogOptions.Standard()/Compact(). */
.mud-dialog .mud-dialog-actions > .gx-dialog-actions__cancel {
	margin-right: auto !important;
}

.mud-dialog .mud-dialog-actions > .gx-dialog-actions__primary {
	min-width: 6.5rem;
}

/* ── d9 Numeri in tabella: cifre allineate (tabular-nums), mai a capo; .gx-num anche a destra.
   Uso: CellClass="gx-num" HeaderClass="gx-num" sulle colonne di ore, importi, km; .gx-tabular per orari e date. ── */
.gx-num,
.gx-tabular {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.gx-num {
	text-align: right;
}

/* specificità più alta dell'allineamento di .mud-table-cell, a prescindere dall'ordine dei fogli */
.mud-table-cell.gx-num {
	text-align: right;
}

.mud-table-cell.gx-num .column-header {
	justify-content: flex-end;
}

/* ── d6 Taglie dialog: piccolo 480 / medio 640 / grande 960 (GxDialogOptions.Small/Medium/Large → xs/sm/md di MudBlazor).
   Su telefono valgono le regole a schermo intero/compatte sopra (con !important). ── */
.mud-dialog.mud-dialog-width-xs {
	max-width: 480px;
}

.mud-dialog.mud-dialog-width-sm {
	max-width: 640px;
}

/* ── r8 Touch target >= 44px su telefono e su ogni schermo touch (tablet in verticale e in orizzontale): pulsanti nei
   dialog, nelle liste mobili, nelle card e nell'intestazione.
   Esclusi calendari/orologi dei picker, adornment dei campi, tab e paginazione/intestazioni delle tabelle: hanno griglie proprie e si romperebbero. ── */
@media (max-width: 599.98px), (pointer: coarse) {
	.mud-dialog .mud-dialog-actions .mud-button-root:not(.mud-icon-button),
	.graphite-scroll-data-view__mobile-viewport .mud-button-root:not(.mud-icon-button),
	.gx-list-card .mud-button-root:not(.mud-icon-button) {
		min-height: 2.75rem;
	}

	:is(.mud-dialog, .graphite-scroll-data-view__mobile-viewport, .gx-list-card, .gx-operational-header)
		.mud-icon-button:not(:is(.mud-picker, .mud-picker-content, .mud-input-adornment, .mud-tabs-scroll-button, .mud-chip, .mud-input-control, .mud-table-pagination-actions, .mud-table-head) *) {
		min-width: 2.75rem;
		min-height: 2.75rem;
	}

	.mud-dialog .mud-dialog-title .mud-button-close {
		min-width: 2.75rem;
		min-height: 2.75rem;
	}

	/* voci dei menu a comparsa (⋮) */
	.mud-popover .mud-menu-item {
		min-height: 2.75rem;
	}
}

/* ── v2/v3/r2 Schermi touch (pointer: coarse), a qualunque larghezza: tutto ciò che si tocca è alto almeno 44px.
   Con il mouse non cambia nulla. Restano fuori calendari e orologi dei picker, schede e paginazione delle tabelle. ── */
@media (pointer: coarse) {
	/* pulsanti con testo, anche piccoli (erano alti 31-37) */
	.mud-button-root.mud-button:not(:is(.mud-picker, .mud-picker-content, .mud-picker-toolbar, .mud-input-numeric-spin, .mud-table-pagination, .mud-pagination) *) {
		min-height: 2.75rem;
	}

	/* pulsanti solo icona: info, azioni di riga, X degli avvisi */
	.mud-icon-button:not(:is(.mud-picker, .mud-picker-content, .mud-picker-toolbar, .mud-input-adornment, .mud-tabs-scroll-button, .mud-chip, .mud-input-control, .mud-table-pagination-actions, .mud-pagination, .mud-table-head) *) {
		min-width: 2.75rem;
		min-height: 2.75rem;
	}

	/* la X di avvisi e messaggi cresce senza alzare il riquadro */
	.mud-alert .mud-alert-close-button,
	.mud-snackbar .mud-snackbar-close-button {
		margin-block: -0.375rem;
	}

	/* «Svuota», freccia delle tendine e icona del calendario dentro i campi: più grandi, campo alto come prima */
	.mud-input-adornment .mud-icon-button {
		min-width: 2.75rem;
		min-height: 2.75rem;
		margin-block: -0.5rem;
	}

	/* caselle di spunta (quelle dense erano 32×32): area di tocco da 44px, riga alta come prima */
	.mud-checkbox > .mud-icon-button {
		min-width: 2.75rem;
		min-height: 2.75rem;
	}

	.mud-checkbox > .mud-icon-button.mud-checkbox-dense {
		margin: -6px;
	}

	/* frecce dei campi numerici (22×20, una sopra l'altra): col dito non si prendono e la tastiera numerica c'è già */
	.mud-input-control.mud-input-number-control .mud-input-numeric-spin {
		display: none;
	}

	/* tabelle dense: pulsanti e icone delle righe hanno il bersaglio da 44px senza alzare le righe (da ~33 a ~57px) */
	.mud-table-body .mud-table-cell .mud-button-root.mud-button {
		margin-block: -0.375rem;
	}

	.mud-table-body .mud-table-cell .mud-icon-button:not(.mud-checkbox *) {
		margin-block: -0.625rem;
	}

	/* barra filtri del desktop: con chip e pulsanti da 44px i tetti di prima creavano uno scorrimento interno */
	.graphite-shell,
	.graphite-shell.graphite-shell-tight-ui {
		--gx-filterbar-max-h: clamp(4.5rem, 30vh, 12rem);
		--gx-filterbar-chips-h: 3.75rem;
	}

	/* chip cliccabili (le scelte rapide del periodo erano alte 24) */
	.mud-chip.mud-clickable {
		min-height: 2.75rem;
		padding-inline: 1rem;
		border-radius: 999px;
	}

	/* voci dei menu a comparsa, delle tendine e del menu laterale (erano alte 36) */
	.mud-popover .mud-menu-item,
	.mud-popover .mud-list-item,
	.mud-navmenu .mud-nav-link {
		min-height: 2.75rem;
	}

	.mud-navmenu .mud-nav-link {
		align-items: center;
	}
}

/* ── v2 Tablet in verticale e telefono in orizzontale (layout telefono oltre i 600px): contenuto in una colonna
   centrata da 640px invece di pulsanti e card larghi quanto lo schermo. Lo scorrimento resta a tutta larghezza. ── */
@media (min-width: 600px) and (max-width: 959.98px) {
	.graphite-main-content {
		padding-inline: max(var(--graphite-shell-content-padding), calc((100% - 40rem) / 2));
	}
}

/* ── r4 Menu laterale: segno di focus visibile da tastiera (MudBlazor mette solo uno sfondo appena percettibile) ── */
.mud-navmenu .mud-nav-link:focus-visible {
	outline: 2px solid var(--mud-palette-primary);
	outline-offset: -2px;
}

/* Hub admin (d4): l'azione principale della scheda attiva in fondo alla riga delle schede, senza tagli */
.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-content {
	min-width: 0;
}

.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-header-after {
	flex: 0 0 auto;
	width: auto;
}

/* Su telefono le schede tengono tutta la riga: l'azione della scheda va sotto, a destra */
@media (max-width: 599.98px) {
	.admin-hub-tabs > .mud-tabs-tabbar,
	.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-inner {
		height: auto;
	}

	.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-inner {
		flex-wrap: wrap;
	}

	.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-content {
		flex: 1 1 0;
	}

	.admin-hub-tabs > .mud-tabs-tabbar .mud-tabs-header-after {
		flex: 1 0 100%;
		justify-content: flex-end;
		padding-block: 0.25rem;
	}
}

/* Licenze: chiavi e ID tecnici in carattere a spaziatura fissa (anche dentro i campi MudBlazor dei dialog) */
.licensing-key,
.licensing-key input,
.licensing-key textarea {
	font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
	font-size: 0.8125rem;
	overflow-wrap: anywhere;
}
